This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
gdbserver: Unexpected missing PT_PHDR when running break-interp.exp
- From: Pedro Alves <palves at redhat dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Cc: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Date: Fri, 02 Mar 2012 18:43:28 +0000
- Subject: gdbserver: Unexpected missing PT_PHDR when running break-interp.exp
Hi Jan,
When running break-interp.exp against extended-remote gdbserver, I see several
"gdbserver: Unexpected missing PT_PHDR" warnings in gdb.log, though the
tests all pass.
GDB doesn't issue any warning in the (I think sort of) equivalent code
in solib-svr4.c:read_program_header:
/* PT_PHDR is optional, but we really need it
for PIE to make this work in general. */
if (pt_phdr_p)
{
/* at_phdr is real address in memory. pt_phdr is what pheader says it is.
Relocation offset is the difference between the two. */
sect_addr = sect_addr + (at_phdr - pt_phdr);
}
I'm wondering if the gdbserver warning is really useful? Is is because
something is missing in gdbserver? AT_ENTRY-based relocation perhaps? And/or
can we drop the warning?
2012-03-02 Pedro Alves <palves@redhat.com>
* linux-low.c (get_dynamic): Don't warn when PT_PHDR isn't found.
---
gdb/gdbserver/linux-low.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 7638ca3..02cbb60 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -5243,7 +5243,7 @@ get_dynamic (const int pid, const int is_elf64)
if (relocation == -1)
{
- warning ("Unexpected missing PT_PHDR");
+ /* PT_PHDR is optional, but necessary for PIE in general. */
return 0;
}
Note, you need:
diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
index 1e47b34..272debd 100644
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -429,6 +429,7 @@ proc test_ld {file ifmain trynosym displacement} {
# Test no (error) message has been printed by `exec-file'.
set escapedfile [string_to_regexp $file]
gdb_test "exec-file $file" "exec-file $escapedfile" "load"
+ gdb_test "set remote exec-file $file" ".*" "load (remote)"
if $ifmain {
reach "_dl_debug_state" run $displacement
in order to run the test against gdbserver currently.
--
Pedro Alves