public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Tom Tromey <tromey@redhat.com>
Cc: Keith Seitz <keiths@redhat.com>, archer@sourceware.org
Subject: Re: Stop the Insanity! Linespec Rewrite
Date: Wed, 07 Mar 2012 21:19:00 -0000	[thread overview]
Message-ID: <20120307211919.GZ2867@adacore.com> (raw)
In-Reply-To: <871up4qtv2.fsf@fleche.redhat.com>

On Wed, Mar 07, 2012 at 09:05:37AM -0700, Tom Tromey wrote:
> Joel>     (gdb) break *break_me'address TASK 2
> 
> Joel> It might be something to do with the Ada expression parser?
> 
> I'm a little surprised this works.
> I don't have a theory that would explain why; I though this token should
> be handled in breakpoint.c:find_condition_and_thread, which uses a
> case-sensitive comparison.

This is from code inspection only, so to be taken with a grain of salt.
But I think I see the source of the problem.

In HEAD, when we see a '*', we call decode_indirect:

  if (**argptr == '*')
    {
      do_cleanups (cleanup);
      return decode_indirect (self, argptr);
    }

And decode_indirect more or less returns:

  pc = value_as_address (parse_to_comma_and_eval (argptr));

The important part, here, is that parse_to_comma_and_eval updates
argptr to point to the end of the expression it used, thus leaving
the "TASK 2" part unread, thus allowing find_condition_and_thread
to report the extraneous tokens.

On the other hand, it looks like the lexer is just swallowing everything,
and then passing that to the parser:

    static CORE_ADDR
    linespec_expression_to_pc (char *expr)
    {
      char **expr_ptr = &expr;
      [...]
      return value_as_address (parse_to_comma_and_eval (expr_ptr));
    }

But it doesn't looks like it's not really checking that expr_ptr
after the function is not checking that parse_to_comma_and_eval
is leaving nothing unread from expr...

-- 
Joel

  reply	other threads:[~2012-03-07 21:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-02  1:14 Keith Seitz
2012-03-02 17:00 ` Tom Tromey
2012-03-02 22:41   ` Keith Seitz
2012-03-03  2:36     ` Tom Tromey
2012-03-02 19:07 ` [Archer] " Joel Brobecker
2012-03-02 22:49   ` Keith Seitz
2012-03-06 17:40     ` [Archer] " Joel Brobecker
2012-03-06 19:08       ` Keith Seitz
2012-03-06 19:36         ` Keith Seitz
2012-03-06 21:50           ` [Archer] " Joel Brobecker
2012-03-07  0:11             ` [Archer] " Joel Brobecker
2012-03-07  1:08               ` Keith Seitz
2012-03-07  1:26                 ` [Archer] " Joel Brobecker
2012-03-07 14:39                   ` Tom Tromey
2012-03-07 15:01                     ` Tom Tromey
2012-03-07 15:39                       ` [Archer] " Joel Brobecker
2012-03-07 16:06                         ` Tom Tromey
2012-03-07 21:19                           ` Joel Brobecker [this message]
2012-03-07 21:11                         ` Keith Seitz
2012-03-08  3:02                           ` 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=20120307211919.GZ2867@adacore.com \
    --to=brobecker@adacore.com \
    --cc=archer@sourceware.org \
    --cc=keiths@redhat.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).