Skip to contentSkip to conversation

[6195] gdbstub: fix gdbserver_fork

Qemu-devel Edgar E. Iglesias 2 participants 2 messages Jan 7, 2009

lore
Share & tools
lore
#0 lore raw

Revision: 6195

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6195
Author:   edgar_igl
Date:     2009-01-07 10:22:28 +0000 (Wed, 07 Jan 2009)

Log Message:
-----------
gdbstub: fix gdbserver_fork

As reported by Martin Mohring fork doesn't work with NPTL. A fix is attached that makes the also attached test run (tested with ARM CodeSourcery 2008q3 on an x86_64 Fedora Core with kernel 2.6.23).

Modified Paths:
--------------
trunk/gdbstub.c

Modified: trunk/gdbstub.c
===================================================================

gdbstub.c +1 -1
@@ -2225,7 +2225,7 @@
 void gdbserver_fork(CPUState *env)
 {
     GDBState *s = gdbserver_state;
-    if (s->fd < 0)
+    if (gdbserver_fd < 0 || s->fd < 0)
       return;
     close(s->fd);
     s->fd = -1;
#1 lore raw
Quoted 5 lines · Edgar E. Iglesias

Revision: 6195

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6195
Author:   edgar_igl
Date:     2009-01-07 10:22:28 +0000 (Wed, 07 Jan 2009)
Quoted 9 lines

Log Message:
-----------
gdbstub: fix gdbserver_fork

As reported by Martin Mohring fork doesn't work with NPTL. A fix is attached that makes the also attached test run (tested with ARM CodeSourcery 2008q3 on an x86_64 Fedora Core with kernel 2.6.23).

I can confirm that it makes fork() work again, so Debian Etch, Lenny, Sid work on ARM inside a chroot running with QEMU (e.g. by running a shell inside the chroot).

Nevertheless, Aurelien promised me that he or the author will take a look into svn commit 6095, because the case that CONFIG_USER_ONLY is defined and USE_NPTL cause the function gdbserver_fork() to be not defined inside gdbstub.c, thus causing a compilation error. Also, the question is open if gdb works and was tested in user mode with more than one threads at all (on the other hand, the makes sense only if yes).

Martin