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.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-12-05 08:20:57 +08:00
|
|
|
#include "lldb/lldb-python.h"
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
#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"
|
2014-08-22 01:57:03 +08:00
|
|
|
#include "lldb/Host/HostInfo.h"
|
2010-06-14 03:36:42 +08:00
|
|
|
#include "lldb/Host/Mutex.h"
|
2014-01-28 07:43:24 +08:00
|
|
|
#include "lldb/Interpreter/ScriptInterpreterPython.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"
|
2014-08-23 08:47:22 +08:00
|
|
|
#include "llvm/Support/TargetSelect.h"
|
2011-03-09 06:40:15 +08:00
|
|
|
|
2011-05-20 02:32:34 +08:00
|
|
|
#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
|
|
|
|
#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
|
2014-03-30 02:54:20 +08:00
|
|
|
#include "Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h"
|
2011-05-20 01:34:40 +08:00
|
|
|
#include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
|
2014-10-31 10:34:28 +08:00
|
|
|
#include "Plugins/ABI/SysV-ppc/ABISysV_ppc.h"
|
|
|
|
#include "Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h"
|
2012-02-17 08:53:45 +08:00
|
|
|
#include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h"
|
2014-03-06 08:14:12 +08:00
|
|
|
#include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
|
2011-04-06 02:46:00 +08:00
|
|
|
#include "Plugins/Instruction/ARM/EmulateInstructionARM.h"
|
2014-03-30 02:54:20 +08:00
|
|
|
#include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h"
|
|
|
|
#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
|
2014-03-06 08:14:12 +08:00
|
|
|
#include "Plugins/JITLoader/GDB/JITLoaderGDB.h"
|
|
|
|
#include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h"
|
2010-06-14 03:36:42 +08:00
|
|
|
#include "Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h"
|
|
|
|
#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
|
2011-09-10 04:33:05 +08:00
|
|
|
#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
|
2012-02-28 03:12:12 +08:00
|
|
|
#include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
|
|
|
|
#include "Plugins/Platform/Linux/PlatformLinux.h"
|
2013-08-27 07:57:52 +08:00
|
|
|
#include "Plugins/Platform/POSIX/PlatformPOSIX.h"
|
2013-10-15 20:32:12 +08:00
|
|
|
#include "Plugins/Platform/Windows/PlatformWindows.h"
|
2014-07-16 23:03:10 +08:00
|
|
|
#include "Plugins/Platform/Kalimba/PlatformKalimba.h"
|
2014-03-06 08:14:12 +08:00
|
|
|
#include "Plugins/Process/elf-core/ProcessElfCore.h"
|
|
|
|
#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
|
|
|
|
#include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h"
|
|
|
|
#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
|
|
|
|
#include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h"
|
|
|
|
#include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h"
|
|
|
|
#include "Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h"
|
|
|
|
#include "Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h"
|
|
|
|
|
2012-08-24 05:17:11 +08:00
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
|
|
|
#include "Plugins/OperatingSystem/Python/OperatingSystemPython.h"
|
|
|
|
#endif
|
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"
|
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"
|
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"
|
2013-04-05 09:03:25 +08:00
|
|
|
#include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h"
|
2012-02-25 14:56:35 +08:00
|
|
|
#include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h"
|
2013-11-15 08:17:32 +08:00
|
|
|
#include "Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h"
|
2010-06-14 03:36:42 +08:00
|
|
|
#endif
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2012-02-09 14:16:32 +08:00
|
|
|
#include "Plugins/Process/mach-core/ProcessMachCore.h"
|
|
|
|
|
2013-07-18 00:06:12 +08:00
|
|
|
|
2011-03-09 06:40:15 +08:00
|
|
|
#if defined (__linux__)
|
|
|
|
#include "Plugins/Process/Linux/ProcessLinux.h"
|
2010-07-24 10:19:04 +08:00
|
|
|
#endif
|
|
|
|
|
2014-07-29 00:45:18 +08:00
|
|
|
#if defined (_WIN32)
|
2014-12-13 02:10:52 +08:00
|
|
|
#include "lldb/Host/windows/windows.h"
|
2014-12-06 02:45:53 +08:00
|
|
|
#include "Plugins/Process/Windows/DynamicLoaderWindows.h"
|
2014-07-29 00:45:18 +08:00
|
|
|
#include "Plugins/Process/Windows/ProcessWindows.h"
|
|
|
|
#endif
|
|
|
|
|
2011-08-03 04:52:42 +08:00
|
|
|
#if defined (__FreeBSD__)
|
2012-01-06 03:17:38 +08:00
|
|
|
#include "Plugins/Process/POSIX/ProcessPOSIX.h"
|
|
|
|
#include "Plugins/Process/FreeBSD/ProcessFreeBSD.h"
|
2011-08-03 04:52:42 +08:00
|
|
|
#endif
|
|
|
|
|
2011-03-24 12:28:38 +08:00
|
|
|
#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
|
2013-01-08 22:55:36 +08:00
|
|
|
#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
|
2011-03-05 09:04:56 +08:00
|
|
|
#include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
|
2014-09-04 09:03:18 +08:00
|
|
|
#include "Plugins/MemoryHistory/asan/MemoryHistoryASan.h"
|
LLDB AddressSanitizer instrumentation runtime plugin, breakpint on error and report data extraction
Reviewed at http://reviews.llvm.org/D5592
This patch gives LLDB some ability to interact with AddressSanitizer runtime library, on top of what we already have (historical memory stack traces provided by ASan). Namely, that's the ability to stop on an error caught by ASan, and access the report information that are associated with it. The report information is also exposed into SB API.
More precisely this patch...
adds a new plugin type, InstrumentationRuntime, which should serve as a generic superclass for other instrumentation runtime libraries, these plugins get notified when modules are loaded, so they get a chance to "activate" when a specific dynamic library is loaded
an instance of this plugin type, AddressSanitizerRuntime, which activates itself when it sees the ASan dynamic library or founds ASan statically linked in the executable
adds a collection of these plugins into the Process class
AddressSanitizerRuntime sets an internal breakpoint on __asan::AsanDie(), and when this breakpoint gets hit, it retrieves the report information from ASan
this breakpoint is then exposed as a new StopReason, eStopReasonInstrumentation, with a new StopInfo subclass, InstrumentationRuntimeStopInfo
the StopInfo superclass is extended with a m_extended_info field (it's a StructuredData::ObjectSP), that can hold arbitrary JSON-like data, which is the way the new plugin provides the report data
the "thread info" command now accepts a "-s" flag that prints out the JSON data of a stop reason (same way the "-j" flag works now)
SBThread has a new API, GetStopReasonExtendedInfoAsJSON, which dumps the JSON string into a SBStream
adds a test case for all of this
I plan to also get rid of the original ASan plugin (memory history stack traces) and use an instance of AddressSanitizerRuntime for that purpose.
Kuba
llvm-svn: 219546
2014-10-11 07:43:03 +08:00
|
|
|
#include "Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.h"
|
2011-03-05 09:04:56 +08:00
|
|
|
|
2010-12-17 05:33:41 +08:00
|
|
|
using namespace lldb;
|
2010-06-09 00:52:24 +08:00
|
|
|
using namespace lldb_private;
|
|
|
|
|
2014-08-23 08:47:22 +08:00
|
|
|
static void fatal_error_handler(void *user_data, const std::string& reason,
|
|
|
|
bool gen_crash_diag) {
|
|
|
|
Host::SetCrashDescription(reason.c_str());
|
|
|
|
::abort();
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
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;
|
2014-12-13 02:10:52 +08:00
|
|
|
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
const char *disable_crash_dialog_var = getenv("LLDB_DISABLE_CRASH_DIALOG");
|
|
|
|
if (disable_crash_dialog_var && llvm::StringRef(disable_crash_dialog_var).equals_lower("true"))
|
|
|
|
{
|
|
|
|
// This will prevent Windows from displaying a dialog box requiring user interaction when
|
|
|
|
// LLDB crashes. This is mostly useful when automating LLDB, for example via the test
|
|
|
|
// suite, so that a crash in LLDB does not prevent completion of the test suite.
|
|
|
|
::SetErrorMode(GetErrorMode() | SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
|
|
|
|
|
|
|
|
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
|
|
|
|
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
|
|
|
|
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
|
|
|
|
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
|
|
|
|
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
|
|
|
|
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-11-19 07:32:35 +08:00
|
|
|
Log::Initialize();
|
2014-08-22 01:57:03 +08:00
|
|
|
HostInfo::Initialize();
|
2010-06-09 00:52:24 +08:00
|
|
|
Timer::Initialize ();
|
|
|
|
Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
|
2014-08-23 08:47:22 +08:00
|
|
|
|
|
|
|
// Initialize LLVM and Clang
|
|
|
|
llvm::InitializeAllTargets();
|
|
|
|
llvm::InitializeAllAsmPrinters();
|
|
|
|
llvm::InitializeAllTargetMCs();
|
|
|
|
llvm::InitializeAllDisassemblers();
|
|
|
|
llvm::install_fatal_error_handler(fatal_error_handler, 0);
|
|
|
|
|
|
|
|
// Initialize plug-ins
|
2011-05-20 02:32:34 +08:00
|
|
|
ABIMacOSX_i386::Initialize();
|
|
|
|
ABIMacOSX_arm::Initialize();
|
2014-03-30 02:54:20 +08:00
|
|
|
ABIMacOSX_arm64::Initialize();
|
2011-05-20 01:34:40 +08:00
|
|
|
ABISysV_x86_64::Initialize();
|
2014-10-31 10:34:28 +08:00
|
|
|
ABISysV_ppc::Initialize();
|
|
|
|
ABISysV_ppc64::Initialize();
|
2012-02-17 08:53:45 +08:00
|
|
|
DisassemblerLLVMC::Initialize();
|
2010-06-14 03:36:42 +08:00
|
|
|
ObjectContainerBSDArchive::Initialize();
|
|
|
|
ObjectFileELF::Initialize();
|
2013-07-02 03:45:50 +08:00
|
|
|
SymbolVendorELF::Initialize();
|
2010-06-14 03:36:42 +08:00
|
|
|
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 ();
|
2014-03-30 02:54:20 +08:00
|
|
|
EmulateInstructionARM64::Initialize ();
|
2011-09-10 04:33:05 +08:00
|
|
|
ObjectFilePECOFF::Initialize ();
|
2012-04-06 01:38:07 +08:00
|
|
|
DynamicLoaderPOSIXDYLD::Initialize ();
|
2012-02-28 03:12:12 +08:00
|
|
|
PlatformFreeBSD::Initialize();
|
|
|
|
PlatformLinux::Initialize();
|
2013-10-15 20:32:12 +08:00
|
|
|
PlatformWindows::Initialize();
|
2014-07-16 23:03:10 +08:00
|
|
|
PlatformKalimba::Initialize();
|
2012-12-15 05:03:37 +08:00
|
|
|
SymbolFileDWARFDebugMap::Initialize();
|
|
|
|
ItaniumABILanguageRuntime::Initialize();
|
2012-08-24 05:17:11 +08:00
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
2014-01-28 07:43:24 +08:00
|
|
|
ScriptInterpreterPython::InitializePrivate();
|
2012-08-24 05:17:11 +08:00
|
|
|
OperatingSystemPython::Initialize();
|
|
|
|
#endif
|
2014-03-06 08:14:12 +08:00
|
|
|
JITLoaderGDB::Initialize();
|
|
|
|
ProcessElfCore::Initialize();
|
2014-09-04 09:03:18 +08:00
|
|
|
MemoryHistoryASan::Initialize();
|
LLDB AddressSanitizer instrumentation runtime plugin, breakpint on error and report data extraction
Reviewed at http://reviews.llvm.org/D5592
This patch gives LLDB some ability to interact with AddressSanitizer runtime library, on top of what we already have (historical memory stack traces provided by ASan). Namely, that's the ability to stop on an error caught by ASan, and access the report information that are associated with it. The report information is also exposed into SB API.
More precisely this patch...
adds a new plugin type, InstrumentationRuntime, which should serve as a generic superclass for other instrumentation runtime libraries, these plugins get notified when modules are loaded, so they get a chance to "activate" when a specific dynamic library is loaded
an instance of this plugin type, AddressSanitizerRuntime, which activates itself when it sees the ASan dynamic library or founds ASan statically linked in the executable
adds a collection of these plugins into the Process class
AddressSanitizerRuntime sets an internal breakpoint on __asan::AsanDie(), and when this breakpoint gets hit, it retrieves the report information from ASan
this breakpoint is then exposed as a new StopReason, eStopReasonInstrumentation, with a new StopInfo subclass, InstrumentationRuntimeStopInfo
the StopInfo superclass is extended with a m_extended_info field (it's a StructuredData::ObjectSP), that can hold arbitrary JSON-like data, which is the way the new plugin provides the report data
the "thread info" command now accepts a "-s" flag that prints out the JSON data of a stop reason (same way the "-j" flag works now)
SBThread has a new API, GetStopReasonExtendedInfoAsJSON, which dumps the JSON string into a SBStream
adds a test case for all of this
I plan to also get rid of the original ASan plugin (memory history stack traces) and use an instance of AddressSanitizerRuntime for that purpose.
Kuba
llvm-svn: 219546
2014-10-11 07:43:03 +08:00
|
|
|
AddressSanitizerRuntime::Initialize();
|
2014-03-06 08:14:12 +08:00
|
|
|
|
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();
|
2010-09-23 10:01:19 +08:00
|
|
|
AppleObjCRuntimeV2::Initialize();
|
2010-11-05 02:30:59 +08:00
|
|
|
AppleObjCRuntimeV1::Initialize();
|
2010-06-09 00:52:24 +08:00
|
|
|
ObjectContainerUniversalMachO::Initialize();
|
|
|
|
ObjectFileMachO::Initialize();
|
2012-06-01 09:39:46 +08:00
|
|
|
ProcessKDP::Initialize();
|
2012-02-09 14:16:32 +08:00
|
|
|
ProcessMachCore::Initialize();
|
2010-07-24 10:19:04 +08:00
|
|
|
SymbolVendorMacOSX::Initialize();
|
2013-04-05 09:03:25 +08:00
|
|
|
PlatformDarwinKernel::Initialize();
|
2011-03-19 09:12:21 +08:00
|
|
|
PlatformRemoteiOS::Initialize();
|
2012-03-21 02:34:04 +08:00
|
|
|
PlatformMacOSX::Initialize();
|
2012-02-25 14:56:35 +08:00
|
|
|
PlatformiOSSimulator::Initialize();
|
2013-11-15 08:17:32 +08:00
|
|
|
SystemRuntimeMacOSX::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
|
|
|
|
//----------------------------------------------------------------------
|
2010-07-24 10:19:04 +08:00
|
|
|
ProcessLinux::Initialize();
|
2011-08-03 04:52:42 +08:00
|
|
|
#endif
|
2014-07-29 00:45:18 +08:00
|
|
|
#if defined(_WIN32)
|
2014-12-06 02:45:53 +08:00
|
|
|
DynamicLoaderWindows::Initialize();
|
2014-07-29 00:45:18 +08:00
|
|
|
ProcessWindows::Initialize();
|
|
|
|
#endif
|
2011-08-03 04:52:42 +08:00
|
|
|
#if defined (__FreeBSD__)
|
2012-01-06 03:17:38 +08:00
|
|
|
ProcessFreeBSD::Initialize();
|
2010-06-14 03:36:42 +08:00
|
|
|
#endif
|
2013-07-18 00:06:12 +08:00
|
|
|
|
2011-03-24 12:28:38 +08:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Platform agnostic plugins
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
PlatformRemoteGDBServer::Initialize ();
|
2013-01-08 22:55:36 +08:00
|
|
|
ProcessGDBRemote::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();
|
2014-03-30 02:54:20 +08:00
|
|
|
ABIMacOSX_arm64::Terminate();
|
2011-05-20 01:34:40 +08:00
|
|
|
ABISysV_x86_64::Terminate();
|
2014-10-31 23:57:52 +08:00
|
|
|
ABISysV_ppc::Terminate();
|
2014-10-31 10:34:28 +08:00
|
|
|
ABISysV_ppc64::Terminate();
|
2012-02-17 08:53:45 +08:00
|
|
|
DisassemblerLLVMC::Terminate();
|
2010-06-09 00:52:24 +08:00
|
|
|
ObjectContainerBSDArchive::Terminate();
|
|
|
|
ObjectFileELF::Terminate();
|
2013-07-02 03:45:50 +08:00
|
|
|
SymbolVendorELF::Terminate();
|
2010-06-09 00:52:24 +08:00
|
|
|
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 ();
|
2014-03-30 02:54:20 +08:00
|
|
|
EmulateInstructionARM64::Terminate ();
|
2011-09-10 04:33:05 +08:00
|
|
|
ObjectFilePECOFF::Terminate ();
|
2012-04-06 01:38:07 +08:00
|
|
|
DynamicLoaderPOSIXDYLD::Terminate ();
|
2012-02-28 03:12:12 +08:00
|
|
|
PlatformFreeBSD::Terminate();
|
|
|
|
PlatformLinux::Terminate();
|
2013-10-15 20:32:12 +08:00
|
|
|
PlatformWindows::Terminate();
|
2014-07-16 23:03:10 +08:00
|
|
|
PlatformKalimba::Terminate();
|
2012-12-15 05:03:37 +08:00
|
|
|
SymbolFileDWARFDebugMap::Terminate();
|
|
|
|
ItaniumABILanguageRuntime::Terminate();
|
2012-08-24 05:17:11 +08:00
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
|
|
|
OperatingSystemPython::Terminate();
|
|
|
|
#endif
|
2014-03-06 08:14:12 +08:00
|
|
|
JITLoaderGDB::Terminate();
|
|
|
|
ProcessElfCore::Terminate();
|
2014-09-04 09:03:18 +08:00
|
|
|
MemoryHistoryASan::Terminate();
|
LLDB AddressSanitizer instrumentation runtime plugin, breakpint on error and report data extraction
Reviewed at http://reviews.llvm.org/D5592
This patch gives LLDB some ability to interact with AddressSanitizer runtime library, on top of what we already have (historical memory stack traces provided by ASan). Namely, that's the ability to stop on an error caught by ASan, and access the report information that are associated with it. The report information is also exposed into SB API.
More precisely this patch...
adds a new plugin type, InstrumentationRuntime, which should serve as a generic superclass for other instrumentation runtime libraries, these plugins get notified when modules are loaded, so they get a chance to "activate" when a specific dynamic library is loaded
an instance of this plugin type, AddressSanitizerRuntime, which activates itself when it sees the ASan dynamic library or founds ASan statically linked in the executable
adds a collection of these plugins into the Process class
AddressSanitizerRuntime sets an internal breakpoint on __asan::AsanDie(), and when this breakpoint gets hit, it retrieves the report information from ASan
this breakpoint is then exposed as a new StopReason, eStopReasonInstrumentation, with a new StopInfo subclass, InstrumentationRuntimeStopInfo
the StopInfo superclass is extended with a m_extended_info field (it's a StructuredData::ObjectSP), that can hold arbitrary JSON-like data, which is the way the new plugin provides the report data
the "thread info" command now accepts a "-s" flag that prints out the JSON data of a stop reason (same way the "-j" flag works now)
SBThread has a new API, GetStopReasonExtendedInfoAsJSON, which dumps the JSON string into a SBStream
adds a test case for all of this
I plan to also get rid of the original ASan plugin (memory history stack traces) and use an instance of AddressSanitizerRuntime for that purpose.
Kuba
llvm-svn: 219546
2014-10-11 07:43:03 +08:00
|
|
|
AddressSanitizerRuntime::Terminate();
|
2014-03-07 07:29:58 +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();
|
2010-11-05 02:30:59 +08:00
|
|
|
AppleObjCRuntimeV2::Terminate();
|
|
|
|
AppleObjCRuntimeV1::Terminate();
|
2010-06-14 03:36:42 +08:00
|
|
|
ObjectContainerUniversalMachO::Terminate();
|
|
|
|
ObjectFileMachO::Terminate();
|
2012-02-09 14:16:32 +08:00
|
|
|
ProcessMachCore::Terminate();
|
2012-06-01 09:39:46 +08:00
|
|
|
ProcessKDP::Terminate();
|
2010-07-24 10:19:04 +08:00
|
|
|
SymbolVendorMacOSX::Terminate();
|
2011-03-09 06:40:15 +08:00
|
|
|
PlatformMacOSX::Terminate();
|
2013-04-05 09:03:25 +08:00
|
|
|
PlatformDarwinKernel::Terminate();
|
2011-03-19 09:12:21 +08:00
|
|
|
PlatformRemoteiOS::Terminate();
|
2012-02-25 14:56:35 +08:00
|
|
|
PlatformiOSSimulator::Terminate();
|
2013-11-15 08:17:32 +08:00
|
|
|
SystemRuntimeMacOSX::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
|
|
|
|
2014-12-06 02:45:53 +08:00
|
|
|
#if defined (_WIN32)
|
|
|
|
DynamicLoaderWindows::Terminate();
|
|
|
|
#endif
|
|
|
|
|
2011-03-09 06:40:15 +08:00
|
|
|
#if defined (__linux__)
|
2010-07-24 10:19:04 +08:00
|
|
|
ProcessLinux::Terminate();
|
2010-06-14 03:36:42 +08:00
|
|
|
#endif
|
2011-08-03 04:52:42 +08:00
|
|
|
|
|
|
|
#if defined (__FreeBSD__)
|
2012-01-06 03:17:38 +08:00
|
|
|
ProcessFreeBSD::Terminate();
|
2011-08-03 04:52:42 +08:00
|
|
|
#endif
|
2013-07-18 00:06:12 +08:00
|
|
|
|
2013-01-08 22:55:36 +08:00
|
|
|
ProcessGDBRemote::Terminate();
|
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
|
|
|
}
|
|
|
|
|
2013-03-01 00:51:15 +08:00
|
|
|
#if defined (__APPLE__)
|
2013-03-08 06:29:06 +08:00
|
|
|
extern "C" const unsigned char liblldb_coreVersionString[];
|
2013-03-01 02:09:18 +08:00
|
|
|
#else
|
|
|
|
|
|
|
|
#include "clang/Basic/Version.h"
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
GetLLDBRevision()
|
|
|
|
{
|
|
|
|
#ifdef LLDB_REVISION
|
|
|
|
return LLDB_REVISION;
|
|
|
|
#else
|
|
|
|
return NULL;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
GetLLDBRepository()
|
|
|
|
{
|
|
|
|
#ifdef LLDB_REPOSITORY
|
|
|
|
return LLDB_REPOSITORY;
|
|
|
|
#else
|
|
|
|
return NULL;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-03-01 00:51:15 +08:00
|
|
|
#endif
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
const char *
|
|
|
|
lldb_private::GetVersion ()
|
|
|
|
{
|
2013-03-01 00:51:15 +08:00
|
|
|
#if defined (__APPLE__)
|
2010-06-09 00:52:24 +08:00
|
|
|
static char g_version_string[32];
|
|
|
|
if (g_version_string[0] == '\0')
|
2013-03-08 06:29:06 +08:00
|
|
|
{
|
|
|
|
const char *version_string = ::strstr ((const char *)liblldb_coreVersionString, "PROJECT:");
|
|
|
|
|
|
|
|
if (version_string)
|
|
|
|
version_string += sizeof("PROJECT:") - 1;
|
|
|
|
else
|
|
|
|
version_string = "unknown";
|
|
|
|
|
|
|
|
const char *newline_loc = strchr(version_string, '\n');
|
|
|
|
|
|
|
|
size_t version_len = sizeof(g_version_string);
|
|
|
|
|
2014-04-02 11:51:35 +08:00
|
|
|
if (newline_loc &&
|
|
|
|
(newline_loc - version_string < static_cast<ptrdiff_t>(version_len)))
|
2013-03-08 06:29:06 +08:00
|
|
|
version_len = newline_loc - version_string;
|
|
|
|
|
|
|
|
::strncpy(g_version_string, version_string, version_len);
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
return g_version_string;
|
2013-03-01 00:51:15 +08:00
|
|
|
#else
|
|
|
|
// On Linux/FreeBSD/Windows, report a version number in the same style as the clang tool.
|
2013-03-01 02:09:18 +08:00
|
|
|
static std::string g_version_str;
|
|
|
|
if (g_version_str.empty())
|
|
|
|
{
|
|
|
|
g_version_str += "lldb version ";
|
|
|
|
g_version_str += CLANG_VERSION_STRING;
|
|
|
|
const char * lldb_repo = GetLLDBRepository();
|
|
|
|
if (lldb_repo)
|
|
|
|
{
|
|
|
|
g_version_str += " (";
|
|
|
|
g_version_str += lldb_repo;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *lldb_rev = GetLLDBRevision();
|
|
|
|
if (lldb_rev)
|
|
|
|
{
|
|
|
|
g_version_str += " revision ";
|
|
|
|
g_version_str += lldb_rev;
|
|
|
|
}
|
|
|
|
std::string clang_rev (clang::getClangRevision());
|
|
|
|
if (clang_rev.length() > 0)
|
|
|
|
{
|
|
|
|
g_version_str += " clang revision ";
|
|
|
|
g_version_str += clang_rev;
|
|
|
|
}
|
|
|
|
std::string llvm_rev (clang::getLLVMRevision());
|
|
|
|
if (llvm_rev.length() > 0)
|
|
|
|
{
|
|
|
|
g_version_str += " llvm revision ";
|
|
|
|
g_version_str += llvm_rev;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lldb_repo)
|
|
|
|
g_version_str += ")";
|
|
|
|
}
|
|
|
|
return g_version_str.c_str();
|
2013-03-01 00:51:15 +08:00
|
|
|
#endif
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
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";
|
|
|
|
}
|
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";
|
2013-07-02 03:45:50 +08:00
|
|
|
case eSectionTypeELFSymbolTable: return "elf-symbol-table";
|
|
|
|
case eSectionTypeELFDynamicSymbols: return "elf-dynamic-symbols";
|
|
|
|
case eSectionTypeELFRelocationEntries: return "elf-relocation-entries";
|
|
|
|
case eSectionTypeELFDynamicLinkInfo: return "elf-dynamic-link-info";
|
2011-09-29 01:06:40 +08:00
|
|
|
case eSectionTypeDWARFAppleNames: return "apple-names";
|
|
|
|
case eSectionTypeDWARFAppleTypes: return "apple-types";
|
2011-10-05 06:41:51 +08:00
|
|
|
case eSectionTypeDWARFAppleNamespaces: return "apple-namespaces";
|
Added support for the new ".apple_objc" accelerator tables. These tables are
in the same hashed format as the ".apple_names", but they map objective C
class names to all of the methods and class functions. We need to do this
because in the DWARF the methods for Objective C are never contained in the
class definition, they are scattered about at the translation unit level and
they don't even have attributes that say the are contained within the class
itself.
Added 3 new formats which can be used to display data:
eFormatAddressInfo
eFormatHexFloat
eFormatInstruction
eFormatAddressInfo describes an address such as function+offset and file+line,
or symbol + offset, or constant data (c string, 2, 4, 8, or 16 byte constants).
The format character for this is "A", the long format is "address".
eFormatHexFloat will print out the hex float format that compilers tend to use.
The format character for this is "X", the long format is "hex float".
eFormatInstruction will print out disassembly with bytes and it will use the
current target's architecture. The format character for this is "i" (which
used to be being used for the integer format, but the integer format also has
"d", so we gave the "i" format to disassembly), the long format is
"instruction".
Mate the lldb::FormatterChoiceCriterion enumeration private as it should have
been from the start. It is very specialized and doesn't belong in the public
API.
llvm-svn: 143114
2011-10-28 01:55:14 +08:00
|
|
|
case eSectionTypeDWARFAppleObjC: return "apple-objc";
|
2010-10-08 08:21:05 +08:00
|
|
|
case eSectionTypeEHFrame: return "eh-frame";
|
2014-12-08 11:09:00 +08:00
|
|
|
case eSectionTypeCompactUnwind: return "compact-unwind";
|
2010-10-08 08:21:05 +08:00
|
|
|
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)
|
|
|
|
{
|
2013-10-14 22:06:28 +08:00
|
|
|
case eNameMatchIgnore: // This case cannot occur: tested before
|
|
|
|
return true;
|
2011-03-09 06:40:15 +08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|