Where should the debugger set a breakpoint?
I recall that in either gdb or Qt Creator&#x27;s gdb wrapper, parameters were sometimes being uninitialized when I breakpoint the function declaration line, then be initialized when I single-step to on&#x2F;before the first line of code. I can&#x27;t replicate it now though.<p>----<p>I&#x27;m interested in the promise of omniscient debugging to partially replace both debuggers, tracing tools, and logging (including printf debugging), for bugs in complex systems which you can reproduce in controlled environments (not in production). However I don&#x27;t believe it will be perfect even there, because I&#x27;ve noticed that when debugging many binaries (especially non-symboled or worse-yet stripped ones) in gdb, it prints many variable values as &quot;optimized out&quot;. This requires special debug builds which <i>partly</i> alleviates the problem (I still get better results with compiled-in debug prints).<p>I&#x27;ve recently been tracing the execution of the pipewire daemon. Since it&#x27;s a large library filled with virtual function calls constructed from C macros, it&#x27;s painful to statically analyze by reading the code. I found a Callgrind profiling trace to be useful as a <i>control flow</i> analysis tool. Unlike perf, it logs <i>every</i> function called, counts the calls to each function, records all callers and how many times each caller called a function, and even records how many times each <i>line of code</i> calls another function (can distinguish between two calls to the same child in the same function).<p>For example, I recently used KCacheGrind to identify that spa_alsa_open() was called 6 times, 4 times by one caller and once each by 2 other callers. And it returned early twice, and continued onto snd_pcm_open() 4 times.<p>I also wanted to trace <i>all</i> ALSA functions being called across the trace (ltrace didn&#x27;t work well since libasound.so.2 was loaded via dlopen, and I couldn&#x27;t figure out how to make ltrace not burn CPU intercepting calls from one .so function to another). This was difficult to extract from the the Callgrind trace, and I had to rig together a script using `gprof2dot --format=callgrind -n 0 -e 0`, rg to convert the output XML file into a CSV of callers and callees, and csvsql to isolate all calls from non-snd-containing functions into snd-containing functions, so I could read the source code to see where these ALSA functions were being called. The result didn&#x27;t tell me the order or parameters of the function calls, so I had to infer the order in some cases, and insert logging statements in other cases.<p>I think Pernosco is promising in this area, but I haven&#x27;t tried it yet because it&#x27;s commercial and has limited free uploads. One idea (I don&#x27;t know if it&#x27;s implemented or not) is having the ability to run SQL-like queries to list all calls from one binary to another .so library. Another idea (on top of the caller-callee lists you already have) is creating control flow graphs like KCacheGrind.