summaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2007-05-03 17:42:25 +0000
committerKevin Buettner <kevinb@redhat.com>2007-05-03 17:42:25 +0000
commit6ddff18666a1683c4dd8126f3413c08133cd9203 (patch)
treebba1d8110c7b91747ea30a5e4b942a9ad8bc56e3 /gdb/breakpoint.c
parentebb54709a8b69f74f77ed6c1af2ffb0ee4b98ad1 (diff)
downloadgdb-6ddff18666a1683c4dd8126f3413c08133cd9203.tar.gz
* breakpoint.c (set_raw_breakpoint): Adjust breakpoint's address
prior to allocating its location.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index c6aaf66dbc1..23b5f1d8b8b 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -4189,13 +4189,23 @@ struct breakpoint *
set_raw_breakpoint (struct symtab_and_line sal, enum bptype bptype)
{
struct breakpoint *b, *b1;
+ CORE_ADDR adjusted_address;
b = (struct breakpoint *) xmalloc (sizeof (struct breakpoint));
memset (b, 0, sizeof (*b));
+
+ /* Adjust the breakpoint's address prior to allocating a location.
+ Once we call allocate_bp_location(), that mostly uninitialized
+ location will be placed on the location chain. Adjustment of the
+ breakpoint may cause read_memory_nobpt() 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, bptype);
+
b->loc = allocate_bp_location (b, bptype);
b->loc->requested_address = sal.pc;
- b->loc->address = adjust_breakpoint_address (b->loc->requested_address,
- bptype);
+ b->loc->address = adjusted_address;
+
if (sal.symtab == NULL)
b->source_file = NULL;
else