[PATCH] D69847: DWARFDebugLoc(v4): Add an incremental parsing function

Sourabh Singh Tomar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 20 02:06:34 PST 2019


SouraVX added a comment.

Hi Pavel, a bug from debug_loc.dwo emission might has gone up here. 
Now please correcting me if I'm wrong.
It's originating from the emission part of debug_loc.dwo.  -- I tried pointing / correcting it in D69462 <https://reviews.llvm.org/D69462>.

Consider the below snippet at the end of emitDebugLocDWO() function
` Asm->emitInt8(dwarf::DW_LLE_end_of_list);` -- now this piece of code is causing to emit `DW_LLE_end_of_list` in a `debug_loc.dwo` which has no notion of this form. amidst it has it's own way of representing end of list.

I corrected this as --

  Asm->OutStreamer->EmitIntValue(0, Size);  -- where Size = Asm->MAI->getCodePointerSize()
  Asm->OutStreamer->EmitIntValue(0, Size);

@dblaikie also did something same  for marking termination of list in function `emitRangeList`  at the very end while emitting in non-split debug_loc section.

Now the undesirable behavior, after correcting this -- Since this patch already add `visitLocationList`  and some sort of verbose printing of `DW_LLE*` for debug_loc.dwo, which I suppose llvm-dwardump is using.
For typical case of location list {loc.dwo} -- with latest master

  llvm-dwarfdump --debug-loc test.dwo
  .debug_loc.dwo contents:
  0x00000000:
              DW_LLE_startx_length   (0x00000000, 0x00000004): DW_OP_reg5 RDI
              DW_LLE_startx_length   (0x00000003, 0x00000014): DW_OP_reg3 RBX
              DW_LLE_end_of_list     ()
  
  0x00000013:
              DW_LLE_startx_length   (0x00000001, 0x00000006): DW_OP_reg5 RDI
              DW_LLE_end_of_list     ()
  
  0x0000001d:
              DW_LLE_startx_length   (0x00000001, 0x0000000b): DW_OP_reg4 RSI
              DW_LLE_end_of_list     ()

Now if, I correct it --

  llvm-dwarfdump --debug-loc test.dwo
  debug_loc.dwo contents:
  0x00000000:
              DW_LLE_startx_length   (0x00000000, 0x00000004): DW_OP_reg5 RDI
              DW_LLE_startx_length   (0x00000003, 0x00000014): DW_OP_reg3 RBX
              DW_LLE_end_of_list     ()
  
  0x00000013:
              DW_LLE_end_of_list     ()
  ..... + a lot of DW_LLE_end_of_list     ()
  
  0x00000022:
              DW_LLE_startx_length   (0x00000001, 0x00000006): DW_OP_reg5 RDI
              DW_LLE_end_of_list     ()
  ..... + a lot of DW_LLE_end_of_list     ()
  
  0x0000003b:
              DW_LLE_startx_length   (0x00000001, 0x0000000b): DW_OP_reg4 RSI
              DW_LLE_end_of_list     ()
  ..... + a lot of DW_LLE_end_of_list     ()

I'm suspecting, the changed representation of termination list might not be appropriately handled{Anyway, you were not aware of this, at that point} here in `DWARFDebugLoc::visitLocationList`.

Why this bothering me ??  I think, I also started out a discussion in D70081 <https://reviews.llvm.org/D70081> that why we are adding this verbosity and stuff to debug_loc.dwo 
you answered.

> You're absolutely right, and I am planning to do that. I already have a patch which does just that -- I just need to clean it up before submission (I'll do that today or tomorrow).

Untill now loc printing is mostly ranges, so we don't worry about form `DW_LLE*`, but I'm suspecting this handling of forms, specially termination of list, you might run into un-necessary trouble.

I think, it's fine if we just dump ranges for pre-dwarf5 stuff.  
Please share your thoughts on this, As @dblaikie  in D69462 <https://reviews.llvm.org/D69462> already asked to put a separate patch for this, which I suspect invites rework  on `DWARFDebugLoc::visitLocationList`.
My Apologies, if this is too big / self explanatory.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69847/new/

https://reviews.llvm.org/D69847





More information about the llvm-commits mailing list