* [PATCH] Trust DT_DEBUG in AUXV better than in ELF
@ 2024-11-09 14:05 Lluís Batlle i Rossell
0 siblings, 0 replies; only message in thread
From: Lluís Batlle i Rossell @ 2024-11-09 14:05 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 162 bytes --]
This patch helped me debug core-dumps generated from executing
a post-processed ELF.
I don't know if changing the DT_DEBUG check order (AUXV, ELF) harms
anyone.
[-- Attachment #2: 0001-Trust-DT_DEBUG-in-AUXV-better-than-in-ELF.patch --]
[-- Type: text/plain, Size: 1194 bytes --]
From 382e0285e8f8b42a9e72c5267f726cf574b2d299 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= <viric@viric.name>
Date: Sat, 9 Nov 2024 15:01:53 +0100
Subject: [PATCH] Trust DT_DEBUG in AUXV better than in ELF
In cases of core dump, sometimes the ELF can be recreated and we should
rather trust what is in the core dump than the ELF.
---
gdb/solib-svr4.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 8378ecaff40..8f4450323a5 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -742,10 +742,11 @@ elf_locate_base (void)
return extract_typed_address (pbuf, ptr_type);
}
- /* Find DT_DEBUG. */
- if (gdb_bfd_scan_elf_dyntag (DT_DEBUG, current_program_space->exec_bfd (),
- &dyn_ptr, NULL)
- || scan_dyntag_auxv (DT_DEBUG, &dyn_ptr, NULL))
+ /* Find DT_DEBUG.
+ Trust better the DT_DEBUG in AUXV */
+ if (scan_dyntag_auxv (DT_DEBUG, &dyn_ptr, NULL) ||
+ gdb_bfd_scan_elf_dyntag (DT_DEBUG, current_program_space->exec_bfd (),
+ &dyn_ptr, NULL))
return dyn_ptr;
/* This may be a static executable. Look for the symbol
--
2.44.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-11-09 14:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-09 14:05 [PATCH] Trust DT_DEBUG in AUXV better than in ELF Lluís Batlle i Rossell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox