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.

llvm-svn: 152152
This commit is contained in:
Greg Clayton 2012-03-06 22:24:44 +00:00
parent 5652716a7a
commit 9c76611055
7 changed files with 41 additions and 8 deletions

View File

@ -712,6 +712,9 @@ public:
SBSourceManager
GetSourceManager();
lldb::SBInstructionList
ReadInstructions (lldb::SBAddress base_addr, uint32_t count);
lldb::SBInstructionList
GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size);

View File

@ -258,7 +258,8 @@ public:
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,

View File

@ -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;
};

View File

@ -668,6 +668,9 @@ public:
lldb::SBBroadcaster
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);

View File

@ -1992,6 +1992,35 @@ SBTarget::GetSourceManager()
return source_manager;
}
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)
{

View File

@ -240,7 +240,8 @@ Disassembler::DisassembleBytes
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 @@ Disassembler::DisassembleBytes
(void)disasm_sp->DecodeInstructions (start,
data,
0,
UINT32_MAX,
num_instructions,
false);
}
}

View File

@ -115,7 +115,7 @@ UnwindTable::Dump (Stream &s)
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();
}