Convert from the C-based LLVM Disassembler shim to the full MC Disassembler API's.

Calculate "can branch" using the MC API's rather than our hand-rolled regex'es.
As extra credit, allow setting the disassembly flavor for x86 based architectures to intel or att.

<rdar://problem/11319574>
<rdar://problem/9329275>

llvm-svn: 176392
This commit is contained in:
Jim Ingham
2013-03-02 00:26:47 +00:00
parent b1caf3c30e
commit 0f063ba6b4
26 changed files with 528 additions and 168 deletions

View File

@@ -2249,6 +2249,12 @@ SBTarget::GetSourceManager()
lldb::SBInstructionList
SBTarget::ReadInstructions (lldb::SBAddress base_addr, uint32_t count)
{
return ReadInstructions (base_addr, count, NULL);
}
lldb::SBInstructionList
SBTarget::ReadInstructions (lldb::SBAddress base_addr, uint32_t count, const char *flavor_string)
{
SBInstructionList sb_instructions;
@@ -2265,6 +2271,7 @@ SBTarget::ReadInstructions (lldb::SBAddress base_addr, uint32_t count)
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,
flavor_string,
*addr_ptr,
data.GetBytes(),
bytes_read,
@@ -2278,6 +2285,12 @@ SBTarget::ReadInstructions (lldb::SBAddress base_addr, uint32_t count)
lldb::SBInstructionList
SBTarget::GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size)
{
return GetInstructionsWithFlavor (base_addr, NULL, buf, size);
}
lldb::SBInstructionList
SBTarget::GetInstructionsWithFlavor (lldb::SBAddress base_addr, const char *flavor_string, const void *buf, size_t size)
{
SBInstructionList sb_instructions;
@@ -2291,6 +2304,7 @@ SBTarget::GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t si
sb_instructions.SetDisassembler (Disassembler::DisassembleBytes (target_sp->GetArchitecture(),
NULL,
flavor_string,
addr,
buf,
size));
@@ -2302,7 +2316,13 @@ SBTarget::GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t si
lldb::SBInstructionList
SBTarget::GetInstructions (lldb::addr_t base_addr, const void *buf, size_t size)
{
return GetInstructions (ResolveLoadAddress(base_addr), buf, size);
return GetInstructionsWithFlavor (ResolveLoadAddress(base_addr), NULL, buf, size);
}
lldb::SBInstructionList
SBTarget::GetInstructionsWithFlavor (lldb::addr_t base_addr, const char *flavor_string, const void *buf, size_t size)
{
return GetInstructionsWithFlavor (ResolveLoadAddress(base_addr), flavor_string, buf, size);
}
SBError