From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH 5/9] gdb: remove final user of the executable_changed observer
Date: Sat, 16 Sep 2023 11:18:06 +0100 [thread overview]
Message-ID: <dbde41f349c387e67f3294b06bc4d14fbce9e438.1694858967.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1694858967.git.aburgess@redhat.com>
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.
---
gdb/auxv.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/gdb/auxv.c b/gdb/auxv.c
index 3c27c1f1ffe..9f599b04a4f 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -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");
}
--
2.25.4
next prev parent reply other threads:[~2023-09-16 10:18 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-16 10:18 [PATCH 0/9] Add executable_changed event to Python API Andrew Burgess
2023-09-16 10:18 ` [PATCH 1/9] gdb/doc: extend the description for Progspace.filename Andrew Burgess
2023-09-16 10:53 ` Eli Zaretskii
2023-09-16 10:18 ` [PATCH 2/9] gdb/python: new Progspace.symbol_file attribute Andrew Burgess
2023-09-16 10:56 ` Eli Zaretskii
2023-09-16 10:18 ` [PATCH 3/9] gdb/python: new Progspace.executable_filename attribute Andrew Burgess
2023-09-16 10:55 ` Eli Zaretskii
2023-09-16 10:18 ` [PATCH 4/9] gdb: remove one user of the executable changed observer Andrew Burgess
2023-09-16 10:18 ` Andrew Burgess [this message]
2023-09-16 10:18 ` [PATCH 6/9] gdb: remove unnecessary notification of executable_changed observer Andrew Burgess
2023-09-16 10:18 ` [PATCH 7/9] gdb: pass more arguments to the " Andrew Burgess
2023-09-16 10:18 ` [PATCH 8/9] gdb/python: make the executable_changed event available from Python Andrew Burgess
2023-09-16 11:03 ` Eli Zaretskii
2023-09-28 14:35 ` Andrew Burgess
2023-09-16 10:18 ` [PATCH 9/9] gdb: use reopen_exec_file from reread_symbols Andrew Burgess
2023-09-19 14:08 ` Tom Tromey
2023-09-28 15:23 ` Andrew Burgess
2023-09-28 18:15 ` Tom Tromey
2023-09-29 10:17 ` Andrew Burgess
2023-09-29 15:18 ` Eli Zaretskii
2023-10-02 14:16 ` Tom Tromey
2023-09-29 14:42 ` Eli Zaretskii
2023-10-02 14:02 ` Tom Tromey
2023-10-02 16:19 ` Eli Zaretskii
2023-09-19 14:09 ` [PATCH 0/9] Add executable_changed event to Python API Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dbde41f349c387e67f3294b06bc4d14fbce9e438.1694858967.git.aburgess@redhat.com \
--to=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).