From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9765 invoked by alias); 3 Jan 2007 17:58:47 -0000 Received: (qmail 9756 invoked by uid 22791); 3 Jan 2007 17:58:47 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Wed, 03 Jan 2007 17:58:41 +0000 Received: from drow by nevyn.them.org with local (Exim 4.63) (envelope-from ) id 1H2ANq-0004m8-CR; Wed, 03 Jan 2007 12:58:38 -0500 Date: Wed, 03 Jan 2007 17:58:00 -0000 From: Daniel Jacobowitz To: Denis PILAT Cc: gdb-patches Subject: Re: [RFA] gdbserver with reversed arguments seg. fault Message-ID: <20070103175838.GA17935@nevyn.them.org> Mail-Followup-To: Denis PILAT , gdb-patches References: <459B778D.4000500@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <459B778D.4000500@st.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-01/txt/msg00067.txt.bz2 On Wed, Jan 03, 2007 at 10:29:49AM +0100, Denis PILAT wrote: > 2007-01-03 Denis Pilat > > * 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 Daniel Jacobowitz * 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;