Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

LLVM doesn't emit DW_AT_high_pc in compile unit #13415

Open Quuxplusone opened 12 years ago

Quuxplusone commented 12 years ago
Bugzilla Link PR13351
Status NEW
Importance P enhancement
Reported by Shinichiro Hamaji (shinichiro.hamaji@gmail.com)
Reported on 2012-07-13 07:14:59 -0700
Last modified on 2015-05-19 02:12:18 -0700
Version trunk
Hardware PC Linux
CC alexanderm.08@googlemail.com, artinetstudio@gmail.com, geek4civic@gmail.com, llvm-bugs@lists.llvm.org, nlewycky@google.com, yaron.keren@gmail.com
Fixed by commit(s)
Attachments llvm.dw.patch (16295 bytes, text/plain)
pc_non_working.diff (3000 bytes, application/octet-stream)
Blocks
Blocked by
See also
Created attachment 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
/home/hamaji/chrome/src/third_party/WebKit/Source/WebCore/page/EventHandler.cpp:1679
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
/home/hamaji/chrome/src/out/Debug/../../third_party/WebKit/Source/WebCore/page/EventHandler.cpp:1679
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
/home/hamaji/chrome/src/out/Debug/../../third_party/WebKit/Sour
ce/WebCore/page/EventHandler.cpp:1679
addr2line -e ~/chrome/src/out-clang/Debug/chrome 2bd6a70  14.35s user 3.32s
system 80% cpu 22.008 total
Quuxplusone commented 12 years ago

Attached llvm.dw.patch (16295 bytes, text/plain): Proposed patch

Quuxplusone commented 10 years ago

Attached pc_non_working.diff (3000 bytes, application/octet-stream): Non working patch updated for current trunk

Quuxplusone commented 10 years ago

OK, this time it's here. I also noticed that the bug system responds ver slowly ~minute for every request which may be related.

Anyhow, it would be nice to fix this, both to match gcc output and to help debuggers, line2addr and such to find the location more efficiently.