]>
Commit | Line | Data |
---|---|---|
6ed6bacf | 1 | Index: gdb-7.2.90.20110411/gdb/breakpoint.c |
51a5ef0f | 2 | =================================================================== |
6ed6bacf AM |
3 | --- gdb-7.2.90.20110411.orig/gdb/breakpoint.c 2011-04-11 19:11:55.000000000 +0200 |
4 | +++ gdb-7.2.90.20110411/gdb/breakpoint.c 2011-04-11 19:18:10.000000000 +0200 | |
5 | @@ -11233,6 +11233,50 @@ re_set_breakpoint (struct breakpoint *b) | |
6 | do_cleanups (cleanups); | |
51a5ef0f PS |
7 | } |
8 | ||
9 | +void | |
10 | +breakpoints_relocate (struct objfile *objfile, struct section_offsets *delta) | |
11 | +{ | |
12 | + struct bp_location *bl, **blp_tmp; | |
13 | + int changed = 0; | |
14 | + | |
15 | + gdb_assert (objfile->separate_debug_objfile_backlink == NULL); | |
16 | + | |
17 | + ALL_BP_LOCATIONS (bl, blp_tmp) | |
18 | + { | |
19 | + struct obj_section *osect; | |
20 | + | |
21 | + /* BL->SECTION can be correctly NULL for breakpoints with multiple | |
22 | + locations expanded through symtab. */ | |
23 | + | |
24 | + ALL_OBJFILE_OSECTIONS (objfile, osect) | |
25 | + { | |
26 | + CORE_ADDR relocated_address; | |
27 | + CORE_ADDR delta_offset; | |
28 | + | |
29 | + delta_offset = ANOFFSET (delta, osect->the_bfd_section->index); | |
30 | + if (delta_offset == 0) | |
31 | + continue; | |
32 | + relocated_address = bl->address + delta_offset; | |
33 | + | |
34 | + if (obj_section_addr (osect) <= relocated_address | |
35 | + && relocated_address < obj_section_endaddr (osect)) | |
36 | + { | |
37 | + if (bl->inserted) | |
38 | + remove_breakpoint (bl, mark_uninserted); | |
39 | + | |
40 | + bl->address += delta_offset; | |
41 | + bl->requested_address += delta_offset; | |
42 | + | |
43 | + changed = 1; | |
44 | + } | |
45 | + } | |
46 | + } | |
47 | + | |
48 | + if (changed) | |
49 | + qsort (bp_location, bp_location_count, sizeof (*bp_location), | |
50 | + bp_location_compare); | |
51 | +} | |
52 | + | |
53 | /* Reset a breakpoint given it's struct breakpoint * BINT. | |
54 | The value we return ends up being the return value from catch_errors. | |
55 | Unused in this case. */ | |
6ed6bacf | 56 | Index: gdb-7.2.90.20110411/gdb/breakpoint.h |
51a5ef0f | 57 | =================================================================== |
6ed6bacf AM |
58 | --- gdb-7.2.90.20110411.orig/gdb/breakpoint.h 2011-04-11 19:11:55.000000000 +0200 |
59 | +++ gdb-7.2.90.20110411/gdb/breakpoint.h 2011-04-11 19:17:53.000000000 +0200 | |
60 | @@ -1245,4 +1245,7 @@ extern int user_breakpoint_p (struct bre | |
61 | ||
62 | extern void modify_semaphore (struct bp_location *location, int set); | |
51a5ef0f PS |
63 | |
64 | +extern void breakpoints_relocate (struct objfile *objfile, | |
65 | + struct section_offsets *delta); | |
66 | + | |
67 | #endif /* !defined (BREAKPOINT_H) */ | |
6ed6bacf | 68 | Index: gdb-7.2.90.20110411/gdb/objfiles.c |
51a5ef0f | 69 | =================================================================== |
6ed6bacf AM |
70 | --- gdb-7.2.90.20110411.orig/gdb/objfiles.c 2011-04-11 19:11:55.000000000 +0200 |
71 | +++ gdb-7.2.90.20110411/gdb/objfiles.c 2011-04-11 19:17:53.000000000 +0200 | |
72 | @@ -851,6 +851,11 @@ objfile_relocate1 (struct objfile *objfi | |
73 | objfile->sf->sym_probe_fns->sym_relocate_probe (objfile, | |
74 | new_offsets, delta); | |
51a5ef0f PS |
75 | |
76 | + /* Final call of breakpoint_re_set can keep breakpoint locations disabled if | |
77 | + their addresses match. */ | |
78 | + if (objfile->separate_debug_objfile_backlink == NULL) | |
79 | + breakpoints_relocate (objfile, delta); | |
80 | + | |
81 | /* Data changed. */ | |
82 | return 1; | |
83 | } |