From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: Simon Marchi <simon.marchi@ericsson.com>,
gdb-patches@sourceware.org, tom@tromey.com
Subject: Re: [PATCH] Fix -list-thread-groups --available logic and add test
Date: Wed, 04 Oct 2017 14:42:00 -0000 [thread overview]
Message-ID: <7b48234b-1a7d-b4b4-2de0-2514d70cc59c@redhat.com> (raw)
In-Reply-To: <4b4d69ff72cd6840be87168174cb7181@polymtl.ca>
On 10/04/2017 03:32 PM, Simon Marchi wrote:
> On 2017-10-04 10:14, Pedro Alves wrote:
>> On 10/04/2017 03:00 PM, Simon Marchi wrote:
>>
>>> +# List a specific process.
>>> +set spawn_id [remote_spawn target $binfile]
>>> +set pid [spawn_id_get_pid $spawn_id]
>>> +mi_gdb_test \
>>> + "-list-thread-groups --available i${pid}" \
>>> + "\\^done,groups=\\\[{id=\"${pid}\",type=\"process\",.*}\\\]" \
>>> + "list available thread groups with filter"
>>
>> Won't that ".*" above end up matching more than one process, if
>> GDB's filtering ends up a bit borked? Can we be sure that
>> only one process comes out?
>
> I tried designing it like that but found it was pretty difficult because
> of the description field:
>
> 55
> ^done,groups=[{id="499",type="process",description="/home/emaisin/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/list-thread-groups-available/list-thread-groups-available",user="emaisin",cores=["1"]}]^M
>
>
> If we have something like this:
>
> groups=[{id="$decimal",type="process",description=".*",...}]
Instead of .*, how about matching "all but unquoted/terminating
double-quote" ?
See http://wiki.tcl.tk/989 for example (Match a "quoted string").
(Maybe there's an easier way to write that regex, haven't
really thought about it.)
>
> and there are two process entries, the .* in the description field could
> match from the beginning of the first description field to the end of
> the second description field. So we wouldn't catch that there are two
> processes instead of one. And we can't really restrict its content,
> because it could potentially include [,}"].
>
> Do you have any idea on how to do this with a regex? The only "real"
> solution I see is to have a proper MI parser that parses MI to a tcl
> data structure, and assert that the list of groups is of length 1.
A "real" parser would consume the "..." description string as a single
string by looking for an unescaped terminating double-quote. :-)
Thanks,
Pedro Alves
next prev parent reply other threads:[~2017-10-04 14:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-04 14:01 Simon Marchi
2017-10-04 14:14 ` Pedro Alves
2017-10-04 14:32 ` Simon Marchi
2017-10-04 14:42 ` Pedro Alves [this message]
2017-10-04 16:01 ` Simon Marchi
2017-10-04 16:13 ` Pedro Alves
2017-10-04 16:31 ` [PATCH v3] " Simon Marchi
2017-10-04 16:38 ` Pedro Alves
2017-10-04 16:45 ` Simon Marchi
2017-10-04 16:31 ` [PATCH] " Simon Marchi
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=7b48234b-1a7d-b4b4-2de0-2514d70cc59c@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@ericsson.com \
--cc=simon.marchi@polymtl.ca \
--cc=tom@tromey.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