From: Keith Seitz <keiths@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: "gdb-patches@sourceware.org ml" <gdb-patches@sourceware.org>
Subject: Re: [RFA 1/2] Linespec rewrite (update 2)
Date: Thu, 29 Mar 2012 19:18:00 -0000 [thread overview]
Message-ID: <4F74B583.6090008@redhat.com> (raw)
In-Reply-To: <87zkb0wj1x.fsf@fleche.redhat.com>
On 03/28/2012 01:46 PM, Tom Tromey wrote:
> This patch is pretty hard to review. I've been reading the branch
> instead, but even there I find it hard to wrap my head around it all.
Yeah, it is pretty massive. I apologize. I simply don't know any other
way to submit this. [I'm all eyes/ears if you would like to see it in
any other form/format.]
> Keith> +const char * const linespec_keywords[] = { "if", "thread", "task" };
>
> Should also be static.
Yup. Fixed.
> Keith> + /* If we're in list mode, and the next token is a string beginning
> Keith> + with ",", we're dealing with a ranged listing. Stop parsing
> Keith> + and return. */
> Keith> + if (PARSER_STATE (parser)->list_mode
> Keith> + && token.type == LSTOKEN_STRING
> Keith> + && *LS_TOKEN_STOKEN (token).ptr == ',')
> Keith> + return;
>
> I thought that historically a top-level comma always terminated a
> linespec -- not just in list mode. It should be possible to write a
> test case for this in Python pretty easily.
I don't know. The whole comma thing is undocumented. The test suite does
contain list ranges. That's how I originally discovered this. I've
removed the list mode restriction, though, and it doesn't affect test
results at all.
One cannot "break 30,31,32" in either branch, so I can see no
differences in functionality.
> Keith> +static void
> Keith> +canonicalize_linespec (struct linespec_state *state, linespec_t ls)
> [...]
> Keith> + if (ls->line_offset.sign != unknown)
> Keith> + {
> Keith> + if (need_colon)
> Keith> + fputc_unfiltered (':', buf);
> Keith> + fprintf_filtered (buf, "%s%d",
> Keith> + (ls->line_offset.sign == none ? ""
> Keith> + : ls->line_offset.sign == plus ? "+" : "-"),
> Keith> + ls->line_offset.offset);
>
> I am curious when this code can trigger.
> Can we end up with a canonical form like "function:+5"?
> I was hoping to reserve that syntax for a later addition; and anyway in
> general I think relative linespecs need to be made absolute by the
> canonicalization process, since otherwise re-setting won't do the right
> thing.
Yes, we can end up with a canonical form like "function:+5" or
"file:+5". The former is permitted (per recent maintainer request)
because we currently ignore the offset. [It is unprocessed in
convert_linespec_to_sals.] I'm not a fan of this,
FYI CVS HEAD creates canonical linespecs like "file:+5" today, without
converting to absolute offset. It also rejects "function:+5".
I haven't done anything with this. AFAICT, the linespecs are identical
in both CVS HEAD and the branch. [Or would be if either CVS HEAD ignored
function-relative offsets or we issued an error again in my branch.]
What would you like me to do?
> Keith> + /* We have an expression. No other attribute is allowed. */
>
> It would be helpful if the constraints on the fields of 'struct
> linespec' were documented there.
I'll add something. The reason this is here because this is no inherent
limitation on expressions (or other members of struct linespec). We
could permit file:*foo, if we wanted to, but we simply don't.
> Keith> + pspace = elem->minsym->ginfo.obj_section->objfile->pspace;
>
> Should use SYMBOL_OBJ_SECTION. I didn't audit for other instances.
Fixed. It was the only offender.
> Keith> + else if (ls->minimal_symbols != NULL)
> Keith> + {
> Keith> + /* We found minimal symbols, but no normal symbols. */
> Keith> + int i;
> Keith> + minsym_and_objfile_d *elem;
> Keith> +
> Keith> + for (i = 0;
> Keith> + VEC_iterate (minsym_and_objfile_d, ls->minimal_symbols, i, elem);
> Keith> + ++i)
> Keith> + minsym_found (state, elem->objfile, elem->minsym,&sals);
>
> Why are minsyms sorted by pspace in one branch but not another?
No real good reason, other than that is the way it is done today. I
tried to keep the codepaths as similar as possible. I've merged the two
branches together. No need for minsyms to be singled out like this.
> Keith> +++ b/gdb/testsuite/gdb.cp/cplabel.exp
> [...]
> Keith> +if {[prepare_for_testing "$testfile.exp" $testfile $srcfile]} {
> Keith> + return -1
>
> I suspect this needs a skip_cplus_tests check.
Indeed. It was also missing the c++ and debug flags for
prepare_for_testing, which I've also added.
I've pushed the requested changes to my archer branch.
Thank you for the feedback.
Keith
next prev parent reply other threads:[~2012-03-29 19:18 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-26 23:18 Keith Seitz
2012-03-27 1:45 ` asmwarrior
2012-03-28 18:55 ` Tom Tromey
2012-03-27 13:56 ` Joel Brobecker
2012-03-27 14:31 ` Keith Seitz
2012-03-27 14:54 ` Joel Brobecker
2012-03-27 15:05 ` Joel Brobecker
2012-03-27 18:08 ` Keith Seitz
2012-03-28 20:46 ` Tom Tromey
2012-03-29 19:18 ` Keith Seitz [this message]
2012-03-30 15:34 ` Tom Tromey
2012-03-30 15:59 ` Keith Seitz
2012-03-30 16:37 ` Tom Tromey
2012-03-30 17:09 ` Joel Brobecker
2012-03-30 17:56 ` Tom Tromey
2012-03-30 18:05 ` Keith Seitz
2012-04-03 23:22 ` Keith Seitz
2012-04-05 15:22 ` Tom Tromey
2012-04-05 15:55 ` Doug Evans
2012-04-05 19:01 ` Keith Seitz
2012-07-22 19:33 ` Andreas Schwab
2012-07-23 17:57 ` Keith Seitz
2012-07-23 18:55 ` Tom Tromey
2012-07-23 21:13 ` Keith Seitz
2012-04-03 21:19 ` Doug Evans
2012-04-03 23:14 ` Keith Seitz
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=4F74B583.6090008@redhat.com \
--to=keiths@redhat.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