[commit/AIX] Fix error when loading core file

Joel Brobecker brobecker@adacore.com
Sun May 20 00:01:00 GMT 2007


Hello,

We noticed the following problem with gdb-6.6 when trying to load
a core file on AIX:

        (gdb) core core
        ptrace ldinfo: No such process.

This is the cause of 2 FAILS in corefile.exp.

I think the problem started when we introduced post_create_inferior.
This causes us to call the SOLIB_CREATE_INFERIOR_HOOK, which in our
case is defined as a call to xcoff_relocate_symtab. I haven't really
checked with older versions of GDB because rebuilding GDB on AIX is
mighty slow, but it very much looks like this function was not called
in the case of core files before. This function is assuming a live process,
not a core file. So what I did was do an early return when debugging
a core file.

What this made me realize, however, is that we should really be
converting the AIX port to using the target_so_ops. I'll try to do
that soon. In the meantime, the attached patch should be good enough.

2007-05-19  Joel Brobecker  <brobecker@adacore.com>

        * rs6000-nat.c (xcoff_relocate_symtab): Do nothing if debugging
        a core file. Add comment in the function description.

Tested on ppc-aix, fixes:

        gdb.base/corefile.exp: args: execfile -core=corefile
        gdb.base/corefile.exp: core-file command

Committed.

-- 
Joel
-------------- next part --------------
Index: rs6000-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-nat.c,v
retrieving revision 1.70
diff -u -p -r1.70 rs6000-nat.c
--- rs6000-nat.c	11 May 2007 19:55:20 -0000	1.70
+++ rs6000-nat.c	18 May 2007 22:17:46 -0000
@@ -1016,7 +1016,9 @@ rs6000_create_inferior (char *exec_file,
 
 
 /* xcoff_relocate_symtab -      hook for symbol table relocation.
-   also reads shared libraries.  */
+   
+   This is only applicable to live processes, and is a no-op when
+   debugging a core file.  */
 
 void
 xcoff_relocate_symtab (unsigned int pid)
@@ -1028,6 +1030,9 @@ xcoff_relocate_symtab (unsigned int pid)
   int ldisize = arch64 ? sizeof (ldi->l64) : sizeof (ldi->l32);
   int size;
 
+  if (ptid_equal (inferior_ptid, null_ptid))
+    return;
+
   do
     {
       size = load_segs * ldisize;


More information about the Gdb-patches mailing list