This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [MI] Duplicate --thread-group flag not detected
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Marc Khouzam <marc dot khouzam at ericsson dot com>
- Cc: "'gdb-patches at sourceware dot org'" <gdb-patches at sourceware dot org>
- Date: Fri, 26 Nov 2010 08:38:42 -0800
- Subject: Re: [MI] Duplicate --thread-group flag not detected
- References: <F7CE05678329534C957159168FA70DEC572E7598F3@EUSAACMS0703.eamcs.ericsson.se>
> 2010-11-25 Marc Khouzam <marc.khouzam@ericsson.com>
>
> * mi/mi-parse.c (mi_parse): Missing else.
Normally, the man to approve this is Vladimir, so I can't approve, but
I had a quick look anyway.
I think that the patch above is correct, given the current implementation.
Another very bad scenario:
<mi-command> --thread-group i1 --all --frame 1 --thread 1
I think that all the options after --thread-group will be ignored.
Speaking of the current implementation:
The whole parsing loop looked very odd at first, but I think I'm starting
to understand how it works, now. I think it does work right now because
there is only 1 option that takes no argument ("--all"). So the code
'swallows' it first if found, and then checks for the other possible
switches. It apparently tries to avoid error-handling duplication by
putting it at the end of the looping block, but then that leads to:
if (*chp != '\0' && !isspace (*chp))
error (_("Invalid value for the '%s' option"),
start[2] == 't' ? "--thread" : "--frame");
... which is missing one case: --thread-group. As the number of options
being handled grows (for instance, I have in my TODO an entry for adding
support for "--task"), I think that we're going to have to rewrite this
slightly differently to make it easier to read and extend...
Another remark: It looks like the use of the --all/--thread-group/--thread
options with the -mi-break command is not documented? I could only see
them documented with commands such as -exec-continue....
Last comment: A small test would be nice...
--
Joel