Dynamic Analysis of Your Own Program: Debuggers, Traces, and Confirming Static Claims
A breakpoint hit is an observation about one run of one build. This lesson builds the harness that turns those observations into confirmed, refuted, and not-observed verdicts on the claims the static lessons made.
130 minutesBuildPython, C, arm64 assembly, lldb command languageMembers
Learning Objectives
- Explain what a debugger needs from the operating system on Linux (
ptrace) and on macOS (Mach task ports and exception ports), and why a sandboxed shell cannot launch a debuggee. - Set software breakpoints by name and by listing address, set a hardware watchpoint, and read the limits that the processor imposes on both.
- Drive lldb in batch mode from Python with a stop hook that records registers, memory, and frame variables at every stop, and parse the transcript back into a timeline.
- Check static claims from lessons 32, 33, 34, and 41 against that timeline: argument registers, struct field offsets, which edge a conditional branch took, and which calls happened.
- Run the same plan against an
-O2build, read breakpoints that resolve and never hit, and say what that does and does not prove. - Save and load a core file, and name what a stack-style core leaves out.
- Map the gdb and lldb command sets, and place
straceltracebpftracedtraceandrron the right operating system with their versions and licences. - State the macOS code-signing facts that let lldb debug a binary you built yourself, and the two conditions under which it refuses.