[PATCH] Permit DW_OP_GNU_uninit to be used with DW_OP_piece
Tom Tromey
tom@tromey.com
Mon Jun 5 13:17:08 GMT 2023
>>>>> "Kevin" == Kevin Buettner via Gdb-patches <gdb-patches@sourceware.org> writes:
Kevin> The test case in that bug report involved running gdb against the 'jq'
Kevin> program (which is a command-line JSON processor) on Fedora 37. Since
Kevin> the debug info is compiler (and compile-time option) dependent, it
Kevin> won't necessarily show up in other distributions or even past or
Kevin> future versions of Fedora. (E.g. when trying the example shown below
Kevin> on Fedora 38, GDB says that the value of 'value' has been optimized
Kevin> out. I.e. it does not demonstrate the same DWARF error that can be
Kevin> see when using Fedora 37.)
Ages ago, during one of the rewrites of the DWARF expression evaluator,
I found out that DW_OP_GNU_uninit was not really documented. So, I just
made it continue to work the way it had been described in the gdb
sources.
My recollection is that it required a special compiler argument to even
get gcc to emit it. It's still undocumented as far as I can tell.
So I'd suggest perhaps you could get someone to remove it from GCC, or
from the jq build. It's barely used and IMO not really useful.
That said, it's fine by me if you want to keep it around.
Kevin> case DW_OP_GNU_uninit:
Kevin> - if (op_ptr != op_end)
Kevin> + if (op_ptr != op_end && *op_ptr != DW_OP_piece)
Kevin> error (_("DWARF-2 expression error: DW_OP_GNU_uninit must always "
Kevin> "be the very last op."));
If DW_OP_GNU_uninit can end a piece then the error message here should
be updated.
Also did you look at the other spots that understand DWARF expressions?
There are 3 or 4 in gdb.
Aside from this the patch is OK.
Tom
More information about the Gdb-patches
mailing list