On 03/06/15 18:30, Jeff Law wrote:
It's common to have something like the struct hack where the length of
the array is stored in the struct.  Then when scripting gdb one can
write:

     print s.array[0] @ s.length
Which is case that I've had use for a non-constant  RHS as well.  I just
haven't had to use it all that much.

To implement that case, you still do not need the compiler to parse @, you just need the compiler to parse s.array[0] and s.length independently. It should be possible to arrange the inferior code in such a way that GCC parses each side of @ independently and gives the info necessary to GDB such that it can interpret what @ means or give a reasonable error.

I discussed this at length here: 
https://gcc.gnu.org/ml/gcc/2015-03/msg00187.html

At https://gcc.gnu.org/ml/gcc/2015-03/msg00183.html I propose other alternatives, which in principle are more work to implement, but move GCC in the direction of being able to parse snippets of code. In my opinion this is moving backwards: making GCC less flexible and adding very special cases that are likely to conflict with other things.

Parsing correctly arbitrary programs that may contain @ at arbitrary places seems a can full of gigantic were-worms.

Cheers,

Manuel.

Reply via email to