This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] Fix gdbserver crash if using kill in remote connection to windows gdbserver
- From: "Pierre Muller" <muller at ics dot u-strasbg dot fr>
- To: <gdb-patches at sourceware dot org>
- Cc: "'Pedro Alves'" <pedro at codesourcery dot com>
- Date: Tue, 23 Jun 2009 18:18:21 +0200
- Subject: [RFA] Fix gdbserver crash if using kill in remote connection to windows gdbserver
I wanted to test Doug Evans patch for hardware watchpoint support
for i386 gdbserver but ran into a new crash for gdbserver in the testsuite.
GDB uses an internal fake pid (42000) for
remote targets not supporting multi-processes,
but send this fake pid to gdbserver when
kill command is used with remote target.
This made win32-low look for a inferior of
pid 42000, which does not exist and created a crash
in remove_process that was called with a NULL argument.
This fixes win32 target, but there might be other targets
that suffer from the same problem...
Pedro, could you check this?
Is this patch OK?
Pierre Muller
Pascal language support maintainer for GDB
2009-06-23 Pierre Muller <muller@ics.u-strasbg.fr>
* win32-low.c (win32_kill): Use current_process_id
to find process to remove as long as multi_process is zero.
(win32_detach): Idem.
Index: src/gdb/gdbserver/win32-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/win32-low.c,v
retrieving revision 1.36
diff -u -p -r1.36 win32-low.c
--- src/gdb/gdbserver/win32-low.c 22 Jun 2009 19:33:41 -0000 1.36
+++ src/gdb/gdbserver/win32-low.c 23 Jun 2009 16:11:01 -0000
@@ -675,7 +675,12 @@ win32_kill (int pid)
win32_clear_inferiors ();
- process = find_process_pid (pid);
+ /* GDB used a fake pid of 42000 for targets that don't support
multi_process
+ yet. */
+ if (multi_process)
+ process = find_process_pid (pid);
+ else
+ process = find_process_pid (current_process_id);
remove_process (process);
return 0;
}
@@ -711,7 +716,12 @@ win32_detach (int pid)
return -1;
DebugSetProcessKillOnExit (FALSE);
- process = find_process_pid (pid);
+ /* GDB used a fake pid of 42000 for targets that don't support
multi_process
+ yet. */
+ if (multi_process)
+ process = find_process_pid (pid);
+ else
+ process = find_process_pid (current_process_id);
remove_process (process);
win32_clear_inferiors ();