[patch/tru64] Do not wait for SO SIGTRAP after attaching

Joel Brobecker brobecker@adacore.com
Tue May 27 19:00:00 GMT 2008


Hello,

I wouldn't mind some feedback on this one...

I noticed on Tru64 that the debugger hangs when trying to attach
to a process.  I tracked the issue down to the debugger waiting
for a SIGTRAP in the "create_inferior_hook" portion of the target_so_ops
vector.  The reason for the wait is explained in the comment:

  /* Now run the target.  It will eventually get a SIGTRAP, at
     which point all of the libraries will have been mapped in and we
     can go groveling around in the rld structures to find
     out what we need to know about them. */

This is N/A in our case (attaching), since the loader has already
mapped our shared libraries by the time we attach to our process,
and so we never get the SO SIGTRAP.

I fixed this by checking that we're not attaching to a process before
continuing.  I *think* that the code that's currently inside
osf_solib_create_inferior_hook is in the right place. So the check
seems necessary and legitimate.

2008-05-24  Joel Brobecker  <brobecker@adacore.com>

        * solib-osf.c (osf_solib_create_inferior_hook): Do nothing if
        we're attaching to a running process.

Tested on alpha-tru64 with the AdaCore testsuite. Will commit in a week
if no objection or comment.

-- 
Joel
-------------- next part --------------
Modified: solib-osf.c
===================================================================
--- solib-osf.c	2008-05-25 02:12:58 UTC
+++ solib-osf.c	2008-05-25 05:20:11 UTC
@@ -306,6 +306,11 @@
 static void
 osf_solib_create_inferior_hook (void)
 {
+  /* If we are attaching to the inferior, the shared libraries
+     have already been mapped, so nothing more to do.  */
+  if (attach_flag)
+    return;
+
   /* Nothing to do for statically bound executables.  */
 
   if (symfile_objfile == NULL


More information about the Gdb-patches mailing list