[LLDB] Add SBInstruction::GetControlFlowKind()

D128477 adds the control flow kind for `Instruction` and displays this
in the `thread trace dump instruction -k` command.

This diff exposes the control flow kind via the new
`SBInstruction::GetControlFlowKind` method.

I've expanded `TestDisassembleRawData` to test this method, but please
let me know if there are any other unittests that should also be updated.

Test Plan:
`./bin/lldb-dotest -p TestDisassembleRawData`

Differential Revision: https://reviews.llvm.org/D131005
This commit is contained in:
Jakob Johnson
2022-08-02 11:26:24 -07:00
parent 4f0262c164
commit 6cbc6e9a6d
4 changed files with 34 additions and 0 deletions

View File

@@ -52,16 +52,26 @@ class DisassembleRawDataTestCase(TestBase):
self.assertEqual(inst.GetMnemonic(target), "move")
self.assertEqual(inst.GetOperands(target),
'$' + "fp, " + '$' + "sp")
self.assertEqual(inst.GetControlFlowKind(target),
lldb.eInstructionControlFlowKindUnknown)
elif re.match("powerpc64le", arch):
self.assertEqual(inst.GetMnemonic(target), "li")
self.assertEqual(inst.GetOperands(target), "4, 0")
self.assertEqual(inst.GetControlFlowKind(target),
lldb.eInstructionControlFlowKindUnknown)
elif arch in ("aarch64", "arm64"):
self.assertEqual(inst.GetMnemonic(target), "mov")
self.assertEqual(inst.GetOperands(target), "w0, #0x63")
self.assertEqual(inst.GetControlFlowKind(target),
lldb.eInstructionControlFlowKindUnknown)
elif arch == "arm":
self.assertEqual(inst.GetMnemonic(target), "mov")
self.assertEqual(inst.GetOperands(target), "r3, #99")
self.assertEqual(inst.GetControlFlowKind(target),
lldb.eInstructionControlFlowKindUnknown)
else:
self.assertEqual(inst.GetMnemonic(target), "movq")
self.assertEqual(inst.GetOperands(target),
'%' + "rsp, " + '%' + "rbp")
self.assertEqual(inst.GetControlFlowKind(target),
lldb.eInstructionControlFlowKindOther)