Re: Complex DWARF expressions

Jan Kratochvil
2014-09-22T18:44:46Z

On Mon, 22 Sep 2014 20:21:14 +0200, Eli Zaretskii wrote:
> Why can't GDB apply all this, and show a value for a given PC?

There is some reason why GDB could not determine it, this is very normal
situation. It would be really great if GDB could always display all values
for -O2 -g code but that can never be possible (without reducing runtime code
peformance and size).
To find out why use: (gdb) set debug entry-values 1

For example the call site may not have matching DW_AT_GNU_call_site_value
because the value is just no longer computable at the caller frame from any
data at that point of execution. Entry values improved the number of cases
where the value is retrievable but it is still far from 100% retrievability.
One needs to use -O0 -g to get the values in 100% of cases. Debug info never
degrades inferior runtime code performance or size to get better debug info.

Besides that there may be GDB bug. And there is also at least one GCC bug:
entry-value: Missing DW_AT_linkage_name for C<->C++ calls
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56502

Jan