[PATCH] DW_OP_const* is invalid as a location

Katya Romanova Katya_Romanova at playstation.sony.com
Mon Dec 8 14:37:46 PST 2014


================
Comment at: lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1721
@@ -1720,2 +1720,3 @@
       Streamer.EmitSLEB128(Value.getInt());
+      Streamer.EmitInt8(dwarf::DW_OP_stack_value, "DW_OP_stack_value");
     } else {
----------------
dblaikie wrote:
> dblaikie wrote:
> > Should this just go outside the if/else, so it's written once rather than twice?
> Do we need to conditionalize this based on whether we're emitting DWARF >= 4? And just leave it the old/broken way in DWARF < 4 for old consumers to keep guessing the way they have before (like LLDB)?
Reasonable :)

================
Comment at: lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1721
@@ -1720,2 +1720,3 @@
       Streamer.EmitSLEB128(Value.getInt());
+      Streamer.EmitInt8(dwarf::DW_OP_stack_value, "DW_OP_stack_value");
     } else {
----------------
kromanova wrote:
> dblaikie wrote:
> > dblaikie wrote:
> > > Should this just go outside the if/else, so it's written once rather than twice?
> > Do we need to conditionalize this based on whether we're emitting DWARF >= 4? And just leave it the old/broken way in DWARF < 4 for old consumers to keep guessing the way they have before (like LLDB)?
> Reasonable :)
Good point. I will add the condition. When I submit a bug against the LLDB, I will make a note that "old/broken" expressions will still be generated for < DWARF 4.

================
Comment at: test/DebugInfo/incorrect-variable-debugloc1.ll:14
@@ +13,3 @@
+; 
+; int main()
+; {
----------------
dblaikie wrote:
> Can this example be simplified further? (do we need the loop, etc?)
I will simplify the test as much as I can. 
BTW, thank you David for reviewing the patch so quickly!

================
Comment at: test/DebugInfo/incorrect-variable-debugloc1.ll:14
@@ +13,3 @@
+; 
+; int main()
+; {
----------------
kromanova wrote:
> dblaikie wrote:
> > Can this example be simplified further? (do we need the loop, etc?)
> I will simplify the test as much as I can. 
> BTW, thank you David for reviewing the patch so quickly!
Is there an elegant solution to test different Dwarf versions (Dwarf-2, Dwarf-3 and Dwarf-4) using .ll file, while avoiding creation of multiple copies of the same test with only one line difference in metadata representing Dwarf Version. 

!12 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}  // needed for dwarf-4 test
!12 = metadata !{i32 2, metadata !"Dwarf Version", i32 2}  // needed for dwarf-2 test

Or should I create a .cpp test instead of .ll test to avoid duplication of the test?

http://reviews.llvm.org/D6568






More information about the llvm-commits mailing list