dyung wrote: > > Hi @Michael137, we are seeing a failure in one of our internal tests that I > > bisected back to this change. Consider the following code: > > ```c++ > > struct X > > { > > static const int constant = 1; > > int x; > > > > X() { x = constant; } > > }; > > const int X::constant; > > > > int main() > > { > > X x; > > x.x = X::constant; > > x.x = X::constant; > > x.x = X::constant; > > x.x = X::constant; > > x.x = X::constant; > > return 0; > > } > > ``` > > > > > > > > > > > > > > > > > > > > > > > > Prior to your change, the compiler would generate the following DWARF for > > the constant value: > > ``` > > 0x0000003a: DW_TAG_member > > DW_AT_name ("constant") > > DW_AT_type (0x00000057 "const int") > > DW_AT_decl_file ("/home/dyung/sandbox/test.cpp") > > DW_AT_decl_line (3) > > DW_AT_external (true) > > DW_AT_declaration (true) > > DW_AT_const_value (1) > > ``` > > > > > > > > > > > > > > > > > > > > > > > > After your change, the DW_AT_const_value is gone from this DW_TAG_member > > group, but doesn't appear anywhere else in the DWARF output which seems to > > indicate that it was dropped completely which does not seem to be correct. > > Is this intended or am I missing something? > > Right, we stopped putting the `DW_AT_const_value` on the declaration. Instead > we put either the location or the constant on the definition, depending on > what's available. In your example you define the variable out-of-class which > would generate a `DW_TAG_variable` with a location, so we don't emit the > constant for it on the definition: > > ``` > 0x0000002e: DW_TAG_variable > DW_AT_specification (0x0000004a "constant") > DW_AT_location (DW_OP_addr 0x90) > DW_AT_linkage_name ("_ZN1X8constantE") > ``` > > What's the nature of the failure? Would you instead be able to read the value > out of the definition?
Our test is expecting to find a DW_AT_const_value somewhere in the dwarf output which it no longer seems to generate. From what I gather from your commit message, the compiler should now be emitting a new DW_TAG_variable section that it previously did not with the DW_AT_const_value attached? Or is my understanding incorrect? https://github.com/llvm/llvm-project/pull/71780 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits