Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Marc Khouzam <marc.khouzam@ericsson.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Tom Tromey <tromey@redhat.com>,
	       "'gdb-patches@sourceware.org'"
	<gdb-patches@sourceware.org>
Subject: RE: [MI] Duplicate --thread-group flag not detected
Date: Sun, 05 Dec 2010 19:27:00 -0000	[thread overview]
Message-ID: <F7CE05678329534C957159168FA70DEC572E0C0DDE@EUSAACMS0703.eamcs.ericsson.se> (raw)
In-Reply-To: <20101204184638.GB3031@adacore.com>

> > > 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 know
> > 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.
> 
> Yes, please go ahead.
> 
> Too bad for the testcase, as this means that we can potentially re-introduce
> 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 better
> 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, --all, --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 sure 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  <marc.khouzam@ericsson.com>

	* mi/mi-parse.c (mi_parse): Missing else.
        

2010-12-05  Marc Khouzam  <marc.khouzam@ericsson.com>

	* gdb.mi/mi-general.exp: New file.

### Eclipse Workspace Patch 1.0
#P src
Index: gdb/mi/mi-parse.c
===================================================================
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 += 1;
          parse->thread_group = strtol (chp, &chp, 10);
        }
-      if (strncmp (chp, "--thread ", ts) == 0)
+      else if (strncmp (chp, "--thread ", ts) == 0)
        {
          if (parse->thread != -1)
            error (_("Duplicate '--thread' option"));
Index: gdb/testsuite/gdb.mi/mi-general.exp
===================================================================
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 <http://www.gnu.org/licenses/>.
+
+#
+# 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=mi"
+
+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}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
+     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 parsed properly    
+    mi_gdb_test "18-break-insert --thread-group i1 bogus" \
+             "18\\^error,msg=\"Function \\\\\"bogus\\\\\" not defined.\"" \
+             "Valid --thread-group flag"
+
+# This test fails because of improper MI error output 
+#    mi_gdb_test "21-break-insert --thread-group iX main" \
+#             "21\\^error,msg=\"Invalid thread group for the --thread-group option\""
+#             "Invalid --thread-group flag"
+
+# This test fails because of improper MI error output 
+#    mi_gdb_test "36-break-insert --thread-group i1 --thread-group i2 main" \
+#             "36\\^error,msg=\"Duplicate '--thread-group' option\n\"" \
+#             "Duplicate --thread-group flag"
+}
+
+
+test_thread_group_flag
+
+mi_gdb_exit
+return 0


  reply	other threads:[~2010-12-05 19:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25 20:56 Marc Khouzam
2010-11-26 16:39 ` Joel Brobecker
2010-12-02 16:40   ` Tom Tromey
2010-12-02 17:10     ` Joel Brobecker
2010-12-04 18:10       ` Marc Khouzam
2010-12-04 18:47         ` Joel Brobecker
2010-12-05 19:27           ` Marc Khouzam [this message]
2010-12-06 11:04             ` Joel Brobecker
2010-12-06 14:26               ` Marc Khouzam
2010-12-06 15:02               ` [MI] --thread-group test (was: RE: [MI] Duplicate --thread-group flag not detected) Marc Khouzam
2010-12-10 12:15                 ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F7CE05678329534C957159168FA70DEC572E0C0DDE@EUSAACMS0703.eamcs.ericsson.se \
    --to=marc.khouzam@ericsson.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox