[LLVMbugs] [Bug 13351] New: LLVM doesn't emit DW_AT_high_pc in compile unit

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 13 05:14:59 PDT 2012


             Bug #: 13351
           Summary: LLVM doesn't emit DW_AT_high_pc in compile unit
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: shinichiro.hamaji at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 8887
  --> http://llvm.org/bugs/attachment.cgi?id=8887
Proposed patch

lib/CodeGen/AsmPrinter/DwarfDebug.cpp emits only DW_AT_low_pc and the value of
DW_AT_low_pc is always 0. I think DWARF allows this behavior, but this makes
GNU addr2line significantly slower for binaries generated by clang. For ~1.4GB
debug binary generated by GCC, addr2line takes ~1.5secs to show an address.
However, it takes ~22secs for ~1.7GB debug binary generated by clang.

I'm attaching a patch for git HEAD with which clang emits both low_pc and
high_pc in compile units. It won't emit high_pc when there is a non-text
section. It seems GCC has similar check as well.

The following is the results of my benchmark. I used chrome binary for this
test. out-clang/Debug/chrome is built by clang without my fix, out-gcc is built
by GCC, and out is built by clang with my fix.

> ls -lh out/Debug/chrome out-clang/Debug/chrome out-gcc/Debug/chrome
-rwxr-x--- 1 hamaji eng 1.7G Jul 12 16:21 out-clang/Debug/chrome*
-rwxr-x--- 1 hamaji eng 1.4G Jul 12 15:41 out-gcc/Debug/chrome*
-rwxr-x--- 1 hamaji eng 1.7G Jul 13 19:00 out/Debug/chrome*

> time addr2line -e ~/chrome/src/out-gcc/Debug/chrome 389a3b4
addr2line -e ~/chrome/src/out-gcc/Debug/chrome 389a3b4  0.64s user 0.87s system
95% cpu 1.581 total

> time addr2line -e ~/chrome/src/out/Debug/chrome 2bd6b00
addr2line -e ~/chrome/src/out/Debug/chrome 2bd6b00  0.43s user 1.26s system 95%
cpu 1.775 total

> time addr2line -e ~/chrome/src/out-clang/Debug/chrome 2bd6a70
addr2line -e ~/chrome/src/out-clang/Debug/chrome 2bd6a70  14.35s user 3.32s
system 80% cpu 22.008 total

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list