Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Fix gdbserver crash if using kill in remote connection to windows gdbserver
@ 2009-06-23 16:18 Pierre Muller
  2009-06-23 17:11 ` Doug Evans
  0 siblings, 1 reply; 3+ messages in thread
From: Pierre Muller @ 2009-06-23 16:18 UTC (permalink / raw)
  To: gdb-patches; +Cc: 'Pedro Alves'

  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 ();


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-23 17:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-23 16:18 [RFA] Fix gdbserver crash if using kill in remote connection to windows gdbserver Pierre Muller
2009-06-23 17:11 ` Doug Evans
2009-06-23 17:22   ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox