public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Update auxv cache when there is no auxv cached data
@ 2022-07-19 14:45 Luis Machado
  2022-07-25  9:42 ` [PING][PATCH] " Luis Machado
                   ` (3 more replies)
  0 siblings, 4 replies; 29+ messages in thread
From: Luis Machado @ 2022-07-19 14:45 UTC (permalink / raw)
  To: gdb-patches

While adding support for MTE corefiles and running the MTE corefile tests,
I noticed a strange situation where loading the symbol file + core file
through the command line has a different behavior compared to firing up
GDB, loading the symbol file with the "file" command and then loading the
core file with the "core" command.

I tracked this down to gdb/auxv.c:get_auxv_inferior_data returning a valid
info struct, but with no auxv data.

We've been doing the auxv caching for a while now, but sometime between
enabling auxv data caching and now, we turned the auxv data into an optional
value.

My guess is that these two modes of opening a symbol file + core file take
slightly different paths in GDB, and in the latter case where we issue
separate "file" and "core" commands, we first cache empty auxv data (no core
file data yet) and later we just return that empty data as if it were valid.

The following patch checks for an empty info->data field, and forces a re-fetch
of auxv data if that is the case.

With this patch, I see full passes for the gdb.arch/aarch64-mte-core testcase.
---
 gdb/auxv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/auxv.c b/gdb/auxv.c
index 8e175138f5d..0d6a860e5f4 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -361,7 +361,7 @@ get_auxv_inferior_data (struct target_ops *ops)
   struct inferior *inf = current_inferior ();
 
   info = auxv_inferior_data.get (inf);
-  if (info == NULL)
+  if (info == NULL || !info->data.has_value ())
     {
       info = auxv_inferior_data.emplace (inf);
       info->data = target_read_alloc (ops, TARGET_OBJECT_AUXV, NULL);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2022-10-12  1:11 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-19 14:45 [PATCH] Update auxv cache when there is no auxv cached data Luis Machado
2022-07-25  9:42 ` [PING][PATCH] " Luis Machado
2022-07-25 16:05 ` [PATCH] " John Baldwin
2022-07-25 18:03   ` Luis Machado
2022-07-25 19:13     ` John Baldwin
2022-08-02 15:05       ` Luis Machado
2022-08-02 16:05         ` John Baldwin
2022-08-05 15:46 ` [PATCH] Update auxv cache when inferior pid is 0 (no inferior) Luis Machado
2022-08-11  9:05   ` [PING][PATCH] " Luis Machado
2022-08-18 15:48   ` Luis Machado
2022-09-01  9:29   ` Luis Machado
2022-09-07  8:20   ` Luis Machado
2022-09-12 12:48   ` Luis Machado
2022-09-12 13:30   ` [PATCH] " Simon Marchi
2022-09-12 13:53     ` John Baldwin
2022-09-12 13:59       ` Luis Machado
2022-09-20 12:28 ` [PATCH] Invalidate auxv cache before creating a core target Luis Machado
2022-09-20 17:49   ` John Baldwin
2022-10-07 20:44   ` [PATCH] gdb: fix auxv caching Simon Marchi
2022-10-07 21:43     ` John Baldwin
2022-10-09  0:39       ` Simon Marchi
2022-10-10 18:32         ` John Baldwin
2022-10-11 17:52           ` Simon Marchi
2022-10-11 20:31         ` Pedro Alves
2022-10-11 20:34           ` Pedro Alves
2022-10-11 20:42             ` John Baldwin
2022-10-12  1:11               ` Simon Marchi
2022-10-10  9:33     ` Luis Machado
2022-10-11 17:53       ` Simon Marchi

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).