* [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* Re: [RFA] Fix gdbserver crash if using kill in remote connection to windows gdbserver
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
0 siblings, 1 reply; 3+ messages in thread
From: Doug Evans @ 2009-06-23 17:11 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches, Pedro Alves
On Tue, Jun 23, 2009 at 9:18 AM, Pierre Muller<muller@ics.u-strasbg.fr> wrote:
> 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.
I thought gdb used 42000 for targets that don't have pids (e.g.
embedded targets).
It's kinda odd that gdb is using the magic 42000 on a target with pids.
Is that, perchance, the bug that needs fixing here?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] Fix gdbserver crash if using kill in remote connection to windows gdbserver
2009-06-23 17:11 ` Doug Evans
@ 2009-06-23 17:22 ` Pedro Alves
0 siblings, 0 replies; 3+ messages in thread
From: Pedro Alves @ 2009-06-23 17:22 UTC (permalink / raw)
To: Doug Evans; +Cc: Pierre Muller, gdb-patches
On Tuesday 23 June 2009 18:11:21, Doug Evans wrote:
> On Tue, Jun 23, 2009 at 9:18 AM, Pierre Muller<muller@ics.u-strasbg.fr> wrote:
> > 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.
>
> I thought gdb used 42000 for targets that don't have pids (e.g.
> embedded targets).
> It's kinda odd that gdb is using the magic 42000 on a target with pids.
> Is that, perchance, the bug that needs fixing here?
If the target doesn't support multi-process extensions, then
there's no way for GDB to know the remote PID.
I haven't looked at the patch yet, but, if the target isn't
reporting multi-process support (win32 gdbserver isn't now),
then GDB should be using the 'k' packet, and that doesn't
carry the fake 42000. In fact, the magic 42000 should not
appear in *any* packet, IIRC. If GDB is sending the vKill
packet when multi-process is off, that is the bug.
--
Pedro Alves
^ 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