Re: Support for "break *ADDRESS thread THREADNO"

Maciej W. Rozycki
2005-04-13T10:36:39Z

On Tue, 12 Apr 2005, Daniel Jacobowitz wrote:

> > Why was it done like this? because "*ADDRESS" is interpreted as an
> > expression in the current language, or is there some other reason?
>
> I assume so. It is parsed as an expression, not just an address; for
> instance "break *thread" would actually work if thread is a pointer to
> a function.

I think the actual problem is the expression parser cannot be told to
stop successfully on an unparseable token as long as the expression
collected so far is valid and let the caller deal with that. AFAICS the
parser can only stop on a string terminator or optionally a comma,
otherwise it issues an error.

> There's already common code for this, that's where most of the 'thread
> THREADNO' support is. I think it's in linespec.c somewhere, but it
> might be in breakpoint.c. It seems to need a little extra help from
> the language... we need to know that a 'thread NUMBER' suffix is not
> part of the expression.

It's in break_command_1() actually, so that's breakpoint.c.

> TBH, the mechanism is fragile; I can't think of a more robust way but
> there must be one. Right now if and thread are handled similarly. But
> if separates two expressions, whereas thread can only be followed by a
> thread number. Perhaps that can be used to simplify.

The current syntax is good enough to be unambiguous -- it's just it's not
parsed correctly. But if you find it inadequate, I won't insist on
keeping it.

Maciej