Collecting Execution Trace
- Backwards traversal:
- Determine the symptoms of the issue.
- Place a breakpoint at the place where the symptoms become apparent.
- Retrace the execution backwards by unwinding the call stack and checking callers.Drawback: In some cases, the call stack might not provide enough information to identify the issue, because it might have originated in a separate execution branch.
- Forward traversal:
- Determine the hierarchy of function calls that lead to the symptom of the issue.
- Place a breakpoint at a function that leads to the issue.
- Single-step the execution until the symptoms are apparent.Drawback: Forward traversal might not work if you have to step through a large number of executions of a code piece to identify the issue. It can also be destructive to issues like race conditions, deadlocks, and others.