From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9698 invoked by alias); 5 Dec 2010 19:27:35 -0000 Received: (qmail 9682 invoked by uid 22791); 5 Dec 2010 19:27:33 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from imr4.ericy.com (HELO imr4.ericy.com) (198.24.6.8) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 05 Dec 2010 19:27:27 +0000 Received: from eusaamw0707.eamcs.ericsson.se ([147.117.20.32]) by imr4.ericy.com (8.14.3/8.14.3/Debian-9.1ubuntu1) with ESMTP id oB5JtuYR027541; Sun, 5 Dec 2010 13:55:57 -0600 Received: from EUSAACMS0703.eamcs.ericsson.se ([169.254.1.63]) by eusaamw0707.eamcs.ericsson.se ([147.117.20.32]) with mapi; Sun, 5 Dec 2010 14:20:44 -0500 From: Marc Khouzam To: Joel Brobecker CC: Tom Tromey , "'gdb-patches@sourceware.org'" Date: Sun, 05 Dec 2010 19:27:00 -0000 Subject: RE: [MI] Duplicate --thread-group flag not detected Message-ID: References: <20101126163842.GJ2634@adacore.com> <20101202170954.GA3031@adacore.com> ,<20101204184638.GB3031@adacore.com> In-Reply-To: <20101204184638.GB3031@adacore.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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-12/txt/msg00037.txt.bz2 > > > Agreed. I am also OK for the 7.2 branch, even if it's not exactly > > > a critical bug. > > > > So, I can commit to both branches? Even without the new test? > > I apologize, but I just don't have time to write new tests, because I k= now > > that if I start, I'll make sure every case is tested, and that will take > > more time than I have for a bug that is not really that important. >=20 > Yes, please go ahead. >=20 > Too bad for the testcase, as this means that we can potentially re-introd= uce > the bug later on. One thing I had to learn early in my career was to not = let > best be the enemy of good. One test is better than none, so if you can't > cover all cases but have enough time to cover one, then one is always bet= ter > than none. You make it hard to say no :-) So here's my attempt at new tests for these cases. I wasn't sure where to = put it so I created a new mi-general.exp test which should eventually test the = parsing of general MI syntax, including the --thread-group, --thread, --frame, --al= l, --reverse, flags. The problem is that there is another bug that makes the new tests fail, so = I had to temporarily comment them out: http://sourceware.org/ml/gdb-patches/2010-11/msg00436.html Once this second bug fix is approved, I'll un-comment the tests and make su= re they pass. So, I'm re-submitting this patch for approval, so that you guys can comment= on the tests. Thanks Marc 2010-12-05 Marc Khouzam * mi/mi-parse.c (mi_parse): Missing else. =20=20=20=20=20=20=20=20 2010-12-05 Marc Khouzam * gdb.mi/mi-general.exp: New file. ### Eclipse Workspace Patch 1.0 #P src Index: gdb/mi/mi-parse.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/mi/mi-parse.c,v retrieving revision 1.21 diff -u -r1.21 mi-parse.c --- gdb/mi/mi-parse.c 17 May 2010 20:49:39 -0000 1.21 +++ gdb/mi/mi-parse.c 5 Dec 2010 19:07:26 -0000 @@ -319,7 +319,7 @@ chp +=3D 1; parse->thread_group =3D strtol (chp, &chp, 10); } - if (strncmp (chp, "--thread ", ts) =3D=3D 0) + else if (strncmp (chp, "--thread ", ts) =3D=3D 0) { if (parse->thread !=3D -1) error (_("Duplicate '--thread' option")); Index: gdb/testsuite/gdb.mi/mi-general.exp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: gdb/testsuite/gdb.mi/mi-general.exp diff -N gdb/testsuite/gdb.mi/mi-general.exp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/testsuite/gdb.mi/mi-general.exp 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,67 @@ +# Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# +# test general features of Machine interface (MI) operations +# +# Verify that, the special MI flags --thread-group, --thread, --frame, +# --all, --reverse, are parsed properly. +# The goal is not to test gdb functionality, which is done by other tests, +# but the command syntax and correct output response to MI operations. +# + +load_lib mi-support.exp +set MIFLAGS "-i=3Dmi" + +gdb_exit +if [mi_gdb_start separate-inferior-tty] { + continue +} + +set testfile "basics" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/mi-basics + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executabl= e {debug additional_flags=3D-DFAKEARGV}] !=3D "" } { + untested mi-general.exp + return -1 +} + +mi_run_to_main + +proc test_thread_group_flag {} { + + # If we get to the breakpoint error, it means the -thread-group was pa= rsed properly=20=20=20=20 + mi_gdb_test "18-break-insert --thread-group i1 bogus" \ + "18\\^error,msg=3D\"Function \\\\\"bogus\\\\\" not defined.\"= " \ + "Valid --thread-group flag" + +# This test fails because of improper MI error output=20 +# mi_gdb_test "21-break-insert --thread-group iX main" \ +# "21\\^error,msg=3D\"Invalid thread group for the --thread-gr= oup option\"" +# "Invalid --thread-group flag" + +# This test fails because of improper MI error output=20 +# mi_gdb_test "36-break-insert --thread-group i1 --thread-group i2 main= " \ +# "36\\^error,msg=3D\"Duplicate '--thread-group' option\n\"" \ +# "Duplicate --thread-group flag" +} + + +test_thread_group_flag + +mi_gdb_exit +return 0