* 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.
doc/ChangeLog:
* gdbint.texi (Examples of Use of @code{ui_out} functions):
Update example code extrated from breakpoint.c.
+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.
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;
}
annotate_field (5);
- *last_addr = b->loc->address;
+ *last_loc = b->loc;
switch (ex)
{
case ex_catch_exception:
}
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
}
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
}
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
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. */
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;
}
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
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;
}
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;
}
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"
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);
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;
/* 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
{
/* 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",
{
/* 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
{
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;
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;
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);
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;
/* 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
{
/* 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'. */
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;
}
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;
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, " ");
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)
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;
}
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
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
{
{
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;
}
}
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)
{
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 */
/* 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);
}
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
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;
/* 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
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;
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;
}
}
+/* 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
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
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;
}
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. */
}
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;
}
/* 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;
/* 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;
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;
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;
}
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. */
}
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;
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;
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;
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;
}
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;
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);
}
\f
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);
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)
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,
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;
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,
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);
}
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,
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);
}
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;
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 */,
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,
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;
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;
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;
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);
{
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);
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;
{
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:
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;
/* 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
}
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);
}
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
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,
/* 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,
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;
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;
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);
}
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;
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
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;
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);
/* 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;
/* 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
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));
/* 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;
}
}
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 */,
/* 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
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"). */
/* 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. */
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);
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,
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);
/* 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. */
`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;
}
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
{
/* 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);
}
}
+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
@{
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 */
breakpoint_init_inferior). */
static int
-ignore (struct bp_target_info *bp_tgt)
+ignore (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
{
return 0;
}
/* 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;
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;
/* 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;
}
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
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. */
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;
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);
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);
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;
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);
/* 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);
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;
}
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
/* 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. */
/* 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;
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
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
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
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. */
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));
}
"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
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
? (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;
}
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);
}
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"
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);
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;
/* 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;
}
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;
}
/* 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;
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;
/* 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;
}
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);
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;
}
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;
{
/* 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."));
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)
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);
}
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);
}
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;
}
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;
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
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
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;
}
}
- 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 ();
return (rs->buf[0] == 'E');
}
- return memory_remove_breakpoint (bp_tgt);
+ return memory_remove_breakpoint (gdbarch, bp_tgt);
}
static int
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;
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;
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 ();
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];
/* 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! */
{
#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;
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
while (pid != PIDGET (inferior_ptid));
regcache_write_pc (regcache, prev_pc);
- deprecated_remove_raw_breakpoint (bp);
+ deprecated_remove_raw_breakpoint (gdbarch, bp);
}
\f
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;
/* 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;
}
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
xfree (ldm);
/* Now (finally!) create the solib breakpoint. */
- create_solib_event_breakpoint (addr);
+ create_solib_event_breakpoint (target_gdbarch, addr);
return 1;
}
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,
/* 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;
}
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;
/* 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
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. */
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 ();
}
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;
}
}
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;
}
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;
}
}
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;
}
}
/* 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
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;
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, ®))
{
target = target & (SPU_LS_SIZE - 1);
if (target != next_pc)
- insert_single_step_breakpoint (target);
+ insert_single_step_breakpoint (gdbarch, target);
}
return 1;
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);
(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))
}
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",
}
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",
}
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",
}
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",
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);
/* 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. */
#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)
/* 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 *);
static void
collect_symbol (struct collection_list *collect,
struct symbol *sym,
+ struct gdbarch *gdbarch,
long frame_regno, long frame_offset)
{
unsigned long len;
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));
/* 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:
/* 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;
: 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))
*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)
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,
else if (0 == strncasecmp ("$loc", action_exp, 4))
{
add_local_symbols (collect,
+ t->gdbarch,
t->loc->address,
frame_reg,
frame_offset,
{
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__,
case OP_VAR_VALUE:
collect_symbol (collect,
exp->elts[2].symbol,
+ t->gdbarch,
frame_reg,
frame_offset);
break;