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"
|
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"
|
2011-01-14 08:29:16 +08:00
|
|
|
#include "lldb/Interpreter/ScriptInterpreter.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"
|
|
|
|
|
2010-06-14 03:36:42 +08:00
|
|
|
#include "Plugins/Disassembler/llvm/DisassemblerLLVM.h"
|
|
|
|
#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"
|
2010-09-10 15:49:16 +08:00
|
|
|
#include "Plugins/Process/Utility/UnwindAssemblyProfiler-x86.h"
|
|
|
|
#include "Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.h"
|
2010-09-22 15:37:07 +08:00
|
|
|
#include "Plugins/Process/Utility/ArchVolatileRegs-x86.h"
|
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
|
|
|
#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
|
|
|
|
#include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
|
|
|
|
#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.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"
|
|
|
|
#include "Plugins/Process/MacOSX-User/source/ProcessMacOSX.h"
|
|
|
|
#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
|
2011-03-09 06:40:15 +08:00
|
|
|
#include "Plugins/Platform/MacOSX/PlatformMacOSX.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-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
|
|
|
|
|
|
|
Target::Initialize ();
|
|
|
|
Process::Initialize ();
|
|
|
|
Thread::Initialize ();
|
2010-06-14 03:36:42 +08:00
|
|
|
DisassemblerLLVM::Initialize();
|
|
|
|
ObjectContainerBSDArchive::Initialize();
|
|
|
|
ObjectFileELF::Initialize();
|
|
|
|
SymbolFileDWARF::Initialize();
|
|
|
|
SymbolFileSymtab::Initialize();
|
2010-09-10 15:49:16 +08:00
|
|
|
UnwindAssemblyProfiler_x86::Initialize();
|
2011-02-15 08:19:15 +08:00
|
|
|
ArchDefaultUnwindPlan_x86_64::Initialize();
|
|
|
|
ArchDefaultUnwindPlan_i386::Initialize();
|
2010-09-22 15:37:07 +08:00
|
|
|
ArchVolatileRegs_x86::Initialize();
|
2011-01-14 08:29:16 +08:00
|
|
|
ScriptInterpreter::Initialize ();
|
2010-07-24 10:19:04 +08:00
|
|
|
|
2011-03-09 06:40:15 +08:00
|
|
|
#if defined (__APPLE__)
|
2010-06-09 00:52:24 +08:00
|
|
|
ABIMacOSX_i386::Initialize();
|
|
|
|
ABISysV_x86_64::Initialize();
|
|
|
|
DynamicLoaderMacOSXDYLD::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();
|
|
|
|
ProcessGDBRemote::Initialize();
|
2010-10-16 05:52:38 +08:00
|
|
|
//ProcessMacOSX::Initialize();
|
2010-07-24 10:19:04 +08:00
|
|
|
SymbolVendorMacOSX::Initialize();
|
2011-03-09 06:40:15 +08:00
|
|
|
PlatformMacOSX::Initialize();
|
2010-07-24 10:19:04 +08:00
|
|
|
#endif
|
2011-03-09 06:40:15 +08:00
|
|
|
#if defined (__linux__)
|
|
|
|
ProcessLinux::Initialize();
|
2010-07-24 10:19:04 +08:00
|
|
|
ProcessLinux::Initialize();
|
2011-01-17 03:45:39 +08:00
|
|
|
DynamicLoaderLinuxDYLD::Initialize();
|
2010-06-14 03:36:42 +08:00
|
|
|
#endif
|
2011-03-05 09:04:56 +08:00
|
|
|
DynamicLoaderStatic::Initialize();
|
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
|
|
|
|
|
|
|
// The process needs to know about installed plug-ins
|
|
|
|
Process::DidInitialize ();
|
|
|
|
|
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();
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
DisassemblerLLVM::Terminate();
|
|
|
|
ObjectContainerBSDArchive::Terminate();
|
|
|
|
ObjectFileELF::Terminate();
|
|
|
|
SymbolFileDWARF::Terminate();
|
|
|
|
SymbolFileSymtab::Terminate();
|
2010-09-10 15:49:16 +08:00
|
|
|
UnwindAssemblyProfiler_x86::Terminate();
|
2011-02-15 08:19:15 +08:00
|
|
|
ArchDefaultUnwindPlan_i386::Terminate();
|
|
|
|
ArchDefaultUnwindPlan_x86_64::Terminate();
|
2010-09-22 15:37:07 +08:00
|
|
|
ArchVolatileRegs_x86::Terminate();
|
2011-01-14 08:29:16 +08:00
|
|
|
ScriptInterpreter::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-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();
|
|
|
|
ProcessGDBRemote::Terminate();
|
2010-10-16 05:52:38 +08:00
|
|
|
//ProcessMacOSX::Terminate();
|
2010-07-24 10:19:04 +08:00
|
|
|
SymbolVendorMacOSX::Terminate();
|
2011-03-09 06:40:15 +08:00
|
|
|
PlatformMacOSX::Terminate();
|
2010-07-24 10:19:04 +08:00
|
|
|
#endif
|
|
|
|
|
2010-11-19 07:32:35 +08:00
|
|
|
Thread::Terminate ();
|
|
|
|
Process::Terminate ();
|
|
|
|
Target::Terminate ();
|
|
|
|
|
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-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
|
|
|
}
|
|
|
|
|
2010-07-07 17:33:41 +08:00
|
|
|
extern "C" const double LLDBVersionNumber;
|
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')
|
|
|
|
::snprintf (g_version_string, sizeof(g_version_string), "LLDB-%g", LLDBVersionNumber);
|
|
|
|
|
|
|
|
return g_version_string;
|
|
|
|
}
|
|
|
|
|
2010-09-04 01:10:42 +08:00
|
|
|
const char *
|
|
|
|
lldb_private::GetVoteAsCString (lldb::Vote vote)
|
|
|
|
{
|
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 *
|
|
|
|
lldb_private::GetSectionTypeAsCString (lldb::SectionType sect_type)
|
|
|
|
{
|
|
|
|
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";
|
|
|
|
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,
|
|
|
|
lldb::NameMatchType match_type,
|
|
|
|
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;
|
|
|
|
}
|