* breakpoint.c (set_raw_breakpoint): Adjust breakpoint's address
authorKevin Buettner <kevinb@redhat.com>
Thu, 3 May 2007 17:42:25 +0000 (17:42 +0000)
committerKevin Buettner <kevinb@redhat.com>
Thu, 3 May 2007 17:42:25 +0000 (17:42 +0000)
prior to allocating its location.

gdb/ChangeLog
gdb/breakpoint.c

index 67fbdbde0c61a32b4bc1886cde2c069c5bd63b4c..188bed35b02791d823d1b878b5328eff5efa2f01 100644 (file)
@@ -1,3 +1,8 @@
+2007-05-03  Kevin Buettner  <kevinb@redhat.com>
+
+       * breakpoint.c (set_raw_breakpoint): Adjust breakpoint's address
+       prior to allocating its location.
+
 2007-05-02  Maciej W. Rozycki  <macro@mips.com>
 
        * mips-tdep.c (mips_o32_push_dummy_call): Remove conditions
index c6aaf66dbc10670af214784cf8fe79e7bcc17817..23b5f1d8b8b21849107f21e70cb6b1db415d66ca 100644 (file)
@@ -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