This script is intended to test the impact of having lots of split dwarf files on debugger startup time. It will generate a large number of object files, each with a single function. It combines these object files into libraries and links it all together into an executable. For each of the object file a separate debug info file (.dwo) is generated by the compiler.
It then times the the startup time of launching a debugger to load the executable.
The --count
option is the scaling parameter for the script. This defines how
many "leaf" functions are generated. These leaf functions are compiled
separately into object files with split dwarf (.dwo). They are then combined
into libraries (determined by --library-object-count
) and linked into a main
executable.
The script generates all outputs into a directory chosen by the
--output-directory
flag. The default location is a build
directory next to
the script. This directory contains all generated source files, a ninja build
file and the compiled object and dwo files.
The script includes builtin help for all supported options. Basic usage will be to point it to your compiler and debugger executables and select which debuggers should be run (gdb, lldb, or both).
Use the --count
flag described above to control the number of generated leaf
functions. The count parameter will not be exactly equal to the number of
generated files since it controls the number of leaf functions. Additional files
will be generated for libraries and the main executable.
After initially generating and building the files you can re-run the timings
without re-generating anything by using the --skip-generate
flag.
$ ./lod.py --clang=clang++ --gdb=gdb --lldb=lldb --build --run both --stats
...
time -v gdb build/bin/lod -ex quit
...
time -v lldb /home/peix/work/lots-o-dwarf/build/bin/lod -o quit
...
===================== Stats =====================
Executable size: 1.1MiB count: 1
ObjectFile size: 3.8MiB count: 12
Library size: 4.2MiB count: 1
DebugInfo size: 2.7MiB count: 12
- c++ compiler (clang++ or g++)
- ninja
- debugger (gdb or lldb)