This is an archive of the discontinued LLVM Phabricator instance.

[lldb/plugins] Add arm64(e) support to ScriptedProcess
ClosedPublic

Authored by mib on Dec 1 2021, 7:02 PM.

Details

Summary

This patch adds support for arm64(e) targets to ScriptedProcess, by
providing the DynamicRegisterInfo to the base lldb.ScriptedThread class.
This allows create and debugging ScriptedProcess on Apple Silicon
hardware as well as Apple mobile devices.

It also replace the C++ asserts on ScriptedThread::GetDynamicRegisterInfo
by some error logging, re-enables TestScriptedProcess for arm64
Darwin platforms and adds a new invalid Scripted Thread test.

rdar://85892451

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

Diff Detail

Event Timeline

mib created this revision.Dec 1 2021, 7:02 PM
mib requested review of this revision.Dec 1 2021, 7:03 PM
DavidSpickett added a subscriber: DavidSpickett.
DavidSpickett added inline comments.
lldb/examples/python/scripted_process/scripted_process.py
357

You can drop the trailing comma , }, inside the } on each entry.

360

Is it worth putting an else: raise Unknown architecture <bla> here? I assume the tests would fail later anyway and you're running this for Apple platforms that are x86/arm64 only.

Would this ever be run against Arm 32 bit?

mib updated this revision to Diff 391389.Dec 2 2021, 10:53 AM
mib edited the summary of this revision. (Show Details)

Address @DavidSpickett feedbacks.

mib marked 2 inline comments as done.Dec 2 2021, 10:58 AM
mib added inline comments.
lldb/examples/python/scripted_process/scripted_process.py
360

Hi David,

Thanks for looking at this.

I didn't put the else branch because the C++ ScriptedThread caller would assert if the returned dictionary didn't have any entry.
After some considerations, it makes more sense to raise an error on the Python side and log the error in lldb.

Regarding arm32, we have no plans on supporting this architecture, but I think it should be quite straightforward to add.

Can we add a small test for the error messages?

mib updated this revision to Diff 392178.Dec 6 2021, 2:12 PM
mib marked an inline comment as done.
mib edited the summary of this revision. (Show Details)

Add invalid Scripted Thread test, addressing @JDevlieghere comment.

This revision is now accepted and ready to land.Dec 6 2021, 4:09 PM
This revision was landed with ongoing or failed builds.Dec 6 2021, 4:12 PM
This revision was automatically updated to reflect the committed changes.