summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins')
-rw-r--r--lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp34
-rw-r--r--lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h1
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp103
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h3
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp117
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h18
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp613
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h123
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp48
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h6
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp49
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h6
12 files changed, 1003 insertions, 118 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);
diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h
index 69ac743fcf2..842c03d5dcd 100644
--- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h
+++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h
@@ -100,6 +100,7 @@ protected:
}
EDDisassemblerRef m_disassembler;
+ EDDisassemblerRef m_disassembler_thumb;
};
#endif // liblldb_DisassemblerLLVM_h_
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 56d3daf6d5e..72c21fede3a 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -29,6 +29,7 @@ using namespace lldb;
using namespace lldb_private;
using namespace llvm::MachO;
+#define MACHO_NLIST_ARM_SYMBOL_IS_THUMB 0x0008
void
ObjectFileMachO::Initialize()
@@ -201,6 +202,108 @@ ObjectFileMachO::GetAddressByteSize () const
return m_data.GetAddressByteSize ();
}
+lldb::AddressClass
+ObjectFileMachO::GetAddressClass (lldb::addr_t file_addr)
+{
+ Symtab *symtab = GetSymtab();
+ if (symtab)
+ {
+ Symbol *symbol = symtab->FindSymbolContainingFileAddress(file_addr);
+ if (symbol)
+ {
+ const AddressRange *range_ptr = symbol->GetAddressRangePtr();
+ if (range_ptr)
+ {
+ const Section *section = range_ptr->GetBaseAddress().GetSection();
+ if (section)
+ {
+ const lldb::SectionType section_type = section->GetType();
+ switch (section_type)
+ {
+ case eSectionTypeInvalid: return eAddressClassUnknown;
+ case eSectionTypeCode:
+ if (m_header.cputype == llvm::MachO::CPUTypeARM)
+ {
+ // For ARM we have a bit in the n_desc field of the symbol
+ // that tells us ARM/Thumb which is bit 0x0008.
+ if (symbol->GetFlags() & MACHO_NLIST_ARM_SYMBOL_IS_THUMB)
+ return eAddressClassCodeAlternateISA;
+ }
+ return eAddressClassCode;
+
+ case eSectionTypeContainer: return eAddressClassUnknown;
+ case eSectionTypeData: return eAddressClassData;
+ case eSectionTypeDataCString: return eAddressClassDataConst;
+ case eSectionTypeDataCStringPointers: return eAddressClassData;
+ case eSectionTypeDataSymbolAddress: return eAddressClassData;
+ case eSectionTypeData4: return eAddressClassData;
+ case eSectionTypeData8: return eAddressClassData;
+ case eSectionTypeData16: return eAddressClassData;
+ case eSectionTypeDataPointers: return eAddressClassData;
+ case eSectionTypeZeroFill: return eAddressClassData;
+ case eSectionTypeDataObjCMessageRefs: return eAddressClassDataConst;
+ case eSectionTypeDataObjCCFStrings: return eAddressClassDataConst;
+ case eSectionTypeDebug: return eAddressClassDebug;
+ case eSectionTypeDWARFDebugAbbrev: return eAddressClassDebug;
+ case eSectionTypeDWARFDebugAranges: return eAddressClassDebug;
+ case eSectionTypeDWARFDebugFrame: return eAddressClassDebug;
+ case eSectionTypeDWARFDebugInfo: return eAddressClassDebug;
+ case eSectionTypeDWARFDebugLine: return eAddressClassDebug;
+ case eSectionTypeDWARFDebugLoc: return eAddressClassDebug;
+ case eSectionTypeDWARFDebugMacInfo: return eAddressClassDebug;
+ case eSectionTypeDWARFDebugPubNames: return eAddressClassDebug;
+ case eSectionTypeDWARFDebugPubTypes: return eAddressClassDebug;
+ case eSectionTypeDWARFDebugRanges: return eAddressClassDebug;
+ case eSectionTypeDWARFDebugStr: return eAddressClassDebug;
+ case eSectionTypeEHFrame: return eAddressClassRuntime;
+ case eSectionTypeOther: return eAddressClassUnknown;
+ }
+ }
+ }
+
+ const lldb::SymbolType symbol_type = symbol->GetType();
+ switch (symbol_type)
+ {
+ case eSymbolTypeAny: return eAddressClassUnknown;
+ case eSymbolTypeAbsolute: return eAddressClassUnknown;
+ case eSymbolTypeExtern: return eAddressClassUnknown;
+
+ case eSymbolTypeCode:
+ case eSymbolTypeTrampoline:
+ if (m_header.cputype == llvm::MachO::CPUTypeARM)
+ {
+ // For ARM we have a bit in the n_desc field of the symbol
+ // that tells us ARM/Thumb which is bit 0x0008.
+ if (symbol->GetFlags() & MACHO_NLIST_ARM_SYMBOL_IS_THUMB)
+ return eAddressClassCodeAlternateISA;
+ }
+ return eAddressClassCode;
+
+ case eSymbolTypeData: return eAddressClassData;
+ case eSymbolTypeRuntime: return eAddressClassRuntime;
+ case eSymbolTypeException: return eAddressClassRuntime;
+ case eSymbolTypeSourceFile: return eAddressClassDebug;
+ case eSymbolTypeHeaderFile: return eAddressClassDebug;
+ case eSymbolTypeObjectFile: return eAddressClassDebug;
+ case eSymbolTypeCommonBlock: return eAddressClassDebug;
+ case eSymbolTypeBlock: return eAddressClassDebug;
+ case eSymbolTypeLocal: return eAddressClassData;
+ case eSymbolTypeParam: return eAddressClassData;
+ case eSymbolTypeVariable: return eAddressClassData;
+ case eSymbolTypeVariableType: return eAddressClassDebug;
+ case eSymbolTypeLineEntry: return eAddressClassDebug;
+ case eSymbolTypeLineHeader: return eAddressClassDebug;
+ case eSymbolTypeScopeBegin: return eAddressClassDebug;
+ case eSymbolTypeScopeEnd: return eAddressClassDebug;
+ case eSymbolTypeAdditional: return eAddressClassUnknown;
+ case eSymbolTypeCompiler: return eAddressClassDebug;
+ case eSymbolTypeInstrumentation:return eAddressClassDebug;
+ case eSymbolTypeUndefined: return eAddressClassUnknown;
+ }
+ }
+ }
+ return eAddressClassUnknown;
+}
Symtab *
ObjectFileMachO::GetSymtab()
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
index c079fe419de..bd25062c38e 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
@@ -74,6 +74,9 @@ public:
virtual size_t
GetAddressByteSize () const;
+ virtual lldb::AddressClass
+ GetAddressClass (lldb::addr_t file_addr);
+
virtual lldb_private::Symtab *
GetSymtab();
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
index b1df7ba6bb8..8c1ef1d5c9d 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -10,16 +10,20 @@
#include "PlatformMacOSX.h"
// C Includes
+#include <sys/sysctl.h>
+
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Error.h"
+#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
using namespace lldb;
using namespace lldb_private;
@@ -29,6 +33,7 @@ PlatformMacOSX::Initialize ()
{
#if defined (__APPLE__)
PlatformSP default_platform_sp (new PlatformMacOSX());
+ default_platform_sp->SetSystemArchitecture (Host::GetArchitecture());
Platform::SetDefaultPlatform (default_platform_sp);
#endif
}
@@ -38,7 +43,6 @@ PlatformMacOSX::Terminate ()
{
}
-
Error
PlatformMacOSX::ResolveExecutable (const FileSpec &exe_file,
const ArchSpec &exe_arch,
@@ -142,11 +146,58 @@ PlatformMacOSX::GetFile (const FileSpec &platform_file, FileSpec &local_file)
}
+void
+PlatformMacOSX::GetStatus (Stream &strm)
+{
+ char sysctlstring[1024];
+ size_t datalen;
+ int mib[CTL_MAXNAME];
+
+ uint32_t major = UINT32_MAX;
+ uint32_t minor = UINT32_MAX;
+ uint32_t update = UINT32_MAX;
+ strm.PutCString("Host platform: Mac OS X Native\n");
+ if (GetOSVersion(major, minor, update))
+ {
+ strm.Printf("OS version: %u", major);
+ if (minor != UINT32_MAX)
+ strm.Printf(".%u", minor);
+ if (update != UINT32_MAX)
+ strm.Printf(".%u", update);
+
+
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_OSVERSION;
+ datalen = sizeof(sysctlstring);
+ if (::sysctl (mib, 2, sysctlstring, &datalen, NULL, 0) == 0)
+ {
+ sysctlstring[datalen] = '\0';
+ strm.Printf(" (%s)", sysctlstring);
+ }
+
+ strm.EOL();
+ }
+
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_VERSION;
+ datalen = sizeof(sysctlstring);
+ if (::sysctl (mib, 2, sysctlstring, &datalen, NULL, 0) == 0)
+ {
+ sysctlstring[datalen] = '\0';
+ strm.Printf("Kernel version: %s\n", sysctlstring);
+ }
+}
+
+
//------------------------------------------------------------------
/// Default Constructor
//------------------------------------------------------------------
PlatformMacOSX::PlatformMacOSX () :
- Platform()
+#if defined (__APPLE__)
+ Platform(true) // This is the local host platform
+#else
+ Platform(false) // This is a remote platform
+#endif
{
}
@@ -197,3 +248,65 @@ PlatformMacOSX::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
}
return false;
}
+
+size_t
+PlatformMacOSX::GetSoftwareBreakpointTrapOpcode (Target &target, BreakpointSite *bp_site)
+{
+ const uint8_t *trap_opcode = NULL;
+ uint32_t trap_opcode_size = 0;
+
+ llvm::Triple::ArchType machine = target.GetArchitecture().GetMachine();
+ switch (machine)
+ {
+ case llvm::Triple::x86:
+ case llvm::Triple::x86_64:
+ {
+ static const uint8_t g_i386_breakpoint_opcode[] = { 0xCC };
+ trap_opcode = g_i386_breakpoint_opcode;
+ trap_opcode_size = sizeof(g_i386_breakpoint_opcode);
+ }
+ break;
+
+ case llvm::Triple::arm:
+ {
+ static const uint8_t g_arm_breakpoint_opcode[] = { 0xFE, 0xDE, 0xFF, 0xE7 };
+ static const uint8_t g_thumb_breakpooint_opcode[] = { 0xFE, 0xDE };
+
+ lldb::BreakpointLocationSP bp_loc_sp (bp_site->GetOwnerAtIndex (0));
+ if (bp_loc_sp)
+ {
+ const AddressClass addr_class = bp_loc_sp->GetAddress().GetAddressClass ();
+ if (addr_class == eAddressClassCodeAlternateISA)
+ {
+ trap_opcode = g_thumb_breakpooint_opcode;
+ trap_opcode_size = sizeof(g_thumb_breakpooint_opcode);
+ break;
+ }
+ }
+ trap_opcode = g_arm_breakpoint_opcode;
+ trap_opcode_size = sizeof(g_arm_breakpoint_opcode);
+ }
+ break;
+
+ case llvm::Triple::ppc:
+ case llvm::Triple::ppc64:
+ {
+ static const uint8_t g_ppc_breakpoint_opcode[] = { 0x7F, 0xC0, 0x00, 0x08 };
+ trap_opcode = g_ppc_breakpoint_opcode;
+ trap_opcode_size = sizeof(g_ppc_breakpoint_opcode);
+ }
+ break;
+
+ default:
+ assert(!"Unhandled architecture in ProcessMacOSX::GetSoftwareBreakpointTrapOpcode()");
+ break;
+ }
+
+ if (trap_opcode && trap_opcode_size)
+ {
+ if (bp_site->SetTrapOpcode(trap_opcode, trap_opcode_size))
+ return trap_opcode_size;
+ }
+ return 0;
+
+}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
index 037cac28e74..4b0db1584a4 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
@@ -45,7 +45,7 @@ namespace lldb_private {
virtual const char *
GetShortPluginName()
{
- return "platform.macosx";
+ return "local-macosx";
}
virtual uint32_t
@@ -63,6 +63,15 @@ namespace lldb_private {
const ArchSpec &arch,
lldb::ModuleSP &module_sp);
+ virtual const char *
+ GetDescription ()
+ {
+ return "The native host platform on MacOSX.";
+ }
+
+ virtual void
+ GetStatus (Stream &strm);
+
virtual Error
GetFile (const FileSpec &platform_file, FileSpec &local_file);
@@ -77,9 +86,10 @@ namespace lldb_private {
virtual bool
GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch);
- protected:
-
-
+ virtual size_t
+ GetSoftwareBreakpointTrapOpcode (Target &target,
+ BreakpointSite *bp_site);
+
private:
DISALLOW_COPY_AND_ASSIGN (PlatformMacOSX);
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
new file mode 100644
index 00000000000..03af1ddfb1f
--- /dev/null
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
@@ -0,0 +1,613 @@
+//===-- Platform.cpp --------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "PlatformRemoteiOS.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Breakpoint/BreakpointLocation.h"
+#include "lldb/Core/ArchSpec.h"
+#include "lldb/Core/Error.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleList.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/StreamString.h"
+#include "lldb/Host/FileSpec.h"
+#include "lldb/Host/Host.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+void
+PlatformRemoteiOS::Initialize ()
+{
+ static bool g_initialized = false;
+
+ if (g_initialized == false)
+ {
+ g_initialized = true;
+ PluginManager::RegisterPlugin (GetShortPluginNameStatic(),
+ GetDescriptionStatic(),
+ CreateInstance);
+ }
+}
+
+Platform*
+PlatformRemoteiOS::CreateInstance ()
+{
+ return new PlatformRemoteiOS ();
+}
+
+void
+PlatformRemoteiOS::Terminate ()
+{
+}
+
+const char *
+PlatformRemoteiOS::GetPluginNameStatic ()
+{
+ return "PlatformRemoteiOS";
+}
+
+const char *
+PlatformRemoteiOS::GetShortPluginNameStatic()
+{
+ return "remote-ios";
+}
+
+const char *
+PlatformRemoteiOS::GetDescriptionStatic()
+{
+ return "Remote iOS platform plug-in.";
+}
+
+
+void
+PlatformRemoteiOS::GetStatus (Stream &strm)
+{
+ uint32_t major = UINT32_MAX;
+ uint32_t minor = UINT32_MAX;
+ uint32_t update = UINT32_MAX;
+ const char *sdk_directory = GetDeviceSupportDirectoryForOSVersion();
+ strm.PutCString ("Remote platform: iOS platform\n");
+ if (GetOSVersion(major, minor, update))
+ {
+ strm.Printf("SDK version: %u", major);
+ if (minor != UINT32_MAX)
+ strm.Printf(".%u", minor);
+ if (update != UINT32_MAX)
+ strm.Printf(".%u", update);
+ strm.EOL();
+ }
+
+ if (!m_build_update.empty())
+ strm.Printf("SDK update: %s\n", m_build_update.c_str());
+
+ if (sdk_directory)
+ strm.Printf ("SDK path: \"%s\"\n", sdk_directory);
+ else
+ strm.PutCString ("SDK path: error: unable to locate SDK\n");
+
+ if (IsConnected())
+ strm.Printf("Connected to: %s\n", m_remote_url.c_str());
+ else
+ strm.PutCString("Not connected to a remote device.\n");
+}
+
+
+Error
+PlatformRemoteiOS::ResolveExecutable (const FileSpec &exe_file,
+ const ArchSpec &exe_arch,
+ lldb::ModuleSP &exe_module_sp)
+{
+ Error error;
+ // Nothing special to do here, just use the actual file and architecture
+
+ FileSpec resolved_exe_file (exe_file);
+
+ // If we have "ls" as the exe_file, resolve the executable loation based on
+ // the current path variables
+ // TODO: resolve bare executables in the Platform SDK
+// if (!resolved_exe_file.Exists())
+// resolved_exe_file.ResolveExecutableLocation ();
+
+ // Resolve any executable within a bundle on MacOSX
+ // TODO: verify that this handles shallow bundles, if not then implement one ourselves
+ Host::ResolveExecutableInBundle (resolved_exe_file);
+
+ if (resolved_exe_file.Exists())
+ {
+ if (exe_arch.IsValid())
+ {
+ error = ModuleList::GetSharedModule (resolved_exe_file,
+ exe_arch,
+ NULL,
+ NULL,
+ 0,
+ exe_module_sp,
+ NULL,
+ NULL);
+
+ if (exe_module_sp->GetObjectFile() == NULL)
+ {
+ exe_module_sp.reset();
+ error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain the architecture %s",
+ exe_file.GetDirectory().AsCString(""),
+ exe_file.GetDirectory() ? "/" : "",
+ exe_file.GetFilename().AsCString(""),
+ exe_arch.GetArchitectureName());
+ }
+ }
+ else
+ {
+ // No valid architecture was specified, ask the platform for
+ // the architectures that we should be using (in the correct order)
+ // and see if we can find a match that way
+ StreamString arch_names;
+ ArchSpec platform_arch;
+ for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, platform_arch); ++idx)
+ {
+ error = ModuleList::GetSharedModule (resolved_exe_file,
+ platform_arch,
+ NULL,
+ NULL,
+ 0,
+ exe_module_sp,
+ NULL,
+ NULL);
+ // Did we find an executable using one of the
+ if (error.Success())
+ {
+ if (exe_module_sp && exe_module_sp->GetObjectFile())
+ break;
+ else
+ error.SetErrorToGenericError();
+ }
+
+ if (idx > 0)
+ arch_names.PutCString (", ");
+ arch_names.PutCString (platform_arch.GetArchitectureName());
+ }
+
+ if (error.Fail() || !exe_module_sp)
+ {
+ error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain any '%s' platform architectures: %s",
+ exe_file.GetDirectory().AsCString(""),
+ exe_file.GetDirectory() ? "/" : "",
+ exe_file.GetFilename().AsCString(""),
+ GetShortPluginName(),
+ arch_names.GetString().c_str());
+ }
+ }
+ }
+ else
+ {
+ error.SetErrorStringWithFormat ("'%s%s%s' does not exist",
+ exe_file.GetDirectory().AsCString(""),
+ exe_file.GetDirectory() ? "/" : "",
+ exe_file.GetFilename().AsCString(""));
+ }
+
+ return error;
+}
+
+const char *
+PlatformRemoteiOS::GetDeviceSupportDirectory()
+{
+ if (m_device_support_directory.empty())
+ {
+ bool developer_dir_path_valid = false;
+ char developer_dir_path[PATH_MAX];
+ FileSpec temp_file_spec;
+ if (Host::GetLLDBPath (ePathTypeLLDBShlibDir, temp_file_spec))
+ {
+ if (temp_file_spec.GetPath (developer_dir_path, sizeof(developer_dir_path)))
+ {
+ char *lib_priv_frameworks = strstr (developer_dir_path, "/Library/PrivateFrameworks/LLDB.framework");
+ if (lib_priv_frameworks)
+ {
+ *lib_priv_frameworks = '\0';
+ developer_dir_path_valid = true;
+ }
+ }
+ }
+
+ if (!developer_dir_path_valid)
+ {
+ std::string xcode_dir_path;
+ const char *xcode_select_prefix_dir = getenv ("XCODE_SELECT_PREFIX_DIR");
+ if (xcode_select_prefix_dir)
+ xcode_dir_path.append (xcode_select_prefix_dir);
+ xcode_dir_path.append ("/usr/share/xcode-select/xcode_dir_path");
+ temp_file_spec.SetFile(xcode_dir_path.c_str(), false);
+ size_t bytes_read = temp_file_spec.ReadFileContents(0, developer_dir_path, sizeof(developer_dir_path));
+ if (bytes_read > 0)
+ {
+ developer_dir_path[bytes_read] = '\0';
+ while (developer_dir_path[bytes_read-1] == '\r' ||
+ developer_dir_path[bytes_read-1] == '\n')
+ developer_dir_path[--bytes_read] = '\0';
+ developer_dir_path_valid = true;
+ }
+ }
+
+ if (developer_dir_path_valid)
+ {
+ temp_file_spec.SetFile (developer_dir_path, false);
+ if (temp_file_spec.Exists())
+ {
+ m_device_support_directory.assign (developer_dir_path);
+ return m_device_support_directory.c_str();
+ }
+ }
+ // Assign a single NULL character so we know we tried to find the device
+ // support directory and we don't keep trying to find it over and over.
+ m_device_support_directory.assign (1, '\0');
+ }
+
+ // We should have put a single NULL character into m_device_support_directory
+ // or it should have a valid path if the code gets here
+ assert (m_device_support_directory.empty() == false);
+ if (m_device_support_directory[0])
+ return m_device_support_directory.c_str();
+ return NULL;
+}
+
+const char *
+PlatformRemoteiOS::GetDeviceSupportDirectoryForOSVersion()
+{
+ if (m_device_support_directory_for_os_version.empty())
+ {
+ const char *device_support_dir = GetDeviceSupportDirectory();
+ const bool resolve_path = true;
+ if (device_support_dir)
+ {
+ m_device_support_directory_for_os_version.assign (device_support_dir);
+ m_device_support_directory_for_os_version.append ("/Platforms/iPhoneOS.platform/DeviceSupport");
+
+ uint32_t major = 0;
+ uint32_t minor = 0;
+ uint32_t update = 0;
+ FileSpec file_spec;
+ char resolved_path[PATH_MAX];
+ if (GetOSVersion(major, minor, update))
+ {
+ if (major != UINT32_MAX && minor != UINT32_MAX && update != UINT32_MAX)
+ {
+ ::snprintf (resolved_path,
+ sizeof(resolved_path),
+ "%s/%i.%i.%i",
+ m_device_support_directory_for_os_version.c_str(),
+ major,
+ minor,
+ update);
+
+ file_spec.SetFile(resolved_path, resolve_path);
+ if (file_spec.Exists() && file_spec.GetPath(resolved_path, sizeof(resolved_path)))
+ {
+ m_device_support_directory_for_os_version.assign (resolved_path);
+ return m_device_support_directory_for_os_version.c_str();
+ }
+ }
+
+ if (major != UINT32_MAX && minor != UINT32_MAX)
+ {
+ ::snprintf (resolved_path,
+ sizeof(resolved_path),
+ "%s/%i.%i",
+ m_device_support_directory_for_os_version.c_str(),
+ major,
+ minor,
+ update);
+
+ file_spec.SetFile(resolved_path, resolve_path);
+ if (file_spec.Exists() && file_spec.GetPath(resolved_path, sizeof(resolved_path)))
+ {
+ m_device_support_directory_for_os_version.assign (resolved_path);
+ return m_device_support_directory_for_os_version.c_str();
+ }
+ }
+ }
+ else
+ {
+ // Use the default as we have no OS version selected
+ m_device_support_directory_for_os_version.append ("/Latest");
+ file_spec.SetFile(m_device_support_directory_for_os_version.c_str(), resolve_path);
+
+ if (file_spec.Exists() && file_spec.GetPath(resolved_path, sizeof(resolved_path)))
+ {
+ if (m_major_os_version == UINT32_MAX)
+ {
+ const char *resolved_latest_dirname = file_spec.GetFilename().GetCString();
+ const char *pos = Args::StringToVersion (resolved_latest_dirname,
+ m_major_os_version,
+ m_minor_os_version,
+ m_update_os_version);
+
+ if (m_build_update.empty() && pos[0] == ' ' && pos[1] == '(')
+ {
+ const char *end_paren = strchr (pos + 2, ')');
+ m_build_update.assign (pos + 2, end_paren);
+ }
+ }
+ m_device_support_directory_for_os_version.assign (resolved_path);
+ return m_device_support_directory_for_os_version.c_str();
+ }
+ }
+ }
+ // Assign a single NULL character so we know we tried to find the device
+ // support directory and we don't keep trying to find it over and over.
+ m_device_support_directory_for_os_version.assign (1, '\0');
+ }
+ // We should have put a single NULL character into m_device_support_directory_for_os_version
+ // or it should have a valid path if the code gets here
+ assert (m_device_support_directory_for_os_version.empty() == false);
+ if (m_device_support_directory_for_os_version[0])
+ return m_device_support_directory_for_os_version.c_str();
+ return NULL;
+}
+
+Error
+PlatformRemoteiOS::GetFile (const FileSpec &platform_file,
+ FileSpec &local_file)
+{
+ Error error;
+ char platform_file_path[PATH_MAX];
+ if (platform_file.GetPath(platform_file_path, sizeof(platform_file_path)))
+ {
+ char resolved_path[PATH_MAX];
+
+ const char * os_version_dir = GetDeviceSupportDirectoryForOSVersion();
+ if (os_version_dir)
+ {
+ ::snprintf (resolved_path,
+ sizeof(resolved_path),
+ "%s/Symbols.Internal/%s",
+ os_version_dir,
+ platform_file_path);
+
+ local_file.SetFile(resolved_path, true);
+ if (local_file.Exists())
+ return error;
+ ::snprintf (resolved_path,
+ sizeof(resolved_path),
+ "%s/Symbols/%s",
+ os_version_dir,
+ platform_file_path);
+
+ local_file.SetFile(resolved_path, true);
+ if (local_file.Exists())
+ return error;
+
+ }
+ local_file = platform_file;
+ if (local_file.Exists())
+ return error;
+
+ error.SetErrorStringWithFormat ("unable to locate a platform file for '%s' in platform '%s'",
+ platform_file_path,
+ GetPluginName());
+ }
+ else
+ {
+ error.SetErrorString ("invalid platform file argument");
+ }
+ return error;
+}
+
+//------------------------------------------------------------------
+/// Default Constructor
+//------------------------------------------------------------------
+PlatformRemoteiOS::PlatformRemoteiOS () :
+ Platform(false), // This is a remote platform
+ m_device_support_directory (),
+ m_device_support_directory_for_os_version ()
+{
+}
+
+//------------------------------------------------------------------
+/// Destructor.
+///
+/// The destructor is virtual since this class is designed to be
+/// inherited from by the plug-in instance.
+//------------------------------------------------------------------
+PlatformRemoteiOS::~PlatformRemoteiOS()
+{
+}
+
+uint32_t
+PlatformRemoteiOS::FindProcessesByName (const char *name_match,
+ lldb::NameMatchType name_match_type,
+ ProcessInfoList &process_infos)
+{
+ // TODO: if connected, send a packet to get the remote process infos by name
+ process_infos.Clear();
+ return 0;
+}
+
+bool
+PlatformRemoteiOS::GetProcessInfo (lldb::pid_t pid, ProcessInfo &process_info)
+{
+ // TODO: if connected, send a packet to get the remote process info
+ process_info.Clear();
+ return false;
+}
+
+bool
+PlatformRemoteiOS::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
+{
+ ArchSpec system_arch (GetSystemArchitecture());
+ const ArchSpec::Core system_core = system_arch.GetCore();
+ switch (system_core)
+ {
+ default:
+ switch (idx)
+ {
+ case 0: arch.SetTriple ("armv7-apple-darwin"); return true;
+ case 1: arch.SetTriple ("armv7f-apple-darwin"); return true;
+ case 2: arch.SetTriple ("armv7k-apple-darwin"); return true;
+ case 3: arch.SetTriple ("armv7s-apple-darwin"); return true;
+ case 4: arch.SetTriple ("armv6-apple-darwin"); return true;
+ case 5: arch.SetTriple ("armv5-apple-darwin"); return true;
+ case 6: arch.SetTriple ("armv4-apple-darwin"); return true;
+ case 7: arch.SetTriple ("arm-apple-darwin"); return true;
+ default: break;
+ }
+ break;
+
+ case ArchSpec::eCore_arm_armv7f:
+ switch (idx)
+ {
+ case 0: arch.SetTriple ("armv7f-apple-darwin"); return true;
+ case 1: arch.SetTriple ("armv7-apple-darwin"); return true;
+ case 2: arch.SetTriple ("armv6-apple-darwin"); return true;
+ case 3: arch.SetTriple ("armv5-apple-darwin"); return true;
+ case 4: arch.SetTriple ("armv4-apple-darwin"); return true;
+ case 5: arch.SetTriple ("arm-apple-darwin"); return true;
+ default: break;
+ }
+ break;
+
+ case ArchSpec::eCore_arm_armv7k:
+ switch (idx)
+ {
+ case 0: arch.SetTriple ("armv7k-apple-darwin"); return true;
+ case 1: arch.SetTriple ("armv7-apple-darwin"); return true;
+ case 2: arch.SetTriple ("armv6-apple-darwin"); return true;
+ case 3: arch.SetTriple ("armv5-apple-darwin"); return true;
+ case 4: arch.SetTriple ("armv4-apple-darwin"); return true;
+ case 5: arch.SetTriple ("arm-apple-darwin"); return true;
+ default: break;
+ }
+ break;
+
+ case ArchSpec::eCore_arm_armv7s:
+ switch (idx)
+ {
+ case 0: arch.SetTriple ("armv7s-apple-darwin"); return true;
+ case 1: arch.SetTriple ("armv7-apple-darwin"); return true;
+ case 2: arch.SetTriple ("armv6-apple-darwin"); return true;
+ case 3: arch.SetTriple ("armv5-apple-darwin"); return true;
+ case 4: arch.SetTriple ("armv4-apple-darwin"); return true;
+ case 5: arch.SetTriple ("arm-apple-darwin"); return true;
+ default: break;
+ }
+ break;
+
+ case ArchSpec::eCore_arm_armv7:
+ switch (idx)
+ {
+ case 0: arch.SetTriple ("armv7-apple-darwin"); return true;
+ case 1: arch.SetTriple ("armv6-apple-darwin"); return true;
+ case 2: arch.SetTriple ("armv5-apple-darwin"); return true;
+ case 3: arch.SetTriple ("armv4-apple-darwin"); return true;
+ case 4: arch.SetTriple ("arm-apple-darwin"); return true;
+ default: break;
+ }
+ break;
+
+ case ArchSpec::eCore_arm_armv6:
+ switch (idx)
+ {
+ case 0: arch.SetTriple ("armv6-apple-darwin"); return true;
+ case 1: arch.SetTriple ("armv5-apple-darwin"); return true;
+ case 2: arch.SetTriple ("armv4-apple-darwin"); return true;
+ case 3: arch.SetTriple ("arm-apple-darwin"); return true;
+ default: break;
+ }
+ break;
+
+ case ArchSpec::eCore_arm_armv5:
+ switch (idx)
+ {
+ case 0: arch.SetTriple ("armv5-apple-darwin"); return true;
+ case 1: arch.SetTriple ("armv4-apple-darwin"); return true;
+ case 2: arch.SetTriple ("arm-apple-darwin"); return true;
+ default: break;
+ }
+ break;
+
+ case ArchSpec::eCore_arm_armv4:
+ switch (idx)
+ {
+ case 0: arch.SetTriple ("armv4-apple-darwin"); return true;
+ case 1: arch.SetTriple ("arm-apple-darwin"); return true;
+ default: break;
+ }
+ break;
+ }
+ arch.Clear();
+ return false;
+}
+
+size_t
+PlatformRemoteiOS::GetSoftwareBreakpointTrapOpcode (Target &target, BreakpointSite *bp_site)
+{
+ const uint8_t *trap_opcode = NULL;
+ uint32_t trap_opcode_size = 0;
+
+ llvm::Triple::ArchType machine = target.GetArchitecture().GetMachine();
+ switch (machine)
+ {
+ case llvm::Triple::x86:
+ case llvm::Triple::x86_64:
+ {
+ static const uint8_t g_i386_breakpoint_opcode[] = { 0xCC };
+ trap_opcode = g_i386_breakpoint_opcode;
+ trap_opcode_size = sizeof(g_i386_breakpoint_opcode);
+ }
+ break;
+
+ case llvm::Triple::arm:
+ {
+ static const uint8_t g_arm_breakpoint_opcode[] = { 0xFE, 0xDE, 0xFF, 0xE7 };
+ static const uint8_t g_thumb_breakpooint_opcode[] = { 0xFE, 0xDE };
+
+ lldb::BreakpointLocationSP bp_loc_sp (bp_site->GetOwnerAtIndex (0));
+ if (bp_loc_sp)
+ {
+ const AddressClass addr_class = bp_loc_sp->GetAddress().GetAddressClass ();
+ if (addr_class == eAddressClassCodeAlternateISA)
+ {
+ trap_opcode = g_thumb_breakpooint_opcode;
+ trap_opcode_size = sizeof(g_thumb_breakpooint_opcode);
+ break;
+ }
+ }
+ trap_opcode = g_arm_breakpoint_opcode;
+ trap_opcode_size = sizeof(g_arm_breakpoint_opcode);
+ }
+ break;
+
+ case llvm::Triple::ppc:
+ case llvm::Triple::ppc64:
+ {
+ static const uint8_t g_ppc_breakpoint_opcode[] = { 0x7F, 0xC0, 0x00, 0x08 };
+ trap_opcode = g_ppc_breakpoint_opcode;
+ trap_opcode_size = sizeof(g_ppc_breakpoint_opcode);
+ }
+ break;
+
+ default:
+ assert(!"Unhandled architecture in ProcessMacOSX::GetSoftwareBreakpointTrapOpcode()");
+ break;
+ }
+
+ if (trap_opcode && trap_opcode_size)
+ {
+ if (bp_site->SetTrapOpcode(trap_opcode, trap_opcode_size))
+ return trap_opcode_size;
+ }
+ return 0;
+
+}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
new file mode 100644
index 00000000000..5c0f075b41c
--- /dev/null
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
@@ -0,0 +1,123 @@
+//===-- PlatformRemoteiOS.h ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_PlatformRemoteiOS_h_
+#define liblldb_PlatformRemoteiOS_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Target/Platform.h"
+
+namespace lldb_private {
+
+ class PlatformRemoteiOS : public Platform
+ {
+ public:
+
+ static Platform*
+ CreateInstance ();
+
+ static void
+ Initialize ();
+
+ static void
+ Terminate ();
+
+ PlatformRemoteiOS ();
+
+ virtual
+ ~PlatformRemoteiOS();
+
+ //------------------------------------------------------------
+ // lldb_private::PluginInterface functions
+ //------------------------------------------------------------
+
+ static const char *
+ GetPluginNameStatic ();
+
+ static const char *
+ GetShortPluginNameStatic();
+
+ static const char *
+ GetDescriptionStatic();
+
+ virtual const char *
+ GetPluginName()
+ {
+ return GetPluginNameStatic();
+ }
+
+ virtual const char *
+ GetShortPluginName()
+ {
+ return GetShortPluginNameStatic();
+ }
+
+ virtual uint32_t
+ GetPluginVersion()
+ {
+ return 1;
+ }
+
+ //------------------------------------------------------------
+ // lldb_private::Platform functions
+ //------------------------------------------------------------
+ virtual Error
+ ResolveExecutable (const FileSpec &exe_file,
+ const ArchSpec &arch,
+ lldb::ModuleSP &module_sp);
+
+ virtual const char *
+ GetDescription ()
+ {
+ return GetDescriptionStatic();
+ }
+
+ virtual void
+ GetStatus (Stream &strm);
+
+ virtual Error
+ GetFile (const FileSpec &platform_file, FileSpec &local_file);
+
+ virtual uint32_t
+ FindProcessesByName (const char *name_match,
+ lldb::NameMatchType name_match_type,
+ ProcessInfoList &process_infos);
+
+ virtual bool
+ GetProcessInfo (lldb::pid_t pid, ProcessInfo &proc_info);
+
+ virtual bool
+ GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch);
+
+ virtual size_t
+ GetSoftwareBreakpointTrapOpcode (Target &target,
+ BreakpointSite *bp_site);
+
+ protected:
+ std::string m_device_support_directory;
+ std::string m_device_support_directory_for_os_version;
+ std::string m_build_update;
+ //std::vector<FileSpec> m_device_support_os_dirs;
+
+ const char *
+ GetDeviceSupportDirectory();
+
+ const char *
+ GetDeviceSupportDirectoryForOSVersion();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN (PlatformRemoteiOS);
+
+ };
+} // namespace lldb_private
+
+#endif // liblldb_Platform_h_
diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
index 3106e34565c..baa12e14e06 100644
--- a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
@@ -183,7 +183,7 @@ using namespace lldb_private;
const char *
ProcessMacOSX::GetPluginNameStatic()
{
- return "process.macosx";
+ return "macosx-user";
}
const char *
@@ -455,52 +455,6 @@ ProcessMacOSX::DoResume ()
return error;
}
-size_t
-ProcessMacOSX::GetSoftwareBreakpointTrapOpcode (BreakpointSite* bp_site)
-{
- const uint8_t *trap_opcode = NULL;
- uint32_t trap_opcode_size = 0;
-
- static const uint8_t g_arm_breakpoint_opcode[] = { 0xFE, 0xDE, 0xFF, 0xE7 };
- //static const uint8_t g_thumb_breakpooint_opcode[] = { 0xFE, 0xDE };
- static const uint8_t g_ppc_breakpoint_opcode[] = { 0x7F, 0xC0, 0x00, 0x08 };
- static const uint8_t g_i386_breakpoint_opcode[] = { 0xCC };
-
- llvm::Triple::ArchType machine = m_arch_spec.GetMachine();
- switch (machine)
- {
- case llvm::Triple::x86:
- case llvm::Triple::x86_64:
- trap_opcode = g_i386_breakpoint_opcode;
- trap_opcode_size = sizeof(g_i386_breakpoint_opcode);
- break;
-
- case llvm::Triple::arm:
- // TODO: fill this in for ARM. We need to dig up the symbol for
- // the address in the breakpoint locaiton and figure out if it is
- // an ARM or Thumb breakpoint.
- trap_opcode = g_arm_breakpoint_opcode;
- trap_opcode_size = sizeof(g_arm_breakpoint_opcode);
- break;
-
- case llvm::Triple::ppc:
- case llvm::Triple::ppc64:
- trap_opcode = g_ppc_breakpoint_opcode;
- trap_opcode_size = sizeof(g_ppc_breakpoint_opcode);
- break;
-
- default:
- assert(!"Unhandled architecture in ProcessMacOSX::GetSoftwareBreakpointTrapOpcode()");
- break;
- }
-
- if (trap_opcode && trap_opcode_size)
- {
- if (bp_site->SetTrapOpcode(trap_opcode, trap_opcode_size))
- return trap_opcode_size;
- }
- return 0;
-}
uint32_t
ProcessMacOSX::UpdateThreadListIfNeeded ()
{
diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h
index 85ce15104b6..a1d28178115 100644
--- a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h
+++ b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h
@@ -192,12 +192,6 @@ public:
//----------------------------------------------------------------------
// Process Breakpoints
//----------------------------------------------------------------------
- virtual size_t
- GetSoftwareBreakpointTrapOpcode (lldb_private::BreakpointSite *bp_site);
-
- //----------------------------------------------------------------------
- // Process Breakpoints
- //----------------------------------------------------------------------
virtual lldb_private::Error
EnableBreakpoint (lldb_private::BreakpointSite *bp_site);
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 2ae589d551c..d88c240f30c 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -63,7 +63,7 @@ get_random_port ()
const char *
ProcessGDBRemote::GetPluginNameStatic()
{
- return "process.gdb-remote";
+ return "gdb-remote";
}
const char *
@@ -1025,53 +1025,6 @@ ProcessGDBRemote::DoResume ()
return error;
}
-size_t
-ProcessGDBRemote::GetSoftwareBreakpointTrapOpcode (BreakpointSite* bp_site)
-{
- const uint8_t *trap_opcode = NULL;
- uint32_t trap_opcode_size = 0;
-
- static const uint8_t g_arm_breakpoint_opcode[] = { 0xFE, 0xDE, 0xFF, 0xE7 };
- //static const uint8_t g_thumb_breakpooint_opcode[] = { 0xFE, 0xDE };
- static const uint8_t g_ppc_breakpoint_opcode[] = { 0x7F, 0xC0, 0x00, 0x08 };
- static const uint8_t g_i386_breakpoint_opcode[] = { 0xCC };
-
- const llvm::Triple::ArchType machine = GetTarget().GetArchitecture().GetMachine();
- switch (machine)
- {
- case llvm::Triple::x86:
- case llvm::Triple::x86_64:
- trap_opcode = g_i386_breakpoint_opcode;
- trap_opcode_size = sizeof(g_i386_breakpoint_opcode);
- break;
-
- case llvm::Triple::arm:
- // TODO: fill this in for ARM. We need to dig up the symbol for
- // the address in the breakpoint locaiton and figure out if it is
- // an ARM or Thumb breakpoint.
- trap_opcode = g_arm_breakpoint_opcode;
- trap_opcode_size = sizeof(g_arm_breakpoint_opcode);
- break;
-
- case llvm::Triple::ppc:
- case llvm::Triple::ppc64:
- trap_opcode = g_ppc_breakpoint_opcode;
- trap_opcode_size = sizeof(g_ppc_breakpoint_opcode);
- break;
-
- default:
- assert(!"Unhandled architecture in ProcessMacOSX::GetSoftwareBreakpointTrapOpcode()");
- break;
- }
-
- if (trap_opcode && trap_opcode_size)
- {
- if (bp_site->SetTrapOpcode(trap_opcode, trap_opcode_size))
- return trap_opcode_size;
- }
- return 0;
-}
-
uint32_t
ProcessGDBRemote::UpdateThreadListIfNeeded ()
{
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index 4bb337fb6d9..6273041825a 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -189,12 +189,6 @@ public:
//----------------------------------------------------------------------
// Process Breakpoints
//----------------------------------------------------------------------
- virtual size_t
- GetSoftwareBreakpointTrapOpcode (lldb_private::BreakpointSite *bp_site);
-
- //----------------------------------------------------------------------
- // Process Breakpoints
- //----------------------------------------------------------------------
virtual lldb_private::Error
EnableBreakpoint (lldb_private::BreakpointSite *bp_site);
OpenPOWER on IntegriCloud