From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25142 invoked by alias); 3 Jan 2007 09:30:07 -0000 Received: (qmail 25070 invoked by uid 22791); 3 Jan 2007 09:30:06 -0000 X-Spam-Check-By: sourceware.org Received: from lon-del-04.spheriq.net (HELO lon-del-04.spheriq.net) (195.46.50.101) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 03 Jan 2007 09:29:58 +0000 Received: from lon-out-02.spheriq.net ([195.46.50.130]) by lon-del-04.spheriq.net with ESMTP id l039Ts3B020454 for ; Wed, 3 Jan 2007 09:29:54 GMT Received: from lon-cus-01.spheriq.net (lon-cus-01.spheriq.net [195.46.50.37]) by lon-out-02.spheriq.net with ESMTP id l039TrMF028095 for ; Wed, 3 Jan 2007 09:29:53 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by lon-cus-01.spheriq.net with ESMTP id l039Toex017175 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Wed, 3 Jan 2007 09:29:53 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 36557DA43 for ; Wed, 3 Jan 2007 09:29:50 +0000 (GMT) Received: from mail1.cro.st.com (mail1.cro.st.com [164.129.40.131]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 066F447354 for ; Wed, 3 Jan 2007 09:29:49 +0000 (GMT) Received: from [164.129.44.95] (crx595.cro.st.com [164.129.44.95]) by mail1.cro.st.com (MOS 3.5.8-GR) with ESMTP id CJI27436 (AUTH "denis pilat"); Wed, 3 Jan 2007 10:29:49 +0100 (CET) Message-ID: <459B778D.4000500@st.com> Date: Wed, 03 Jan 2007 09:30:00 -0000 From: Denis PILAT User-Agent: Thunderbird 1.5.0.9 (X11/20061206) MIME-Version: 1.0 To: gdb-patches Subject: [RFA] gdbserver with reversed arguments seg. fault Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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/msg00060.txt.bz2 Hi, Following our discussion in the thread http://sources.redhat.com/ml/gdb-patches/2007-01/msg00059.html I'm proposing the attached patch to fix a segmentation fault that occurs into gdbserver when you revert the binary filename with the "host:port" argument. In inferiors.c the inferior_target_data() function is called with a NULL pointer argument. At the beginning I though of testing arguments but none of them are tested in this whole file so I concluded it's up to the caller to do so. (I hope this time my patch is related to a version nearer from the HEAD :) Denis -- 2007-01-03 Denis Pilat * linux-low.c (linux_kill): handle the null case of all_threads.head. Index: linux-low.c =================================================================== --- linux-low.c (revision 545) +++ linux-low.c (working copy) @@ -255,9 +255,13 @@ 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) + return; + + process = get_thread_process (thread); for_each_inferior (&all_threads, linux_kill_one_process); /* See the comment in linux_kill_one_process. We did not kill the first