aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Target/StackFrame.cpp
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2020-03-05 14:42:03 +0100
committerPavel Labath <pavel@labath.sk>2020-03-09 13:41:43 +0100
commitaf3db4e9aa8fbe7e43f89cdde780c6acc35368be (patch)
treec1743e0477dd5604ed4c5dd4a100d702db6c28bc /lldb/source/Target/StackFrame.cpp
parent62af02e76fe808134b06b75c8108a98c079ac8bc (diff)
downloadllvm-af3db4e9aa8fbe7e43f89cdde780c6acc35368be.zip
llvm-af3db4e9aa8fbe7e43f89cdde780c6acc35368be.tar.gz
llvm-af3db4e9aa8fbe7e43f89cdde780c6acc35368be.tar.bz2
[lldb] Reduce duplication in the Disassembler class
Summary: The class has two pairs of functions whose functionalities differ in only how one specifies how much he wants to disasseble. One limits the process by the size of the input memory region. The other based on the total amount of instructions disassembled. They also differ in various features (like error reporting) that were only added to one of the versions. There are various ways in which this could be addressed. This patch does it by introducing a helper struct called "Limit", which is effectively a pair specifying the value that you want to limit, and the actual limit itself. Reviewers: JDevlieghere Subscribers: sdardis, jrtc27, atanasyan, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D75730
Diffstat (limited to 'lldb/source/Target/StackFrame.cpp')
-rw-r--r--lldb/source/Target/StackFrame.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index f9e55cf..a818794 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -1940,16 +1940,14 @@ bool StackFrame::GetStatus(Stream &strm, bool show_frame_info, bool show_source,
const uint32_t disasm_lines = debugger.GetDisassemblyLineCount();
if (disasm_lines > 0) {
const ArchSpec &target_arch = target->GetArchitecture();
- AddressRange pc_range;
- pc_range.GetBaseAddress() = GetFrameCodeAddress();
- pc_range.SetByteSize(disasm_lines *
- target_arch.GetMaximumOpcodeByteSize());
const char *plugin_name = nullptr;
const char *flavor = nullptr;
const bool mixed_source_and_assembly = false;
Disassembler::Disassemble(
target->GetDebugger(), target_arch, plugin_name, flavor,
- exe_ctx, pc_range, disasm_lines, mixed_source_and_assembly, 0,
+ exe_ctx, GetFrameCodeAddress(),
+ {Disassembler::Limit::Instructions, disasm_lines},
+ mixed_source_and_assembly, 0,
Disassembler::eOptionMarkPCAddress, strm);
}
}