This is an archive of the discontinued LLVM Phabricator instance.

[lldb/Plugins] Refactor ScriptedThread register context creation
ClosedPublic

Authored by mib on Oct 20 2021, 11:54 AM.

Details

Summary

This patch changes the ScriptedThread class to create the register
context when Process::RefreshStateAfterStop is called rather than
doing it in the thread constructor.

This is required to update the thread state for execution control
support.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>

Diff Detail

Event Timeline

mib requested review of this revision.Oct 20 2021, 11:54 AM
mib created this revision.
shafik added a subscriber: shafik.Oct 20 2021, 1:53 PM
shafik added inline comments.
lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
189

It should be /*force=*/false

See clang-tidy - bugprone-argument-comment

mib marked an inline comment as done.Oct 20 2021, 1:58 PM
shafik added inline comments.Oct 20 2021, 1:58 PM
lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
99–120

const

mib updated this revision to Diff 381091.Oct 20 2021, 2:02 PM

Address @shafik comment.

JDevlieghere requested changes to this revision.Oct 25 2021, 10:54 AM
JDevlieghere added inline comments.
lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
126

It looks like this error is set but never used/returned? Should this return an Expected<RegisterContextSP> with the caller dealing with the error?

This revision now requires changes to proceed.Oct 25 2021, 10:54 AM
mib requested review of this revision.Nov 10 2021, 11:54 AM
mib marked 2 inline comments as done.
mib added inline comments.
lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
126

This follows the Thread::CreateRegisterContextForFrame base definition, returning a RegisterContextSP and not taking a Status& as an argument. I agree this should be refactored but that should be done on a separate patch.

For now, I refactored the code to log the error on the thread channel.

mib updated this revision to Diff 386274.Nov 10 2021, 11:55 AM
mib marked an inline comment as done.

Addressed @JDevlieghere & @shafik comments.

This revision is now accepted and ready to land.Nov 10 2021, 12:05 PM
This revision was landed with ongoing or failed builds.Nov 10 2021, 3:14 PM
This revision was automatically updated to reflect the committed changes.