This is the mail archive of the mailing list for the Archer project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Stop the Insanity! Linespec Rewrite

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...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]