Handle <error reading variable> when printed after a reference.
commit20d049e721ae2e7dd3ccaeec758e492c857407af
authorJohannes Sixt <j6t@kdbg.org>
Sun, 11 Sep 2016 15:35:56 +0000 (11 17:35 +0200)
committerJohannes Sixt <j6t@kdbg.org>
Fri, 16 Sep 2016 22:05:17 +0000 (17 00:05 +0200)
treecf8c103f928cc308b8ec9213e27d1c5f57820a6d
parent496a50ea5b2f6503649ba8f8da25719eb8645e17
Handle <error reading variable> when printed after a reference.

GCC generates a private reference variable for the container used in an
range-for loop. Until the reference is initialized, the reference address
is garbage and produces an error message in the values of the local
variable, for example, when the breakpoint is at the for loop:

__for_range = @0x100400f08: <error reading variable>
__for_begin = 0x7fffffffdb7f
__for_end = 0x400da1 <templS<int>::operator<(int)+43>

The text in angle brackets is treated as part of a multi-token value.
Normally, this would not be a problem (as in the __for_end example above).
But since the variable is marked as a reference, the value parsing is
repeated, but there is no further value to parse, and we run into a parse
error.

Detect the situation and do not parse off the text in angle brackets at
this point, but leave it for the repeated parsing pass.
kdbg/gdbdriver.cpp