diff options
author | Andrew Burgess <aburgess@redhat.com> | 2023-09-08 15:48:16 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2023-09-28 15:33:13 +0100 |
commit | a2827364e2bf19910fa5a54364a594a5ba3033b8 (patch) | |
tree | 90d20c791423c353ef4a9922c21c9ac698805f3e /gdb/auxv.c | |
parent | a0a031bce0527b1521788b5dad640e7883b3a252 (diff) | |
download | gdb-a2827364e2bf19910fa5a54364a594a5ba3033b8.zip gdb-a2827364e2bf19910fa5a54364a594a5ba3033b8.tar.gz gdb-a2827364e2bf19910fa5a54364a594a5ba3033b8.tar.bz2 |
gdb: remove final user of the executable_changed observer
This commit continues with the task started in the previous commit,
and is similar in many ways.
The goal of the next couple of commits is to expose the
executable_changed observable in the Python API as an event. Before I
do this I would like to remove the additional call to the
executable_changed observable which can be found in the reread_symbols
function in the symfile.c file, as I don't believe that this use
actually corresponds to a change in the current executable.
The previous commit removed one user of the executable_changed
observable and replaced it with a new_obfile observer instead, and
this commit does the same thing.
In auxv.c we use the executable_changed observable to call
invalidate_auxv_cache, which then calls:
invalidate_auxv_cache_inf (current_inferior ());
The auxv cache is already (additionally) cleared when an inferior
exits and when an inferior appears.
As with the previous commit, I think we can safely replace the use of
the executable_changed observable with a use of the new_obfile
observable. All the tests still pass, and with some locally placed
printf calls, I think that the cache is still being cleared in all the
cases that should matter.
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/auxv.c')
-rw-r--r-- | gdb/auxv.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -344,12 +344,14 @@ invalidate_auxv_cache_inf (struct inferior *inf) auxv_inferior_data.clear (inf); } -/* Invalidate current inferior's auxv cache. */ +/* Invalidate current inferior's auxv cache when all symbol table data is + cleared (indicated by OBJFILE being nullptr). */ static void -invalidate_auxv_cache (void) +auxv_new_objfile_observer (struct objfile *objfile) { - invalidate_auxv_cache_inf (current_inferior ()); + if (objfile == nullptr) + invalidate_auxv_cache_inf (current_inferior ()); } /* See auxv.h. */ @@ -613,5 +615,5 @@ This is information provided by the operating system at program startup.")); /* Observers used to invalidate the auxv cache when needed. */ gdb::observers::inferior_exit.attach (invalidate_auxv_cache_inf, "auxv"); gdb::observers::inferior_appeared.attach (invalidate_auxv_cache_inf, "auxv"); - gdb::observers::executable_changed.attach (invalidate_auxv_cache, "auxv"); + gdb::observers::new_objfile.attach (auxv_new_objfile_observer, "auxv"); } |