Added the ability to disassembly "count" instructions given a SBAddress.
This was done in SBTarget:
lldb::SBInstructionList
lldb::SBTarget::ReadInstructions (lldb::SBAddress base_addr, uint32_t count);
Also cleaned up a few files in the LLDB.framework settings.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152152 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp
index 8f8d75e..33b659b 100644
--- a/source/API/SBTarget.cpp
+++ b/source/API/SBTarget.cpp
@@ -1993,6 +1993,35 @@
}
lldb::SBInstructionList
+SBTarget::ReadInstructions (lldb::SBAddress base_addr, uint32_t count)
+{
+ SBInstructionList sb_instructions;
+
+ TargetSP target_sp(GetSP());
+ if (target_sp)
+ {
+ Address *addr_ptr = base_addr.get();
+
+ if (addr_ptr)
+ {
+ DataBufferHeap data (target_sp->GetArchitecture().GetMaximumOpcodeByteSize() * count, 0);
+ bool prefer_file_cache = false;
+ lldb_private::Error error;
+ const size_t bytes_read = target_sp->ReadMemory(*addr_ptr, prefer_file_cache, data.GetBytes(), data.GetByteSize(), error);
+ sb_instructions.SetDisassembler (Disassembler::DisassembleBytes (target_sp->GetArchitecture(),
+ NULL,
+ *addr_ptr,
+ data.GetBytes(),
+ bytes_read,
+ count));
+ }
+ }
+
+ return sb_instructions;
+
+}
+
+lldb::SBInstructionList
SBTarget::GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size)
{
SBInstructionList sb_instructions;
diff --git a/source/Core/Disassembler.cpp b/source/Core/Disassembler.cpp
index 2be02f9..1ab77bb 100644
--- a/source/Core/Disassembler.cpp
+++ b/source/Core/Disassembler.cpp
@@ -240,7 +240,8 @@
const char *plugin_name,
const Address &start,
const void *bytes,
- size_t length
+ size_t length,
+ uint32_t num_instructions
)
{
lldb::DisassemblerSP disasm_sp;
@@ -256,7 +257,7 @@
(void)disasm_sp->DecodeInstructions (start,
data,
0,
- UINT32_MAX,
+ num_instructions,
false);
}
}
diff --git a/source/Symbol/UnwindTable.cpp b/source/Symbol/UnwindTable.cpp
index 647fbb1..3a73504 100644
--- a/source/Symbol/UnwindTable.cpp
+++ b/source/Symbol/UnwindTable.cpp
@@ -115,7 +115,7 @@
const_iterator end = m_unwinds.end();
for (const_iterator pos = begin; pos != end; ++pos)
{
- s.Printf ("[%zu] 0x%16.16llx\n", std::distance (begin, pos), pos->first);
+ s.Printf ("[%u] 0x%16.16llx\n", (unsigned)std::distance (begin, pos), pos->first);
}
s.EOL();
}