|
|
059aafd |
--- ./gdb/breakpoint.c 2009-12-18 00:13:49.000000000 +0100
|
|
|
059aafd |
+++ ./gdb/breakpoint.c 2009-12-18 00:13:16.000000000 +0100
|
|
|
059aafd |
@@ -8563,6 +8563,49 @@ update_breakpoint_locations (struct brea
|
|
|
059aafd |
update_global_location_list (1);
|
|
|
059aafd |
}
|
|
|
059aafd |
|
|
|
059aafd |
+void
|
|
|
059aafd |
+breakpoints_relocate (struct objfile *objfile, struct section_offsets *delta)
|
|
|
059aafd |
+{
|
|
|
059aafd |
+ struct bp_location *bl, **blp_tmp;
|
|
|
059aafd |
+ int changed = 0;
|
|
|
059aafd |
+
|
|
|
059aafd |
+ gdb_assert (objfile->separate_debug_objfile_backlink == NULL);
|
|
|
059aafd |
+
|
|
|
059aafd |
+ ALL_BP_LOCATIONS (bl, blp_tmp)
|
|
|
059aafd |
+ {
|
|
|
059aafd |
+ struct obj_section *osect;
|
|
|
059aafd |
+
|
|
|
059aafd |
+ /* BL->SECTION can be correctly NULL for breakpoints with multiple
|
|
|
059aafd |
+ locations expanded through symtab. */
|
|
|
059aafd |
+
|
|
|
059aafd |
+ ALL_OBJFILE_OSECTIONS (objfile, osect)
|
|
|
059aafd |
+ {
|
|
|
059aafd |
+ CORE_ADDR relocated_address;
|
|
|
059aafd |
+ CORE_ADDR delta_offset;
|
|
|
059aafd |
+
|
|
|
059aafd |
+ delta_offset = ANOFFSET (delta, osect->the_bfd_section->index);
|
|
|
059aafd |
+ if (delta_offset == 0)
|
|
|
059aafd |
+ continue;
|
|
|
059aafd |
+ relocated_address = bl->address + delta_offset;
|
|
|
059aafd |
+
|
|
|
059aafd |
+ if (obj_section_addr (osect) <= relocated_address
|
|
|
059aafd |
+ && relocated_address < obj_section_endaddr (osect))
|
|
|
059aafd |
+ {
|
|
|
059aafd |
+ if (bl->inserted)
|
|
|
059aafd |
+ remove_breakpoint (bl, mark_uninserted);
|
|
|
059aafd |
+
|
|
|
059aafd |
+ bl->address += delta_offset;
|
|
|
059aafd |
+ bl->requested_address += delta_offset;
|
|
|
059aafd |
+
|
|
|
059aafd |
+ changed = 1;
|
|
|
059aafd |
+ }
|
|
|
059aafd |
+ }
|
|
|
059aafd |
+ }
|
|
|
059aafd |
+
|
|
|
059aafd |
+ if (changed)
|
|
|
059aafd |
+ qsort (bp_location, bp_location_count, sizeof (*bp_location),
|
|
|
059aafd |
+ bp_location_compare_for_qsort);
|
|
|
059aafd |
+}
|
|
|
059aafd |
|
|
|
059aafd |
/* Reset a breakpoint given it's struct breakpoint * BINT.
|
|
|
059aafd |
The value we return ends up being the return value from catch_errors.
|
|
|
059aafd |
--- ./gdb/breakpoint.h 2009-12-18 00:13:48.000000000 +0100
|
|
|
059aafd |
+++ ./gdb/breakpoint.h 2009-12-17 22:11:10.000000000 +0100
|
|
|
059aafd |
@@ -970,4 +970,7 @@ extern struct breakpoint *get_tracepoint
|
|
|
059aafd |
is newly allocated; the caller should free when done with it. */
|
|
|
059aafd |
extern VEC(breakpoint_p) *all_tracepoints (void);
|
|
|
059aafd |
|
|
|
059aafd |
+extern void breakpoints_relocate (struct objfile *objfile,
|
|
|
059aafd |
+ struct section_offsets *delta);
|
|
|
059aafd |
+
|
|
|
059aafd |
#endif /* !defined (BREAKPOINT_H) */
|
|
|
059aafd |
--- ./gdb/objfiles.c 2009-12-18 00:13:48.000000000 +0100
|
|
|
059aafd |
+++ ./gdb/objfiles.c 2009-12-17 23:19:22.000000000 +0100
|
|
|
059aafd |
@@ -546,7 +546,7 @@ free_all_objfiles (void)
|
|
|
059aafd |
/* Relocate OBJFILE to NEW_OFFSETS. There should be OBJFILE->NUM_SECTIONS
|
|
|
059aafd |
entries in new_offsets. SEPARATE_DEBUG_OBJFILE is not touched here. */
|
|
|
059aafd |
|
|
|
059aafd |
-static void
|
|
|
059aafd |
+static int
|
|
|
059aafd |
objfile_relocate1 (struct objfile *objfile, struct section_offsets *new_offsets)
|
|
|
059aafd |
{
|
|
|
059aafd |
struct obj_section *s;
|
|
|
059aafd |
@@ -565,7 +565,7 @@ objfile_relocate1 (struct objfile *objfi
|
|
|
059aafd |
something_changed = 1;
|
|
|
059aafd |
}
|
|
|
059aafd |
if (!something_changed)
|
|
|
059aafd |
- return;
|
|
|
059aafd |
+ return 0;
|
|
|
059aafd |
}
|
|
|
059aafd |
|
|
|
059aafd |
/* OK, get all the symtabs. */
|
|
|
059aafd |
@@ -706,6 +706,13 @@ objfile_relocate1 (struct objfile *objfi
|
|
|
059aafd |
exec_set_section_address (bfd_get_filename (objfile->obfd), idx,
|
|
|
059aafd |
obj_section_addr (s));
|
|
|
059aafd |
}
|
|
|
059aafd |
+
|
|
|
059aafd |
+ /* Final call of breakpoint_re_set can keep breakpoint locations disabled if
|
|
|
059aafd |
+ their addresses match. */
|
|
|
059aafd |
+ if (objfile->separate_debug_objfile_backlink == NULL)
|
|
|
059aafd |
+ breakpoints_relocate (objfile, delta);
|
|
|
059aafd |
+
|
|
|
059aafd |
+ return 1;
|
|
|
059aafd |
}
|
|
|
059aafd |
|
|
|
059aafd |
/* Relocate OBJFILE to NEW_OFFSETS. There should be OBJFILE->NUM_SECTIONS
|
|
|
059aafd |
@@ -720,7 +727,9 @@ objfile_relocate1 (struct objfile *objfi
|
|
|
059aafd |
void
|
|
|
059aafd |
objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
|
|
|
059aafd |
{
|
|
|
059aafd |
- objfile_relocate1 (objfile, new_offsets);
|
|
|
059aafd |
+ int changed = 0;
|
|
|
059aafd |
+
|
|
|
059aafd |
+ changed |= objfile_relocate1 (objfile, new_offsets);
|
|
|
059aafd |
|
|
|
059aafd |
if (objfile->separate_debug_objfile != NULL)
|
|
|
059aafd |
{
|
|
|
059aafd |
@@ -747,11 +756,12 @@ objfile_relocate (struct objfile *objfil
|
|
|
059aafd |
objfile_addrs);
|
|
|
059aafd |
do_cleanups (my_cleanups);
|
|
|
059aafd |
|
|
|
059aafd |
- objfile_relocate1 (debug_objfile, new_debug_offsets);
|
|
|
059aafd |
+ changed |= objfile_relocate1 (debug_objfile, new_debug_offsets);
|
|
|
059aafd |
}
|
|
|
059aafd |
|
|
|
059aafd |
/* Relocate breakpoints as necessary, after things are relocated. */
|
|
|
059aafd |
- breakpoint_re_set ();
|
|
|
059aafd |
+ if (changed)
|
|
|
059aafd |
+ breakpoint_re_set ();
|
|
|
059aafd |
}
|
|
|
059aafd |
|
|
|
059aafd |
/* Return non-zero if OBJFILE has partial symbols. */
|