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/include/lldb/API/SBTarget.h b/include/lldb/API/SBTarget.h
index 2e5ed6d..0c9af2a 100644
--- a/include/lldb/API/SBTarget.h
+++ b/include/lldb/API/SBTarget.h
@@ -713,6 +713,9 @@
GetSourceManager();
lldb::SBInstructionList
+ ReadInstructions (lldb::SBAddress base_addr, uint32_t count);
+
+ lldb::SBInstructionList
GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size);
lldb::SBInstructionList
diff --git a/include/lldb/Core/Disassembler.h b/include/lldb/Core/Disassembler.h
index e2e22b6..6d09b9f 100644
--- a/include/lldb/Core/Disassembler.h
+++ b/include/lldb/Core/Disassembler.h
@@ -258,7 +258,8 @@
const char *plugin_name,
const Address &start,
const void *bytes,
- size_t length);
+ size_t length,
+ uint32_t num_instructions = UINT32_MAX);
static bool
Disassemble (Debugger &debugger,
diff --git a/lldb.xcodeproj/project.pbxproj b/lldb.xcodeproj/project.pbxproj
index 9063953..bf2f688 100644
--- a/lldb.xcodeproj/project.pbxproj
+++ b/lldb.xcodeproj/project.pbxproj
@@ -445,7 +445,6 @@
49DA65031485C92A005FF180 /* AppleObjCSymbolVendor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49DA65021485C92A005FF180 /* AppleObjCSymbolVendor.cpp */; };
4C6649A014EEE7F100B0316F /* StreamCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C66499F14EEE7F100B0316F /* StreamCallback.h */; };
4C6649A314EEE81000B0316F /* StreamCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C6649A214EEE81000B0316F /* StreamCallback.cpp */; };
- 4CAA56131422D96A001FFA01 /* BreakpointResolverFileRegex.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CAA56121422D96A001FFA01 /* BreakpointResolverFileRegex.h */; };
4CAA56151422D986001FFA01 /* BreakpointResolverFileRegex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CAA56141422D986001FFA01 /* BreakpointResolverFileRegex.cpp */; };
4CABA9E0134A8BCD00539BDD /* ValueObjectMemory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CABA9DF134A8BCD00539BDD /* ValueObjectMemory.cpp */; };
4CCA644D13B40B82003BDF98 /* ItaniumABILanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA643D13B40B82003BDF98 /* ItaniumABILanguageRuntime.cpp */; };
@@ -508,7 +507,6 @@
B2A58722143119810092BFBA /* SBWatchpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = B2A58721143119810092BFBA /* SBWatchpoint.h */; settings = {ATTRIBUTES = (Public, ); }; };
B2A58724143119D50092BFBA /* SBWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2A58723143119D50092BFBA /* SBWatchpoint.cpp */; };
ED236E0814F84F6800153F6F /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDB919B414F6F10D008FF64B /* Security.framework */; };
- EDB919B314F6EC85008FF64B /* LauncherXPCService.h in Headers */ = {isa = PBXBuildFile; fileRef = EDB919B214F6EC85008FF64B /* LauncherXPCService.h */; };
EDB919B714F6F22D008FF64B /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDB919B414F6F10D008FF64B /* Security.framework */; };
EDC6D4AA14E5C49E001B75F8 /* LauncherXPCService.mm in Sources */ = {isa = PBXBuildFile; fileRef = EDC6D49414E5C15C001B75F8 /* LauncherXPCService.mm */; };
EDE274E414EDCE1F005B0F75 /* LauncherXPCService.mm in Sources */ = {isa = PBXBuildFile; fileRef = EDC6D49414E5C15C001B75F8 /* LauncherXPCService.mm */; };
@@ -3103,10 +3101,8 @@
26D265A2136B40EE002EEE45 /* SharingPtr.h in Headers */,
26D265BC136B4269002EEE45 /* lldb-public.h in Headers */,
4CF52AF51428291E0051E832 /* SBFileSpecList.h in Headers */,
- 4CAA56131422D96A001FFA01 /* BreakpointResolverFileRegex.h in Headers */,
26B8283D142D01E9002DBC64 /* SBSection.h in Headers */,
B2A58722143119810092BFBA /* SBWatchpoint.h in Headers */,
- EDB919B314F6EC85008FF64B /* LauncherXPCService.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/scripts/Python/interface/SBTarget.i b/scripts/Python/interface/SBTarget.i
index b6333d4..fccecd3 100644
--- a/scripts/Python/interface/SBTarget.i
+++ b/scripts/Python/interface/SBTarget.i
@@ -669,6 +669,9 @@
GetBroadcaster () const;
lldb::SBInstructionList
+ ReadInstructions (lldb::SBAddress base_addr, uint32_t count);
+
+ lldb::SBInstructionList
GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size);
bool
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();
}