+2018-06-07 Pedro Alves <palves@redhat.com>
+
+ * target.h (target_stack): Delete.
+ (current_top_target): Declare function.
+ * target.c (target_stack): Delete.
+ (g_current_top_target): New.
+ (current_top_target): New function.
+ * auxv.c: Use current_top_target instead of target_stack
+ throughout.
+ * avr-tdep.c: Likewise.
+ * breakpoint.c: Likewise.
+ * corefile.c: Likewise.
+ * elfread.c: Likewise.
+ * eval.c: Likewise.
+ * exceptions.c: Likewise.
+ * frame.c: Likewise.
+ * gdbarch-selftests.c: Likewise.
+ * gnu-v3-abi.c: Likewise.
+ * ia64-tdep.c: Likewise.
+ * ia64-vms-tdep.c: Likewise.
+ * infcall.c: Likewise.
+ * infcmd.c: Likewise.
+ * infrun.c: Likewise.
+ * linespec.c: Likewise.
+ * linux-tdep.c: Likewise.
+ * minsyms.c: Likewise.
+ * ppc-linux-nat.c: Likewise.
+ * ppc-linux-tdep.c: Likewise.
+ * procfs.c: Likewise.
+ * regcache.c: Likewise.
+ * remote.c: Likewise.
+ * rs6000-tdep.c: Likewise.
+ * s390-linux-nat.c: Likewise.
+ * s390-tdep.c: Likewise.
+ * solib-aix.c: Likewise.
+ * solib-darwin.c: Likewise.
+ * solib-dsbt.c: Likewise.
+ * solib-spu.c: Likewise.
+ * solib-svr4.c: Likewise.
+ * solib-target.c: Likewise.
+ * sparc-tdep.c: Likewise.
+ * sparc64-tdep.c: Likewise.
+ * spu-tdep.c: Likewise.
+ * symfile.c: Likewise.
+ * symtab.c: Likewise.
+ * target-descriptions.c: Likewise.
+ * target-memory.c: Likewise.
+ * target.c: Likewise.
+ * target.h: Likewise.
+ * tracefile-tfile.c: Likewise.
+ * tracepoint.c: Likewise.
+ * valops.c: Likewise.
+ * valprint.c: Likewise.
+ * value.c: Likewise.
+ * windows-tdep.c: Likewise.
+ * mi/mi-main.c: Likewise.
+
2018-06-07 Tom Tromey <tom@tromey.com>
* valprint.h (build_address_symbolic): Declare.
if (gdbarch_auxv_parse_p (gdbarch))
return gdbarch_auxv_parse (gdbarch, readptr, endptr, typep, valp);
- return target_stack->auxv_parse (readptr, endptr, typep, valp);
+ return current_top_target ()->auxv_parse (readptr, endptr, typep, valp);
}
error (_("The program has no auxiliary information now."));
else
{
- int ents = fprint_target_auxv (gdb_stdout, target_stack);
+ int ents = fprint_target_auxv (gdb_stdout, current_top_target ());
if (ents < 0)
error (_("No auxiliary vector found, or failed reading it."));
/* Find out how many io registers the target has. */
gdb::optional<gdb::byte_vector> buf
- = target_read_alloc (target_stack, TARGET_OBJECT_AVR, "avr.io_reg");
+ = target_read_alloc (current_top_target (), TARGET_OBJECT_AVR, "avr.io_reg");
if (!buf)
{
j = nreg - i; /* last block is less than 8 registers */
snprintf (query, sizeof (query) - 1, "avr.io_reg:%x,%x", i, j);
- buf = target_read_alloc (target_stack, TARGET_OBJECT_AVR, query);
+ buf = target_read_alloc (current_top_target (), TARGET_OBJECT_AVR, query);
if (!buf)
{
}
addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->exception_msym);
- addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, target_stack);
+ addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr,
+ current_top_target ());
b = create_internal_breakpoint (gdbarch, addr, bp_exception_master,
&internal_breakpoint_ops);
initialize_explicit_location (&explicit_loc);
return 0;
}
- if (!target_stopped_data_address (target_stack, &addr))
+ if (!target_stopped_data_address (current_top_target (), &addr))
{
/* We were stopped by a watchpoint, but we don't know where.
Mark all watchpoints as unknown. */
}
}
/* Exact match not required. Within range is sufficient. */
- else if (target_watchpoint_addr_within_range (target_stack,
+ else if (target_watchpoint_addr_within_range (current_top_target (),
addr, loc->address,
loc->length))
{
enum target_xfer_status status;
ULONGEST xfered_len;
- status = target_xfer_partial (target_stack, object, NULL,
+ status = target_xfer_partial (current_top_target (), object, NULL,
myaddr + xfered, NULL,
memaddr + xfered, len - xfered,
&xfered_len);
if (target_read_memory (pointer_address, buf, ptr_size) != 0)
continue;
addr = extract_typed_address (buf, ptr_type);
- addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, target_stack);
+ addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr,
+ current_top_target ());
addr = gdbarch_addr_bits_remove (gdbarch, addr);
if (elf_gnu_ifunc_record_cache (name, addr))
parameter. FUNCTION is the function entry address. ADDRESS may be a
function descriptor. */
- target_auxv_search (target_stack, AT_HWCAP, &hwcap);
+ target_auxv_search (current_top_target (), AT_HWCAP, &hwcap);
hwcap_val = value_from_longest (builtin_type (gdbarch)
->builtin_unsigned_long, hwcap);
address_val = call_function_by_hand (function, NULL, 1, &hwcap_val);
address = value_as_address (address_val);
- address = gdbarch_convert_from_func_ptr_addr (gdbarch, address, target_stack);
+ address = gdbarch_convert_from_func_ptr_addr (gdbarch, address, current_top_target ());
address = gdbarch_addr_bits_remove (gdbarch, address);
if (name_at_pc)
resolved_address = value_as_address (value);
resolved_pc = gdbarch_convert_from_func_ptr_addr (gdbarch,
resolved_address,
- target_stack);
+ current_top_target ());
resolved_pc = gdbarch_addr_bits_remove (gdbarch, resolved_pc);
gdb_assert (current_program_space == b->pspace || b->pspace == NULL);
/* The address might point to a function descriptor;
resolve it to the actual code address instead. */
addr = gdbarch_convert_from_func_ptr_addr (exp->gdbarch, addr,
- target_stack);
+ current_top_target ());
/* Is it a high_level symbol? */
sym = find_pc_function (addr);
stack, the NULL check is needed here because we can get here very
early during startup, before the target stack is first
initialized. */
- if (target_stack != NULL && target_supports_terminal_ours ())
+ if (current_top_target () != NULL && target_supports_terminal_ours ())
{
term_state.emplace ();
target_terminal::ours_for_output ();
returned. */
maddr = gdbarch_convert_from_func_ptr_addr (get_frame_arch (this_frame),
BMSYMBOL_VALUE_ADDRESS (msymbol),
- target_stack);
+ current_top_target ());
return maddr == get_frame_func (this_frame);
}
/* Error out if debugging something, because we're going to push the
test target, which would pop any existing target. */
- if (target_stack->to_stratum >= process_stratum)
+ if (current_top_target ()->to_stratum >= process_stratum)
error (_("target already pushed"));
/* Create a mock environment. An inferior with a thread, with a
of the real function from the function descriptor before passing on
the address to other layers of GDB. */
func_addr = gdbarch_convert_from_func_ptr_addr (gdbarch, method_stop_pc,
- target_stack);
+ current_top_target ());
if (func_addr != 0)
method_stop_pc = func_addr;
we should find a way to override the corefile layer's
xfer_partial method. */
- x = target_read_alloc (target_stack, TARGET_OBJECT_UNWIND_TABLE,
+ x = target_read_alloc (current_top_target (), TARGET_OBJECT_UNWIND_TABLE,
NULL, buf_p);
return x;
CORE_ADDR table_addr;
unsigned int info_len;
- res = target_read (target_stack, TARGET_OBJECT_OPENVMS_UIB,
+ res = target_read (current_top_target (), TARGET_OBJECT_OPENVMS_UIB,
annex + 2, buf, 0, sizeof (buf));
if (res != sizeof (buf))
if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
|| TYPE_CODE (ftype) == TYPE_CODE_METHOD)
funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
- target_stack);
+ current_top_target ());
}
if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
|| TYPE_CODE (ftype) == TYPE_CODE_METHOD)
funaddr = value_as_address (value_addr (function));
nfunaddr = funaddr;
- funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
- target_stack);
+ funaddr
+ = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
+ current_top_target ());
if (funaddr != nfunaddr)
found_descriptor = 1;
}
/* Pass zero for FROM_TTY, because at this point the "run" command
has done its thing; now we are setting up the running program. */
- post_create_inferior (target_stack, 0);
+ post_create_inferior (current_top_target (), 0);
/* Queue a pending event so that the program stops immediately. */
if (run_how == RUN_STOP_AT_FIRST_INSN)
ensure_not_running ();
}
- prepare_execution_command (target_stack, async_exec);
+ prepare_execution_command (current_top_target (), async_exec);
if (from_tty)
printf_filtered (_("Continuing.\n"));
= strip_bg_char (count_string, &async_exec);
count_string = stripped.get ();
- prepare_execution_command (target_stack, async_exec);
+ prepare_execution_command (current_top_target (), async_exec);
count = count_string ? parse_and_eval_long (count_string) : 1;
gdb::unique_xmalloc_ptr<char> stripped = strip_bg_char (arg, &async_exec);
arg = stripped.get ();
- prepare_execution_command (target_stack, async_exec);
+ prepare_execution_command (current_top_target (), async_exec);
if (!arg)
error_no_arg (_("starting address"));
= strip_bg_char (signum_exp, &async_exec);
signum_exp = stripped.get ();
- prepare_execution_command (target_stack, async_exec);
+ prepare_execution_command (current_top_target (), async_exec);
if (!signum_exp)
error_no_arg (_("signal number"));
gdb::unique_xmalloc_ptr<char> stripped = strip_bg_char (arg, &async_exec);
arg = stripped.get ();
- prepare_execution_command (target_stack, async_exec);
+ prepare_execution_command (current_top_target (), async_exec);
if (arg)
until_break_command (arg, from_tty, 0);
gdb::unique_xmalloc_ptr<char> stripped = strip_bg_char (arg, &async_exec);
arg = stripped.get ();
- prepare_execution_command (target_stack, async_exec);
+ prepare_execution_command (current_top_target (), async_exec);
until_break_command (arg, from_tty, 1);
}
gdb::unique_xmalloc_ptr<char> stripped = strip_bg_char (arg, &async_exec);
arg = stripped.get ();
- prepare_execution_command (target_stack, async_exec);
+ prepare_execution_command (current_top_target (), async_exec);
if (arg)
error (_("The \"finish\" command does not take any arguments."));
/* Take any necessary post-attaching actions for this platform. */
target_post_attach (ptid_get_pid (inferior_ptid));
- post_create_inferior (target_stack, from_tty);
+ post_create_inferior (current_top_target (), from_tty);
}
/* What to do after the first program stops after attaching. */
/* Now that the inferior has stopped, do any bookkeeping like
loading shared libraries. We want to do this before normal_stop,
so that the displayed frame is up to date. */
- post_create_inferior (target_stack, from_tty);
+ post_create_inferior (current_top_target (), from_tty);
normal_stop ();
}
fprintf_unfiltered (gdb_stdlog, "infrun: stopped by watchpoint\n");
- if (target_stopped_data_address (target_stack, &addr))
+ if (target_stopped_data_address (current_top_target (), &addr))
fprintf_unfiltered (gdb_stdlog,
"infrun: stopped data address = %s\n",
paddress (gdbarch, addr));
validate_registers_access ();
transferred =
- target_read (target_stack, TARGET_OBJECT_SIGNAL_INFO,
+ target_read (current_top_target (), TARGET_OBJECT_SIGNAL_INFO,
NULL,
value_contents_all_raw (v),
value_offset (v),
vice versa. */
validate_registers_access ();
- transferred = target_write (target_stack,
+ transferred = target_write (current_top_target (),
TARGET_OBJECT_SIGNAL_INFO,
NULL,
value_contents_all_raw (fromval),
siginfo_data = (gdb_byte *) xmalloc (len);
back_to = make_cleanup (xfree, siginfo_data);
- if (target_read (target_stack, TARGET_OBJECT_SIGNAL_INFO, NULL,
+ if (target_read (current_top_target (), TARGET_OBJECT_SIGNAL_INFO, NULL,
siginfo_data, 0, len) == len)
discard_cleanups (back_to);
else
struct type *type = gdbarch_get_siginfo_type (gdbarch);
/* Errors ignored. */
- target_write (target_stack, TARGET_OBJECT_SIGNAL_INFO, NULL,
+ target_write (current_top_target (), TARGET_OBJECT_SIGNAL_INFO, NULL,
inf_state->siginfo_data, 0, TYPE_LENGTH (type));
}
= (gdbarch_convert_from_func_ptr_addr
(gdbarch,
msym_addr,
- target_stack));
+ current_top_target ()));
}
if (msym_addr == addr)
{
CORE_ADDR dummy;
- return (target_auxv_search (target_stack, AT_NULL, &dummy) > 0
- && target_auxv_search (target_stack, AT_PAGESZ, &dummy) == 0);
+ return (target_auxv_search (current_top_target (), AT_NULL, &dummy) > 0
+ && target_auxv_search (current_top_target (), AT_PAGESZ, &dummy) == 0);
}
static int
/* Determine list of SPU ids. */
gdb::optional<gdb::byte_vector>
- spu_ids = target_read_alloc (target_stack, TARGET_OBJECT_SPU, NULL);
+ spu_ids = target_read_alloc (current_top_target (),
+ TARGET_OBJECT_SPU, NULL);
if (!spu_ids)
return note_data;
xsnprintf (annex, sizeof annex, "%d/%s", fd, spu_files[j]);
gdb::optional<gdb::byte_vector> spu_data
- = target_read_alloc (target_stack, TARGET_OBJECT_SPU, annex);
+ = target_read_alloc (current_top_target (), TARGET_OBJECT_SPU, annex);
if (spu_data && !spu_data->empty ())
{
gdb::byte_vector buf (TYPE_LENGTH (siginfo_type));
- bytes_read = target_read (target_stack, TARGET_OBJECT_SIGNAL_INFO, NULL,
+ bytes_read = target_read (current_top_target (), TARGET_OBJECT_SIGNAL_INFO, NULL,
buf.data (), 0, TYPE_LENGTH (siginfo_type));
if (bytes_read != TYPE_LENGTH (siginfo_type))
buf.clear ();
/* Auxillary vector. */
gdb::optional<gdb::byte_vector> auxv =
- target_read_alloc (target_stack, TARGET_OBJECT_AUXV, NULL);
+ target_read_alloc (current_top_target (), TARGET_OBJECT_AUXV, NULL);
if (auxv && !auxv->empty ())
{
note_data = elfcore_write_note (obfd, note_data, note_size,
char filename[100];
long pid;
- if (target_auxv_search (target_stack, AT_SYSINFO_EHDR, &range->start) <= 0)
+ if (target_auxv_search (current_top_target (), AT_SYSINFO_EHDR, &range->start) <= 0)
return 0;
/* It doesn't make sense to access the host's /proc when debugging a
local-store address and is thus not usable as displaced stepping
location. The auxiliary vector gets us the PowerPC-side entry
point address instead. */
- if (target_auxv_search (target_stack, AT_ENTRY, &addr) <= 0)
+ if (target_auxv_search (current_top_target (), AT_ENTRY, &addr) <= 0)
throw_error (NOT_SUPPORTED_ERROR,
_("Cannot find AT_ENTRY auxiliary vector entry."));
/* Make certain that the address points at real code, and not a
function descriptor. */
addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr,
- target_stack);
+ current_top_target ());
/* Inferior calls also use the entry point as a breakpoint location.
We don't want displaced stepping to interfere with those
static void
exec_continue (char **argv, int argc)
{
- prepare_execution_command (target_stack, mi_async_p ());
+ prepare_execution_command (current_top_target (), mi_async_p ());
if (non_stop)
{
gdb::byte_vector mbuf (total_bytes);
- nr_bytes = target_read (target_stack, TARGET_OBJECT_MEMORY, NULL, mbuf.data (),
- addr, total_bytes);
+ nr_bytes = target_read (current_top_target (), TARGET_OBJECT_MEMORY, NULL,
+ mbuf.data (), addr, total_bytes);
if (nr_bytes <= 0)
error (_("Unable to read memory."));
length = atol (argv[1]);
std::vector<memory_read_result> result
- = read_memory_robust (target_stack, addr, length);
+ = read_memory_robust (current_top_target (), addr, length);
if (result.size () == 0)
error (_("Unable to read memory."));
case mst_data_gnu_ifunc:
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
- CORE_ADDR pc = gdbarch_convert_from_func_ptr_addr (gdbarch, msym_addr,
- target_stack);
+ CORE_ADDR pc
+ = gdbarch_convert_from_func_ptr_addr (gdbarch, msym_addr,
+ current_top_target ());
if (pc != msym_addr)
{
if (func_address_p != NULL)
{
CORE_ADDR field;
- if (target_auxv_search (target_stack, AT_HWCAP, &field) != 1)
+ if (target_auxv_search (current_top_target (), AT_HWCAP, &field) != 1)
return 0;
return field;
/* Look up cached address of thread-local variable. */
if (!ptid_equal (spe_context_cache_ptid, inferior_ptid))
{
- struct target_ops *target = target_stack;
+ struct target_ops *target = current_top_target ();
TRY
{
return 0;
xsnprintf (annex, sizeof annex, "%d/regs", data.id);
- if (target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ if (target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
data.gprs, 0, sizeof data.gprs)
== sizeof data.gprs)
{
&thread_args);
note_data = thread_args.note_data;
- auxv_len = target_read_alloc (target_stack, TARGET_OBJECT_AUXV,
+ auxv_len = target_read_alloc (current_top_target (), TARGET_OBJECT_AUXV,
NULL, &auxv);
if (auxv_len > 0)
{
{
/* Error out if debugging something, because we're going to push the
test target, which would pop any existing target. */
- if (target_stack->to_stratum >= process_stratum)
+ if (current_top_target ()->to_stratum >= process_stratum)
error (_("target already pushed"));
/* Create a mock environment. An inferior with a thread, with a
{
/* Error out if debugging something, because we're going to push the
test target, which would pop any existing target. */
- if (target_stack->to_stratum >= process_stratum)
+ if (current_top_target ()->to_stratum >= process_stratum)
error (_("target already pushed"));
/* Create a mock environment. A process_stratum target pushed. */
instead of any data function descriptor. */
sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
sym_addr,
- target_stack);
+ current_top_target ());
xsnprintf (msg, get_remote_packet_size (), "qSymbol:%s:%s",
phex_nz (sym_addr, addr_size), &reply[8]);
{
std::vector<mem_region> result;
gdb::optional<gdb::char_vector> text
- = target_read_stralloc (target_stack, TARGET_OBJECT_MEMORY_MAP, NULL);
+ = target_read_stralloc (current_top_target (), TARGET_OBJECT_MEMORY_MAP, NULL);
if (text)
result = parse_memory_map (text->data ());
remote_target::traceframe_info ()
{
gdb::optional<gdb::char_vector> text
- = target_read_stralloc (target_stack, TARGET_OBJECT_TRACEFRAME_INFO,
+ = target_read_stralloc (current_top_target (), TARGET_OBJECT_TRACEFRAME_INFO,
NULL);
if (text)
return parse_traceframe_info (text->data ());
btrace_read_config (struct btrace_config *conf)
{
gdb::optional<gdb::char_vector> xml
- = target_read_stralloc (target_stack, TARGET_OBJECT_BTRACE_CONF, "");
+ = target_read_stralloc (current_top_target (), TARGET_OBJECT_BTRACE_CONF, "");
if (xml)
parse_xml_btrace_conf (conf, xml->data ());
}
}
gdb::optional<gdb::char_vector> xml
- = target_read_stralloc (target_stack, TARGET_OBJECT_BTRACE, annex);
+ = target_read_stralloc (current_top_target (), TARGET_OBJECT_BTRACE, annex);
if (!xml)
return BTRACE_ERR_UNKNOWN;
xsnprintf (annex, annex_size, "%x", pid);
}
- filename = target_read_stralloc (target_stack,
+ filename = target_read_stralloc (current_top_target (),
TARGET_OBJECT_EXEC_FILE, annex);
return filename ? filename->data () : nullptr;
return 0;
case 1014: /* Data Cache Block set to Zero */
- if (target_auxv_search (target_stack, AT_DCACHEBSIZE, &at_dcsz) <= 0
+ if (target_auxv_search (current_top_target (), AT_DCACHEBSIZE, &at_dcsz) <= 0
|| at_dcsz == 0)
at_dcsz = 128; /* Assume 128-byte cache line size (POWER8) */
{
CORE_ADDR hwcap = 0;
- target_auxv_search (target_stack, AT_HWCAP, &hwcap);
+ target_auxv_search (current_top_target (), AT_HWCAP, &hwcap);
have_regset_tdb = (hwcap & HWCAP_S390_TE)
&& check_regset (tid, NT_S390_TDB, s390_sizeof_tdbregset);
if (pv_is_constant (addr))
{
struct target_section *secp;
- secp = target_section_by_addr (target_stack, addr.k);
+ secp = target_section_by_addr (current_top_target (), addr.k);
if (secp != NULL
&& (bfd_get_section_flags (secp->the_bfd_section->owner,
secp->the_bfd_section)
return data->library_list;
gdb::optional<gdb::char_vector> library_document
- = target_read_stralloc (target_stack, TARGET_OBJECT_LIBRARIES_AIX,
+ = target_read_stralloc (current_top_target (), TARGET_OBJECT_LIBRARIES_AIX,
NULL);
if (!library_document && warning_msg != NULL)
{
if (TYPE_LENGTH (ptr_type) > sizeof (buf))
return;
- len = target_read (target_stack, TARGET_OBJECT_DARWIN_DYLD_INFO, NULL,
- buf, 0, TYPE_LENGTH (ptr_type));
+ len = target_read (current_top_target (), TARGET_OBJECT_DARWIN_DYLD_INFO,
+ NULL, buf, 0, TYPE_LENGTH (ptr_type));
if (len <= 0)
return;
{
struct dsbt_info *info = get_dsbt_info ();
gdb::optional<gdb::byte_vector> buf
- = target_read_alloc (target_stack, TARGET_OBJECT_FDPIC, "exec");
+ = target_read_alloc (current_top_target (), TARGET_OBJECT_FDPIC, "exec");
if (!buf || buf->empty ())
{
if (solib_dsbt_debug)
dsbt_print_loadmap (info->exec_loadmap);
- buf = target_read_alloc (target_stack, TARGET_OBJECT_FDPIC, "exec");
+ buf = target_read_alloc (current_top_target (), TARGET_OBJECT_FDPIC, "exec");
if (!buf || buf->empty ())
{
info->interp_loadmap = NULL;
;
/* Determine list of SPU ids. */
- size = target_read (target_stack, TARGET_OBJECT_SPU, NULL,
+ size = target_read (current_top_target (), TARGET_OBJECT_SPU, NULL,
buf, 0, sizeof buf);
/* Do not add stand-alone SPE executable context as shared library,
already created the SPE context, but not installed the object-id
yet. Skip such entries; we'll be back for them later. */
xsnprintf (annex, sizeof annex, "%d/object-id", fd);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
(gdb_byte *) id, 0, sizeof id);
if (len <= 0 || len >= sizeof id)
continue;
CORE_ADDR addr = BMSYMBOL_VALUE_ADDRESS (spe_event_sym);
addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (), addr,
- target_stack);
+ current_top_target ());
create_solib_event_breakpoint (target_gdbarch (), addr);
return 1;
}
int pt_phdr_p = 0;
/* Get required auxv elements from target. */
- if (target_auxv_search (target_stack, AT_PHDR, &at_phdr) <= 0)
+ if (target_auxv_search (current_top_target (), AT_PHDR, &at_phdr) <= 0)
return 0;
- if (target_auxv_search (target_stack, AT_PHENT, &at_phent) <= 0)
+ if (target_auxv_search (current_top_target (), AT_PHENT, &at_phent) <= 0)
return 0;
- if (target_auxv_search (target_stack, AT_PHNUM, &at_phnum) <= 0)
+ if (target_auxv_search (current_top_target (), AT_PHNUM, &at_phnum) <= 0)
return 0;
if (!at_phdr || !at_phnum)
return 0;
/* Fetch the list of shared libraries. */
gdb::optional<gdb::char_vector> svr4_library_document
- = target_read_stralloc (target_stack, TARGET_OBJECT_LIBRARIES_SVR4,
+ = target_read_stralloc (current_top_target (), TARGET_OBJECT_LIBRARIES_SVR4,
annex);
if (!svr4_library_document)
return 0;
struct obj_section *os;
sym_addr = gdbarch_addr_bits_remove
- (target_gdbarch (), gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
- sym_addr,
- target_stack));
+ (target_gdbarch (),
+ gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
+ sym_addr,
+ current_top_target ()));
/* On at least some versions of Solaris there's a dynamic relocation
on _r_debug.r_brk and SYM_ADDR may not be relocated yet, e.g., if
/* If we were not able to find the base address of the loader
from our so_list, then try using the AT_BASE auxilliary entry. */
if (!load_addr_found)
- if (target_auxv_search (target_stack, AT_BASE, &load_addr) > 0)
+ if (target_auxv_search (current_top_target (), AT_BASE, &load_addr) > 0)
{
int addr_bit = gdbarch_addr_bit (target_gdbarch ());
sym_addr = BMSYMBOL_VALUE_ADDRESS (msymbol);
sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
sym_addr,
- target_stack);
+ current_top_target ());
svr4_create_solib_event_breakpoints (target_gdbarch (), sym_addr);
return 1;
}
sym_addr = BMSYMBOL_VALUE_ADDRESS (msymbol);
sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
sym_addr,
- target_stack);
+ current_top_target ());
svr4_create_solib_event_breakpoints (target_gdbarch (), sym_addr);
return 1;
}
if ((bfd_get_file_flags (exec_bfd) & DYNAMIC) == 0)
return 0;
- if (target_auxv_search (target_stack, AT_ENTRY, &entry_point) <= 0)
+ if (target_auxv_search (current_top_target (), AT_ENTRY, &entry_point) <= 0)
return 0;
exec_displacement = entry_point - bfd_get_start_address (exec_bfd);
/* Fetch the list of shared libraries. */
gdb::optional<gdb::char_vector> library_document
- = target_read_stralloc (target_stack, TARGET_OBJECT_LIBRARIES, NULL);
+ = target_read_stralloc (current_top_target (), TARGET_OBJECT_LIBRARIES,
+ NULL);
if (!library_document)
return NULL;
sparc_fetch_wcookie (struct gdbarch *gdbarch)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- struct target_ops *ops = target_stack;
+ struct target_ops *ops = current_top_target ();
gdb_byte buf[8];
int len;
return proc->stat.is_avail;
proc->stat.checked_avail = true;
- if (target_auxv_search (target_stack, AT_ADI_BLKSZ, &value) <= 0)
+ if (target_auxv_search (current_top_target (), AT_ADI_BLKSZ, &value) <= 0)
return false;
proc->stat.blksize = value;
- target_auxv_search (target_stack, AT_ADI_NBITS, &value);
+ target_auxv_search (current_top_target (), AT_ADI_NBITS, &value);
proc->stat.nbits = value;
proc->stat.max_version = (1 << proc->stat.nbits) - 2;
proc->stat.is_avail = true;
return status;
xsnprintf (annex, sizeof annex, "%d/%s", (int) id, regname);
memset (reg, 0, sizeof reg);
- target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
reg, 0, sizeof reg);
ul = strtoulst ((char *) reg, NULL, 16);
if (status != REG_VALID)
return status;
xsnprintf (annex, sizeof annex, "%d/fpcr", (int) id);
- target_read (target_stack, TARGET_OBJECT_SPU, annex, buf, 0, 16);
+ target_read (current_top_target (), TARGET_OBJECT_SPU, annex, buf, 0, 16);
return status;
case SPU_SRR0_REGNUM:
xsnprintf (annex, sizeof annex, "%d/%s", (int) id, regname);
xsnprintf (reg, sizeof reg, "0x%s",
phex_nz (extract_unsigned_integer (buf, 4, byte_order), 4));
- target_write (target_stack, TARGET_OBJECT_SPU, annex,
+ target_write (current_top_target (), TARGET_OBJECT_SPU, annex,
(gdb_byte *) reg, 0, strlen (reg));
}
case SPU_FPSCR_REGNUM:
regcache_raw_read_unsigned (regcache, SPU_ID_REGNUM, &id);
xsnprintf (annex, sizeof annex, "%d/fpcr", (int) id);
- target_write (target_stack, TARGET_OBJECT_SPU, annex, buf, 0, 16);
+ target_write (current_top_target (), TARGET_OBJECT_SPU, annex, buf, 0, 16);
break;
case SPU_SRR0_REGNUM:
id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
xsnprintf (annex, sizeof annex, "%d/event_status", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
buf, 0, (sizeof (buf) - 1));
if (len <= 0)
error (_("Could not read event_status."));
event_status = strtoulst ((char *) buf, NULL, 16);
xsnprintf (annex, sizeof annex, "%d/event_mask", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
buf, 0, (sizeof (buf) - 1));
if (len <= 0)
error (_("Could not read event_mask."));
id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
xsnprintf (annex, sizeof annex, "%d/signal1", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex, buf, 0, 4);
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU,
+ annex, buf, 0, 4);
if (len < 0)
error (_("Could not read signal1."));
else if (len == 4)
}
xsnprintf (annex, sizeof annex, "%d/signal1_type", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
buf, 0, (sizeof (buf) - 1));
if (len <= 0)
error (_("Could not read signal1_type."));
signal1_type = strtoulst ((char *) buf, NULL, 16);
xsnprintf (annex, sizeof annex, "%d/signal2", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex, buf, 0, 4);
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU,
+ annex, buf, 0, 4);
if (len < 0)
error (_("Could not read signal2."));
else if (len == 4)
}
xsnprintf (annex, sizeof annex, "%d/signal2_type", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
buf, 0, (sizeof (buf) - 1));
if (len <= 0)
error (_("Could not read signal2_type."));
ui_out_emit_tuple tuple_emitter (current_uiout, "SPUInfoMailbox");
xsnprintf (annex, sizeof annex, "%d/mbox_info", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
buf, 0, sizeof buf);
if (len < 0)
error (_("Could not read mbox_info."));
"mbox", "SPU Outbound Mailbox");
xsnprintf (annex, sizeof annex, "%d/ibox_info", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
buf, 0, sizeof buf);
if (len < 0)
error (_("Could not read ibox_info."));
"ibox", "SPU Outbound Interrupt Mailbox");
xsnprintf (annex, sizeof annex, "%d/wbox_info", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
buf, 0, sizeof buf);
if (len < 0)
error (_("Could not read wbox_info."));
id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
xsnprintf (annex, sizeof annex, "%d/dma_info", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
buf, 0, 40 + 16 * 32);
if (len <= 0)
error (_("Could not read dma_info."));
id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
xsnprintf (annex, sizeof annex, "%d/proxydma_info", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
buf, 0, 24 + 8 * 32);
if (len <= 0)
error (_("Could not read proxydma_info."));
entry_point
= gdbarch_convert_from_func_ptr_addr (get_objfile_arch (objfile),
entry_point,
- target_stack);
+ current_top_target ());
/* Remove any ISA markers, so that this matches entries in the
symbol table. */
if (MSYMBOL_TYPE (minsym) == mst_data_gnu_ifunc)
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
- msym_addr = gdbarch_convert_from_func_ptr_addr (gdbarch,
- msym_addr,
- target_stack);
+ msym_addr
+ = gdbarch_convert_from_func_ptr_addr (gdbarch,
+ msym_addr,
+ current_top_target ());
}
if (msym_addr == address)
{
/* Next try to read the description from the current target using
target objects. */
if (current_target_desc == NULL)
- current_target_desc = target_read_description_xml (target_stack);
+ current_target_desc = target_read_description_xml (current_top_target ());
/* If that failed try a target-specific hook. */
if (current_target_desc == NULL)
- current_target_desc = target_read_description (target_stack);
+ current_target_desc = target_read_description (current_top_target ());
/* If a non-NULL description was returned, then update the current
architecture. */
{
LONGEST len;
- len = target_write_with_progress (target_stack,
+ len = target_write_with_progress (current_top_target (),
TARGET_OBJECT_MEMORY, NULL,
iter.data, iter.begin,
iter.end - iter.begin,
{
LONGEST len;
- len = target_write_with_progress (target_stack,
+ len = target_write_with_progress (current_top_target (),
TARGET_OBJECT_FLASH, NULL,
iter.data, iter.begin,
iter.end - iter.begin,
/* The target structure we are currently using to talk to a process
or file or whatever "inferior" we have. */
-struct target_ops *target_stack;
+static target_ops *g_current_top_target;
+
+target_ops *
+current_top_target ()
+{
+ return g_current_top_target;
+}
/* Command list for target. */
{
struct target_ops *t;
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
if (t->has_all_memory ())
return 1;
{
struct target_ops *t;
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
if (t->has_memory ())
return 1;
{
struct target_ops *t;
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
if (t->has_stack ())
return 1;
{
struct target_ops *t;
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
if (t->has_registers ())
return 1;
{
struct target_ops *t;
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
if (t->has_execution (the_ptid))
return 1;
void
target_kill (void)
{
- target_stack->kill ();
+ current_top_target ()->kill ();
}
void
target_load (const char *arg, int from_tty)
{
target_dcache_invalidate ();
- target_stack->load (arg, from_tty);
+ current_top_target ()->load (arg, from_tty);
}
/* Define it. */
void
target_terminal::init (void)
{
- target_stack->terminal_init ();
+ current_top_target ()->terminal_init ();
m_terminal_state = target_terminal_state::is_ours;
}
if (inf->terminal_state != target_terminal_state::is_inferior)
{
- target_stack->terminal_inferior ();
+ current_top_target ()->terminal_inferior ();
inf->terminal_state = target_terminal_state::is_inferior;
}
if (inf->terminal_state == target_terminal_state::is_ours_for_output)
{
set_current_inferior (inf);
- target_stack->terminal_inferior ();
+ current_top_target ()->terminal_inferior ();
inf->terminal_state = target_terminal_state::is_inferior;
}
}
if (inf->terminal_state == target_terminal_state::is_inferior)
{
set_current_inferior (inf);
- target_stack->terminal_save_inferior ();
+ current_top_target ()->terminal_save_inferior ();
}
}
{
set_current_inferior (inf);
if (desired_state == target_terminal_state::is_ours)
- target_stack->terminal_ours ();
+ current_top_target ()->terminal_ours ();
else if (desired_state == target_terminal_state::is_ours_for_output)
- target_stack->terminal_ours_for_output ();
+ current_top_target ()->terminal_ours_for_output ();
else
gdb_assert_not_reached ("unhandled desired state");
inf->terminal_state = desired_state;
void
target_terminal::info (const char *arg, int from_tty)
{
- target_stack->terminal_info (arg, from_tty);
+ current_top_target ()->terminal_info (arg, from_tty);
}
/* See target.h. */
int
target_supports_terminal_ours (void)
{
- return target_stack->supports_terminal_ours ();
+ return current_top_target ()->supports_terminal_ours ();
}
static void
tcomplain (void)
{
error (_("You can't do that when your target is `%s'"),
- target_stack->shortname ());
+ current_top_target ()->shortname ());
}
void
struct target_ops **cur;
/* Find the proper stratum to install this target in. */
- for (cur = &target_stack; (*cur) != NULL; cur = &(*cur)->beneath)
+ for (cur = &g_current_top_target; (*cur) != NULL; cur = &(*cur)->beneath)
{
if ((int) (t->to_stratum) >= (int) (*cur)->to_stratum)
break;
/* Look for the specified target. Note that we assume that a target
can only occur once in the target stack. */
- for (cur = &target_stack; (*cur) != NULL; cur = &(*cur)->beneath)
+ for (cur = &g_current_top_target; (*cur) != NULL; cur = &(*cur)->beneath)
{
if ((*cur) == t)
break;
void
pop_all_targets_above (enum strata above_stratum)
{
- while ((int) (target_stack->to_stratum) > (int) above_stratum)
- unpush_target_and_assert (target_stack);
+ while ((int) (current_top_target ()->to_stratum) > (int) above_stratum)
+ unpush_target_and_assert (current_top_target ());
}
/* See target.h. */
void
pop_all_targets_at_and_above (enum strata stratum)
{
- while ((int) (target_stack->to_stratum) >= (int) stratum)
- unpush_target_and_assert (target_stack);
+ while ((int) (current_top_target ()->to_stratum) >= (int) stratum)
+ unpush_target_and_assert (current_top_target ());
}
void
{
struct target_ops *cur;
- for (cur = target_stack; cur != NULL; cur = cur->beneath)
+ for (cur = current_top_target (); cur != NULL; cur = cur->beneath)
if (cur == t)
return 1;
target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
{
volatile CORE_ADDR addr = 0;
- struct target_ops *target = target_stack;
+ struct target_ops *target = current_top_target ();
if (gdbarch_fetch_tls_load_module_address_p (target_gdbarch ()))
{
int
target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
{
- if (target_read (target_stack, TARGET_OBJECT_MEMORY, NULL,
+ if (target_read (current_top_target (), TARGET_OBJECT_MEMORY, NULL,
myaddr, memaddr, len) == len)
return 0;
else
int
target_read_raw_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
{
- if (target_read (target_stack, TARGET_OBJECT_RAW_MEMORY, NULL,
+ if (target_read (current_top_target (), TARGET_OBJECT_RAW_MEMORY, NULL,
myaddr, memaddr, len) == len)
return 0;
else
int
target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
{
- if (target_read (target_stack, TARGET_OBJECT_STACK_MEMORY, NULL,
+ if (target_read (current_top_target (), TARGET_OBJECT_STACK_MEMORY, NULL,
myaddr, memaddr, len) == len)
return 0;
else
int
target_read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
{
- if (target_read (target_stack, TARGET_OBJECT_CODE_MEMORY, NULL,
+ if (target_read (current_top_target (), TARGET_OBJECT_CODE_MEMORY, NULL,
myaddr, memaddr, len) == len)
return 0;
else
int
target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
{
- if (target_write (target_stack, TARGET_OBJECT_MEMORY, NULL,
+ if (target_write (current_top_target (), TARGET_OBJECT_MEMORY, NULL,
myaddr, memaddr, len) == len)
return 0;
else
int
target_write_raw_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
{
- if (target_write (target_stack, TARGET_OBJECT_RAW_MEMORY, NULL,
+ if (target_write (current_top_target (), TARGET_OBJECT_RAW_MEMORY, NULL,
myaddr, memaddr, len) == len)
return 0;
else
std::vector<mem_region>
target_memory_map (void)
{
- std::vector<mem_region> result = target_stack->memory_map ();
+ std::vector<mem_region> result = current_top_target ()->memory_map ();
if (result.empty ())
return result;
void
target_flash_erase (ULONGEST address, LONGEST length)
{
- target_stack->flash_erase (address, length);
+ current_top_target ()->flash_erase (address, length);
}
void
target_flash_done (void)
{
- target_stack->flash_done ();
+ current_top_target ()->flash_done ();
}
static void
return 1;
}
- return target_stack->insert_breakpoint (gdbarch, bp_tgt);
+ return current_top_target ()->insert_breakpoint (gdbarch, bp_tgt);
}
/* See target.h. */
return 1;
}
- return target_stack->remove_breakpoint (gdbarch, bp_tgt, reason);
+ return current_top_target ()->remove_breakpoint (gdbarch, bp_tgt, reason);
}
static void
printf_unfiltered (_("Symbols from \"%s\".\n"),
objfile_name (symfile_objfile));
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
{
if (!t->has_memory ())
continue;
prepare_for_detach ();
- target_stack->detach (inf, from_tty);
+ current_top_target ()->detach (inf, from_tty);
}
void
disconnecting. */
remove_breakpoints ();
- target_stack->disconnect (args, from_tty);
+ current_top_target ()->disconnect (args, from_tty);
}
/* See target/target.h. */
ptid_t
target_wait (ptid_t ptid, struct target_waitstatus *status, int options)
{
- return target_stack->wait (ptid, status, options);
+ return current_top_target ()->wait (ptid, status, options);
}
/* See target.h. */
const char *
target_pid_to_str (ptid_t ptid)
{
- return target_stack->pid_to_str (ptid);
+ return current_top_target ()->pid_to_str (ptid);
}
const char *
target_thread_name (struct thread_info *info)
{
- return target_stack->thread_name (info);
+ return current_top_target ()->thread_name (info);
}
struct thread_info *
int handle_len,
struct inferior *inf)
{
- return target_stack->thread_handle_to_thread_info (thread_handle,
+ return current_top_target ()->thread_handle_to_thread_info (thread_handle,
handle_len, inf);
}
{
target_dcache_invalidate ();
- target_stack->resume (ptid, step, signal);
+ current_top_target ()->resume (ptid, step, signal);
registers_changed_ptid (ptid);
/* We only set the internal executing state here. The user/frontend
if (defer_target_commit_resume)
return;
- target_stack->commit_resume ();
+ current_top_target ()->commit_resume ();
}
/* See target.h. */
void
target_pass_signals (int numsigs, unsigned char *pass_signals)
{
- target_stack->pass_signals (numsigs, pass_signals);
+ current_top_target ()->pass_signals (numsigs, pass_signals);
}
void
target_program_signals (int numsigs, unsigned char *program_signals)
{
- target_stack->program_signals (numsigs, program_signals);
+ current_top_target ()->program_signals (numsigs, program_signals);
}
static int
int
target_follow_fork (int follow_child, int detach_fork)
{
- return target_stack->follow_fork (follow_child, detach_fork);
+ return current_top_target ()->follow_fork (follow_child, detach_fork);
}
/* Target wrapper for follow exec hook. */
void
target_follow_exec (struct inferior *inf, char *execd_pathname)
{
- target_stack->follow_exec (inf, execd_pathname);
+ current_top_target ()->follow_exec (inf, execd_pathname);
}
static void
target_mourn_inferior (ptid_t ptid)
{
gdb_assert (ptid_equal (ptid, inferior_ptid));
- target_stack->mourn_inferior ();
+ current_top_target ()->mourn_inferior ();
/* We no longer need to keep handles on any of the object files.
Make sure to release them to avoid unnecessarily locking any
CORE_ADDR *found_addrp)
{
/* Start over from the top of the target stack. */
- return simple_search_memory (target_stack,
+ return simple_search_memory (current_top_target (),
start_addr, search_space_len,
pattern, pattern_len, found_addrp);
}
const gdb_byte *pattern, ULONGEST pattern_len,
CORE_ADDR *found_addrp)
{
- return target_stack->search_memory (start_addr, search_space_len,
+ return current_top_target ()->search_memory (start_addr, search_space_len,
pattern, pattern_len, found_addrp);
}
{
struct target_ops *t;
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
{
/* If this target knows how to create a new program, then
assume we will still be able to after killing the current
find_attach_target (void)
{
/* If a target on the current stack can attach, use it. */
- for (target_ops *t = target_stack; t != NULL; t = t->beneath)
+ for (target_ops *t = current_top_target (); t != NULL; t = t->beneath)
{
if (t->can_attach ())
return t;
find_run_target (void)
{
/* If a target on the current stack can run, use it. */
- for (target_ops *t = target_stack; t != NULL; t = t->beneath)
+ for (target_ops *t = current_top_target (); t != NULL; t = t->beneath)
{
if (t->can_create_inferior ())
return t;
int
target_supports_disable_randomization (void)
{
- return target_stack->supports_disable_randomization ();
+ return current_top_target ()->supports_disable_randomization ();
}
/* See target/target.h. */
int
target_supports_multi_process (void)
{
- return target_stack->supports_multi_process ();
+ return current_top_target ()->supports_multi_process ();
}
/* See target.h. */
{
struct address_space *aspace;
- aspace = target_stack->thread_address_space (ptid);
+ aspace = current_top_target ()->thread_address_space (ptid);
gdb_assert (aspace != NULL);
return aspace;
{
struct target_ops *t;
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
{
if (t->can_run ())
return 1;
{
struct target_ops *t;
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
if (t->to_stratum == stratum)
return t;
int
target_thread_alive (ptid_t ptid)
{
- return target_stack->thread_alive (ptid);
+ return current_top_target ()->thread_alive (ptid);
}
void
target_update_thread_list (void)
{
- target_stack->update_thread_list ();
+ current_top_target ()->update_thread_list ();
}
void
return;
}
- target_stack->stop (ptid);
+ current_top_target ()->stop (ptid);
}
void
return;
}
- target_stack->interrupt ();
+ current_top_target ()->interrupt ();
}
/* See target.h. */
void
target_pass_ctrlc (void)
{
- target_stack->pass_ctrlc ();
+ current_top_target ()->pass_ctrlc ();
}
/* See target.h. */
void
target_fetch_registers (struct regcache *regcache, int regno)
{
- target_stack->fetch_registers (regcache, regno);
+ current_top_target ()->fetch_registers (regcache, regno);
if (targetdebug)
regcache->debug_print_register ("target_fetch_registers", regno);
}
if (!may_write_registers)
error (_("Writing to registers is not allowed (regno %d)"), regno);
- target_stack->store_registers (regcache, regno);
+ current_top_target ()->store_registers (regcache, regno);
if (targetdebug)
{
regcache->debug_print_register ("target_store_registers", regno);
int
target_core_of_thread (ptid_t ptid)
{
- return target_stack->core_of_thread (ptid);
+ return current_top_target ()->core_of_thread (ptid);
}
int
const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size)
{
/* Start over from the top of the target stack. */
- return simple_verify_memory (target_stack,
+ return simple_verify_memory (current_top_target (),
data, memaddr, size);
}
int
target_verify_memory (const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size)
{
- return target_stack->verify_memory (data, memaddr, size);
+ return current_top_target ()->verify_memory (data, memaddr, size);
}
/* The documentation for this function is in its prototype declaration in
target_insert_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask,
enum target_hw_bp_type rw)
{
- return target_stack->insert_mask_watchpoint (addr, mask, rw);
+ return current_top_target ()->insert_mask_watchpoint (addr, mask, rw);
}
/* The documentation for this function is in its prototype declaration in
target_remove_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask,
enum target_hw_bp_type rw)
{
- return target_stack->remove_mask_watchpoint (addr, mask, rw);
+ return current_top_target ()->remove_mask_watchpoint (addr, mask, rw);
}
/* The documentation for this function is in its prototype declaration
int
target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask)
{
- return target_stack->masked_watch_num_registers (addr, mask);
+ return current_top_target ()->masked_watch_num_registers (addr, mask);
}
/* The documentation for this function is in its prototype declaration
int
target_ranged_break_num_registers (void)
{
- return target_stack->ranged_break_num_registers ();
+ return current_top_target ()->ranged_break_num_registers ();
}
/* See target.h. */
struct btrace_target_info *
target_enable_btrace (ptid_t ptid, const struct btrace_config *conf)
{
- return target_stack->enable_btrace (ptid, conf);
+ return current_top_target ()->enable_btrace (ptid, conf);
}
/* See target.h. */
void
target_disable_btrace (struct btrace_target_info *btinfo)
{
- target_stack->disable_btrace (btinfo);
+ current_top_target ()->disable_btrace (btinfo);
}
/* See target.h. */
void
target_teardown_btrace (struct btrace_target_info *btinfo)
{
- target_stack->teardown_btrace (btinfo);
+ current_top_target ()->teardown_btrace (btinfo);
}
/* See target.h. */
struct btrace_target_info *btinfo,
enum btrace_read_type type)
{
- return target_stack->read_btrace (btrace, btinfo, type);
+ return current_top_target ()->read_btrace (btrace, btinfo, type);
}
/* See target.h. */
const struct btrace_config *
target_btrace_conf (const struct btrace_target_info *btinfo)
{
- return target_stack->btrace_conf (btinfo);
+ return current_top_target ()->btrace_conf (btinfo);
}
/* See target.h. */
void
target_stop_recording (void)
{
- target_stack->stop_recording ();
+ current_top_target ()->stop_recording ();
}
/* See target.h. */
void
target_save_record (const char *filename)
{
- target_stack->save_record (filename);
+ current_top_target ()->save_record (filename);
}
/* See target.h. */
int
target_supports_delete_record ()
{
- return target_stack->supports_delete_record ();
+ return current_top_target ()->supports_delete_record ();
}
/* See target.h. */
void
target_delete_record (void)
{
- target_stack->delete_record ();
+ current_top_target ()->delete_record ();
}
/* See target.h. */
enum record_method
target_record_method (ptid_t ptid)
{
- return target_stack->record_method (ptid);
+ return current_top_target ()->record_method (ptid);
}
/* See target.h. */
int
target_record_is_replaying (ptid_t ptid)
{
- return target_stack->record_is_replaying (ptid);
+ return current_top_target ()->record_is_replaying (ptid);
}
/* See target.h. */
int
target_record_will_replay (ptid_t ptid, int dir)
{
- return target_stack->record_will_replay (ptid, dir);
+ return current_top_target ()->record_will_replay (ptid, dir);
}
/* See target.h. */
void
target_record_stop_replaying (void)
{
- target_stack->record_stop_replaying ();
+ current_top_target ()->record_stop_replaying ();
}
/* See target.h. */
void
target_goto_record_begin (void)
{
- target_stack->goto_record_begin ();
+ current_top_target ()->goto_record_begin ();
}
/* See target.h. */
void
target_goto_record_end (void)
{
- target_stack->goto_record_end ();
+ current_top_target ()->goto_record_end ();
}
/* See target.h. */
void
target_goto_record (ULONGEST insn)
{
- target_stack->goto_record (insn);
+ current_top_target ()->goto_record (insn);
}
/* See target.h. */
void
target_insn_history (int size, gdb_disassembly_flags flags)
{
- target_stack->insn_history (size, flags);
+ current_top_target ()->insn_history (size, flags);
}
/* See target.h. */
target_insn_history_from (ULONGEST from, int size,
gdb_disassembly_flags flags)
{
- target_stack->insn_history_from (from, size, flags);
+ current_top_target ()->insn_history_from (from, size, flags);
}
/* See target.h. */
target_insn_history_range (ULONGEST begin, ULONGEST end,
gdb_disassembly_flags flags)
{
- target_stack->insn_history_range (begin, end, flags);
+ current_top_target ()->insn_history_range (begin, end, flags);
}
/* See target.h. */
void
target_call_history (int size, record_print_flags flags)
{
- target_stack->call_history (size, flags);
+ current_top_target ()->call_history (size, flags);
}
/* See target.h. */
void
target_call_history_from (ULONGEST begin, int size, record_print_flags flags)
{
- target_stack->call_history_from (begin, size, flags);
+ current_top_target ()->call_history_from (begin, size, flags);
}
/* See target.h. */
void
target_call_history_range (ULONGEST begin, ULONGEST end, record_print_flags flags)
{
- target_stack->call_history_range (begin, end, flags);
+ current_top_target ()->call_history_range (begin, end, flags);
}
/* See target.h. */
const struct frame_unwind *
target_get_unwinder (void)
{
- return target_stack->get_unwinder ();
+ return current_top_target ()->get_unwinder ();
}
/* See target.h. */
const struct frame_unwind *
target_get_tailcall_unwinder (void)
{
- return target_stack->get_tailcall_unwinder ();
+ return current_top_target ()->get_tailcall_unwinder ();
}
/* See target.h. */
void
target_prepare_to_generate_core (void)
{
- target_stack->prepare_to_generate_core ();
+ current_top_target ()->prepare_to_generate_core ();
}
/* See target.h. */
void
target_done_generating_core (void)
{
- target_stack->done_generating_core ();
+ current_top_target ()->done_generating_core ();
}
\f
printf_filtered (_("The current target stack is:\n"));
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
{
if (t->to_stratum == debug_stratum)
continue;
target_async (int enable)
{
infrun_async (enable);
- target_stack->async (enable);
+ current_top_target ()->async (enable);
}
/* See target.h. */
void
target_thread_events (int enable)
{
- target_stack->thread_events (enable);
+ current_top_target ()->thread_events (enable);
}
/* Controls if targets can report that they can/are async. This is
static int
target_always_non_stop_p (void)
{
- return target_stack->always_non_stop_p ();
+ return current_top_target ()->always_non_stop_p ();
}
/* See target.h. */
/* The ops structure for our "current" target process. This should
never be NULL. If there is no target, it points to the dummy_target. */
-extern struct target_ops *target_stack;
+extern target_ops *current_top_target ();
/* Define easy words for doing these operations on our current target. */
-#define target_shortname (target_stack->shortname ())
-#define target_longname (target_stack->longname ())
+#define target_shortname (current_top_target ()->shortname ())
+#define target_longname (current_top_target ()->longname ())
/* Does whatever cleanup is required for a target that we are no
longer going to be calling. This routine is automatically always
These targets must set to_attach_no_wait. */
#define target_attach_no_wait() \
- (target_stack->attach_no_wait ())
+ (current_top_target ()->attach_no_wait ())
/* The target_attach operation places a process under debugger control,
and stops the process.
This operation provides a target-specific hook that allows the
necessary bookkeeping to be performed after an attach completes. */
#define target_post_attach(pid) \
- (target_stack->post_attach) (pid)
+ (current_top_target ()->post_attach) (pid)
/* Display a message indicating we're about to detach from the current
inferior process. */
debugged. */
#define target_prepare_to_store(regcache) \
- (target_stack->prepare_to_store) (regcache)
+ (current_top_target ()->prepare_to_store) (regcache)
/* Determine current address space of thread PTID. */
while a trace experiment is running. */
#define target_supports_enable_disable_tracepoint() \
- (target_stack->supports_enable_disable_tracepoint) ()
+ (current_top_target ()->supports_enable_disable_tracepoint) ()
#define target_supports_string_tracing() \
- (target_stack->supports_string_tracing) ()
+ (current_top_target ()->supports_string_tracing) ()
/* Returns true if this target can handle breakpoint conditions
on its end. */
#define target_supports_evaluation_of_breakpoint_conditions() \
- (target_stack->supports_evaluation_of_breakpoint_conditions) ()
+ (current_top_target ()->supports_evaluation_of_breakpoint_conditions) ()
/* Returns true if this target can handle breakpoint commands
on its end. */
#define target_can_run_breakpoint_commands() \
- (target_stack->can_run_breakpoint_commands) ()
+ (current_top_target ()->can_run_breakpoint_commands) ()
extern int target_read_string (CORE_ADDR, gdb::unique_xmalloc_ptr<char> *,
int, int *);
/* Print a line about the current target. */
#define target_files_info() \
- (target_stack->files_info) ()
+ (current_top_target ()->files_info) ()
/* Insert a breakpoint at address BP_TGT->placed_address in
the target machine. Returns 0 for success, and returns non-zero or
Such targets will supply an appropriate definition for this function. */
#define target_post_startup_inferior(ptid) \
- (target_stack->post_startup_inferior) (ptid)
+ (current_top_target ()->post_startup_inferior) (ptid)
/* On some targets, we can catch an inferior fork or vfork event when
it occurs. These functions insert/remove an already-created
catchpoint type is not supported and -1 for failure. */
#define target_insert_fork_catchpoint(pid) \
- (target_stack->insert_fork_catchpoint) (pid)
+ (current_top_target ()->insert_fork_catchpoint) (pid)
#define target_remove_fork_catchpoint(pid) \
- (target_stack->remove_fork_catchpoint) (pid)
+ (current_top_target ()->remove_fork_catchpoint) (pid)
#define target_insert_vfork_catchpoint(pid) \
- (target_stack->insert_vfork_catchpoint) (pid)
+ (current_top_target ()->insert_vfork_catchpoint) (pid)
#define target_remove_vfork_catchpoint(pid) \
- (target_stack->remove_vfork_catchpoint) (pid)
+ (current_top_target ()->remove_vfork_catchpoint) (pid)
/* If the inferior forks or vforks, this function will be called at
the next resume in order to perform any bookkeeping and fiddling
catchpoint type is not supported and -1 for failure. */
#define target_insert_exec_catchpoint(pid) \
- (target_stack->insert_exec_catchpoint) (pid)
+ (current_top_target ()->insert_exec_catchpoint) (pid)
#define target_remove_exec_catchpoint(pid) \
- (target_stack->remove_exec_catchpoint) (pid)
+ (current_top_target ()->remove_exec_catchpoint) (pid)
/* Syscall catch.
for failure. */
#define target_set_syscall_catchpoint(pid, needed, any_count, syscall_counts) \
- (target_stack->set_syscall_catchpoint) (pid, needed, any_count, \
+ (current_top_target ()->set_syscall_catchpoint) (pid, needed, any_count, \
syscall_counts)
/* The debugger has completed a blocking wait() call. There is now
placed in OUTBUF. */
#define target_rcmd(command, outbuf) \
- (target_stack->rcmd) (command, outbuf)
+ (current_top_target ()->rcmd) (command, outbuf)
/* Does the target include all of memory, or only part of it? This
Can it lock the thread scheduler? */
#define target_can_lock_scheduler \
- (target_stack->get_thread_control_capabilities () & tc_schedlock)
+ (current_top_target ()->get_thread_control_capabilities () & tc_schedlock)
/* Controls whether async mode is permitted. */
extern int target_async_permitted;
/* Can the target support asynchronous execution? */
-#define target_can_async_p() (target_stack->can_async_p ())
+#define target_can_async_p() (current_top_target ()->can_async_p ())
/* Is the target in asynchronous execution mode? */
-#define target_is_async_p() (target_stack->is_async_p ())
+#define target_is_async_p() (current_top_target ()->is_async_p ())
/* Enables/disabled async target events. */
extern void target_async (int enable);
extern int target_is_non_stop_p (void);
#define target_execution_direction() \
- (target_stack->execution_direction ())
+ (current_top_target ()->execution_direction ())
/* Converts a process id to a string. Usually, the string just contains
`process xyz', but on some systems it may contain
is okay. */
#define target_extra_thread_info(TP) \
- (target_stack->extra_thread_info (TP))
+ (current_top_target ()->extra_thread_info (TP))
/* Return the thread's name, or NULL if the target is unable to determine it.
The returned value must not be freed by the caller. */
it must persist. */
#define target_pid_to_exec_file(pid) \
- (target_stack->pid_to_exec_file) (pid)
+ (current_top_target ()->pid_to_exec_file) (pid)
/* See the to_thread_architecture description in struct target_ops. */
#define target_thread_architecture(ptid) \
- (target_stack->thread_architecture (ptid))
+ (current_top_target ()->thread_architecture (ptid))
/*
* Iterator function for target memory regions.
*/
#define target_find_memory_regions(FUNC, DATA) \
- (target_stack->find_memory_regions) (FUNC, DATA)
+ (current_top_target ()->find_memory_regions) (FUNC, DATA)
/*
* Compose corefile .note section.
*/
#define target_make_corefile_notes(BFD, SIZE_P) \
- (target_stack->make_corefile_notes) (BFD, SIZE_P)
+ (current_top_target ()->make_corefile_notes) (BFD, SIZE_P)
/* Bookmark interfaces. */
#define target_get_bookmark(ARGS, FROM_TTY) \
- (target_stack->get_bookmark) (ARGS, FROM_TTY)
+ (current_top_target ()->get_bookmark) (ARGS, FROM_TTY)
#define target_goto_bookmark(ARG, FROM_TTY) \
- (target_stack->goto_bookmark) (ARG, FROM_TTY)
+ (current_top_target ()->goto_bookmark) (ARG, FROM_TTY)
/* Hardware watchpoint interfaces. */
write). Only the INFERIOR_PTID task is being queried. */
#define target_stopped_by_watchpoint() \
- ((target_stack->stopped_by_watchpoint) ())
+ ((current_top_target ()->stopped_by_watchpoint) ())
/* Returns non-zero if the target stopped because it executed a
software breakpoint instruction. */
#define target_stopped_by_sw_breakpoint() \
- ((target_stack->stopped_by_sw_breakpoint) ())
+ ((current_top_target ()->stopped_by_sw_breakpoint) ())
#define target_supports_stopped_by_sw_breakpoint() \
- ((target_stack->supports_stopped_by_sw_breakpoint) ())
+ ((current_top_target ()->supports_stopped_by_sw_breakpoint) ())
#define target_stopped_by_hw_breakpoint() \
- ((target_stack->stopped_by_hw_breakpoint) ())
+ ((current_top_target ()->stopped_by_hw_breakpoint) ())
#define target_supports_stopped_by_hw_breakpoint() \
- ((target_stack->supports_stopped_by_hw_breakpoint) ())
+ ((current_top_target ()->supports_stopped_by_hw_breakpoint) ())
/* Non-zero if we have steppable watchpoints */
#define target_have_steppable_watchpoint \
- (target_stack->have_steppable_watchpoint ())
+ (current_top_target ()->have_steppable_watchpoint ())
/* Non-zero if we have continuable watchpoints */
#define target_have_continuable_watchpoint \
- (target_stack->have_continuable_watchpoint ())
+ (current_top_target ()->have_continuable_watchpoint ())
/* Provide defaults for hardware watchpoint functions. */
this one used so far. */
#define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
- (target_stack->can_use_hw_breakpoint) ( \
+ (current_top_target ()->can_use_hw_breakpoint) ( \
TYPE, CNT, OTHERTYPE)
/* Returns the number of debug registers needed to watch the given
memory region, or zero if not supported. */
#define target_region_ok_for_hw_watchpoint(addr, len) \
- (target_stack->region_ok_for_hw_watchpoint) (addr, len)
+ (current_top_target ()->region_ok_for_hw_watchpoint) (addr, len)
#define target_can_do_single_step() \
- (target_stack->can_do_single_step) ()
+ (current_top_target ()->can_do_single_step) ()
/* Set/clear a hardware watchpoint starting at ADDR, for LEN bytes.
TYPE is 0 for write, 1 for read, and 2 for read/write accesses.
-1 for failure. */
#define target_insert_watchpoint(addr, len, type, cond) \
- (target_stack->insert_watchpoint) (addr, len, type, cond)
+ (current_top_target ()->insert_watchpoint) (addr, len, type, cond)
#define target_remove_watchpoint(addr, len, type, cond) \
- (target_stack->remove_watchpoint) (addr, len, type, cond)
+ (current_top_target ()->remove_watchpoint) (addr, len, type, cond)
/* Insert a new masked watchpoint at ADDR using the mask MASK.
RW may be hw_read for a read watchpoint, hw_write for a write watchpoint
message) otherwise. */
#define target_insert_hw_breakpoint(gdbarch, bp_tgt) \
- (target_stack->insert_hw_breakpoint) (gdbarch, bp_tgt)
+ (current_top_target ()->insert_hw_breakpoint) (gdbarch, bp_tgt)
#define target_remove_hw_breakpoint(gdbarch, bp_tgt) \
- (target_stack->remove_hw_breakpoint) (gdbarch, bp_tgt)
+ (current_top_target ()->remove_hw_breakpoint) (gdbarch, bp_tgt)
/* Return number of debug registers needed for a ranged breakpoint,
or -1 if ranged breakpoints are not supported. */
For this reason, GDB will still evaluate the condition expression when
the watchpoint triggers. */
#define target_can_accel_watchpoint_condition(addr, len, type, cond) \
- (target_stack->can_accel_watchpoint_condition) (addr, len, type, cond)
+ (current_top_target ()->can_accel_watchpoint_condition) (addr, len, type, cond)
/* Return number of debug registers needed for a masked watchpoint,
-1 if masked watchpoints are not supported or -2 if the given address
/* Target can execute in reverse? */
#define target_can_execute_reverse \
- target_stack->can_execute_reverse ()
+ current_top_target ()->can_execute_reverse ()
extern const struct target_desc *target_read_description (struct target_ops *);
#define target_get_ada_task_ptid(lwp, tid) \
- (target_stack->get_ada_task_ptid) (lwp,tid)
+ (current_top_target ()->get_ada_task_ptid) (lwp,tid)
/* Utility implementation of searching memory. */
extern int simple_search_memory (struct target_ops* ops,
/* Return nonzero if the filesystem seen by the current inferior
is the local filesystem, zero otherwise. */
#define target_filesystem_is_local() \
- target_stack->filesystem_is_local ()
+ current_top_target ()->filesystem_is_local ()
/* Open FILENAME on the target, in the filesystem as seen by INF,
using FLAGS and MODE. If INF is NULL, use the filesystem seen
/* Tracepoint-related operations. */
#define target_trace_init() \
- (target_stack->trace_init) ()
+ (current_top_target ()->trace_init) ()
#define target_download_tracepoint(t) \
- (target_stack->download_tracepoint) (t)
+ (current_top_target ()->download_tracepoint) (t)
#define target_can_download_tracepoint() \
- (target_stack->can_download_tracepoint) ()
+ (current_top_target ()->can_download_tracepoint) ()
#define target_download_trace_state_variable(tsv) \
- (target_stack->download_trace_state_variable) (tsv)
+ (current_top_target ()->download_trace_state_variable) (tsv)
#define target_enable_tracepoint(loc) \
- (target_stack->enable_tracepoint) (loc)
+ (current_top_target ()->enable_tracepoint) (loc)
#define target_disable_tracepoint(loc) \
- (target_stack->disable_tracepoint) (loc)
+ (current_top_target ()->disable_tracepoint) (loc)
#define target_trace_start() \
- (target_stack->trace_start) ()
+ (current_top_target ()->trace_start) ()
#define target_trace_set_readonly_regions() \
- (target_stack->trace_set_readonly_regions) ()
+ (current_top_target ()->trace_set_readonly_regions) ()
#define target_get_trace_status(ts) \
- (target_stack->get_trace_status) (ts)
+ (current_top_target ()->get_trace_status) (ts)
#define target_get_tracepoint_status(tp,utp) \
- (target_stack->get_tracepoint_status) (tp, utp)
+ (current_top_target ()->get_tracepoint_status) (tp, utp)
#define target_trace_stop() \
- (target_stack->trace_stop) ()
+ (current_top_target ()->trace_stop) ()
#define target_trace_find(type,num,addr1,addr2,tpp) \
- (target_stack->trace_find) (\
+ (current_top_target ()->trace_find) (\
(type), (num), (addr1), (addr2), (tpp))
#define target_get_trace_state_variable_value(tsv,val) \
- (target_stack->get_trace_state_variable_value) ((tsv), (val))
+ (current_top_target ()->get_trace_state_variable_value) ((tsv), (val))
#define target_save_trace_data(filename) \
- (target_stack->save_trace_data) (filename)
+ (current_top_target ()->save_trace_data) (filename)
#define target_upload_tracepoints(utpp) \
- (target_stack->upload_tracepoints) (utpp)
+ (current_top_target ()->upload_tracepoints) (utpp)
#define target_upload_trace_state_variables(utsvp) \
- (target_stack->upload_trace_state_variables) (utsvp)
+ (current_top_target ()->upload_trace_state_variables) (utsvp)
#define target_get_raw_trace_data(buf,offset,len) \
- (target_stack->get_raw_trace_data) ((buf), (offset), (len))
+ (current_top_target ()->get_raw_trace_data) ((buf), (offset), (len))
#define target_get_min_fast_tracepoint_insn_len() \
- (target_stack->get_min_fast_tracepoint_insn_len) ()
+ (current_top_target ()->get_min_fast_tracepoint_insn_len) ()
#define target_set_disconnected_tracing(val) \
- (target_stack->set_disconnected_tracing) (val)
+ (current_top_target ()->set_disconnected_tracing) (val)
#define target_set_circular_trace_buffer(val) \
- (target_stack->set_circular_trace_buffer) (val)
+ (current_top_target ()->set_circular_trace_buffer) (val)
#define target_set_trace_buffer_size(val) \
- (target_stack->set_trace_buffer_size) (val)
+ (current_top_target ()->set_trace_buffer_size) (val)
#define target_set_trace_notes(user,notes,stopnotes) \
- (target_stack->set_trace_notes) ((user), (notes), (stopnotes))
+ (current_top_target ()->set_trace_notes) ((user), (notes), (stopnotes))
#define target_get_tib_address(ptid, addr) \
- (target_stack->get_tib_address) ((ptid), (addr))
+ (current_top_target ()->get_tib_address) ((ptid), (addr))
#define target_set_permissions() \
- (target_stack->set_permissions) ()
+ (current_top_target ()->set_permissions) ()
#define target_static_tracepoint_marker_at(addr, marker) \
- (target_stack->static_tracepoint_marker_at) (addr, marker)
+ (current_top_target ()->static_tracepoint_marker_at) (addr, marker)
#define target_static_tracepoint_markers_by_strid(marker_id) \
- (target_stack->static_tracepoint_markers_by_strid) (marker_id)
+ (current_top_target ()->static_tracepoint_markers_by_strid) (marker_id)
#define target_traceframe_info() \
- (target_stack->traceframe_info) ()
+ (current_top_target ()->traceframe_info) ()
#define target_use_agent(use) \
- (target_stack->use_agent) (use)
+ (current_top_target ()->use_agent) (use)
#define target_can_use_agent() \
- (target_stack->can_use_agent) ()
+ (current_top_target ()->can_use_agent) ()
#define target_augmented_libraries_svr4_read() \
- (target_stack->augmented_libraries_svr4_read) ()
+ (current_top_target ()->augmented_libraries_svr4_read) ()
/* Command logging facility. */
#define target_log_command(p) \
- (target_stack->log_command) (p)
+ (current_top_target ()->log_command) (p)
extern int target_core_of_thread (ptid_t ptid);
= (struct tfile_trace_file_writer *) self;
gdb::optional<std::string> tdesc
- = target_fetch_description_xml (target_stack);
+ = target_fetch_description_xml (current_top_target ());
if (!tdesc)
return;
{
/* We need to read the whole object before we know its size. */
gdb::optional<gdb::byte_vector> buf
- = target_read_alloc (target_stack, TARGET_OBJECT_STATIC_TRACE_DATA,
+ = target_read_alloc (current_top_target (), TARGET_OBJECT_STATIC_TRACE_DATA,
NULL);
if (buf)
{
enum target_xfer_status status;
ULONGEST xfered_partial;
- status = target_xfer_partial (target_stack,
+ status = target_xfer_partial (current_top_target (),
object, NULL,
buffer + xfered_total * unit_size, NULL,
memaddr + xfered_total,
case lval_register:
case lval_computed:
- gdb::observers::target_changed.notify (target_stack);
+ gdb::observers::target_changed.notify (current_top_target ());
/* Having destroyed the frame cache, restore the selected
frame. */
{
CORE_ADDR func_addr
= gdbarch_convert_from_func_ptr_addr (gdbarch, address,
- target_stack);
+ current_top_target ());
/* If the function pointer is represented by a description, print
the address of the description. */
set_value_address (v,
gdbarch_convert_from_func_ptr_addr
- (gdbarch, BMSYMBOL_VALUE_ADDRESS (msym), target_stack));
+ (gdbarch, BMSYMBOL_VALUE_ADDRESS (msym), current_top_target ()));
}
if (arg1p)
return -1;
}
- if (target_read (target_stack, TARGET_OBJECT_MEMORY,
+ if (target_read (current_top_target (), TARGET_OBJECT_MEMORY,
NULL, tib, thread_local_base, tib_size) != tib_size)
{
printf_filtered (_("Unable to read thread information "