[Lldb-commits] [PATCH] D130580: Refactor string conversion for InstructionControlFlowKind enum
Jakob Johnson via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Jul 26 12:44:04 PDT 2022
jj10306 updated this revision to Diff 447804.
jj10306 marked 3 inline comments as done.
jj10306 added a comment.
Remove unnecessary comment
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130580/new/
https://reviews.llvm.org/D130580
Files:
lldb/include/lldb/Core/Disassembler.h
lldb/source/Core/Disassembler.cpp
Index: lldb/source/Core/Disassembler.cpp
===================================================================
--- lldb/source/Core/Disassembler.cpp
+++ lldb/source/Core/Disassembler.cpp
@@ -577,6 +577,30 @@
return m_address_class;
}
+const char *Instruction::GetNameForInstructionControlFlowKind(
+ lldb::InstructionControlFlowKind instruction_control_flow_kind) {
+ switch (instruction_control_flow_kind) {
+ case eInstructionControlFlowKindUnknown:
+ return "unknown";
+ case eInstructionControlFlowKindOther:
+ return "other";
+ case eInstructionControlFlowKindCall:
+ return "call";
+ case eInstructionControlFlowKindReturn:
+ return "return";
+ case eInstructionControlFlowKindJump:
+ return "jump";
+ case eInstructionControlFlowKindCondJump:
+ return "cond jump";
+ case eInstructionControlFlowKindFarCall:
+ return "far call";
+ case eInstructionControlFlowKindFarReturn:
+ return "far return";
+ case eInstructionControlFlowKindFarJump:
+ return "far jump";
+ }
+}
+
void Instruction::Dump(lldb_private::Stream *s, uint32_t max_opcode_byte_size,
bool show_address, bool show_bytes,
bool show_control_flow_kind,
@@ -618,35 +642,10 @@
}
if (show_control_flow_kind) {
- switch (GetControlFlowKind(exe_ctx)) {
- case eInstructionControlFlowKindUnknown:
- ss.Printf("%-12s", "unknown");
- break;
- case eInstructionControlFlowKindOther:
- ss.Printf("%-12s", "other");
- break;
- case eInstructionControlFlowKindCall:
- ss.Printf("%-12s", "call");
- break;
- case eInstructionControlFlowKindReturn:
- ss.Printf("%-12s", "return");
- break;
- case eInstructionControlFlowKindJump:
- ss.Printf("%-12s", "jump");
- break;
- case eInstructionControlFlowKindCondJump:
- ss.Printf("%-12s", "cond jump");
- break;
- case eInstructionControlFlowKindFarCall:
- ss.Printf("%-12s", "far call");
- break;
- case eInstructionControlFlowKindFarReturn:
- ss.Printf("%-12s", "far return");
- break;
- case eInstructionControlFlowKindFarJump:
- ss.Printf("%-12s", "far jump");
- break;
- }
+ lldb::InstructionControlFlowKind instruction_control_flow_kind =
+ GetControlFlowKind(exe_ctx);
+ ss.Printf("%-12s", GetNameForInstructionControlFlowKind(
+ instruction_control_flow_kind));
}
const size_t opcode_pos = ss.GetSizeOfLastLine();
Index: lldb/include/lldb/Core/Disassembler.h
===================================================================
--- lldb/include/lldb/Core/Disassembler.h
+++ lldb/include/lldb/Core/Disassembler.h
@@ -226,6 +226,9 @@
virtual bool IsCall() { return false; }
+ static const char *GetNameForInstructionControlFlowKind(
+ lldb::InstructionControlFlowKind instruction_control_flow_kind);
+
protected:
Address m_address; // The section offset address of this instruction
// We include an address class in the Instruction class to
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130580.447804.patch
Type: text/x-patch
Size: 3056 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220726/4799e0bb/attachment.bin>
More information about the lldb-commits
mailing list