[PATCH] D85018: [WIP][POC][DebugInfo] Support for DW_AT_start_scope for scoped variables

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 5 10:50:58 PDT 2020


dblaikie added a comment.

In D85018#2195562 <https://reviews.llvm.org/D85018#2195562>, @djtodoro wrote:

> The `DW_AT_start_scope` might be interesting when calculating location coverage stats (and I guess that is what @dblaikie has thought) with `llvm-dwarfdump --statistics` or `llvm-locstats` (these create the location coverage buckets).

Right. More follow-up/after this work than anything.

In D85018#2196802 <https://reviews.llvm.org/D85018#2196802>, @SouraVX wrote:

> Sorry for the confusion/churn. This is the resultant DWARF(for the variable of interest)  for this test case.
>
>   0x0000007a:       DW_TAG_variable
>                       **DW_AT_location      (0x00000000:
>                          [0x0000000000401178, 0x00000000004011c1): DW_OP_breg6 RBP-24)** // This is what causing increased in location list(even at "-O0 -g")
>                       DW_AT_name  ("Local")
>                       DW_AT_decl_file     ("/Scope.c")
>                       DW_AT_decl_line     (7)
>                       DW_AT_type  (0x0000008f "int")
>                       DW_AT_start_scope   (0x00000017)

How does the start scope compare to the location range of the variable, and the scope range of the enclosing scope?

In any case - this seems a bit backwards - one of the benefits of start_scope is that we should be able to use singular variable locations in more places because the scope will already be appropriately truncated by the start_scope value.

Also, general question: Why are you implementing this feature? Do you have a debugger that can/will consume this? I hesitate to add features (especially ones with a lot of surface area/additional complexity) that don't have a consumer/customer use case readily available.

Also - the spec describes start_scope as being able to contain a range list - for cases where the scope of the variable name is discontiguous. This seems relevant/useful/necessary as well (& would further help reduce the need for location lists on variables if the variable is live for its actual scope - though overall I've more concerns about the scope_start feature creating more expensive IR and DWARF than saving us anything, just that maybe the costs can be mitigated somewhat) & if the feature is important, maybe should be implemented more generally to handle discontiguous scopes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85018



More information about the llvm-commits mailing list