a comparison of the dwarf debugging information produced ... · a lightning talk at the llvm...
TRANSCRIPT
![Page 1: A comparison of the DWARF debugging information produced ... · A lightning talk at the LLVM Conference on 7th November 2013 . 2 Summary ... accessibility e ile call_line p_dir const_value](https://reader034.vdocuments.mx/reader034/viewer/2022050206/5f59890c0ba48d0966177820/html5/thumbnails/1.jpg)
1
A comparison of the DWARF
debugging information
produced by LLVM and GCC
by
Keith Walker
A lightning talk at
the LLVM Conference on 7th November 2013
![Page 2: A comparison of the DWARF debugging information produced ... · A lightning talk at the LLVM Conference on 7th November 2013 . 2 Summary ... accessibility e ile call_line p_dir const_value](https://reader034.vdocuments.mx/reader034/viewer/2022050206/5f59890c0ba48d0966177820/html5/thumbnails/2.jpg)
2
Summary
Debug information is mostly comparable to GCC.
LLVM is more aggressive at doing function inlining resulting
in larger debug tables at –O2.
Areas for improvement:
Remove duplication of inlined function parameter information.
Enumerators missing in pubnames.
System included files in line table if referenced by symbols.
Generate stack information for ARM.
Generate stack information for AARCH64 function epilogues.
debug_types can provide significant improvements in reducing size of
the debug information.
No sibling entries reduce debug info sizes at the cost of
loading speed (change can be around 10%).
![Page 3: A comparison of the DWARF debugging information produced ... · A lightning talk at the LLVM Conference on 7th November 2013 . 2 Summary ... accessibility e ile call_line p_dir const_value](https://reader034.vdocuments.mx/reader034/viewer/2022050206/5f59890c0ba48d0966177820/html5/thumbnails/3.jpg)
3
What was used in the comparison
Comparison performed on a C program of about 70,000 lines
of source in 58 source files and 16 header files
No library code linked in ... all debug information from the
compiled sources
Uses the same header files
GCC 4.8.2 using:
arm-none-eabi-gcc –g –gpubnames –gstrict-dwarf
LLVM tip of trunk using:
clang –target=arm-none-eabi -g
![Page 4: A comparison of the DWARF debugging information produced ... · A lightning talk at the LLVM Conference on 7th November 2013 . 2 Summary ... accessibility e ile call_line p_dir const_value](https://reader034.vdocuments.mx/reader034/viewer/2022050206/5f59890c0ba48d0966177820/html5/thumbnails/4.jpg)
4
DWARF debug section sizes
0
20000
40000
60000
80000
100000
120000
140000
160000
180000
LLVM -O0
LLVM -O1
LLVM -O2
GCC -O0
GCC -O1
GCC -O2
Effect of function inlining
![Page 5: A comparison of the DWARF debugging information produced ... · A lightning talk at the LLVM Conference on 7th November 2013 . 2 Summary ... accessibility e ile call_line p_dir const_value](https://reader034.vdocuments.mx/reader034/viewer/2022050206/5f59890c0ba48d0966177820/html5/thumbnails/5.jpg)
5
DWARF Tags (symbols)
0
500
1000
1500
2000
2500
3000
LLVM -O0
LLVM -O1
LLVM -O2
GCC -O0
GCC -O1
GCC -O2
![Page 6: A comparison of the DWARF debugging information produced ... · A lightning talk at the LLVM Conference on 7th November 2013 . 2 Summary ... accessibility e ile call_line p_dir const_value](https://reader034.vdocuments.mx/reader034/viewer/2022050206/5f59890c0ba48d0966177820/html5/thumbnails/6.jpg)
6
DWARF Attributes (symbol properties)
0
2000
4000
6000
8000
10000
12000
LLVM -O0
LLVM -O1
LLVM -O2
GCC -O0
GCC -O1
GCC -O2
Due to inlined function parameters
Due to inlined functions
![Page 7: A comparison of the DWARF debugging information produced ... · A lightning talk at the LLVM Conference on 7th November 2013 . 2 Summary ... accessibility e ile call_line p_dir const_value](https://reader034.vdocuments.mx/reader034/viewer/2022050206/5f59890c0ba48d0966177820/html5/thumbnails/7.jpg)
7
Are siblings attributes worth the space?
LLVM deliberately does not generate entries the
DW_AT_sibling attribute due to the size the occupied in the
.debug_info section.
GCC does generate DW_AT_sibling entries:
Take ~4% of the .debug_info section size (in this example).
Contribute no actual debug information.
Implemented using 4-byte entries.
... But of 1508 entries only 96 have a value greater than 255.
What is the effect of not having sibling entries in a debugger?
... Can affect loading speed by about 10%.
![Page 8: A comparison of the DWARF debugging information produced ... · A lightning talk at the LLVM Conference on 7th November 2013 . 2 Summary ... accessibility e ile call_line p_dir const_value](https://reader034.vdocuments.mx/reader034/viewer/2022050206/5f59890c0ba48d0966177820/html5/thumbnails/8.jpg)
8
Line Table Differences
LLVM does not include system header files/directories in the
line table.
But symbols defined in the system header files have a file/line
reference .... The file entry pointing at the current source file.
LLVM generates “End of Function Prologue” entries.
Needs support in debugger but will help to remove the need for
heuristics used by debuggers to find the prologue end.
LLVM (sometimes) marks the function prologue instruction as
a place not to put a source level breakpoint.
Neither compiler generates “Start of Function Epilogue”
entries.
![Page 9: A comparison of the DWARF debugging information produced ... · A lightning talk at the LLVM Conference on 7th November 2013 . 2 Summary ... accessibility e ile call_line p_dir const_value](https://reader034.vdocuments.mx/reader034/viewer/2022050206/5f59890c0ba48d0966177820/html5/thumbnails/9.jpg)
9
Stack Frame Differences
LLVM does not generate .debug_frame information for the
selected arm-none-eabi target.
GCC generates the changes that occur in a function
epilogue, LLVM does not (comparing AARCH64).
The effect of this is that when instruction stepping the
function epilogue in LLVM generated code, register usage in
the called function may be displayed incorrectly.
![Page 10: A comparison of the DWARF debugging information produced ... · A lightning talk at the LLVM Conference on 7th November 2013 . 2 Summary ... accessibility e ile call_line p_dir const_value](https://reader034.vdocuments.mx/reader034/viewer/2022050206/5f59890c0ba48d0966177820/html5/thumbnails/10.jpg)
10
DWARF .debug_types coming soon
The .debug_types section was added in DWARF 4 in order to
help common up duplicated type information. This removal
of duplicate information can results in smaller file sizes and
as a consequence means debuggers have less debugging
information to process and load.
I am looking forward to the completion of the current
development effort to implement support for the .debug_types
section.
GCC already has support for .debug_types, so we can see
the possible benefits of adding this support.
![Page 11: A comparison of the DWARF debugging information produced ... · A lightning talk at the LLVM Conference on 7th November 2013 . 2 Summary ... accessibility e ile call_line p_dir const_value](https://reader034.vdocuments.mx/reader034/viewer/2022050206/5f59890c0ba48d0966177820/html5/thumbnails/11.jpg)
11
DWARF Debug section sizes (GCC)
0
50000
100000
150000
200000
250000
GCC -O2
GCC -O2 (types)
Main sections that change
![Page 12: A comparison of the DWARF debugging information produced ... · A lightning talk at the LLVM Conference on 7th November 2013 . 2 Summary ... accessibility e ile call_line p_dir const_value](https://reader034.vdocuments.mx/reader034/viewer/2022050206/5f59890c0ba48d0966177820/html5/thumbnails/12.jpg)
12
Questions?
![Page 13: A comparison of the DWARF debugging information produced ... · A lightning talk at the LLVM Conference on 7th November 2013 . 2 Summary ... accessibility e ile call_line p_dir const_value](https://reader034.vdocuments.mx/reader034/viewer/2022050206/5f59890c0ba48d0966177820/html5/thumbnails/13.jpg)
13
DWARF debug section sizes
0
20000
40000
60000
80000
100000
120000
140000
160000
180000 LLVM -O0
LLVM -O1
LLVM -O2
GCC -O0
GCC -O1
GCC -O2
![Page 14: A comparison of the DWARF debugging information produced ... · A lightning talk at the LLVM Conference on 7th November 2013 . 2 Summary ... accessibility e ile call_line p_dir const_value](https://reader034.vdocuments.mx/reader034/viewer/2022050206/5f59890c0ba48d0966177820/html5/thumbnails/14.jpg)
14
DWARF Tags (symbols)
0
500
1000
1500
2000
2500
3000
3500
4000
4500
5000
LLVM -O0
LLVM -O1
LLVM -O2
GCC -O0
GCC -O1
GCC -O2
![Page 15: A comparison of the DWARF debugging information produced ... · A lightning talk at the LLVM Conference on 7th November 2013 . 2 Summary ... accessibility e ile call_line p_dir const_value](https://reader034.vdocuments.mx/reader034/viewer/2022050206/5f59890c0ba48d0966177820/html5/thumbnails/15.jpg)
15
DWARF Attributes (symbol properties)
0
2000
4000
6000
8000
10000
12000 abstr
act_
origin
accessib
ility
byte
_siz
e
call_
file
call_
line
com
p_dir
const_
valu
e
data
_m
em
ber_
location
decl_
file
decl_
line
decla
ration
encodin
g
entr
y_pc
exte
rnal
fram
e_base
hig
h_pc
inlin
e
language
location
low
_pc
nam
e
pro
ducer
pro
toty
ped
ranges
sib
ling
stm
t_lis
t
type
uppe
r_bo
und
LLVM -O0
LLVM -O1
LLVM -O2
GCC -O0
GCC -O1
GCC -O2
![Page 16: A comparison of the DWARF debugging information produced ... · A lightning talk at the LLVM Conference on 7th November 2013 . 2 Summary ... accessibility e ile call_line p_dir const_value](https://reader034.vdocuments.mx/reader034/viewer/2022050206/5f59890c0ba48d0966177820/html5/thumbnails/16.jpg)
16
Thank You
The trademarks featured in this presentation are registered and/or unregistered trademarks of ARM
Limited (or its subsidiaries) in the EU and/or elsewhere. All rights reserved. Any other marks featured
may be trademarks of their respective owners