[all-commits] [llvm/llvm-project] dd0ee5: [lldb] Read the bool that a scripted thread plan's...

alexey-gusarov via All-commits all-commits at lists.llvm.org
Thu Sep 17 15:48:45 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dd0ee5e10da57e2b1ebf0cbf066b32a8ffe92c28
      https://github.com/llvm/llvm-project/commit/dd0ee5e10da57e2b1ebf0cbf066b32a8ffe92c28
  Author: alexey-gusarov <alexey.gusarov at gmail.com>
  Date:   2026-09-17 (Thu, 17 Sep 2026)

  Changed paths:
    M lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface.cpp
    M lldb/test/API/commands/frame/recognizer/step-through/recognizer.py
    M lldb/test/API/functionalities/step_scripted/Steps.py
    M lldb/test/API/functionalities/step_scripted/TestStepScripted.py
    M lldb/test/API/functionalities/step_scripted/main.c

  Log Message:
  -----------
  [lldb] Read the bool that a scripted thread plan's should_step returns (#215521)

Fixes part (1) of #215189.

`ScriptedThreadPlanPythonInterface::GetRunState()` used
`GetUnsignedIntegerValue()` to read the script's `should_step` return
value. A
Python `bool` arrives as a `StructuredData::Boolean`, so the return
value was
discarded and every scripted thread plan reported `eStateStepping`: a
plan
returning `False` single-stepped exactly like one returning `True`.

The documented contract for `should_step` is a bool
(`lldb/docs/use/tutorials/automating-stepping-logic.md` and
`lldb/examples/python/templates/scripted_thread_plan.py`). Read it as
one; any
other return value is logged and causes the plan to step.

### Behavior change

| `should_step` returns             | before  | after   |
| --------------------------------- | ------- | ------- |
| `True`                            | step    | step    |
| `False`                           | step    | **run** |
| `0`, `1`, or `lldb.eStateRunning` | **run** | step    |
| `lldb.eStateStepping`             | step    | step    |

The integer case is an intentional behavior change. Integers used to be
reinterpreted as a `StateType`, which also made them the only way to
make a
scripted plan run while boolean `False` was being discarded. They are
not part
of the documented `should_step` contract.

The behavior for a missing `should_step` is unchanged by this PR: it
continues
to step.

### In-tree user of the old behavior


`commands/frame/recognizer/step-through/TestFrameRecognizerStepThrough.py`
returns `False` from `should_step` and relied on being single-stepped
anyway.
With `False` honored, its `ThreadPlanRunToAddress` sub-plan handles the
stop
that completes it, so `explains_stop` is not called.

Update the plan to notice completion of the sub-plan in `should_stop`
and call
`SetPlanComplete` there, as described by the `ScriptedThreadPlan`
documentation.

### Testing

`lldb/test/API/functionalities/step_scripted/` covers:

* `should_step == True` stepping one instruction;
* `should_step == False` running to the next breakpoint;
* non-bool integer and `StateType` returns stepping.

The `False` and invalid-return cases fail before this change on both
Linux and
Windows.

### Landing order

This change allows scripted plans returning `False` from `should_step`
to reach
the `SetAutoContinue(true)` path in
`Thread::SetupToStepOverBreakpointIfNeeded()`. #215522 fixes the
independent
thread-plan-stack issue on that path. The two changes are independent,
but are
best landed together.

---

Tool-use disclosure, per the LLVM AI tool policy: this change was
prepared with
the assistance of Claude Code (`Assisted-by:` trailer on the commit).
Everything
in the change was read and reviewed before posting.

Co-authored-by: Med Ismail Bennani <ismail at bennani.ma>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list