This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] gdbserver with reversed arguments seg. fault
- From: Daniel Jacobowitz <drow at false dot org>
- To: Denis PILAT <denis dot pilat at st dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Wed, 3 Jan 2007 12:58:38 -0500
- Subject: Re: [RFA] gdbserver with reversed arguments seg. fault
- References: <459B778D.4000500@st.com>
On Wed, Jan 03, 2007 at 10:29:49AM +0100, Denis PILAT wrote:
> 2007-01-03 Denis Pilat <denis.pilat@st.com>
>
> * linux-low.c (linux_kill): handle the null case of all_threads.head.
Thanks, I see what happened now. I've committed this version. Please
avoid format=flowed patches in the future - it was pretty mangled.
--
Daniel Jacobowitz
CodeSourcery
2007-01-03 Denis Pilat <denis.pilat@st.com>
Daniel Jacobowitz <dan@codesourcery.com>
* linux-low.c (linux_kill): Handle being called with no threads.
* win32-i386-low.c (win32_kill): Likewise.
(get_child_debug_event): Clear current_process_handle.
Index: linux-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v
retrieving revision 1.48
diff -u -p -r1.48 linux-low.c
--- linux-low.c 16 Nov 2006 15:08:25 -0000 1.48
+++ linux-low.c 3 Jan 2007 17:53:31 -0000
@@ -255,13 +255,17 @@ static void
linux_kill (void)
{
struct thread_info *thread = (struct thread_info *) all_threads.head;
- struct process_info *process = get_thread_process (thread);
+ struct process_info *process;
int wstat;
+ if (thread == NULL)
+ return;
+
for_each_inferior (&all_threads, linux_kill_one_process);
/* See the comment in linux_kill_one_process. We did not kill the first
thread in the list, so do so now. */
+ process = get_thread_process (thread);
do
{
ptrace (PTRACE_KILL, pid_of (process), 0, 0);
Index: win32-i386-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/win32-i386-low.c,v
retrieving revision 1.1
diff -u -p -r1.1 win32-i386-low.c
--- win32-i386-low.c 23 Jul 2006 03:52:15 -0000 1.1
+++ win32-i386-low.c 3 Jan 2007 17:53:31 -0000
@@ -582,6 +582,9 @@ win32_attach (unsigned long pid)
static void
win32_kill (void)
{
+ if (current_process_handle == NULL)
+ return;
+
TerminateProcess (current_process_handle, 0);
for (;;)
{
@@ -901,6 +904,7 @@ in:
ourstatus->kind = TARGET_WAITKIND_EXITED;
ourstatus->value.integer = current_event.u.ExitProcess.dwExitCode;
CloseHandle (current_process_handle);
+ current_process_handle = NULL;
retval = main_thread_id;
break;