This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
GDB hangs when attaching to process on mips-irix
- From: Joel Brobecker <brobecker at adacore dot com>
- To: gdb-patches at sourceware dot org
- Date: Sat, 9 Jan 2010 08:57:53 +0400
- Subject: GDB hangs when attaching to process on mips-irix
Trying to attach GDB to a running process does not work. It shows
that it attached to the process, then read its shared library symbols,
but then hung:
(gdb) att 5866121
Attaching to program `/p...]/foo', process 5866121
[New process 5866121]
Retry #1:
Retry #2:
Retry #3:
Retry #4:
Reading symbols from /[...]/libgnat-6.4.so...done.
Loaded symbols for /[...]/libgnat-6.4.so
Reading symbols from /usr/lib32/libexc.so...done.
Loaded symbols for /usr/lib32/libexc.so
Reading symbols from /[...]/libgcc_s.so.1...done.
Loaded symbols for /[...]/libgcc_s.so.1
Reading symbols from /usr/lib32/libm.so...done.
***HANGS***
The problem is fairly simple: The solib-irix create_inferior_hook
tries to wait until the process reaches the solib breapoint signalling
when the shared libraries have been mapped in memory. However, this
is only needed when spawing a process - in the context of attaching
to a process, the SOs have already been mapped in memory, and thus
GDB hangs, waiting for a breakpoint that will never happen.
The fix is fairly classic: Do nothing in this create_inferior_hook
when attaching...
gdb/ChangeLog:
GDB hangs when attaching to process on mips-irix.
* solib-irix.c (irix_solib_create_inferior_hook): Do nothing if
attaching to a process.
--
Joel
gdb/ChangeLog:
GDB hangs when attaching to process on mips-irix.
* solib-irix.c (irix_solib_create_inferior_hook): Do nothing if
attaching to a process.
---
gdb/solib-irix.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/gdb/solib-irix.c b/gdb/solib-irix.c
index 596f9a0..4c97263 100644
--- a/gdb/solib-irix.c
+++ b/gdb/solib-irix.c
@@ -442,6 +442,13 @@ irix_solib_create_inferior_hook (void)
struct inferior *inf;
struct thread_info *tp;
+ inf = current_inferior ();
+
+ /* If we are attaching to the inferior, the shared libraries
+ have already been mapped, so nothing more to do. */
+ if (inf->attach_flag)
+ return;
+
if (!enable_break ())
{
warning (_("shared library handler failed to enable breakpoint"));
@@ -453,7 +460,6 @@ irix_solib_create_inferior_hook (void)
can go groveling around in the dynamic linker structures to find
out what we need to know about them. */
- inf = current_inferior ();
tp = inferior_thread ();
clear_proceed_status ();
--
1.5.4.3