diff options
Diffstat (limited to 'gdb')
42 files changed, 632 insertions, 251 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 496fb24..4e80a66 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,203 @@ 2009-07-02 Ulrich Weigand <uweigand@de.ibm.com> + * breakpoint.h (struct breakpoint): New member GDBARCH. + * breakpoint.c: Include "arch-utils.h". + (set_raw_breakpoint_without_location): Add GDBARCH parameter. + Use it to set breakpoint architecture. + (set_raw_breakpoint): Add GDBARCH parameter. + (create_internal_breakpoint): Likewise. + (create_catchpoint): Likewise. + (create_fork_vfork_event_catchpoint): Likewise. + (create_breakpoint): Likewise. + (create_breakpoints): Likewise. + (break_command_really): Likewise. + (create_ada_exception_breakpoint): Likewise. + Update local callers to pass architecture: + (create_internal_breakpoint): Update. + (create_overlay_event_breakpoint): Update. + (create_longjmp_master_breakpoint): Update. + (create_thread_event_breakpoint): Update. + (create_solib_event_breakpoint): Update. + (create_catchpoint): Update. + (create_fork_vfork_event_catchpoint): Update. + (set_momentary_breakpoint): Update. + (clone_momentary_breakpoint): Update. + (create_breakpoint): Update. + (create_breakpoints): Update. + (break_command_really): Update. + (break_command_1): Update. + (set_breakpoint): Update. + (watch_command_1): Update. + (catch_fork_command_1): Update. + (catch_exec_commnd_1): Update. + (handle_gnu_v3_exceptions): Update. + (create_ada_exception_breakpoint): Update. + (catch_ada_exception_command): Update. + (catch_assert_command): Update. + (trace_command): Update. + + * breakpoint.h (struct bp_location): New member GDBARCH. + * breakpoint.c (get_sal_arch): New function. + (set_raw_breakpoint): Set location architecture. + (add_location_to_breakpoint): Likewise. + (clone_momentary_breakpoint): Likewise. + (watch_command_1): Likewise. + (update_watchpoint): Likewise. + (bp_loc_is_permanent): Use location architecture instead of + current_gdbarch. + (adjust_breakpoint_address): Add GDBARCH parameter; use it + instead of current_gdbarch. + Update callers of adjust_breakpoint_address to pass + breakpoint location architecture: + (set_raw_breakpoint): Update. + (watch_command_1): Update. + + * tracepoint.c: (collect_symbol): Add GDBARCH parameter, use instead + of current_gdbarch. + (add_local_symbols): Add GDBARCH parameter. Pass to collect_symbol. + (encode_actions): Pass tracepoint architecture to add_local_symbols + (encode_actions): Use tracepoint architecture instead of + current_gdbarch. Pass it to add_local_symbols and collect_symbol. + + * breakpoint.h (struct breakpoint_ops): Replace last_addr parameter + of print_one callback with last_loc. + * breakpoint.c (print_one_breakpoint_location): Replace last_addr + parameter with last_loc. + (print_one_breakpoint): Likewise. + (do_captured_breakpoint_query): Update call. + (breakpoint_1): Pass last_loc instead of last_addr to + print_one_breakpoint. Pass last location architecture instead of + current_gdbarch to set_next_address. + Update all implementations of the print_one callback: + * breakpoint.c (print_one_catch_fork): Update. + (print_one_catch_vfork): Update. + (print_one_catch_exec): Update. + (print_one_exception_catchpoint): Update. + * ada-lang.c (print_one_exception): Update. + (print_one_catch_exception): Update. + (print_one_catch_exception_unhandled): Update. + (print_one_catch_assert): Update. + + * breakpoint.c (print_one_breakpoint_location): Add PRINT_ADDRESS_BITS + parameter. Use it instead of gdbarch_addr_bit (current_gdbarch). + (print_one_breakpoint): Add PRINT_ADDRESS_BITS parameter and pass it + to print_one_breakpoint_location. + (breakpoint_address_bits): New function. + (do_captured_breakpoint_query): Compute number of address bits to print + and pass it to print_one_breakpoint. + (breakpoint_1): Likewise. Use it instead of current_gdbarch. + + * breakpoint.h (create_thread_event_breakpoint): Add GDBARCH. + * breakpoint.c (create_thread_event_breakpoint): Likewise. + Update callers to create_thread_event_breakpoint: + * aix-thread.c (pd_enable): Update. + * linux-thread-db.c (enable_thread_event): Update. + + * breakpoint.h (create_solib_event_breakpoint): Add GDBARCH. + * breakpoint.c (create_solib_event_breakpoint): Likewise. + Update callers to create_solib_event_breakpoint: + * solib-frv.c (enable_break, enable_break2): Update. + * solib-pa64.c (pa64_solib_create_inferior_hook): Update. + * solib-som.c (som_solib_create_inferior_hook): Update. + * solib-darwin.c (darwin_solib_create_inferior_hook): Update. + * solib-svr4.c (enable_break): Update. + + * breakpoint.h (insert_single_step_breakpoint): Add GDBARCH. + * breakpoint.c (insert_single_step_breakpoint): Likewise. + Update callers to insert_single_step_breakpoint: + * alpha-tdep.c (alpha_software_single_step): Update. + * arm-linux-tdep.c (arm_linux_software_single_step): Update. + * arm-tdep.c (arm_software_single_step): Update. + * cris-tdep.c (cris_software_single_step): Update. + * rs6000-aix-tdep.c (rs6000_software_single_step): Update. + * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Update. + * sparc-tdep.c (sparc_software_single_step): Update. + * spu-tdep.c (spu_software_single_step): Update. + * mips-tdep.c (deal_with_atomic_sequence): Add GDBARCH parameter. + Pass it to insert_single_step_breakpoint. + (mips_software_single_step): Pass architecture to + deal_with_atomic_sequence and insert_single_step_breakpoint. + + * breakpoint.h (deprecated_insert_raw_breakpoint): Add GDBARCH. + (deprecated_remove_raw_breakpoint): Likewise. + * breakpoint.c (deprecated_insert_raw_breakpoint): Add GDBARCH. + (deprecated_remove_raw_breakpoint): Likewise. + Update callers to deprecated_insert_raw_breakpoint and + deprecated_remove_raw_breakpoint: + * breakpoint.c (single_step_gdbarch): New static variable. + (insert_single_step_breakpoint): Pass GDBARCH parameter to + deprecated_insert_raw_breakpoint. Store it in single_step_gdbarch. + (remove_single_step_breakpoints): Pass architecture stored in + single_step_gdbarch to deprecated_remove_raw_breakpoint. + * rs6000-nat.c (exec_one_dummy_insn): Update. + * solib-irix.c (enable_break, disable_break): Update. + * procfs.c (procfs_mourn_inferior): Update. + (remove_dbx_link_breakpoint): Update. + + * breakpoint.h (set_breakpoint): Add GDBARCH parameter. + (set_momentary_breakpoint, set_momentary_breakpoint_at_pc): Likewise. + * breakpoint.c (set_breakpoint): Add GDBARCH parameter. + (set_momentary_breakpoint, set_momentary_breakpoint_at_pc): Likewise. + Update callers to set_breakpoint, set_momentary_breakpoint and + set_momentary_breakpoint_at_pc: + * breakpoint.c (set_momentary_breakpoint_at_pc): Update. + (until_break_command): Update. + * infcall.c (call_function_by_hand): Update. + * infcmd.c (finish_backward, finish_forward): Update. + * infrun.c (insert_step_resume_breakpoint_at_sal): Add GDBARCH + parameter. Pass it to set_momentary_breakpoint. + (insert_longjmp_resume_breakpoint): Add GDBARCH parameter. + Pass it to set_momentary_breakpoint_at_pc. + (handle_inferior_event): Update. + (insert_step_resume_breakpoint_at_frame): Update. + (insert_step_resume_breakpoint_at_caller): Update.. + * mi/mi-cmd-break.c: Include "arch-utils.h". + (mi_cmd_break_insert): Update. + + * target.h (struct target_ops): Add GDBARCH parameter to + to_insert_breakpoint, to_remove_breakpoint, to_insert_hw_breakpoint, + and to_remove_hw_breakpoint members. + (target_insert_breakpoint, target_remove_breakpoint, + target_insert_hw_breakpoint, target_remove_hw_breakpoint): Add GDBARCH + parameter, pass to target routine. + (memory_remove_breakpoint, memory_insert_breakpoint): Add GDBARCH + parameter. + * target.c (debug_to_insert_breakpoint, debug_to_remove_breakpoint, + debug_to_insert_hw_breakpoint, debug_to_remove_hw_breakpoint): Add + GDBARCH parameter, pass to target routine. + (update_current_target): Update function signature. + * breakpoint.c (insert_bp_location, remove_breakpoint, + deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint): + Pass architecture to target_ routines. + Update all implementations of the target breakpoint routines to take + GDBARCH parameter and use it instead of GDBARCH as appropriate: + * corelow.c (ignore): Update. + * exec.c (ignore): Update. + * mem-break.c (memory_insert_breakpoint): Update. + (memory_remove_breakpoint): Update. + * monitor.c (monitor_insert_breakpoint): Update. + (monitor_remove_breakpoint): Update. + * record.c (record_insert_breakpoint): Update. + (record_beneath_to_insert_breakpoint): Update. + (record_remove_breakpoint): Update. + (record_beneath_to_remove_breakpoint): Update. + * remote.c (remote_insert_breakpoint): Update. + (remote_remove_breakpoint): Update. + (remote_insert_hw_breakpoint): Update. + (remote_remove_hw_breakpoint): Update. + * remote-m32r-sdi.c (m32r_insert_breakpoint): Update. + (m32r_remove_breakpoint): Update. + * remote-mips.c (mips_insert_breakpoint): Update. + (mips_remove_breakpoint): Update. + * i386-nat.c (i386_insert_hw_breakpoint): Update. + (i386_remove_hw_breakpoint): Update. + * nto-procfs.c (procfs_insert_breakpoint): Update. + (procfs_remove_breakpoint): Update. + (procfs_insert_hw_breakpoint): Update. + (procfs_remove_hw_breakpoint): Update. + +2009-07-02 Ulrich Weigand <uweigand@de.ibm.com> + * frame.h (frame_unwind_arch): New. (frame_unwind_caller_arch): Likewise. * frame-unwind.h (frame_prev_arch_ftype): New type. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 3b68cc9..e7ca5a9 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -10293,7 +10293,7 @@ print_it_exception (enum exception_catchpoint_kind ex, struct breakpoint *b) static void print_one_exception (enum exception_catchpoint_kind ex, - struct breakpoint *b, CORE_ADDR *last_addr) + struct breakpoint *b, struct bp_location **last_loc) { struct value_print_options opts; @@ -10305,7 +10305,7 @@ print_one_exception (enum exception_catchpoint_kind ex, } annotate_field (5); - *last_addr = b->loc->address; + *last_loc = b->loc; switch (ex) { case ex_catch_exception: @@ -10377,9 +10377,9 @@ print_it_catch_exception (struct breakpoint *b) } static void -print_one_catch_exception (struct breakpoint *b, CORE_ADDR *last_addr) +print_one_catch_exception (struct breakpoint *b, struct bp_location **last_loc) { - print_one_exception (ex_catch_exception, b, last_addr); + print_one_exception (ex_catch_exception, b, last_loc); } static void @@ -10407,9 +10407,10 @@ print_it_catch_exception_unhandled (struct breakpoint *b) } static void -print_one_catch_exception_unhandled (struct breakpoint *b, CORE_ADDR *last_addr) +print_one_catch_exception_unhandled (struct breakpoint *b, + struct bp_location **last_loc) { - print_one_exception (ex_catch_exception_unhandled, b, last_addr); + print_one_exception (ex_catch_exception_unhandled, b, last_loc); } static void @@ -10436,9 +10437,9 @@ print_it_catch_assert (struct breakpoint *b) } static void -print_one_catch_assert (struct breakpoint *b, CORE_ADDR *last_addr) +print_one_catch_assert (struct breakpoint *b, struct bp_location **last_loc) { - print_one_exception (ex_catch_assert, b, last_addr); + print_one_exception (ex_catch_assert, b, last_loc); } static void diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index 60eb5e2..92e434c 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -901,7 +901,7 @@ pd_enable (void) if (!(ms = lookup_minimal_symbol (stub_name, NULL, NULL))) return; pd_brk_addr = SYMBOL_VALUE_ADDRESS (ms); - if (!create_thread_event_breakpoint (pd_brk_addr)) + if (!create_thread_event_breakpoint (target_gdbarch, pd_brk_addr)) return; /* Prepare for thread debugging. */ diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index ff24975..ad12b3e 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -1478,12 +1478,13 @@ alpha_next_pc (struct frame_info *frame, CORE_ADDR pc) int alpha_software_single_step (struct frame_info *frame) { + struct gdbarch *gdbarch = get_frame_arch (frame); CORE_ADDR pc, next_pc; pc = get_frame_pc (frame); next_pc = alpha_next_pc (frame, pc); - insert_single_step_breakpoint (next_pc); + insert_single_step_breakpoint (gdbarch, next_pc); return 1; } diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index 88976b9..dc72ee1 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -575,6 +575,7 @@ arm_linux_regset_from_core_section (struct gdbarch *gdbarch, static int arm_linux_software_single_step (struct frame_info *frame) { + struct gdbarch *gdbarch = get_frame_arch (frame); CORE_ADDR next_pc = arm_get_next_pc (frame, get_frame_pc (frame)); /* The Linux kernel offers some user-mode helpers in a high page. We can @@ -585,7 +586,7 @@ arm_linux_software_single_step (struct frame_info *frame) if (next_pc > 0xffff0000) next_pc = get_frame_register_unsigned (frame, ARM_LR_REGNUM); - insert_single_step_breakpoint (next_pc); + insert_single_step_breakpoint (gdbarch, next_pc); return 1; } diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 20f0aab..ffc0863 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -2180,12 +2180,14 @@ arm_get_next_pc (struct frame_info *frame, CORE_ADDR pc) int arm_software_single_step (struct frame_info *frame) { + struct gdbarch *gdbarch = get_frame_arch (frame); + /* NOTE: This may insert the wrong breakpoint instruction when single-stepping over a mode-changing instruction, if the CPSR heuristics are used. */ CORE_ADDR next_pc = arm_get_next_pc (frame, get_frame_pc (frame)); - insert_single_step_breakpoint (next_pc); + insert_single_step_breakpoint (gdbarch, next_pc); return 1; } diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 710a792..cb4c3d7 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "defs.h" +#include "arch-utils.h" #include <ctype.h> #include "hashtab.h" #include "symtab.h" @@ -104,13 +105,16 @@ static void break_command_1 (char *, int, int); static void mention (struct breakpoint *); -struct breakpoint *set_raw_breakpoint (struct symtab_and_line, enum bptype); +static struct breakpoint *set_raw_breakpoint (struct gdbarch *gdbarch, + struct symtab_and_line, + enum bptype); static void check_duplicates (struct breakpoint *); static void breakpoint_adjustment_warning (CORE_ADDR, CORE_ADDR, int, int); -static CORE_ADDR adjust_breakpoint_address (CORE_ADDR bpaddr, +static CORE_ADDR adjust_breakpoint_address (struct gdbarch *gdbarch, + CORE_ADDR bpaddr, enum bptype bptype); static void describe_other_breakpoints (CORE_ADDR, struct obj_section *, int); @@ -1005,6 +1009,7 @@ update_watchpoint (struct breakpoint *b, int reparse) for (tmp = &(b->loc); *tmp != NULL; tmp = &((*tmp)->next)) ; *tmp = loc; + loc->gdbarch = get_type_arch (value_type (v)); loc->address = addr; loc->length = len; loc->watchpoint_type = type; @@ -1147,9 +1152,11 @@ Note: automatically using hardware breakpoints for read-only addresses.\n")); /* No overlay handling: just set the breakpoint. */ if (bpt->loc_type == bp_loc_hardware_breakpoint) - val = target_insert_hw_breakpoint (&bpt->target_info); + val = target_insert_hw_breakpoint (bpt->gdbarch, + &bpt->target_info); else - val = target_insert_breakpoint (&bpt->target_info); + val = target_insert_breakpoint (bpt->gdbarch, + &bpt->target_info); } else { @@ -1170,7 +1177,8 @@ Note: automatically using hardware breakpoints for read-only addresses.\n")); /* Set a software (trap) breakpoint at the LMA. */ bpt->overlay_target_info = bpt->target_info; bpt->overlay_target_info.placed_address = addr; - val = target_insert_breakpoint (&bpt->overlay_target_info); + val = target_insert_breakpoint (bpt->gdbarch, + &bpt->overlay_target_info); if (val != 0) fprintf_unfiltered (tmp_error_stream, "Overlay breakpoint %d failed: in ROM?\n", @@ -1182,9 +1190,11 @@ Note: automatically using hardware breakpoints for read-only addresses.\n")); { /* Yes. This overlay section is mapped into memory. */ if (bpt->loc_type == bp_loc_hardware_breakpoint) - val = target_insert_hw_breakpoint (&bpt->target_info); + val = target_insert_hw_breakpoint (bpt->gdbarch, + &bpt->target_info); else - val = target_insert_breakpoint (&bpt->target_info); + val = target_insert_breakpoint (bpt->gdbarch, + &bpt->target_info); } else { @@ -1458,7 +1468,8 @@ reattach_breakpoints (int pid) static int internal_breakpoint_number = -1; static struct breakpoint * -create_internal_breakpoint (CORE_ADDR address, enum bptype type) +create_internal_breakpoint (struct gdbarch *gdbarch, + CORE_ADDR address, enum bptype type) { struct symtab_and_line sal; struct breakpoint *b; @@ -1468,7 +1479,7 @@ create_internal_breakpoint (CORE_ADDR address, enum bptype type) sal.pc = address; sal.section = find_pc_overlay (sal.pc); - b = set_raw_breakpoint (sal, type); + b = set_raw_breakpoint (gdbarch, sal, type); b->number = internal_breakpoint_number--; b->disposition = disp_donttouch; @@ -1489,7 +1500,8 @@ create_overlay_event_breakpoint (char *func_name) if (m == NULL) continue; - b = create_internal_breakpoint (SYMBOL_VALUE_ADDRESS (m), + b = create_internal_breakpoint (get_objfile_arch (objfile), + SYMBOL_VALUE_ADDRESS (m), bp_overlay_event); b->addr_string = xstrdup (func_name); @@ -1524,7 +1536,8 @@ create_longjmp_master_breakpoint (char *func_name) if (m == NULL) continue; - b = create_internal_breakpoint (SYMBOL_VALUE_ADDRESS (m), + b = create_internal_breakpoint (get_objfile_arch (objfile), + SYMBOL_VALUE_ADDRESS (m), bp_longjmp_master); b->addr_string = xstrdup (func_name); b->enable_state = bp_disabled; @@ -1696,9 +1709,9 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) /* No overlay handling: just remove the breakpoint. */ if (b->loc_type == bp_loc_hardware_breakpoint) - val = target_remove_hw_breakpoint (&b->target_info); + val = target_remove_hw_breakpoint (b->gdbarch, &b->target_info); else - val = target_remove_breakpoint (&b->target_info); + val = target_remove_breakpoint (b->gdbarch, &b->target_info); } else { @@ -1712,9 +1725,11 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) /* Ignore any failures: if the LMA is in ROM, we will have already warned when we failed to insert it. */ if (b->loc_type == bp_loc_hardware_breakpoint) - target_remove_hw_breakpoint (&b->overlay_target_info); + target_remove_hw_breakpoint (b->gdbarch, + &b->overlay_target_info); else - target_remove_breakpoint (&b->overlay_target_info); + target_remove_breakpoint (b->gdbarch, + &b->overlay_target_info); } /* Did we set a breakpoint at the VMA? If so, we will have marked the breakpoint 'inserted'. */ @@ -1725,13 +1740,15 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) unmapped, but let's not rely on that being safe. We don't know what the overlay manager might do. */ if (b->loc_type == bp_loc_hardware_breakpoint) - val = target_remove_hw_breakpoint (&b->target_info); + val = target_remove_hw_breakpoint (b->gdbarch, + &b->target_info); /* However, we should remove *software* breakpoints only if the section is still mapped, or else we overwrite wrong code with the saved shadow contents. */ else if (section_is_mapped (b->section)) - val = target_remove_breakpoint (&b->target_info); + val = target_remove_breakpoint (b->gdbarch, + &b->target_info); else val = 0; } @@ -3541,7 +3558,8 @@ static void print_one_breakpoint_location (struct breakpoint *b, struct bp_location *loc, int loc_number, - CORE_ADDR *last_addr) + struct bp_location **last_loc, + int print_address_bits) { struct command_line *l; struct symbol *sym; @@ -3650,7 +3668,7 @@ print_one_breakpoint_location (struct breakpoint *b, strcpy (wrap_indent, " "); if (opts.addressprint) { - if (gdbarch_addr_bit (current_gdbarch) <= 32) + if (print_address_bits <= 32) strcat (wrap_indent, " "); else strcat (wrap_indent, " "); @@ -3663,7 +3681,7 @@ print_one_breakpoint_location (struct breakpoint *b, to get any nice result. So, make sure there's just one location. */ gdb_assert (b->loc == NULL || b->loc->next == NULL); - b->ops->print_one (b, last_addr); + b->ops->print_one (b, last_loc); } else switch (b->type) @@ -3714,7 +3732,7 @@ print_one_breakpoint_location (struct breakpoint *b, if (!header_of_multiple) print_breakpoint_location (b, loc, wrap_indent, stb); if (b->loc) - *last_addr = b->loc->address; + *last_loc = b->loc; break; } @@ -3850,9 +3868,9 @@ print_one_breakpoint_location (struct breakpoint *b, static void print_one_breakpoint (struct breakpoint *b, - CORE_ADDR *last_addr) + struct bp_location **last_loc, int print_address_bits) { - print_one_breakpoint_location (b, NULL, 0, last_addr); + print_one_breakpoint_location (b, NULL, 0, last_loc, print_address_bits); /* If this breakpoint has custom print function, it's already printed. Otherwise, print individual @@ -3875,11 +3893,27 @@ print_one_breakpoint (struct breakpoint *b, struct bp_location *loc; int n = 1; for (loc = b->loc; loc; loc = loc->next, ++n) - print_one_breakpoint_location (b, loc, n, last_addr); + print_one_breakpoint_location (b, loc, n, last_loc, + print_address_bits); } } } +static int +breakpoint_address_bits (struct breakpoint *b) +{ + int print_address_bits = 0; + struct bp_location *loc; + + for (loc = b->loc; loc; loc = loc->next) + { + int addr_bit = gdbarch_addr_bit (b->gdbarch); + if (addr_bit > print_address_bits) + print_address_bits = addr_bit; + } + + return print_address_bits; +} struct captured_breakpoint_query_args { @@ -3891,12 +3925,13 @@ do_captured_breakpoint_query (struct ui_out *uiout, void *data) { struct captured_breakpoint_query_args *args = data; struct breakpoint *b; - CORE_ADDR dummy_addr = 0; + struct bp_location *dummy_loc = NULL; ALL_BREAKPOINTS (b) { if (args->bnum == b->number) { - print_one_breakpoint (b, &dummy_addr); + int print_address_bits = breakpoint_address_bits (b); + print_one_breakpoint (b, &dummy_loc, print_address_bits); return GDB_RC_OK; } } @@ -3941,21 +3976,29 @@ static void breakpoint_1 (int bnum, int allflag) { struct breakpoint *b; - CORE_ADDR last_addr = (CORE_ADDR) -1; + struct bp_location *last_loc = NULL; int nr_printable_breakpoints; struct cleanup *bkpttbl_chain; struct value_print_options opts; + int print_address_bits = 0; get_user_print_options (&opts); - /* Compute the number of rows in the table. */ + /* Compute the number of rows in the table, as well as the + size required for address fields. */ nr_printable_breakpoints = 0; ALL_BREAKPOINTS (b) if (bnum == -1 || bnum == b->number) { if (allflag || user_settable_breakpoint (b)) - nr_printable_breakpoints++; + { + int addr_bit = breakpoint_address_bits (b); + if (addr_bit > print_address_bits) + print_address_bits = addr_bit; + + nr_printable_breakpoints++; + } } if (opts.addressprint) @@ -3985,7 +4028,7 @@ breakpoint_1 (int bnum, int allflag) { if (nr_printable_breakpoints > 0) annotate_field (4); - if (gdbarch_addr_bit (current_gdbarch) <= 32) + if (print_address_bits <= 32) ui_out_table_header (uiout, 10, ui_left, "addr", "Address");/* 5 */ else ui_out_table_header (uiout, 18, ui_left, "addr", "Address");/* 5 */ @@ -4004,7 +4047,7 @@ breakpoint_1 (int bnum, int allflag) /* We only print out user settable breakpoints unless the allflag is set. */ if (allflag || user_settable_breakpoint (b)) - print_one_breakpoint (b, &last_addr); + print_one_breakpoint (b, &last_loc, print_address_bits); } do_cleanups (bkpttbl_chain); @@ -4019,10 +4062,8 @@ breakpoint_1 (int bnum, int allflag) } else { - /* Compare against (CORE_ADDR)-1 in case some compiler decides - that a comparison of an unsigned with -1 is always false. */ - if (last_addr != (CORE_ADDR) -1 && !server_command) - set_next_address (current_gdbarch, last_addr); + if (last_loc && !server_command) + set_next_address (last_loc->gdbarch, last_loc->address); } /* FIXME? Should this be moved up so that it is only called when @@ -4251,9 +4292,10 @@ breakpoint_adjustment_warning (CORE_ADDR from_addr, CORE_ADDR to_addr, this function is simply the identity function. */ static CORE_ADDR -adjust_breakpoint_address (CORE_ADDR bpaddr, enum bptype bptype) +adjust_breakpoint_address (struct gdbarch *gdbarch, + CORE_ADDR bpaddr, enum bptype bptype) { - if (!gdbarch_adjust_breakpoint_address_p (current_gdbarch)) + if (!gdbarch_adjust_breakpoint_address_p (gdbarch)) { /* Very few targets need any kind of breakpoint adjustment. */ return bpaddr; @@ -4274,8 +4316,7 @@ adjust_breakpoint_address (CORE_ADDR bpaddr, enum bptype bptype) /* Some targets have architectural constraints on the placement of breakpoint instructions. Obtain the adjusted address. */ - adjusted_bpaddr = gdbarch_adjust_breakpoint_address (current_gdbarch, - bpaddr); + adjusted_bpaddr = gdbarch_adjust_breakpoint_address (gdbarch, bpaddr); /* An adjusted breakpoint address can significantly alter a user's expectations. Print a warning if an adjustment @@ -4353,7 +4394,8 @@ static void free_bp_location (struct bp_location *loc) that has type BPTYPE and has no locations as yet. */ static struct breakpoint * -set_raw_breakpoint_without_location (enum bptype bptype) +set_raw_breakpoint_without_location (struct gdbarch *gdbarch, + enum bptype bptype) { struct breakpoint *b, *b1; @@ -4361,6 +4403,7 @@ set_raw_breakpoint_without_location (enum bptype bptype) memset (b, 0, sizeof (*b)); b->type = bptype; + b->gdbarch = gdbarch; b->language = current_language->la_language; b->input_radix = input_radix; b->thread = -1; @@ -4406,6 +4449,18 @@ set_breakpoint_location_function (struct bp_location *loc) } } +/* Attempt to determine architecture of location identified by SAL. */ +static struct gdbarch * +get_sal_arch (struct symtab_and_line sal) +{ + if (sal.section) + return get_objfile_arch (sal.section->objfile); + if (sal.symtab) + return get_objfile_arch (sal.symtab->objfile); + + return NULL; +} + /* set_raw_breakpoint is a low level routine for allocating and partially initializing a breakpoint of type BPTYPE. The newly created breakpoint's address, section, source file name, and line @@ -4421,11 +4476,17 @@ set_breakpoint_location_function (struct bp_location *loc) prior to completing the initialization of the breakpoint. If this should happen, a bogus breakpoint will be left on the chain. */ -struct breakpoint * -set_raw_breakpoint (struct symtab_and_line sal, enum bptype bptype) +static struct breakpoint * +set_raw_breakpoint (struct gdbarch *gdbarch, + struct symtab_and_line sal, enum bptype bptype) { - struct breakpoint *b = set_raw_breakpoint_without_location (bptype); + struct breakpoint *b = set_raw_breakpoint_without_location (gdbarch, bptype); CORE_ADDR adjusted_address; + struct gdbarch *loc_gdbarch; + + loc_gdbarch = get_sal_arch (sal); + if (!loc_gdbarch) + loc_gdbarch = b->gdbarch; /* Adjust the breakpoint's address prior to allocating a location. Once we call allocate_bp_location(), that mostly uninitialized @@ -4433,9 +4494,10 @@ set_raw_breakpoint (struct symtab_and_line sal, enum bptype bptype) breakpoint may cause target_read_memory() to be called and we do not want its scan of the location chain to find a breakpoint and location that's only been partially initialized. */ - adjusted_address = adjust_breakpoint_address (sal.pc, b->type); + adjusted_address = adjust_breakpoint_address (loc_gdbarch, sal.pc, b->type); b->loc = allocate_bp_location (b); + b->loc->gdbarch = loc_gdbarch; b->loc->requested_address = sal.pc; b->loc->address = adjusted_address; @@ -4536,11 +4598,11 @@ disable_overlay_breakpoints (void) } struct breakpoint * -create_thread_event_breakpoint (CORE_ADDR address) +create_thread_event_breakpoint (struct gdbarch *gdbarch, CORE_ADDR address) { struct breakpoint *b; - b = create_internal_breakpoint (address, bp_thread_event); + b = create_internal_breakpoint (gdbarch, address, bp_thread_event); b->enable_state = bp_enabled; /* addr_string has to be used or breakpoint_re_set will delete me. */ @@ -4587,11 +4649,11 @@ remove_solib_event_breakpoints (void) } struct breakpoint * -create_solib_event_breakpoint (CORE_ADDR address) +create_solib_event_breakpoint (struct gdbarch *gdbarch, CORE_ADDR address) { struct breakpoint *b; - b = create_internal_breakpoint (address, bp_shlib_event); + b = create_internal_breakpoint (gdbarch, address, bp_shlib_event); update_global_location_list_nothrow (1); return b; } @@ -4711,7 +4773,7 @@ print_it_catch_fork (struct breakpoint *b) /* Implement the "print_one" breakpoint_ops method for fork catchpoints. */ static void -print_one_catch_fork (struct breakpoint *b, CORE_ADDR *last_addr) +print_one_catch_fork (struct breakpoint *b, struct bp_location **last_loc) { struct value_print_options opts; @@ -4793,7 +4855,7 @@ print_it_catch_vfork (struct breakpoint *b) /* Implement the "print_one" breakpoint_ops method for vfork catchpoints. */ static void -print_one_catch_vfork (struct breakpoint *b, CORE_ADDR *last_addr) +print_one_catch_vfork (struct breakpoint *b, struct bp_location **last_loc) { struct value_print_options opts; @@ -4843,8 +4905,8 @@ static struct breakpoint_ops catch_vfork_breakpoint_ops = to the catchpoint. */ static struct breakpoint * -create_catchpoint (int tempflag, char *cond_string, - struct breakpoint_ops *ops) +create_catchpoint (struct gdbarch *gdbarch, int tempflag, + char *cond_string, struct breakpoint_ops *ops) { struct symtab_and_line sal; struct breakpoint *b; @@ -4854,7 +4916,7 @@ create_catchpoint (int tempflag, char *cond_string, sal.symtab = NULL; sal.line = 0; - b = set_raw_breakpoint (sal, bp_catchpoint); + b = set_raw_breakpoint (gdbarch, sal, bp_catchpoint); set_breakpoint_count (breakpoint_count + 1); b->number = breakpoint_count; @@ -4872,10 +4934,12 @@ create_catchpoint (int tempflag, char *cond_string, } static void -create_fork_vfork_event_catchpoint (int tempflag, char *cond_string, +create_fork_vfork_event_catchpoint (struct gdbarch *gdbarch, + int tempflag, char *cond_string, struct breakpoint_ops *ops) { - struct breakpoint *b = create_catchpoint (tempflag, cond_string, ops); + struct breakpoint *b + = create_catchpoint (gdbarch, tempflag, cond_string, ops); /* FIXME: We should put this information in a breakpoint private data area. */ @@ -4912,7 +4976,7 @@ print_it_catch_exec (struct breakpoint *b) } static void -print_one_catch_exec (struct breakpoint *b, CORE_ADDR *last_addr) +print_one_catch_exec (struct breakpoint *b, struct bp_location **last_loc) { struct value_print_options opts; @@ -5030,8 +5094,8 @@ enable_watchpoints_after_interactive_call_stop (void) Restrict it to frame FRAME if FRAME is nonzero. */ struct breakpoint * -set_momentary_breakpoint (struct symtab_and_line sal, struct frame_id frame_id, - enum bptype type) +set_momentary_breakpoint (struct gdbarch *gdbarch, struct symtab_and_line sal, + struct frame_id frame_id, enum bptype type) { struct breakpoint *b; @@ -5039,7 +5103,7 @@ set_momentary_breakpoint (struct symtab_and_line sal, struct frame_id frame_id, one. */ gdb_assert (!frame_id_inlined_p (frame_id)); - b = set_raw_breakpoint (sal, type); + b = set_raw_breakpoint (gdbarch, sal, type); b->enable_state = bp_enabled; b->disposition = disp_donttouch; b->frame_id = frame_id; @@ -5067,10 +5131,11 @@ clone_momentary_breakpoint (struct breakpoint *orig) if (orig == NULL) return NULL; - copy = set_raw_breakpoint_without_location (orig->type); + copy = set_raw_breakpoint_without_location (orig->gdbarch, orig->type); copy->loc = allocate_bp_location (copy); set_breakpoint_location_function (copy->loc); + copy->loc->gdbarch = orig->loc->gdbarch; copy->loc->requested_address = orig->loc->requested_address; copy->loc->address = orig->loc->address; copy->loc->section = orig->loc->section; @@ -5093,7 +5158,8 @@ clone_momentary_breakpoint (struct breakpoint *orig) } struct breakpoint * -set_momentary_breakpoint_at_pc (CORE_ADDR pc, enum bptype type) +set_momentary_breakpoint_at_pc (struct gdbarch *gdbarch, CORE_ADDR pc, + enum bptype type) { struct symtab_and_line sal; @@ -5102,7 +5168,7 @@ set_momentary_breakpoint_at_pc (CORE_ADDR pc, enum bptype type) sal.section = find_pc_overlay (pc); sal.explicit_pc = 1; - return set_momentary_breakpoint (sal, null_frame_id, type); + return set_momentary_breakpoint (gdbarch, sal, null_frame_id, type); } @@ -5256,8 +5322,12 @@ add_location_to_breakpoint (struct breakpoint *b, for (tmp = &(b->loc); *tmp != NULL; tmp = &((*tmp)->next)) ; *tmp = loc; + loc->gdbarch = get_sal_arch (*sal); + if (!loc->gdbarch) + loc->gdbarch = b->gdbarch; loc->requested_address = sal->pc; - loc->address = adjust_breakpoint_address (loc->requested_address, b->type); + loc->address = adjust_breakpoint_address (loc->gdbarch, + loc->requested_address, b->type); loc->section = sal->section; set_breakpoint_location_function (loc); @@ -5281,7 +5351,7 @@ bp_loc_is_permanent (struct bp_location *loc) gdb_assert (loc != NULL); addr = loc->address; - brk = gdbarch_breakpoint_from_pc (current_gdbarch, &addr, &len); + brk = gdbarch_breakpoint_from_pc (loc->gdbarch, &addr, &len); /* Software breakpoints unsupported? */ if (brk == NULL) @@ -5310,7 +5380,8 @@ bp_loc_is_permanent (struct bp_location *loc) as condition expression. */ static void -create_breakpoint (struct symtabs_and_lines sals, char *addr_string, +create_breakpoint (struct gdbarch *gdbarch, + struct symtabs_and_lines sals, char *addr_string, char *cond_string, enum bptype type, enum bpdisp disposition, int thread, int task, int ignore_count, @@ -5341,7 +5412,7 @@ create_breakpoint (struct symtabs_and_lines sals, char *addr_string, if (i == 0) { - b = set_raw_breakpoint (sal, type); + b = set_raw_breakpoint (gdbarch, sal, type); set_breakpoint_count (breakpoint_count + 1); b->number = breakpoint_count; b->thread = thread; @@ -5540,7 +5611,8 @@ expand_line_sal_maybe (struct symtab_and_line sal) COND and SALS arrays and each of those arrays contents. */ static void -create_breakpoints (struct symtabs_and_lines sals, char **addr_string, +create_breakpoints (struct gdbarch *gdbarch, + struct symtabs_and_lines sals, char **addr_string, char *cond_string, enum bptype type, enum bpdisp disposition, int thread, int task, int ignore_count, @@ -5553,7 +5625,7 @@ create_breakpoints (struct symtabs_and_lines sals, char **addr_string, struct symtabs_and_lines expanded = expand_line_sal_maybe (sals.sals[i]); - create_breakpoint (expanded, addr_string[i], + create_breakpoint (gdbarch, expanded, addr_string[i], cond_string, type, disposition, thread, task, ignore_count, ops, from_tty, enabled); } @@ -5739,7 +5811,8 @@ find_condition_and_thread (char *tok, CORE_ADDR pc, parameters. */ static void -break_command_really (char *arg, char *cond_string, int thread, +break_command_really (struct gdbarch *gdbarch, + char *arg, char *cond_string, int thread, int parse_condition_and_thread, int tempflag, int hardwareflag, int traceflag, int ignore_count, @@ -5881,7 +5954,7 @@ break_command_really (char *arg, char *cond_string, int thread, make_cleanup (xfree, cond_string); } } - create_breakpoints (sals, addr_string, cond_string, type_wanted, + create_breakpoints (gdbarch, sals, addr_string, cond_string, type_wanted, tempflag ? disp_del : disp_donttouch, thread, task, ignore_count, ops, from_tty, enabled); } @@ -5892,7 +5965,7 @@ break_command_really (char *arg, char *cond_string, int thread, make_cleanup (xfree, copy_arg); - b = set_raw_breakpoint_without_location (type_wanted); + b = set_raw_breakpoint_without_location (gdbarch, type_wanted); set_breakpoint_count (breakpoint_count + 1); b->number = breakpoint_count; b->thread = -1; @@ -5933,7 +6006,8 @@ break_command_1 (char *arg, int flag, int from_tty) int hardwareflag = flag & BP_HARDWAREFLAG; int tempflag = flag & BP_TEMPFLAG; - break_command_really (arg, + break_command_really (get_current_arch (), + arg, NULL, 0, 1 /* parse arg */, tempflag, hardwareflag, 0 /* traceflag */, 0 /* Ignore count */, @@ -5945,12 +6019,14 @@ break_command_1 (char *arg, int flag, int from_tty) void -set_breakpoint (char *address, char *condition, +set_breakpoint (struct gdbarch *gdbarch, + char *address, char *condition, int hardwareflag, int tempflag, int thread, int ignore_count, int pending, int enabled) { - break_command_really (address, condition, thread, + break_command_really (gdbarch, + address, condition, thread, 0 /* condition and thread are valid. */, tempflag, hardwareflag, 0 /* traceflag */, ignore_count, @@ -6144,6 +6220,7 @@ stopat_command (char *arg, int from_tty) static void watch_command_1 (char *arg, int accessflag, int from_tty) { + struct gdbarch *gdbarch = get_current_arch (); struct breakpoint *b, *scope_breakpoint = NULL; struct symtab_and_line sal; struct expression *exp; @@ -6299,7 +6376,8 @@ watch_command_1 (char *arg, int accessflag, int from_tty) if (frame_id_p (frame_unwind_caller_id (frame))) { scope_breakpoint - = create_internal_breakpoint (frame_unwind_caller_pc (frame), + = create_internal_breakpoint (frame_unwind_caller_arch (frame), + frame_unwind_caller_pc (frame), bp_watchpoint_scope); scope_breakpoint->enable_state = bp_enabled; @@ -6311,16 +6389,19 @@ watch_command_1 (char *arg, int accessflag, int from_tty) scope_breakpoint->frame_id = frame_unwind_caller_id (frame); /* Set the address at which we will stop. */ + scope_breakpoint->loc->gdbarch + = frame_unwind_caller_arch (frame); scope_breakpoint->loc->requested_address = frame_unwind_caller_pc (frame); scope_breakpoint->loc->address - = adjust_breakpoint_address (scope_breakpoint->loc->requested_address, + = adjust_breakpoint_address (scope_breakpoint->loc->gdbarch, + scope_breakpoint->loc->requested_address, scope_breakpoint->type); } } /* Now set up the breakpoint. */ - b = set_raw_breakpoint (sal, bp_type); + b = set_raw_breakpoint (gdbarch, sal, bp_type); set_breakpoint_count (breakpoint_count + 1); b->number = breakpoint_count; b->thread = thread; @@ -6527,11 +6608,13 @@ until_break_command (char *arg, int from_tty, int anywhere) if (anywhere) /* If the user told us to continue until a specified location, we don't specify a frame at which we need to stop. */ - breakpoint = set_momentary_breakpoint (sal, null_frame_id, bp_until); + breakpoint = set_momentary_breakpoint (get_frame_arch (frame), sal, + null_frame_id, bp_until); else /* Otherwise, specify the selected frame, because we want to stop only at the very same frame. */ - breakpoint = set_momentary_breakpoint (sal, get_stack_frame_id (frame), + breakpoint = set_momentary_breakpoint (get_frame_arch (frame), sal, + get_stack_frame_id (frame), bp_until); old_chain = make_cleanup_delete_breakpoint (breakpoint); @@ -6543,7 +6626,8 @@ until_break_command (char *arg, int from_tty, int anywhere) { sal = find_pc_line (frame_unwind_caller_pc (frame), 0); sal.pc = frame_unwind_caller_pc (frame); - breakpoint2 = set_momentary_breakpoint (sal, + breakpoint2 = set_momentary_breakpoint (frame_unwind_caller_arch (frame), + sal, frame_unwind_caller_id (frame), bp_until); make_cleanup_delete_breakpoint (breakpoint2); @@ -6661,6 +6745,7 @@ catch_fork_kind; static void catch_fork_command_1 (char *arg, int from_tty, struct cmd_list_element *command) { + struct gdbarch *gdbarch = get_current_arch (); char *cond_string = NULL; catch_fork_kind fork_kind; int tempflag; @@ -6689,12 +6774,12 @@ catch_fork_command_1 (char *arg, int from_tty, struct cmd_list_element *command) { case catch_fork_temporary: case catch_fork_permanent: - create_fork_vfork_event_catchpoint (tempflag, cond_string, + create_fork_vfork_event_catchpoint (gdbarch, tempflag, cond_string, &catch_fork_breakpoint_ops); break; case catch_vfork_temporary: case catch_vfork_permanent: - create_fork_vfork_event_catchpoint (tempflag, cond_string, + create_fork_vfork_event_catchpoint (gdbarch, tempflag, cond_string, &catch_vfork_breakpoint_ops); break; default: @@ -6706,6 +6791,7 @@ catch_fork_command_1 (char *arg, int from_tty, struct cmd_list_element *command) static void catch_exec_command_1 (char *arg, int from_tty, struct cmd_list_element *command) { + struct gdbarch *gdbarch = get_current_arch (); int tempflag; char *cond_string = NULL; @@ -6727,7 +6813,8 @@ catch_exec_command_1 (char *arg, int from_tty, struct cmd_list_element *command) /* If this target supports it, create an exec catchpoint and enable reporting of such events. */ - create_catchpoint (tempflag, cond_string, &catch_exec_breakpoint_ops); + create_catchpoint (gdbarch, tempflag, cond_string, + &catch_exec_breakpoint_ops); } static enum print_stop_action @@ -6762,7 +6849,7 @@ print_exception_catchpoint (struct breakpoint *b) } static void -print_one_exception_catchpoint (struct breakpoint *b, CORE_ADDR *last_addr) +print_one_exception_catchpoint (struct breakpoint *b, struct bp_location **last_loc) { struct value_print_options opts; get_user_print_options (&opts); @@ -6776,7 +6863,7 @@ print_one_exception_catchpoint (struct breakpoint *b, CORE_ADDR *last_addr) } annotate_field (5); if (b->loc) - *last_addr = b->loc->address; + *last_loc = b->loc; if (strstr (b->addr_string, "throw") != NULL) ui_out_field_string (uiout, "what", "exception throw"); else @@ -6818,7 +6905,8 @@ handle_gnu_v3_exceptions (int tempflag, char *cond_string, else trigger_func_name = "__cxa_throw"; - break_command_really (trigger_func_name, cond_string, -1, + break_command_really (get_current_arch (), + trigger_func_name, cond_string, -1, 0 /* condition and thread are valid. */, tempflag, 0, 0, 0, @@ -6878,7 +6966,8 @@ catch_throw_command (char *arg, int from_tty, struct cmd_list_element *command) /* Create a breakpoint struct for Ada exception catchpoints. */ static void -create_ada_exception_breakpoint (struct symtab_and_line sal, +create_ada_exception_breakpoint (struct gdbarch *gdbarch, + struct symtab_and_line sal, char *addr_string, char *exp_string, char *cond_string, @@ -6902,7 +6991,7 @@ create_ada_exception_breakpoint (struct symtab_and_line sal, enough for now, though. */ } - b = set_raw_breakpoint (sal, bp_breakpoint); + b = set_raw_breakpoint (gdbarch, sal, bp_breakpoint); set_breakpoint_count (breakpoint_count + 1); b->enable_state = bp_enabled; @@ -6927,6 +7016,7 @@ static void catch_ada_exception_command (char *arg, int from_tty, struct cmd_list_element *command) { + struct gdbarch *gdbarch = get_current_arch (); int tempflag; struct symtab_and_line sal; enum bptype type; @@ -6942,7 +7032,7 @@ catch_ada_exception_command (char *arg, int from_tty, arg = ""; sal = ada_decode_exception_location (arg, &addr_string, &exp_string, &cond_string, &cond, &ops); - create_ada_exception_breakpoint (sal, addr_string, exp_string, + create_ada_exception_breakpoint (gdbarch, sal, addr_string, exp_string, cond_string, cond, ops, tempflag, from_tty); } @@ -6952,6 +7042,7 @@ catch_ada_exception_command (char *arg, int from_tty, static void catch_assert_command (char *arg, int from_tty, struct cmd_list_element *command) { + struct gdbarch *gdbarch = get_current_arch (); int tempflag; struct symtab_and_line sal; char *addr_string = NULL; @@ -6962,8 +7053,8 @@ catch_assert_command (char *arg, int from_tty, struct cmd_list_element *command) if (!arg) arg = ""; sal = ada_decode_assert_location (arg, &addr_string, &ops); - create_ada_exception_breakpoint (sal, addr_string, NULL, NULL, NULL, ops, - tempflag, from_tty); + create_ada_exception_breakpoint (gdbarch, sal, addr_string, NULL, NULL, NULL, + ops, tempflag, from_tty); } static void @@ -8230,7 +8321,7 @@ decode_line_spec_1 (char *string, int funfirstline) someday. */ void * -deprecated_insert_raw_breakpoint (CORE_ADDR pc) +deprecated_insert_raw_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc) { struct bp_target_info *bp_tgt; @@ -8238,7 +8329,7 @@ deprecated_insert_raw_breakpoint (CORE_ADDR pc) memset (bp_tgt, 0, sizeof (struct bp_target_info)); bp_tgt->placed_address = pc; - if (target_insert_breakpoint (bp_tgt) != 0) + if (target_insert_breakpoint (gdbarch, bp_tgt) != 0) { /* Could not insert the breakpoint. */ xfree (bp_tgt); @@ -8251,12 +8342,12 @@ deprecated_insert_raw_breakpoint (CORE_ADDR pc) /* Remove a breakpoint BP inserted by deprecated_insert_raw_breakpoint. */ int -deprecated_remove_raw_breakpoint (void *bp) +deprecated_remove_raw_breakpoint (struct gdbarch *gdbarch, void *bp) { struct bp_target_info *bp_tgt = bp; int ret; - ret = target_remove_breakpoint (bp_tgt); + ret = target_remove_breakpoint (gdbarch, bp_tgt); xfree (bp_tgt); return ret; @@ -8265,20 +8356,25 @@ deprecated_remove_raw_breakpoint (void *bp) /* One (or perhaps two) breakpoints used for software single stepping. */ static void *single_step_breakpoints[2]; +static struct gdbarch *single_step_gdbarch[2]; /* Create and insert a breakpoint for software single step. */ void -insert_single_step_breakpoint (CORE_ADDR next_pc) +insert_single_step_breakpoint (struct gdbarch *gdbarch, CORE_ADDR next_pc) { void **bpt_p; if (single_step_breakpoints[0] == NULL) - bpt_p = &single_step_breakpoints[0]; + { + bpt_p = &single_step_breakpoints[0]; + single_step_gdbarch[0] = gdbarch; + } else { gdb_assert (single_step_breakpoints[1] == NULL); bpt_p = &single_step_breakpoints[1]; + single_step_gdbarch[1] = gdbarch; } /* NOTE drow/2006-04-11: A future improvement to this function would be @@ -8288,7 +8384,7 @@ insert_single_step_breakpoint (CORE_ADDR next_pc) corresponding changes elsewhere where single step breakpoints are handled, however. So, for now, we use this. */ - *bpt_p = deprecated_insert_raw_breakpoint (next_pc); + *bpt_p = deprecated_insert_raw_breakpoint (gdbarch, next_pc); if (*bpt_p == NULL) error (_("Could not insert single-step breakpoint at 0x%s"), paddr_nz (next_pc)); @@ -8303,12 +8399,16 @@ remove_single_step_breakpoints (void) /* See insert_single_step_breakpoint for more about this deprecated call. */ - deprecated_remove_raw_breakpoint (single_step_breakpoints[0]); + deprecated_remove_raw_breakpoint (single_step_gdbarch[0], + single_step_breakpoints[0]); + single_step_gdbarch[0] = NULL; single_step_breakpoints[0] = NULL; if (single_step_breakpoints[1] != NULL) { - deprecated_remove_raw_breakpoint (single_step_breakpoints[1]); + deprecated_remove_raw_breakpoint (single_step_gdbarch[1], + single_step_breakpoints[1]); + single_step_gdbarch[1] = NULL; single_step_breakpoints[1] = NULL; } } @@ -8343,7 +8443,8 @@ set_tracepoint_count (int num) void trace_command (char *arg, int from_tty) { - break_command_really (arg, + break_command_really (get_current_arch (), + arg, NULL, 0, 1 /* parse arg */, 0 /* tempflag */, 0 /* hardwareflag */, 1 /* traceflag */, diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 1b711c0..6731e68 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -258,6 +258,10 @@ struct bp_location /* Data for specific breakpoint types. These could be a union, but simplicity is more important than memory usage for breakpoints. */ + /* Architecture associated with this location's address. May be + different from the breakpoint architecture. */ + struct gdbarch *gdbarch; + /* Note that zero is a perfectly valid code address on some platforms (for example, the mn10200 (OBSOLETE) and mn10300 simulators). NULL is not a special value for this field. Valid for all types except @@ -326,7 +330,7 @@ struct breakpoint_ops enum print_stop_action (*print_it) (struct breakpoint *); /* Display information about this breakpoint, for "info breakpoints". */ - void (*print_one) (struct breakpoint *, CORE_ADDR *); + void (*print_one) (struct breakpoint *, struct bp_location **); /* Display information about this breakpoint after setting it (roughly speaking; this is called from "mention"). */ @@ -394,6 +398,8 @@ struct breakpoint /* String we used to set the breakpoint (malloc'd). */ char *addr_string; + /* Architecture we used to set the breakpoint. */ + struct gdbarch *gdbarch; /* Language we used to set the breakpoint. */ enum language language; /* Input radix we used to set the breakpoint. */ @@ -698,10 +704,10 @@ extern void breakpoint_re_set (void); extern void breakpoint_re_set_thread (struct breakpoint *); extern struct breakpoint *set_momentary_breakpoint - (struct symtab_and_line, struct frame_id, enum bptype); + (struct gdbarch *, struct symtab_and_line, struct frame_id, enum bptype); extern struct breakpoint *set_momentary_breakpoint_at_pc - (CORE_ADDR pc, enum bptype type); + (struct gdbarch *, CORE_ADDR pc, enum bptype type); extern struct breakpoint *clone_momentary_breakpoint (struct breakpoint *bpkt); @@ -727,7 +733,8 @@ extern void awatch_command_wrapper (char *, int); extern void rwatch_command_wrapper (char *, int); extern void tbreak_command (char *, int); -extern void set_breakpoint (char *address, char *condition, +extern void set_breakpoint (struct gdbarch *gdbarch, + char *address, char *condition, int hardwareflag, int tempflag, int thread, int ignore_count, int pending, @@ -834,9 +841,11 @@ extern void mark_breakpoints_out (void); extern void make_breakpoint_permanent (struct breakpoint *); -extern struct breakpoint *create_solib_event_breakpoint (CORE_ADDR); +extern struct breakpoint *create_solib_event_breakpoint (struct gdbarch *, + CORE_ADDR); -extern struct breakpoint *create_thread_event_breakpoint (CORE_ADDR); +extern struct breakpoint *create_thread_event_breakpoint (struct gdbarch *, + CORE_ADDR); extern void remove_solib_event_breakpoints (void); @@ -857,14 +866,14 @@ extern int remove_hw_watchpoints (void); /* Manage a software single step breakpoint (or two). Insert may be called twice before remove is called. */ -extern void insert_single_step_breakpoint (CORE_ADDR); +extern void insert_single_step_breakpoint (struct gdbarch *, CORE_ADDR); extern void remove_single_step_breakpoints (void); /* Manage manual breakpoints, separate from the normal chain of breakpoints. These functions are used in murky target-specific ways. Please do not add more uses! */ -extern void *deprecated_insert_raw_breakpoint (CORE_ADDR); -extern int deprecated_remove_raw_breakpoint (void *); +extern void *deprecated_insert_raw_breakpoint (struct gdbarch *, CORE_ADDR); +extern int deprecated_remove_raw_breakpoint (struct gdbarch *, void *); /* Check if any hardware watchpoints have triggered, according to the target. */ diff --git a/gdb/corelow.c b/gdb/corelow.c index b69c2a1..4dbcef0 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -695,7 +695,7 @@ core_xfer_partial (struct target_ops *ops, enum target_object object, `gdb internal error' (since generic_mourn calls breakpoint_init_inferior). */ static int -ignore (struct bp_target_info *bp_tgt) +ignore (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { return 0; } diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index f2c0b7e..81b1edc 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -2120,6 +2120,7 @@ find_step_target (struct frame_info *frame, inst_env_type *inst_env) static int cris_software_single_step (struct frame_info *frame) { + struct gdbarch *gdbarch = get_frame_arch (frame); inst_env_type inst_env; /* Analyse the present instruction environment and insert @@ -2135,15 +2136,15 @@ cris_software_single_step (struct frame_info *frame) { /* Insert at most two breakpoints. One for the next PC content and possibly another one for a branch, jump, etc. */ - CORE_ADDR next_pc = - (CORE_ADDR) inst_env.reg[gdbarch_pc_regnum (get_frame_arch (frame))]; - insert_single_step_breakpoint (next_pc); + CORE_ADDR next_pc + = (CORE_ADDR) inst_env.reg[gdbarch_pc_regnum (gdbarch)]; + insert_single_step_breakpoint (gdbarch, next_pc); if (inst_env.branch_found && (CORE_ADDR) inst_env.branch_break_address != next_pc) { CORE_ADDR branch_target_address = (CORE_ADDR) inst_env.branch_break_address; - insert_single_step_breakpoint (branch_target_address); + insert_single_step_breakpoint (gdbarch, branch_target_address); } } diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 6965728..d3ee3c5 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2009-07-02 Ulrich Weigand <uweigand@de.ibm.com> + + * gdbint.texi (Examples of Use of @code{ui_out} functions): + Update example code extrated from breakpoint.c. + 2009-06-28 Paul Pluzhnikov <ppluzhnikov@google.com> * gdb.texinfo (GDB/MI Program Context): @ignore unimplemented diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index b5771cc..8df45c6 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -1589,7 +1589,7 @@ Here's the new version: @{ if (nr_printable_breakpoints > 0) annotate_field (4); - if (gdbarch_addr_bit (current_gdbarch) <= 32) + if (print_address_bits <= 32) ui_out_table_header (uiout, 10, ui_left, "addr", "Address");/* 5 */ else ui_out_table_header (uiout, 18, ui_left, "addr", "Address");/* 5 */ @@ -776,7 +776,7 @@ exec_set_section_address (const char *filename, int index, CORE_ADDR address) breakpoint_init_inferior). */ static int -ignore (struct bp_target_info *bp_tgt) +ignore (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { return 0; } diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c index 49339b0..d556875 100644 --- a/gdb/i386-nat.c +++ b/gdb/i386-nat.c @@ -601,7 +601,8 @@ i386_stopped_by_hwbp (void) /* Insert a hardware-assisted breakpoint at BP_TGT->placed_address. Return 0 on success, EBUSY on failure. */ static int -i386_insert_hw_breakpoint (struct bp_target_info *bp_tgt) +i386_insert_hw_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { unsigned len_rw = i386_length_and_rw_bits (1, hw_execute); CORE_ADDR addr = bp_tgt->placed_address; @@ -617,7 +618,8 @@ i386_insert_hw_breakpoint (struct bp_target_info *bp_tgt) Return 0 on success, -1 on failure. */ static int -i386_remove_hw_breakpoint (struct bp_target_info *bp_tgt) +i386_remove_hw_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { unsigned len_rw = i386_length_and_rw_bits (1, hw_execute); CORE_ADDR addr = bp_tgt->placed_address; diff --git a/gdb/infcall.c b/gdb/infcall.c index 8a7c86b..479492d 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -738,7 +738,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) /* Sanity. The exact same SP value is returned by PUSH_DUMMY_CALL, saved as the dummy-frame TOS, and used by dummy_id to form the frame ID's stack address. */ - bpt = set_momentary_breakpoint (sal, dummy_id, bp_call_dummy); + bpt = set_momentary_breakpoint (gdbarch, sal, dummy_id, bp_call_dummy); bpt->disposition = disp_del; } @@ -760,7 +760,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) NULL, NULL); if (tm != NULL) terminate_bp = set_momentary_breakpoint_at_pc - (SYMBOL_VALUE_ADDRESS (tm), bp_breakpoint); + (gdbarch, SYMBOL_VALUE_ADDRESS (tm), bp_breakpoint); } /* Everything's ready, push all the info needed to restore the diff --git a/gdb/infcmd.c b/gdb/infcmd.c index b1ccf9f..fb357e8 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1461,10 +1461,13 @@ finish_backward (struct symbol *function) if (sal.pc != pc) { + struct frame_info *frame = get_selected_frame (NULL); + struct gdbarch *gdbarch = get_frame_arch (frame); + /* Set breakpoint and continue. */ breakpoint = - set_momentary_breakpoint (sal, - get_stack_frame_id (get_selected_frame (NULL)), + set_momentary_breakpoint (gdbarch, sal, + get_stack_frame_id (frame), bp_breakpoint); /* Tell the breakpoint to keep quiet. We won't be done until we've done another reverse single-step. */ @@ -1493,6 +1496,7 @@ finish_backward (struct symbol *function) static void finish_forward (struct symbol *function, struct frame_info *frame) { + struct gdbarch *gdbarch = get_frame_arch (frame); struct symtab_and_line sal; struct thread_info *tp = inferior_thread (); struct breakpoint *breakpoint; @@ -1502,7 +1506,8 @@ finish_forward (struct symbol *function, struct frame_info *frame) sal = find_pc_line (get_frame_pc (frame), 0); sal.pc = get_frame_pc (frame); - breakpoint = set_momentary_breakpoint (sal, get_stack_frame_id (frame), + breakpoint = set_momentary_breakpoint (gdbarch, sal, + get_stack_frame_id (frame), bp_finish); old_chain = make_cleanup_delete_breakpoint (breakpoint); diff --git a/gdb/infrun.c b/gdb/infrun.c index ec17f6d..0606821 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1759,9 +1759,10 @@ static void handle_step_into_function_backward (struct gdbarch *gdbarch, struct execution_control_state *ecs); static void insert_step_resume_breakpoint_at_frame (struct frame_info *step_frame); static void insert_step_resume_breakpoint_at_caller (struct frame_info *); -static void insert_step_resume_breakpoint_at_sal (struct symtab_and_line sr_sal, +static void insert_step_resume_breakpoint_at_sal (struct gdbarch *gdbarch, + struct symtab_and_line sr_sal, struct frame_id sr_id); -static void insert_longjmp_resume_breakpoint (CORE_ADDR); +static void insert_longjmp_resume_breakpoint (struct gdbarch *, CORE_ADDR); static void stop_stepping (struct execution_control_state *ecs); static void prepare_to_wait (struct execution_control_state *ecs); @@ -3411,7 +3412,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n"); delete_step_resume_breakpoint (ecs->event_thread); /* Insert a breakpoint at resume address. */ - insert_longjmp_resume_breakpoint (jmp_buf_pc); + insert_longjmp_resume_breakpoint (gdbarch, jmp_buf_pc); keep_going (ecs); return; @@ -3732,7 +3733,8 @@ infrun: not switching back to stepped thread, it has vanished\n"); init_sal (&sr_sal); sr_sal.pc = pc_after_resolver; - insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id); + insert_step_resume_breakpoint_at_sal (gdbarch, + sr_sal, null_frame_id); } keep_going (ecs); @@ -3828,7 +3830,8 @@ infrun: not switching back to stepped thread, it has vanished\n"); /* Normal function call return (static or dynamic). */ init_sal (&sr_sal); sr_sal.pc = ecs->stop_func_start; - insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id); + insert_step_resume_breakpoint_at_sal (gdbarch, + sr_sal, null_frame_id); } else insert_step_resume_breakpoint_at_caller (frame); @@ -3854,7 +3857,8 @@ infrun: not switching back to stepped thread, it has vanished\n"); init_sal (&sr_sal); sr_sal.pc = ecs->stop_func_start; - insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id); + insert_step_resume_breakpoint_at_sal (gdbarch, + sr_sal, null_frame_id); keep_going (ecs); return; } @@ -3898,7 +3902,8 @@ infrun: not switching back to stepped thread, it has vanished\n"); struct symtab_and_line sr_sal; init_sal (&sr_sal); sr_sal.pc = ecs->stop_func_start; - insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id); + insert_step_resume_breakpoint_at_sal (gdbarch, + sr_sal, null_frame_id); } else /* Set a breakpoint at callee's return address (the address @@ -3934,7 +3939,8 @@ infrun: not switching back to stepped thread, it has vanished\n"); /* Do not specify what the fp should be when we stop since on some machines the prologue is where the new fp value is established. */ - insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id); + insert_step_resume_breakpoint_at_sal (gdbarch, + sr_sal, null_frame_id); /* Restart without fiddling with the step ranges or other state. */ @@ -4212,7 +4218,7 @@ handle_step_into_function (struct gdbarch *gdbarch, /* Do not specify what the fp should be when we stop since on some machines the prologue is where the new fp value is established. */ - insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id); + insert_step_resume_breakpoint_at_sal (gdbarch, sr_sal, null_frame_id); /* And make sure stepping stops right away then. */ ecs->event_thread->step_range_end = ecs->event_thread->step_range_start; @@ -4262,7 +4268,8 @@ handle_step_into_function_backward (struct gdbarch *gdbarch, This is used to both functions and to skip over code. */ static void -insert_step_resume_breakpoint_at_sal (struct symtab_and_line sr_sal, +insert_step_resume_breakpoint_at_sal (struct gdbarch *gdbarch, + struct symtab_and_line sr_sal, struct frame_id sr_id) { /* There should never be more than one step-resume or longjmp-resume @@ -4276,7 +4283,7 @@ insert_step_resume_breakpoint_at_sal (struct symtab_and_line sr_sal, paddr_nz (sr_sal.pc)); inferior_thread ()->step_resume_breakpoint - = set_momentary_breakpoint (sr_sal, sr_id, bp_step_resume); + = set_momentary_breakpoint (gdbarch, sr_sal, sr_id, bp_step_resume); } /* Insert a "step-resume breakpoint" at RETURN_FRAME.pc. This is used @@ -4289,16 +4296,18 @@ insert_step_resume_breakpoint_at_sal (struct symtab_and_line sr_sal, static void insert_step_resume_breakpoint_at_frame (struct frame_info *return_frame) { - struct gdbarch *gdbarch = get_frame_arch (return_frame); struct symtab_and_line sr_sal; + struct gdbarch *gdbarch; gdb_assert (return_frame != NULL); init_sal (&sr_sal); /* initialize to zeros */ + gdbarch = get_frame_arch (return_frame); sr_sal.pc = gdbarch_addr_bits_remove (gdbarch, get_frame_pc (return_frame)); sr_sal.section = find_pc_overlay (sr_sal.pc); - insert_step_resume_breakpoint_at_sal (sr_sal, get_stack_frame_id (return_frame)); + insert_step_resume_breakpoint_at_sal (gdbarch, sr_sal, + get_stack_frame_id (return_frame)); } /* Similar to insert_step_resume_breakpoint_at_frame, except @@ -4319,8 +4328,8 @@ insert_step_resume_breakpoint_at_frame (struct frame_info *return_frame) static void insert_step_resume_breakpoint_at_caller (struct frame_info *next_frame) { - struct gdbarch *gdbarch = get_frame_arch (next_frame); struct symtab_and_line sr_sal; + struct gdbarch *gdbarch; /* We shouldn't have gotten here if we don't know where the call site is. */ @@ -4328,11 +4337,12 @@ insert_step_resume_breakpoint_at_caller (struct frame_info *next_frame) init_sal (&sr_sal); /* initialize to zeros */ + gdbarch = frame_unwind_caller_arch (next_frame); sr_sal.pc = gdbarch_addr_bits_remove (gdbarch, frame_unwind_caller_pc (next_frame)); sr_sal.section = find_pc_overlay (sr_sal.pc); - insert_step_resume_breakpoint_at_sal (sr_sal, + insert_step_resume_breakpoint_at_sal (gdbarch, sr_sal, frame_unwind_caller_id (next_frame)); } @@ -4342,7 +4352,7 @@ insert_step_resume_breakpoint_at_caller (struct frame_info *next_frame) "step-resume" breakpoints. */ static void -insert_longjmp_resume_breakpoint (CORE_ADDR pc) +insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc) { /* There should never be more than one step-resume or longjmp-resume breakpoint per thread, so we should never be setting a new @@ -4355,7 +4365,7 @@ insert_longjmp_resume_breakpoint (CORE_ADDR pc) paddr_nz (pc)); inferior_thread ()->step_resume_breakpoint = - set_momentary_breakpoint_at_pc (pc, bp_longjmp_resume); + set_momentary_breakpoint_at_pc (gdbarch, pc, bp_longjmp_resume); } static void diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index d6c10fa..cea4541 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -515,7 +515,7 @@ enable_thread_event (int event, CORE_ADDR *bp) ? (CORE_ADDR) (intptr_t) notify.u.bptaddr : (CORE_ADDR) (uintptr_t) notify.u.bptaddr), ¤t_target)); - create_thread_event_breakpoint ((*bp)); + create_thread_event_breakpoint (target_gdbarch, *bp); return TD_OK; } diff --git a/gdb/mem-break.c b/gdb/mem-break.c index 76dad61..1338dce 100644 --- a/gdb/mem-break.c +++ b/gdb/mem-break.c @@ -78,13 +78,15 @@ default_memory_remove_breakpoint (struct gdbarch *gdbarch, int -memory_insert_breakpoint (struct bp_target_info *bp_tgt) +memory_insert_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { - return gdbarch_memory_insert_breakpoint (current_gdbarch, bp_tgt); + return gdbarch_memory_insert_breakpoint (gdbarch, bp_tgt); } int -memory_remove_breakpoint (struct bp_target_info *bp_tgt) +memory_remove_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { - return gdbarch_memory_remove_breakpoint (current_gdbarch, bp_tgt); + return gdbarch_memory_remove_breakpoint (gdbarch, bp_tgt); } diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c index 0de08ce..445c53e 100644 --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "defs.h" +#include "arch-utils.h" #include "mi-cmds.h" #include "ui-out.h" #include "mi-out.h" @@ -153,13 +154,13 @@ mi_cmd_break_insert (char *command, char **argv, int argc) switch (type) { case REG_BP: - set_breakpoint (address, condition, + set_breakpoint (get_current_arch (), address, condition, 0 /*hardwareflag */ , temp_p, thread, ignore_count, pending, enabled); break; case HW_BP: - set_breakpoint (address, condition, + set_breakpoint (get_current_arch (), address, condition, 1 /*hardwareflag */ , temp_p, thread, ignore_count, pending, enabled); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index f75e386..c4d9ee9 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -2377,7 +2377,7 @@ mips_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr) the sequence. */ static int -deal_with_atomic_sequence (CORE_ADDR pc) +deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc) { CORE_ADDR breaks[2] = {-1, -1}; CORE_ADDR loc = pc; @@ -2465,7 +2465,7 @@ deal_with_atomic_sequence (CORE_ADDR pc) /* Effectively inserts the breakpoints. */ for (index = 0; index <= last_breakpoint; index++) - insert_single_step_breakpoint (breaks[index]); + insert_single_step_breakpoint (gdbarch, breaks[index]); return 1; } @@ -2478,15 +2478,16 @@ deal_with_atomic_sequence (CORE_ADDR pc) int mips_software_single_step (struct frame_info *frame) { + struct gdbarch *gdbarch = get_frame_arch (frame); CORE_ADDR pc, next_pc; pc = get_frame_pc (frame); - if (deal_with_atomic_sequence (pc)) + if (deal_with_atomic_sequence (gdbarch, pc)) return 1; next_pc = mips_next_pc (frame, pc); - insert_single_step_breakpoint (next_pc); + insert_single_step_breakpoint (gdbarch, next_pc); return 1; } diff --git a/gdb/monitor.c b/gdb/monitor.c index 10e588a..b51848e 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -2027,7 +2027,8 @@ monitor_mourn_inferior (struct target_ops *ops) /* Tell the monitor to add a breakpoint. */ static int -monitor_insert_breakpoint (struct bp_target_info *bp_tgt) +monitor_insert_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { CORE_ADDR addr = bp_tgt->placed_address; int i; @@ -2038,10 +2039,10 @@ monitor_insert_breakpoint (struct bp_target_info *bp_tgt) error (_("No set_break defined for this monitor")); if (current_monitor->flags & MO_ADDR_BITS_REMOVE) - addr = gdbarch_addr_bits_remove (current_gdbarch, addr); + addr = gdbarch_addr_bits_remove (gdbarch, addr); /* Determine appropriate breakpoint size for this address. */ - gdbarch_breakpoint_from_pc (current_gdbarch, &addr, &bplen); + gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); bp_tgt->placed_address = addr; bp_tgt->placed_size = bplen; @@ -2062,7 +2063,8 @@ monitor_insert_breakpoint (struct bp_target_info *bp_tgt) /* Tell the monitor to remove a breakpoint. */ static int -monitor_remove_breakpoint (struct bp_target_info *bp_tgt) +monitor_remove_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { CORE_ADDR addr = bp_tgt->placed_address; int i; diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index c60649b..f724941 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -824,26 +824,30 @@ procfs_breakpoint (CORE_ADDR addr, int type, int size) } static int -procfs_insert_breakpoint (struct bp_target_info *bp_tgt) +procfs_insert_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { return procfs_breakpoint (bp_tgt->placed_address, _DEBUG_BREAK_EXEC, 0); } static int -procfs_remove_breakpoint (struct bp_target_info *bp_tgt) +procfs_remove_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { return procfs_breakpoint (bp_tgt->placed_address, _DEBUG_BREAK_EXEC, -1); } static int -procfs_insert_hw_breakpoint (struct bp_target_info *bp_tgt) +procfs_insert_hw_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { return procfs_breakpoint (bp_tgt->placed_address, _DEBUG_BREAK_EXEC | _DEBUG_BREAK_HW, 0); } static int -procfs_remove_hw_breakpoint (struct bp_target_info *bp_tgt) +procfs_remove_hw_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { return procfs_breakpoint (bp_tgt->placed_address, _DEBUG_BREAK_EXEC | _DEBUG_BREAK_HW, -1); diff --git a/gdb/procfs.c b/gdb/procfs.c index 46a4f40..378042d 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -4803,7 +4803,7 @@ procfs_mourn_inferior (struct target_ops *ops) if (dbx_link_bpt != NULL) { - deprecated_remove_raw_breakpoint (dbx_link_bpt); + deprecated_remove_raw_breakpoint (target_gdbarch, dbx_link_bpt); dbx_link_bpt_addr = 0; dbx_link_bpt = NULL; } @@ -5592,7 +5592,7 @@ remove_dbx_link_breakpoint (void) if (dbx_link_bpt_addr == 0) return; - if (deprecated_remove_raw_breakpoint (dbx_link_bpt) != 0) + if (deprecated_remove_raw_breakpoint (target_gdbarch, dbx_link_bpt) != 0) warning (_("Unable to remove __dbx_link breakpoint.")); dbx_link_bpt_addr = 0; @@ -5664,7 +5664,8 @@ insert_dbx_link_bpt_in_file (int fd, CORE_ADDR ignored) { /* Insert the breakpoint. */ dbx_link_bpt_addr = sym_addr; - dbx_link_bpt = deprecated_insert_raw_breakpoint (sym_addr); + dbx_link_bpt = deprecated_insert_raw_breakpoint (target_gdbarch, + sym_addr); if (dbx_link_bpt == NULL) { warning (_("Failed to insert dbx_link breakpoint.")); diff --git a/gdb/record.c b/gdb/record.c index 3669eb4..6595570 100644 --- a/gdb/record.c +++ b/gdb/record.c @@ -112,8 +112,10 @@ static LONGEST (*record_beneath_to_xfer_partial) (struct target_ops *ops, const gdb_byte *writebuf, ULONGEST offset, LONGEST len); -static int (*record_beneath_to_insert_breakpoint) (struct bp_target_info *); -static int (*record_beneath_to_remove_breakpoint) (struct bp_target_info *); +static int (*record_beneath_to_insert_breakpoint) (struct gdbarch *, + struct bp_target_info *); +static int (*record_beneath_to_remove_breakpoint) (struct gdbarch *, + struct bp_target_info *); static void record_list_release (struct record_entry *rec) @@ -1046,12 +1048,13 @@ record_xfer_partial (struct target_ops *ops, enum target_object object, nor when recording. */ static int -record_insert_breakpoint (struct bp_target_info *bp_tgt) +record_insert_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { if (!RECORD_IS_REPLAY) { struct cleanup *old_cleanups = record_gdb_operation_disable_set (); - int ret = record_beneath_to_insert_breakpoint (bp_tgt); + int ret = record_beneath_to_insert_breakpoint (gdbarch, bp_tgt); do_cleanups (old_cleanups); @@ -1062,12 +1065,13 @@ record_insert_breakpoint (struct bp_target_info *bp_tgt) } static int -record_remove_breakpoint (struct bp_target_info *bp_tgt) +record_remove_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { if (!RECORD_IS_REPLAY) { struct cleanup *old_cleanups = record_gdb_operation_disable_set (); - int ret = record_beneath_to_remove_breakpoint (bp_tgt); + int ret = record_beneath_to_remove_breakpoint (gdbarch, bp_tgt); do_cleanups (old_cleanups); diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index 2c40482..7d9982b 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -1140,7 +1140,8 @@ m32r_mourn_inferior (struct target_ops *ops) } static int -m32r_insert_breakpoint (struct bp_target_info *bp_tgt) +m32r_insert_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { CORE_ADDR addr = bp_tgt->placed_address; int ib_breakpoints; @@ -1183,7 +1184,8 @@ m32r_insert_breakpoint (struct bp_target_info *bp_tgt) } static int -m32r_remove_breakpoint (struct bp_target_info *bp_tgt) +m32r_remove_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { CORE_ADDR addr = bp_tgt->placed_address; int i; diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 4c52daf..b9fa028 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -2228,23 +2228,25 @@ mips_mourn_inferior (struct target_ops *ops) target contents. */ static int -mips_insert_breakpoint (struct bp_target_info *bp_tgt) +mips_insert_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { if (monitor_supports_breakpoints) return mips_set_breakpoint (bp_tgt->placed_address, MIPS_INSN32_SIZE, BREAK_FETCH); else - return memory_insert_breakpoint (bp_tgt); + return memory_insert_breakpoint (gdbarch, bp_tgt); } static int -mips_remove_breakpoint (struct bp_target_info *bp_tgt) +mips_remove_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { if (monitor_supports_breakpoints) return mips_clear_breakpoint (bp_tgt->placed_address, MIPS_INSN32_SIZE, BREAK_FETCH); else - return memory_remove_breakpoint (bp_tgt); + return memory_remove_breakpoint (gdbarch, bp_tgt); } /* Tell whether this target can support a hardware breakpoint. CNT diff --git a/gdb/remote.c b/gdb/remote.c index 6e8f69c..297e784 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -6792,7 +6792,8 @@ extended_remote_create_inferior (struct target_ops *ops, which don't, we insert a traditional memory breakpoint. */ static int -remote_insert_breakpoint (struct bp_target_info *bp_tgt) +remote_insert_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { /* Try the "Z" s/w breakpoint packet if it is not already disabled. If it succeeds, then set the support to PACKET_ENABLE. If it @@ -6806,7 +6807,7 @@ remote_insert_breakpoint (struct bp_target_info *bp_tgt) char *p; int bpsize; - gdbarch_breakpoint_from_pc (target_gdbarch, &addr, &bpsize); + gdbarch_breakpoint_from_pc (gdbarch, &addr, &bpsize); rs = get_remote_state (); p = rs->buf; @@ -6834,11 +6835,12 @@ remote_insert_breakpoint (struct bp_target_info *bp_tgt) } } - return memory_insert_breakpoint (bp_tgt); + return memory_insert_breakpoint (gdbarch, bp_tgt); } static int -remote_remove_breakpoint (struct bp_target_info *bp_tgt) +remote_remove_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { CORE_ADDR addr = bp_tgt->placed_address; struct remote_state *rs = get_remote_state (); @@ -6862,7 +6864,7 @@ remote_remove_breakpoint (struct bp_target_info *bp_tgt) return (rs->buf[0] == 'E'); } - return memory_remove_breakpoint (bp_tgt); + return memory_remove_breakpoint (gdbarch, bp_tgt); } static int @@ -6998,7 +7000,8 @@ remote_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p) static int -remote_insert_hw_breakpoint (struct bp_target_info *bp_tgt) +remote_insert_hw_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { CORE_ADDR addr; struct remote_state *rs; @@ -7008,7 +7011,7 @@ remote_insert_hw_breakpoint (struct bp_target_info *bp_tgt) instruction, even though we aren't inserting one ourselves. */ gdbarch_breakpoint_from_pc - (target_gdbarch, &bp_tgt->placed_address, &bp_tgt->placed_size); + (gdbarch, &bp_tgt->placed_address, &bp_tgt->placed_size); if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE) return -1; @@ -7041,7 +7044,8 @@ remote_insert_hw_breakpoint (struct bp_target_info *bp_tgt) static int -remote_remove_hw_breakpoint (struct bp_target_info *bp_tgt) +remote_remove_hw_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { CORE_ADDR addr; struct remote_state *rs = get_remote_state (); diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c index 108f2a0..e3c5c1a 100644 --- a/gdb/rs6000-aix-tdep.c +++ b/gdb/rs6000-aix-tdep.c @@ -663,6 +663,7 @@ branch_dest (struct frame_info *frame, int opcode, int instr, static int rs6000_software_single_step (struct frame_info *frame) { + struct gdbarch *gdbarch = get_frame_arch (frame); int ii, insn; CORE_ADDR loc; CORE_ADDR breaks[2]; @@ -688,7 +689,7 @@ rs6000_software_single_step (struct frame_info *frame) /* ignore invalid breakpoint. */ if (breaks[ii] == -1) continue; - insert_single_step_breakpoint (breaks[ii]); + insert_single_step_breakpoint (gdbarch, breaks[ii]); } errno = 0; /* FIXME, don't ignore errors! */ diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index 7b91902..a1d15bc 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -581,6 +581,7 @@ exec_one_dummy_insn (struct regcache *regcache) { #define DUMMY_INSN_ADDR AIX_TEXT_SEGMENT_BASE+0x200 + struct gdbarch *gdbarch = get_regcache_arch (regcache); int ret, status, pid; CORE_ADDR prev_pc; void *bp; @@ -589,7 +590,7 @@ exec_one_dummy_insn (struct regcache *regcache) assume that this address will never be executed again by the real code. */ - bp = deprecated_insert_raw_breakpoint (DUMMY_INSN_ADDR); + bp = deprecated_insert_raw_breakpoint (gdbarch, DUMMY_INSN_ADDR); /* You might think this could be done with a single ptrace call, and you'd be correct for just about every platform I've ever worked @@ -613,7 +614,7 @@ exec_one_dummy_insn (struct regcache *regcache) while (pid != PIDGET (inferior_ptid)); regcache_write_pc (regcache, prev_pc); - deprecated_remove_raw_breakpoint (bp); + deprecated_remove_raw_breakpoint (gdbarch, bp); } diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 36097e6..6779581 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1071,6 +1071,7 @@ ppc_displaced_step_fixup (struct gdbarch *gdbarch, int ppc_deal_with_atomic_sequence (struct frame_info *frame) { + struct gdbarch *gdbarch = get_frame_arch (frame); CORE_ADDR pc = get_frame_pc (frame); CORE_ADDR breaks[2] = {-1, -1}; CORE_ADDR loc = pc; @@ -1143,7 +1144,7 @@ ppc_deal_with_atomic_sequence (struct frame_info *frame) /* Effectively inserts the breakpoints. */ for (index = 0; index <= last_breakpoint; index++) - insert_single_step_breakpoint (breaks[index]); + insert_single_step_breakpoint (gdbarch, breaks[index]); return 1; } diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c index 4af70c3..17f9547 100644 --- a/gdb/solib-darwin.c +++ b/gdb/solib-darwin.c @@ -360,7 +360,7 @@ darwin_solib_create_inferior_hook (void) darwin_load_image_infos (); if (dyld_all_image.version == DYLD_VERSION) - create_solib_event_breakpoint (dyld_all_image.notifier); + create_solib_event_breakpoint (target_gdbarch, dyld_all_image.notifier); } static void diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c index 4e1e845..080751d 100644 --- a/gdb/solib-frv.c +++ b/gdb/solib-frv.c @@ -788,7 +788,7 @@ enable_break2 (void) xfree (ldm); /* Now (finally!) create the solib breakpoint. */ - create_solib_event_breakpoint (addr); + create_solib_event_breakpoint (target_gdbarch, addr); return 1; } @@ -817,7 +817,8 @@ enable_break (void) if (interp_sect) { enable_break1_done = 1; - create_solib_event_breakpoint (symfile_objfile->ei.entry_point); + create_solib_event_breakpoint (target_gdbarch, + symfile_objfile->ei.entry_point); if (solib_frv_debug) fprintf_unfiltered (gdb_stdlog, diff --git a/gdb/solib-irix.c b/gdb/solib-irix.c index 979afd2..e60c520 100644 --- a/gdb/solib-irix.c +++ b/gdb/solib-irix.c @@ -320,7 +320,7 @@ disable_break (void) /* Note that breakpoint address and original contents are in our address space, so we just need to write the original contents back. */ - if (deprecated_remove_raw_breakpoint (base_breakpoint) != 0) + if (deprecated_remove_raw_breakpoint (target_gdbarch, base_breakpoint) != 0) { status = 0; } @@ -358,7 +358,8 @@ enable_break (void) if (symfile_objfile != NULL) { base_breakpoint - = deprecated_insert_raw_breakpoint (entry_point_address ()); + = deprecated_insert_raw_breakpoint (target_gdbarch, + entry_point_address ()); if (base_breakpoint != NULL) return 1; diff --git a/gdb/solib-pa64.c b/gdb/solib-pa64.c index ee43cca..3d22ee5 100644 --- a/gdb/solib-pa64.c +++ b/gdb/solib-pa64.c @@ -428,7 +428,7 @@ pa64_solib_create_inferior_hook (void) /* Create the shared library breakpoint. */ { struct breakpoint *b - = create_solib_event_breakpoint (sym_addr); + = create_solib_event_breakpoint (target_gdbarch, sym_addr); /* The breakpoint is actually hard-coded into the dynamic linker, so we don't need to actually insert a breakpoint instruction diff --git a/gdb/solib-som.c b/gdb/solib-som.c index dfe1a17..f16bba3 100644 --- a/gdb/solib-som.c +++ b/gdb/solib-som.c @@ -290,7 +290,8 @@ Suggest linking with /opt/langtools/lib/end.o.\n\ GDB will be unable to track shl_load/shl_unload calls")); goto keep_going; } - create_solib_event_breakpoint (SYMBOL_VALUE_ADDRESS (msymbol)); + create_solib_event_breakpoint (target_gdbarch, + SYMBOL_VALUE_ADDRESS (msymbol)); /* We have all the support usually found in end.o, so we can track shl_load and shl_unload calls. */ @@ -353,7 +354,7 @@ keep_going: anaddr = SYMBOL_VALUE_ADDRESS (msymbol); /* Make the breakpoint at "_start" a shared library event breakpoint. */ - create_solib_event_breakpoint (anaddr); + create_solib_event_breakpoint (target_gdbarch, anaddr); clear_symtab_users (); } diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index bb2cefc..07e4f76 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -1309,7 +1309,7 @@ enable_break (struct svr4_info *info) interp_plt_sect_low + bfd_section_size (tmp_bfd, interp_sect); } - create_solib_event_breakpoint (sym_addr); + create_solib_event_breakpoint (target_gdbarch, sym_addr); return 1; } } @@ -1435,7 +1435,7 @@ enable_break (struct svr4_info *info) if (sym_addr != 0) { - create_solib_event_breakpoint (load_addr + sym_addr); + create_solib_event_breakpoint (target_gdbarch, load_addr + sym_addr); xfree (interp_name); return 1; } @@ -1457,7 +1457,8 @@ enable_break (struct svr4_info *info) msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, symfile_objfile); if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0)) { - create_solib_event_breakpoint (SYMBOL_VALUE_ADDRESS (msymbol)); + create_solib_event_breakpoint (target_gdbarch, + SYMBOL_VALUE_ADDRESS (msymbol)); return 1; } } @@ -1467,7 +1468,8 @@ enable_break (struct svr4_info *info) msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, symfile_objfile); if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0)) { - create_solib_event_breakpoint (SYMBOL_VALUE_ADDRESS (msymbol)); + create_solib_event_breakpoint (target_gdbarch, + SYMBOL_VALUE_ADDRESS (msymbol)); return 1; } } diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 2b87d77..04343d6 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -1314,10 +1314,10 @@ sparc_software_single_step (struct frame_info *frame) /* Analyze the instruction at PC. */ nnpc = sparc_analyze_control_transfer (frame, pc, &npc); if (npc != 0) - insert_single_step_breakpoint (npc); + insert_single_step_breakpoint (arch, npc); if (nnpc != 0) - insert_single_step_breakpoint (nnpc); + insert_single_step_breakpoint (arch, nnpc); /* Assert that we have set at least one breakpoint, and that they're not set at the same spot - unless we're going diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index ac976a5..0034de4 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -1288,6 +1288,7 @@ spu_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR * pcptr, int *lenptr) static int spu_software_single_step (struct frame_info *frame) { + struct gdbarch *gdbarch = get_frame_arch (frame); CORE_ADDR pc, next_pc; unsigned int insn; int offset, reg; @@ -1307,7 +1308,7 @@ spu_software_single_step (struct frame_info *frame) else next_pc = (pc + 4) & (SPU_LS_SIZE - 1); - insert_single_step_breakpoint (next_pc); + insert_single_step_breakpoint (gdbarch, next_pc); if (is_branch (insn, &offset, ®)) { @@ -1323,7 +1324,7 @@ spu_software_single_step (struct frame_info *frame) target = target & (SPU_LS_SIZE - 1); if (target != next_pc) - insert_single_step_breakpoint (target); + insert_single_step_breakpoint (gdbarch, target); } return 1; diff --git a/gdb/target.c b/gdb/target.c index 24497cb..e1ebc04 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -106,15 +106,19 @@ static void debug_to_prepare_to_store (struct regcache *); static void debug_to_files_info (struct target_ops *); -static int debug_to_insert_breakpoint (struct bp_target_info *); +static int debug_to_insert_breakpoint (struct gdbarch *, + struct bp_target_info *); -static int debug_to_remove_breakpoint (struct bp_target_info *); +static int debug_to_remove_breakpoint (struct gdbarch *, + struct bp_target_info *); static int debug_to_can_use_hw_breakpoint (int, int, int); -static int debug_to_insert_hw_breakpoint (struct bp_target_info *); +static int debug_to_insert_hw_breakpoint (struct gdbarch *, + struct bp_target_info *); -static int debug_to_remove_hw_breakpoint (struct bp_target_info *); +static int debug_to_remove_hw_breakpoint (struct gdbarch *, + struct bp_target_info *); static int debug_to_insert_watchpoint (CORE_ADDR, int, int); @@ -679,10 +683,10 @@ update_current_target (void) (int (*) (int, int, int)) return_zero); de_fault (to_insert_hw_breakpoint, - (int (*) (struct bp_target_info *)) + (int (*) (struct gdbarch *, struct bp_target_info *)) return_minus_one); de_fault (to_remove_hw_breakpoint, - (int (*) (struct bp_target_info *)) + (int (*) (struct gdbarch *, struct bp_target_info *)) return_minus_one); de_fault (to_insert_watchpoint, (int (*) (CORE_ADDR, int, int)) @@ -2905,11 +2909,12 @@ debug_to_files_info (struct target_ops *target) } static int -debug_to_insert_breakpoint (struct bp_target_info *bp_tgt) +debug_to_insert_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { int retval; - retval = debug_target.to_insert_breakpoint (bp_tgt); + retval = debug_target.to_insert_breakpoint (gdbarch, bp_tgt); fprintf_unfiltered (gdb_stdlog, "target_insert_breakpoint (0x%lx, xxx) = %ld\n", @@ -2919,11 +2924,12 @@ debug_to_insert_breakpoint (struct bp_target_info *bp_tgt) } static int -debug_to_remove_breakpoint (struct bp_target_info *bp_tgt) +debug_to_remove_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { int retval; - retval = debug_target.to_remove_breakpoint (bp_tgt); + retval = debug_target.to_remove_breakpoint (gdbarch, bp_tgt); fprintf_unfiltered (gdb_stdlog, "target_remove_breakpoint (0x%lx, xxx) = %ld\n", @@ -3008,11 +3014,12 @@ debug_to_watchpoint_addr_within_range (struct target_ops *target, } static int -debug_to_insert_hw_breakpoint (struct bp_target_info *bp_tgt) +debug_to_insert_hw_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { int retval; - retval = debug_target.to_insert_hw_breakpoint (bp_tgt); + retval = debug_target.to_insert_hw_breakpoint (gdbarch, bp_tgt); fprintf_unfiltered (gdb_stdlog, "target_insert_hw_breakpoint (0x%lx, xxx) = %ld\n", @@ -3022,11 +3029,12 @@ debug_to_insert_hw_breakpoint (struct bp_target_info *bp_tgt) } static int -debug_to_remove_hw_breakpoint (struct bp_target_info *bp_tgt) +debug_to_remove_hw_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { int retval; - retval = debug_target.to_remove_hw_breakpoint (bp_tgt); + retval = debug_target.to_remove_hw_breakpoint (gdbarch, bp_tgt); fprintf_unfiltered (gdb_stdlog, "target_remove_hw_breakpoint (0x%lx, xxx) = %ld\n", diff --git a/gdb/target.h b/gdb/target.h index 2434a64..94750bb 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -367,11 +367,11 @@ struct target_ops struct target_ops *target); void (*to_files_info) (struct target_ops *); - int (*to_insert_breakpoint) (struct bp_target_info *); - int (*to_remove_breakpoint) (struct bp_target_info *); + int (*to_insert_breakpoint) (struct gdbarch *, struct bp_target_info *); + int (*to_remove_breakpoint) (struct gdbarch *, struct bp_target_info *); int (*to_can_use_hw_breakpoint) (int, int, int); - int (*to_insert_hw_breakpoint) (struct bp_target_info *); - int (*to_remove_hw_breakpoint) (struct bp_target_info *); + int (*to_insert_hw_breakpoint) (struct gdbarch *, struct bp_target_info *); + int (*to_remove_hw_breakpoint) (struct gdbarch *, struct bp_target_info *); int (*to_remove_watchpoint) (CORE_ADDR, int, int); int (*to_insert_watchpoint) (CORE_ADDR, int, int); int (*to_stopped_by_watchpoint) (void); @@ -739,14 +739,14 @@ extern int inferior_has_execd (ptid_t pid, char **execd_pathname); /* Insert a breakpoint at address BP_TGT->placed_address in the target machine. Result is 0 for success, or an errno value. */ -#define target_insert_breakpoint(bp_tgt) \ - (*current_target.to_insert_breakpoint) (bp_tgt) +#define target_insert_breakpoint(gdbarch, bp_tgt) \ + (*current_target.to_insert_breakpoint) (gdbarch, bp_tgt) /* Remove a breakpoint at address BP_TGT->placed_address in the target machine. Result is 0 for success, or an errno value. */ -#define target_remove_breakpoint(bp_tgt) \ - (*current_target.to_remove_breakpoint) (bp_tgt) +#define target_remove_breakpoint(gdbarch, bp_tgt) \ + (*current_target.to_remove_breakpoint) (gdbarch, bp_tgt) /* Initialize the terminal settings we record for the inferior, before we actually run the inferior. */ @@ -1109,11 +1109,11 @@ extern char *normal_pid_to_str (ptid_t ptid); #define target_remove_watchpoint(addr, len, type) \ (*current_target.to_remove_watchpoint) (addr, len, type) -#define target_insert_hw_breakpoint(bp_tgt) \ - (*current_target.to_insert_hw_breakpoint) (bp_tgt) +#define target_insert_hw_breakpoint(gdbarch, bp_tgt) \ + (*current_target.to_insert_hw_breakpoint) (gdbarch, bp_tgt) -#define target_remove_hw_breakpoint(bp_tgt) \ - (*current_target.to_remove_hw_breakpoint) (bp_tgt) +#define target_remove_hw_breakpoint(gdbarch, bp_tgt) \ + (*current_target.to_remove_hw_breakpoint) (gdbarch, bp_tgt) #define target_stopped_data_address(target, x) \ (*target.to_stopped_data_address) (target, x) @@ -1229,9 +1229,9 @@ extern struct target_section_table *target_get_section_table /* From mem-break.c */ -extern int memory_remove_breakpoint (struct bp_target_info *); +extern int memory_remove_breakpoint (struct gdbarch *, struct bp_target_info *); -extern int memory_insert_breakpoint (struct bp_target_info *); +extern int memory_insert_breakpoint (struct gdbarch *, struct bp_target_info *); extern int default_memory_remove_breakpoint (struct gdbarch *, struct bp_target_info *); diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index dcd3df7..5d194ff 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -722,6 +722,7 @@ add_memrange (struct collection_list *memranges, static void collect_symbol (struct collection_list *collect, struct symbol *sym, + struct gdbarch *gdbarch, long frame_regno, long frame_offset) { unsigned long len; @@ -754,7 +755,7 @@ collect_symbol (struct collection_list *collect, add_memrange (collect, memrange_absolute, offset, len); break; case LOC_REGISTER: - reg = SYMBOL_REGISTER_OPS (sym)->register_number (sym, current_gdbarch); + reg = SYMBOL_REGISTER_OPS (sym)->register_number (sym, gdbarch); if (info_verbose) printf_filtered ("LOC_REG[parm] %s: ", SYMBOL_PRINT_NAME (sym)); @@ -762,7 +763,7 @@ collect_symbol (struct collection_list *collect, /* Check for doubles stored in two registers. */ /* FIXME: how about larger types stored in 3 or more regs? */ if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FLT && - len > register_size (current_gdbarch, reg)) + len > register_size (gdbarch, reg)) add_register (collect, reg + 1); break; case LOC_REF_ARG: @@ -819,7 +820,8 @@ collect_symbol (struct collection_list *collect, /* Add all locals (or args) symbols to collection list */ static void -add_local_symbols (struct collection_list *collect, CORE_ADDR pc, +add_local_symbols (struct collection_list *collect, + struct gdbarch *gdbarch, CORE_ADDR pc, long frame_regno, long frame_offset, int type) { struct symbol *sym; @@ -838,8 +840,8 @@ add_local_symbols (struct collection_list *collect, CORE_ADDR pc, : type == 'L') /* collecting Locals */ { count++; - collect_symbol (collect, sym, frame_regno, - frame_offset); + collect_symbol (collect, sym, gdbarch, + frame_regno, frame_offset); } } if (BLOCK_FUNCTION (block)) @@ -1025,7 +1027,7 @@ encode_actions (struct breakpoint *t, char ***tdp_actions, *tdp_actions = NULL; *stepping_actions = NULL; - gdbarch_virtual_frame_pointer (current_gdbarch, + gdbarch_virtual_frame_pointer (t->gdbarch, t->loc->address, &frame_reg, &frame_offset); for (action = t->actions; action; action = action->next) @@ -1052,13 +1054,14 @@ encode_actions (struct breakpoint *t, char ***tdp_actions, if (0 == strncasecmp ("$reg", action_exp, 4)) { - for (i = 0; i < gdbarch_num_regs (current_gdbarch); i++) + for (i = 0; i < gdbarch_num_regs (t->gdbarch); i++) add_register (collect, i); action_exp = strchr (action_exp, ','); /* more? */ } else if (0 == strncasecmp ("$arg", action_exp, 4)) { add_local_symbols (collect, + t->gdbarch, t->loc->address, frame_reg, frame_offset, @@ -1068,6 +1071,7 @@ encode_actions (struct breakpoint *t, char ***tdp_actions, else if (0 == strncasecmp ("$loc", action_exp, 4)) { add_local_symbols (collect, + t->gdbarch, t->loc->address, frame_reg, frame_offset, @@ -1091,7 +1095,7 @@ encode_actions (struct breakpoint *t, char ***tdp_actions, { const char *name = &exp->elts[2].string; - i = user_reg_map_name_to_regnum (current_gdbarch, + i = user_reg_map_name_to_regnum (t->gdbarch, name, strlen (name)); if (i == -1) internal_error (__FILE__, __LINE__, @@ -1114,6 +1118,7 @@ encode_actions (struct breakpoint *t, char ***tdp_actions, case OP_VAR_VALUE: collect_symbol (collect, exp->elts[2].symbol, + t->gdbarch, frame_reg, frame_offset); break; |