public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [Bug default/28594] New: Consider removing 0 length entries from variable and formal parameter location lists
@ 2021-11-15  3:19 wcohen at redhat dot com
  0 siblings, 0 replies; only message in thread
From: wcohen at redhat dot com @ 2021-11-15  3:19 UTC (permalink / raw)
  To: dwz

https://sourceware.org/bugzilla/show_bug.cgi?id=28594

            Bug ID: 28594
           Summary: Consider removing 0 length entries from variable and
                    formal parameter location lists
           Product: dwz
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: default
          Assignee: nobody at sourceware dot org
          Reporter: wcohen at redhat dot com
                CC: dwz at sourceware dot org
  Target Milestone: ---

When reviewing the kernel debuginfo of the Fedora Linux kernel I found that
there were a number of places where gcc generated locations lists that had
entries that are 0 length.  There is a upstream gcc bug
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103241) that shows an example of
this occurring.  There are a number of places in the kernel with 0 length
entries that are not going to match anything due to the 0-length and the
entries are just taking up space.  As an alternative to fixing gcc upstream dwz
could also remove these 0-length entries. To get an idea of the number of times
this occurred a dwgrep (https://pmachata.github.io/dwgrep/) was written to
print out each occurrence 0-length location list entries for regular and
inlined functions:


[wcohen@haro perf]$  dwgrep
/usr/lib/debug/lib/modules/5.14.15-200.fc34.x86_64/vmlinux -e '
let A := entry (?TAG_subprogram || ?TAG_inlined_subroutine) (?AT_ranges ||
?AT_low_pc);
let FSTART := (A ?AT_ranges @AT_ranges low) || ( A low);
let PARM := A child (?TAG_formal_parameter || ?TAG_variable);
(PARM ?AT_location @AT_location address length==0) ([A name, FSTART, PARM
name])' | grep \\[ |wc
  93105  279315 4386700

One function in the kernel that has 0-length entries is static_protections. 
Took a look at it with:

llvm-dwarfdump -c --name="static_protection"
/usr/lib/debug/lib/modules/5.14.15-200.fc34.x86_64/vmlinux | more

See the following for static_protections where first entry for "prot" parameter
is 0 length and overlaps the next entry:

0x00e44d5c:   DW_TAG_formal_parameter
                DW_AT_abstract_origin   (0x00e3fb6d "prot")
                DW_AT_location  (0x002c83db: 
                   [0xffffffff8107a540, 0xffffffff8107a540): DW_OP_reg5 RDI
                   [0xffffffff8107a540, 0xffffffff8107a569): DW_OP_reg5 RDI,
DW_OP_piece 0x8
                   [0xffffffff8107a5a0, 0xffffffff8107a5f3): DW_OP_reg5 RDI
                   [0xffffffff8107a617, 0xffffffff8107a65b): DW_OP_reg3 RBX
                   [0xffffffff8107a66a, 0xffffffff8107a67e): DW_OP_reg3 RBX,
DW_OP_piece 0x8
                   [0xffffffff8107a67e, 0xffffffff8107a68c): DW_OP_reg5 RDI
                   [0xffffffff8107a68c, 0xffffffff8107a6a1): DW_OP_reg3 RBX,
DW_OP_piece 0x8
                   [0xffffffff8107a6a1, 0xffffffff8107a6a1): DW_OP_reg3 RBX,
DW_OP_piece 0x8
                   [0xffffffff8107a6a1, 0xffffffff8107a6cb): DW_OP_reg3 RBX
                   [0xffffffff8107a6cb, 0xffffffff8107a6cb): DW_OP_reg3 RBX,
DW_OP_piece 0x8
                   [0xffffffff81bc6967, 0xffffffff81bc6994): DW_OP_reg3 RBX,
DW_OP_piece 0x8
                   [0xffffffff81bc69b5, 0xffffffff81bc6a24): DW_OP_reg3 RBX,
DW_OP_piece 0x8)
                DW_AT_unknown_2137      (0x002c83c3)

0x00e44d69:   DW_TAG_formal_parameter
                DW_AT_abstract_origin   (0x00e3fb7a "start")
                DW_AT_location  (0x002c84ed: 
                   [0xffffffff8107a540, 0xffffffff8107a5a0): DW_OP_reg4 RSI
                   [0xffffffff8107a5a0, 0xffffffff8107a65b): DW_OP_reg12 R12
                   [0xffffffff8107a65b, 0xffffffff8107a66a):
DW_OP_GNU_entry_value(DW_OP_reg4 RSI), DW_OP_s
tack_value
                   [0xffffffff8107a66a, 0xffffffff8107a68c): DW_OP_reg4 RSI
                   [0xffffffff8107a68c, 0xffffffff8107a6cb): DW_OP_reg12 R12
                   [0xffffffff8107a6cb, 0xffffffff8107a6cb): DW_OP_reg4 RSI
                   [0xffffffff81bc6967, 0xffffffff81bc698c): DW_OP_reg4 RSI
                   [0xffffffff81bc698c, 0xffffffff81bc6a24): DW_OP_reg12 R12)
                DW_AT_unknown_2137      (0x002c84dd)

0x00e44d76:   DW_TAG_formal_parameter
                DW_AT_abstract_origin   (0x00e3fb87 "pfn")
                DW_AT_location  (0x002c85a8: 
                   [0xffffffff8107a540, 0xffffffff8107a5a0): DW_OP_reg1 RDX
                   [0xffffffff8107a5a0, 0xffffffff8107a65b): DW_OP_reg15 R15
                   [0xffffffff8107a65b, 0xffffffff8107a66a):
DW_OP_GNU_entry_value(DW_OP_reg1 RDX), DW_OP_s
tack_value
                   [0xffffffff8107a66a, 0xffffffff8107a68c): DW_OP_reg1 RDX
                   [0xffffffff8107a68c, 0xffffffff8107a6cb): DW_OP_reg15 R15
                   [0xffffffff8107a6cb, 0xffffffff8107a6cb): DW_OP_reg1 RDX
                   [0xffffffff81bc6967, 0xffffffff81bc6983): DW_OP_reg1 RDX
                   [0xffffffff81bc6983, 0xffffffff81bc6a24): DW_OP_reg15 R15)
                DW_AT_unknown_2137      (0x002c8598)

0x00e44d83:   DW_TAG_formal_parameter
                DW_AT_abstract_origin   (0x00e3fb94 "npg")
                DW_AT_location  (0x002c8663: 
                   [0xffffffff8107a540, 0xffffffff8107a5a0): DW_OP_reg2 RCX
                   [0xffffffff8107a5a0, 0xffffffff8107a65b): DW_OP_reg13 R13
                   [0xffffffff8107a65b, 0xffffffff8107a66a):
DW_OP_GNU_entry_value(DW_OP_reg2 RCX), DW_OP_s
tack_value
                   [0xffffffff8107a66a, 0xffffffff8107a68c): DW_OP_reg2 RCX
                   [0xffffffff8107a68c, 0xffffffff8107a6cb): DW_OP_reg13 R13
                   [0xffffffff8107a6cb, 0xffffffff8107a6cb): DW_OP_reg2 RCX
                   [0xffffffff81bc6967, 0xffffffff81bc6977): DW_OP_reg2 RCX
                   [0xffffffff81bc6977, 0xffffffff81bc6a24): DW_OP_reg13 R13)
                DW_AT_unknown_2137      (0x002c8653)

0x00e44d90:   DW_TAG_formal_parameter
                DW_AT_abstract_origin   (0x00e3fba1 "lpsize")
                DW_AT_location  (0x002c8718: 
                   [0xffffffff8107a540, 0xffffffff8107a585): DW_OP_reg8 R8
                   [0xffffffff8107a585, 0xffffffff8107a65b): DW_OP_reg14 R14
                   [0xffffffff8107a65b, 0xffffffff8107a66a):
DW_OP_GNU_entry_value(DW_OP_reg8 R8), DW_OP_st
ack_value
                   [0xffffffff8107a66a, 0xffffffff8107a6cb): DW_OP_reg14 R14
                   [0xffffffff81bc6967, 0xffffffff81bc6a24): DW_OP_reg14 R14)
                DW_AT_unknown_2137      (0x002c870e)

0x00e44d9d:   DW_TAG_formal_parameter
                DW_AT_abstract_origin   (0x00e3fbae "warnlvl")
                DW_AT_location  (0x002c8798: 
                   [0xffffffff8107a540, 0xffffffff8107a5a0): DW_OP_reg9 R9
                   [0xffffffff8107a5a0, 0xffffffff8107a66a): DW_OP_fbreg -72
                   [0xffffffff8107a66a, 0xffffffff8107a68c): DW_OP_reg9 R9
                   [0xffffffff8107a68c, 0xffffffff8107a6cb): DW_OP_fbreg -72
                   [0xffffffff8107a6cb, 0xffffffff8107a6cb): DW_OP_reg9 R9
                   [0xffffffff81bc6967, 0xffffffff81bc6974): DW_OP_reg9 R9
                   [0xffffffff81bc6974, 0xffffffff81bc6a24): DW_OP_fbreg -72)
                DW_AT_unknown_2137      (0x002c878a)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-15  3:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15  3:19 [Bug default/28594] New: Consider removing 0 length entries from variable and formal parameter location lists wcohen at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).