[PATCH] D157036: Emit a .debug_str_offsets section with dsymutil to support DW_FORM_strx in dsymutil.

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 15:15:19 PDT 2023


avl added a comment.

> Added a test to specifically check for strx and str_offsets_base, similar to dwarf5-addr_base.test. One thing to note, right now, when using --update, the strx1's get converted to strxs, I don't know if we want to change that.

I think that is OK. We already have the similar situation for update DWARFv4. DW_FORM_string is replaced with DW_FORM_strp.



================
Comment at: llvm/include/llvm/DWARFLinker/DWARFLinker.h:117
+  /// Emit the debug string offset table described by \p StringOffsets into the
+  /// .debug_string_offset table.
+  virtual void emitStringOffsets(const SmallVector<uint64_t> &StringOffsets,
----------------



================
Comment at: llvm/lib/DWARFLinker/DWARFLinker.cpp:2024
 
+static void patchStrOffsetsBase(DIE &Die, DIEInteger Offset) {
+  for (auto &V : Die.values())
----------------
It looks patchStrOffsetsBase is not removed still.


================
Comment at: llvm/lib/DWARFLinker/DWARFStreamer.cpp:268
+    return;
+
+  Asm->OutStreamer->switchSection(MOFI->getDwarfStrOffSection());
----------------
should not we check here for empty StringOffsets and return?


```
if (StringOffsets.empty())
  return;
```


================
Comment at: llvm/test/tools/dsymutil/ARM/dwarf5-addr_base.test:49
 RUN: rm -rf %t.dir && mkdir -p %t.dir
-RUN: dsymutil -y %p/dummy-debug-map-amr64.map -oso-prepend-path=%p/../Inputs/DWARF5-addr_base -o %t.dir/dwarf5-addr_base.dSYM
+RUN: dsymutil -y %p/dummy-debug-map-amr64.map -oso-prepend-path=%p/../Inputs/DWARF5-addr_base-str_off_base -o %t.dir/dwarf5-addr_base.dSYM
 RUN: llvm-dwarfdump %t.dir/dwarf5-addr_base.dSYM -a --verbose | FileCheck %s
----------------
Oh, excuse me, I did not notice it earlier : please, do not use underscore in file names. It is really inconvenient if underscores mixed up with hyphens. Other file names use hyphens. Please rename all of this:


```
Inputs/DWARF5-addr_base-str_off_base -> Inputs/DWARF5-addr-base-str-off-base 
Inputs/DWARF5-addr_base/ -> Inputs/DWARF5-addr-base/
dwarf5-addr_base.dSYM -> dwarf5-addr-base.dSYM
dwarf5-str_offsets_base-strx.test -> dwarf5-str-offsets-base-strx.test
dwarf5-addr_base.test -> dwarf5-addr-base.test
```



================
Comment at: llvm/test/tools/dsymutil/ARM/dwarf5-dwarf4-combination-macho.test:66
+CHECK: DW_AT_LLVM_sysroot [DW_FORM_strp] ( .debug_str[0x00000039] = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
+CHECK: DW_AT_APPLE_sdk [DW_FORM_strp]    ( .debug_str[0x00000098] = "MacOSX.sdk")
+CHECK: DW_AT_comp_dir [DW_FORM_strp]     ( .debug_str[0x000000a3] = "/Users/shubham/Development/test109275485")
----------------
probably:

CHECK-NOT: DW_AT_str_offsets_base 


================
Comment at: llvm/test/tools/dsymutil/ARM/dwarf5-str_offsets_base-strx.test:1
+; This test checks to ensure that if three DWARFv5 object files have correct values for the DW_AT_addr_base in their compile units.
+
----------------



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

https://reviews.llvm.org/D157036



More information about the llvm-commits mailing list