[PATCH] D123534: [dwarf] Emit a DIGlobalVariable for constant strings.

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 20 10:54:09 PDT 2022


dblaikie added a comment.

In D123534#3454749 <https://reviews.llvm.org/D123534#3454749>, @hctim wrote:

> In D123534#3454354 <https://reviews.llvm.org/D123534#3454354>, @dblaikie wrote:
>
>> This seems like it would significantly introduce debug info size for at least some kinds of code - have you done any size measurements of this change?
>
> With `-DCMAKE_BUILD_TYPE=RelWithDebInfo -DLLVM_ENABLE_ASSERTIONS=On`:
>
> - Before the patch: `clang` was 1247264656 bytes
> - After the patch: `clang` was 1270191696 bytes (or, a 1.84% increase)

That does seem a bit unfortunate/enough to be worth more examination.

>> What does the resulting DWARF look like?
>
> Each string DI ends up looking like a regular global variable (i.e. a `DW_TAG_variable` entry in `.debug_info`):
>
>   $ llvm-dwarfdump --debug-info
>   0x00000032:   DW_TAG_variable
>                   DW_AT_name      (".str")
>                   DW_AT_type      (0x0000003e ".str")
>                   DW_AT_decl_file ("/tmp/file.c")
>                   DW_AT_decl_line (3)
>                   DW_AT_location  (DW_OP_addrx 0x1)
>                   DW_AT_linkage_name      (".str")
>
> (and obviously an entry in the `.debug_addr` referenced by the `DW_AT_location` at index `0x1`)

What's the DW_AT_type referring to? (why is there a type called ".str"?)

For your particular purposes, it seems like the name/type/linkage name could all be omitted & that might be OK, since these entities aren't actually named in the source?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123534



More information about the cfe-commits mailing list