3 ms·
What I'd appreciate is if GDB, when stopped during execution, could show _all_ of the source statements that are currently 'in progress' (for the common case un
by caf 8y ago
What I'd appreciate is if GDB, when stopped during execution, could show _all_ of the source statements that are currently 'in progress' (for the common case under optimisation where the execution of several source statements are interleaved). I don't know how feasible that is, though.
- speps 8y agoVisual Studio has something called "Parallel Stacks" [1] which shows a graph of all the stacks of every thread of the application. It's very powerful when debugging multithreaded code. [1] https://docs.microsoft.com/en-us/visualstudio/debugger/using-the-parallel-stacks-window https://docs.microsoft.com/en-us/visualstudio/debugger/using...
- kccqzy 8y agoI believe GP is not talking about thread parallelism, but rather the compiler-controlled instruction reordering. Compilers typically reorder instructions in the hope that it will improve performance. For example if you have v+=2, the compiler can choose to load v into a register, and then continue with the rest of the statements, and ten instructions later perform the actual addition and store it back into memory.
- caf 8y agoYes, that's what I was referring to. When single-stepping such code you'll often see it skip backwards and forwards between the interleaved source statements.
- saagarjha 8y agoLLDB does this, and it lets you jump between threads. I’m not sure if GDB supports this.
- sigjuice 8y agohttps://ftp.gnu.org/old-gnu/Manuals/gdb/html_node/gdb_24.html https://ftp.gnu.org/old-gnu/Manuals/gdb/html_node/gdb_24.htm...