2010-06-09 00:52:24 +08:00
|
|
|
//===-- lldb.cpp ------------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/lldb-private.h"
|
|
|
|
#include "lldb/lldb-private-log.h"
|
2010-06-14 03:36:42 +08:00
|
|
|
#include "lldb/Core/ArchSpec.h"
|
2011-03-13 08:00:32 +08:00
|
|
|
#include "lldb/Core/Debugger.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Core/Log.h"
|
Modified the PluginManager to be ready for loading plug-ins from a system
LLDB plugin directory and a user LLDB plugin directory. We currently still
need to work out at what layer the plug-ins will be, but at least we are
prepared for plug-ins. Plug-ins will attempt to be loaded from the
"/Developer/Library/PrivateFrameworks/LLDB.framework/Resources/Plugins"
folder, and from the "~/Library/Application Support/LLDB/Plugins" folder on
MacOSX. Each plugin will be scanned for:
extern "C" bool LLDBPluginInitialize(void);
extern "C" void LLDBPluginTerminate(void);
If at least LLDBPluginInitialize is found, the plug-in will be loaded. The
LLDBPluginInitialize function returns a bool that indicates if the plug-in
should stay loaded or not (plug-ins might check the current OS, current
hardware, or anything else and determine they don't want to run on the current
host). The plug-in is uniqued by path and added to a static loaded plug-in
map. The plug-in scanning happens during "lldb_private::Initialize()" which
calls to the PluginManager::Initialize() function. Likewise with termination
lldb_private::Terminate() calls PluginManager::Terminate(). The paths for the
plug-in directories is fetched through new Host calls:
bool Host::GetLLDBPath (ePathTypeLLDBSystemPlugins, dir_spec);
bool Host::GetLLDBPath (ePathTypeLLDBUserPlugins, dir_spec);
This way linux and other systems can define their own appropriate locations
for plug-ins to be loaded.
To allow dynamic shared library loading, the Host layer has also been modified
to include shared library open, close and get symbol:
static void *
Host::DynamicLibraryOpen (const FileSpec &file_spec,
Error &error);
static Error
Host::DynamicLibraryClose (void *dynamic_library_handle);
static void *
Host::DynamicLibraryGetSymbol (void *dynamic_library_handle,
const char *symbol_name,
Error &error);
lldb_private::FileSpec also has been modified to support directory enumeration
in an attempt to abstract the directory enumeration into one spot in the code.
The directory enumertion function is static and takes a callback:
typedef enum EnumerateDirectoryResult
{
eEnumerateDirectoryResultNext, // Enumerate next entry in the current directory
eEnumerateDirectoryResultEnter, // Recurse into the current entry if it is a directory or symlink, or next if not
eEnumerateDirectoryResultExit, // Exit from the current directory at the current level.
eEnumerateDirectoryResultQuit // Stop directory enumerations at any level
};
typedef FileSpec::EnumerateDirectoryResult (*EnumerateDirectoryCallbackType) (void *baton,
FileSpec::FileType file_type,
const FileSpec &spec);
static FileSpec::EnumerateDirectoryResult
FileSpec::EnumerateDirectory (const char *dir_path,
bool find_directories,
bool find_files,
bool find_other,
EnumerateDirectoryCallbackType callback,
void *callback_baton);
This allow clients to specify the directory to search, and specifies if only
files, directories or other (pipe, symlink, fifo, etc) files will cause the
callback to be called. The callback also gets to return with the action that
should be performed after this directory entry. eEnumerateDirectoryResultNext
specifies to continue enumerating through a directory with the next entry.
eEnumerateDirectoryResultEnter specifies to recurse down into a directory
entry, or if the file is not a directory or symlink/alias to a directory, then
just iterate to the next entry. eEnumerateDirectoryResultExit specifies to
exit the current directory and skip any entries that might be remaining, yet
continue enumerating to the next entry in the parent directory. And finally
eEnumerateDirectoryResultQuit means to abort all directory enumerations at
all levels.
Modified the Declaration class to not include column information currently
since we don't have any compilers that currently support column based
declaration information. Columns support can be re-enabled with the
additions of a #define.
Added the ability to find an EmulateInstruction plug-in given a target triple
and optional plug-in name in the plug-in manager.
Fixed a few cases where opendir/readdir was being used, but yet not closedir
was being used. Soon these will be deprecated in favor of the new directory
enumeration call that was added to the FileSpec class.
llvm-svn: 124716
2011-02-02 10:24:04 +08:00
|
|
|
#include "lldb/Core/PluginManager.h"
|
2011-03-09 06:40:15 +08:00
|
|
|
#include "lldb/Core/RegularExpression.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Core/Timer.h"
|
|
|
|
#include "lldb/Host/Host.h"
|
2010-06-14 03:36:42 +08:00
|
|
|
#include "lldb/Host/Mutex.h"
|
2010-12-17 05:36:30 +08:00
|
|
|
#include "lldb/Target/Target.h"
|
|
|
|
#include "lldb/Target/Thread.h"
|
2010-06-14 03:36:42 +08:00
|
|
|
|
2011-03-09 06:40:15 +08:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
|
|
|
2011-05-20 02:32:34 +08:00
|
|
|
#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
|
|
|
|
#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
|
2011-05-20 01:34:40 +08:00
|
|
|
#include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
|
2010-06-14 03:36:42 +08:00
|
|
|
#include "Plugins/Disassembler/llvm/DisassemblerLLVM.h"
|
2011-04-06 02:46:00 +08:00
|
|
|
#include "Plugins/Instruction/ARM/EmulateInstructionARM.h"
|
2010-06-14 03:36:42 +08:00
|
|
|
#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
|
|
|
|
#include "Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h"
|
|
|
|
#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
|
|
|
|
#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
|
|
|
|
#include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h"
|
|
|
|
#include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h"
|
2011-04-26 05:07:40 +08:00
|
|
|
#include "Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h"
|
2011-04-26 05:05:07 +08:00
|
|
|
#include "Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h"
|
2011-09-10 04:33:05 +08:00
|
|
|
#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
|
2011-03-09 06:40:15 +08:00
|
|
|
#if defined (__APPLE__)
|
2010-06-14 03:36:42 +08:00
|
|
|
#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
|
2011-08-23 06:30:57 +08:00
|
|
|
#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
|
|
|
|
#include "Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.h"
|
2010-09-23 10:01:19 +08:00
|
|
|
#include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h"
|
2010-11-05 02:30:59 +08:00
|
|
|
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h"
|
|
|
|
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h"
|
2010-06-14 03:36:42 +08:00
|
|
|
#include "Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h"
|
|
|
|
#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
|
2011-07-18 04:36:25 +08:00
|
|
|
#include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
|
2010-06-14 03:36:42 +08:00
|
|
|
#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
|
2011-03-09 06:40:15 +08:00
|
|
|
#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
|
2011-03-19 09:12:21 +08:00
|
|
|
#include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
|
2010-06-14 03:36:42 +08:00
|
|
|
#endif
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2011-03-09 06:40:15 +08:00
|
|
|
#if defined (__linux__)
|
2011-01-17 03:45:39 +08:00
|
|
|
#include "Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.h"
|
2011-03-09 06:40:15 +08:00
|
|
|
#include "Plugins/Platform/Linux/PlatformLinux.h"
|
|
|
|
#include "Plugins/Process/Linux/ProcessLinux.h"
|
2010-07-24 10:19:04 +08:00
|
|
|
#endif
|
|
|
|
|
2011-08-03 04:52:42 +08:00
|
|
|
#if defined (__FreeBSD__)
|
|
|
|
#include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
|
|
|
|
#endif
|
|
|
|
|
2011-03-24 12:28:38 +08:00
|
|
|
#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
|
2011-03-05 09:04:56 +08:00
|
|
|
#include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
|
|
|
|
|
2010-12-17 05:33:41 +08:00
|
|
|
using namespace lldb;
|
2010-06-09 00:52:24 +08:00
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
lldb_private::Initialize ()
|
|
|
|
{
|
|
|
|
// Make sure we inialize only once
|
2011-01-14 08:29:16 +08:00
|
|
|
static Mutex g_inited_mutex(Mutex::eMutexTypeRecursive);
|
2010-06-09 00:52:24 +08:00
|
|
|
static bool g_inited = false;
|
|
|
|
|
|
|
|
Mutex::Locker locker(g_inited_mutex);
|
|
|
|
if (!g_inited)
|
|
|
|
{
|
|
|
|
g_inited = true;
|
2010-11-19 07:32:35 +08:00
|
|
|
Log::Initialize();
|
2010-06-09 00:52:24 +08:00
|
|
|
Timer::Initialize ();
|
|
|
|
Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
|
2010-11-19 07:32:35 +08:00
|
|
|
|
2011-05-20 02:32:34 +08:00
|
|
|
ABIMacOSX_i386::Initialize();
|
|
|
|
ABIMacOSX_arm::Initialize();
|
2011-05-20 01:34:40 +08:00
|
|
|
ABISysV_x86_64::Initialize();
|
2010-06-14 03:36:42 +08:00
|
|
|
DisassemblerLLVM::Initialize();
|
|
|
|
ObjectContainerBSDArchive::Initialize();
|
|
|
|
ObjectFileELF::Initialize();
|
|
|
|
SymbolFileDWARF::Initialize();
|
|
|
|
SymbolFileSymtab::Initialize();
|
2011-04-26 05:05:07 +08:00
|
|
|
UnwindAssemblyInstEmulation::Initialize();
|
2011-04-26 12:39:08 +08:00
|
|
|
UnwindAssembly_x86::Initialize();
|
2011-04-06 02:46:00 +08:00
|
|
|
EmulateInstructionARM::Initialize ();
|
2011-09-10 04:33:05 +08:00
|
|
|
ObjectFilePECOFF::Initialize ();
|
2011-03-09 06:40:15 +08:00
|
|
|
#if defined (__APPLE__)
|
2011-03-24 12:28:38 +08:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Apple/Darwin hosted plugins
|
|
|
|
//----------------------------------------------------------------------
|
2010-06-09 00:52:24 +08:00
|
|
|
DynamicLoaderMacOSXDYLD::Initialize();
|
2011-08-23 06:30:57 +08:00
|
|
|
DynamicLoaderDarwinKernel::Initialize();
|
|
|
|
OperatingSystemDarwinKernel::Initialize();
|
2011-01-12 12:22:09 +08:00
|
|
|
SymbolFileDWARFDebugMap::Initialize();
|
2010-09-23 10:01:19 +08:00
|
|
|
ItaniumABILanguageRuntime::Initialize();
|
|
|
|
AppleObjCRuntimeV2::Initialize();
|
2010-11-05 02:30:59 +08:00
|
|
|
AppleObjCRuntimeV1::Initialize();
|
2010-06-09 00:52:24 +08:00
|
|
|
ObjectContainerUniversalMachO::Initialize();
|
|
|
|
ObjectFileMachO::Initialize();
|
2011-07-18 04:36:25 +08:00
|
|
|
ProcessKDP::Initialize();
|
2010-06-09 00:52:24 +08:00
|
|
|
ProcessGDBRemote::Initialize();
|
2010-07-24 10:19:04 +08:00
|
|
|
SymbolVendorMacOSX::Initialize();
|
2011-03-09 06:40:15 +08:00
|
|
|
PlatformMacOSX::Initialize();
|
2011-03-19 09:12:21 +08:00
|
|
|
PlatformRemoteiOS::Initialize();
|
2010-07-24 10:19:04 +08:00
|
|
|
#endif
|
2011-03-09 06:40:15 +08:00
|
|
|
#if defined (__linux__)
|
2011-03-24 12:28:38 +08:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Linux hosted plugins
|
|
|
|
//----------------------------------------------------------------------
|
2011-03-10 11:08:28 +08:00
|
|
|
PlatformLinux::Initialize();
|
2010-07-24 10:19:04 +08:00
|
|
|
ProcessLinux::Initialize();
|
2011-01-17 03:45:39 +08:00
|
|
|
DynamicLoaderLinuxDYLD::Initialize();
|
2011-08-03 04:52:42 +08:00
|
|
|
#endif
|
|
|
|
#if defined (__FreeBSD__)
|
|
|
|
PlatformFreeBSD::Initialize();
|
2010-06-14 03:36:42 +08:00
|
|
|
#endif
|
2011-03-24 12:28:38 +08:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Platform agnostic plugins
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
PlatformRemoteGDBServer::Initialize ();
|
2011-03-05 09:04:56 +08:00
|
|
|
DynamicLoaderStatic::Initialize();
|
2011-03-24 12:28:38 +08:00
|
|
|
|
Modified the PluginManager to be ready for loading plug-ins from a system
LLDB plugin directory and a user LLDB plugin directory. We currently still
need to work out at what layer the plug-ins will be, but at least we are
prepared for plug-ins. Plug-ins will attempt to be loaded from the
"/Developer/Library/PrivateFrameworks/LLDB.framework/Resources/Plugins"
folder, and from the "~/Library/Application Support/LLDB/Plugins" folder on
MacOSX. Each plugin will be scanned for:
extern "C" bool LLDBPluginInitialize(void);
extern "C" void LLDBPluginTerminate(void);
If at least LLDBPluginInitialize is found, the plug-in will be loaded. The
LLDBPluginInitialize function returns a bool that indicates if the plug-in
should stay loaded or not (plug-ins might check the current OS, current
hardware, or anything else and determine they don't want to run on the current
host). The plug-in is uniqued by path and added to a static loaded plug-in
map. The plug-in scanning happens during "lldb_private::Initialize()" which
calls to the PluginManager::Initialize() function. Likewise with termination
lldb_private::Terminate() calls PluginManager::Terminate(). The paths for the
plug-in directories is fetched through new Host calls:
bool Host::GetLLDBPath (ePathTypeLLDBSystemPlugins, dir_spec);
bool Host::GetLLDBPath (ePathTypeLLDBUserPlugins, dir_spec);
This way linux and other systems can define their own appropriate locations
for plug-ins to be loaded.
To allow dynamic shared library loading, the Host layer has also been modified
to include shared library open, close and get symbol:
static void *
Host::DynamicLibraryOpen (const FileSpec &file_spec,
Error &error);
static Error
Host::DynamicLibraryClose (void *dynamic_library_handle);
static void *
Host::DynamicLibraryGetSymbol (void *dynamic_library_handle,
const char *symbol_name,
Error &error);
lldb_private::FileSpec also has been modified to support directory enumeration
in an attempt to abstract the directory enumeration into one spot in the code.
The directory enumertion function is static and takes a callback:
typedef enum EnumerateDirectoryResult
{
eEnumerateDirectoryResultNext, // Enumerate next entry in the current directory
eEnumerateDirectoryResultEnter, // Recurse into the current entry if it is a directory or symlink, or next if not
eEnumerateDirectoryResultExit, // Exit from the current directory at the current level.
eEnumerateDirectoryResultQuit // Stop directory enumerations at any level
};
typedef FileSpec::EnumerateDirectoryResult (*EnumerateDirectoryCallbackType) (void *baton,
FileSpec::FileType file_type,
const FileSpec &spec);
static FileSpec::EnumerateDirectoryResult
FileSpec::EnumerateDirectory (const char *dir_path,
bool find_directories,
bool find_files,
bool find_other,
EnumerateDirectoryCallbackType callback,
void *callback_baton);
This allow clients to specify the directory to search, and specifies if only
files, directories or other (pipe, symlink, fifo, etc) files will cause the
callback to be called. The callback also gets to return with the action that
should be performed after this directory entry. eEnumerateDirectoryResultNext
specifies to continue enumerating through a directory with the next entry.
eEnumerateDirectoryResultEnter specifies to recurse down into a directory
entry, or if the file is not a directory or symlink/alias to a directory, then
just iterate to the next entry. eEnumerateDirectoryResultExit specifies to
exit the current directory and skip any entries that might be remaining, yet
continue enumerating to the next entry in the parent directory. And finally
eEnumerateDirectoryResultQuit means to abort all directory enumerations at
all levels.
Modified the Declaration class to not include column information currently
since we don't have any compilers that currently support column based
declaration information. Columns support can be re-enabled with the
additions of a #define.
Added the ability to find an EmulateInstruction plug-in given a target triple
and optional plug-in name in the plug-in manager.
Fixed a few cases where opendir/readdir was being used, but yet not closedir
was being used. Soon these will be deprecated in favor of the new directory
enumeration call that was added to the FileSpec class.
llvm-svn: 124716
2011-02-02 10:24:04 +08:00
|
|
|
// Scan for any system or user LLDB plug-ins
|
|
|
|
PluginManager::Initialize();
|
2011-02-18 09:44:25 +08:00
|
|
|
|
2011-03-11 06:14:10 +08:00
|
|
|
// The process settings need to know about installed plug-ins, so the Settings must be initialized
|
|
|
|
// AFTER PluginManager::Initialize is called.
|
|
|
|
|
|
|
|
Debugger::SettingsInitialize();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
lldb_private::WillTerminate()
|
|
|
|
{
|
|
|
|
Host::WillTerminate();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
lldb_private::Terminate ()
|
|
|
|
{
|
|
|
|
Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
|
Modified the PluginManager to be ready for loading plug-ins from a system
LLDB plugin directory and a user LLDB plugin directory. We currently still
need to work out at what layer the plug-ins will be, but at least we are
prepared for plug-ins. Plug-ins will attempt to be loaded from the
"/Developer/Library/PrivateFrameworks/LLDB.framework/Resources/Plugins"
folder, and from the "~/Library/Application Support/LLDB/Plugins" folder on
MacOSX. Each plugin will be scanned for:
extern "C" bool LLDBPluginInitialize(void);
extern "C" void LLDBPluginTerminate(void);
If at least LLDBPluginInitialize is found, the plug-in will be loaded. The
LLDBPluginInitialize function returns a bool that indicates if the plug-in
should stay loaded or not (plug-ins might check the current OS, current
hardware, or anything else and determine they don't want to run on the current
host). The plug-in is uniqued by path and added to a static loaded plug-in
map. The plug-in scanning happens during "lldb_private::Initialize()" which
calls to the PluginManager::Initialize() function. Likewise with termination
lldb_private::Terminate() calls PluginManager::Terminate(). The paths for the
plug-in directories is fetched through new Host calls:
bool Host::GetLLDBPath (ePathTypeLLDBSystemPlugins, dir_spec);
bool Host::GetLLDBPath (ePathTypeLLDBUserPlugins, dir_spec);
This way linux and other systems can define their own appropriate locations
for plug-ins to be loaded.
To allow dynamic shared library loading, the Host layer has also been modified
to include shared library open, close and get symbol:
static void *
Host::DynamicLibraryOpen (const FileSpec &file_spec,
Error &error);
static Error
Host::DynamicLibraryClose (void *dynamic_library_handle);
static void *
Host::DynamicLibraryGetSymbol (void *dynamic_library_handle,
const char *symbol_name,
Error &error);
lldb_private::FileSpec also has been modified to support directory enumeration
in an attempt to abstract the directory enumeration into one spot in the code.
The directory enumertion function is static and takes a callback:
typedef enum EnumerateDirectoryResult
{
eEnumerateDirectoryResultNext, // Enumerate next entry in the current directory
eEnumerateDirectoryResultEnter, // Recurse into the current entry if it is a directory or symlink, or next if not
eEnumerateDirectoryResultExit, // Exit from the current directory at the current level.
eEnumerateDirectoryResultQuit // Stop directory enumerations at any level
};
typedef FileSpec::EnumerateDirectoryResult (*EnumerateDirectoryCallbackType) (void *baton,
FileSpec::FileType file_type,
const FileSpec &spec);
static FileSpec::EnumerateDirectoryResult
FileSpec::EnumerateDirectory (const char *dir_path,
bool find_directories,
bool find_files,
bool find_other,
EnumerateDirectoryCallbackType callback,
void *callback_baton);
This allow clients to specify the directory to search, and specifies if only
files, directories or other (pipe, symlink, fifo, etc) files will cause the
callback to be called. The callback also gets to return with the action that
should be performed after this directory entry. eEnumerateDirectoryResultNext
specifies to continue enumerating through a directory with the next entry.
eEnumerateDirectoryResultEnter specifies to recurse down into a directory
entry, or if the file is not a directory or symlink/alias to a directory, then
just iterate to the next entry. eEnumerateDirectoryResultExit specifies to
exit the current directory and skip any entries that might be remaining, yet
continue enumerating to the next entry in the parent directory. And finally
eEnumerateDirectoryResultQuit means to abort all directory enumerations at
all levels.
Modified the Declaration class to not include column information currently
since we don't have any compilers that currently support column based
declaration information. Columns support can be re-enabled with the
additions of a #define.
Added the ability to find an EmulateInstruction plug-in given a target triple
and optional plug-in name in the plug-in manager.
Fixed a few cases where opendir/readdir was being used, but yet not closedir
was being used. Soon these will be deprecated in favor of the new directory
enumeration call that was added to the FileSpec class.
llvm-svn: 124716
2011-02-02 10:24:04 +08:00
|
|
|
|
|
|
|
// Terminate and unload and loaded system or user LLDB plug-ins
|
|
|
|
PluginManager::Terminate();
|
|
|
|
|
2011-05-20 02:32:34 +08:00
|
|
|
ABIMacOSX_i386::Terminate();
|
|
|
|
ABIMacOSX_arm::Terminate();
|
2011-05-20 01:34:40 +08:00
|
|
|
ABISysV_x86_64::Terminate();
|
2010-06-09 00:52:24 +08:00
|
|
|
DisassemblerLLVM::Terminate();
|
|
|
|
ObjectContainerBSDArchive::Terminate();
|
|
|
|
ObjectFileELF::Terminate();
|
|
|
|
SymbolFileDWARF::Terminate();
|
|
|
|
SymbolFileSymtab::Terminate();
|
2011-04-26 05:05:07 +08:00
|
|
|
UnwindAssembly_x86::Terminate();
|
|
|
|
UnwindAssemblyInstEmulation::Terminate();
|
2011-04-06 02:46:00 +08:00
|
|
|
EmulateInstructionARM::Terminate ();
|
2011-09-10 04:33:05 +08:00
|
|
|
ObjectFilePECOFF::Terminate ();
|
2010-07-24 10:19:04 +08:00
|
|
|
|
2011-03-09 06:40:15 +08:00
|
|
|
#if defined (__APPLE__)
|
2010-06-14 03:36:42 +08:00
|
|
|
DynamicLoaderMacOSXDYLD::Terminate();
|
2011-08-23 06:30:57 +08:00
|
|
|
DynamicLoaderDarwinKernel::Terminate();
|
|
|
|
OperatingSystemDarwinKernel::Terminate();
|
2011-01-12 12:22:09 +08:00
|
|
|
SymbolFileDWARFDebugMap::Terminate();
|
2010-11-05 02:30:59 +08:00
|
|
|
ItaniumABILanguageRuntime::Terminate();
|
|
|
|
AppleObjCRuntimeV2::Terminate();
|
|
|
|
AppleObjCRuntimeV1::Terminate();
|
2010-06-14 03:36:42 +08:00
|
|
|
ObjectContainerUniversalMachO::Terminate();
|
|
|
|
ObjectFileMachO::Terminate();
|
2011-07-18 04:36:25 +08:00
|
|
|
ProcessKDP::Terminate();
|
2010-06-14 03:36:42 +08:00
|
|
|
ProcessGDBRemote::Terminate();
|
2010-07-24 10:19:04 +08:00
|
|
|
SymbolVendorMacOSX::Terminate();
|
2011-03-09 06:40:15 +08:00
|
|
|
PlatformMacOSX::Terminate();
|
2011-03-19 09:12:21 +08:00
|
|
|
PlatformRemoteiOS::Terminate();
|
2010-07-24 10:19:04 +08:00
|
|
|
#endif
|
|
|
|
|
2011-03-11 06:14:10 +08:00
|
|
|
Debugger::SettingsTerminate ();
|
2010-11-19 07:32:35 +08:00
|
|
|
|
2011-03-09 06:40:15 +08:00
|
|
|
#if defined (__linux__)
|
|
|
|
PlatformLinux::Terminate();
|
2010-07-24 10:19:04 +08:00
|
|
|
ProcessLinux::Terminate();
|
2011-01-17 03:45:39 +08:00
|
|
|
DynamicLoaderLinuxDYLD::Terminate();
|
2010-06-14 03:36:42 +08:00
|
|
|
#endif
|
2011-08-03 04:52:42 +08:00
|
|
|
|
|
|
|
#if defined (__FreeBSD__)
|
|
|
|
PlatformFreeBSD::Terminate();
|
|
|
|
#endif
|
2011-03-05 09:04:56 +08:00
|
|
|
|
|
|
|
DynamicLoaderStatic::Terminate();
|
2010-11-19 07:32:35 +08:00
|
|
|
|
|
|
|
Log::Terminate();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2011-03-22 09:14:58 +08:00
|
|
|
extern "C" const double liblldb_coreVersionNumber;
|
2010-06-09 00:52:24 +08:00
|
|
|
const char *
|
|
|
|
lldb_private::GetVersion ()
|
|
|
|
{
|
|
|
|
static char g_version_string[32];
|
|
|
|
if (g_version_string[0] == '\0')
|
2011-03-22 09:14:58 +08:00
|
|
|
::snprintf (g_version_string, sizeof(g_version_string), "LLDB-%g", liblldb_coreVersionNumber);
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
return g_version_string;
|
|
|
|
}
|
|
|
|
|
2010-09-04 01:10:42 +08:00
|
|
|
const char *
|
2011-03-25 05:19:54 +08:00
|
|
|
lldb_private::GetVoteAsCString (Vote vote)
|
2010-09-04 01:10:42 +08:00
|
|
|
{
|
2010-09-04 06:45:01 +08:00
|
|
|
switch (vote)
|
|
|
|
{
|
|
|
|
case eVoteNo: return "no";
|
|
|
|
case eVoteNoOpinion: return "no opinion";
|
|
|
|
case eVoteYes: return "yes";
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2010-09-04 01:10:42 +08:00
|
|
|
return "invalid";
|
|
|
|
}
|
|
|
|
|
2010-10-08 08:21:05 +08:00
|
|
|
|
|
|
|
const char *
|
2011-03-25 05:19:54 +08:00
|
|
|
lldb_private::GetSectionTypeAsCString (SectionType sect_type)
|
2010-10-08 08:21:05 +08:00
|
|
|
{
|
|
|
|
switch (sect_type)
|
|
|
|
{
|
|
|
|
case eSectionTypeInvalid: return "invalid";
|
|
|
|
case eSectionTypeCode: return "code";
|
|
|
|
case eSectionTypeContainer: return "container";
|
|
|
|
case eSectionTypeData: return "data";
|
|
|
|
case eSectionTypeDataCString: return "data-cstr";
|
|
|
|
case eSectionTypeDataCStringPointers: return "data-cstr-ptr";
|
|
|
|
case eSectionTypeDataSymbolAddress: return "data-symbol-addr";
|
|
|
|
case eSectionTypeData4: return "data-4-byte";
|
|
|
|
case eSectionTypeData8: return "data-8-byte";
|
|
|
|
case eSectionTypeData16: return "data-16-byte";
|
|
|
|
case eSectionTypeDataPointers: return "data-ptrs";
|
|
|
|
case eSectionTypeDebug: return "debug";
|
|
|
|
case eSectionTypeZeroFill: return "zero-fill";
|
|
|
|
case eSectionTypeDataObjCMessageRefs: return "objc-message-refs";
|
|
|
|
case eSectionTypeDataObjCCFStrings: return "objc-cfstrings";
|
|
|
|
case eSectionTypeDWARFDebugAbbrev: return "dwarf-abbrev";
|
|
|
|
case eSectionTypeDWARFDebugAranges: return "dwarf-aranges";
|
|
|
|
case eSectionTypeDWARFDebugFrame: return "dwarf-frame";
|
|
|
|
case eSectionTypeDWARFDebugInfo: return "dwarf-info";
|
|
|
|
case eSectionTypeDWARFDebugLine: return "dwarf-line";
|
|
|
|
case eSectionTypeDWARFDebugLoc: return "dwarf-loc";
|
|
|
|
case eSectionTypeDWARFDebugMacInfo: return "dwarf-macinfo";
|
|
|
|
case eSectionTypeDWARFDebugPubNames: return "dwarf-pubnames";
|
|
|
|
case eSectionTypeDWARFDebugPubTypes: return "dwarf-pubtypes";
|
|
|
|
case eSectionTypeDWARFDebugRanges: return "dwarf-ranges";
|
|
|
|
case eSectionTypeDWARFDebugStr: return "dwarf-str";
|
2011-09-02 07:16:13 +08:00
|
|
|
case eSectionTypeDWARFDebugNames: return "dwarf-names";
|
|
|
|
case eSectionTypeDWARFDebugTypes: return "dwarf-types";
|
2010-10-08 08:21:05 +08:00
|
|
|
case eSectionTypeEHFrame: return "eh-frame";
|
|
|
|
case eSectionTypeOther: return "regular";
|
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-03-09 06:40:15 +08:00
|
|
|
bool
|
|
|
|
lldb_private::NameMatches (const char *name,
|
2011-03-25 05:19:54 +08:00
|
|
|
NameMatchType match_type,
|
2011-03-09 06:40:15 +08:00
|
|
|
const char *match)
|
|
|
|
{
|
|
|
|
if (match_type == eNameMatchIgnore)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if (name == match)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if (name && match)
|
|
|
|
{
|
|
|
|
llvm::StringRef name_sref(name);
|
|
|
|
llvm::StringRef match_sref(match);
|
|
|
|
switch (match_type)
|
|
|
|
{
|
|
|
|
case eNameMatchIgnore:
|
|
|
|
return true;
|
|
|
|
case eNameMatchEquals: return name_sref == match_sref;
|
|
|
|
case eNameMatchContains: return name_sref.find (match_sref) != llvm::StringRef::npos;
|
|
|
|
case eNameMatchStartsWith: return name_sref.startswith (match_sref);
|
|
|
|
case eNameMatchEndsWith: return name_sref.endswith (match_sref);
|
|
|
|
case eNameMatchRegularExpression:
|
|
|
|
{
|
|
|
|
RegularExpression regex (match);
|
|
|
|
return regex.Execute (name);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
assert (!"unhandled NameMatchType in lldb_private::NameMatches()");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|