Beware link wall ahead
Stumbling upon this page [1] ended up in a massive recurssive tree search. A stack of links where kept here.
Profiling with gdb
Why not profiling your application by sampling backtraces using gdb? This intuitive idea is easily adapted to remote debugging as well. [2]
If the sampling rate is too slow, quickstack can go faster. It is also a good reference for implementing a faster version of a gdb script. [3]
Bonus: gdb convenience variables and especially this one:
(gdb) break funcA if $_caller_is("funcB")
Wouldn't it be nice to setup a little Raspberry with gdb compiled for your target in order to sample backtraces all the time? (especially for Windows users) [4]
Wait! gdb is super slow because of the hundreds of megabytes of symbols it is loading each time. Solution! -> DebugFission [5] ([6] [7] [8] [9])
Profiling with callgrind
Why not using a real profile?
Valgrind Callgrind [10]
The output can be read with qtcreator, but it does not work as well as kcachegrind. Good news, kcachegrind includes qcachegrind, which is a Qt-only application without dependencies to KDE. The official website looks old and out-dated [11], but if you look at the git repository [12] shows that the tool is still updated.
References
[1] | Wikibooks, Linux Applications Debugging Techniques, https://en.wikibooks.org/wiki/Linux_Applications_Debugging_Techniques/Print_Version |
[2] | "poor man's profiler", https://poormansprofiler.org |
[3] | quickstack, https://github.com/yoshinorim/quickstack |
[4] | https://sourceware.org/gdb/current/onlinedocs/gdb/Convenience-Funs.html#Convenience-Funs |
[5] | https://sourceware.org/gdb/wiki/BuildingCrossGDBandGDBserver |
[6] | https://gcc.gnu.org/wiki/DebugFission |
[7] | https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html |
[8] | http://stackoverflow.com/a/16449810 |
[9] | http://stackoverflow.com/a/31944619 |
[10] | https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/CnRm0EIBp0E |
[11] | Valgrind Callgrind, http://valgrind.org/docs/manual/cl-manual.html |
[12] | Kcachegrind, https://kcachegrind.github.io |
[13] | Kcachegrind, git repository, https://cgit.kde.org/kcachegrind.git/tree//? |