This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[06/15] Per-breakpoint architecture support
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 9 Jun 2009 17:17:40 +0200 (CEST)
- Subject: [06/15] Per-breakpoint architecture support
Hello,
processing of breakpoints needs to be architecture-aware in several places:
- which architecture should be used to query gdbarch callbacks like:
gdbarch_memory_insert_breakpoint
gdbarch_memory_remove_breakpoint
gdbarch_breakpoint_from_pc
gdbarch_adjust_breakpoint_address
- (re-)parsing a breakpoint condition / watchpoint expression may
require an architecture to use
- displaying breakpoint addresses needs gdbarch_addr_bit
- tracepoint collection requires an architecture to correctly interpret
register numbers
This patch addresses those questions by adding a struct gdbarch to the
main breakpoint structure. Every routine that creates a breakpoint
gets a gdbarch argument, and all callers are updated. The per-breakpoint
architecture is then used for the purposes mentioned above.
Bye,
Ulrich
ChangeLog:
* breakpoint.h (struct breakpoint): New member gdbarch.
(set_momentary_breakpoint): Add GDBARCH parameter.
(set_momentary_breakpoint_at_pc): Likewise.
(create_solib_event_breakpoint): Likewise.
(create_thread_event_breakpoint): Likewise.
(insert_single_step_breakpoint): Likewise.
(deprecated_insert_raw_breakpoint): Likewise.
(deprecated_remove_raw_breakpoint): Likewise.
* 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): Add GDBARCH
parameter, pass to target routine.
(target_insert_hw_breakpoint, target_remove_hw_breakpoint): Likewise.
(memory_remove_breakpoint, memory_insert_breakpoint): Add GDBARCH
parameter.
* 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. Pass it to
set_raw_breakpoint_without_location and adjust_breakpoint_address.
(create_internal_breakpoint): Add GDBARCH parameter. Pass it to
set_raw_breakpoint.
(create_longjmp_breakpoint): Pass objfile architecture to
set_momentary_breakpoint_at_pc.
(create_overlay_event_breakpoint_1): Pass objfile architecture
to create_internal_breakpoint.
(create_thread_event_breakpoint): Add GDBARCH parameter.
Pass it to create_internal_breakpoint.
(create_solib_event_breakpoint): Add GDBARCH parameter.
Pass it to create_internal_breakpoint.
(create_catchpoint): Add GDBARCH parameter. Pass it to
set_raw_breakpoint.
(create_fork_vfork_event_catchpoint): Add GDBARCH parameter.
Pass it to create_catchpoint.
(create_ada_exception_breakpoint): Add GDBARCH parameter. Pass it
to set_raw_breakpoint.
(set_momentary_breakpoint): Add GDBARCH parameter. Pass it to
set_raw_breakpoint.
(set_momentary_breakpoint_at_pc): Add GDBARCH parameter.
Pass it to set_momentary_breakpoint.
(clone_momentary_breakpoint): Pass architecture to
set_raw_breakpoint_without_location.
(create_breakpoint): Add GDBARCH parameter. Pass it to
set_raw_breakpoint.
(create_breakpoints): Add GDBARCH parameter. Pass it to
create_breakpoint.
(break_command_really): Pass get_current_arch () to create_breakpoints
and set_raw_breakpoint_without_location.
(watch_command_1): Pass get_current_arch () to set_raw_breakpoint,
create_internal_breakpoint, and adjust_breakpoint_address.
(until_break_command): Pass frame arch to set_momentary_breakpoint.
(catch_fork_command_1): Pass get_current_arch () to
create_fork_vfork_event_catchpoint.
(catch_exec_command_1): Pass get_current_arch () to create_catchpoint.
(catch_ada_exception_command): Pass get_current_arch () to
create_ada_exception_breakpoint.
(catch_assert_command): Likewise.
(print_one_breakpoint_location): Add PRINT_ADDRESS_BITS parameter.
Use it to define the size of the address output field.
(print_one_breakpoint): Add PRINT_ADDRESS_BITS parameter.
Pass it to print_one_breakpoint_location.
(do_captured_breakpoint_query): Pass address size of breakpoint
architecture to print_one_breakpoint.
(breakpoint_1): Determine maximum address size of all breakpoint
architectures and pass it to print_one_breakpoint.
Pass breakpoint architecture to set_next_address.
(adjust_breakpoint_address): Add GDBARCH parameter. Use it
instead of current_gdbarch.
(add_location_to_breakpoint): Pass breakpoint architecture to
adjust_breakpoint_address.
(bp_loc_is_permanent): Pass breakpoint architecture to
gdbarch_breakpoint_from_pc.
(insert_bp_location): Pass breakpoint architecture to
target_insert_breakpoint and target_insert_hw_breakpoint.
(remove_breakpoint): Pass breakpoint architecture to
target_remove_breakpoint and target_remove_hw_breakpoint.
(deprecated_insert_raw_breakpoint): Add GDBARCH parameter. Pass it
to target_insert_breakpoint.
(deprecated_remove_raw_breakpoint): Add GDBARCH parameter. Pass it
to target_remove_breakpoint.
(single_step_gdbarch): New static variable.
(insert_single_step_breakpoint): Add GDBARCH parameter. Pass it 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.
* target.c (debug_to_insert_breakpoint, debug_to_remove_breakpoint):
Add GDBARCH parameter, pass to target routine.
(debug_to_insert_hw_breakpoint, debug_to_remove_hw_breakpoint):
Likewise.
(update_current_target): Update function signature.
* mem-break.c (memory_insert_breakpoint): Add GDBARCH parameter.
Use it instead of current_gdbarch.
(memory_remove_breakpoint): Likewise.
* monitor.c (monitor_insert_breakpoint): Likewise.
(monitor_remove_breakpoint): Likewise.
* record.c (record_insert_breakpoint): Likewise.
(record_beneath_to_insert_breakpoint): Likewise.
(record_remove_breakpoint): Likewise.
(record_beneath_to_remove_breakpoint): Likewise.
* remote.c (remote_insert_breakpoint): Add GDBARCH parameter.
Use it instead of target_gdbarch. Pass to memory_insert_breakpoint.
(remote_remove_breakpoint): Add GDBARCH parameter. Pass it
to memory_remove_breakpoint.
(remote_insert_hw_breakpoint): Add GDBARCH parameter. Use it
instead of target_gdbarch.
(remote_remove_hw_breakpoint): Add GDBARCH parameter.
* remote-m32r-sdi.c (m32r_insert_breakpoint): Likewise.
(m32r_remove_breakpoint): Likewise.
* remote-mips.c (mips_insert_breakpoint): Add GDBARCH paramter.
Pass it to memory_insert_breakpoint.
(mips_remove_breakpoint): Add GDBARCH parameter. Pass it to
memory_remove_breakpoint.
* config/i386/nm-i386.h (i386_insert_hw_breakpoint): Add GDBARCH parameter.
(i386_remove_hw_breakpoint): Likewise.
* i386-nat.c (i386_insert_hw_breakpoint): Likewise.
(i386_remove_hw_breakpoint): Likewise.
* corelow.c (ignore): Add GDBARCH parameter.
* exec.c (ignore): Likewise.
* nto-procfs.c (procfs_insert_breakpoint): Likewise.
(procfs_remove_breakpoint): Likewise.
(procfs_insert_hw_breakpoint): Likewise.
(procfs_remove_hw_breakpoint): Likewise.
* 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.
* aix-thread.c (pd_enable): Pass target_gdbarch to
create_thread_event_breakpoint.
* linux-thread-db.c (enable_thread_event): Likewise.
* solib-frv.c (enable_break, enable_break2): Pass target_gdbarch
to create_solib_event_breakpoint.
* solib-pa64.c (pa64_solib_create_inferior_hook): Likewise.
* solib-som.c (som_solib_create_inferior_hook): Likewise.
* solib-svr4.c (enable_break): Likewise.
* rs6000-nat.c (exec_one_dummy_insn): Pass architecture to
deprecated_insert_raw_breakpoint and deprecated_remove_raw_breakpoint.
* solib-irix.c (enable_break): Pass target_gdbarch to
deprecated_insert_raw_breakpoint.
(disable_break): Pass target_gdbarch to
deprecated_remove_raw_breakpoint.
* procfs.c (procfs_mourn_inferior): Pass target_gdbarch to
deprecated_remove_raw_breakpoint.
(remove_dbx_link_breakpoint): Likewise.
(insert_dbx_link_bpt_in_file): Pass target_gdbarch to
deprecated_insert_raw_breakpoint.
* alpha-tdep.c (alpha_software_single_step): Pass architecture
to insert_single_step_breakpoint.
* arm-linux-tdep.c (arm_linux_software_single_step): Likewise.
* arm-tdep.c (arm_software_single_step): Likewise.
* cris-tdep.c (cris_software_single_step): Likewise.
* rs6000-aix-tdep.c (rs6000_software_single_step): Likewise.
* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Likewise.
* sparc-tdep.c (sparc_software_single_step): Likewise.
* spu-tdep.c (spu_software_single_step): Likewise.
* 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.
* infcall.c (call_function_by_hand): Pass architecture to
set_momentary_breakpoint.
* infcmd.c (finish_backward): Likewise.
(finish_forward): Likewise.
* 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): Pass architecture to
insert_longjmp_resume_breakpoint and
insert_step_resume_breakpoint_at_sal.
(insert_step_resume_breakpoint_at_frame): Pass architecture to
insert_step_resume_breakpoint_at_sal.
(insert_step_resume_breakpoint_at_caller): Likewise.
doc/ChangeLog:
* gdbint.texi (Examples of Use of @code{ui_out} functions):
Update example code extrated from breakpoint.c.
Index: gdb-head/gdb/aix-thread.c
===================================================================
--- gdb-head.orig/gdb/aix-thread.c
+++ gdb-head/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. */
Index: gdb-head/gdb/linux-thread-db.c
===================================================================
--- gdb-head.orig/gdb/linux-thread-db.c
+++ gdb-head/gdb/linux-thread-db.c
@@ -515,7 +515,7 @@ enable_thread_event (int event, CORE_ADD
? (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;
}
Index: gdb-head/gdb/alpha-tdep.c
===================================================================
--- gdb-head.orig/gdb/alpha-tdep.c
+++ gdb-head/gdb/alpha-tdep.c
@@ -1477,12 +1477,13 @@ alpha_next_pc (struct frame_info *frame,
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;
}
Index: gdb-head/gdb/arm-linux-tdep.c
===================================================================
--- gdb-head.orig/gdb/arm-linux-tdep.c
+++ gdb-head/gdb/arm-linux-tdep.c
@@ -575,6 +575,7 @@ arm_linux_regset_from_core_section (stru
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 f
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;
}
Index: gdb-head/gdb/arm-tdep.c
===================================================================
--- gdb-head.orig/gdb/arm-tdep.c
+++ gdb-head/gdb/arm-tdep.c
@@ -2166,12 +2166,14 @@ arm_get_next_pc (struct frame_info *fram
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;
}
Index: gdb-head/gdb/breakpoint.c
===================================================================
--- gdb-head.orig/gdb/breakpoint.c
+++ gdb-head/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
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);
@@ -1144,9 +1148,11 @@ Note: automatically using hardware break
/* 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->owner->gdbarch,
+ &bpt->target_info);
else
- val = target_insert_breakpoint (&bpt->target_info);
+ val = target_insert_breakpoint (bpt->owner->gdbarch,
+ &bpt->target_info);
}
else
{
@@ -1167,7 +1173,8 @@ Note: automatically using hardware break
/* 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->owner->gdbarch,
+ &bpt->overlay_target_info);
if (val != 0)
fprintf_unfiltered (tmp_error_stream,
"Overlay breakpoint %d failed: in ROM?\n",
@@ -1179,9 +1186,11 @@ Note: automatically using hardware break
{
/* 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->owner->gdbarch,
+ &bpt->target_info);
else
- val = target_insert_breakpoint (&bpt->target_info);
+ val = target_insert_breakpoint (bpt->owner->gdbarch,
+ &bpt->target_info);
}
else
{
@@ -1457,7 +1466,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;
@@ -1467,7 +1477,7 @@ create_internal_breakpoint (CORE_ADDR ad
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;
@@ -1483,7 +1493,8 @@ create_overlay_event_breakpoint (char *f
if ((m = lookup_minimal_symbol_text (func_name, objfile)) == NULL)
return;
- 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);
@@ -1661,9 +1672,11 @@ remove_breakpoint (struct bp_location *b
/* 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->owner->gdbarch,
+ &b->target_info);
else
- val = target_remove_breakpoint (&b->target_info);
+ val = target_remove_breakpoint (b->owner->gdbarch,
+ &b->target_info);
}
else
{
@@ -1677,9 +1690,11 @@ remove_breakpoint (struct bp_location *b
/* 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->owner->gdbarch,
+ &b->overlay_target_info);
else
- target_remove_breakpoint (&b->overlay_target_info);
+ target_remove_breakpoint (b->owner->gdbarch,
+ &b->overlay_target_info);
}
/* Did we set a breakpoint at the VMA?
If so, we will have marked the breakpoint 'inserted'. */
@@ -1690,13 +1705,15 @@ remove_breakpoint (struct bp_location *b
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->owner->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->owner->gdbarch,
+ &b->target_info);
else
val = 0;
}
@@ -3496,7 +3513,8 @@ static void
print_one_breakpoint_location (struct breakpoint *b,
struct bp_location *loc,
int loc_number,
- CORE_ADDR *last_addr)
+ CORE_ADDR *last_addr,
+ int print_address_bits)
{
struct command_line *l;
struct symbol *sym;
@@ -3604,7 +3622,7 @@ print_one_breakpoint_location (struct br
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, " ");
@@ -3802,9 +3820,9 @@ print_one_breakpoint_location (struct br
static void
print_one_breakpoint (struct breakpoint *b,
- CORE_ADDR *last_addr)
+ CORE_ADDR *last_addr, int print_address_bits)
{
- print_one_breakpoint_location (b, NULL, 0, last_addr);
+ print_one_breakpoint_location (b, NULL, 0, last_addr, print_address_bits);
/* If this breakpoint has custom print function,
it's already printed. Otherwise, print individual
@@ -3827,7 +3845,8 @@ print_one_breakpoint (struct breakpoint
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_addr,
+ print_address_bits);
}
}
}
@@ -3848,7 +3867,8 @@ do_captured_breakpoint_query (struct ui_
{
if (args->bnum == b->number)
{
- print_one_breakpoint (b, &dummy_addr);
+ int print_address_bits = gdbarch_addr_bit (b->gdbarch);
+ print_one_breakpoint (b, &dummy_addr, print_address_bits);
return GDB_RC_OK;
}
}
@@ -3894,20 +3914,29 @@ breakpoint_1 (int bnum, int allflag)
{
struct breakpoint *b;
CORE_ADDR last_addr = (CORE_ADDR) -1;
+ struct gdbarch *last_gdbarch = 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 = gdbarch_addr_bit (b->gdbarch);
+ if (addr_bit > print_address_bits)
+ print_address_bits = addr_bit;
+
+ nr_printable_breakpoints++;
+ }
}
if (opts.addressprint)
@@ -3937,7 +3966,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 */
@@ -3956,7 +3985,15 @@ 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);
+ {
+ CORE_ADDR this_addr = (CORE_ADDR) -1;
+ print_one_breakpoint (b, &this_addr, print_address_bits);
+ if (this_addr != (CORE_ADDR) -1)
+ {
+ last_addr = this_addr;
+ last_gdbarch = b->gdbarch;
+ }
+ }
}
do_cleanups (bkpttbl_chain);
@@ -3974,7 +4011,7 @@ breakpoint_1 (int bnum, int allflag)
/* 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);
+ set_next_address (last_gdbarch, last_addr);
}
/* FIXME? Should this be moved up so that it is only called when
@@ -4203,9 +4240,10 @@ breakpoint_adjustment_warning (CORE_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;
@@ -4226,8 +4264,7 @@ adjust_breakpoint_address (CORE_ADDR bpa
/* 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
@@ -4304,7 +4341,8 @@ static void free_bp_location (struct bp_
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;
@@ -4312,6 +4350,7 @@ set_raw_breakpoint_without_location (enu
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;
@@ -4372,10 +4411,11 @@ set_breakpoint_location_function (struct
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;
/* Adjust the breakpoint's address prior to allocating a location.
@@ -4384,7 +4424,7 @@ set_raw_breakpoint (struct symtab_and_li
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 (gdbarch, sal.pc, b->type);
b->loc = allocate_bp_location (b);
b->loc->requested_address = sal.pc;
@@ -4429,7 +4469,8 @@ create_longjmp_breakpoint (char *func_na
if ((m = lookup_minimal_symbol_text (func_name, objfile)) == NULL)
return;
- set_momentary_breakpoint_at_pc (SYMBOL_VALUE_ADDRESS (m), bp_longjmp);
+ set_momentary_breakpoint_at_pc (get_objfile_arch (objfile),
+ SYMBOL_VALUE_ADDRESS (m), bp_longjmp);
update_global_location_list (1);
}
@@ -4497,11 +4538,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. */
@@ -4548,11 +4589,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;
}
@@ -4804,8 +4845,8 @@ static struct breakpoint_ops catch_vfork
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;
@@ -4815,7 +4856,7 @@ create_catchpoint (int tempflag, char *c
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;
@@ -4833,10 +4874,12 @@ create_catchpoint (int tempflag, char *c
}
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. */
@@ -4991,11 +5034,11 @@ enable_watchpoints_after_interactive_cal
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;
- 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;
@@ -5023,7 +5066,7 @@ clone_momentary_breakpoint (struct break
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);
@@ -5049,7 +5092,8 @@ clone_momentary_breakpoint (struct break
}
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;
@@ -5058,7 +5102,7 @@ set_momentary_breakpoint_at_pc (CORE_ADD
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);
}
@@ -5212,7 +5256,8 @@ add_location_to_breakpoint (struct break
;
*tmp = loc;
loc->requested_address = sal->pc;
- loc->address = adjust_breakpoint_address (loc->requested_address, b->type);
+ loc->address = adjust_breakpoint_address (b->gdbarch,
+ loc->requested_address, b->type);
loc->section = sal->section;
set_breakpoint_location_function (loc);
@@ -5236,7 +5281,7 @@ bp_loc_is_permanent (struct bp_location
gdb_assert (loc != NULL);
addr = loc->address;
- brk = gdbarch_breakpoint_from_pc (current_gdbarch, &addr, &len);
+ brk = gdbarch_breakpoint_from_pc (loc->owner->gdbarch, &addr, &len);
/* Software breakpoints unsupported? */
if (brk == NULL)
@@ -5265,7 +5310,8 @@ bp_loc_is_permanent (struct bp_location
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,
@@ -5296,7 +5342,7 @@ create_breakpoint (struct symtabs_and_li
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;
@@ -5486,7 +5532,8 @@ expand_line_sal_maybe (struct symtab_and
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,
@@ -5499,7 +5546,7 @@ create_breakpoints (struct symtabs_and_l
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);
}
@@ -5694,6 +5741,7 @@ break_command_really (char *arg, char *c
int from_tty,
int enabled)
{
+ struct gdbarch *gdbarch = get_current_arch ();
struct gdb_exception e;
struct symtabs_and_lines sals;
struct symtab_and_line pending_sal;
@@ -5828,7 +5876,7 @@ break_command_really (char *arg, char *c
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);
}
@@ -5839,7 +5887,7 @@ break_command_really (char *arg, char *c
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;
@@ -6086,6 +6134,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;
@@ -6243,7 +6292,8 @@ watch_command_1 (char *arg, int accessfl
that we will encounter it first in bpstat_stop_status. */
if (innermost_block && prev_frame)
{
- scope_breakpoint = create_internal_breakpoint (get_frame_pc (prev_frame),
+ scope_breakpoint = create_internal_breakpoint (gdbarch,
+ get_frame_pc (prev_frame),
bp_watchpoint_scope);
scope_breakpoint->enable_state = bp_enabled;
@@ -6258,12 +6308,13 @@ watch_command_1 (char *arg, int accessfl
scope_breakpoint->loc->requested_address
= get_frame_pc (prev_frame);
scope_breakpoint->loc->address
- = adjust_breakpoint_address (scope_breakpoint->loc->requested_address,
+ = adjust_breakpoint_address (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;
@@ -6441,6 +6492,7 @@ until_break_command (char *arg, int from
struct symtab_and_line sal;
struct frame_info *frame = get_selected_frame (NULL);
struct frame_info *prev_frame = get_prev_frame (frame);
+ struct gdbarch *gdbarch = get_frame_arch (frame);
struct breakpoint *breakpoint;
struct breakpoint *breakpoint2 = NULL;
struct cleanup *old_chain;
@@ -6471,12 +6523,13 @@ until_break_command (char *arg, int from
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 (gdbarch, sal,
+ null_frame_id, bp_until);
else
/* Otherwise, specify the current frame, because we want to stop only
at the very same frame. */
- breakpoint = set_momentary_breakpoint (sal, get_frame_id (frame),
- bp_until);
+ breakpoint = set_momentary_breakpoint (gdbarch, sal,
+ get_frame_id (frame), bp_until);
old_chain = make_cleanup_delete_breakpoint (breakpoint);
@@ -6486,7 +6539,8 @@ until_break_command (char *arg, int from
{
sal = find_pc_line (get_frame_pc (prev_frame), 0);
sal.pc = get_frame_pc (prev_frame);
- breakpoint2 = set_momentary_breakpoint (sal, get_frame_id (prev_frame),
+ breakpoint2 = set_momentary_breakpoint (gdbarch, sal,
+ get_frame_id (prev_frame),
bp_until);
make_cleanup_delete_breakpoint (breakpoint2);
}
@@ -6603,6 +6657,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;
@@ -6631,12 +6686,12 @@ catch_fork_command_1 (char *arg, int fro
{
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:
@@ -6648,6 +6703,7 @@ catch_fork_command_1 (char *arg, int fro
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;
@@ -6669,7 +6725,8 @@ catch_exec_command_1 (char *arg, int fro
/* 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
@@ -6820,7 +6877,8 @@ catch_throw_command (char *arg, int from
/* 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,
@@ -6844,7 +6902,7 @@ create_ada_exception_breakpoint (struct
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;
@@ -6869,6 +6927,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;
@@ -6884,7 +6943,7 @@ catch_ada_exception_command (char *arg,
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);
}
@@ -6894,6 +6953,7 @@ catch_ada_exception_command (char *arg,
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;
@@ -6904,8 +6964,8 @@ catch_assert_command (char *arg, int fro
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
@@ -8181,7 +8241,7 @@ decode_line_spec_1 (char *string, int fu
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;
@@ -8189,7 +8249,7 @@ deprecated_insert_raw_breakpoint (CORE_A
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);
@@ -8202,12 +8262,12 @@ deprecated_insert_raw_breakpoint (CORE_A
/* 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;
@@ -8216,20 +8276,25 @@ deprecated_remove_raw_breakpoint (void *
/* 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
@@ -8239,7 +8304,7 @@ insert_single_step_breakpoint (CORE_ADDR
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));
@@ -8254,12 +8319,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;
}
}
Index: gdb-head/gdb/breakpoint.h
===================================================================
--- gdb-head.orig/gdb/breakpoint.h
+++ gdb-head/gdb/breakpoint.h
@@ -387,6 +387,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. */
@@ -691,10 +693,10 @@ extern void breakpoint_re_set_objfile (s
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);
@@ -827,9 +829,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);
@@ -850,14 +854,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. */
Index: gdb-head/gdb/corelow.c
===================================================================
--- gdb-head.orig/gdb/corelow.c
+++ gdb-head/gdb/corelow.c
@@ -693,7 +693,7 @@ core_xfer_partial (struct target_ops *op
`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;
}
Index: gdb-head/gdb/cris-tdep.c
===================================================================
--- gdb-head.orig/gdb/cris-tdep.c
+++ gdb-head/gdb/cris-tdep.c
@@ -2120,6 +2120,7 @@ find_step_target (struct frame_info *fra
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_
{
/* 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);
}
}
Index: gdb-head/gdb/exec.c
===================================================================
--- gdb-head.orig/gdb/exec.c
+++ gdb-head/gdb/exec.c
@@ -797,7 +797,7 @@ exec_set_section_address (const char *fi
breakpoint_init_inferior). */
static int
-ignore (struct bp_target_info *bp_tgt)
+ignore (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
{
return 0;
}
Index: gdb-head/gdb/i386-nat.c
===================================================================
--- gdb-head.orig/gdb/i386-nat.c
+++ gdb-head/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_tar
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;
Index: gdb-head/gdb/infcall.c
===================================================================
--- gdb-head.orig/gdb/infcall.c
+++ gdb-head/gdb/infcall.c
@@ -713,7 +713,7 @@ call_function_by_hand (struct value *fun
/* 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;
}
Index: gdb-head/gdb/infcmd.c
===================================================================
--- gdb-head.orig/gdb/infcmd.c
+++ gdb-head/gdb/infcmd.c
@@ -1428,11 +1428,12 @@ 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_frame_id (get_selected_frame (NULL)),
- bp_breakpoint);
+ set_momentary_breakpoint (gdbarch, sal,
+ get_frame_id (frame), bp_breakpoint);
/* Tell the breakpoint to keep quiet. We won't be done
until we've done another reverse single-step. */
make_breakpoint_silent (breakpoint);
@@ -1460,6 +1461,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;
@@ -1469,8 +1471,8 @@ finish_forward (struct symbol *function,
sal = find_pc_line (get_frame_pc (frame), 0);
sal.pc = get_frame_pc (frame);
- breakpoint = set_momentary_breakpoint (sal, get_frame_id (frame),
- bp_finish);
+ breakpoint = set_momentary_breakpoint (gdbarch, sal,
+ get_frame_id (frame), bp_finish);
old_chain = make_cleanup_delete_breakpoint (breakpoint);
Index: gdb-head/gdb/infrun.c
===================================================================
--- gdb-head.orig/gdb/infrun.c
+++ gdb-head/gdb/infrun.c
@@ -1731,9 +1731,10 @@ static void handle_step_into_function_ba
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);
@@ -3352,7 +3353,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
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;
@@ -3640,7 +3641,8 @@ infrun: not switching back to stepped th
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);
@@ -3733,7 +3735,8 @@ infrun: not switching back to stepped th
/* Normal (staticly linked) function call return. */
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);
@@ -3759,7 +3762,8 @@ infrun: not switching back to stepped th
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;
}
@@ -3803,7 +3807,8 @@ infrun: not switching back to stepped th
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
@@ -3839,7 +3844,8 @@ infrun: not switching back to stepped th
/* 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. */
@@ -4043,7 +4049,7 @@ handle_step_into_function (struct gdbarc
/* 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;
@@ -4093,7 +4099,8 @@ handle_step_into_function_backward (stru
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
@@ -4107,7 +4114,7 @@ insert_step_resume_breakpoint_at_sal (st
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
@@ -4129,7 +4136,8 @@ insert_step_resume_breakpoint_at_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_frame_id (return_frame));
+ insert_step_resume_breakpoint_at_sal (gdbarch, sr_sal,
+ get_frame_id (return_frame));
}
/* Similar to insert_step_resume_breakpoint_at_frame, except
@@ -4162,7 +4170,8 @@ insert_step_resume_breakpoint_at_caller
sr_sal.pc = gdbarch_addr_bits_remove (gdbarch, frame_pc_unwind (next_frame));
sr_sal.section = find_pc_overlay (sr_sal.pc);
- insert_step_resume_breakpoint_at_sal (sr_sal, frame_unwind_id (next_frame));
+ insert_step_resume_breakpoint_at_sal (gdbarch, sr_sal,
+ frame_unwind_id (next_frame));
}
/* Insert a "longjmp-resume" breakpoint at PC. This is used to set a
@@ -4171,7 +4180,7 @@ insert_step_resume_breakpoint_at_caller
"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
@@ -4184,7 +4193,7 @@ insert_longjmp_resume_breakpoint (CORE_A
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
Index: gdb-head/gdb/mem-break.c
===================================================================
--- gdb-head.orig/gdb/mem-break.c
+++ gdb-head/gdb/mem-break.c
@@ -78,13 +78,15 @@ default_memory_remove_breakpoint (struct
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);
}
Index: gdb-head/gdb/mips-tdep.c
===================================================================
--- gdb-head.orig/gdb/mips-tdep.c
+++ gdb-head/gdb/mips-tdep.c
@@ -2380,7 +2380,7 @@ mips_addr_bits_remove (struct gdbarch *g
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;
@@ -2468,7 +2468,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;
}
@@ -2481,15 +2481,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;
}
Index: gdb-head/gdb/monitor.c
===================================================================
--- gdb-head.orig/gdb/monitor.c
+++ gdb-head/gdb/monitor.c
@@ -2027,7 +2027,8 @@ monitor_mourn_inferior (struct target_op
/* 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_tar
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_tar
/* 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;
Index: gdb-head/gdb/nto-procfs.c
===================================================================
--- gdb-head.orig/gdb/nto-procfs.c
+++ gdb-head/gdb/nto-procfs.c
@@ -824,26 +824,30 @@ procfs_breakpoint (CORE_ADDR addr, int t
}
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);
Index: gdb-head/gdb/procfs.c
===================================================================
--- gdb-head.orig/gdb/procfs.c
+++ gdb-head/gdb/procfs.c
@@ -4800,7 +4800,7 @@ procfs_mourn_inferior (struct target_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;
}
@@ -5617,7 +5617,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;
@@ -5689,7 +5689,8 @@ insert_dbx_link_bpt_in_file (int fd, COR
{
/* 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."));
Index: gdb-head/gdb/remote.c
===================================================================
--- gdb-head.orig/gdb/remote.c
+++ gdb-head/gdb/remote.c
@@ -6823,7 +6823,8 @@ extended_remote_create_inferior (struct
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
@@ -6837,7 +6838,7 @@ remote_insert_breakpoint (struct bp_targ
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;
@@ -6865,11 +6866,12 @@ remote_insert_breakpoint (struct bp_targ
}
}
- 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 ();
@@ -6893,7 +6895,7 @@ remote_remove_breakpoint (struct bp_targ
return (rs->buf[0] == 'E');
}
- return memory_remove_breakpoint (bp_tgt);
+ return memory_remove_breakpoint (gdbarch, bp_tgt);
}
static int
@@ -7029,7 +7031,8 @@ remote_stopped_data_address (struct targ
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;
@@ -7039,7 +7042,7 @@ remote_insert_hw_breakpoint (struct bp_t
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;
@@ -7072,7 +7075,8 @@ remote_insert_hw_breakpoint (struct bp_t
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 ();
Index: gdb-head/gdb/remote-m32r-sdi.c
===================================================================
--- gdb-head.orig/gdb/remote-m32r-sdi.c
+++ gdb-head/gdb/remote-m32r-sdi.c
@@ -1140,7 +1140,8 @@ m32r_mourn_inferior (struct target_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
}
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;
Index: gdb-head/gdb/remote-mips.c
===================================================================
--- gdb-head.orig/gdb/remote-mips.c
+++ gdb-head/gdb/remote-mips.c
@@ -2228,23 +2228,25 @@ mips_mourn_inferior (struct target_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
Index: gdb-head/gdb/rs6000-aix-tdep.c
===================================================================
--- gdb-head.orig/gdb/rs6000-aix-tdep.c
+++ gdb-head/gdb/rs6000-aix-tdep.c
@@ -663,6 +663,7 @@ branch_dest (struct frame_info *frame, i
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 fram
/* 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! */
Index: gdb-head/gdb/rs6000-nat.c
===================================================================
--- gdb-head.orig/gdb/rs6000-nat.c
+++ gdb-head/gdb/rs6000-nat.c
@@ -581,6 +581,7 @@ exec_one_dummy_insn (struct regcache *re
{
#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 *re
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 *re
while (pid != PIDGET (inferior_ptid));
regcache_write_pc (regcache, prev_pc);
- deprecated_remove_raw_breakpoint (bp);
+ deprecated_remove_raw_breakpoint (gdbarch, bp);
}
Index: gdb-head/gdb/rs6000-tdep.c
===================================================================
--- gdb-head.orig/gdb/rs6000-tdep.c
+++ gdb-head/gdb/rs6000-tdep.c
@@ -1071,6 +1071,7 @@ ppc_displaced_step_fixup (struct 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 fr
/* 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;
}
Index: gdb-head/gdb/solib-frv.c
===================================================================
--- gdb-head.orig/gdb/solib-frv.c
+++ gdb-head/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,
Index: gdb-head/gdb/solib-irix.c
===================================================================
--- gdb-head.orig/gdb/solib-irix.c
+++ gdb-head/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;
Index: gdb-head/gdb/solib-pa64.c
===================================================================
--- gdb-head.orig/gdb/solib-pa64.c
+++ gdb-head/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
Index: gdb-head/gdb/solib-som.c
===================================================================
--- gdb-head.orig/gdb/solib-som.c
+++ gdb-head/gdb/solib-som.c
@@ -290,7 +290,8 @@ Suggest linking with /opt/langtools/lib/
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 ();
}
Index: gdb-head/gdb/solib-svr4.c
===================================================================
--- gdb-head.orig/gdb/solib-svr4.c
+++ gdb-head/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;
}
}
Index: gdb-head/gdb/sparc-tdep.c
===================================================================
--- gdb-head.orig/gdb/sparc-tdep.c
+++ gdb-head/gdb/sparc-tdep.c
@@ -1297,10 +1297,10 @@ sparc_software_single_step (struct 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
Index: gdb-head/gdb/spu-tdep.c
===================================================================
--- gdb-head.orig/gdb/spu-tdep.c
+++ gdb-head/gdb/spu-tdep.c
@@ -1288,6 +1288,7 @@ spu_breakpoint_from_pc (struct gdbarch *
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_i
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_i
target = target & (SPU_LS_SIZE - 1);
if (target != next_pc)
- insert_single_step_breakpoint (target);
+ insert_single_step_breakpoint (gdbarch, target);
}
return 1;
Index: gdb-head/gdb/target.c
===================================================================
--- gdb-head.orig/gdb/target.c
+++ gdb-head/gdb/target.c
@@ -105,15 +105,19 @@ static void debug_to_prepare_to_store (s
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);
@@ -549,10 +553,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))
@@ -2813,11 +2817,12 @@ debug_to_files_info (struct target_ops *
}
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",
@@ -2827,11 +2832,12 @@ debug_to_insert_breakpoint (struct bp_ta
}
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",
@@ -2916,11 +2922,12 @@ debug_to_watchpoint_addr_within_range (s
}
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",
@@ -2930,11 +2937,12 @@ debug_to_insert_hw_breakpoint (struct bp
}
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",
Index: gdb-head/gdb/target.h
===================================================================
--- gdb-head.orig/gdb/target.h
+++ gdb-head/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 pi
/* 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. */
@@ -1100,11 +1100,11 @@ extern char *normal_pid_to_str (ptid_t p
#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)
@@ -1227,9 +1227,9 @@ extern struct target_section_table *targ
/* 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 *);
Index: gdb-head/gdb/record.c
===================================================================
--- gdb-head.orig/gdb/record.c
+++ gdb-head/gdb/record.c
@@ -112,8 +112,10 @@ static LONGEST (*record_beneath_to_xfer_
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 *
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_targ
}
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);
Index: gdb-head/gdb/doc/gdbint.texinfo
===================================================================
--- gdb-head.orig/gdb/doc/gdbint.texinfo
+++ gdb-head/gdb/doc/gdbint.texinfo
@@ -1594,7 +1594,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 */
Index: gdb-head/gdb/tracepoint.c
===================================================================
--- gdb-head.orig/gdb/tracepoint.c
+++ gdb-head/gdb/tracepoint.c
@@ -752,6 +752,7 @@ add_memrange (struct collection_list *me
static void
collect_symbol (struct collection_list *collect,
struct symbol *sym,
+ struct gdbarch *gdbarch,
long frame_regno, long frame_offset)
{
unsigned long len;
@@ -784,7 +785,7 @@ collect_symbol (struct collection_list *
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));
@@ -792,7 +793,7 @@ collect_symbol (struct collection_list *
/* 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:
@@ -849,7 +850,8 @@ collect_symbol (struct collection_list *
/* 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;
@@ -868,8 +870,8 @@ add_local_symbols (struct collection_lis
: 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))
@@ -1055,7 +1057,7 @@ encode_actions (struct breakpoint *t, ch
*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)
@@ -1082,13 +1084,14 @@ encode_actions (struct breakpoint *t, ch
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,
@@ -1098,6 +1101,7 @@ encode_actions (struct breakpoint *t, ch
else if (0 == strncasecmp ("$loc", action_exp, 4))
{
add_local_symbols (collect,
+ t->gdbarch,
t->loc->address,
frame_reg,
frame_offset,
@@ -1121,7 +1125,7 @@ encode_actions (struct breakpoint *t, ch
{
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__,
@@ -1144,6 +1148,7 @@ encode_actions (struct breakpoint *t, ch
case OP_VAR_VALUE:
collect_symbol (collect,
exp->elts[2].symbol,
+ t->gdbarch,
frame_reg,
frame_offset);
break;
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com