diff options
author | Greg Clayton <gclayton@apple.com> | 2011-03-19 01:12:21 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2011-03-19 01:12:21 +0000 |
commit | ded470d31aa3a3b1c6b06fc8ae191d210ae089d5 (patch) | |
tree | 57af3b30c78261da0625d9ed4def8ccb212dc078 /lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp | |
parent | 5366ff18659c58ac54ab55db5c6f3cf5d0e01034 (diff) | |
download | bcm5719-llvm-ded470d31aa3a3b1c6b06fc8ae191d210ae089d5.tar.gz bcm5719-llvm-ded470d31aa3a3b1c6b06fc8ae191d210ae089d5.zip |
Added more platform support. There are now some new commands:
platform status -- gets status information for the selected platform
platform create <platform-name> -- creates a new instance of a remote platform
platform list -- list all available platforms
platform select -- select a platform instance as the current platform (not working yet)
When using "platform create" it will create a remote platform and make it the
selected platform. For instances for iPhone OS debugging on Mac OS X one can
do:
(lldb) platform create remote-ios --sdk-version=4.0
Remote platform: iOS platform
SDK version: 4.0
SDK path: "/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0"
Not connected to a remote device.
(lldb) file ~/Documents/a.out
Current executable set to '~/Documents/a.out' (armv6).
(lldb) image list
[ 0] /Volumes/work/gclayton/Documents/devb/attach/a.out
[ 1] /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0/Symbols/usr/lib/dyld
[ 2] /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0/Symbols/usr/lib/libSystem.B.dylib
Note that this is all happening prior to running _or_ connecting to a remote
platform. Once connected to a remote platform the OS version might change which
means we will need to update our dependecies. Also once we run, we will need
to match up the actualy binaries with the actualy UUID's to files in the
SDK, or download and cache them locally.
This is just the start of the remote platforms, but this modification is the
first iteration in getting the platforms really doing something.
llvm-svn: 127934
Diffstat (limited to 'lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp')
-rw-r--r-- | lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp index 9f2ddd845e7..3b10a343209 100644 --- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp +++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp @@ -31,8 +31,8 @@ using namespace lldb; using namespace lldb_private; -static -int DataExtractorByteReader(uint8_t *byte, uint64_t address, void *arg) +static int +DataExtractorByteReader(uint8_t *byte, uint64_t address, void *arg) { DataExtractor &extractor = *((DataExtractor *)arg); @@ -66,7 +66,7 @@ static int IPRegisterReader(uint64_t *value, unsigned regID, void* arg) uint64_t instructionPointer = ((RegisterReaderArg*)arg)->instructionPointer; EDDisassemblerRef disassembler = ((RegisterReaderArg*)arg)->disassembler; - if(EDRegisterIsProgramCounter(disassembler, regID)) { + if (EDRegisterIsProgramCounter(disassembler, regID)) { *value = instructionPointer; return 0; } @@ -371,13 +371,26 @@ DisassemblerLLVM::CreateInstance(const ArchSpec &arch) DisassemblerLLVM::DisassemblerLLVM(const ArchSpec &arch) : Disassembler (arch), - m_disassembler (NULL) + m_disassembler (NULL), + m_disassembler_thumb (NULL) // For ARM only { const std::string &arch_triple = arch.GetTriple().str(); if (!arch_triple.empty()) { if (EDGetDisassembler(&m_disassembler, arch_triple.c_str(), SyntaxForArchSpec (arch))) m_disassembler = NULL; + llvm::Triple::ArchType llvm_arch = arch.GetTriple().getArch(); + if (llvm_arch == llvm::Triple::arm) + { + if (EDGetDisassembler(&m_disassembler_thumb, "thumb-apple-darwin", kEDAssemblySyntaxARMUAL)) + m_disassembler_thumb = NULL; + } + else if (llvm_arch == llvm::Triple::thumb) + { + m_disassembler_thumb = m_disassembler; + if (EDGetDisassembler(&m_disassembler, "arm-apple-darwin-unknown", kEDAssemblySyntaxARMUAL)) + m_disassembler = NULL; + } } } @@ -405,7 +418,18 @@ DisassemblerLLVM::DecodeInstructions { Address inst_addr (base_addr); inst_addr.Slide(data_offset); - InstructionSP inst_sp (new InstructionLLVM(m_disassembler, inst_addr)); + + bool use_thumb = false; + // If we have a thumb disassembler, then we have an ARM architecture + // so we need to check what the instruction address class is to make + // sure we shouldn't be disassembling as thumb... + if (m_disassembler_thumb) + { + if (inst_addr.GetAddressClass () == eAddressClassCodeAlternateISA) + use_thumb = true; + } + InstructionSP inst_sp (new InstructionLLVM (use_thumb ? m_disassembler_thumb : m_disassembler, + inst_addr)); size_t inst_byte_size = inst_sp->Extract (data, data_offset); |