From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15072 invoked by alias); 5 Aug 2010 14:47:56 -0000 Received: (qmail 15059 invoked by uid 22791); 5 Aug 2010 14:47:55 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 05 Aug 2010 14:47:50 +0000 Received: (qmail 11157 invoked from network); 5 Aug 2010 14:47:48 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 5 Aug 2010 14:47:48 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [MI] Fix segfault for -remove-inferior Date: Thu, 05 Aug 2010 14:47:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.31-11-rt; KDE/4.4.2; x86_64; ; ) Cc: Marc Khouzam References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201008051547.46328.pedro@codesourcery.com> 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: 2010-08/txt/msg00034.txt.bz2 On Wednesday 04 August 2010 20:56:45, Marc Khouzam wrote: > Hi, Hi Marc, > I started to play around with MI multi-exec and got a segfault. > Below is the session showing the problem and the patch to fix it. Thanks. > I think this should go into the 7.2 branch. Agreed. > (I did not have time to run the test suite) You can run the testsuite in parallel make mode nowadays. E.g., on my laptop, "make check -j4" only takes around 5 minutes. You can also run only the MI tests with: make check RUNTESTFLAGS="--directory=gdb.mi" although, I don't think there's any test covering these MI commands. :-/ > OK? Looks obviously correct to me. -- Pedro Alves > GNU gdb (GDB) 7.2.50.20100727-cvs > Copyright (C) 2010 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later > This is free software: you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. Type "show copying" > and "show warranty" for details. > This GDB was configured as "i686-pc-linux-gnu". > For bug reporting instructions, please see: > . > (gdb) interpreter-exec mi "-remove-inferior i1" > Segmentation fault > > > 2010-08-04 Marc Khouzam > > * mi/mi-main.c (mi_cmd_remove_inferior): Properly access first argument. > > > ### Eclipse Workspace Patch 1.0 > #P src > Index: gdb/mi/mi-main.c > =================================================================== > RCS file: /cvs/src/src/gdb/mi/mi-main.c,v > retrieving revision 1.178 > diff -u -r1.178 mi-main.c > --- gdb/mi/mi-main.c 11 Jun 2010 15:36:07 -0000 1.178 > +++ gdb/mi/mi-main.c 4 Aug 2010 19:40:19 -0000 > @@ -1609,7 +1609,7 @@ > if (argc != 1) > error ("-remove-inferior should be passed a single argument"); > > - if (sscanf (argv[1], "i%d", &id) != 1) > + if (sscanf (argv[0], "i%d", &id) != 1) > error ("the thread group id is syntactically invalid"); > > inf = find_inferior_id (id); >