diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 13 | ||||
-rw-r--r-- | gdb/objfiles.c | 37 | ||||
-rw-r--r-- | gdb/objfiles.h | 2 | ||||
-rw-r--r-- | gdb/symfile.c | 4 |
4 files changed, 30 insertions, 26 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f63fab7..a741045 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +2009-07-22 Paul Pluzhnikov <ppluzhnikov@google.com> + + * objfiles.h (objfiles_changed): New prototype. + * objfiles.c (objfiles_updated_p): Rename to objfiles_changed_p. + (allocate_objfile, free_objfile): Must rebuild section map. + (objfile_relocate): Likewise. + (update_section_map, find_pc_section): Adjust. + (set_objfiles_updated_on_exe_change): Remove. + (set_objfiles_updated_on_solib_activity): Remove. + (_initialize_objfiles): Remove. + (objfiles_changed): New function. + * symfile.c (reread_symbols): Call objfiles_changed. + 2009-07-22 Hui Zhu <teawater@gmail.com> * record.c (record_xfer_partial): Call error When nquery diff --git a/gdb/objfiles.c b/gdb/objfiles.c index ab5f0ea..4662e1b 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -68,7 +68,7 @@ struct objfile *rt_common_objfile; /* For runtime common symbols */ /* Records whether any objfiles appeared or disappeared since we last updated address to obj section map. */ -static int objfiles_updated_p; +static int objfiles_changed_p; /* Locate all mappable sections of a BFD file. objfile_p_char is a char * to get it through @@ -235,6 +235,8 @@ allocate_objfile (bfd *abfd, int flags) /* Save passed in flag bits. */ objfile->flags |= flags; + objfiles_changed_p = 1; /* Rebuild section map next time we need it. */ + return (objfile); } @@ -501,6 +503,7 @@ free_objfile (struct objfile *objfile) obstack_free (&objfile->objfile_obstack, 0); xfree (objfile); objfile = NULL; + objfiles_changed_p = 1; /* Rebuild section map next time we need it. */ } static void @@ -682,6 +685,7 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets) /* Relocate breakpoints as necessary, after things are relocated. */ breakpoint_re_set (); + objfiles_changed_p = 1; /* Rebuild section map next time we need it. */ } /* Many places in gdb want to test just to see if we have any partial @@ -798,7 +802,7 @@ update_section_map (struct obj_section ***pmap, int *pmap_size) struct obj_section *s, **map; struct objfile *objfile; - gdb_assert (objfiles_updated_p != 0); + gdb_assert (objfiles_changed_p != 0); map = *pmap; xfree (map); @@ -857,13 +861,13 @@ find_pc_section (CORE_ADDR pc) if (s) return s; - if (objfiles_updated_p != 0) + if (objfiles_changed_p != 0) { update_section_map (§ions, &num_sections); /* Don't need updates to section map until objfiles are added or removed. */ - objfiles_updated_p = 0; + objfiles_changed_p = 0; } sp = (struct obj_section **) bsearch (&pc, sections, num_sections, @@ -989,28 +993,11 @@ objfile_data (struct objfile *objfile, const struct objfile_data *data) return objfile->data[data->index]; } -/* Set objfiles_updated_p so section map will be rebuilt next time it - is used. Called by executable_changed observer. */ - -static void -set_objfiles_updated_on_exe_change (void) -{ - objfiles_updated_p = 1; /* Rebuild section map next time we need it. */ -} - -/* Set objfiles_updated_p so section map will be rebuilt next time it - is used. Called by solib_loaded/unloaded observer. */ - -static void -set_objfiles_updated_on_solib_activity (struct so_list *so_list) -{ - objfiles_updated_p = 1; /* Rebuild section map next time we need it. */ -} +/* Set objfiles_changed_p so section map will be rebuilt next time it + is used. Called by reread_symbols. */ void -_initialize_objfiles (void) +objfiles_changed (void) { - observer_attach_executable_changed (set_objfiles_updated_on_exe_change); - observer_attach_solib_loaded (set_objfiles_updated_on_solib_activity); - observer_attach_solib_unloaded (set_objfiles_updated_on_solib_activity); + objfiles_changed_p = 1; /* Rebuild section map next time we need it. */ } diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 60d3143..1857260 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -482,6 +482,8 @@ extern int have_partial_symbols (void); extern int have_full_symbols (void); +extern void objfiles_changed (void); + /* This operation deletes all objfile entries that represent solibs that weren't explicitly loaded by the user, via e.g., the add-symbol-file command. diff --git a/gdb/symfile.c b/gdb/symfile.c index 4dd9c1c..bbdb3ca 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2457,8 +2457,10 @@ reread_symbols (void) /* At least one objfile has changed, so we can consider that the executable we're debugging has changed too. */ observer_notify_executable_changed (); + + /* Notify objfiles that we've modified objfile sections. */ + objfiles_changed (); } - } |