This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH]: Fixes PR gdb/794.
- From: Josh Martin <Josh dot Martin at abq dot sc dot philips dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 9 Oct 2002 19:27:18 -0600 (MDT)
- Subject: [PATCH]: Fixes PR gdb/794.
- Reply-to: Josh Martin <Josh dot Martin at abq dot sc dot philips dot com>
This problem is also reported in PR gdb/794.
I encountered a problem while trying to debug a PA64 (hppa64elf) executable
(src/temacs, a file generated during the building of emacs-21.2) in gdb-5.2.1.
While loading the libraries listed in the .dynamic section, gdb (pa64solib.c
(pa64_solib_add) would choke on "empty" entries (entries where all the members
of the dll_desc structure were set to 0). The dld normally ignores/skips these
entries, but gdb was trying to parse them, generating a "pa64_solib_add, unable
to read shared library path." error. So I patched the function to ignore
entries where the text base and size, and the data base and size were all 0. I
also fixed a typo in one of the nearby comments. Unfortunately, I cannot get
expect to work on my system, so I was not able to generate a test case for this
bug. What follows is the ChangeLog entry and the 'diff -up' patch for
gdb/pa64solib.c
- Josh Martin
---------------------------------------
2002-10-09 Josh Martin <timeslice@iname.com>
* pa64solib.c (pa64_solib_add): Changed to ignore empty
library entries, just like dld does. Fixed typo in comment.
Fixes PR gdb/794.
---------------------------------------
--- pa64solib.c.old Wed Oct 9 18:27:53 2002
+++ pa64solib.c Wed Oct 9 18:32:46 2002
@@ -422,7 +422,7 @@ pa64_solib_add (char *arg_string, int fr
if ((dld_cache.dld_flags & DT_HP_DEBUG_PRIVATE) == 0)
warning ("The shared libraries were not privately mapped; setting
a\nbreakpoint in a shared library will not work until you rerun the
program.\n");
- /* For each shaerd library, add it to the shared library list. */
+ /* For each shared library, add it to the shared library list. */
for (dll_index = 1; ; dll_index++)
{
/* Read in the load module descriptor. */
@@ -430,6 +430,12 @@ pa64_solib_add (char *arg_string, int fr
pa64_target_read_memory, 0, dld_cache.load_map)
== 0)
return;
+
+ /* Skip/ignore "empty" entries. I'm not sure why these entries
+ are here, but the dld ignores them, so we should too. */
+ if ((dll_desc.text_base == 0) && (dll_desc.text_size == 0) &&
+ (dll_desc.data_base == 0) && (dll_desc.data_size == 0))
+ continue;
/* Get the name of the shared library. */
dll_path = (char *)dlgetname (&dll_desc, sizeof (dll_desc),