-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
| Bugzilla Link | 13351 |
| Version | trunk |
| OS | Linux |
| Attachments | Proposed patch |
| Reporter | LLVM Bugzilla Contributor |
Extended Description
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