[PATCH] D151579: Fix -u option in dsymutil, to not emit an extra DW_LNE_set_address if the original line table was empty

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 29 14:20:36 PDT 2023


avl added inline comments.


================
Comment at: llvm/lib/DWARFLinker/DWARFStreamer.cpp:854-855
 
-  if (LineTable.Rows.empty()) {
+  if (LineTable.Rows.empty() ||
+      (LineTable.Rows.size() == 1 && LineTable.Rows[0].EndSequence)) {
     // We only have the dummy entry, dsymutil emits an entry with a 0
----------------
avl wrote:
> JDevlieghere wrote:
> > Would it make sense to hoist that into the `LineTable` class and have a method `LineTable::empty()` that returns exactly this? 
> In that case LineTable::empty() would in fact not match with real number of LineTable.Rows(). It looks a bit sloppy.
> 
> 
> Another alternative might be implementing what described in DWARFLinker.cpp:
> 
>   // FIXME: this only removes the unneeded end_sequence if the
>   // sequences have been inserted in order. Using a global sort like
>   // described in generateLineTableForUnit() and delaying the end_sequene
>   // elimination to emitLineTableForUnit() we can get rid of all of them.
> 
> Running such cleanup code for no-update and update modes will probably make output equal for both modes.
Or, if it is not a good moment to implementing such cleanup code then do simple version of it in DWARFLinker.cpp:


```
    // Set Line Table Rows.
    if (Linker.Options.Update) {
      LineTable.Rows = LT->Rows; 
      if (LineTable.Rows.size() == 1 && LineTable.Rows[0].EndSequence))
         LineTable.Rows.clear()  
```


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

https://reviews.llvm.org/D151579



More information about the llvm-commits mailing list