phyBrackets wrote:
> I'd be curious of the use-case. LLDB seems to be able to read the contents of
> the static just fine (even at `-O3`):
>
> ```
> struct Test {
> static inline constexpr char TEST[] = "Test String";
> };
>
> int main() {
> __builtin_printf("%s", Test::TEST);
> __builtin_debugtrap();
> }
> ```
>
> ```
> warning: a.out was compiled with optimization - stepping may behave oddly;
> variables may not be available.
> (lldb) v Test::TEST
> (const char[12]) Test::TEST = "Test String"
> ```
@Michael137 Thanks for taking a look! lldb can read the value when the variable
still exists in memory, but I think `DW_AT_const_value` helps in cases where
it doesn't for eg if the variable is never odr used, the linker can discard it
entirely, and there would be no memory location to read, and remote debugging
where reading target memory is expensive or unavailable.
And GCC already emits this, so there's a compatibility argument, but if others
think the dwarf size cost isn't worth it for this cases, then i am happy to
discus this further
https://github.com/llvm/llvm-project/pull/182442
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits