Skip to content

Add lldb versions of the ptbt and ptbtall gdb macros - #32

Merged
LarryRuane merged 2 commits into
masterfrom
lldb-macros
Nov 4, 2026
Merged

LarryRuane merged 2 commits into
masterfrom
lldb-macros

Conversation

@LarryRuane

Copy link
Copy Markdown
Owner

lldbinit.py is an lldb port of the ptbt and ptbtall macros in gdbinit. Load it with command script import lldbinit.py, or add that line to ~/.lldbinit.

The output matches gdbinit. One difference is that the argument can be a struct or a pointer, so ptbtall pt works as well as ptbtall &pt. If the name isn't visible in the current frame, outer frames are tried. So it still works when you're stopped inside a library function like pt_timer_next().

It was checked against gdbinit on pttpcc (1040 threads, same backtraces) and in VS Code with CodeLLDB. The README now mentions both.

🤖 Generated with Claude Code

LarryRuane and others added 2 commits November 4, 2026 00:16
lldbinit.py is a Python command script with the same output as gdbinit.
Load it with "command script import lldbinit.py" (or from ~/.lldbinit).

Unlike the gdb macros, the argument can be a struct or a pointer, so
"ptbtall pt" works as well as "ptbtall &pt". If the name isn't visible
in the current frame, outer frames are tried, so it also works when
stopped inside a library function. Each frame line shows the address of
the pt_func_t.

Checked against gdbinit on pttpcc (1040 threads, same backtraces).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
debugger_test.sh builds protothread_test with -g, stops it twice, and
runs ptbtall in both debuggers. The first stop is in test_pc(), with
the consumer running and the producer waiting. The second is where the
last thread arrives at a barrier in test_barrier(), which has running,
ready and waiting threads, some waiting inside a pt_call().

The two debuggers have to print the same threads and frames, and each
frame's line has to be a pt_wait(), pt_yield() or pt_call(). The thread
functions and states are checked too, but not line numbers, so the test
doesn't break whenever protothread_test.c changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LarryRuane
LarryRuane merged commit 50b9ae6 into master Nov 4, 2026
32 checks passed
@LarryRuane
LarryRuane deleted the lldb-macros branch November 4, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant