diff options
author | Paul Koning <paul_koning@dell.com> | 2015-10-19 15:16:46 -0400 |
---|---|---|
committer | Paul Koning <paul_koning@dell.com> | 2015-10-19 15:16:46 -0400 |
commit | 95ba86d5a482fc4de16a67253f0b6511cbb79504 (patch) | |
tree | e3c4cfb8fce593cf45f68d36c5d09f7f436706cd | |
parent | 3101915abf7ce1188e58c811e8c8096fae441e3c (diff) | |
download | gdb-95ba86d5a482fc4de16a67253f0b6511cbb79504.zip gdb-95ba86d5a482fc4de16a67253f0b6511cbb79504.tar.gz gdb-95ba86d5a482fc4de16a67253f0b6511cbb79504.tar.bz2 |
convert current_target to be a pointer
This converts current_target to be a pointer rather than a struct.
This is more efficient when we move to multi-target, because then we
can switch targets by simply changing the pointer.
I made this patch by running this:
perl -pi -e 's/¤t_target/current_target/g; s/current_target\./current_target->/g;' *.[chyl] */*.[chyl]
... and then fixing up the result minorly:
* Updating the definition and declaration of current_target
* Fixing a "sizeof"
* Initializing current_target
Built and regtested on x86-64 Fedora 20.
2014-07-29 Tom Tromey <tromey@redhat.com>
* target.c (current_target): Now a pointer.
(update_current_target): Use size of target_ops, not
current_target.
(initialize_targets): Initialize current_target.
* target.h (current_target): Now a pointer.
* auxv.c: Update.
* avr-tdep.c: Update.
* breakpoint.c: Update.
* corefile.c: Update.
* elfread.c: Update.
* eval.c: Update.
* frame.c: Update.
* gnu-v3-abi.c: Update.
* ia64-hpux-tdep.c: Update.
* ia64-tdep.c: Update.
* ia64-vms-tdep.c: Update.
* infcall.c: Update.
* infcmd.c: Update.
* infrun.c: Update.
* linespec.c: Update.
* linux-nat.c: Update.
* linux-tdep.c: Update.
* linux-thread-db.c: Update.
* mi/mi-main.c: Update.
* minsyms.c: Update.
* parse.c: Update.
* ppc-linux-nat.c: Update.
* ppc-linux-tdep.c: Update.
* procfs.c: Update.
* remote-m32r-sdi.c: Update.
* remote.c: Update.
* s390-linux-nat.c: Update.
* s390-linux-tdep.c: Update.
* sol-thread.c: Update.
* solib-aix.c: Update.
* solib-darwin.c: Update.
* solib-dsbt.c: Update.
* solib-ia64-hpux.c: Update.
* solib-irix.c: Update.
* solib-osf.c: Update.
* solib-spu.c: Update.
* solib-svr4.c: Update.
* solib-target.c: Update.
* solib.c: Update.
* sparc-tdep.c: Update.
* spu-tdep.c: Update.
* symfile.c: Update.
* target-descriptions.c: Update.
* target-memory.c: Update.
* target.c: Update.
* target.h: Update.
* tracepoint.c: Update.
* valops.c: Update.
* valprint.c: Update.
* value.c: Update.
* windows-tdep.c: Update.
48 files changed, 315 insertions, 313 deletions
@@ -291,7 +291,7 @@ target_auxv_parse (struct target_ops *ops, gdb_byte **readptr, if (gdbarch_auxv_parse_p (gdbarch)) return gdbarch_auxv_parse (gdbarch, readptr, endptr, typep, valp); - return current_target.to_auxv_parse (¤t_target, readptr, endptr, + return current_target->to_auxv_parse (current_target, readptr, endptr, typep, valp); } @@ -528,7 +528,7 @@ info_auxv_command (char *cmd, int from_tty) error (_("The program has no auxiliary information now.")); else { - int ents = fprint_target_auxv (gdb_stdout, ¤t_target); + int ents = fprint_target_auxv (gdb_stdout, current_target); if (ents < 0) error (_("No auxiliary vector found, or failed reading it.")); diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 1108eb4..4894c82 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -1563,7 +1563,7 @@ avr_io_reg_read_command (char *args, int from_tty) int i, j, k, step; /* Find out how many io registers the target has. */ - bufsiz = target_read_alloc (¤t_target, TARGET_OBJECT_AVR, + bufsiz = target_read_alloc (current_target, TARGET_OBJECT_AVR, "avr.io_reg", &buf); bufstr = (const char *) buf; @@ -1600,7 +1600,7 @@ avr_io_reg_read_command (char *args, int from_tty) j = nreg - i; /* last block is less than 8 registers */ snprintf (query, sizeof (query) - 1, "avr.io_reg:%x,%x", i, j); - bufsiz = target_read_alloc (¤t_target, TARGET_OBJECT_AVR, + bufsiz = target_read_alloc (current_target, TARGET_OBJECT_AVR, query, &buf); p = (const char *) buf; diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 2c901ff..ae74393 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -3738,7 +3738,7 @@ create_exception_master_breakpoint (void) addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->exception_msym); addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, - ¤t_target); + current_target); b = create_internal_breakpoint (gdbarch, addr, bp_exception_master, &internal_breakpoint_ops); initialize_explicit_location (&explicit_loc); @@ -4959,7 +4959,7 @@ watchpoints_triggered (struct target_waitstatus *ws) return 0; } - if (!target_stopped_data_address (¤t_target, &addr)) + if (!target_stopped_data_address (current_target, &addr)) { /* We were stopped by a watchpoint, but we don't know where. Mark all watchpoints as unknown. */ @@ -4999,7 +4999,7 @@ watchpoints_triggered (struct target_waitstatus *ws) } } /* Exact match not required. Within range is sufficient. */ - else if (target_watchpoint_addr_within_range (¤t_target, + else if (target_watchpoint_addr_within_range (current_target, addr, loc->address, loc->length)) { diff --git a/gdb/corefile.c b/gdb/corefile.c index a860ce3..729bad4 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -245,7 +245,7 @@ read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len) enum target_xfer_status status; ULONGEST xfered_len; - status = target_xfer_partial (current_target.beneath, + status = target_xfer_partial (current_target->beneath, TARGET_OBJECT_MEMORY, NULL, myaddr + xfered, NULL, memaddr + xfered, len - xfered, diff --git a/gdb/elfread.c b/gdb/elfread.c index 138d316..1ecdb26 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -820,7 +820,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p) continue; addr = extract_typed_address (buf, ptr_type); addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, - ¤t_target); + current_target); addr = gdbarch_addr_bits_remove (gdbarch, addr); if (addr_p) @@ -884,7 +884,7 @@ elf_gnu_ifunc_resolve_addr (struct gdbarch *gdbarch, CORE_ADDR pc) address_val = call_function_by_hand (function, 0, NULL); address = value_as_address (address_val); address = gdbarch_convert_from_func_ptr_addr (gdbarch, address, - ¤t_target); + current_target); address = gdbarch_addr_bits_remove (gdbarch, address); if (name_at_pc) @@ -993,7 +993,7 @@ elf_gnu_ifunc_resolver_return_stop (struct breakpoint *b) resolved_address = value_as_address (value); resolved_pc = gdbarch_convert_from_func_ptr_addr (gdbarch, resolved_address, - ¤t_target); + current_target); resolved_pc = gdbarch_addr_bits_remove (gdbarch, resolved_pc); gdb_assert (current_program_space == b->pspace || b->pspace == NULL); @@ -1206,7 +1206,7 @@ evaluate_subexp_standard (struct type *expect_type, /* 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, - ¤t_target); + current_target); /* Is it a high_level symbol? */ sym = find_pc_function (addr); diff --git a/gdb/frame.c b/gdb/frame.c index 93bb7f6..ea366f7 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -2092,7 +2092,7 @@ inside_main_func (struct frame_info *this_frame) returned. */ maddr = gdbarch_convert_from_func_ptr_addr (get_frame_arch (this_frame), BMSYMBOL_VALUE_ADDRESS (msymbol), - ¤t_target); + current_target); return maddr == get_frame_func (this_frame); } diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index b962cd3..b701d16 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -1262,7 +1262,7 @@ gnuv3_skip_trampoline (struct frame_info *frame, CORE_ADDR stop_pc) 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, - ¤t_target); + current_target); if (func_addr != 0) method_stop_pc = func_addr; diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 46a114c..f80a087 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -2682,7 +2682,7 @@ getunwind_table (gdb_byte **buf_p) we should find a way to override the corefile layer's xfer_partial method. */ - x = target_read_alloc (¤t_target, TARGET_OBJECT_UNWIND_TABLE, + x = target_read_alloc (current_target, TARGET_OBJECT_UNWIND_TABLE, NULL, buf_p); return x; diff --git a/gdb/ia64-vms-tdep.c b/gdb/ia64-vms-tdep.c index 25b0f13..db0e332 100644 --- a/gdb/ia64-vms-tdep.c +++ b/gdb/ia64-vms-tdep.c @@ -42,7 +42,7 @@ ia64_vms_find_proc_info_x (unw_addr_space_t as, unw_word_t ip, CORE_ADDR table_addr; unsigned int info_len; - res = target_read (¤t_target, TARGET_OBJECT_OPENVMS_UIB, + res = target_read (current_target, TARGET_OBJECT_OPENVMS_UIB, annex + 2, buf, 0, sizeof (buf)); if (res != sizeof (buf)) diff --git a/gdb/infcall.c b/gdb/infcall.c index efb389f..f88b100 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -269,7 +269,7 @@ find_function_addr (struct value *function, struct type **retval_type) if (TYPE_CODE (ftype) == TYPE_CODE_FUNC || TYPE_CODE (ftype) == TYPE_CODE_METHOD) funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr, - ¤t_target); + current_target); } if (TYPE_CODE (ftype) == TYPE_CODE_FUNC || TYPE_CODE (ftype) == TYPE_CODE_METHOD) @@ -305,7 +305,7 @@ find_function_addr (struct value *function, struct type **retval_type) funaddr = value_as_address (value_addr (function)); nfunaddr = funaddr; funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr, - ¤t_target); + current_target); if (funaddr != nfunaddr) found_descriptor = 1; } diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 54aa1ef..fe5bdfd 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -622,7 +622,7 @@ run_command_1 (char *args, int from_tty, int tbreak_at_main) /* 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 (¤t_target, 0); + post_create_inferior (current_target, 0); /* Start the target running. Do not use -1 continuation as it would skip breakpoint right at the entry point. */ @@ -775,7 +775,7 @@ continue_command (char *args, int from_tty) args = strip_bg_char (args, &async_exec); args_chain = make_cleanup (xfree, args); - prepare_execution_command (¤t_target, async_exec); + prepare_execution_command (current_target, async_exec); if (args != NULL) { @@ -988,7 +988,7 @@ step_1 (int skip_subroutines, int single_inst, char *count_string) count_string = strip_bg_char (count_string, &async_exec); args_chain = make_cleanup (xfree, count_string); - prepare_execution_command (¤t_target, async_exec); + prepare_execution_command (current_target, async_exec); count = count_string ? parse_and_eval_long (count_string) : 1; @@ -1180,7 +1180,7 @@ jump_command (char *arg, int from_tty) arg = strip_bg_char (arg, &async_exec); args_chain = make_cleanup (xfree, arg); - prepare_execution_command (¤t_target, async_exec); + prepare_execution_command (current_target, async_exec); if (!arg) error_no_arg (_("starting address")); @@ -1265,7 +1265,7 @@ signal_command (char *signum_exp, int from_tty) signum_exp = strip_bg_char (signum_exp, &async_exec); args_chain = make_cleanup (xfree, signum_exp); - prepare_execution_command (¤t_target, async_exec); + prepare_execution_command (current_target, async_exec); if (!signum_exp) error_no_arg (_("signal number")); @@ -1543,7 +1543,7 @@ until_command (char *arg, int from_tty) arg = strip_bg_char (arg, &async_exec); args_chain = make_cleanup (xfree, arg); - prepare_execution_command (¤t_target, async_exec); + prepare_execution_command (current_target, async_exec); if (arg) until_break_command (arg, from_tty, 0); @@ -1572,7 +1572,7 @@ advance_command (char *arg, int from_tty) arg = strip_bg_char (arg, &async_exec); args_chain = make_cleanup (xfree, arg); - prepare_execution_command (¤t_target, async_exec); + prepare_execution_command (current_target, async_exec); until_break_command (arg, from_tty, 1); @@ -1951,7 +1951,7 @@ finish_command (char *arg, int from_tty) arg = strip_bg_char (arg, &async_exec); args_chain = make_cleanup (xfree, arg); - prepare_execution_command (¤t_target, async_exec); + prepare_execution_command (current_target, async_exec); if (arg) error (_("The \"finish\" command does not take any arguments.")); @@ -2635,7 +2635,7 @@ attach_command_post_wait (char *args, int from_tty, int async_exec) /* Take any necessary post-attaching actions for this platform. */ target_post_attach (ptid_get_pid (inferior_ptid)); - post_create_inferior (¤t_target, from_tty); + post_create_inferior (current_target, from_tty); if (async_exec) { diff --git a/gdb/infrun.c b/gdb/infrun.c index cf91370..f451be4 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3194,7 +3194,7 @@ start_remote (int from_tty) /* 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 (¤t_target, from_tty); + post_create_inferior (current_target, from_tty); normal_stop (); } @@ -5462,7 +5462,7 @@ handle_signal_stop (struct execution_control_state *ecs) fprintf_unfiltered (gdb_stdlog, "infrun: stopped by watchpoint\n"); - if (target_stopped_data_address (¤t_target, &addr)) + if (target_stopped_data_address (current_target, &addr)) fprintf_unfiltered (gdb_stdlog, "infrun: stopped data address = %s\n", paddress (gdbarch, addr)); @@ -8563,7 +8563,7 @@ siginfo_value_read (struct value *v) validate_siginfo_access (); transferred = - target_read (¤t_target, TARGET_OBJECT_SIGNAL_INFO, + target_read (current_target, TARGET_OBJECT_SIGNAL_INFO, NULL, value_contents_all_raw (v), value_offset (v), @@ -8583,7 +8583,7 @@ siginfo_value_write (struct value *v, struct value *fromval) validate_siginfo_access (); - transferred = target_write (¤t_target, + transferred = target_write (current_target, TARGET_OBJECT_SIGNAL_INFO, NULL, value_contents_all_raw (fromval), @@ -8662,7 +8662,7 @@ save_infcall_suspend_state (void) siginfo_data = (gdb_byte *) xmalloc (len); back_to = make_cleanup (xfree, siginfo_data); - if (target_read (¤t_target, TARGET_OBJECT_SIGNAL_INFO, NULL, + if (target_read (current_target, TARGET_OBJECT_SIGNAL_INFO, NULL, siginfo_data, 0, len) == len) discard_cleanups (back_to); else @@ -8712,7 +8712,7 @@ restore_infcall_suspend_state (struct infcall_suspend_state *inf_state) struct type *type = gdbarch_get_siginfo_type (gdbarch); /* Errors ignored. */ - target_write (¤t_target, TARGET_OBJECT_SIGNAL_INFO, NULL, + target_write (current_target, TARGET_OBJECT_SIGNAL_INFO, NULL, inf_state->siginfo_data, 0, TYPE_LENGTH (type)); } diff --git a/gdb/linespec.c b/gdb/linespec.c index b2233b9..3724537 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -3556,7 +3556,7 @@ minsym_found (struct linespec_state *self, struct objfile *objfile, /* The minimal symbol might point to a function descriptor; resolve it to the actual code address instead. */ - pc = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc, ¤t_target); + pc = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc, current_target); if (pc != sal.pc) sal = find_pc_sect_line (pc, NULL, 0); @@ -3573,7 +3573,7 @@ minsym_found (struct linespec_state *self, struct objfile *objfile, stay correct from the last find_pc_sect_line above. */ sal.pc = MSYMBOL_VALUE_ADDRESS (objfile, msymbol); sal.pc = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc, - ¤t_target); + current_target); if (gdbarch_skip_entrypoint_p (gdbarch)) sal.pc = gdbarch_skip_entrypoint (gdbarch, sal.pc); } @@ -3665,7 +3665,7 @@ add_minsym (struct minimal_symbol *minsym, void *d) NULL, 0); sal.section = MSYMBOL_OBJ_SECTION (info->objfile, minsym); pc - = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc, ¤t_target); + = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc, current_target); if (pc != sal.pc) sal = find_pc_sect_line (pc, NULL, 0); @@ -3689,7 +3689,7 @@ add_minsym (struct minimal_symbol *minsym, void *d) struct gdbarch *gdbarch = get_objfile_arch (info->objfile); CORE_ADDR addr = gdbarch_convert_from_func_ptr_addr (gdbarch, BMSYMBOL_VALUE_ADDRESS (mo), - ¤t_target); + current_target); if (addr == BMSYMBOL_VALUE_ADDRESS (mo)) return; diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index eb9f5bb..18fdea7 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -2488,7 +2488,7 @@ check_stopped_by_watchpoint (struct lwp_info *lp) if (linux_ops->to_stopped_data_address != NULL) lp->stopped_data_address_p = - linux_ops->to_stopped_data_address (¤t_target, + linux_ops->to_stopped_data_address (current_target, &lp->stopped_data_address); else lp->stopped_data_address_p = 0; diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 7c24eaa..df674c9 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -370,8 +370,8 @@ linux_is_uclinux (void) { CORE_ADDR dummy; - return (target_auxv_search (¤t_target, AT_NULL, &dummy) > 0 - && target_auxv_search (¤t_target, AT_PAGESZ, &dummy) == 0); + return (target_auxv_search (current_target, AT_NULL, &dummy) > 0 + && target_auxv_search (current_target, AT_PAGESZ, &dummy) == 0); } static int @@ -1386,7 +1386,7 @@ linux_spu_make_corefile_notes (bfd *obfd, char *note_data, int *note_size) LONGEST i, j, size; /* Determine list of SPU ids. */ - size = target_read_alloc (¤t_target, TARGET_OBJECT_SPU, + size = target_read_alloc (current_target, TARGET_OBJECT_SPU, NULL, &spu_ids); /* Generate corefile notes for each SPU file. */ @@ -1401,7 +1401,7 @@ linux_spu_make_corefile_notes (bfd *obfd, char *note_data, int *note_size) LONGEST spu_len; xsnprintf (annex, sizeof annex, "%d/%s", fd, spu_files[j]); - spu_len = target_read_alloc (¤t_target, TARGET_OBJECT_SPU, + spu_len = target_read_alloc (current_target, TARGET_OBJECT_SPU, annex, &spu_data); if (spu_len > 0) { @@ -1637,7 +1637,7 @@ linux_get_siginfo_data (struct gdbarch *gdbarch, LONGEST *size) buf = (gdb_byte *) xmalloc (TYPE_LENGTH (siginfo_type)); cleanups = make_cleanup (xfree, buf); - bytes_read = target_read (¤t_target, TARGET_OBJECT_SIGNAL_INFO, NULL, + bytes_read = target_read (current_target, TARGET_OBJECT_SIGNAL_INFO, NULL, buf, 0, TYPE_LENGTH (siginfo_type)); if (bytes_read == TYPE_LENGTH (siginfo_type)) { @@ -1975,7 +1975,7 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size) return NULL; /* Auxillary vector. */ - auxv_len = target_read_alloc (¤t_target, TARGET_OBJECT_AUXV, + auxv_len = target_read_alloc (current_target, TARGET_OBJECT_AUXV, NULL, &auxv); if (auxv_len > 0) { @@ -2273,7 +2273,7 @@ find_mapping_size (CORE_ADDR vaddr, unsigned long size, static int linux_vsyscall_range_raw (struct gdbarch *gdbarch, struct mem_range *range) { - if (target_auxv_search (¤t_target, AT_SYSINFO_EHDR, &range->start) <= 0) + if (target_auxv_search (current_target, AT_SYSINFO_EHDR, &range->start) <= 0) return 0; /* This is installed by linux_init_abi below, so should always be @@ -2397,13 +2397,13 @@ linux_displaced_step_location (struct gdbarch *gdbarch) 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 (¤t_target, AT_ENTRY, &addr) <= 0) + if (target_auxv_search (current_target, AT_ENTRY, &addr) <= 0) 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, - ¤t_target); + current_target); /* Inferior calls also use the entry point as a breakpoint location. We don't want displaced stepping to interfere with those diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index 66e9595..b77418d 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -480,7 +480,7 @@ enable_thread_event (td_event_e event, CORE_ADDR *bp) (bfd_get_sign_extend_vma (exec_bfd) > 0 ? (CORE_ADDR) (intptr_t) notify.u.bptaddr : (CORE_ADDR) (uintptr_t) notify.u.bptaddr), - ¤t_target)); + current_target)); create_thread_event_breakpoint (target_gdbarch (), *bp); return TD_OK; @@ -1074,7 +1074,7 @@ thread_db_load (void) return 0; /* Don't attempt to use thread_db for remote targets. */ - if (!(target_can_run (¤t_target) || core_bfd)) + if (!(target_can_run (current_target) || core_bfd)) return 0; if (thread_db_load_search ()) @@ -1182,7 +1182,7 @@ static void check_pid_namespace_match (void) { /* Check is only relevant for local targets targets. */ - if (target_can_run (¤t_target)) + if (target_can_run (current_target)) { /* If the child is in a different PID namespace, its idea of its PID will differ from our idea of its PID. When we scan the diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 2b25a9c..6ab5ff2 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -267,7 +267,7 @@ proceed_thread_callback (struct thread_info *thread, void *arg) static void exec_continue (char **argv, int argc) { - prepare_execution_command (¤t_target, mi_async_p ()); + prepare_execution_command (current_target, mi_async_p ()); if (non_stop) { @@ -1498,8 +1498,8 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc) make_cleanup (xfree, mbuf); /* Dispatch memory reads to the topmost target, not the flattened - current_target. */ - nr_bytes = target_read (current_target.beneath, + current_target-> */ + nr_bytes = target_read (current_target->beneath, TARGET_OBJECT_MEMORY, NULL, mbuf, addr, total_bytes); if (nr_bytes <= 0) @@ -1631,7 +1631,7 @@ mi_cmd_data_read_memory_bytes (char *command, char **argv, int argc) addr = parse_and_eval_address (argv[0]) + offset; length = atol (argv[1]); - result = read_memory_robust (current_target.beneath, addr, length); + result = read_memory_robust (current_target->beneath, addr, length); cleanups = make_cleanup (free_memory_read_result_vector, result); diff --git a/gdb/minsyms.c b/gdb/minsyms.c index d7097a9..fc8624c 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1417,7 +1417,7 @@ find_solib_trampoline_target (struct frame_info *frame, CORE_ADDR pc) func = gdbarch_convert_from_func_ptr_addr (get_objfile_arch (objfile), MSYMBOL_VALUE_ADDRESS (objfile, msymbol), - ¤t_target); + current_target); /* Ignore data symbols that are not function descriptors. */ if (func != MSYMBOL_VALUE_ADDRESS (objfile, msymbol)) diff --git a/gdb/parse.c b/gdb/parse.c index a24c52a..47d5c09 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -486,7 +486,7 @@ write_exp_msymbol (struct parser_state *ps, /* The minimal symbol might point to a function descriptor; resolve it to the actual code address instead. */ - pc = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, ¤t_target); + pc = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, current_target); if (pc != addr) { struct bound_minimal_symbol ifunc_msym = lookup_minimal_symbol_by_pc (pc); diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index 55aec00..c037162 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -1304,7 +1304,7 @@ ppc_linux_get_hwcap (void) { CORE_ADDR field; - if (target_auxv_search (¤t_target, AT_HWCAP, &field)) + if (target_auxv_search (current_target, AT_HWCAP, &field)) return (unsigned long) field; return 0; diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 460c503..c84ce73 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1194,7 +1194,7 @@ ppc_linux_spe_context (int wordsize, enum bfd_endian byte_order, /* Look up cached address of thread-local variable. */ if (!ptid_equal (spe_context_cache_ptid, inferior_ptid)) { - struct target_ops *target = ¤t_target; + struct target_ops *target = current_target; TRY { @@ -1358,7 +1358,7 @@ ppu2spu_sniffer (const struct frame_unwind *self, return 0; xsnprintf (annex, sizeof annex, "%d/regs", data.id); - if (target_read (¤t_target, TARGET_OBJECT_SPU, annex, + if (target_read (current_target, TARGET_OBJECT_SPU, annex, data.gprs, 0, sizeof data.gprs) == sizeof data.gprs) { diff --git a/gdb/procfs.c b/gdb/procfs.c index 20afdee..73e1c5b 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -4622,7 +4622,7 @@ procfs_inferior_created (struct target_ops *ops, int from_tty) the inferior ourselves, there is nothing to do when the inferior was created by attaching to an already running process, or when debugging a core file. */ - if (current_inferior ()->attach_flag || !target_can_run (¤t_target)) + if (current_inferior ()->attach_flag || !target_can_run (current_target)) return; proc_trace_syscalls_1 (find_procinfo_or_die (ptid_get_pid (inferior_ptid), @@ -5460,7 +5460,7 @@ procfs_make_note_section (struct target_ops *self, bfd *obfd, int *note_size) &thread_args); note_data = thread_args.note_data; - auxv_len = target_read_alloc (¤t_target, TARGET_OBJECT_AUXV, + auxv_len = target_read_alloc (current_target, TARGET_OBJECT_AUXV, NULL, &auxv); if (auxv_len > 0) { diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index e67f9d4..b39fbff 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -1500,7 +1500,7 @@ m32r_stopped_by_watchpoint (struct target_ops *ops) { CORE_ADDR addr; - return m32r_stopped_data_address (¤t_target, &addr); + return m32r_stopped_data_address (current_target, &addr); } /* Check to see if a thread is still alive. */ diff --git a/gdb/remote.c b/gdb/remote.c index f40f791..2ec9c6e 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -4162,7 +4162,7 @@ remote_check_symbols (void) instead of any data function descriptor. */ sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (), sym_addr, - ¤t_target); + current_target); xsnprintf (msg, get_remote_packet_size (), "qSymbol:%s:%s", phex_nz (sym_addr, addr_size), &reply[8]); @@ -10010,7 +10010,7 @@ static VEC(mem_region_s) * remote_memory_map (struct target_ops *ops) { VEC(mem_region_s) *result = NULL; - char *text = target_read_stralloc (¤t_target, + char *text = target_read_stralloc (current_target, TARGET_OBJECT_MEMORY_MAP, NULL); if (text) @@ -12180,7 +12180,7 @@ remote_traceframe_info (struct target_ops *self) { char *text; - text = target_read_stralloc (¤t_target, + text = target_read_stralloc (current_target, TARGET_OBJECT_TRACEFRAME_INFO, NULL); if (text != NULL) { @@ -12451,7 +12451,7 @@ btrace_read_config (struct btrace_config *conf) { char *xml; - xml = target_read_stralloc (¤t_target, + xml = target_read_stralloc (current_target, TARGET_OBJECT_BTRACE_CONF, ""); if (xml != NULL) { @@ -12607,8 +12607,8 @@ remote_read_btrace (struct target_ops *self, (unsigned int) type); } - xml = target_read_stralloc (¤t_target, - TARGET_OBJECT_BTRACE, annex); + xml = target_read_stralloc (current_target, + TARGET_OBJECT_BTRACE, annex); if (xml == NULL) return BTRACE_ERR_UNKNOWN; @@ -12671,7 +12671,7 @@ remote_pid_to_exec_file (struct target_ops *self, int pid) xsnprintf (annex, annex_size, "%x", pid); } - filename = target_read_stralloc (¤t_target, + filename = target_read_stralloc (current_target, TARGET_OBJECT_EXEC_FILE, annex); return filename; diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index baf6b67..bcabea5 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -4542,7 +4542,7 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache, return -1; case 1014: /* Data Cache Block set to Zero */ - if (target_auxv_search (¤t_target, AT_DCACHEBSIZE, &at_dcsz) <= 0 + if (target_auxv_search (current_target, AT_DCACHEBSIZE, &at_dcsz) <= 0 || at_dcsz == 0) at_dcsz = 128; /* Assume 128-byte cache line size (POWER8) */ diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c index 3bb99c8..342bca0 100644 --- a/gdb/s390-linux-nat.c +++ b/gdb/s390-linux-nat.c @@ -678,7 +678,7 @@ s390_read_description (struct target_ops *ops) { CORE_ADDR hwcap = 0; - target_auxv_search (¤t_target, AT_HWCAP, &hwcap); + target_auxv_search (current_target, AT_HWCAP, &hwcap); have_regset_tdb = (hwcap & HWCAP_S390_TE) && check_regset (tid, NT_S390_TDB, s390_sizeof_tdbregset); diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index fcf93d7..0032c78 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -1144,7 +1144,7 @@ s390_load (struct s390_prologue_data *data, if (pv_is_constant (addr)) { struct target_section *secp; - secp = target_section_by_addr (¤t_target, addr.k); + secp = target_section_by_addr (current_target, addr.k); if (secp != NULL && (bfd_get_section_flags (secp->the_bfd_section->owner, secp->the_bfd_section) diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 066295c..45b41e7 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -581,7 +581,7 @@ check_for_thread_db (void) ptid_t ptid; /* Don't attempt to use thread_db for remote targets. */ - if (!(target_can_run (¤t_target) || core_bfd)) + if (!(target_can_run (current_target) || core_bfd)) return; /* Do nothing if we couldn't load libthread_db.so.1. */ @@ -1203,7 +1203,7 @@ sol_get_ada_task_ptid (struct target_ops *self, long lwp, long thread) { /* The list of threads is probably not up to date. Find any thread that is missing from the list, and try again. */ - sol_update_thread_list (¤t_target); + sol_update_thread_list (current_target); thread_info = iterate_over_threads (thread_db_find_thread_from_tid, &thread); } diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c index 0310e66..98cfbac 100644 --- a/gdb/solib-aix.c +++ b/gdb/solib-aix.c @@ -303,7 +303,7 @@ solib_aix_get_library_list (struct inferior *inf, const char *warning_msg) if (data->library_list != NULL) return data->library_list; - library_document = target_read_stralloc (¤t_target, + library_document = target_read_stralloc (current_target, TARGET_OBJECT_LIBRARIES_AIX, NULL); if (library_document == NULL && warning_msg != NULL) diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c index 876ca8c..6ead694 100644 --- a/gdb/solib-darwin.c +++ b/gdb/solib-darwin.c @@ -482,7 +482,7 @@ darwin_solib_read_all_image_info_addr (struct darwin_info *info) LONGEST len; enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); - len = target_read (¤t_target, TARGET_OBJECT_DARWIN_DYLD_INFO, NULL, + len = target_read (current_target, TARGET_OBJECT_DARWIN_DYLD_INFO, NULL, buf, 0, sizeof (buf)); if (len != sizeof (buf)) return; diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c index 3218bbe..7d33d10 100644 --- a/gdb/solib-dsbt.c +++ b/gdb/solib-dsbt.c @@ -290,7 +290,7 @@ dsbt_get_initial_loadmaps (void) gdb_byte *buf; struct dsbt_info *info = get_dsbt_info (); - if (0 >= target_read_alloc (¤t_target, TARGET_OBJECT_FDPIC, + if (0 >= target_read_alloc (current_target, TARGET_OBJECT_FDPIC, "exec", &buf)) { info->exec_loadmap = NULL; @@ -300,7 +300,7 @@ dsbt_get_initial_loadmaps (void) if (solib_dsbt_debug) dsbt_print_loadmap (info->exec_loadmap); - if (0 >= target_read_alloc (¤t_target, TARGET_OBJECT_FDPIC, + if (0 >= target_read_alloc (current_target, TARGET_OBJECT_FDPIC, "interp", &buf)) { info->interp_loadmap = NULL; diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c index 468ab1a..1df7422 100644 --- a/gdb/solib-spu.c +++ b/gdb/solib-spu.c @@ -171,7 +171,7 @@ spu_current_sos (void) ; /* Determine list of SPU ids. */ - size = target_read (¤t_target, TARGET_OBJECT_SPU, NULL, + size = target_read (current_target, TARGET_OBJECT_SPU, NULL, buf, 0, sizeof buf); /* Do not add stand-alone SPE executable context as shared library, @@ -206,7 +206,7 @@ spu_current_sos (void) 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 (¤t_target, TARGET_OBJECT_SPU, annex, + len = target_read (current_target, TARGET_OBJECT_SPU, annex, (gdb_byte *) id, 0, sizeof id); if (len <= 0 || len >= sizeof id) continue; @@ -421,7 +421,7 @@ spu_enable_break (struct objfile *objfile) CORE_ADDR addr = BMSYMBOL_VALUE_ADDRESS (spe_event_sym); addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (), addr, - ¤t_target); + current_target); create_solib_event_breakpoint (target_gdbarch (), addr); return 1; } diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 55b8f55..a25d4db 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -459,11 +459,11 @@ read_program_header (int type, int *p_sect_size, int *p_arch_size, int pt_phdr_p = 0; /* Get required auxv elements from target. */ - if (target_auxv_search (¤t_target, AT_PHDR, &at_phdr) <= 0) + if (target_auxv_search (current_target, AT_PHDR, &at_phdr) <= 0) return 0; - if (target_auxv_search (¤t_target, AT_PHENT, &at_phent) <= 0) + if (target_auxv_search (current_target, AT_PHENT, &at_phent) <= 0) return 0; - if (target_auxv_search (¤t_target, AT_PHNUM, &at_phnum) <= 0) + if (target_auxv_search (current_target, AT_PHNUM, &at_phnum) <= 0) return 0; if (!at_phdr || !at_phnum) return 0; @@ -1291,7 +1291,7 @@ svr4_current_sos_via_xfer_libraries (struct svr4_library_list *list, gdb_assert (annex == NULL || target_augmented_libraries_svr4_read ()); /* Fetch the list of shared libraries. */ - svr4_library_document = target_read_stralloc (¤t_target, + svr4_library_document = target_read_stralloc (current_target, TARGET_OBJECT_LIBRARIES_SVR4, annex); if (svr4_library_document == NULL) @@ -1614,7 +1614,7 @@ svr4_fetch_objfile_link_map (struct objfile *objfile) /* Cause svr4_current_sos() to be run if it hasn't been already. */ if (info->main_lm_addr == 0) - solib_add (NULL, 0, ¤t_target, auto_solib_add); + solib_add (NULL, 0, current_target, auto_solib_add); /* svr4_current_sos() will set main_lm_addr for the main executable. */ if (objfile == symfile_objfile) @@ -2274,7 +2274,7 @@ enable_break (struct svr4_info *info, int from_tty) mean r_brk has already been relocated. Assume the dynamic linker is the object containing r_brk. */ - solib_add (NULL, from_tty, ¤t_target, auto_solib_add); + solib_add (NULL, from_tty, current_target, auto_solib_add); sym_addr = 0; if (info->debug_base && solib_svr4_r_map (info) != 0) sym_addr = solib_svr4_r_brk (info); @@ -2286,7 +2286,7 @@ enable_break (struct svr4_info *info, int from_tty) sym_addr = gdbarch_addr_bits_remove (target_gdbarch (), gdbarch_convert_from_func_ptr_addr (target_gdbarch (), sym_addr, - ¤t_target)); + current_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 @@ -2403,7 +2403,7 @@ enable_break (struct svr4_info *info, int from_tty) /* 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 (¤t_target, AT_BASE, &load_addr) > 0) + if (target_auxv_search (current_target, AT_BASE, &load_addr) > 0) { int addr_bit = gdbarch_addr_bit (target_gdbarch ()); @@ -2452,7 +2452,7 @@ enable_break (struct svr4_info *info, int from_tty) info->debug_loader_name = xstrdup (interp_name); info->debug_loader_offset_p = 1; info->debug_loader_offset = load_addr; - solib_add (NULL, from_tty, ¤t_target, auto_solib_add); + solib_add (NULL, from_tty, current_target, auto_solib_add); } /* Record the relocated start and end address of the dynamic linker @@ -2527,7 +2527,7 @@ enable_break (struct svr4_info *info, int from_tty) sym_addr = BMSYMBOL_VALUE_ADDRESS (msymbol); sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (), sym_addr, - ¤t_target); + current_target); svr4_create_solib_event_breakpoints (target_gdbarch (), sym_addr); return 1; } @@ -2544,7 +2544,7 @@ enable_break (struct svr4_info *info, int from_tty) sym_addr = BMSYMBOL_VALUE_ADDRESS (msymbol); sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (), sym_addr, - ¤t_target); + current_target); svr4_create_solib_event_breakpoints (target_gdbarch (), sym_addr); return 1; } @@ -2647,7 +2647,7 @@ svr4_exec_displacement (CORE_ADDR *displacementp) if ((bfd_get_file_flags (exec_bfd) & DYNAMIC) == 0) return 0; - if (target_auxv_search (¤t_target, AT_ENTRY, &entry_point) <= 0) + if (target_auxv_search (current_target, AT_ENTRY, &entry_point) <= 0) return 0; exec_displacement = entry_point - bfd_get_start_address (exec_bfd); diff --git a/gdb/solib-target.c b/gdb/solib-target.c index 7745a4a..ab700b1 100644 --- a/gdb/solib-target.c +++ b/gdb/solib-target.c @@ -260,7 +260,7 @@ solib_target_current_sos (void) int ix; /* Fetch the list of shared libraries. */ - library_document = target_read_stralloc (¤t_target, + library_document = target_read_stralloc (current_target, TARGET_OBJECT_LIBRARIES, NULL); if (library_document == NULL) diff --git a/gdb/solib.c b/gdb/solib.c index 9a6e7de..8b63375 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -1340,7 +1340,7 @@ handle_solib_event (void) be adding them automatically. Switch terminal for any messages produced by breakpoint_re_set. */ target_terminal_ours_for_output (); - solib_add (NULL, 0, ¤t_target, auto_solib_add); + solib_add (NULL, 0, current_target, auto_solib_add); target_terminal_inferior (); } diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index b2bba26..a98902e 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -187,7 +187,7 @@ ULONGEST sparc_fetch_wcookie (struct gdbarch *gdbarch) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - struct target_ops *ops = ¤t_target; + struct target_ops *ops = current_target; gdb_byte buf[8]; int len; diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index c94b46e8..c188baa 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -198,7 +198,7 @@ spu_pseudo_register_read_spu (struct regcache *regcache, const char *regname, return status; xsnprintf (annex, sizeof annex, "%d/%s", (int) id, regname); memset (reg, 0, sizeof reg); - target_read (¤t_target, TARGET_OBJECT_SPU, annex, + target_read (current_target, TARGET_OBJECT_SPU, annex, reg, 0, sizeof reg); ul = strtoulst ((char *) reg, NULL, 16); @@ -229,7 +229,7 @@ spu_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, if (status != REG_VALID) return status; xsnprintf (annex, sizeof annex, "%d/fpcr", (int) id); - target_read (¤t_target, TARGET_OBJECT_SPU, annex, buf, 0, 16); + target_read (current_target, TARGET_OBJECT_SPU, annex, buf, 0, 16); return status; case SPU_SRR0_REGNUM: @@ -263,7 +263,7 @@ spu_pseudo_register_write_spu (struct regcache *regcache, const char *regname, 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 (¤t_target, TARGET_OBJECT_SPU, annex, + target_write (current_target, TARGET_OBJECT_SPU, annex, (gdb_byte *) reg, 0, strlen (reg)); } @@ -286,7 +286,7 @@ spu_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, case SPU_FPSCR_REGNUM: regcache_raw_read_unsigned (regcache, SPU_ID_REGNUM, &id); xsnprintf (annex, sizeof annex, "%d/fpcr", (int) id); - target_write (¤t_target, TARGET_OBJECT_SPU, annex, buf, 0, 16); + target_write (current_target, TARGET_OBJECT_SPU, annex, buf, 0, 16); break; case SPU_SRR0_REGNUM: @@ -2103,7 +2103,7 @@ info_spu_event_command (char *args, int from_tty) id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); xsnprintf (annex, sizeof annex, "%d/event_status", id); - len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, + len = target_read (current_target, TARGET_OBJECT_SPU, annex, buf, 0, (sizeof (buf) - 1)); if (len <= 0) error (_("Could not read event_status.")); @@ -2111,7 +2111,7 @@ info_spu_event_command (char *args, int from_tty) event_status = strtoulst ((char *) buf, NULL, 16); xsnprintf (annex, sizeof annex, "%d/event_mask", id); - len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, + len = target_read (current_target, TARGET_OBJECT_SPU, annex, buf, 0, (sizeof (buf) - 1)); if (len <= 0) error (_("Could not read event_mask.")); @@ -2160,7 +2160,7 @@ info_spu_signal_command (char *args, int from_tty) id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); xsnprintf (annex, sizeof annex, "%d/signal1", id); - len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, buf, 0, 4); + len = target_read (current_target, TARGET_OBJECT_SPU, annex, buf, 0, 4); if (len < 0) error (_("Could not read signal1.")); else if (len == 4) @@ -2170,7 +2170,7 @@ info_spu_signal_command (char *args, int from_tty) } xsnprintf (annex, sizeof annex, "%d/signal1_type", id); - len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, + len = target_read (current_target, TARGET_OBJECT_SPU, annex, buf, 0, (sizeof (buf) - 1)); if (len <= 0) error (_("Could not read signal1_type.")); @@ -2178,7 +2178,7 @@ info_spu_signal_command (char *args, int from_tty) signal1_type = strtoulst ((char *) buf, NULL, 16); xsnprintf (annex, sizeof annex, "%d/signal2", id); - len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, buf, 0, 4); + len = target_read (current_target, TARGET_OBJECT_SPU, annex, buf, 0, 4); if (len < 0) error (_("Could not read signal2.")); else if (len == 4) @@ -2188,7 +2188,7 @@ info_spu_signal_command (char *args, int from_tty) } xsnprintf (annex, sizeof annex, "%d/signal2_type", id); - len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, + len = target_read (current_target, TARGET_OBJECT_SPU, annex, buf, 0, (sizeof (buf) - 1)); if (len <= 0) error (_("Could not read signal2_type.")); @@ -2283,7 +2283,7 @@ info_spu_mailbox_command (char *args, int from_tty) chain = make_cleanup_ui_out_tuple_begin_end (current_uiout, "SPUInfoMailbox"); xsnprintf (annex, sizeof annex, "%d/mbox_info", id); - len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, + len = target_read (current_target, TARGET_OBJECT_SPU, annex, buf, 0, sizeof buf); if (len < 0) error (_("Could not read mbox_info.")); @@ -2292,7 +2292,7 @@ info_spu_mailbox_command (char *args, int from_tty) "mbox", "SPU Outbound Mailbox"); xsnprintf (annex, sizeof annex, "%d/ibox_info", id); - len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, + len = target_read (current_target, TARGET_OBJECT_SPU, annex, buf, 0, sizeof buf); if (len < 0) error (_("Could not read ibox_info.")); @@ -2301,7 +2301,7 @@ info_spu_mailbox_command (char *args, int from_tty) "ibox", "SPU Outbound Interrupt Mailbox"); xsnprintf (annex, sizeof annex, "%d/wbox_info", id); - len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, + len = target_read (current_target, TARGET_OBJECT_SPU, annex, buf, 0, sizeof buf); if (len < 0) error (_("Could not read wbox_info.")); @@ -2523,7 +2523,7 @@ info_spu_dma_command (char *args, int from_tty) id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); xsnprintf (annex, sizeof annex, "%d/dma_info", id); - len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, + len = target_read (current_target, TARGET_OBJECT_SPU, annex, buf, 0, 40 + 16 * 32); if (len <= 0) error (_("Could not read dma_info.")); @@ -2602,7 +2602,7 @@ info_spu_proxydma_command (char *args, int from_tty) id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); xsnprintf (annex, sizeof annex, "%d/proxydma_info", id); - len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, + len = target_read (current_target, TARGET_OBJECT_SPU, annex, buf, 0, 24 + 8 * 32); if (len <= 0) error (_("Could not read proxydma_info.")); diff --git a/gdb/symfile.c b/gdb/symfile.c index 682e3ca..6cba9ee 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -946,7 +946,7 @@ init_entry_point_info (struct objfile *objfile) entry_point = gdbarch_convert_from_func_ptr_addr (get_objfile_arch (objfile), entry_point, - ¤t_target); + current_target); /* Remove any ISA markers, so that this matches entries in the symbol table. */ diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index de365c9..fa7313f 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -348,11 +348,11 @@ target_find_description (void) /* 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 (¤t_target); + current_target_desc = target_read_description_xml (current_target); /* If that failed try a target-specific hook. */ if (current_target_desc == NULL) - current_target_desc = target_read_description (¤t_target); + current_target_desc = target_read_description (current_target); /* If a non-NULL description was returned, then update the current architecture. */ diff --git a/gdb/target-memory.c b/gdb/target-memory.c index 9067033..2812b9d 100644 --- a/gdb/target-memory.c +++ b/gdb/target-memory.c @@ -397,7 +397,7 @@ target_write_memory_blocks (VEC(memory_write_request_s) *requests, { LONGEST len; - len = target_write_with_progress (current_target.beneath, + len = target_write_with_progress (current_target->beneath, TARGET_OBJECT_MEMORY, NULL, r->data, r->begin, r->end - r->begin, progress_cb, r->baton); @@ -420,7 +420,7 @@ target_write_memory_blocks (VEC(memory_write_request_s) *requests, { LONGEST len; - len = target_write_with_progress (¤t_target, + len = target_write_with_progress (current_target, TARGET_OBJECT_FLASH, NULL, r->data, r->begin, r->end - r->begin, diff --git a/gdb/target.c b/gdb/target.c index c791aa5..345a668 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -130,7 +130,7 @@ static struct target_ops *target_stack; /* The target structure we are currently using to talk to a process or file or whatever "inferior" we have. */ -struct target_ops current_target; +struct target_ops *current_target; /* Command list for target. */ @@ -249,7 +249,7 @@ target_has_all_memory_1 (void) { struct target_ops *t; - for (t = current_target.beneath; t != NULL; t = t->beneath) + for (t = current_target->beneath; t != NULL; t = t->beneath) if (t->to_has_all_memory (t)) return 1; @@ -261,7 +261,7 @@ target_has_memory_1 (void) { struct target_ops *t; - for (t = current_target.beneath; t != NULL; t = t->beneath) + for (t = current_target->beneath; t != NULL; t = t->beneath) if (t->to_has_memory (t)) return 1; @@ -273,7 +273,7 @@ target_has_stack_1 (void) { struct target_ops *t; - for (t = current_target.beneath; t != NULL; t = t->beneath) + for (t = current_target->beneath; t != NULL; t = t->beneath) if (t->to_has_stack (t)) return 1; @@ -285,7 +285,7 @@ target_has_registers_1 (void) { struct target_ops *t; - for (t = current_target.beneath; t != NULL; t = t->beneath) + for (t = current_target->beneath; t != NULL; t = t->beneath) if (t->to_has_registers (t)) return 1; @@ -297,7 +297,7 @@ target_has_execution_1 (ptid_t the_ptid) { struct target_ops *t; - for (t = current_target.beneath; t != NULL; t = t->beneath) + for (t = current_target->beneath; t != NULL; t = t->beneath) if (t->to_has_execution (t, the_ptid)) return 1; @@ -421,14 +421,14 @@ add_deprecated_target_alias (struct target_ops *t, char *alias) void target_kill (void) { - current_target.to_kill (¤t_target); + current_target->to_kill (current_target); } void target_load (const char *arg, int from_tty) { target_dcache_invalidate (); - (*current_target.to_load) (¤t_target, arg, from_tty); + (*current_target->to_load) (current_target, arg, from_tty); } /* Possible terminal states. */ @@ -453,7 +453,7 @@ static enum terminal_state terminal_state = terminal_is_ours; void target_terminal_init (void) { - (*current_target.to_terminal_init) (¤t_target); + (*current_target->to_terminal_init) (current_target); terminal_state = terminal_is_ours; } @@ -483,7 +483,7 @@ target_terminal_inferior (void) /* If GDB is resuming the inferior in the foreground, install inferior's terminal modes. */ - (*current_target.to_terminal_inferior) (¤t_target); + (*current_target->to_terminal_inferior) (current_target); terminal_state = terminal_is_inferior; } @@ -495,7 +495,7 @@ target_terminal_ours (void) if (terminal_state == terminal_is_ours) return; - (*current_target.to_terminal_ours) (¤t_target); + (*current_target->to_terminal_ours) (current_target); terminal_state = terminal_is_ours; } @@ -506,7 +506,7 @@ target_terminal_ours_for_output (void) { if (terminal_state != terminal_is_inferior) return; - (*current_target.to_terminal_ours_for_output) (¤t_target); + (*current_target->to_terminal_ours_for_output) (current_target); terminal_state = terminal_is_ours_for_output; } @@ -517,7 +517,7 @@ target_supports_terminal_ours (void) { struct target_ops *t; - for (t = current_target.beneath; t != NULL; t = t->beneath) + for (t = current_target->beneath; t != NULL; t = t->beneath) { if (t->to_terminal_ours != delegate_terminal_ours && t->to_terminal_ours != tdefault_terminal_ours) @@ -565,7 +565,7 @@ static void tcomplain (void) { error (_("You can't do that when your target is `%s'"), - current_target.to_shortname); + current_target->to_shortname); } void @@ -622,16 +622,16 @@ update_current_target (void) struct target_ops *t; /* First, reset current's contents. */ - memset (¤t_target, 0, sizeof (current_target)); + memset (current_target, 0, sizeof (struct target_ops)); /* Install the delegators. */ - install_delegators (¤t_target); + install_delegators (current_target); - current_target.to_stratum = target_stack->to_stratum; + current_target->to_stratum = target_stack->to_stratum; #define INHERIT(FIELD, TARGET) \ - if (!current_target.FIELD) \ - current_target.FIELD = (TARGET)->FIELD + if (!current_target->FIELD) \ + current_target->FIELD = (TARGET)->FIELD /* Do not add any new INHERITs here. Instead, use the delegation mechanism provided by make-target-delegates. */ @@ -649,7 +649,7 @@ update_current_target (void) /* Finally, position the target-stack beneath the squashed "current_target". That way code looking for a non-inherited target method can quickly and simply find it. */ - current_target.beneath = target_stack; + current_target->beneath = target_stack; if (targetdebug) setup_target_debug (); @@ -771,7 +771,7 @@ unpush_target (struct target_ops *t) void pop_all_targets_above (enum strata above_stratum) { - while ((int) (current_target.to_stratum) > (int) above_stratum) + while ((int) (current_target->to_stratum) > (int) above_stratum) { if (!unpush_target (target_stack)) { @@ -831,7 +831,7 @@ CORE_ADDR target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset) { volatile CORE_ADDR addr = 0; - struct target_ops *target = ¤t_target; + struct target_ops *target = current_target; if (gdbarch_fetch_tls_load_module_address_p (target_gdbarch ())) { @@ -1414,10 +1414,10 @@ target_xfer_partial (struct target_ops *ops, int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len) { - /* Dispatch to the topmost target, not the flattened current_target. + /* Dispatch to the topmost target, not the flattened current_target-> Memory accesses check target->to_has_(all_)memory, and the flattened target doesn't inherit those. */ - if (target_read (current_target.beneath, TARGET_OBJECT_MEMORY, NULL, + if (target_read (current_target->beneath, TARGET_OBJECT_MEMORY, NULL, myaddr, memaddr, len) == len) return 0; else @@ -1448,8 +1448,8 @@ int target_read_raw_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len) { /* See comment in target_read_memory about why the request starts at - current_target.beneath. */ - if (target_read (current_target.beneath, TARGET_OBJECT_RAW_MEMORY, NULL, + current_target->beneath. */ + if (target_read (current_target->beneath, TARGET_OBJECT_RAW_MEMORY, NULL, myaddr, memaddr, len) == len) return 0; else @@ -1463,8 +1463,8 @@ int target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len) { /* See comment in target_read_memory about why the request starts at - current_target.beneath. */ - if (target_read (current_target.beneath, TARGET_OBJECT_STACK_MEMORY, NULL, + current_target->beneath. */ + if (target_read (current_target->beneath, TARGET_OBJECT_STACK_MEMORY, NULL, myaddr, memaddr, len) == len) return 0; else @@ -1478,8 +1478,8 @@ int target_read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len) { /* See comment in target_read_memory about why the request starts at - current_target.beneath. */ - if (target_read (current_target.beneath, TARGET_OBJECT_CODE_MEMORY, NULL, + current_target->beneath. */ + if (target_read (current_target->beneath, TARGET_OBJECT_CODE_MEMORY, NULL, myaddr, memaddr, len) == len) return 0; else @@ -1496,8 +1496,8 @@ int target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len) { /* See comment in target_read_memory about why the request starts at - current_target.beneath. */ - if (target_write (current_target.beneath, TARGET_OBJECT_MEMORY, NULL, + current_target->beneath. */ + if (target_write (current_target->beneath, TARGET_OBJECT_MEMORY, NULL, myaddr, memaddr, len) == len) return 0; else @@ -1514,8 +1514,8 @@ int target_write_raw_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len) { /* See comment in target_read_memory about why the request starts at - current_target.beneath. */ - if (target_write (current_target.beneath, TARGET_OBJECT_RAW_MEMORY, NULL, + current_target->beneath. */ + if (target_write (current_target->beneath, TARGET_OBJECT_RAW_MEMORY, NULL, myaddr, memaddr, len) == len) return 0; else @@ -1532,7 +1532,7 @@ target_memory_map (void) int ix; struct target_ops *t; - result = current_target.to_memory_map (¤t_target); + result = current_target->to_memory_map (current_target); if (result == NULL) return NULL; @@ -1563,13 +1563,13 @@ target_memory_map (void) void target_flash_erase (ULONGEST address, LONGEST length) { - current_target.to_flash_erase (¤t_target, address, length); + current_target->to_flash_erase (current_target, address, length); } void target_flash_done (void) { - current_target.to_flash_done (¤t_target); + current_target->to_flash_done (current_target); } static void @@ -2072,7 +2072,7 @@ target_insert_breakpoint (struct gdbarch *gdbarch, return 1; } - return current_target.to_insert_breakpoint (¤t_target, + return current_target->to_insert_breakpoint (current_target, gdbarch, bp_tgt); } @@ -2092,7 +2092,7 @@ target_remove_breakpoint (struct gdbarch *gdbarch, return 1; } - return current_target.to_remove_breakpoint (¤t_target, + return current_target->to_remove_breakpoint (current_target, gdbarch, bp_tgt); } @@ -2235,7 +2235,7 @@ target_detach (const char *args, int from_tty) prepare_for_detach (); - current_target.to_detach (¤t_target, args, from_tty); + current_target->to_detach (current_target, args, from_tty); } void @@ -2246,13 +2246,13 @@ target_disconnect (const char *args, int from_tty) disconnecting. */ remove_breakpoints (); - current_target.to_disconnect (¤t_target, args, from_tty); + current_target->to_disconnect (current_target, args, from_tty); } ptid_t target_wait (ptid_t ptid, struct target_waitstatus *status, int options) { - return (current_target.to_wait) (¤t_target, ptid, status, options); + return (current_target->to_wait) (current_target, ptid, status, options); } /* See target.h. */ @@ -2269,13 +2269,13 @@ default_target_wait (struct target_ops *ops, char * target_pid_to_str (ptid_t ptid) { - return (*current_target.to_pid_to_str) (¤t_target, ptid); + return (*current_target->to_pid_to_str) (current_target, ptid); } char * target_thread_name (struct thread_info *info) { - return current_target.to_thread_name (¤t_target, info); + return current_target->to_thread_name (current_target, info); } void @@ -2285,7 +2285,7 @@ target_resume (ptid_t ptid, int step, enum gdb_signal signal) target_dcache_invalidate (); - current_target.to_resume (¤t_target, ptid, step, signal); + current_target->to_resume (current_target, ptid, step, signal); registers_changed_ptid (ptid); /* We only set the internal executing state here. The user/frontend @@ -2297,13 +2297,13 @@ target_resume (ptid_t ptid, int step, enum gdb_signal signal) void target_pass_signals (int numsigs, unsigned char *pass_signals) { - (*current_target.to_pass_signals) (¤t_target, numsigs, pass_signals); + (*current_target->to_pass_signals) (current_target, numsigs, pass_signals); } void target_program_signals (int numsigs, unsigned char *program_signals) { - (*current_target.to_program_signals) (¤t_target, + (*current_target->to_program_signals) (current_target, numsigs, program_signals); } @@ -2322,7 +2322,7 @@ default_follow_fork (struct target_ops *self, int follow_child, int target_follow_fork (int follow_child, int detach_fork) { - return current_target.to_follow_fork (¤t_target, + return current_target->to_follow_fork (current_target, follow_child, detach_fork); } @@ -2331,7 +2331,7 @@ target_follow_fork (int follow_child, int detach_fork) void target_follow_exec (struct inferior *inf, char *execd_pathname) { - current_target.to_follow_exec (¤t_target, inf, execd_pathname); + current_target->to_follow_exec (current_target, inf, execd_pathname); } static void @@ -2344,7 +2344,7 @@ default_mourn_inferior (struct target_ops *self) void target_mourn_inferior (void) { - current_target.to_mourn_inferior (¤t_target); + current_target->to_mourn_inferior (current_target); /* We no longer need to keep handles on any of the object files. Make sure to release them to avoid unnecessarily locking any @@ -2477,7 +2477,7 @@ default_search_memory (struct target_ops *self, CORE_ADDR *found_addrp) { /* Start over from the top of the target stack. */ - return simple_search_memory (current_target.beneath, + return simple_search_memory (current_target->beneath, start_addr, search_space_len, pattern, pattern_len, found_addrp); } @@ -2494,7 +2494,7 @@ target_search_memory (CORE_ADDR start_addr, ULONGEST search_space_len, const gdb_byte *pattern, ULONGEST pattern_len, CORE_ADDR *found_addrp) { - return current_target.to_search_memory (¤t_target, start_addr, + return current_target->to_search_memory (current_target, start_addr, search_space_len, pattern, pattern_len, found_addrp); } @@ -2600,7 +2600,7 @@ find_attach_target (void) struct target_ops *t; /* If a target on the current stack can attach, use it. */ - for (t = current_target.beneath; t != NULL; t = t->beneath) + for (t = current_target->beneath; t != NULL; t = t->beneath) { if (t->to_attach != NULL) break; @@ -2621,7 +2621,7 @@ find_run_target (void) struct target_ops *t; /* If a target on the current stack can attach, use it. */ - for (t = current_target.beneath; t != NULL; t = t->beneath) + for (t = current_target->beneath; t != NULL; t = t->beneath) { if (t->to_create_inferior != NULL) break; @@ -2644,8 +2644,8 @@ target_info_proc (const char *args, enum info_proc_what what) /* If we're already connected to something that can get us OS related data, use it. Otherwise, try using the native target. */ - if (current_target.to_stratum >= process_stratum) - t = current_target.beneath; + if (current_target->to_stratum >= process_stratum) + t = current_target->beneath; else t = find_default_run_target (NULL); @@ -2682,7 +2682,7 @@ target_supports_disable_randomization (void) { struct target_ops *t; - for (t = ¤t_target; t != NULL; t = t->beneath) + for (t = current_target; t != NULL; t = t->beneath) if (t->to_supports_disable_randomization) return t->to_supports_disable_randomization (t); @@ -2697,8 +2697,8 @@ target_get_osdata (const char *type) /* If we're already connected to something that can get us OS related data, use it. Otherwise, try using the native target. */ - if (current_target.to_stratum >= process_stratum) - t = current_target.beneath; + if (current_target->to_stratum >= process_stratum) + t = current_target->beneath; else t = find_default_run_target ("get OS data"); @@ -2732,7 +2732,7 @@ target_thread_address_space (ptid_t ptid) { struct address_space *aspace; - aspace = current_target.to_thread_address_space (¤t_target, ptid); + aspace = current_target->to_thread_address_space (current_target, ptid); gdb_assert (aspace != NULL); return aspace; @@ -2746,8 +2746,8 @@ default_fileio_target (void) { /* If we're already connected to something that can perform file I/O, use it. Otherwise, try using the native target. */ - if (current_target.to_stratum >= process_stratum) - return current_target.beneath; + if (current_target->to_stratum >= process_stratum) + return current_target->beneath; else return find_default_run_target ("file I/O"); } @@ -3202,7 +3202,7 @@ find_target_at (enum strata stratum) { struct target_ops *t; - for (t = current_target.beneath; t != NULL; t = t->beneath) + for (t = current_target->beneath; t != NULL; t = t->beneath) if (t->to_stratum == stratum) return t; @@ -3321,13 +3321,13 @@ target_close (struct target_ops *targ) int target_thread_alive (ptid_t ptid) { - return current_target.to_thread_alive (¤t_target, ptid); + return current_target->to_thread_alive (current_target, ptid); } void target_update_thread_list (void) { - current_target.to_update_thread_list (¤t_target); + current_target->to_update_thread_list (current_target); } void @@ -3339,7 +3339,7 @@ target_stop (ptid_t ptid) return; } - (*current_target.to_stop) (¤t_target, ptid); + (*current_target->to_stop) (current_target, ptid); } void @@ -3351,7 +3351,7 @@ target_interrupt (ptid_t ptid) return; } - (*current_target.to_interrupt) (¤t_target, ptid); + (*current_target->to_interrupt) (current_target, ptid); } /* See target.h. */ @@ -3359,7 +3359,7 @@ target_interrupt (ptid_t ptid) void target_check_pending_interrupt (void) { - (*current_target.to_check_pending_interrupt) (¤t_target); + (*current_target->to_check_pending_interrupt) (current_target); } /* See target/target.h. */ @@ -3475,7 +3475,7 @@ debug_print_register (const char * func, void target_fetch_registers (struct regcache *regcache, int regno) { - current_target.to_fetch_registers (¤t_target, regcache, regno); + current_target->to_fetch_registers (current_target, regcache, regno); if (targetdebug) debug_print_register ("target_fetch_registers", regcache, regno); } @@ -3488,7 +3488,7 @@ target_store_registers (struct regcache *regcache, int regno) if (!may_write_registers) error (_("Writing to registers is not allowed (regno %d)"), regno); - current_target.to_store_registers (¤t_target, regcache, regno); + current_target->to_store_registers (current_target, regcache, regno); if (targetdebug) { debug_print_register ("target_store_registers", regcache, regno); @@ -3498,7 +3498,7 @@ target_store_registers (struct regcache *regcache, int regno) int target_core_of_thread (ptid_t ptid) { - return current_target.to_core_of_thread (¤t_target, ptid); + return current_target->to_core_of_thread (current_target, ptid); } int @@ -3536,14 +3536,14 @@ default_verify_memory (struct target_ops *self, const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size) { /* Start over from the top of the target stack. */ - return simple_verify_memory (current_target.beneath, + return simple_verify_memory (current_target->beneath, data, memaddr, size); } int target_verify_memory (const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size) { - return current_target.to_verify_memory (¤t_target, + return current_target->to_verify_memory (current_target, data, memaddr, size); } @@ -3553,7 +3553,7 @@ target_verify_memory (const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size) int target_insert_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask, int rw) { - return current_target.to_insert_mask_watchpoint (¤t_target, + return current_target->to_insert_mask_watchpoint (current_target, addr, mask, rw); } @@ -3563,7 +3563,7 @@ target_insert_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask, int rw) int target_remove_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask, int rw) { - return current_target.to_remove_mask_watchpoint (¤t_target, + return current_target->to_remove_mask_watchpoint (current_target, addr, mask, rw); } @@ -3573,7 +3573,7 @@ target_remove_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask, int rw) int target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask) { - return current_target.to_masked_watch_num_registers (¤t_target, + return current_target->to_masked_watch_num_registers (current_target, addr, mask); } @@ -3583,7 +3583,7 @@ target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask) int target_ranged_break_num_registers (void) { - return current_target.to_ranged_break_num_registers (¤t_target); + return current_target->to_ranged_break_num_registers (current_target); } /* See target.h. */ @@ -3591,7 +3591,7 @@ target_ranged_break_num_registers (void) int target_supports_btrace (enum btrace_format format) { - return current_target.to_supports_btrace (¤t_target, format); + return current_target->to_supports_btrace (current_target, format); } /* See target.h. */ @@ -3599,7 +3599,7 @@ target_supports_btrace (enum btrace_format format) struct btrace_target_info * target_enable_btrace (ptid_t ptid, const struct btrace_config *conf) { - return current_target.to_enable_btrace (¤t_target, ptid, conf); + return current_target->to_enable_btrace (current_target, ptid, conf); } /* See target.h. */ @@ -3607,7 +3607,7 @@ target_enable_btrace (ptid_t ptid, const struct btrace_config *conf) void target_disable_btrace (struct btrace_target_info *btinfo) { - current_target.to_disable_btrace (¤t_target, btinfo); + current_target->to_disable_btrace (current_target, btinfo); } /* See target.h. */ @@ -3615,7 +3615,7 @@ target_disable_btrace (struct btrace_target_info *btinfo) void target_teardown_btrace (struct btrace_target_info *btinfo) { - current_target.to_teardown_btrace (¤t_target, btinfo); + current_target->to_teardown_btrace (current_target, btinfo); } /* See target.h. */ @@ -3625,7 +3625,7 @@ target_read_btrace (struct btrace_data *btrace, struct btrace_target_info *btinfo, enum btrace_read_type type) { - return current_target.to_read_btrace (¤t_target, btrace, btinfo, type); + return current_target->to_read_btrace (current_target, btrace, btinfo, type); } /* See target.h. */ @@ -3633,7 +3633,7 @@ target_read_btrace (struct btrace_data *btrace, const struct btrace_config * target_btrace_conf (const struct btrace_target_info *btinfo) { - return current_target.to_btrace_conf (¤t_target, btinfo); + return current_target->to_btrace_conf (current_target, btinfo); } /* See target.h. */ @@ -3641,7 +3641,7 @@ target_btrace_conf (const struct btrace_target_info *btinfo) void target_stop_recording (void) { - current_target.to_stop_recording (¤t_target); + current_target->to_stop_recording (current_target); } /* See target.h. */ @@ -3649,7 +3649,7 @@ target_stop_recording (void) void target_save_record (const char *filename) { - current_target.to_save_record (¤t_target, filename); + current_target->to_save_record (current_target, filename); } /* See target.h. */ @@ -3659,7 +3659,7 @@ target_supports_delete_record (void) { struct target_ops *t; - for (t = current_target.beneath; t != NULL; t = t->beneath) + for (t = current_target->beneath; t != NULL; t = t->beneath) if (t->to_delete_record != delegate_delete_record && t->to_delete_record != tdefault_delete_record) return 1; @@ -3672,7 +3672,7 @@ target_supports_delete_record (void) void target_delete_record (void) { - current_target.to_delete_record (¤t_target); + current_target->to_delete_record (current_target); } /* See target.h. */ @@ -3680,7 +3680,7 @@ target_delete_record (void) int target_record_is_replaying (ptid_t ptid) { - return current_target.to_record_is_replaying (¤t_target, ptid); + return current_target->to_record_is_replaying (current_target, ptid); } /* See target.h. */ @@ -3688,7 +3688,7 @@ target_record_is_replaying (ptid_t ptid) int target_record_will_replay (ptid_t ptid, int dir) { - return current_target.to_record_will_replay (¤t_target, ptid, dir); + return current_target->to_record_will_replay (current_target, ptid, dir); } /* See target.h. */ @@ -3696,7 +3696,7 @@ target_record_will_replay (ptid_t ptid, int dir) void target_record_stop_replaying (void) { - current_target.to_record_stop_replaying (¤t_target); + current_target->to_record_stop_replaying (current_target); } /* See target.h. */ @@ -3704,7 +3704,7 @@ target_record_stop_replaying (void) void target_goto_record_begin (void) { - current_target.to_goto_record_begin (¤t_target); + current_target->to_goto_record_begin (current_target); } /* See target.h. */ @@ -3712,7 +3712,7 @@ target_goto_record_begin (void) void target_goto_record_end (void) { - current_target.to_goto_record_end (¤t_target); + current_target->to_goto_record_end (current_target); } /* See target.h. */ @@ -3720,7 +3720,7 @@ target_goto_record_end (void) void target_goto_record (ULONGEST insn) { - current_target.to_goto_record (¤t_target, insn); + current_target->to_goto_record (current_target, insn); } /* See target.h. */ @@ -3728,7 +3728,7 @@ target_goto_record (ULONGEST insn) void target_insn_history (int size, int flags) { - current_target.to_insn_history (¤t_target, size, flags); + current_target->to_insn_history (current_target, size, flags); } /* See target.h. */ @@ -3736,7 +3736,7 @@ target_insn_history (int size, int flags) void target_insn_history_from (ULONGEST from, int size, int flags) { - current_target.to_insn_history_from (¤t_target, from, size, flags); + current_target->to_insn_history_from (current_target, from, size, flags); } /* See target.h. */ @@ -3744,7 +3744,7 @@ target_insn_history_from (ULONGEST from, int size, int flags) void target_insn_history_range (ULONGEST begin, ULONGEST end, int flags) { - current_target.to_insn_history_range (¤t_target, begin, end, flags); + current_target->to_insn_history_range (current_target, begin, end, flags); } /* See target.h. */ @@ -3752,7 +3752,7 @@ target_insn_history_range (ULONGEST begin, ULONGEST end, int flags) void target_call_history (int size, int flags) { - current_target.to_call_history (¤t_target, size, flags); + current_target->to_call_history (current_target, size, flags); } /* See target.h. */ @@ -3760,7 +3760,7 @@ target_call_history (int size, int flags) void target_call_history_from (ULONGEST begin, int size, int flags) { - current_target.to_call_history_from (¤t_target, begin, size, flags); + current_target->to_call_history_from (current_target, begin, size, flags); } /* See target.h. */ @@ -3768,7 +3768,7 @@ target_call_history_from (ULONGEST begin, int size, int flags) void target_call_history_range (ULONGEST begin, ULONGEST end, int flags) { - current_target.to_call_history_range (¤t_target, begin, end, flags); + current_target->to_call_history_range (current_target, begin, end, flags); } /* See target.h. */ @@ -3776,7 +3776,7 @@ target_call_history_range (ULONGEST begin, ULONGEST end, int flags) const struct frame_unwind * target_get_unwinder (void) { - return current_target.to_get_unwinder (¤t_target); + return current_target->to_get_unwinder (current_target); } /* See target.h. */ @@ -3784,7 +3784,7 @@ target_get_unwinder (void) const struct frame_unwind * target_get_tailcall_unwinder (void) { - return current_target.to_get_tailcall_unwinder (¤t_target); + return current_target->to_get_tailcall_unwinder (current_target); } /* See target.h. */ @@ -3792,7 +3792,7 @@ target_get_tailcall_unwinder (void) void target_prepare_to_generate_core (void) { - current_target.to_prepare_to_generate_core (¤t_target); + current_target->to_prepare_to_generate_core (current_target); } /* See target.h. */ @@ -3800,15 +3800,15 @@ target_prepare_to_generate_core (void) void target_done_generating_core (void) { - current_target.to_done_generating_core (¤t_target); + current_target->to_done_generating_core (current_target); } static void setup_target_debug (void) { - memcpy (&debug_target, ¤t_target, sizeof debug_target); + memcpy (&debug_target, current_target, sizeof debug_target); - init_debug_target (¤t_target); + init_debug_target (current_target); } @@ -3852,7 +3852,7 @@ void target_async (int enable) { infrun_async (enable); - current_target.to_async (¤t_target, enable); + current_target->to_async (current_target, enable); } /* Controls if targets can report that they can/are async. This is @@ -3892,7 +3892,7 @@ maint_show_target_async_command (struct ui_file *file, int from_tty, static int target_always_non_stop_p (void) { - return current_target.to_always_non_stop_p (¤t_target); + return current_target->to_always_non_stop_p (current_target); } /* See target.h. */ @@ -4006,6 +4006,8 @@ set_write_memory_permission (char *args, int from_tty, void initialize_targets (void) { + current_target = XCNEW (struct target_ops); + init_dummy_target (); push_target (&dummy_target); diff --git a/gdb/target.h b/gdb/target.h index da04e47..e319271 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1259,12 +1259,12 @@ struct target_ops /* 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 current_target; +extern struct target_ops *current_target; /* Define easy words for doing these operations on our current target. */ -#define target_shortname (current_target.to_shortname) -#define target_longname (current_target.to_longname) +#define target_shortname (current_target->to_shortname) +#define target_longname (current_target->to_longname) /* Does whatever cleanup is required for a target that we are no longer going to be calling. This routine is automatically always @@ -1292,7 +1292,7 @@ extern struct target_ops *find_run_target (void); These targets must set to_attach_no_wait. */ #define target_attach_no_wait \ - (current_target.to_attach_no_wait) + (current_target->to_attach_no_wait) /* The target_attach operation places a process under debugger control, and stops the process. @@ -1300,7 +1300,7 @@ extern struct target_ops *find_run_target (void); This operation provides a target-specific hook that allows the necessary bookkeeping to be performed after an attach completes. */ #define target_post_attach(pid) \ - (*current_target.to_post_attach) (¤t_target, pid) + (*current_target->to_post_attach) (current_target, pid) /* Takes a program previously attached to and detaches it. The program may resume execution (some targets do, some don't) and will @@ -1365,7 +1365,7 @@ extern void target_store_registers (struct regcache *regcache, int regs); debugged. */ #define target_prepare_to_store(regcache) \ - (*current_target.to_prepare_to_store) (¤t_target, regcache) + (*current_target->to_prepare_to_store) (current_target, regcache) /* Determine current address space of thread PTID. */ @@ -1382,7 +1382,7 @@ int target_info_proc (const char *, enum info_proc_what); simultaneously. */ #define target_supports_multi_process() \ - (*current_target.to_supports_multi_process) (¤t_target) + (*current_target->to_supports_multi_process) (current_target) /* Returns true if this target can disable address space randomization. */ @@ -1392,22 +1392,22 @@ int target_supports_disable_randomization (void); while a trace experiment is running. */ #define target_supports_enable_disable_tracepoint() \ - (*current_target.to_supports_enable_disable_tracepoint) (¤t_target) + (*current_target->to_supports_enable_disable_tracepoint) (current_target) #define target_supports_string_tracing() \ - (*current_target.to_supports_string_tracing) (¤t_target) + (*current_target->to_supports_string_tracing) (current_target) /* Returns true if this target can handle breakpoint conditions on its end. */ #define target_supports_evaluation_of_breakpoint_conditions() \ - (*current_target.to_supports_evaluation_of_breakpoint_conditions) (¤t_target) + (*current_target->to_supports_evaluation_of_breakpoint_conditions) (current_target) /* Returns true if this target can handle breakpoint commands on its end. */ #define target_can_run_breakpoint_commands() \ - (*current_target.to_can_run_breakpoint_commands) (¤t_target) + (*current_target->to_can_run_breakpoint_commands) (current_target) extern int target_read_string (CORE_ADDR, char **, int, int *); @@ -1482,7 +1482,7 @@ int target_write_memory_blocks (VEC(memory_write_request_s) *requests, /* Print a line about the current target. */ #define target_files_info() \ - (*current_target.to_files_info) (¤t_target) + (*current_target->to_files_info) (current_target) /* Insert a breakpoint at address BP_TGT->placed_address in the target machine. Returns 0 for success, and returns non-zero or @@ -1539,7 +1539,7 @@ extern struct cleanup *make_cleanup_restore_target_terminal (void); exists. */ #define target_terminal_info(arg, from_tty) \ - (*current_target.to_terminal_info) (¤t_target, arg, from_tty) + (*current_target->to_terminal_info) (current_target, arg, from_tty) /* Kill the inferior process. Make it go away. */ @@ -1569,7 +1569,7 @@ extern void target_load (const char *arg, int from_tty); Such targets will supply an appropriate definition for this function. */ #define target_post_startup_inferior(ptid) \ - (*current_target.to_post_startup_inferior) (¤t_target, ptid) + (*current_target->to_post_startup_inferior) (current_target, ptid) /* On some targets, we can catch an inferior fork or vfork event when it occurs. These functions insert/remove an already-created @@ -1577,16 +1577,16 @@ extern void target_load (const char *arg, int from_tty); catchpoint type is not supported and -1 for failure. */ #define target_insert_fork_catchpoint(pid) \ - (*current_target.to_insert_fork_catchpoint) (¤t_target, pid) + (*current_target->to_insert_fork_catchpoint) (current_target, pid) #define target_remove_fork_catchpoint(pid) \ - (*current_target.to_remove_fork_catchpoint) (¤t_target, pid) + (*current_target->to_remove_fork_catchpoint) (current_target, pid) #define target_insert_vfork_catchpoint(pid) \ - (*current_target.to_insert_vfork_catchpoint) (¤t_target, pid) + (*current_target->to_insert_vfork_catchpoint) (current_target, pid) #define target_remove_vfork_catchpoint(pid) \ - (*current_target.to_remove_vfork_catchpoint) (¤t_target, pid) + (*current_target->to_remove_vfork_catchpoint) (current_target, pid) /* If the inferior forks or vforks, this function will be called at the next resume in order to perform any bookkeeping and fiddling @@ -1609,10 +1609,10 @@ void target_follow_exec (struct inferior *inf, char *execd_pathname); catchpoint type is not supported and -1 for failure. */ #define target_insert_exec_catchpoint(pid) \ - (*current_target.to_insert_exec_catchpoint) (¤t_target, pid) + (*current_target->to_insert_exec_catchpoint) (current_target, pid) #define target_remove_exec_catchpoint(pid) \ - (*current_target.to_remove_exec_catchpoint) (¤t_target, pid) + (*current_target->to_remove_exec_catchpoint) (current_target, pid) /* Syscall catch. @@ -1635,7 +1635,7 @@ void target_follow_exec (struct inferior *inf, char *execd_pathname); for failure. */ #define target_set_syscall_catchpoint(pid, needed, any_count, table_size, table) \ - (*current_target.to_set_syscall_catchpoint) (¤t_target, \ + (*current_target->to_set_syscall_catchpoint) (current_target, \ pid, needed, any_count, \ table_size, table) @@ -1643,7 +1643,7 @@ void target_follow_exec (struct inferior *inf, char *execd_pathname); exit code of PID, if any. */ #define target_has_exited(pid,wait_status,exit_status) \ - (*current_target.to_has_exited) (¤t_target, \ + (*current_target->to_has_exited) (current_target, \ pid,wait_status,exit_status) /* The debugger has completed a blocking wait() call. There is now @@ -1725,7 +1725,7 @@ extern void target_check_pending_interrupt (void); placed in OUTBUF. */ #define target_rcmd(command, outbuf) \ - (*current_target.to_rcmd) (¤t_target, command, outbuf) + (*current_target->to_rcmd) (current_target, command, outbuf) /* Does the target include all of memory, or only part of it? This @@ -1781,16 +1781,16 @@ extern int default_child_has_execution (struct target_ops *ops, Can it lock the thread scheduler? */ #define target_can_lock_scheduler \ - (current_target.to_has_thread_control & tc_schedlock) + (current_target->to_has_thread_control & tc_schedlock) /* Controls whether async mode is permitted. */ extern int target_async_permitted; /* Can the target support asynchronous execution? */ -#define target_can_async_p() (current_target.to_can_async_p (¤t_target)) +#define target_can_async_p() (current_target->to_can_async_p (current_target)) /* Is the target in asynchronous execution mode? */ -#define target_is_async_p() (current_target.to_is_async_p (¤t_target)) +#define target_is_async_p() (current_target->to_is_async_p (current_target)) /* Enables/disabled async target events. */ extern void target_async (int enable); @@ -1805,7 +1805,7 @@ extern enum auto_boolean target_non_stop_enabled; extern int target_is_non_stop_p (void); #define target_execution_direction() \ - (current_target.to_execution_direction (¤t_target)) + (current_target->to_execution_direction (current_target)) /* Converts a process id to a string. Usually, the string just contains `process xyz', but on some systems it may contain @@ -1820,7 +1820,7 @@ extern char *normal_pid_to_str (ptid_t ptid); is okay. */ #define target_extra_thread_info(TP) \ - (current_target.to_extra_thread_info (¤t_target, TP)) + (current_target->to_extra_thread_info (current_target, TP)) /* Return the thread's name. A NULL result means that the target could not determine this thread's name. */ @@ -1840,12 +1840,12 @@ extern char *target_thread_name (struct thread_info *); it must persist. */ #define target_pid_to_exec_file(pid) \ - (current_target.to_pid_to_exec_file) (¤t_target, pid) + (current_target->to_pid_to_exec_file) (current_target, pid) /* See the to_thread_architecture description in struct target_ops. */ #define target_thread_architecture(ptid) \ - (current_target.to_thread_architecture (¤t_target, ptid)) + (current_target->to_thread_architecture (current_target, ptid)) /* * Iterator function for target memory regions. @@ -1855,21 +1855,21 @@ extern char *target_thread_name (struct thread_info *); */ #define target_find_memory_regions(FUNC, DATA) \ - (current_target.to_find_memory_regions) (¤t_target, FUNC, DATA) + (current_target->to_find_memory_regions) (current_target, FUNC, DATA) /* * Compose corefile .note section. */ #define target_make_corefile_notes(BFD, SIZE_P) \ - (current_target.to_make_corefile_notes) (¤t_target, BFD, SIZE_P) + (current_target->to_make_corefile_notes) (current_target, BFD, SIZE_P) /* Bookmark interfaces. */ #define target_get_bookmark(ARGS, FROM_TTY) \ - (current_target.to_get_bookmark) (¤t_target, ARGS, FROM_TTY) + (current_target->to_get_bookmark) (current_target, ARGS, FROM_TTY) #define target_goto_bookmark(ARG, FROM_TTY) \ - (current_target.to_goto_bookmark) (¤t_target, ARG, FROM_TTY) + (current_target->to_goto_bookmark) (current_target, ARG, FROM_TTY) /* Hardware watchpoint interfaces. */ @@ -1877,32 +1877,32 @@ extern char *target_thread_name (struct thread_info *); write). Only the INFERIOR_PTID task is being queried. */ #define target_stopped_by_watchpoint() \ - ((*current_target.to_stopped_by_watchpoint) (¤t_target)) + ((*current_target->to_stopped_by_watchpoint) (current_target)) /* Returns non-zero if the target stopped because it executed a software breakpoint instruction. */ #define target_stopped_by_sw_breakpoint() \ - ((*current_target.to_stopped_by_sw_breakpoint) (¤t_target)) + ((*current_target->to_stopped_by_sw_breakpoint) (current_target)) #define target_supports_stopped_by_sw_breakpoint() \ - ((*current_target.to_supports_stopped_by_sw_breakpoint) (¤t_target)) + ((*current_target->to_supports_stopped_by_sw_breakpoint) (current_target)) #define target_stopped_by_hw_breakpoint() \ - ((*current_target.to_stopped_by_hw_breakpoint) (¤t_target)) + ((*current_target->to_stopped_by_hw_breakpoint) (current_target)) #define target_supports_stopped_by_hw_breakpoint() \ - ((*current_target.to_supports_stopped_by_hw_breakpoint) (¤t_target)) + ((*current_target->to_supports_stopped_by_hw_breakpoint) (current_target)) /* Non-zero if we have steppable watchpoints */ #define target_have_steppable_watchpoint \ - (current_target.to_have_steppable_watchpoint) + (current_target->to_have_steppable_watchpoint) /* Non-zero if we have continuable watchpoints */ #define target_have_continuable_watchpoint \ - (current_target.to_have_continuable_watchpoint) + (current_target->to_have_continuable_watchpoint) /* Provide defaults for hardware watchpoint functions. */ @@ -1918,19 +1918,19 @@ extern char *target_thread_name (struct thread_info *); one. OTHERTYPE is who knows what... */ #define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \ - (*current_target.to_can_use_hw_breakpoint) (¤t_target, \ - TYPE, CNT, OTHERTYPE) + (*current_target->to_can_use_hw_breakpoint) (current_target, \ + 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) \ - (*current_target.to_region_ok_for_hw_watchpoint) (¤t_target, \ + (*current_target->to_region_ok_for_hw_watchpoint) (current_target, \ addr, len) #define target_can_do_single_step() \ - (*current_target.to_can_do_single_step) (¤t_target) + (*current_target->to_can_do_single_step) (current_target) /* 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. @@ -1939,11 +1939,11 @@ extern char *target_thread_name (struct thread_info *); -1 for failure. */ #define target_insert_watchpoint(addr, len, type, cond) \ - (*current_target.to_insert_watchpoint) (¤t_target, \ + (*current_target->to_insert_watchpoint) (current_target, \ addr, len, type, cond) #define target_remove_watchpoint(addr, len, type, cond) \ - (*current_target.to_remove_watchpoint) (¤t_target, \ + (*current_target->to_remove_watchpoint) (current_target, \ addr, len, type, cond) /* Insert a new masked watchpoint at ADDR using the mask MASK. @@ -1966,11 +1966,11 @@ extern int target_remove_mask_watchpoint (CORE_ADDR, CORE_ADDR, int); message) otherwise. */ #define target_insert_hw_breakpoint(gdbarch, bp_tgt) \ - (*current_target.to_insert_hw_breakpoint) (¤t_target, \ + (*current_target->to_insert_hw_breakpoint) (current_target, \ gdbarch, bp_tgt) #define target_remove_hw_breakpoint(gdbarch, bp_tgt) \ - (*current_target.to_remove_hw_breakpoint) (¤t_target, \ + (*current_target->to_remove_hw_breakpoint) (current_target, \ gdbarch, bp_tgt) /* Return number of debug registers needed for a ranged breakpoint, @@ -2000,7 +2000,7 @@ extern int target_ranged_break_num_registers (void); For this reason, GDB will still evaluate the condition expression when the watchpoint triggers. */ #define target_can_accel_watchpoint_condition(addr, len, type, cond) \ - (*current_target.to_can_accel_watchpoint_condition) (¤t_target, \ + (*current_target->to_can_accel_watchpoint_condition) (current_target, \ addr, len, type, cond) /* Return number of debug registers needed for a masked watchpoint, @@ -2011,12 +2011,12 @@ extern int target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask); /* Target can execute in reverse? */ #define target_can_execute_reverse \ - current_target.to_can_execute_reverse (¤t_target) + current_target->to_can_execute_reverse (current_target) extern const struct target_desc *target_read_description (struct target_ops *); #define target_get_ada_task_ptid(lwp, tid) \ - (*current_target.to_get_ada_task_ptid) (¤t_target, lwp,tid) + (*current_target->to_get_ada_task_ptid) (current_target, lwp,tid) /* Utility implementation of searching memory. */ extern int simple_search_memory (struct target_ops* ops, @@ -2038,7 +2038,7 @@ extern int target_search_memory (CORE_ADDR start_addr, /* Return nonzero if the filesystem seen by the current inferior is the local filesystem, zero otherwise. */ #define target_filesystem_is_local() \ - current_target.to_filesystem_is_local (¤t_target) + current_target->to_filesystem_is_local (current_target) /* Open FILENAME on the target, in the filesystem as seen by INF, using FLAGS and MODE. If INF is NULL, use the filesystem seen @@ -2126,105 +2126,105 @@ extern char *target_fileio_read_stralloc (struct inferior *inf, /* Tracepoint-related operations. */ #define target_trace_init() \ - (*current_target.to_trace_init) (¤t_target) + (*current_target->to_trace_init) (current_target) #define target_download_tracepoint(t) \ - (*current_target.to_download_tracepoint) (¤t_target, t) + (*current_target->to_download_tracepoint) (current_target, t) #define target_can_download_tracepoint() \ - (*current_target.to_can_download_tracepoint) (¤t_target) + (*current_target->to_can_download_tracepoint) (current_target) #define target_download_trace_state_variable(tsv) \ - (*current_target.to_download_trace_state_variable) (¤t_target, tsv) + (*current_target->to_download_trace_state_variable) (current_target, tsv) #define target_enable_tracepoint(loc) \ - (*current_target.to_enable_tracepoint) (¤t_target, loc) + (*current_target->to_enable_tracepoint) (current_target, loc) #define target_disable_tracepoint(loc) \ - (*current_target.to_disable_tracepoint) (¤t_target, loc) + (*current_target->to_disable_tracepoint) (current_target, loc) #define target_trace_start() \ - (*current_target.to_trace_start) (¤t_target) + (*current_target->to_trace_start) (current_target) #define target_trace_set_readonly_regions() \ - (*current_target.to_trace_set_readonly_regions) (¤t_target) + (*current_target->to_trace_set_readonly_regions) (current_target) #define target_get_trace_status(ts) \ - (*current_target.to_get_trace_status) (¤t_target, ts) + (*current_target->to_get_trace_status) (current_target, ts) #define target_get_tracepoint_status(tp,utp) \ - (*current_target.to_get_tracepoint_status) (¤t_target, tp, utp) + (*current_target->to_get_tracepoint_status) (current_target, tp, utp) #define target_trace_stop() \ - (*current_target.to_trace_stop) (¤t_target) + (*current_target->to_trace_stop) (current_target) #define target_trace_find(type,num,addr1,addr2,tpp) \ - (*current_target.to_trace_find) (¤t_target, \ + (*current_target->to_trace_find) (current_target, \ (type), (num), (addr1), (addr2), (tpp)) #define target_get_trace_state_variable_value(tsv,val) \ - (*current_target.to_get_trace_state_variable_value) (¤t_target, \ + (*current_target->to_get_trace_state_variable_value) (current_target, \ (tsv), (val)) #define target_save_trace_data(filename) \ - (*current_target.to_save_trace_data) (¤t_target, filename) + (*current_target->to_save_trace_data) (current_target, filename) #define target_upload_tracepoints(utpp) \ - (*current_target.to_upload_tracepoints) (¤t_target, utpp) + (*current_target->to_upload_tracepoints) (current_target, utpp) #define target_upload_trace_state_variables(utsvp) \ - (*current_target.to_upload_trace_state_variables) (¤t_target, utsvp) + (*current_target->to_upload_trace_state_variables) (current_target, utsvp) #define target_get_raw_trace_data(buf,offset,len) \ - (*current_target.to_get_raw_trace_data) (¤t_target, \ + (*current_target->to_get_raw_trace_data) (current_target, \ (buf), (offset), (len)) #define target_get_min_fast_tracepoint_insn_len() \ - (*current_target.to_get_min_fast_tracepoint_insn_len) (¤t_target) + (*current_target->to_get_min_fast_tracepoint_insn_len) (current_target) #define target_set_disconnected_tracing(val) \ - (*current_target.to_set_disconnected_tracing) (¤t_target, val) + (*current_target->to_set_disconnected_tracing) (current_target, val) #define target_set_circular_trace_buffer(val) \ - (*current_target.to_set_circular_trace_buffer) (¤t_target, val) + (*current_target->to_set_circular_trace_buffer) (current_target, val) #define target_set_trace_buffer_size(val) \ - (*current_target.to_set_trace_buffer_size) (¤t_target, val) + (*current_target->to_set_trace_buffer_size) (current_target, val) #define target_set_trace_notes(user,notes,stopnotes) \ - (*current_target.to_set_trace_notes) (¤t_target, \ + (*current_target->to_set_trace_notes) (current_target, \ (user), (notes), (stopnotes)) #define target_get_tib_address(ptid, addr) \ - (*current_target.to_get_tib_address) (¤t_target, (ptid), (addr)) + (*current_target->to_get_tib_address) (current_target, (ptid), (addr)) #define target_set_permissions() \ - (*current_target.to_set_permissions) (¤t_target) + (*current_target->to_set_permissions) (current_target) #define target_static_tracepoint_marker_at(addr, marker) \ - (*current_target.to_static_tracepoint_marker_at) (¤t_target, \ + (*current_target->to_static_tracepoint_marker_at) (current_target, \ addr, marker) #define target_static_tracepoint_markers_by_strid(marker_id) \ - (*current_target.to_static_tracepoint_markers_by_strid) (¤t_target, \ + (*current_target->to_static_tracepoint_markers_by_strid) (current_target, \ marker_id) #define target_traceframe_info() \ - (*current_target.to_traceframe_info) (¤t_target) + (*current_target->to_traceframe_info) (current_target) #define target_use_agent(use) \ - (*current_target.to_use_agent) (¤t_target, use) + (*current_target->to_use_agent) (current_target, use) #define target_can_use_agent() \ - (*current_target.to_can_use_agent) (¤t_target) + (*current_target->to_can_use_agent) (current_target) #define target_augmented_libraries_svr4_read() \ - (*current_target.to_augmented_libraries_svr4_read) (¤t_target) + (*current_target->to_augmented_libraries_svr4_read) (current_target) /* Command logging facility. */ #define target_log_command(p) \ - (*current_target.to_log_command) (¤t_target, p) + (*current_target->to_log_command) (current_target, p) extern int target_core_of_thread (ptid_t ptid); diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 6ca66e7..1524813 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -4142,7 +4142,7 @@ sdata_make_value (struct gdbarch *gdbarch, struct internalvar *var, gdb_byte *buf; /* We need to read the whole object before we know its size. */ - size = target_read_alloc (¤t_target, + size = target_read_alloc (current_target, TARGET_OBJECT_STATIC_TRACE_DATA, NULL, &buf); if (size >= 0) diff --git a/gdb/valops.c b/gdb/valops.c index 1e372ef..fb0a312 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -967,7 +967,7 @@ read_value_memory (struct value *val, int embedded_offset, enum target_xfer_status status; ULONGEST xfered_partial; - status = target_xfer_partial (current_target.beneath, + status = target_xfer_partial (current_target->beneath, TARGET_OBJECT_MEMORY, NULL, buffer + xfered_total * unit_size, NULL, memaddr + xfered_total, @@ -1203,7 +1203,7 @@ value_assign (struct value *toval, struct value *fromval) case lval_register: case lval_computed: - observer_notify_target_changed (¤t_target); + observer_notify_target_changed (current_target); /* Having destroyed the frame cache, restore the selected frame. */ diff --git a/gdb/valprint.c b/gdb/valprint.c index c053a81..f634782 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -1788,7 +1788,7 @@ print_function_pointer_address (const struct value_print_options *options, { CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (gdbarch, address, - ¤t_target); + current_target); /* If the function pointer is represented by a description, print the address of the description. */ diff --git a/gdb/value.c b/gdb/value.c index 91bf49e..ebf4e0f 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -3164,7 +3164,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f, set_value_address (v, gdbarch_convert_from_func_ptr_addr - (gdbarch, BMSYMBOL_VALUE_ADDRESS (msym), ¤t_target)); + (gdbarch, BMSYMBOL_VALUE_ADDRESS (msym), current_target)); } if (arg1p) diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index 58e8fca..e18fe68 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -330,7 +330,7 @@ display_one_tib (ptid_t ptid) return -1; } - if (target_read (¤t_target, TARGET_OBJECT_MEMORY, + if (target_read (current_target, TARGET_OBJECT_MEMORY, NULL, tib, thread_local_base, tib_size) != tib_size) { printf_filtered (_("Unable to read thread information " |