This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add "Trace" stop reason in Scripted Thread
ClosedPublic

Authored by mib on May 21 2023, 12:52 AM.

Details

Summary

This patch adds support to eStopReasonTrace to Scripted Threads.

This is necessary when using a Scrited Process with a Scripted Thread
Plan to report a special thread stop reason to the thread plan.

rdar://109425542

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>

Diff Detail

Event Timeline

mib created this revision.May 21 2023, 12:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 21 2023, 12:52 AM
mib requested review of this revision.May 21 2023, 12:52 AM
mib added inline comments.May 21 2023, 12:55 AM
lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
70–71

Other tests still user a lldb.eStopReasonSignal with Scripted Processes so we can just replace this by an lldb.eStopReasonTrace instead

JDevlieghere accepted this revision.May 22 2023, 8:32 AM

LGTM. Are there other stop reasons that are currently not supported by scripted threads that we should consider supporting?

This revision is now accepted and ready to land.May 22 2023, 8:32 AM
mib added a comment.May 22 2023, 10:56 AM

LGTM. Are there other stop reasons that are currently not supported by scripted threads that we should consider supporting?

Scripted Threads still don't support eStopReasonWatchpoint as well as all of these stop reasons :

eStopReasonExec,
eStopReasonPlanComplete,
eStopReasonThreadExiting,
eStopReasonInstrumentation,
eStopReasonProcessorTrace,
eStopReasonFork,
eStopReasonVFork,
eStopReasonVForkDone,

I'll implement the watchpoint stop info in a follow-up (should very similar to the breakpoint stop info), but I'm not sure if need to implement support to any of the other ... @jingham, what do you think ?

This revision was automatically updated to reflect the committed changes.

If a Scripted process is able to provide private events and enough info to lldb's lower level calls (read memory, registers) to work the thread-plan machinery then it won't need to generate the inferred stop reasons like PlanComplete and Instrumentation. But the scripted threads might just be producing public stops w/o the underlying model that would allow lldb to generate them. In that case, the scripted thread will also need to be able to produce the inferred stop reasons.