Home     About

Hamburg Hackweek 2025

Hackertools

Time Travel Debugging

using rr, the big brother of gdb, one can time travel through the source code and go in both the forward and backword directions of execution. so one can set a breakpoint on the destructor, print and remember the this pointer and set a conditional breakpoint on the constructor for the instance being same as the pointer one, and start execution in the reverse direction... so cool!

Profiling

callgrind simulates the system and records the state of code at all times. so if some memory was initialized and not accessed, callgrind will warn about that. same in the case of out of bounds memory access as callgrind knows which memory was allocated by the program and which wasn't. cachegrind is another such tool.

VALGRIND=callgrind ./instdir/program/soffice start libreoffice in a simulated callgrind env. valgrind by default looks for segmentation faults.

kcachegrind is a visualizer for callgrind files, usually the largest one has the most important bits. requires graphviz as a dependency. it shows the callgraph of the program which is quite helpful (but some people find the flamegraphs more readable).

perf generates some files which are used other tools to show flamegraphs to visualize the data in a nicer, more interactive way. the flamegraphs have various search/find features...

but profiling doesn't tell much, it's a fuzzy method. using printf time logs is still the simplest, most reliable method of knowing whether things got a whole lot slower or not. one can print absolute or relative timestamps, depending on the usecase.

core/include/sal/log.hxx has all the functionalities required to print time logs in libreoffice. SAL_LOG_FILE allows to log entries to a file rather than stdout or stderr.

Common Sense

Asking Questions

Not too Far, Not too Close

while working on bugs, it's easy to get really focused on to the problem and keep thinking about it without reaching anywhere. one can think endlessly of how would hitting a golf ball from a sand pit work, but one actually never knows until they start hitting it. it might not even be a sand pit in the first place.

the idea is to not be too invested into the problem and have a playful approach. this way when something fails, one has both a close and a faraway perspective. then one can try a few things and if they don't work, one can think of searching for the solution on the internet. if that doesn't work either, one can ask others for help and share the logs.