aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2007-09-17 19:32:53 +0000
committerJoel Brobecker <brobecker@gnat.com>2007-09-17 19:32:53 +0000
commit8d4e36bad1bab0ff367a2f9ab7a131d63e030de0 (patch)
tree13731aa8d6784b75c6b92c75da685041f743a6a3
parentf9ed52beed7a3b98293b1a84d5b96b3a9754014a (diff)
downloadgdb-8d4e36bad1bab0ff367a2f9ab7a131d63e030de0.zip
gdb-8d4e36bad1bab0ff367a2f9ab7a131d63e030de0.tar.gz
gdb-8d4e36bad1bab0ff367a2f9ab7a131d63e030de0.tar.bz2
* solib-svr4.c: Add include of "auxv.h".
(enable_break): Use the AT_BASE auxiliary entry if available. * Makefile.in (solib-svr4.o): Update dependencies.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/Makefile.in2
-rw-r--r--gdb/solib-svr4.c18
3 files changed, 19 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9e662f9..f22d6a8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2007-09-17 Joel Brobecker <brobecker@adacore.com>
+ * solib-svr4.c: Add include of "auxv.h".
+ (enable_break): Use the AT_BASE auxiliary entry if available.
+ * Makefile.in (solib-svr4.o): Update dependencies.
+
+2007-09-17 Joel Brobecker <brobecker@adacore.com>
+
* NEWS: Create a new section for the next release branch.
Rename the section of the current branch, now that it has
been cut.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 65fc5b2..cebfbc9 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2622,7 +2622,7 @@ solib-svr4.o: solib-svr4.c $(defs_h) $(elf_external_h) $(elf_common_h) \
$(elf_mips_h) $(symtab_h) $(bfd_h) $(symfile_h) $(objfiles_h) \
$(gdbcore_h) $(target_h) $(inferior_h) $(gdb_assert_h) \
$(solist_h) $(solib_h) $(solib_svr4_h) $(bfd_target_h) $(elf_bfd_h) \
- $(exec_h)
+ $(exec_h) $(auxv_h)
solib-target.o: solib-target.c $(defs_h) $(objfiles_h) $(solist_h) \
$(symtab_h) $(symfile_h) $(target_h) $(vec_h) $(xml_support_h) \
$(gdb_string_h)
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 0c658ea..702e6f6 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -41,6 +41,7 @@
#include "bfd-target.h"
#include "elf-bfd.h"
#include "exec.h"
+#include "auxv.h"
static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
static int svr4_have_link_map_offsets (void);
@@ -1008,11 +1009,6 @@ enable_break (void)
be trivial on GNU/Linux). Therefore, we have to try an alternate
mechanism to find the dynamic linker's base address. */
- /* TODO drow/2006-09-12: This is somewhat fragile, because it
- relies on read_pc. On both Solaris and GNU/Linux we can use
- the AT_BASE auxilliary entry, which GDB now knows how to
- access, to find the base address. */
-
tmp_fd = solib_open (buf, &tmp_pathname);
if (tmp_fd >= 0)
tmp_bfd = bfd_fopen (tmp_pathname, gnutarget, FOPEN_RB, tmp_fd);
@@ -1048,9 +1044,19 @@ enable_break (void)
so = so->next;
}
+ /* If we were not able to find the base address of the loader
+ from our so_list, then try using the AT_BASE auxilliary entry. */
+ if (!load_addr_found)
+ if (target_auxv_search (&current_target, AT_BASE, &load_addr) > 0)
+ load_addr_found = 1;
+
/* Otherwise we find the dynamic linker's base address by examining
the current pc (which should point at the entry point for the
- dynamic linker) and subtracting the offset of the entry point. */
+ dynamic linker) and subtracting the offset of the entry point.
+
+ This is more fragile than the previous approaches, but is a good
+ fallback method because it has actually been working well in
+ most cases. */
if (!load_addr_found)
{
load_addr = (read_pc ()