aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/lldb/API/LLDB.h1
-rw-r--r--include/lldb/API/SBAddress.h2
-rw-r--r--include/lldb/API/SBAttachInfo.h149
-rw-r--r--include/lldb/API/SBBlock.h2
-rw-r--r--include/lldb/API/SBBreakpoint.h2
-rw-r--r--include/lldb/API/SBBreakpointLocation.h6
-rw-r--r--include/lldb/API/SBBroadcaster.h2
-rw-r--r--include/lldb/API/SBCommandInterpreter.h33
-rw-r--r--include/lldb/API/SBCommandReturnObject.h2
-rw-r--r--include/lldb/API/SBCommunication.h5
-rw-r--r--include/lldb/API/SBCompileUnit.h2
-rw-r--r--include/lldb/API/SBData.h2
-rw-r--r--include/lldb/API/SBDebugger.h4
-rw-r--r--include/lldb/API/SBDeclaration.h2
-rw-r--r--include/lldb/API/SBDefines.h3
-rw-r--r--include/lldb/API/SBError.h2
-rw-r--r--include/lldb/API/SBEvent.h3
-rw-r--r--include/lldb/API/SBExecutionContext.h2
-rw-r--r--include/lldb/API/SBExpressionOptions.h8
-rw-r--r--include/lldb/API/SBFileSpec.h2
-rw-r--r--include/lldb/API/SBFileSpecList.h2
-rw-r--r--include/lldb/API/SBFrame.h21
-rw-r--r--include/lldb/API/SBFunction.h2
-rw-r--r--include/lldb/API/SBHostOS.h2
-rw-r--r--include/lldb/API/SBInstruction.h2
-rw-r--r--include/lldb/API/SBInstructionList.h2
-rw-r--r--include/lldb/API/SBLanguageRuntime.h29
-rw-r--r--include/lldb/API/SBLaunchInfo.h13
-rw-r--r--include/lldb/API/SBLineEntry.h2
-rw-r--r--include/lldb/API/SBListener.h2
-rw-r--r--include/lldb/API/SBModule.h21
-rw-r--r--include/lldb/API/SBModuleSpec.h2
-rw-r--r--include/lldb/API/SBPlatform.h6
-rw-r--r--include/lldb/API/SBProcess.h24
-rw-r--r--include/lldb/API/SBQueue.h2
-rw-r--r--include/lldb/API/SBQueueItem.h2
-rw-r--r--include/lldb/API/SBSection.h2
-rw-r--r--include/lldb/API/SBSourceManager.h2
-rw-r--r--include/lldb/API/SBStream.h2
-rw-r--r--include/lldb/API/SBStringList.h2
-rw-r--r--include/lldb/API/SBSymbol.h2
-rw-r--r--include/lldb/API/SBSymbolContext.h2
-rw-r--r--include/lldb/API/SBSymbolContextList.h2
-rw-r--r--include/lldb/API/SBTarget.h165
-rw-r--r--include/lldb/API/SBThread.h2
-rw-r--r--include/lldb/API/SBThreadCollection.h2
-rw-r--r--include/lldb/API/SBThreadPlan.h2
-rw-r--r--include/lldb/API/SBType.h2
-rw-r--r--include/lldb/API/SBTypeCategory.h2
-rw-r--r--include/lldb/API/SBTypeEnumMember.h2
-rw-r--r--include/lldb/API/SBTypeFilter.h2
-rw-r--r--include/lldb/API/SBTypeFormat.h2
-rw-r--r--include/lldb/API/SBTypeNameSpecifier.h2
-rw-r--r--include/lldb/API/SBTypeSummary.h2
-rw-r--r--include/lldb/API/SBTypeSynthetic.h2
-rw-r--r--include/lldb/API/SBUnixSignals.h2
-rw-r--r--include/lldb/API/SBValue.h14
-rw-r--r--include/lldb/API/SBValueList.h2
-rw-r--r--include/lldb/API/SBVariablesOptions.h98
-rw-r--r--include/lldb/API/SBWatchpoint.h2
-rw-r--r--include/lldb/API/SystemInitializerFull.h40
-rw-r--r--include/lldb/Breakpoint/Breakpoint.h58
-rw-r--r--include/lldb/Breakpoint/BreakpointLocation.h5
-rw-r--r--include/lldb/Breakpoint/BreakpointOptions.h3
-rw-r--r--include/lldb/Breakpoint/BreakpointResolverFileLine.h4
-rw-r--r--include/lldb/Breakpoint/BreakpointResolverFileRegex.h4
-rw-r--r--include/lldb/Breakpoint/BreakpointSite.h2
-rw-r--r--include/lldb/Breakpoint/Watchpoint.h18
-rw-r--r--include/lldb/Core/Address.h2
-rw-r--r--include/lldb/Core/ArchSpec.h141
-rw-r--r--include/lldb/Core/ClangForward.h3
-rw-r--r--include/lldb/Core/Communication.h30
-rw-r--r--include/lldb/Core/Connection.h23
-rw-r--r--include/lldb/Core/ConstString.h2
-rw-r--r--include/lldb/Core/CxaDemangle.h21
-rw-r--r--include/lldb/Core/DataEncoder.h4
-rw-r--r--include/lldb/Core/DataExtractor.h14
-rw-r--r--include/lldb/Core/Debugger.h30
-rw-r--r--include/lldb/Core/Disassembler.h11
-rw-r--r--include/lldb/Core/FastDemangle.h24
-rw-r--r--include/lldb/Core/FormatEntity.h3
-rw-r--r--include/lldb/Core/IOHandler.h150
-rw-r--r--include/lldb/Core/Log.h140
-rw-r--r--include/lldb/Core/Logging.h (renamed from include/lldb/lldb-private-log.h)9
-rw-r--r--include/lldb/Core/Mangled.h17
-rw-r--r--include/lldb/Core/Module.h12
-rw-r--r--include/lldb/Core/ModuleList.h4
-rw-r--r--include/lldb/Core/ModuleSpec.h33
-rw-r--r--include/lldb/Core/PluginManager.h6
-rw-r--r--include/lldb/Core/RangeMap.h27
-rw-r--r--include/lldb/Core/StreamAsynchronousIO.h8
-rw-r--r--include/lldb/Core/StreamFile.h4
-rw-r--r--include/lldb/Core/StringList.h4
-rw-r--r--include/lldb/Core/StructuredData.h406
-rw-r--r--include/lldb/Core/ThreadSafeDenseSet.h65
-rw-r--r--include/lldb/Core/ValueObject.h65
-rw-r--r--include/lldb/Core/ValueObjectChild.h3
-rw-r--r--include/lldb/Core/ValueObjectDynamicValue.h12
-rw-r--r--include/lldb/Core/ValueObjectSyntheticFilter.h15
-rw-r--r--include/lldb/DataFormatters/CXXFormatterFunctions.h35
-rw-r--r--include/lldb/DataFormatters/FormatManager.h4
-rw-r--r--include/lldb/DataFormatters/TypeFormat.h27
-rw-r--r--include/lldb/DataFormatters/TypeSummary.h33
-rw-r--r--include/lldb/DataFormatters/TypeSynthetic.h30
-rw-r--r--include/lldb/DataFormatters/TypeValidator.h27
-rw-r--r--include/lldb/DataFormatters/ValueObjectPrinter.h5
-rw-r--r--include/lldb/DataFormatters/VectorType.h0
-rw-r--r--include/lldb/Expression/ClangASTSource.h127
-rw-r--r--include/lldb/Expression/ClangExpressionDeclMap.h21
-rw-r--r--include/lldb/Expression/ClangExpressionParser.h1
-rw-r--r--include/lldb/Expression/ClangFunction.h3
-rw-r--r--include/lldb/Expression/ClangModulesDeclVendor.h73
-rw-r--r--include/lldb/Expression/ClangPersistentVariables.h16
-rw-r--r--include/lldb/Expression/ClangUserExpression.h13
-rw-r--r--include/lldb/Expression/IRForTarget.h3
-rw-r--r--include/lldb/Expression/IRMemoryMap.h12
-rw-r--r--include/lldb/Expression/IRToDWARF.h2
-rw-r--r--include/lldb/Host/Editline.h18
-rw-r--r--include/lldb/Host/File.h2
-rw-r--r--include/lldb/Host/FileSpec.h131
-rw-r--r--include/lldb/Host/FileSystem.h31
-rw-r--r--include/lldb/Host/Host.h45
-rw-r--r--include/lldb/Host/HostInfo.h5
-rw-r--r--include/lldb/Host/HostInfoBase.h4
-rw-r--r--include/lldb/Host/LockFile.h27
-rw-r--r--include/lldb/Host/LockFileBase.h73
-rw-r--r--include/lldb/Host/PipeBase.h2
-rw-r--r--include/lldb/Host/Socket.h7
-rw-r--r--include/lldb/Host/Time.h26
-rw-r--r--include/lldb/Host/XML.h234
-rw-r--r--include/lldb/Host/common/NativeBreakpointList.h3
-rw-r--r--include/lldb/Host/common/NativeProcessProtocol.h20
-rw-r--r--include/lldb/Host/common/NativeRegisterContext.h19
-rw-r--r--include/lldb/Host/common/SoftwareBreakpoint.h2
-rw-r--r--include/lldb/Host/posix/ConnectionFileDescriptorPosix.h18
-rw-r--r--include/lldb/Host/posix/Fcntl.h25
-rw-r--r--include/lldb/Host/posix/HostProcessPosix.h10
-rw-r--r--include/lldb/Host/posix/HostThreadPosix.h4
-rw-r--r--include/lldb/Host/posix/LockFilePosix.h42
-rw-r--r--include/lldb/Host/posix/PipePosix.h17
-rw-r--r--include/lldb/Host/posix/ProcessLauncherPosix.h2
-rw-r--r--include/lldb/Initialization/SystemInitializer.h26
-rw-r--r--include/lldb/Initialization/SystemInitializerCommon.h38
-rw-r--r--include/lldb/Initialization/SystemLifetimeManager.h42
-rw-r--r--include/lldb/Interpreter/Args.h17
-rw-r--r--include/lldb/Interpreter/CommandInterpreter.h13
-rw-r--r--include/lldb/Interpreter/CommandObject.h90
-rw-r--r--include/lldb/Interpreter/OptionValue.h16
-rw-r--r--include/lldb/Interpreter/OptionValueArch.h2
-rw-r--r--include/lldb/Interpreter/OptionValueArray.h2
-rw-r--r--include/lldb/Interpreter/OptionValueBoolean.h2
-rw-r--r--include/lldb/Interpreter/OptionValueChar.h2
-rw-r--r--include/lldb/Interpreter/OptionValueDictionary.h2
-rw-r--r--include/lldb/Interpreter/OptionValueEnumeration.h2
-rw-r--r--include/lldb/Interpreter/OptionValueFileSpec.h13
-rw-r--r--include/lldb/Interpreter/OptionValueFileSpecList.h2
-rw-r--r--include/lldb/Interpreter/OptionValueFormat.h2
-rw-r--r--include/lldb/Interpreter/OptionValueFormatEntity.h2
-rw-r--r--include/lldb/Interpreter/OptionValueLanguage.h107
-rw-r--r--include/lldb/Interpreter/OptionValuePathMappings.h2
-rw-r--r--include/lldb/Interpreter/OptionValueProperties.h2
-rw-r--r--include/lldb/Interpreter/OptionValueRegex.h2
-rw-r--r--include/lldb/Interpreter/OptionValueSInt64.h2
-rw-r--r--include/lldb/Interpreter/OptionValueString.h2
-rw-r--r--include/lldb/Interpreter/OptionValueUInt64.h2
-rw-r--r--include/lldb/Interpreter/OptionValueUUID.h2
-rw-r--r--include/lldb/Interpreter/OptionValues.h1
-rw-r--r--include/lldb/Interpreter/PythonDataObjects.h107
-rw-r--r--include/lldb/Interpreter/ScriptInterpreter.h323
-rw-r--r--include/lldb/Interpreter/ScriptInterpreterPython.h288
-rw-r--r--include/lldb/Symbol/ClangASTContext.h2
-rw-r--r--include/lldb/Symbol/ClangASTType.h4
-rw-r--r--include/lldb/Symbol/ClangExternalASTSourceCallbacks.h76
-rw-r--r--include/lldb/Symbol/CompileUnit.h25
-rw-r--r--include/lldb/Symbol/DWARFCallFrameInfo.h10
-rw-r--r--include/lldb/Symbol/FuncUnwinders.h4
-rw-r--r--include/lldb/Symbol/ObjectFile.h7
-rw-r--r--include/lldb/Symbol/Symbol.h88
-rw-r--r--include/lldb/Symbol/SymbolContext.h29
-rw-r--r--include/lldb/Symbol/SymbolFile.h1
-rw-r--r--include/lldb/Symbol/SymbolVendor.h7
-rw-r--r--include/lldb/Symbol/Symtab.h8
-rw-r--r--include/lldb/Symbol/Type.h12
-rw-r--r--include/lldb/Symbol/UnwindPlan.h248
-rw-r--r--include/lldb/Symbol/Variable.h2
-rw-r--r--include/lldb/Target/CPPLanguageRuntime.h3
-rw-r--r--include/lldb/Target/FileAction.h17
-rw-r--r--include/lldb/Target/LanguageRuntime.h30
-rw-r--r--include/lldb/Target/Memory.h17
-rw-r--r--include/lldb/Target/ObjCLanguageRuntime.h62
-rw-r--r--include/lldb/Target/Platform.h150
-rw-r--r--include/lldb/Target/Process.h262
-rw-r--r--include/lldb/Target/ProcessInfo.h2
-rw-r--r--include/lldb/Target/ProcessLaunchInfo.h36
-rw-r--r--include/lldb/Target/SectionLoadHistory.h2
-rw-r--r--include/lldb/Target/StopInfo.h8
-rw-r--r--include/lldb/Target/Target.h223
-rw-r--r--include/lldb/Target/Thread.h50
-rw-r--r--include/lldb/Target/ThreadPlanCallUserExpression.h13
-rw-r--r--include/lldb/Target/ThreadPlanPython.h5
-rw-r--r--include/lldb/Utility/ConvertEnum.h22
-rw-r--r--include/lldb/Utility/JSON.h276
-rw-r--r--include/lldb/Utility/LLDBAssert.h30
-rw-r--r--include/lldb/Utility/NameMatches.h19
-rw-r--r--include/lldb/Utility/PseudoTerminal.h4
-rw-r--r--include/lldb/Utility/SharingPtr.h11
-rw-r--r--include/lldb/lldb-defines.h2
-rw-r--r--include/lldb/lldb-enumerations.h334
-rw-r--r--include/lldb/lldb-forward.h33
-rw-r--r--include/lldb/lldb-private-interfaces.h1
-rw-r--r--include/lldb/lldb-private-types.h11
-rw-r--r--include/lldb/lldb-private.h53
212 files changed, 4782 insertions, 1838 deletions
diff --git a/include/lldb/API/LLDB.h b/include/lldb/API/LLDB.h
index 4026b2b61ba8..66e095395f13 100644
--- a/include/lldb/API/LLDB.h
+++ b/include/lldb/API/LLDB.h
@@ -52,5 +52,6 @@
#include "lldb/API/SBType.h"
#include "lldb/API/SBValue.h"
#include "lldb/API/SBValueList.h"
+#include "lldb/API/SBVariablesOptions.h"
#endif // LLDB_LLDB_h_
diff --git a/include/lldb/API/SBAddress.h b/include/lldb/API/SBAddress.h
index c2d07b6e9bcc..4cbbee9fd132 100644
--- a/include/lldb/API/SBAddress.h
+++ b/include/lldb/API/SBAddress.h
@@ -15,7 +15,7 @@
namespace lldb {
-class SBAddress
+class LLDB_API SBAddress
{
public:
diff --git a/include/lldb/API/SBAttachInfo.h b/include/lldb/API/SBAttachInfo.h
new file mode 100644
index 000000000000..712150e128be
--- /dev/null
+++ b/include/lldb/API/SBAttachInfo.h
@@ -0,0 +1,149 @@
+//===-- SBAttachInfo.h ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBAttachInfo_h_
+#define LLDB_SBAttachInfo_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class SBTarget;
+
+class LLDB_API SBAttachInfo
+{
+public:
+ SBAttachInfo ();
+
+ SBAttachInfo (lldb::pid_t pid);
+
+ SBAttachInfo (const char *path, bool wait_for);
+
+ SBAttachInfo (const SBAttachInfo &rhs);
+
+ ~SBAttachInfo();
+
+ SBAttachInfo &
+ operator = (const SBAttachInfo &rhs);
+
+ lldb::pid_t
+ GetProcessID ();
+
+ void
+ SetProcessID (lldb::pid_t pid);
+
+ void
+ SetExecutable (const char *path);
+
+ void
+ SetExecutable (lldb::SBFileSpec exe_file);
+
+ bool
+ GetWaitForLaunch ();
+
+ void
+ SetWaitForLaunch (bool b);
+
+ bool
+ GetIgnoreExisting ();
+
+ void
+ SetIgnoreExisting (bool b);
+
+ uint32_t
+ GetResumeCount ();
+
+ void
+ SetResumeCount (uint32_t c);
+
+ const char *
+ GetProcessPluginName ();
+
+ void
+ SetProcessPluginName (const char *plugin_name);
+
+ uint32_t
+ GetUserID();
+
+ uint32_t
+ GetGroupID();
+
+ bool
+ UserIDIsValid ();
+
+ bool
+ GroupIDIsValid ();
+
+ void
+ SetUserID (uint32_t uid);
+
+ void
+ SetGroupID (uint32_t gid);
+
+ uint32_t
+ GetEffectiveUserID();
+
+ uint32_t
+ GetEffectiveGroupID();
+
+ bool
+ EffectiveUserIDIsValid ();
+
+ bool
+ EffectiveGroupIDIsValid ();
+
+ void
+ SetEffectiveUserID (uint32_t uid);
+
+ void
+ SetEffectiveGroupID (uint32_t gid);
+
+ lldb::pid_t
+ GetParentProcessID ();
+
+ void
+ SetParentProcessID (lldb::pid_t pid);
+
+ bool
+ ParentProcessIDIsValid();
+
+ //----------------------------------------------------------------------
+ /// Get the listener that will be used to receive process events.
+ ///
+ /// If no listener has been set via a call to
+ /// SBLaunchInfo::SetListener(), then an invalid SBListener will be
+ /// returned (SBListener::IsValid() will return false). If a listener
+ /// has been set, then the valid listener object will be returned.
+ //----------------------------------------------------------------------
+ SBListener
+ GetListener ();
+
+ //----------------------------------------------------------------------
+ /// Set the listener that will be used to receive process events.
+ ///
+ /// By default the SBDebugger, which has a listener, that the SBTarget
+ /// belongs to will listen for the process events. Calling this function
+ /// allows a different listener to be used to listen for process events.
+ //----------------------------------------------------------------------
+ void
+ SetListener (SBListener &listener);
+
+
+protected:
+ friend class SBTarget;
+
+ lldb_private::ProcessAttachInfo &
+ ref ();
+
+ ProcessAttachInfoSP m_opaque_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBAttachInfo_h_
diff --git a/include/lldb/API/SBBlock.h b/include/lldb/API/SBBlock.h
index b8e61fc6eb27..a18eab02088b 100644
--- a/include/lldb/API/SBBlock.h
+++ b/include/lldb/API/SBBlock.h
@@ -17,7 +17,7 @@
namespace lldb {
-class SBBlock
+class LLDB_API SBBlock
{
public:
diff --git a/include/lldb/API/SBBreakpoint.h b/include/lldb/API/SBBreakpoint.h
index 20a97a1fb5a0..c244ab8a9b48 100644
--- a/include/lldb/API/SBBreakpoint.h
+++ b/include/lldb/API/SBBreakpoint.h
@@ -14,7 +14,7 @@
namespace lldb {
-class SBBreakpoint
+class LLDB_API SBBreakpoint
{
public:
diff --git a/include/lldb/API/SBBreakpointLocation.h b/include/lldb/API/SBBreakpointLocation.h
index fd9f246de4ff..ab7049739c0b 100644
--- a/include/lldb/API/SBBreakpointLocation.h
+++ b/include/lldb/API/SBBreakpointLocation.h
@@ -15,7 +15,7 @@
namespace lldb {
-class SBBreakpointLocation
+class LLDB_API SBBreakpointLocation
{
public:
@@ -101,9 +101,7 @@ public:
private:
friend class SBBreakpoint;
-#ifndef LLDB_DISABLE_PYTHON
- friend class lldb_private::ScriptInterpreterPython;
-#endif
+
void
SetLocation (const lldb::BreakpointLocationSP &break_loc_sp);
diff --git a/include/lldb/API/SBBroadcaster.h b/include/lldb/API/SBBroadcaster.h
index 7b32d85faa0f..28b6686b79b3 100644
--- a/include/lldb/API/SBBroadcaster.h
+++ b/include/lldb/API/SBBroadcaster.h
@@ -14,7 +14,7 @@
namespace lldb {
-class SBBroadcaster
+class LLDB_API SBBroadcaster
{
public:
SBBroadcaster ();
diff --git a/include/lldb/API/SBCommandInterpreter.h b/include/lldb/API/SBCommandInterpreter.h
index 947e39164140..235a2f3ea603 100644
--- a/include/lldb/API/SBCommandInterpreter.h
+++ b/include/lldb/API/SBCommandInterpreter.h
@@ -15,7 +15,7 @@
namespace lldb {
-class SBCommandInterpreterRunOptions
+class LLDB_API SBCommandInterpreterRunOptions
{
friend class SBDebugger;
friend class SBCommandInterpreter;
@@ -94,6 +94,9 @@ public:
static const char *
GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type);
+
+ static bool
+ EventIsCommandInterpreterEvent (const lldb::SBEvent &event);
bool
IsValid() const;
@@ -216,6 +219,19 @@ public:
const char *
GetIOHandlerControlSequence(char ch);
+ bool
+ GetPromptOnQuit();
+
+ void
+ SetPromptOnQuit(bool b);
+
+ //----------------------------------------------------------------------
+ /// Resolve the command just as HandleCommand would, expanding abbreviations
+ /// and aliases. If successful, result->GetOutput has the full expansion.
+ //----------------------------------------------------------------------
+ void
+ ResolveCommand(const char *command_line, SBCommandReturnObject &result);
+
protected:
lldb_private::CommandInterpreter &
@@ -266,6 +282,21 @@ public:
const char*
GetHelp ();
+ const char*
+ GetHelpLong ();
+
+ void
+ SetHelp (const char*);
+
+ void
+ SetHelpLong (const char*);
+
+ uint32_t
+ GetFlags ();
+
+ void
+ SetFlags (uint32_t flags);
+
lldb::SBCommand
AddMultiwordCommand (const char* name, const char* help = NULL);
diff --git a/include/lldb/API/SBCommandReturnObject.h b/include/lldb/API/SBCommandReturnObject.h
index f2d274802330..c51d6bc8d2d5 100644
--- a/include/lldb/API/SBCommandReturnObject.h
+++ b/include/lldb/API/SBCommandReturnObject.h
@@ -16,7 +16,7 @@
namespace lldb {
-class SBCommandReturnObject
+class LLDB_API SBCommandReturnObject
{
public:
diff --git a/include/lldb/API/SBCommunication.h b/include/lldb/API/SBCommunication.h
index ecaaa3523c91..c4b2709de8ab 100644
--- a/include/lldb/API/SBCommunication.h
+++ b/include/lldb/API/SBCommunication.h
@@ -15,10 +15,11 @@
namespace lldb {
-class SBCommunication
+class LLDB_API SBCommunication
{
public:
- enum {
+ FLAGS_ANONYMOUS_ENUM()
+ {
eBroadcastBitDisconnected = (1 << 0), ///< Sent when the communications connection is lost.
eBroadcastBitReadThreadGotBytes = (1 << 1), ///< Sent by the read thread when bytes become available.
eBroadcastBitReadThreadDidExit = (1 << 2), ///< Sent by the read thread when it exits to inform clients.
diff --git a/include/lldb/API/SBCompileUnit.h b/include/lldb/API/SBCompileUnit.h
index e2c216445d94..a53d556679c4 100644
--- a/include/lldb/API/SBCompileUnit.h
+++ b/include/lldb/API/SBCompileUnit.h
@@ -15,7 +15,7 @@
namespace lldb {
-class SBCompileUnit
+class LLDB_API SBCompileUnit
{
public:
diff --git a/include/lldb/API/SBData.h b/include/lldb/API/SBData.h
index e7656a52d9c2..a2bd72fad570 100644
--- a/include/lldb/API/SBData.h
+++ b/include/lldb/API/SBData.h
@@ -14,7 +14,7 @@
namespace lldb {
-class SBData
+class LLDB_API SBData
{
public:
diff --git a/include/lldb/API/SBDebugger.h b/include/lldb/API/SBDebugger.h
index 6e43e12f7b16..4f2c1d7f8756 100644
--- a/include/lldb/API/SBDebugger.h
+++ b/include/lldb/API/SBDebugger.h
@@ -18,7 +18,7 @@
namespace lldb {
-class SBInputReader
+class LLDB_API SBInputReader
{
public:
SBInputReader();
@@ -28,7 +28,7 @@ public:
bool IsActive() const;
};
-class SBDebugger
+class LLDB_API SBDebugger
{
public:
diff --git a/include/lldb/API/SBDeclaration.h b/include/lldb/API/SBDeclaration.h
index 190026c0d2d0..5461a1f15c2e 100644
--- a/include/lldb/API/SBDeclaration.h
+++ b/include/lldb/API/SBDeclaration.h
@@ -15,7 +15,7 @@
namespace lldb {
- class SBDeclaration
+ class LLDB_API SBDeclaration
{
public:
diff --git a/include/lldb/API/SBDefines.h b/include/lldb/API/SBDefines.h
index b59b79580910..09bea502dd01 100644
--- a/include/lldb/API/SBDefines.h
+++ b/include/lldb/API/SBDefines.h
@@ -55,6 +55,8 @@ class LLDB_API SBFunction;
class LLDB_API SBHostOS;
class LLDB_API SBInstruction;
class LLDB_API SBInstructionList;
+class LLDB_API SBLanguageRuntime;
+class LLDB_API SBLaunchInfo;
class LLDB_API SBLineEntry;
class LLDB_API SBListener;
class LLDB_API SBModule;
@@ -90,6 +92,7 @@ class LLDB_API SBTypeSynthetic;
class LLDB_API SBTypeList;
class LLDB_API SBValue;
class LLDB_API SBValueList;
+class LLDB_API SBVariablesOptions;
class LLDB_API SBWatchpoint;
class LLDB_API SBUnixSignals;
diff --git a/include/lldb/API/SBError.h b/include/lldb/API/SBError.h
index b9908658c5bc..afdec0d3826d 100644
--- a/include/lldb/API/SBError.h
+++ b/include/lldb/API/SBError.h
@@ -14,7 +14,7 @@
namespace lldb {
-class SBError {
+class LLDB_API SBError {
public:
SBError ();
diff --git a/include/lldb/API/SBEvent.h b/include/lldb/API/SBEvent.h
index 1706d0c009b9..975c365f5916 100644
--- a/include/lldb/API/SBEvent.h
+++ b/include/lldb/API/SBEvent.h
@@ -20,7 +20,7 @@ namespace lldb {
class SBBroadcaster;
-class SBEvent
+class LLDB_API SBEvent
{
public:
SBEvent();
@@ -78,6 +78,7 @@ protected:
friend class SBBreakpoint;
friend class SBDebugger;
friend class SBProcess;
+ friend class SBTarget;
friend class SBThread;
friend class SBWatchpoint;
diff --git a/include/lldb/API/SBExecutionContext.h b/include/lldb/API/SBExecutionContext.h
index 9d889139f5cb..1d64497ae867 100644
--- a/include/lldb/API/SBExecutionContext.h
+++ b/include/lldb/API/SBExecutionContext.h
@@ -18,7 +18,7 @@
namespace lldb {
-class SBExecutionContext
+class LLDB_API SBExecutionContext
{
friend class SBCommandInterpreter;
diff --git a/include/lldb/API/SBExpressionOptions.h b/include/lldb/API/SBExpressionOptions.h
index c3592880c46a..ed2f9187b3e0 100644
--- a/include/lldb/API/SBExpressionOptions.h
+++ b/include/lldb/API/SBExpressionOptions.h
@@ -17,7 +17,7 @@
namespace lldb {
-class SBExpressionOptions
+class LLDB_API SBExpressionOptions
{
public:
SBExpressionOptions();
@@ -105,6 +105,12 @@ public:
void
SetSuppressPersistentResult (bool b = false);
+ const char *
+ GetPrefix () const;
+
+ void
+ SetPrefix (const char *prefix);
+
protected:
SBExpressionOptions (lldb_private::EvaluateExpressionOptions &expression_options);
diff --git a/include/lldb/API/SBFileSpec.h b/include/lldb/API/SBFileSpec.h
index 1eee3d10367c..d6f38f5b2d74 100644
--- a/include/lldb/API/SBFileSpec.h
+++ b/include/lldb/API/SBFileSpec.h
@@ -14,7 +14,7 @@
namespace lldb {
-class SBFileSpec
+class LLDB_API SBFileSpec
{
public:
SBFileSpec ();
diff --git a/include/lldb/API/SBFileSpecList.h b/include/lldb/API/SBFileSpecList.h
index 734e7d4d35cc..ff429a1815be 100644
--- a/include/lldb/API/SBFileSpecList.h
+++ b/include/lldb/API/SBFileSpecList.h
@@ -14,7 +14,7 @@
namespace lldb {
-class SBFileSpecList
+class LLDB_API SBFileSpecList
{
public:
SBFileSpecList ();
diff --git a/include/lldb/API/SBFrame.h b/include/lldb/API/SBFrame.h
index b93e36afecdf..2ca9e062490d 100644
--- a/include/lldb/API/SBFrame.h
+++ b/include/lldb/API/SBFrame.h
@@ -15,7 +15,7 @@
namespace lldb {
-class SBFrame
+class LLDB_API SBFrame
{
public:
SBFrame ();
@@ -25,7 +25,7 @@ public:
const lldb::SBFrame &
operator =(const lldb::SBFrame &rhs);
- ~SBFrame();
+ ~SBFrame();
bool
IsEqual (const lldb::SBFrame &that) const;
@@ -37,6 +37,9 @@ public:
GetFrameID () const;
lldb::addr_t
+ GetCFA () const;
+
+ lldb::addr_t
GetPC () const;
bool
@@ -88,12 +91,18 @@ public:
const char *
GetFunctionName();
+ const char *
+ GetFunctionName() const;
+
/// Return true if this frame represents an inlined function.
///
/// See also GetFunctionName().
bool
IsInlined();
-
+
+ bool
+ IsInlined() const;
+
/// The version that doesn't supply a 'use_dynamic' value will use the
/// target's default.
lldb::SBValue
@@ -157,6 +166,9 @@ public:
lldb::DynamicValueType use_dynamic);
lldb::SBValueList
+ GetVariables (const lldb::SBVariablesOptions& options);
+
+ lldb::SBValueList
GetRegisters ();
lldb::SBValue
@@ -210,9 +222,6 @@ protected:
friend class SBInstruction;
friend class SBThread;
friend class SBValue;
-#ifndef LLDB_DISABLE_PYTHON
- friend class lldb_private::ScriptInterpreterPython;
-#endif
lldb::StackFrameSP
GetFrameSP() const;
diff --git a/include/lldb/API/SBFunction.h b/include/lldb/API/SBFunction.h
index 1b0d53d11736..7d578393eb2c 100644
--- a/include/lldb/API/SBFunction.h
+++ b/include/lldb/API/SBFunction.h
@@ -16,7 +16,7 @@
namespace lldb {
-class SBFunction
+class LLDB_API SBFunction
{
public:
diff --git a/include/lldb/API/SBHostOS.h b/include/lldb/API/SBHostOS.h
index 7ab22caaaad9..d9bc97365632 100644
--- a/include/lldb/API/SBHostOS.h
+++ b/include/lldb/API/SBHostOS.h
@@ -15,7 +15,7 @@
namespace lldb {
-class SBHostOS
+class LLDB_API SBHostOS
{
public:
diff --git a/include/lldb/API/SBInstruction.h b/include/lldb/API/SBInstruction.h
index aad2d87f4f33..c4bded595761 100644
--- a/include/lldb/API/SBInstruction.h
+++ b/include/lldb/API/SBInstruction.h
@@ -20,7 +20,7 @@
namespace lldb {
-class SBInstruction
+class LLDB_API SBInstruction
{
public:
diff --git a/include/lldb/API/SBInstructionList.h b/include/lldb/API/SBInstructionList.h
index 944e144a1480..8ef163796629 100644
--- a/include/lldb/API/SBInstructionList.h
+++ b/include/lldb/API/SBInstructionList.h
@@ -16,7 +16,7 @@
namespace lldb {
-class SBInstructionList
+class LLDB_API SBInstructionList
{
public:
diff --git a/include/lldb/API/SBLanguageRuntime.h b/include/lldb/API/SBLanguageRuntime.h
new file mode 100644
index 000000000000..898604c496fa
--- /dev/null
+++ b/include/lldb/API/SBLanguageRuntime.h
@@ -0,0 +1,29 @@
+//===-- SBLanguageRuntime.h -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBLanguageRuntime_h_
+#define LLDB_SBLanguageRuntime_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class SBLanguageRuntime
+{
+public:
+ static lldb::LanguageType
+ GetLanguageTypeFromString (const char *string);
+
+ static const char *
+ GetNameForLanguageType (lldb::LanguageType language);
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBLanguageRuntime_h_
diff --git a/include/lldb/API/SBLaunchInfo.h b/include/lldb/API/SBLaunchInfo.h
index a5921ab90d48..68c0f386acde 100644
--- a/include/lldb/API/SBLaunchInfo.h
+++ b/include/lldb/API/SBLaunchInfo.h
@@ -17,7 +17,7 @@ namespace lldb {
class SBPlatform;
class SBTarget;
-class SBLaunchInfo
+class LLDB_API SBLaunchInfo
{
public:
SBLaunchInfo (const char **argv);
@@ -140,7 +140,13 @@ public:
void
SetShell (const char * path);
-
+
+ bool
+ GetShellExpandArguments ();
+
+ void
+ SetShellExpandArguments (bool glob);
+
uint32_t
GetResumeCount ();
@@ -178,6 +184,9 @@ protected:
lldb_private::ProcessLaunchInfo &
ref ();
+ const lldb_private::ProcessLaunchInfo &
+ ref () const;
+
ProcessLaunchInfoSP m_opaque_sp;
};
diff --git a/include/lldb/API/SBLineEntry.h b/include/lldb/API/SBLineEntry.h
index 2d099a297980..8311bbbafc90 100644
--- a/include/lldb/API/SBLineEntry.h
+++ b/include/lldb/API/SBLineEntry.h
@@ -16,7 +16,7 @@
namespace lldb {
-class SBLineEntry
+class LLDB_API SBLineEntry
{
public:
diff --git a/include/lldb/API/SBListener.h b/include/lldb/API/SBListener.h
index 58a8fe9a55b7..924f8109f638 100644
--- a/include/lldb/API/SBListener.h
+++ b/include/lldb/API/SBListener.h
@@ -14,7 +14,7 @@
namespace lldb {
-class SBListener
+class LLDB_API SBListener
{
public:
SBListener ();
diff --git a/include/lldb/API/SBModule.h b/include/lldb/API/SBModule.h
index e85654bccc72..4030d2b21797 100644
--- a/include/lldb/API/SBModule.h
+++ b/include/lldb/API/SBModule.h
@@ -18,7 +18,7 @@
namespace lldb {
-class SBModule
+class LLDB_API SBModule
{
public:
@@ -106,7 +106,7 @@ public:
/// or "./usr/lib", then the install path will be resolved using
/// the platform's current working directory as the base path.
///
- /// @param[in]
+ /// @param[in] file
/// A file specification object.
//------------------------------------------------------------------
bool
@@ -318,6 +318,23 @@ public:
GetVersion (uint32_t *versions,
uint32_t num_versions);
+ //------------------------------------------------------------------
+ /// Get accessor for the symbol file specification.
+ ///
+ /// When debugging an object file an additional debug information can
+ /// be provided in separate file. Therefore if you debugging something
+ /// like '/usr/lib/liba.dylib' then debug information can be located
+ /// in folder like '/usr/lib/liba.dylib.dSYM/'.
+ ///
+ /// @return
+ /// A const reference to the file specification object.
+ //------------------------------------------------------------------
+ lldb::SBFileSpec
+ GetSymbolFileSpec() const;
+
+ lldb::SBAddress
+ GetObjectFileHeaderAddress() const;
+
private:
friend class SBAddress;
friend class SBFrame;
diff --git a/include/lldb/API/SBModuleSpec.h b/include/lldb/API/SBModuleSpec.h
index a615e017cbc8..d533de3c7bce 100644
--- a/include/lldb/API/SBModuleSpec.h
+++ b/include/lldb/API/SBModuleSpec.h
@@ -15,7 +15,7 @@
namespace lldb {
-class SBModuleSpec
+class LLDB_API SBModuleSpec
{
public:
diff --git a/include/lldb/API/SBPlatform.h b/include/lldb/API/SBPlatform.h
index 42b2d0492895..db4a754103ca 100644
--- a/include/lldb/API/SBPlatform.h
+++ b/include/lldb/API/SBPlatform.h
@@ -21,7 +21,7 @@ namespace lldb {
class SBLaunchInfo;
- class SBPlatformConnectOptions
+ class LLDB_API SBPlatformConnectOptions
{
public:
SBPlatformConnectOptions (const char *url);
@@ -59,7 +59,7 @@ namespace lldb {
PlatformConnectOptions *m_opaque_ptr;
};
- class SBPlatformShellCommand
+ class LLDB_API SBPlatformShellCommand
{
public:
SBPlatformShellCommand (const char *shell_command);
@@ -104,7 +104,7 @@ namespace lldb {
PlatformShellCommand *m_opaque_ptr;
};
- class SBPlatform
+ class LLDB_API SBPlatform
{
public:
diff --git a/include/lldb/API/SBProcess.h b/include/lldb/API/SBProcess.h
index 3d6e49c4821d..71bca4fc697a 100644
--- a/include/lldb/API/SBProcess.h
+++ b/include/lldb/API/SBProcess.h
@@ -20,13 +20,13 @@ namespace lldb {
class SBEvent;
-class SBProcess
+class LLDB_API SBProcess
{
public:
//------------------------------------------------------------------
/// Broadcaster event bits definitions.
//------------------------------------------------------------------
- enum
+ FLAGS_ANONYMOUS_ENUM()
{
eBroadcastBitStateChanged = (1 << 0),
eBroadcastBitInterrupt = (1 << 1),
@@ -229,7 +229,22 @@ public:
uint32_t
GetStopID(bool include_expression_stops = false);
-
+
+ //------------------------------------------------------------------
+ /// Gets the stop event corresponding to stop ID.
+ //
+ /// Note that it wasn't fully implemented and tracks only the stop
+ /// event for the last natural stop ID.
+ ///
+ /// @param [in] stop_id
+ /// The ID of the stop event to return.
+ ///
+ /// @return
+ /// The stop event corresponding to stop ID.
+ //------------------------------------------------------------------
+ lldb::SBEvent
+ GetStopEventForStopID(uint32_t stop_id);
+
size_t
ReadMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);
@@ -260,6 +275,9 @@ public:
static lldb::SBProcess
GetProcessFromEvent (const lldb::SBEvent &event);
+
+ static bool
+ GetInterruptedFromEvent (const lldb::SBEvent &event);
static bool
EventIsProcessEvent (const lldb::SBEvent &event);
diff --git a/include/lldb/API/SBQueue.h b/include/lldb/API/SBQueue.h
index fbb1952902f8..2f453cddd5d1 100644
--- a/include/lldb/API/SBQueue.h
+++ b/include/lldb/API/SBQueue.h
@@ -17,7 +17,7 @@
namespace lldb {
-class SBQueue
+class LLDB_API SBQueue
{
public:
SBQueue ();
diff --git a/include/lldb/API/SBQueueItem.h b/include/lldb/API/SBQueueItem.h
index c90f36eeb573..9426a53b2376 100644
--- a/include/lldb/API/SBQueueItem.h
+++ b/include/lldb/API/SBQueueItem.h
@@ -15,7 +15,7 @@
namespace lldb {
-class SBQueueItem
+class LLDB_API SBQueueItem
{
public:
SBQueueItem ();
diff --git a/include/lldb/API/SBSection.h b/include/lldb/API/SBSection.h
index 5a49049502fd..0a22413b5b9c 100644
--- a/include/lldb/API/SBSection.h
+++ b/include/lldb/API/SBSection.h
@@ -15,7 +15,7 @@
namespace lldb {
-class SBSection
+class LLDB_API SBSection
{
public:
diff --git a/include/lldb/API/SBSourceManager.h b/include/lldb/API/SBSourceManager.h
index 5b52c49ff3ee..6e7358f16e77 100644
--- a/include/lldb/API/SBSourceManager.h
+++ b/include/lldb/API/SBSourceManager.h
@@ -16,7 +16,7 @@
namespace lldb {
-class SBSourceManager
+class LLDB_API SBSourceManager
{
public:
SBSourceManager (const SBDebugger &debugger);
diff --git a/include/lldb/API/SBStream.h b/include/lldb/API/SBStream.h
index cd33bfda32ba..2b25cd2c68f2 100644
--- a/include/lldb/API/SBStream.h
+++ b/include/lldb/API/SBStream.h
@@ -16,7 +16,7 @@
namespace lldb {
-class SBStream
+class LLDB_API SBStream
{
public:
diff --git a/include/lldb/API/SBStringList.h b/include/lldb/API/SBStringList.h
index 9d0be6e8a741..e0e58f765c6d 100644
--- a/include/lldb/API/SBStringList.h
+++ b/include/lldb/API/SBStringList.h
@@ -14,7 +14,7 @@
namespace lldb {
-class SBStringList
+class LLDB_API SBStringList
{
public:
diff --git a/include/lldb/API/SBSymbol.h b/include/lldb/API/SBSymbol.h
index 0a528a9ac96f..3d259a2c20c6 100644
--- a/include/lldb/API/SBSymbol.h
+++ b/include/lldb/API/SBSymbol.h
@@ -17,7 +17,7 @@
namespace lldb {
-class SBSymbol
+class LLDB_API SBSymbol
{
public:
diff --git a/include/lldb/API/SBSymbolContext.h b/include/lldb/API/SBSymbolContext.h
index fee2d19179d0..24c2ce9a1d6e 100644
--- a/include/lldb/API/SBSymbolContext.h
+++ b/include/lldb/API/SBSymbolContext.h
@@ -20,7 +20,7 @@
namespace lldb {
-class SBSymbolContext
+class LLDB_API SBSymbolContext
{
public:
SBSymbolContext ();
diff --git a/include/lldb/API/SBSymbolContextList.h b/include/lldb/API/SBSymbolContextList.h
index 6cc78e472c6f..79dcccdcbf84 100644
--- a/include/lldb/API/SBSymbolContextList.h
+++ b/include/lldb/API/SBSymbolContextList.h
@@ -15,7 +15,7 @@
namespace lldb {
-class SBSymbolContextList
+class LLDB_API SBSymbolContextList
{
public:
SBSymbolContextList ();
diff --git a/include/lldb/API/SBTarget.h b/include/lldb/API/SBTarget.h
index 322cf04159ff..dcca4e7b3a19 100644
--- a/include/lldb/API/SBTarget.h
+++ b/include/lldb/API/SBTarget.h
@@ -12,6 +12,7 @@
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBAddress.h"
+#include "lldb/API/SBAttachInfo.h"
#include "lldb/API/SBBroadcaster.h"
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBFileSpecList.h"
@@ -25,135 +26,7 @@ namespace lldb {
class SBPlatform;
-class SBAttachInfo
-{
-public:
- SBAttachInfo ();
-
- SBAttachInfo (lldb::pid_t pid);
-
- SBAttachInfo (const char *path, bool wait_for);
-
- SBAttachInfo (const SBAttachInfo &rhs);
-
- ~SBAttachInfo();
-
- SBAttachInfo &
- operator = (const SBAttachInfo &rhs);
-
- lldb::pid_t
- GetProcessID ();
-
- void
- SetProcessID (lldb::pid_t pid);
-
- void
- SetExecutable (const char *path);
-
- void
- SetExecutable (lldb::SBFileSpec exe_file);
-
- bool
- GetWaitForLaunch ();
-
- void
- SetWaitForLaunch (bool b);
-
- bool
- GetIgnoreExisting ();
-
- void
- SetIgnoreExisting (bool b);
-
- uint32_t
- GetResumeCount ();
-
- void
- SetResumeCount (uint32_t c);
-
- const char *
- GetProcessPluginName ();
-
- void
- SetProcessPluginName (const char *plugin_name);
-
- uint32_t
- GetUserID();
-
- uint32_t
- GetGroupID();
-
- bool
- UserIDIsValid ();
-
- bool
- GroupIDIsValid ();
-
- void
- SetUserID (uint32_t uid);
-
- void
- SetGroupID (uint32_t gid);
-
- uint32_t
- GetEffectiveUserID();
-
- uint32_t
- GetEffectiveGroupID();
-
- bool
- EffectiveUserIDIsValid ();
-
- bool
- EffectiveGroupIDIsValid ();
-
- void
- SetEffectiveUserID (uint32_t uid);
-
- void
- SetEffectiveGroupID (uint32_t gid);
-
- lldb::pid_t
- GetParentProcessID ();
-
- void
- SetParentProcessID (lldb::pid_t pid);
-
- bool
- ParentProcessIDIsValid();
-
- //----------------------------------------------------------------------
- /// Get the listener that will be used to receive process events.
- ///
- /// If no listener has been set via a call to
- /// SBLaunchInfo::SetListener(), then an invalid SBListener will be
- /// returned (SBListener::IsValid() will return false). If a listener
- /// has been set, then the valid listener object will be returned.
- //----------------------------------------------------------------------
- SBListener
- GetListener ();
-
- //----------------------------------------------------------------------
- /// Set the listener that will be used to receive process events.
- ///
- /// By default the SBDebugger, which has a listener, that the SBTarget
- /// belongs to will listen for the process events. Calling this function
- /// allows a different listener to be used to listen for process events.
- //----------------------------------------------------------------------
- void
- SetListener (SBListener &listener);
-
-
-protected:
- friend class SBTarget;
-
- lldb_private::ProcessAttachInfo &
- ref ();
-
- ProcessAttachInfoSP m_opaque_sp;
-};
-
-class SBTarget
+class LLDB_API SBTarget
{
public:
//------------------------------------------------------------------
@@ -187,7 +60,19 @@ public:
bool
IsValid() const;
+
+ static bool
+ EventIsTargetEvent (const lldb::SBEvent &event);
+
+ static lldb::SBTarget
+ GetTargetFromEvent (const lldb::SBEvent &event);
+ static uint32_t
+ GetNumModulesFromEvent (const lldb::SBEvent &event);
+
+ static lldb::SBModule
+ GetModuleAtIndexFromEvent (const uint32_t idx, const lldb::SBEvent &event);
+
static const char *
GetBroadcasterClassName ();
@@ -273,7 +158,7 @@ public:
/// @param[in] stop_at_entry
/// If false do not stop the inferior at the entry point.
///
- /// @param[out]
+ /// @param[out] error
/// An error object. Contains the reason if there is some failure.
///
/// @return
@@ -344,7 +229,7 @@ public:
/// @param[in] pid
/// The process ID to attach to.
///
- /// @param[out]
+ /// @param[out] error
/// An error explaining what went wrong if attach fails.
///
/// @return
@@ -378,7 +263,7 @@ public:
/// @param[in] wait_for
/// If true wait for a new instance of 'name' to be launched.
///
- /// @param[out]
+ /// @param[out] error
/// An error explaining what went wrong if attach fails.
///
/// @return
@@ -405,7 +290,7 @@ public:
/// @param[in] plugin_name
/// The plugin name to be used; can be NULL.
///
- /// @param[out]
+ /// @param[out] error
/// An error explaining what went wrong if the connect fails.
///
/// @return
@@ -764,13 +649,13 @@ public:
lldb::SBBreakpoint
BreakpointCreateBySourceRegex (const char *source_regex,
- const lldb::SBFileSpec &source_file,
+ const SBFileSpec &source_file,
const char *module_name = NULL);
lldb::SBBreakpoint
- BreakpointCreateBySourceRegex (const char *source_regex,
- const SBFileSpecList &module_list,
- const lldb::SBFileSpecList &source_file);
+ BreakpointCreateBySourceRegex (const char *source_regex,
+ const SBFileSpecList &module_list,
+ const SBFileSpecList &source_file);
lldb::SBBreakpoint
BreakpointCreateForException (lldb::LanguageType language,
@@ -888,6 +773,12 @@ public:
lldb::addr_t
GetStackRedZoneSize();
+
+ lldb::SBLaunchInfo
+ GetLaunchInfo () const;
+
+ void
+ SetLaunchInfo (const lldb::SBLaunchInfo &launch_info);
protected:
friend class SBAddress;
diff --git a/include/lldb/API/SBThread.h b/include/lldb/API/SBThread.h
index db15f651f2d5..2c45fa8d5120 100644
--- a/include/lldb/API/SBThread.h
+++ b/include/lldb/API/SBThread.h
@@ -18,7 +18,7 @@ namespace lldb {
class SBFrame;
-class SBThread
+class LLDB_API SBThread
{
public:
enum
diff --git a/include/lldb/API/SBThreadCollection.h b/include/lldb/API/SBThreadCollection.h
index b13cbd938e28..996ee3cd22aa 100644
--- a/include/lldb/API/SBThreadCollection.h
+++ b/include/lldb/API/SBThreadCollection.h
@@ -14,7 +14,7 @@
namespace lldb {
-class SBThreadCollection
+class LLDB_API SBThreadCollection
{
public:
diff --git a/include/lldb/API/SBThreadPlan.h b/include/lldb/API/SBThreadPlan.h
index e53942d65fa8..9cc0d0b89bb5 100644
--- a/include/lldb/API/SBThreadPlan.h
+++ b/include/lldb/API/SBThreadPlan.h
@@ -16,7 +16,7 @@
namespace lldb {
-class SBThreadPlan
+class LLDB_API SBThreadPlan
{
friend class lldb_private::ThreadPlan;
diff --git a/include/lldb/API/SBType.h b/include/lldb/API/SBType.h
index 7990fc0696a9..01f0c6afc795 100644
--- a/include/lldb/API/SBType.h
+++ b/include/lldb/API/SBType.h
@@ -16,7 +16,7 @@ namespace lldb {
class SBTypeList;
-class SBTypeMember
+class LLDB_API SBTypeMember
{
public:
SBTypeMember ();
diff --git a/include/lldb/API/SBTypeCategory.h b/include/lldb/API/SBTypeCategory.h
index f123e931e17d..30c338b28a46 100644
--- a/include/lldb/API/SBTypeCategory.h
+++ b/include/lldb/API/SBTypeCategory.h
@@ -14,7 +14,7 @@
namespace lldb {
- class SBTypeCategory
+ class LLDB_API SBTypeCategory
{
public:
diff --git a/include/lldb/API/SBTypeEnumMember.h b/include/lldb/API/SBTypeEnumMember.h
index 75c9917989c2..b141ba0a6bb0 100644
--- a/include/lldb/API/SBTypeEnumMember.h
+++ b/include/lldb/API/SBTypeEnumMember.h
@@ -15,7 +15,7 @@
namespace lldb {
-class SBTypeEnumMember
+class LLDB_API SBTypeEnumMember
{
public:
SBTypeEnumMember ();
diff --git a/include/lldb/API/SBTypeFilter.h b/include/lldb/API/SBTypeFilter.h
index 016954943e28..f030b6a99b60 100644
--- a/include/lldb/API/SBTypeFilter.h
+++ b/include/lldb/API/SBTypeFilter.h
@@ -14,7 +14,7 @@
namespace lldb {
- class SBTypeFilter
+ class LLDB_API SBTypeFilter
{
public:
diff --git a/include/lldb/API/SBTypeFormat.h b/include/lldb/API/SBTypeFormat.h
index eb45ff2b0eba..c24641ac15f5 100644
--- a/include/lldb/API/SBTypeFormat.h
+++ b/include/lldb/API/SBTypeFormat.h
@@ -14,7 +14,7 @@
namespace lldb {
-class SBTypeFormat
+class LLDB_API SBTypeFormat
{
public:
diff --git a/include/lldb/API/SBTypeNameSpecifier.h b/include/lldb/API/SBTypeNameSpecifier.h
index 19d1988aa0c5..71700a7123d5 100644
--- a/include/lldb/API/SBTypeNameSpecifier.h
+++ b/include/lldb/API/SBTypeNameSpecifier.h
@@ -14,7 +14,7 @@
namespace lldb {
- class SBTypeNameSpecifier
+ class LLDB_API SBTypeNameSpecifier
{
public:
diff --git a/include/lldb/API/SBTypeSummary.h b/include/lldb/API/SBTypeSummary.h
index 220451e6d70b..9b367ba5f982 100644
--- a/include/lldb/API/SBTypeSummary.h
+++ b/include/lldb/API/SBTypeSummary.h
@@ -15,7 +15,7 @@
#ifndef LLDB_DISABLE_PYTHON
namespace lldb {
- class SBTypeSummaryOptions
+ class LLDB_API SBTypeSummaryOptions
{
public:
SBTypeSummaryOptions();
diff --git a/include/lldb/API/SBTypeSynthetic.h b/include/lldb/API/SBTypeSynthetic.h
index e77cbfef598c..5dd11757ba40 100644
--- a/include/lldb/API/SBTypeSynthetic.h
+++ b/include/lldb/API/SBTypeSynthetic.h
@@ -16,7 +16,7 @@
namespace lldb {
- class SBTypeSynthetic
+ class LLDB_API SBTypeSynthetic
{
public:
diff --git a/include/lldb/API/SBUnixSignals.h b/include/lldb/API/SBUnixSignals.h
index 40bbed8b48ef..9eae30739bb8 100644
--- a/include/lldb/API/SBUnixSignals.h
+++ b/include/lldb/API/SBUnixSignals.h
@@ -14,7 +14,7 @@
namespace lldb {
-class SBUnixSignals {
+class LLDB_API SBUnixSignals {
public:
SBUnixSignals ();
diff --git a/include/lldb/API/SBValue.h b/include/lldb/API/SBValue.h
index bedac4ef1d2d..a070b149f34f 100644
--- a/include/lldb/API/SBValue.h
+++ b/include/lldb/API/SBValue.h
@@ -19,10 +19,8 @@ class ValueLocker;
namespace lldb {
-class SBValue
+class LLDB_API SBValue
{
-friend class ValueLocker;
-
public:
SBValue ();
@@ -84,6 +82,7 @@ public:
ValueType
GetValueType ();
+ // If you call this on a newly created ValueObject, it will always return false.
bool
GetValueDidChange ();
@@ -223,7 +222,7 @@ public:
/// and also if the target can be run to figure out the dynamic
/// type of the child value.
///
- /// @param[in] synthetic_allowed
+ /// @param[in] can_create_synthetic
/// If \b true, then allow child values to be created by index
/// for pointers and arrays for indexes that normally wouldn't
/// be allowed.
@@ -326,6 +325,9 @@ public:
//------------------------------------------------------------------
bool
MightHaveChildren ();
+
+ bool
+ IsRuntimeSupportValue ();
uint32_t
GetNumChildren ();
@@ -386,7 +388,7 @@ public:
/// @param[in] write
/// Stop when this value is modified
///
- /// @param[out]
+ /// @param[out] error
/// An error object. Contains the reason if there is some failure.
///
/// @return
@@ -419,7 +421,7 @@ public:
/// @param[in] write
/// Stop when this value is modified
///
- /// @param[out]
+ /// @param[out] error
/// An error object. Contains the reason if there is some failure.
///
/// @return
diff --git a/include/lldb/API/SBValueList.h b/include/lldb/API/SBValueList.h
index 812fdac91c11..563ca3d7e1bf 100644
--- a/include/lldb/API/SBValueList.h
+++ b/include/lldb/API/SBValueList.h
@@ -16,7 +16,7 @@ class ValueListImpl;
namespace lldb {
-class SBValueList
+class LLDB_API SBValueList
{
public:
diff --git a/include/lldb/API/SBVariablesOptions.h b/include/lldb/API/SBVariablesOptions.h
new file mode 100644
index 000000000000..527310f5dfc7
--- /dev/null
+++ b/include/lldb/API/SBVariablesOptions.h
@@ -0,0 +1,98 @@
+//===-- SBVariablesOptions.h ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBVariablesOptions_h_
+#define LLDB_SBVariablesOptions_h_
+
+#include "lldb/API/SBDefines.h"
+
+class VariablesOptionsImpl;
+
+namespace lldb {
+
+class LLDB_API SBVariablesOptions
+{
+public:
+ SBVariablesOptions ();
+
+ SBVariablesOptions (const SBVariablesOptions& options);
+
+ SBVariablesOptions&
+ operator = (const SBVariablesOptions& options);
+
+ ~SBVariablesOptions ();
+
+ bool
+ IsValid () const;
+
+ bool
+ GetIncludeArguments () const;
+
+ void
+ SetIncludeArguments (bool);
+
+ bool
+ GetIncludeLocals () const;
+
+ void
+ SetIncludeLocals (bool);
+
+ bool
+ GetIncludeStatics () const;
+
+ void
+ SetIncludeStatics (bool);
+
+ bool
+ GetInScopeOnly () const;
+
+ void
+ SetInScopeOnly (bool);
+
+ bool
+ GetIncludeRuntimeSupportValues () const;
+
+ void
+ SetIncludeRuntimeSupportValues (bool);
+
+ lldb::DynamicValueType
+ GetUseDynamic () const;
+
+ void
+ SetUseDynamic (lldb::DynamicValueType);
+
+protected:
+ VariablesOptionsImpl *
+ operator->();
+
+ const VariablesOptionsImpl *
+ operator->() const;
+
+ VariablesOptionsImpl *
+ get ();
+
+ VariablesOptionsImpl &
+ ref();
+
+ const VariablesOptionsImpl &
+ ref() const;
+
+ SBVariablesOptions (VariablesOptionsImpl *lldb_object_ptr);
+
+ void
+ SetOptions (VariablesOptionsImpl *lldb_object_ptr);
+
+private:
+
+ std::unique_ptr<VariablesOptionsImpl> m_opaque_ap;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBValue_h_
diff --git a/include/lldb/API/SBWatchpoint.h b/include/lldb/API/SBWatchpoint.h
index 9bf51fd1ad05..5d0d48ee12f2 100644
--- a/include/lldb/API/SBWatchpoint.h
+++ b/include/lldb/API/SBWatchpoint.h
@@ -14,7 +14,7 @@
namespace lldb {
-class SBWatchpoint
+class LLDB_API SBWatchpoint
{
public:
diff --git a/include/lldb/API/SystemInitializerFull.h b/include/lldb/API/SystemInitializerFull.h
new file mode 100644
index 000000000000..6280fe8aef04
--- /dev/null
+++ b/include/lldb/API/SystemInitializerFull.h
@@ -0,0 +1,40 @@
+//===-- SystemInitializerFull.h ---------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_API_SYSTEM_INITIALIZER_FULL_H
+#define LLDB_API_SYSTEM_INITIALIZER_FULL_H
+
+#include "lldb/Initialization/SystemInitializerCommon.h"
+
+namespace lldb_private
+{
+//------------------------------------------------------------------
+/// Initializes lldb.
+///
+/// This class is responsible for initializing all of lldb system
+/// services needed to use the full LLDB application. This class is
+/// not intended to be used externally, but is instead used
+/// internally by SBDebugger to initialize the system.
+//------------------------------------------------------------------
+class SystemInitializerFull : public SystemInitializerCommon
+{
+ public:
+ SystemInitializerFull();
+ virtual ~SystemInitializerFull();
+
+ void Initialize() override;
+ void Terminate() override;
+
+ private:
+ void InitializeSWIG();
+ void TerminateSWIG();
+};
+}
+
+#endif
diff --git a/include/lldb/Breakpoint/Breakpoint.h b/include/lldb/Breakpoint/Breakpoint.h
index 883571a3ce9a..a70c2787a1ef 100644
--- a/include/lldb/Breakpoint/Breakpoint.h
+++ b/include/lldb/Breakpoint/Breakpoint.h
@@ -155,6 +155,23 @@ public:
};
+ class BreakpointPrecondition
+ {
+ public:
+ virtual ~BreakpointPrecondition() {}
+
+ virtual bool
+ EvaluatePrecondition(StoppointCallbackContext &context);
+
+ virtual Error
+ ConfigurePrecondition(Args &options);
+
+ virtual void
+ DescribePrecondition(Stream &stream, lldb::DescriptionLevel level);
+ };
+
+ typedef std::shared_ptr<BreakpointPrecondition> BreakpointPreconditionSP;
+
//------------------------------------------------------------------
/// Destructor.
///
@@ -665,6 +682,31 @@ public:
}
}
+ //------------------------------------------------------------------
+ /// Set a pre-condition filter that overrides all user provided filters/callbacks etc.
+ ///
+ /// Used to define fancy breakpoints that can do dynamic hit detection without taking up the condition slot -
+ /// which really belongs to the user anyway...
+ ///
+ /// The Precondition should not continue the target, it should return true if the condition says to stop and
+ /// false otherwise.
+ ///
+ //------------------------------------------------------------------
+ void
+ SetPrecondition(BreakpointPreconditionSP precondition_sp)
+ {
+ m_precondition_sp = precondition_sp;
+ }
+
+ bool
+ EvaluatePrecondition (StoppointCallbackContext &context);
+
+ BreakpointPreconditionSP
+ GetPrecondition()
+ {
+ return m_precondition_sp;
+ }
+
protected:
friend class Target;
//------------------------------------------------------------------
@@ -737,13 +779,17 @@ private:
// For Breakpoint only
//------------------------------------------------------------------
bool m_being_created;
- bool m_hardware; // If this breakpoint is required to use a hardware breakpoint
- Target &m_target; // The target that holds this breakpoint.
+ bool m_hardware; // If this breakpoint is required to use a hardware breakpoint
+ Target &m_target; // The target that holds this breakpoint.
std::unordered_set<std::string> m_name_list; // If not empty, this is the name of this breakpoint (many breakpoints can share the same name.)
- lldb::SearchFilterSP m_filter_sp; // The filter that constrains the breakpoint's domain.
- lldb::BreakpointResolverSP m_resolver_sp; // The resolver that defines this breakpoint.
- BreakpointOptions m_options; // Settable breakpoint options
- BreakpointLocationList m_locations; // The list of locations currently found for this breakpoint.
+ lldb::SearchFilterSP m_filter_sp; // The filter that constrains the breakpoint's domain.
+ lldb::BreakpointResolverSP m_resolver_sp; // The resolver that defines this breakpoint.
+ BreakpointPreconditionSP m_precondition_sp; // The precondition is a breakpoint-level hit filter that can be used
+ // to skip certain breakpoint hits. For instance, exception breakpoints
+ // use this to limit the stop to certain exception classes, while leaving
+ // the condition & callback free for user specification.
+ BreakpointOptions m_options; // Settable breakpoint options
+ BreakpointLocationList m_locations; // The list of locations currently found for this breakpoint.
std::string m_kind_description;
bool m_resolve_indirect_symbols;
uint32_t m_hit_count; // Number of times this breakpoint/watchpoint has been hit. This is kept
diff --git a/include/lldb/Breakpoint/BreakpointLocation.h b/include/lldb/Breakpoint/BreakpointLocation.h
index 642256386785..c3e620d085c6 100644
--- a/include/lldb/Breakpoint/BreakpointLocation.h
+++ b/include/lldb/Breakpoint/BreakpointLocation.h
@@ -21,11 +21,8 @@
#include "lldb/lldb-private.h"
#include "lldb/Breakpoint/StoppointLocation.h"
#include "lldb/Core/Address.h"
-#include "lldb/Core/StringList.h"
#include "lldb/Core/UserID.h"
#include "lldb/Host/Mutex.h"
-#include "lldb/Target/Process.h"
-#include "lldb/Expression/ClangUserExpression.h"
namespace lldb_private {
@@ -464,7 +461,7 @@ private:
Breakpoint &m_owner; ///< The breakpoint that produced this object.
std::unique_ptr<BreakpointOptions> m_options_ap; ///< Breakpoint options pointer, NULL if we're using our breakpoint's options.
lldb::BreakpointSiteSP m_bp_site_sp; ///< Our breakpoint site (it may be shared by more than one location.)
- ClangUserExpression::ClangUserExpressionSP m_user_expression_sp; ///< The compiled expression to use in testing our condition.
+ lldb::ClangUserExpressionSP m_user_expression_sp; ///< The compiled expression to use in testing our condition.
Mutex m_condition_mutex; ///< Guards parsing and evaluation of the condition, which could be evaluated by multiple processes.
size_t m_condition_hash; ///< For testing whether the condition source code changed.
diff --git a/include/lldb/Breakpoint/BreakpointOptions.h b/include/lldb/Breakpoint/BreakpointOptions.h
index eb374ad69603..bf10fc096d75 100644
--- a/include/lldb/Breakpoint/BreakpointOptions.h
+++ b/include/lldb/Breakpoint/BreakpointOptions.h
@@ -89,6 +89,9 @@ public:
// callback.
// Asynchronous callbacks get run as part of the "ShouldStop" logic in the thread plan. The logic there is:
// a) If the breakpoint is thread specific and not for this thread, continue w/o running the callback.
+ // NB. This is actually enforced underneath the breakpoint system, the Process plugin is expected to
+ // call BreakpointSite::IsValidForThread, and set the thread's StopInfo to "no reason". That way,
+ // thread displays won't show stops for breakpoints not for that thread...
// b) If the ignore count says we shouldn't stop, then ditto.
// c) If the condition says we shouldn't stop, then ditto.
// d) Otherwise, the callback will get run, and if it returns true we will stop, and if false we won't.
diff --git a/include/lldb/Breakpoint/BreakpointResolverFileLine.h b/include/lldb/Breakpoint/BreakpointResolverFileLine.h
index cd62bcd032b0..2403d24515a7 100644
--- a/include/lldb/Breakpoint/BreakpointResolverFileLine.h
+++ b/include/lldb/Breakpoint/BreakpointResolverFileLine.h
@@ -32,7 +32,8 @@ public:
const FileSpec &resolver,
uint32_t line_no,
bool check_inlines,
- bool skip_prologue);
+ bool skip_prologue,
+ bool exact_match);
virtual
~BreakpointResolverFileLine ();
@@ -67,6 +68,7 @@ protected:
uint32_t m_line_number; // This is the line number that we are looking for.
bool m_inlines; // This determines whether the resolver looks for inlined functions or not.
bool m_skip_prologue;
+ bool m_exact_match;
private:
DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileLine);
diff --git a/include/lldb/Breakpoint/BreakpointResolverFileRegex.h b/include/lldb/Breakpoint/BreakpointResolverFileRegex.h
index 2c05ac1c87da..8e18fff16447 100644
--- a/include/lldb/Breakpoint/BreakpointResolverFileRegex.h
+++ b/include/lldb/Breakpoint/BreakpointResolverFileRegex.h
@@ -29,7 +29,8 @@ class BreakpointResolverFileRegex :
{
public:
BreakpointResolverFileRegex (Breakpoint *bkpt,
- RegularExpression &regex);
+ RegularExpression &regex,
+ bool exact_match);
virtual
~BreakpointResolverFileRegex ();
@@ -61,6 +62,7 @@ public:
protected:
friend class Breakpoint;
RegularExpression m_regex; // This is the line expression that we are looking for.
+ bool m_exact_match;
private:
DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileRegex);
diff --git a/include/lldb/Breakpoint/BreakpointSite.h b/include/lldb/Breakpoint/BreakpointSite.h
index c6dbef781f22..d67fc8bb57f1 100644
--- a/include/lldb/Breakpoint/BreakpointSite.h
+++ b/include/lldb/Breakpoint/BreakpointSite.h
@@ -18,7 +18,7 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/lldb-private.h"
+#include "lldb/lldb-forward.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Core/UserID.h"
#include "lldb/Breakpoint/StoppointLocation.h"
diff --git a/include/lldb/Breakpoint/Watchpoint.h b/include/lldb/Breakpoint/Watchpoint.h
index 8493775eec34..926e0b506f31 100644
--- a/include/lldb/Breakpoint/Watchpoint.h
+++ b/include/lldb/Breakpoint/Watchpoint.h
@@ -20,10 +20,11 @@
// Project includes
#include "lldb/lldb-private.h"
-#include "lldb/Target/Target.h"
-#include "lldb/Core/UserID.h"
#include "lldb/Breakpoint/WatchpointOptions.h"
#include "lldb/Breakpoint/StoppointLocation.h"
+#include "lldb/Core/UserID.h"
+#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Target/Target.h"
namespace lldb_private {
@@ -205,7 +206,18 @@ private:
friend class Target;
friend class WatchpointList;
- void ResetHitCount() { m_hit_count = 0; }
+ void
+ ResetHitCount ()
+ {
+ m_hit_count = 0;
+ }
+
+ void
+ ResetHistoricValues ()
+ {
+ m_old_value_sp.reset(nullptr);
+ m_new_value_sp.reset(nullptr);
+ }
Target &m_target;
bool m_enabled; // Is this watchpoint enabled
diff --git a/include/lldb/Core/Address.h b/include/lldb/Core/Address.h
index b430ef7cec21..cfa16c30bedb 100644
--- a/include/lldb/Core/Address.h
+++ b/include/lldb/Core/Address.h
@@ -88,6 +88,8 @@ public:
///< if the address is in a section (section of pointers, c strings, etc).
DumpStyleResolvedDescriptionNoModule,
DumpStyleResolvedDescriptionNoFunctionArguments,
+ DumpStyleNoFunctionName, ///< Elide the function name; display an offset into the current function.
+ ///< Used primarily in disassembly symbolication
DumpStyleDetailedSymbolContext, ///< Detailed symbol context information for an address for all symbol
///< context members.
DumpStyleResolvedPointerDescription ///< Dereference a pointer at the current address and then lookup the
diff --git a/include/lldb/Core/ArchSpec.h b/include/lldb/Core/ArchSpec.h
index 93630f043822..0cadd8d8dec6 100644
--- a/include/lldb/Core/ArchSpec.h
+++ b/include/lldb/Core/ArchSpec.h
@@ -12,9 +12,8 @@
#if defined(__cplusplus)
-#include "lldb/lldb-private.h"
+#include "lldb/lldb-forward.h"
#include "lldb/Core/ConstString.h"
-#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
namespace lldb_private {
@@ -33,6 +32,23 @@ struct CoreDefinition;
class ArchSpec
{
public:
+ enum MIPSSubType
+ {
+ eMIPSSubType_unknown,
+ eMIPSSubType_mips32,
+ eMIPSSubType_mips32r2,
+ eMIPSSubType_mips32r6,
+ eMIPSSubType_mips32el,
+ eMIPSSubType_mips32r2el,
+ eMIPSSubType_mips32r6el,
+ eMIPSSubType_mips64,
+ eMIPSSubType_mips64r2,
+ eMIPSSubType_mips64r6,
+ eMIPSSubType_mips64el,
+ eMIPSSubType_mips64r2el,
+ eMIPSSubType_mips64r6el,
+ };
+
enum Core
{
eCore_arm_generic,
@@ -66,8 +82,27 @@ public:
eCore_arm_arm64,
eCore_arm_armv8,
eCore_arm_aarch64,
-
+
+ eCore_mips32,
+ eCore_mips32r2,
+ eCore_mips32r3,
+ eCore_mips32r5,
+ eCore_mips32r6,
+ eCore_mips32el,
+ eCore_mips32r2el,
+ eCore_mips32r3el,
+ eCore_mips32r5el,
+ eCore_mips32r6el,
eCore_mips64,
+ eCore_mips64r2,
+ eCore_mips64r3,
+ eCore_mips64r5,
+ eCore_mips64r6,
+ eCore_mips64el,
+ eCore_mips64r2el,
+ eCore_mips64r3el,
+ eCore_mips64r5el,
+ eCore_mips64r6el,
eCore_ppc_generic,
eCore_ppc_ppc601,
@@ -142,7 +177,19 @@ public:
kCore_hexagon_last = eCore_hexagon_hexagonv5,
kCore_kalimba_first = eCore_kalimba3,
- kCore_kalimba_last = eCore_kalimba5
+ kCore_kalimba_last = eCore_kalimba5,
+
+ kCore_mips32_first = eCore_mips32,
+ kCore_mips32_last = eCore_mips32r6,
+
+ kCore_mips32el_first = eCore_mips32el,
+ kCore_mips32el_last = eCore_mips32r6el,
+
+ kCore_mips64_first = eCore_mips64,
+ kCore_mips64_last = eCore_mips64r6,
+
+ kCore_mips64el_first = eCore_mips64el,
+ kCore_mips64el_last = eCore_mips64r6el
};
typedef void (* StopInfoOverrideCallbackType)(lldb_private::Thread &thread);
@@ -290,58 +337,48 @@ public:
//------------------------------------------------------------------
void
MergeFrom(const ArchSpec &other);
-
- //------------------------------------------------------------------
- /// Sets this ArchSpec according to the given architecture name.
- ///
- /// The architecture name can be one of the generic system default
- /// values:
- ///
- /// @li \c LLDB_ARCH_DEFAULT - The arch the current system defaults
- /// to when a program is launched without any extra
- /// attributes or settings.
- /// @li \c LLDB_ARCH_DEFAULT_32BIT - The default host architecture
- /// for 32 bit (if any).
- /// @li \c LLDB_ARCH_DEFAULT_64BIT - The default host architecture
- /// for 64 bit (if any).
- ///
- /// Alternatively, if the object type of this ArchSpec has been
- /// configured, a concrete architecture can be specified to set
- /// the CPU type ("x86_64" for example).
- ///
- /// Finally, an encoded object and archetecture format is accepted.
- /// The format contains an object type (like "macho" or "elf"),
- /// followed by a platform dependent encoding of CPU type and
- /// subtype. For example:
- ///
- /// "macho" : Specifies an object type of MachO.
- /// "macho-16-6" : MachO specific encoding for ARMv6.
- /// "elf-43 : ELF specific encoding for Sparc V9.
- ///
- /// @param[in] arch_name The name of an architecture.
- ///
- /// @return True if @p arch_name was successfully translated, false
- /// otherwise.
- //------------------------------------------------------------------
-// bool
-// SetArchitecture (const llvm::StringRef& arch_name);
-//
-// bool
-// SetArchitecture (const char *arch_name);
//------------------------------------------------------------------
- /// Change the architecture object type and CPU type.
+ /// Change the architecture object type, CPU type and OS type.
///
/// @param[in] arch_type The object type of this ArchSpec.
///
/// @param[in] cpu The required CPU type.
///
- /// @return True if the object and CPU type were successfully set.
+ /// @param[in] os The optional OS type
+ /// The default value of 0 was choosen to from the ELF spec value
+ /// ELFOSABI_NONE. ELF is the only one using this parameter. If another
+ /// format uses this parameter and 0 does not work, use a value over
+ /// 255 because in the ELF header this is value is only a byte.
+ ///
+ /// @return True if the object, and CPU were successfully set.
+ ///
+ /// As a side effect, the vendor value is usually set to unknown.
+ /// The exections are
+ /// aarch64-apple-ios
+ /// arm-apple-ios
+ /// thumb-apple-ios
+ /// x86-apple-
+ /// x86_64-apple-
+ ///
+ /// As a side effect, the os value is usually set to unknown
+ /// The exceptions are
+ /// *-*-aix
+ /// aarch64-apple-ios
+ /// arm-apple-ios
+ /// thumb-apple-ios
+ /// powerpc-apple-darwin
+ /// *-*-freebsd
+ /// *-*-linux
+ /// *-*-netbsd
+ /// *-*-openbsd
+ /// *-*-solaris
//------------------------------------------------------------------
bool
SetArchitecture (ArchitectureType arch_type,
uint32_t cpu,
- uint32_t sub);
+ uint32_t sub,
+ uint32_t os = 0);
//------------------------------------------------------------------
/// Returns the byte order for the architecture specification.
@@ -456,8 +493,18 @@ public:
GetDefaultEndian () const;
//------------------------------------------------------------------
- /// Compare an ArchSpec to another ArchSpec, requiring an exact cpu
- /// type match between them.
+ /// Returns true if 'char' is a signed type by defualt in the
+ /// architecture false otherwise
+ ///
+ /// @return True if 'char' is a signed type by default on the
+ /// architecture and false otherwise.
+ //------------------------------------------------------------------
+ bool
+ CharIsSignedByDefault () const;
+
+ //------------------------------------------------------------------
+ /// Compare an ArchSpec to another ArchSpec, requiring an exact cpu
+ /// type match between them.
/// e.g. armv7s is not an exact match with armv7 - this would return false
///
/// @return true if the two ArchSpecs match.
diff --git a/include/lldb/Core/ClangForward.h b/include/lldb/Core/ClangForward.h
index ef7308d25f7f..6c627c2ad3b7 100644
--- a/include/lldb/Core/ClangForward.h
+++ b/include/lldb/Core/ClangForward.h
@@ -72,11 +72,14 @@ namespace clang
class FunctionTemplateSpecializationInfo;
class GotoStmt;
class HeaderSearchOptions;
+ class IdentifierInfo;
class IdentifierTable;
class IntegerLiteral;
class LabelStmt;
class LangOptions;
+ class MacroDirective;
class MemberExpr;
+ class Module;
class NamedDecl;
class NamespaceDecl;
class NonTypeTemplateParmDecl;
diff --git a/include/lldb/Core/Communication.h b/include/lldb/Core/Communication.h
index 49532fe123c5..7924ed293d3c 100644
--- a/include/lldb/Core/Communication.h
+++ b/include/lldb/Core/Communication.h
@@ -85,14 +85,16 @@ namespace lldb_private {
class Communication : public Broadcaster
{
public:
- enum {
- eBroadcastBitDisconnected = (1 << 0), ///< Sent when the communications connection is lost.
- eBroadcastBitReadThreadGotBytes = (1 << 1), ///< Sent by the read thread when bytes become available.
- eBroadcastBitReadThreadDidExit = (1 << 2), ///< Sent by the read thread when it exits to inform clients.
- eBroadcastBitReadThreadShouldExit = (1 << 3), ///< Sent by clients that need to cancel the read thread.
- eBroadcastBitPacketAvailable = (1 << 4), ///< Sent when data received makes a complete packet.
- kLoUserBroadcastBit = (1 << 16),///< Subclasses can used bits 31:16 for any needed events.
- kHiUserBroadcastBit = (1 << 31),
+ FLAGS_ANONYMOUS_ENUM()
+ {
+ eBroadcastBitDisconnected = (1u << 0), ///< Sent when the communications connection is lost.
+ eBroadcastBitReadThreadGotBytes = (1u << 1), ///< Sent by the read thread when bytes become available.
+ eBroadcastBitReadThreadDidExit = (1u << 2), ///< Sent by the read thread when it exits to inform clients.
+ eBroadcastBitReadThreadShouldExit = (1u << 3), ///< Sent by clients that need to cancel the read thread.
+ eBroadcastBitPacketAvailable = (1u << 4), ///< Sent when data received makes a complete packet.
+ eBroadcastBitNoMorePendingInput = (1u << 5), ///< Sent by the read thread to indicate all pending input has been processed.
+ kLoUserBroadcastBit = (1u << 16),///< Subclasses can used bits 31:16 for any needed events.
+ kHiUserBroadcastBit = (1u << 31),
eAllEventBits = 0xffffffff
};
@@ -321,6 +323,16 @@ public:
SetReadThreadBytesReceivedCallback (ReadThreadBytesReceived callback,
void *callback_baton);
+
+ //------------------------------------------------------------------
+ /// Wait for the read thread to process all outstanding data.
+ ///
+ /// After this function returns, the read thread has processed all data that
+ /// has been waiting in the Connection queue.
+ ///
+ //------------------------------------------------------------------
+ void SynchronizeWithReadThread ();
+
static const char *
ConnectionStatusAsCString (lldb::ConnectionStatus status);
@@ -354,9 +366,11 @@ protected:
lldb::ConnectionSP m_connection_sp; ///< The connection that is current in use by this communications class.
HostThread m_read_thread; ///< The read thread handle in case we need to cancel the thread.
std::atomic<bool> m_read_thread_enabled;
+ std::atomic<bool> m_read_thread_did_exit;
std::string m_bytes; ///< A buffer to cache bytes read in the ReadThread function.
Mutex m_bytes_mutex; ///< A mutex to protect multi-threaded access to the cached bytes.
Mutex m_write_mutex; ///< Don't let multiple threads write at the same time...
+ Mutex m_synchronize_mutex;
ReadThreadBytesReceived m_callback;
void *m_callback_baton;
bool m_close_on_eof;
diff --git a/include/lldb/Core/Connection.h b/include/lldb/Core/Connection.h
index a7b911ac382f..c354519a222e 100644
--- a/include/lldb/Core/Connection.h
+++ b/include/lldb/Core/Connection.h
@@ -111,6 +111,13 @@ public:
/// The number of bytes to attempt to read, and also the max
/// number of bytes that can be placed into \a dst.
///
+ /// @param[in] timeout_usec
+ /// The number of microseconds to wait for the data.
+ ///
+ /// @param[out] status
+ /// On return, indicates whether the call was sucessful or terminated
+ /// due to some error condition.
+ ///
/// @param[out] error_ptr
/// A pointer to an error object that should be given an
/// approriate error value if this method returns zero. This
@@ -164,6 +171,22 @@ public:
virtual std::string
GetURI() = 0;
+ //------------------------------------------------------------------
+ /// Interrupts an ongoing Read() operation.
+ ///
+ /// If there is an ongoing read operation in another thread, this operation
+ /// return with status == eConnectionStatusInterrupted. Note that if there
+ /// data waiting to be read and an interrupt request is issued, the Read()
+ /// function will return the data immediately without processing the
+ /// interrupt request (which will remain queued for the next Read()
+ /// operation).
+ ///
+ /// @return
+ /// Returns true is the interrupt request was sucessful.
+ //------------------------------------------------------------------
+ virtual bool
+ InterruptRead() = 0;
+
private:
//------------------------------------------------------------------
// For Connection only
diff --git a/include/lldb/Core/ConstString.h b/include/lldb/Core/ConstString.h
index cfa237c46862..cfe8ea2db0e1 100644
--- a/include/lldb/Core/ConstString.h
+++ b/include/lldb/Core/ConstString.h
@@ -233,7 +233,7 @@ public:
const char *
AsCString(const char *value_if_empty = NULL) const
{
- if (m_string == NULL)
+ if (IsEmpty())
return value_if_empty;
return m_string;
}
diff --git a/include/lldb/Core/CxaDemangle.h b/include/lldb/Core/CxaDemangle.h
new file mode 100644
index 000000000000..0cd54fb36a32
--- /dev/null
+++ b/include/lldb/Core/CxaDemangle.h
@@ -0,0 +1,21 @@
+//===-- CxaDemangle.h -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CxaDemangle_h_
+#define liblldb_CxaDemangle_h_
+
+namespace lldb_private
+{
+
+ char*
+ __cxa_demangle(const char* mangled_name, char* buf, size_t* n, int* status);
+
+}
+
+#endif
diff --git a/include/lldb/Core/DataEncoder.h b/include/lldb/Core/DataEncoder.h
index 7cd5d6808152..7889f4191e50 100644
--- a/include/lldb/Core/DataEncoder.h
+++ b/include/lldb/Core/DataEncoder.h
@@ -357,7 +357,7 @@ public:
/// The number of bytes that this object now contains.
//------------------------------------------------------------------
uint32_t
- SetData (const void *bytes, uint32_t length, lldb::ByteOrder byte_order);
+ SetData (void *bytes, uint32_t length, lldb::ByteOrder byte_order);
//------------------------------------------------------------------
/// Adopt a subset of shared data in \a data_sp.
@@ -446,7 +446,7 @@ protected:
uint8_t *m_end; ///< A pointer to the byte that is past the end of the data.
lldb::ByteOrder m_byte_order; ///< The byte order of the data we are extracting from.
uint8_t m_addr_size; ///< The address size to use when extracting pointers or addresses
- mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can be shared among multilple instances
+ mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can be shared among multiple instances
private:
DISALLOW_COPY_AND_ASSIGN (DataEncoder);
diff --git a/include/lldb/Core/DataExtractor.h b/include/lldb/Core/DataExtractor.h
index 516953b00c33..e61189b98103 100644
--- a/include/lldb/Core/DataExtractor.h
+++ b/include/lldb/Core/DataExtractor.h
@@ -234,7 +234,7 @@ public:
/// bytes into the contained data, into the stream \a s. \a
/// num_per_line objects will be dumped on each line before a new
/// line will be output. If \a base_addr is a valid address, then
- /// each new line of output will be prededed by the address value
+ /// each new line of output will be preceded by the address value
/// plus appropriate offset, and a colon and space. Bitfield values
/// can be dumped by calling this function multiple times with the
/// same start offset, format and size, yet differing \a
@@ -574,7 +574,7 @@ public:
GetSharedDataOffset () const;
//------------------------------------------------------------------
- /// Get a the data start pointer.
+ /// Get the data start pointer.
///
/// @return
/// Returns a pointer to the first byte contained in this
@@ -908,7 +908,7 @@ public:
///
/// @return
/// \a dst if all values were properly extracted and copied,
- /// NULL otherise.
+ /// NULL otherwise.
//------------------------------------------------------------------
void *
GetU8 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
@@ -955,7 +955,7 @@ public:
///
/// @return
/// \a dst if all values were properly extracted and copied,
- /// NULL otherise.
+ /// NULL otherwise.
//------------------------------------------------------------------
void *
GetU16 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
@@ -1002,7 +1002,7 @@ public:
///
/// @return
/// \a dst if all values were properly extracted and copied,
- /// NULL otherise.
+ /// NULL otherwise.
//------------------------------------------------------------------
void *
GetU32 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
@@ -1049,7 +1049,7 @@ public:
///
/// @return
/// \a dst if all values were properly extracted and copied,
- /// NULL otherise.
+ /// NULL otherwise.
//------------------------------------------------------------------
void *
GetU64 ( lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
@@ -1328,7 +1328,7 @@ protected:
const uint8_t * m_end; ///< A pointer to the byte that is past the end of the data.
lldb::ByteOrder m_byte_order; ///< The byte order of the data we are extracting from.
uint32_t m_addr_size; ///< The address size to use when extracting pointers or addresses
- mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can be shared among multilple instances
+ mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can be shared among multiple instances
const uint32_t m_target_byte_size;
};
diff --git a/include/lldb/Core/Debugger.h b/include/lldb/Core/Debugger.h
index 9a3f9736fdca..0d9b90c8919d 100644
--- a/include/lldb/Core/Debugger.h
+++ b/include/lldb/Core/Debugger.h
@@ -14,22 +14,16 @@
#include <stdint.h>
-#include <stack>
-
#include "lldb/lldb-public.h"
#include "lldb/Core/Broadcaster.h"
-#include "lldb/Core/Communication.h"
#include "lldb/Core/FormatEntity.h"
#include "lldb/Core/IOHandler.h"
#include "lldb/Core/Listener.h"
#include "lldb/Core/SourceManager.h"
#include "lldb/Core/UserID.h"
#include "lldb/Core/UserSettingsController.h"
-#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Host/Terminal.h"
-#include "lldb/Interpreter/OptionValueProperties.h"
-#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/TargetList.h"
@@ -61,10 +55,6 @@ friend class SourceManager; // For GetSourceFileCache.
public:
- typedef llvm::sys::DynamicLibrary (*LoadPluginCallbackType) (const lldb::DebuggerSP &debugger_sp,
- const FileSpec& spec,
- Error& error);
-
static lldb::DebuggerSP
CreateInstance (lldb::LogOutputCallback log_callback = NULL, void *baton = NULL);
@@ -75,10 +65,10 @@ public:
FindTargetWithProcess (Process *process);
static void
- Initialize (LoadPluginCallbackType load_plugin_callback);
+ Initialize(LoadPluginCallbackType load_plugin_callback);
- static void
- Terminate ();
+ static void
+ Terminate();
static void
SettingsInitialize ();
@@ -220,6 +210,9 @@ public:
bool
IsTopIOHandler (const lldb::IOHandlerSP& reader_sp);
+ void
+ PrintAsync (const char *s, size_t len, bool is_stdout);
+
ConstString
GetTopIOHandlerControlSequence(char ch);
@@ -229,12 +222,6 @@ public:
const char *
GetIOHandlerHelpPrologue();
- bool
- HideTopIOHandler();
-
- void
- RefreshTopIOHandler();
-
static lldb::DebuggerSP
FindDebuggerWithID (lldb::user_id_t id);
@@ -258,9 +245,6 @@ public:
void
ClearIOHandlers ();
- static int
- TestDebuggerRefCount ();
-
bool
GetCloseInputOnEOF () const;
@@ -360,7 +344,7 @@ public:
LoadPlugin (const FileSpec& spec, Error& error);
void
- ExecuteIOHanders();
+ ExecuteIOHandlers();
bool
IsForwardingEvents ();
diff --git a/include/lldb/Core/Disassembler.h b/include/lldb/Core/Disassembler.h
index 64d35e67bfd0..e08e2def4c18 100644
--- a/include/lldb/Core/Disassembler.h
+++ b/include/lldb/Core/Disassembler.h
@@ -120,6 +120,12 @@ public:
/// @param[in] disassembly_addr_format
/// The format specification for how addresses are printed.
/// Only needed if show_address is true.
+ ///
+ /// @param[in] max_address_text_size
+ /// The length of the longest address string at the start of the
+ /// disassembly line that will be printed (the Debugger::FormatDisassemblerAddress() string)
+ /// so this method can properly align the instruction opcodes.
+ /// May be 0 to indicate no indentation/alignment of the opcodes.
//------------------------------------------------------------------
virtual void
@@ -130,7 +136,8 @@ public:
const ExecutionContext* exe_ctx,
const SymbolContext *sym_ctx,
const SymbolContext *prev_sym_ctx,
- const FormatEntity::Entry *disassembly_addr_format);
+ const FormatEntity::Entry *disassembly_addr_format,
+ size_t max_address_text_size);
virtual bool
DoesBranch () = 0;
@@ -218,7 +225,7 @@ public:
GetInstructionAtIndex (size_t idx) const;
uint32_t
- GetIndexOfNextBranchInstruction(uint32_t start) const;
+ GetIndexOfNextBranchInstruction(uint32_t start, Target &target) const;
uint32_t
GetIndexOfInstructionAtLoadAddress (lldb::addr_t load_addr, Target &target);
diff --git a/include/lldb/Core/FastDemangle.h b/include/lldb/Core/FastDemangle.h
new file mode 100644
index 000000000000..cd6128c73038
--- /dev/null
+++ b/include/lldb/Core/FastDemangle.h
@@ -0,0 +1,24 @@
+//===-- FastDemangle.h ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_FastDemangle_h_
+#define liblldb_FastDemangle_h_
+
+namespace lldb_private
+{
+
+ char *
+ FastDemangle(const char *mangled_name);
+
+ char *
+ FastDemangle(const char *mangled_name, long mangled_name_length);
+
+}
+
+#endif
diff --git a/include/lldb/Core/FormatEntity.h b/include/lldb/Core/FormatEntity.h
index 32ff9ea4e3eb..db4f59132832 100644
--- a/include/lldb/Core/FormatEntity.h
+++ b/include/lldb/Core/FormatEntity.h
@@ -61,6 +61,7 @@ namespace lldb_private
ScriptTarget,
ModuleFile,
File,
+ Lang,
FrameIndex,
FrameRegisterPC,
FrameRegisterSP,
@@ -78,6 +79,8 @@ namespace lldb_private
FunctionAddrOffsetConcrete,
FunctionLineOffset,
FunctionPCOffset,
+ FunctionInitial,
+ FunctionChanged,
LineEntryFile,
LineEntryLineNumber,
LineEntryStartAddress,
diff --git a/include/lldb/Core/IOHandler.h b/include/lldb/Core/IOHandler.h
index 02e6bde1edb6..b617d8e75f58 100644
--- a/include/lldb/Core/IOHandler.h
+++ b/include/lldb/Core/IOHandler.h
@@ -67,18 +67,6 @@ namespace lldb_private {
virtual void
Run () = 0;
- // Hide any characters that have been displayed so far so async
- // output can be displayed. Refresh() will be called after the
- // output has been displayed.
- virtual void
- Hide () = 0;
-
- // Called when the async output has been received in order to update
- // the input reader (refresh the prompt and redisplay any current
- // line(s) that are being edited
- virtual void
- Refresh () = 0;
-
// Called when an input reader should relinquish its control so another
// can be pushed onto the IO handler stack, or so the current IO
// handler can pop itself off the stack
@@ -246,7 +234,14 @@ namespace lldb_private {
void
WaitForPop ();
-
+
+ virtual void
+ PrintAsync (Stream *stream, const char *s, size_t len)
+ {
+ stream->Write (s, len);
+ stream->Flush();
+ }
+
protected:
Debugger &m_debugger;
lldb::StreamFileSP m_input_sp;
@@ -318,7 +313,7 @@ namespace lldb_private {
}
//------------------------------------------------------------------
- /// Called when a new line is created or one of an identifed set of
+ /// Called when a new line is created or one of an identified set of
/// indentation characters is typed.
///
/// This function determines how much indentation should be added
@@ -332,7 +327,7 @@ namespace lldb_private {
/// following the line containing the cursor are not included.
///
/// @param[in] cursor_position
- /// The number of characters preceeding the cursor on the final
+ /// The number of characters preceding the cursor on the final
/// line at the time.
///
/// @return
@@ -448,17 +443,17 @@ namespace lldb_private {
{
}
- virtual ConstString
- IOHandlerGetControlSequence (char ch)
+ ConstString
+ IOHandlerGetControlSequence (char ch) override
{
if (ch == 'd')
return ConstString (m_end_line + "\n");
return ConstString();
}
- virtual bool
+ bool
IOHandlerIsInputComplete (IOHandler &io_handler,
- StringList &lines)
+ StringList &lines) override
{
// Determine whether the end of input signal has been entered
const size_t num_lines = lines.GetSize();
@@ -507,53 +502,47 @@ namespace lldb_private {
virtual
~IOHandlerEditline ();
- virtual void
- Run ();
+ void
+ Run () override;
- virtual void
- Hide ();
-
- virtual void
- Refresh ();
-
- virtual void
- Cancel ();
+ void
+ Cancel () override;
- virtual bool
- Interrupt ();
+ bool
+ Interrupt () override;
- virtual void
- GotEOF();
+ void
+ GotEOF() override;
- virtual void
- Activate ();
+ void
+ Activate () override;
- virtual void
- Deactivate ();
+ void
+ Deactivate () override;
- virtual ConstString
- GetControlSequence (char ch)
+ ConstString
+ GetControlSequence (char ch) override
{
return m_delegate.IOHandlerGetControlSequence (ch);
}
- virtual const char *
- GetCommandPrefix ()
+ const char *
+ GetCommandPrefix () override
{
return m_delegate.IOHandlerGetCommandPrefix ();
}
- virtual const char *
- GetHelpPrologue ()
+ const char *
+ GetHelpPrologue () override
{
return m_delegate.IOHandlerGetHelpPrologue ();
}
- virtual const char *
- GetPrompt ();
+ const char *
+ GetPrompt () override;
- virtual bool
- SetPrompt (const char *prompt);
+ bool
+ SetPrompt (const char *prompt) override;
const char *
GetContinuationPrompt ();
@@ -591,6 +580,9 @@ namespace lldb_private {
uint32_t
GetCurrentLineIndex () const;
+ void
+ PrintAsync (Stream *stream, const char *s, size_t len) override;
+
private:
#ifndef LLDB_DISABLE_LIBEDIT
static bool
@@ -626,6 +618,7 @@ namespace lldb_private {
bool m_multi_line;
bool m_color_prompts;
bool m_interrupt_exits;
+ bool m_editing; // Set to true when fetching a line manually (not using libedit)
};
// The order of base classes is important. Look at the constructor of IOHandlerConfirm
@@ -648,17 +641,17 @@ namespace lldb_private {
return m_user_response;
}
- virtual int
+ int
IOHandlerComplete (IOHandler &io_handler,
const char *current_line,
const char *cursor,
const char *last_char,
int skip_first_n_matches,
int max_matches,
- StringList &matches);
+ StringList &matches) override;
- virtual void
- IOHandlerInputComplete (IOHandler &io_handler, std::string &data);
+ void
+ IOHandlerInputComplete (IOHandler &io_handler, std::string &data) override;
protected:
const bool m_default_response;
@@ -671,32 +664,25 @@ namespace lldb_private {
public:
IOHandlerCursesGUI (Debugger &debugger);
- virtual
- ~IOHandlerCursesGUI ();
-
- virtual void
- Run ();
+ ~IOHandlerCursesGUI () override;
- virtual void
- Hide ();
+ void
+ Run () override;
- virtual void
- Refresh ();
-
- virtual void
- Cancel ();
+ void
+ Cancel () override;
- virtual bool
- Interrupt ();
+ bool
+ Interrupt () override;
- virtual void
- GotEOF();
+ void
+ GotEOF() override;
- virtual void
- Activate ();
+ void
+ Activate () override;
- virtual void
- Deactivate ();
+ void
+ Deactivate () override;
protected:
curses::ApplicationAP m_app_ap;
@@ -711,20 +697,11 @@ namespace lldb_private {
virtual
~IOHandlerCursesValueObjectList ();
- virtual void
- Run ();
-
- virtual void
- Hide ();
-
- virtual void
- Refresh ();
-
- virtual bool
- HandleInterrupt ();
+ void
+ Run () override;
- virtual void
- GotEOF();
+ void
+ GotEOF() override;
protected:
ValueObjectList m_valobj_list;
};
@@ -849,7 +826,10 @@ namespace lldb_private {
return NULL;
}
- protected:
+ void
+ PrintAsync (Stream *stream, const char *s, size_t len);
+
+ protected:
typedef std::vector<lldb::IOHandlerSP> collection;
collection m_stack;
diff --git a/include/lldb/Core/Log.h b/include/lldb/Core/Log.h
index b389946e264c..3aa4b4d48e17 100644
--- a/include/lldb/Core/Log.h
+++ b/include/lldb/Core/Log.h
@@ -22,20 +22,10 @@
#include "lldb/lldb-private.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Flags.h"
+#include "lldb/Core/Logging.h"
#include "lldb/Core/PluginInterface.h"
//----------------------------------------------------------------------
-// Logging types
-//----------------------------------------------------------------------
-#define LLDB_LOG_FLAG_STDOUT (1u << 0)
-#define LLDB_LOG_FLAG_STDERR (1u << 1)
-#define LLDB_LOG_FLAG_FATAL (1u << 2)
-#define LLDB_LOG_FLAG_ERROR (1u << 3)
-#define LLDB_LOG_FLAG_WARNING (1u << 4)
-#define LLDB_LOG_FLAG_DEBUG (1u << 5)
-#define LLDB_LOG_FLAG_VERBOSE (1u << 6)
-
-//----------------------------------------------------------------------
// Logging Options
//----------------------------------------------------------------------
#define LLDB_LOG_OPTION_THREADSAFE (1u << 0)
@@ -46,6 +36,7 @@
#define LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD (1u << 5)
#define LLDB_LOG_OPTION_PREPEND_THREAD_NAME (1U << 6)
#define LLDB_LOG_OPTION_BACKTRACE (1U << 7)
+#define LLDB_LOG_OPTION_APPEND (1U << 8)
//----------------------------------------------------------------------
// Logging Functions
@@ -59,12 +50,10 @@ public:
//------------------------------------------------------------------
// Callback definitions for abstracted plug-in log access.
//------------------------------------------------------------------
- typedef void (*DisableCallback) (const char **categories, Stream *feedback_strm);
- typedef Log * (*EnableCallback) (lldb::StreamSP &log_stream_sp,
- uint32_t log_options,
- const char **categories,
- Stream *feedback_strm);
- typedef void (*ListCategoriesCallback) (Stream *strm);
+ typedef void (*DisableCallback)(const char **categories, Stream *feedback_strm);
+ typedef Log *(*EnableCallback)(lldb::StreamSP &log_stream_sp, uint32_t log_options, const char **categories,
+ Stream *feedback_strm);
+ typedef void (*ListCategoriesCallback)(Stream *strm);
struct Callbacks
{
@@ -77,86 +66,85 @@ public:
// Static accessors for logging channels
//------------------------------------------------------------------
static void
- RegisterLogChannel (const ConstString &channel,
- const Log::Callbacks &log_callbacks);
+ RegisterLogChannel(const ConstString &channel, const Log::Callbacks &log_callbacks);
static bool
- UnregisterLogChannel (const ConstString &channel);
+ UnregisterLogChannel(const ConstString &channel);
static bool
- GetLogChannelCallbacks (const ConstString &channel,
- Log::Callbacks &log_callbacks);
+ GetLogChannelCallbacks(const ConstString &channel, Log::Callbacks &log_callbacks);
+ static bool
+ EnableLogChannel(lldb::StreamSP &log_stream_sp, uint32_t log_options, const char *channel,
+ const char **categories, Stream &error_stream);
static void
- EnableAllLogChannels (lldb::StreamSP &log_stream_sp,
- uint32_t log_options,
- const char **categories,
- Stream *feedback_strm);
+ EnableAllLogChannels(lldb::StreamSP &log_stream_sp, uint32_t log_options, const char **categories,
+ Stream *feedback_strm);
static void
- DisableAllLogChannels (Stream *feedback_strm);
+ DisableAllLogChannels(Stream *feedback_strm);
static void
- ListAllLogChannels (Stream *strm);
+ ListAllLogChannels(Stream *strm);
static void
- Initialize ();
+ Initialize();
static void
- Terminate ();
-
+ Terminate();
+
//------------------------------------------------------------------
// Auto completion
//------------------------------------------------------------------
static void
- AutoCompleteChannelName (const char *channel_name,
- StringList &matches);
+ AutoCompleteChannelName(const char *channel_name, StringList &matches);
//------------------------------------------------------------------
// Member functions
//------------------------------------------------------------------
- Log ();
+ Log();
- Log (const lldb::StreamSP &stream_sp);
+ Log(const lldb::StreamSP &stream_sp);
- ~Log ();
+ virtual
+ ~Log();
- void
- PutCString (const char *cstr);
+ virtual void
+ PutCString(const char *cstr);
- void
- Printf (const char *format, ...) __attribute__ ((format (printf, 2, 3)));
+ virtual void
+ Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
- void
- VAPrintf (const char *format, va_list args);
+ virtual void
+ VAPrintf(const char *format, va_list args);
- void
- PrintfWithFlags( uint32_t flags, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
+ virtual void
+ LogIf(uint32_t mask, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
- void
- LogIf (uint32_t mask, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
+ virtual void
+ Debug(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
- void
- Debug (const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
+ virtual void
+ DebugVerbose(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
- void
- DebugVerbose (const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
+ virtual void
+ Error(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
- void
- Error (const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
+ virtual void
+ VAError(const char *format, va_list args);
- void
- FatalError (int err, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
+ virtual void
+ FatalError(int err, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
- void
- Verbose (const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
+ virtual void
+ Verbose(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
- void
- Warning (const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
+ virtual void
+ Warning(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
- void
- WarningVerbose (const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
+ virtual void
+ WarningVerbose(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
Flags &
GetOptions();
@@ -177,7 +165,7 @@ public:
GetDebug() const;
void
- SetStream (const lldb::StreamSP &stream_sp)
+ SetStream(const lldb::StreamSP &stream_sp)
{
m_stream_sp = stream_sp;
}
@@ -190,43 +178,35 @@ protected:
Flags m_options;
Flags m_mask_bits;
- void
- PrintfWithFlagsVarArg (uint32_t flags, const char *format, va_list args);
-
private:
- DISALLOW_COPY_AND_ASSIGN (Log);
+ DISALLOW_COPY_AND_ASSIGN(Log);
};
class LogChannel : public PluginInterface
{
public:
- LogChannel ();
+ LogChannel();
- virtual
- ~LogChannel ();
+ virtual ~LogChannel();
- static lldb::LogChannelSP
- FindPlugin (const char *plugin_name);
+ static lldb::LogChannelSP FindPlugin(const char *plugin_name);
// categories is a an array of chars that ends with a NULL element.
- virtual void
- Disable (const char **categories, Stream *feedback_strm) = 0;
+ virtual void Disable(const char **categories, Stream *feedback_strm) = 0;
- virtual bool
- Enable (lldb::StreamSP &log_stream_sp,
- uint32_t log_options,
- Stream *feedback_strm, // Feedback stream for argument errors etc
- const char **categories) = 0;// The categories to enable within this logging stream, if empty, enable default set
+ virtual bool Enable(
+ lldb::StreamSP &log_stream_sp, uint32_t log_options,
+ Stream *feedback_strm, // Feedback stream for argument errors etc
+ const char **categories) = 0; // The categories to enable within this logging stream, if empty, enable default set
- virtual void
- ListCategories (Stream *strm) = 0;
+ virtual void ListCategories(Stream *strm) = 0;
protected:
std::unique_ptr<Log> m_log_ap;
private:
- DISALLOW_COPY_AND_ASSIGN (LogChannel);
+ DISALLOW_COPY_AND_ASSIGN(LogChannel);
};
diff --git a/include/lldb/lldb-private-log.h b/include/lldb/Core/Logging.h
index dc37ae2c7c42..a4dd76f11237 100644
--- a/include/lldb/lldb-private-log.h
+++ b/include/lldb/Core/Logging.h
@@ -1,4 +1,4 @@
-//===-- lldb-private-log.h --------------------------------------*- C++ -*-===//
+//===-- Logging.h -----------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_lldb_private_log_h_
-#define liblldb_lldb_private_log_h_
+#ifndef liblldb_Core_Logging_h_
+#define liblldb_Core_Logging_h_
// C Includes
// C++ Includes
@@ -47,6 +47,7 @@
#define LIBLLDB_LOG_PLATFORM (1u << 25)
#define LIBLLDB_LOG_SYSTEM_RUNTIME (1u << 26)
#define LIBLLDB_LOG_JIT_LOADER (1u << 27)
+#define LIBLLDB_LOG_LANGUAGE (1u << 28)
#define LIBLLDB_LOG_ALL (UINT32_MAX)
#define LIBLLDB_LOG_DEFAULT (LIBLLDB_LOG_PROCESS |\
LIBLLDB_LOG_THREAD |\
@@ -90,4 +91,4 @@ ListLogCategories (Stream *strm);
} // namespace lldb_private
-#endif // liblldb_lldb_private_log_h_
+#endif // liblldb_Core_Logging_h_
diff --git a/include/lldb/Core/Mangled.h b/include/lldb/Core/Mangled.h
index 87b23799882f..a2a2b5591d0f 100644
--- a/include/lldb/Core/Mangled.h
+++ b/include/lldb/Core/Mangled.h
@@ -41,6 +41,13 @@ public:
ePreferDemangledWithoutArguments
};
+ enum ManglingScheme
+ {
+ eManglingSchemeNone = 0,
+ eManglingSchemeMSVC,
+ eManglingSchemeItanium
+ };
+
//----------------------------------------------------------------------
/// Default constructor.
///
@@ -291,12 +298,12 @@ public:
SetValue (const ConstString &name);
//----------------------------------------------------------------------
- /// Get the language only if it is definitive what the language is from
- /// the mangling.
+ /// Try to guess the language from the mangling.
///
/// For a mangled name to have a language it must have both a mangled
- /// and a demangled name and it must be definitive from the mangling
- /// what the language is.
+ /// and a demangled name and it can be guessed from the mangling what
+ /// the language is. Note: this will return C++ for any language that
+ /// uses Itanium ABI mangling.
///
/// Standard C function names will return eLanguageTypeUnknown because
/// they aren't mangled and it isn't clear what language the name
@@ -307,7 +314,7 @@ public:
/// if there is no mangled or demangled counterpart.
//----------------------------------------------------------------------
lldb::LanguageType
- GetLanguage ();
+ GuessLanguage () const;
private:
//----------------------------------------------------------------------
diff --git a/include/lldb/Core/Module.h b/include/lldb/Core/Module.h
index 60fbb989502e..127ddaeb9fd4 100644
--- a/include/lldb/Core/Module.h
+++ b/include/lldb/Core/Module.h
@@ -10,12 +10,12 @@
#ifndef liblldb_Module_h_
#define liblldb_Module_h_
+#include "lldb/lldb-forward.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/UUID.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Host/TimeValue.h"
-#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/SymbolContextScope.h"
#include "lldb/Target/PathMappingList.h"
@@ -1098,7 +1098,7 @@ protected:
mutable Mutex m_mutex; ///< A mutex to keep this object happy in multi-threaded environments.
TimeValue m_mod_time; ///< The modification time for this module when it was created.
ArchSpec m_arch; ///< The architecture for this module.
- lldb_private::UUID m_uuid; ///< Each module is assumed to have a unique identifier to help match it up to debug symbols.
+ UUID m_uuid; ///< Each module is assumed to have a unique identifier to help match it up to debug symbols.
FileSpec m_file; ///< The file representation on disk for this module (if there is one).
FileSpec m_platform_file;///< The path to the module on the platform on which it is being debugged
FileSpec m_remote_install_file; ///< If set when debugging on remote platforms, this module will be installed at this location
@@ -1107,10 +1107,12 @@ protected:
uint64_t m_object_offset;
TimeValue m_object_mod_time;
lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file parser for this module as it may or may not be shared with the SymbolFile
- std::unique_ptr<SymbolVendor> m_symfile_ap; ///< A pointer to the symbol vendor for this module.
- ClangASTContext m_ast; ///< The AST context for this module.
+ lldb::SymbolVendorUP m_symfile_ap; ///< A pointer to the symbol vendor for this module.
+ std::vector<lldb::SymbolVendorUP> m_old_symfiles; ///< If anyone calls Module::SetSymbolFileFileSpec() and changes the symbol file,
+ ///< we need to keep all old symbol files around in case anyone has type references to them
+ lldb::ClangASTContextUP m_ast; ///< The AST context for this module.
PathMappingList m_source_mappings; ///< Module specific source remappings for when you have debug info for a module that doesn't match where the sources currently are
- std::unique_ptr<lldb_private::SectionList> m_sections_ap; ///< Unified section list for module that is used by the ObjectFile and and ObjectFile instances for the debug info
+ lldb::SectionListUP m_sections_ap; ///< Unified section list for module that is used by the ObjectFile and and ObjectFile instances for the debug info
bool m_did_load_objfile:1,
m_did_load_symbol_vendor:1,
diff --git a/include/lldb/Core/ModuleList.h b/include/lldb/Core/ModuleList.h
index a46e212da9bb..f4c12cf168ac 100644
--- a/include/lldb/Core/ModuleList.h
+++ b/include/lldb/Core/ModuleList.h
@@ -12,6 +12,7 @@
#include <vector>
#include <list>
+#include <functional>
#include "lldb/lldb-private.h"
#include "lldb/Host/Mutex.h"
@@ -562,6 +563,9 @@ public:
static bool
RemoveSharedModuleIfOrphaned (const Module *module_ptr);
+ void
+ ForEach (std::function <bool (const lldb::ModuleSP &module_sp)> const &callback) const;
+
protected:
//------------------------------------------------------------------
// Class typedefs.
diff --git a/include/lldb/Core/ModuleSpec.h b/include/lldb/Core/ModuleSpec.h
index 195fd991f8de..be7041981a0a 100644
--- a/include/lldb/Core/ModuleSpec.h
+++ b/include/lldb/Core/ModuleSpec.h
@@ -14,6 +14,7 @@
#include "lldb/Core/Stream.h"
#include "lldb/Core/UUID.h"
#include "lldb/Host/FileSpec.h"
+#include "lldb/Host/Mutex.h"
#include "lldb/Target/PathMappingList.h"
namespace lldb_private {
@@ -29,6 +30,7 @@ public:
m_uuid (),
m_object_name (),
m_object_offset (0),
+ m_object_size (0),
m_object_mod_time (),
m_source_mappings ()
{
@@ -42,6 +44,7 @@ public:
m_uuid (),
m_object_name (),
m_object_offset (0),
+ m_object_size (file_spec.GetByteSize ()),
m_object_mod_time (),
m_source_mappings ()
{
@@ -55,6 +58,7 @@ public:
m_uuid (),
m_object_name (),
m_object_offset (0),
+ m_object_size (file_spec.GetByteSize ()),
m_object_mod_time (),
m_source_mappings ()
{
@@ -68,6 +72,7 @@ public:
m_uuid (rhs.m_uuid),
m_object_name (rhs.m_object_name),
m_object_offset (rhs.m_object_offset),
+ m_object_size (rhs.m_object_size),
m_object_mod_time (rhs.m_object_mod_time),
m_source_mappings (rhs.m_source_mappings)
{
@@ -85,6 +90,7 @@ public:
m_uuid = rhs.m_uuid;
m_object_name = rhs.m_object_name;
m_object_offset = rhs.m_object_offset;
+ m_object_size = rhs.m_object_size;
m_object_mod_time = rhs.m_object_mod_time;
m_source_mappings = rhs.m_source_mappings;
}
@@ -254,7 +260,19 @@ public:
{
m_object_offset = object_offset;
}
-
+
+ uint64_t
+ GetObjectSize () const
+ {
+ return m_object_size;
+ }
+
+ void
+ SetObjectSize (uint64_t object_size)
+ {
+ m_object_size = object_size;
+ }
+
TimeValue &
GetObjectModificationTime ()
{
@@ -283,6 +301,7 @@ public:
m_uuid.Clear();
m_object_name.Clear();
m_object_offset = 0;
+ m_object_size = 0;
m_source_mappings.Clear(false);
m_object_mod_time.Clear();
}
@@ -302,6 +321,8 @@ public:
return true;
if (m_object_name)
return true;
+ if (m_object_size)
+ return true;
if (m_object_mod_time.IsValid())
return true;
return false;
@@ -362,7 +383,14 @@ public:
{
if (dumped_something)
strm.PutCString(", ");
- strm.Printf("object_offset = 0x%" PRIx64, m_object_offset);
+ strm.Printf("object_offset = %" PRIu64, m_object_offset);
+ dumped_something = true;
+ }
+ if (m_object_size > 0)
+ {
+ if (dumped_something)
+ strm.PutCString(", ");
+ strm.Printf("object size = %" PRIu64, m_object_size);
dumped_something = true;
}
if (m_object_mod_time.IsValid())
@@ -425,6 +453,7 @@ protected:
UUID m_uuid;
ConstString m_object_name;
uint64_t m_object_offset;
+ uint64_t m_object_size;
TimeValue m_object_mod_time;
mutable PathMappingList m_source_mappings;
};
diff --git a/include/lldb/Core/PluginManager.h b/include/lldb/Core/PluginManager.h
index 55e6df06d842..af940d788ab0 100644
--- a/include/lldb/Core/PluginManager.h
+++ b/include/lldb/Core/PluginManager.h
@@ -137,7 +137,8 @@ public:
static bool
RegisterPlugin (const ConstString &name,
const char *description,
- LanguageRuntimeCreateInstance create_callback);
+ LanguageRuntimeCreateInstance create_callback,
+ LanguageRuntimeGetCommandObject command_callback = nullptr);
static bool
UnregisterPlugin (LanguageRuntimeCreateInstance create_callback);
@@ -145,6 +146,9 @@ public:
static LanguageRuntimeCreateInstance
GetLanguageRuntimeCreateCallbackAtIndex (uint32_t idx);
+ static LanguageRuntimeGetCommandObject
+ GetLanguageRuntimeGetCommandObjectAtIndex (uint32_t idx);
+
static LanguageRuntimeCreateInstance
GetLanguageRuntimeCreateCallbackForPluginName (const ConstString &name);
diff --git a/include/lldb/Core/RangeMap.h b/include/lldb/Core/RangeMap.h
index d78504c7d285..d2c43a5d794d 100644
--- a/include/lldb/Core/RangeMap.h
+++ b/include/lldb/Core/RangeMap.h
@@ -128,9 +128,10 @@ namespace lldb_private {
{
return Contains(range.GetRangeBase()) && ContainsEndInclusive(range.GetRangeEnd());
}
-
+
+ // Returns true if the two ranges adjoing or intersect
bool
- Overlap (const Range &rhs) const
+ DoesAdjoinOrIntersect (const Range &rhs) const
{
const BaseType lhs_base = this->GetRangeBase();
const BaseType rhs_base = rhs.GetRangeBase();
@@ -139,7 +140,19 @@ namespace lldb_private {
bool result = (lhs_base <= rhs_end) && (lhs_end >= rhs_base);
return result;
}
-
+
+ // Returns true if the two ranges intersect
+ bool
+ DoesIntersect (const Range &rhs) const
+ {
+ const BaseType lhs_base = this->GetRangeBase();
+ const BaseType rhs_base = rhs.GetRangeBase();
+ const BaseType lhs_end = this->GetRangeEnd();
+ const BaseType rhs_end = rhs.GetRangeEnd();
+ bool result = (lhs_base < rhs_end) && (lhs_end > rhs_base);
+ return result;
+ }
+
bool
operator < (const Range &rhs) const
{
@@ -241,7 +254,7 @@ namespace lldb_private {
// don't end up allocating and making a new collection for no reason
for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end; prev = pos++)
{
- if (prev != end && prev->Overlap(*pos))
+ if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
{
can_combine = true;
break;
@@ -255,7 +268,7 @@ namespace lldb_private {
Collection minimal_ranges;
for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end; prev = pos++)
{
- if (prev != end && prev->Overlap(*pos))
+ if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
minimal_ranges.back().SetRangeEnd (std::max<BaseType>(prev->GetRangeEnd(), pos->GetRangeEnd()));
else
minimal_ranges.push_back (*pos);
@@ -521,7 +534,7 @@ namespace lldb_private {
// don't end up allocating and making a new collection for no reason
for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end; prev = pos++)
{
- if (prev != end && prev->Overlap(*pos))
+ if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
{
can_combine = true;
break;
@@ -535,7 +548,7 @@ namespace lldb_private {
Collection minimal_ranges;
for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end; prev = pos++)
{
- if (prev != end && prev->Overlap(*pos))
+ if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
minimal_ranges.back().SetRangeEnd (std::max<BaseType>(prev->GetRangeEnd(), pos->GetRangeEnd()));
else
minimal_ranges.push_back (*pos);
diff --git a/include/lldb/Core/StreamAsynchronousIO.h b/include/lldb/Core/StreamAsynchronousIO.h
index a73a9567fe83..d3b054463fa7 100644
--- a/include/lldb/Core/StreamAsynchronousIO.h
+++ b/include/lldb/Core/StreamAsynchronousIO.h
@@ -20,7 +20,7 @@ class StreamAsynchronousIO :
public Stream
{
public:
- StreamAsynchronousIO (Broadcaster &broadcaster, uint32_t broadcast_event_type);
+ StreamAsynchronousIO (Debugger &debugger, bool for_stdout);
virtual ~StreamAsynchronousIO ();
@@ -32,9 +32,9 @@ public:
private:
- Broadcaster &m_broadcaster;
- uint32_t m_broadcast_event_type;
- std::string m_accumulated_data;
+ Debugger &m_debugger;
+ std::string m_data;
+ bool m_for_stdout;
};
} // namespace lldb_private
diff --git a/include/lldb/Core/StreamFile.h b/include/lldb/Core/StreamFile.h
index d032c0b21e6b..55bb361780a5 100644
--- a/include/lldb/Core/StreamFile.h
+++ b/include/lldb/Core/StreamFile.h
@@ -37,6 +37,10 @@ public:
StreamFile (const char *path);
+ StreamFile (const char *path,
+ uint32_t options,
+ uint32_t permissions = lldb::eFilePermissionsFileDefault);
+
StreamFile (FILE *fh, bool transfer_ownership);
virtual
diff --git a/include/lldb/Core/StringList.h b/include/lldb/Core/StringList.h
index b68ab4be2d6d..c69ed872c30d 100644
--- a/include/lldb/Core/StringList.h
+++ b/include/lldb/Core/StringList.h
@@ -14,6 +14,7 @@
#include "lldb/Core/STLUtils.h"
#include "lldb/lldb-forward.h"
+#include "llvm/ADT/StringRef.h"
namespace lldb_private {
@@ -43,6 +44,9 @@ public:
AppendString (const char *str, size_t str_len);
void
+ AppendString(llvm::StringRef str);
+
+ void
AppendList (const char ** strv, int strc);
void
diff --git a/include/lldb/Core/StructuredData.h b/include/lldb/Core/StructuredData.h
index a4cabf4fe352..8acfa310deac 100644
--- a/include/lldb/Core/StructuredData.h
+++ b/include/lldb/Core/StructuredData.h
@@ -13,10 +13,11 @@
// C Includes
// C++ Includes
+#include <functional>
#include <map>
+#include <string>
#include <utility>
#include <vector>
-#include <string>
#include "llvm/ADT/StringRef.h"
@@ -54,14 +55,22 @@ public:
class Boolean;
class String;
class Dictionary;
+ class Generic;
typedef std::shared_ptr<Object> ObjectSP;
typedef std::shared_ptr<Array> ArraySP;
+ typedef std::shared_ptr<Integer> IntegerSP;
+ typedef std::shared_ptr<Float> FloatSP;
+ typedef std::shared_ptr<Boolean> BooleanSP;
+ typedef std::shared_ptr<String> StringSP;
typedef std::shared_ptr<Dictionary> DictionarySP;
+ typedef std::shared_ptr<Generic> GenericSP;
- enum class Type {
+ enum class Type
+ {
eTypeInvalid = -1,
eTypeNull = 0,
+ eTypeGeneric,
eTypeArray,
eTypeInteger,
eTypeFloat,
@@ -84,6 +93,12 @@ public:
{
}
+ virtual bool
+ IsValid() const
+ {
+ return true;
+ }
+
virtual void
Clear ()
{
@@ -126,6 +141,15 @@ public:
return NULL;
}
+ uint64_t
+ GetIntegerValue (uint64_t fail_value = 0)
+ {
+ Integer *integer = GetAsInteger ();
+ if (integer)
+ return integer->GetValue();
+ return fail_value;
+ }
+
Float *
GetAsFloat ()
{
@@ -134,6 +158,15 @@ public:
return NULL;
}
+ double
+ GetFloatValue (double fail_value = 0.0)
+ {
+ Float *f = GetAsFloat ();
+ if (f)
+ return f->GetValue();
+ return fail_value;
+ }
+
Boolean *
GetAsBoolean ()
{
@@ -142,6 +175,15 @@ public:
return NULL;
}
+ bool
+ GetBooleanValue (bool fail_value = false)
+ {
+ Boolean *b = GetAsBoolean ();
+ if (b)
+ return b->GetValue();
+ return fail_value;
+ }
+
String *
GetAsString ()
{
@@ -150,9 +192,32 @@ public:
return NULL;
}
+ std::string
+ GetStringValue(const char *fail_value = NULL)
+ {
+ String *s = GetAsString ();
+ if (s)
+ return s->GetValue();
+
+ if (fail_value && fail_value[0])
+ return std::string(fail_value);
+
+ return std::string();
+ }
+
+ Generic *
+ GetAsGeneric()
+ {
+ if (m_type == Type::eTypeGeneric)
+ return (Generic *)this;
+ return NULL;
+ }
+
ObjectSP
GetObjectForDotSeparatedPath (llvm::StringRef path);
+ void DumpToStdout() const;
+
virtual void
Dump (Stream &s) const = 0;
@@ -173,8 +238,19 @@ public:
{
}
+ void
+ ForEach (std::function <bool(Object* object)> const &foreach_callback) const
+ {
+ for (const auto &object_sp : m_items)
+ {
+ if (foreach_callback(object_sp.get()) == false)
+ break;
+ }
+ }
+
+
size_t
- GetSize()
+ GetSize() const
{
return m_items.size();
}
@@ -188,13 +264,97 @@ public:
}
ObjectSP
- GetItemAtIndex (size_t idx)
+ GetItemAtIndex(size_t idx) const
{
+ assert(idx < GetSize());
if (idx < m_items.size())
return m_items[idx];
return ObjectSP();
}
+ template <class IntType>
+ bool
+ GetItemAtIndexAsInteger(size_t idx, IntType &result) const
+ {
+ ObjectSP value = GetItemAtIndex(idx);
+ if (auto int_value = value->GetAsInteger())
+ {
+ result = static_cast<IntType>(int_value->GetValue());
+ return true;
+ }
+ return false;
+ }
+
+ template <class IntType>
+ bool
+ GetItemAtIndexAsInteger(size_t idx, IntType &result, IntType default_val) const
+ {
+ bool success = GetItemAtIndexAsInteger(idx, result);
+ if (!success)
+ result = default_val;
+ return success;
+ }
+
+ bool
+ GetItemAtIndexAsString(size_t idx, std::string &result) const
+ {
+ ObjectSP value = GetItemAtIndex(idx);
+ if (auto string_value = value->GetAsString())
+ {
+ result = string_value->GetValue();
+ return true;
+ }
+ return false;
+ }
+
+ bool
+ GetItemAtIndexAsString(size_t idx, std::string &result, const std::string &default_val) const
+ {
+ bool success = GetItemAtIndexAsString(idx, result);
+ if (!success)
+ result = default_val;
+ return success;
+ }
+
+ bool
+ GetItemAtIndexAsString(size_t idx, ConstString &result) const
+ {
+ ObjectSP value = GetItemAtIndex(idx);
+ if (!value)
+ return false;
+ if (auto string_value = value->GetAsString())
+ {
+ result = ConstString(string_value->GetValue());
+ return true;
+ }
+ return false;
+ }
+
+ bool
+ GetItemAtIndexAsString(size_t idx, ConstString &result, const char *default_val) const
+ {
+ bool success = GetItemAtIndexAsString(idx, result);
+ if (!success)
+ result.SetCString(default_val);
+ return success;
+ }
+
+ bool
+ GetItemAtIndexAsDictionary(size_t idx, Dictionary *&result) const
+ {
+ ObjectSP value = GetItemAtIndex(idx);
+ result = value->GetAsDictionary();
+ return (result != nullptr);
+ }
+
+ bool
+ GetItemAtIndexAsArray(size_t idx, Array *&result) const
+ {
+ ObjectSP value = GetItemAtIndex(idx);
+ result = value->GetAsArray();
+ return (result != nullptr);
+ }
+
void
Push(ObjectSP item)
{
@@ -207,8 +367,7 @@ public:
m_items.push_back(item);
}
- virtual void
- Dump (Stream &s) const;
+ void Dump(Stream &s) const override;
protected:
typedef std::vector<ObjectSP> collection;
@@ -219,9 +378,9 @@ public:
class Integer : public Object
{
public:
- Integer () :
+ Integer (uint64_t i = 0) :
Object (Type::eTypeInteger),
- m_value ()
+ m_value (i)
{
}
@@ -241,8 +400,7 @@ public:
return m_value;
}
- virtual void
- Dump (Stream &s) const;
+ void Dump(Stream &s) const override;
protected:
uint64_t m_value;
@@ -251,9 +409,9 @@ public:
class Float : public Object
{
public:
- Float () :
+ Float (double d = 0.0) :
Object (Type::eTypeFloat),
- m_value ()
+ m_value (d)
{
}
@@ -273,8 +431,7 @@ public:
return m_value;
}
- virtual void
- Dump (Stream &s) const;
+ void Dump(Stream &s) const override;
protected:
double m_value;
@@ -283,9 +440,9 @@ public:
class Boolean : public Object
{
public:
- Boolean () :
+ Boolean (bool b = false) :
Object (Type::eTypeBoolean),
- m_value ()
+ m_value (b)
{
}
@@ -305,8 +462,7 @@ public:
return m_value;
}
- virtual void
- Dump (Stream &s) const;
+ void Dump(Stream &s) const override;
protected:
bool m_value;
@@ -317,26 +473,39 @@ public:
class String : public Object
{
public:
- String () :
+ String (const char *cstr = NULL) :
Object (Type::eTypeString),
m_value ()
{
+ if (cstr)
+ m_value = cstr;
+ }
+
+ String (const std::string &s) :
+ Object (Type::eTypeString),
+ m_value (s)
+ {
+ }
+
+ String (const std::string &&s) :
+ Object (Type::eTypeString),
+ m_value (s)
+ {
}
void
- SetValue (std::string string)
+ SetValue (const std::string &string)
{
m_value = string;
}
- std::string
+ const std::string &
GetValue ()
{
return m_value;
}
- virtual void
- Dump (Stream &s) const;
+ void Dump(Stream &s) const override;
protected:
std::string m_value;
@@ -345,6 +514,7 @@ public:
class Dictionary : public Object
{
public:
+
Dictionary () :
Object (Type::eTypeDictionary),
m_dict ()
@@ -354,14 +524,25 @@ public:
virtual ~Dictionary()
{
}
+
size_t
- GetSize()
+ GetSize() const
{
return m_dict.size();
}
+ void
+ ForEach (std::function <bool(ConstString key, Object* object)> const &callback) const
+ {
+ for (const auto &pair : m_dict)
+ {
+ if (callback (pair.first, pair.second.get()) == false)
+ break;
+ }
+ }
+
ObjectSP
- GetKeys()
+ GetKeys() const
{
ObjectSP object_sp(new Array ());
Array *array = object_sp->GetAsArray();
@@ -376,10 +557,10 @@ public:
}
ObjectSP
- GetValueForKey (const char *key)
+ GetValueForKey(llvm::StringRef key) const
{
ObjectSP value_sp;
- if (key)
+ if (!key.empty())
{
ConstString key_cs(key);
for (collection::const_iterator iter = m_dict.begin(); iter != m_dict.end(); ++iter)
@@ -394,62 +575,144 @@ public:
return value_sp;
}
+ template <class IntType>
bool
- HasKey (const char *key)
+ GetValueForKeyAsInteger(llvm::StringRef key, IntType &result) const
{
- ConstString key_cs (key);
- collection::const_iterator search = m_dict.find(key_cs);
- if (search != m_dict.end())
+ ObjectSP value = GetValueForKey(key);
+ if (!value)
+ return false;
+ if (auto int_value = value->GetAsInteger())
{
+ result = static_cast<IntType>(int_value->GetValue());
return true;
}
- else
+ return false;
+ }
+
+ template <class IntType>
+ bool
+ GetValueForKeyAsInteger(llvm::StringRef key, IntType &result, IntType default_val) const
+ {
+ bool success = GetValueForKeyAsInteger<IntType>(key, result);
+ if (!success)
+ result = default_val;
+ return success;
+ }
+
+ bool
+ GetValueForKeyAsString(llvm::StringRef key, std::string &result) const
+ {
+ ObjectSP value = GetValueForKey(key);
+ if (!value)
+ return false;
+ if (auto string_value = value->GetAsString())
{
+ result = string_value->GetValue();
+ return true;
+ }
+ return false;
+ }
+
+ bool
+ GetValueForKeyAsString(llvm::StringRef key, std::string &result, const char *default_val) const
+ {
+ bool success = GetValueForKeyAsString(key, result);
+ if (!success)
+ {
+ if (default_val)
+ result = default_val;
+ else
+ result.clear();
+ }
+ return success;
+ }
+
+ bool
+ GetValueForKeyAsString(llvm::StringRef key, ConstString &result) const
+ {
+ ObjectSP value = GetValueForKey(key);
+ if (!value)
return false;
+ if (auto string_value = value->GetAsString())
+ {
+ result = ConstString(string_value->GetValue());
+ return true;
}
+ return false;
+ }
+
+ bool
+ GetValueForKeyAsString(llvm::StringRef key, ConstString &result, const char *default_val) const
+ {
+ bool success = GetValueForKeyAsString(key, result);
+ if (!success)
+ result.SetCString(default_val);
+ return success;
+ }
+
+ bool
+ GetValueForKeyAsDictionary(llvm::StringRef key, Dictionary *&result) const
+ {
+ result = nullptr;
+ ObjectSP value = GetValueForKey(key);
+ if (!value)
+ return false;
+ result = value->GetAsDictionary();
+ return true;
+ }
+
+ bool
+ GetValueForKeyAsArray(llvm::StringRef key, Array *&result) const
+ {
+ result = nullptr;
+ ObjectSP value = GetValueForKey(key);
+ if (!value)
+ return false;
+ result = value->GetAsArray();
+ return true;
+ }
+
+ bool
+ HasKey(llvm::StringRef key) const
+ {
+ ConstString key_cs(key);
+ collection::const_iterator search = m_dict.find(key_cs);
+ return search != m_dict.end();
}
void
- AddItem (const char *key, ObjectSP value)
+ AddItem (llvm::StringRef key, ObjectSP value)
{
ConstString key_cs(key);
m_dict[key_cs] = value;
}
void
- AddIntegerItem (const char *key, uint64_t value)
+ AddIntegerItem (llvm::StringRef key, uint64_t value)
{
- ObjectSP val_obj (new Integer());
- val_obj->GetAsInteger()->SetValue (value);
- AddItem (key, val_obj);
+ AddItem (key, ObjectSP (new Integer(value)));
}
void
- AddFloatItem (const char *key, double value)
+ AddFloatItem (llvm::StringRef key, double value)
{
- ObjectSP val_obj (new Float());
- val_obj->GetAsFloat()->SetValue (value);
- AddItem (key, val_obj);
+ AddItem (key, ObjectSP (new Float(value)));
}
void
- AddStringItem (const char *key, std::string value)
+ AddStringItem (llvm::StringRef key, std::string value)
{
- ObjectSP val_obj (new String());
- val_obj->GetAsString()->SetValue (value);
- AddItem (key, val_obj);
+ AddItem (key, ObjectSP (new String(std::move(value))));
}
void
- AddBooleanItem (const char *key, bool value)
+ AddBooleanItem (llvm::StringRef key, bool value)
{
- ObjectSP val_obj (new Boolean());
- val_obj->GetAsBoolean()->SetValue (value);
- AddItem (key, val_obj);
+ AddItem (key, ObjectSP (new Boolean(value)));
}
- virtual void
- Dump (Stream &s) const;
+ void Dump(Stream &s) const override;
protected:
typedef std::map<ConstString, ObjectSP> collection;
@@ -468,12 +731,49 @@ public:
{
}
- virtual void
- Dump (Stream &s) const;
+ bool
+ IsValid() const override
+ {
+ return false;
+ }
+
+ void Dump(Stream &s) const override;
protected:
};
+ class Generic : public Object
+ {
+ public:
+ explicit Generic(void *object = nullptr) :
+ Object (Type::eTypeGeneric),
+ m_object (object)
+ {
+ }
+
+ void
+ SetValue(void *value)
+ {
+ m_object = value;
+ }
+
+ void *
+ GetValue() const
+ {
+ return m_object;
+ }
+
+ bool
+ IsValid() const override
+ {
+ return m_object != nullptr;
+ }
+
+ void Dump(Stream &s) const override;
+
+ private:
+ void *m_object;
+ };
static ObjectSP
ParseJSON (std::string json_text);
diff --git a/include/lldb/Core/ThreadSafeDenseSet.h b/include/lldb/Core/ThreadSafeDenseSet.h
new file mode 100644
index 000000000000..19c67b65e8c1
--- /dev/null
+++ b/include/lldb/Core/ThreadSafeDenseSet.h
@@ -0,0 +1,65 @@
+//===-- ThreadSafeDenseSet.h ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadSafeDenseSet_h_
+#define liblldb_ThreadSafeDenseSet_h_
+
+// C Includes
+// C++ Includes
+
+// Other libraries and framework includes
+#include "llvm/ADT/DenseSet.h"
+
+// Project includes
+#include "lldb/Host/Mutex.h"
+
+namespace lldb_private {
+
+ template <typename _ElementType>
+ class ThreadSafeDenseSet
+ {
+ public:
+ typedef llvm::DenseSet<_ElementType> LLVMSetType;
+
+ ThreadSafeDenseSet(unsigned set_initial_capacity = 0,
+ Mutex::Type mutex_type = Mutex::eMutexTypeNormal) :
+ m_set(set_initial_capacity),
+ m_mutex(mutex_type)
+ {
+ }
+
+ void
+ Insert (_ElementType e)
+ {
+ Mutex::Locker locker(m_mutex);
+ m_set.insert(e);
+ }
+
+ void
+ Erase (_ElementType e)
+ {
+ Mutex::Locker locker(m_mutex);
+ m_set.erase(e);
+ }
+
+ bool
+ Lookup (_ElementType e)
+ {
+ Mutex::Locker locker(m_mutex);
+ return (m_set.count(e) > 0);
+ }
+
+ protected:
+ LLVMSetType m_set;
+ Mutex m_mutex;
+ };
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadSafeDenseSet_h_
diff --git a/include/lldb/Core/ValueObject.h b/include/lldb/Core/ValueObject.h
index b50adfb69564..cdc507093b28 100644
--- a/include/lldb/Core/ValueObject.h
+++ b/include/lldb/Core/ValueObject.h
@@ -16,6 +16,7 @@
#include <vector>
// Other libraries and framework includes
+#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
// Project includes
@@ -26,6 +27,7 @@
#include "lldb/Core/ConstString.h"
#include "lldb/Core/UserID.h"
#include "lldb/Core/Value.h"
+#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/Target/Process.h"
@@ -139,19 +141,27 @@ public:
struct GetValueForExpressionPathOptions
{
+ enum class SyntheticChildrenTraversal
+ {
+ None,
+ ToSynthetic,
+ FromSynthetic,
+ Both
+ };
+
bool m_check_dot_vs_arrow_syntax;
bool m_no_fragile_ivar;
bool m_allow_bitfields_syntax;
- bool m_no_synthetic_children;
+ SyntheticChildrenTraversal m_synthetic_children_traversal;
GetValueForExpressionPathOptions(bool dot = false,
bool no_ivar = false,
bool bitfield = true,
- bool no_synth = false) :
+ SyntheticChildrenTraversal synth_traverse = SyntheticChildrenTraversal::ToSynthetic) :
m_check_dot_vs_arrow_syntax(dot),
m_no_fragile_ivar(no_ivar),
m_allow_bitfields_syntax(bitfield),
- m_no_synthetic_children(no_synth)
+ m_synthetic_children_traversal(synth_traverse)
{
}
@@ -198,16 +208,9 @@ public:
}
GetValueForExpressionPathOptions&
- DoAllowSyntheticChildren()
- {
- m_no_synthetic_children = false;
- return *this;
- }
-
- GetValueForExpressionPathOptions&
- DontAllowSyntheticChildren()
+ SetSyntheticChildrenTraversal(SyntheticChildrenTraversal traverse)
{
- m_no_synthetic_children = true;
+ m_synthetic_children_traversal = traverse;
return *this;
}
@@ -282,18 +285,19 @@ public:
SetUpdated ();
bool
- NeedsUpdating()
+ NeedsUpdating(bool accept_invalid_exe_ctx)
{
- SyncWithProcessState();
+ SyncWithProcessState(accept_invalid_exe_ctx);
return m_needs_update;
}
bool
IsValid ()
{
+ const bool accept_invalid_exe_ctx = false;
if (!m_mod_id.IsValid())
return false;
- else if (SyncWithProcessState ())
+ else if (SyncWithProcessState (accept_invalid_exe_ctx))
{
if (!m_mod_id.IsValid())
return false;
@@ -315,7 +319,7 @@ public:
private:
bool
- SyncWithProcessState ();
+ SyncWithProcessState (bool accept_invalid_exe_ctx);
ProcessModID m_mod_id; // This is the stop id when this ValueObject was last evaluated.
ExecutionContextRef m_exe_ctx_ref;
@@ -647,6 +651,7 @@ public:
bool
GetValueIsValid () const;
+ // If you call this on a newly created ValueObject, it will always return false.
bool
GetValueDidChange ();
@@ -679,12 +684,6 @@ public:
GetSyntheticArrayMember (size_t index, bool can_create);
lldb::ValueObjectSP
- GetSyntheticArrayMemberFromPointer (size_t index, bool can_create);
-
- lldb::ValueObjectSP
- GetSyntheticArrayMemberFromArray (size_t index, bool can_create);
-
- lldb::ValueObjectSP
GetSyntheticBitFieldChild (uint32_t from, uint32_t to, bool can_create);
lldb::ValueObjectSP
@@ -853,12 +852,19 @@ public:
virtual bool
SetData (DataExtractor &data, Error &error);
- bool
+ virtual bool
GetIsConstant () const
{
return m_update_point.IsConstant();
}
+ bool
+ NeedsUpdating ()
+ {
+ const bool accept_invalid_exe_ctx = CanUpdateWithInvalidExecutionContext();
+ return m_update_point.NeedsUpdating(accept_invalid_exe_ctx);
+ }
+
void
SetIsConstant ()
{
@@ -868,7 +874,7 @@ public:
lldb::Format
GetFormat () const;
- void
+ virtual void
SetFormat (lldb::Format format)
{
if (format != m_format)
@@ -992,6 +998,9 @@ public:
//------------------------------------------------------------------
virtual bool
MightHaveChildren();
+
+ virtual bool
+ IsRuntimeSupportValue ();
protected:
typedef ClusterManager<ValueObject> ValueObjectManager;
@@ -1128,10 +1137,12 @@ protected:
m_did_calculate_complete_objc_class_type:1,
m_is_synthetic_children_generated:1;
+ friend class ValueObjectChild;
friend class ClangExpressionDeclMap; // For GetValue
friend class ClangExpressionVariable; // For SetName
friend class Target; // For SetName
friend class ValueObjectConstResultImpl;
+ friend class ValueObjectSynthetic; // For ClearUserVisibleData
//------------------------------------------------------------------
// Constructors and Destructors
@@ -1161,6 +1172,12 @@ protected:
virtual bool
UpdateValue () = 0;
+ virtual bool
+ CanUpdateWithInvalidExecutionContext ()
+ {
+ return false;
+ }
+
virtual void
CalculateDynamicValue (lldb::DynamicValueType use_dynamic);
diff --git a/include/lldb/Core/ValueObjectChild.h b/include/lldb/Core/ValueObjectChild.h
index 7bbfe8a662d1..bf8707ea3b05 100644
--- a/include/lldb/Core/ValueObjectChild.h
+++ b/include/lldb/Core/ValueObjectChild.h
@@ -83,6 +83,9 @@ public:
protected:
virtual bool
UpdateValue ();
+
+ virtual bool
+ CanUpdateWithInvalidExecutionContext ();
virtual ClangASTType
GetClangTypeImpl ()
diff --git a/include/lldb/Core/ValueObjectDynamicValue.h b/include/lldb/Core/ValueObjectDynamicValue.h
index 7607bd38137d..8d42706be166 100644
--- a/include/lldb/Core/ValueObjectDynamicValue.h
+++ b/include/lldb/Core/ValueObjectDynamicValue.h
@@ -56,6 +56,12 @@ public:
return true;
}
+ virtual bool
+ GetIsConstant () const
+ {
+ return false;
+ }
+
virtual ValueObject *
GetParent()
{
@@ -103,6 +109,12 @@ protected:
virtual bool
UpdateValue ();
+ virtual bool
+ CanUpdateWithInvalidExecutionContext ()
+ {
+ return true;
+ }
+
virtual lldb::DynamicValueType
GetDynamicValueTypeImpl ()
{
diff --git a/include/lldb/Core/ValueObjectSyntheticFilter.h b/include/lldb/Core/ValueObjectSyntheticFilter.h
index aa784add7409..88824ef4fa54 100644
--- a/include/lldb/Core/ValueObjectSyntheticFilter.h
+++ b/include/lldb/Core/ValueObjectSyntheticFilter.h
@@ -141,12 +141,27 @@ public:
}
virtual bool
+ GetIsConstant () const
+ {
+ return false;
+ }
+
+ virtual bool
SetValueFromCString (const char *value_str, Error& error);
+ virtual void
+ SetFormat (lldb::Format format);
+
protected:
virtual bool
UpdateValue ();
+ virtual bool
+ CanUpdateWithInvalidExecutionContext ()
+ {
+ return true;
+ }
+
virtual ClangASTType
GetClangTypeImpl ();
diff --git a/include/lldb/DataFormatters/CXXFormatterFunctions.h b/include/lldb/DataFormatters/CXXFormatterFunctions.h
index 53b7468bb13c..9b1a02ca0a5c 100644
--- a/include/lldb/DataFormatters/CXXFormatterFunctions.h
+++ b/include/lldb/DataFormatters/CXXFormatterFunctions.h
@@ -186,6 +186,9 @@ namespace lldb_private {
extern template bool
ObjCSELSummaryProvider<false> (ValueObject&, Stream&, const TypeSummaryOptions&);
+ bool
+ CMTimeSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
+
SyntheticChildrenFrontEnd* NSArraySyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
SyntheticChildrenFrontEnd* NSDictionarySyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
@@ -229,37 +232,6 @@ namespace lldb_private {
bool
LibcxxContainerSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
- class LibstdcppVectorBoolSyntheticFrontEnd : public SyntheticChildrenFrontEnd
- {
- public:
- LibstdcppVectorBoolSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-
- virtual size_t
- CalculateNumChildren ();
-
- virtual lldb::ValueObjectSP
- GetChildAtIndex (size_t idx);
-
- virtual bool
- Update();
-
- virtual bool
- MightHaveChildren ();
-
- virtual size_t
- GetIndexOfChildWithName (const ConstString &name);
-
- virtual
- ~LibstdcppVectorBoolSyntheticFrontEnd ();
- private:
- ExecutionContextRef m_exe_ctx_ref;
- uint64_t m_count;
- lldb::addr_t m_base_data_address;
- EvaluateExpressionOptions m_options;
- };
-
- SyntheticChildrenFrontEnd* LibstdcppVectorBoolSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-
class LibstdcppMapIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd
{
public:
@@ -395,6 +367,7 @@ namespace lldb_private {
SyntheticChildrenFrontEnd* LibcxxInitializerListSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
+ SyntheticChildrenFrontEnd* VectorTypeSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
} // namespace formatters
} // namespace lldb_private
diff --git a/include/lldb/DataFormatters/FormatManager.h b/include/lldb/DataFormatters/FormatManager.h
index 37dae6536761..a1f4b59fb344 100644
--- a/include/lldb/DataFormatters/FormatManager.h
+++ b/include/lldb/DataFormatters/FormatManager.h
@@ -287,6 +287,7 @@ private:
ConstString m_coreservices_category_name;
ConstString m_vectortypes_category_name;
ConstString m_appkit_category_name;
+ ConstString m_coremedia_category_name;
HardcodedFormatterFinders<TypeFormatImpl> m_hardcoded_formats;
HardcodedFormatterFinders<TypeSummaryImpl> m_hardcoded_summaries;
@@ -326,6 +327,9 @@ private:
void
LoadObjCFormatters ();
+
+ void
+ LoadCoreMediaFormatters ();
void
LoadHardcodedFormatters ();
diff --git a/include/lldb/DataFormatters/TypeFormat.h b/include/lldb/DataFormatters/TypeFormat.h
index 1090d7843e53..8aa7c60b4938 100644
--- a/include/lldb/DataFormatters/TypeFormat.h
+++ b/include/lldb/DataFormatters/TypeFormat.h
@@ -115,6 +115,22 @@ namespace lldb_private {
return *this;
}
+ bool
+ GetNonCacheable () const
+ {
+ return (m_flags & lldb::eTypeOptionNonCacheable) == lldb::eTypeOptionNonCacheable;
+ }
+
+ Flags&
+ SetNonCacheable (bool value = true)
+ {
+ if (value)
+ m_flags |= lldb::eTypeOptionNonCacheable;
+ else
+ m_flags &= ~lldb::eTypeOptionNonCacheable;
+ return *this;
+ }
+
uint32_t
GetValue ()
{
@@ -153,6 +169,11 @@ namespace lldb_private {
{
return m_flags.GetSkipReferences();
}
+ bool
+ NonCacheable () const
+ {
+ return m_flags.GetNonCacheable();
+ }
void
SetCascades (bool value)
@@ -171,6 +192,12 @@ namespace lldb_private {
{
m_flags.SetSkipReferences(value);
}
+
+ void
+ SetNonCacheable (bool value)
+ {
+ m_flags.SetNonCacheable(value);
+ }
uint32_t
GetOptions ()
diff --git a/include/lldb/DataFormatters/TypeSummary.h b/include/lldb/DataFormatters/TypeSummary.h
index 8b90dd0c4895..c2838eac27f1 100644
--- a/include/lldb/DataFormatters/TypeSummary.h
+++ b/include/lldb/DataFormatters/TypeSummary.h
@@ -25,8 +25,8 @@
#include "lldb/Core/Error.h"
#include "lldb/Core/FormatEntity.h"
+#include "lldb/Core/StructuredData.h"
#include "lldb/Core/ValueObject.h"
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
#include "lldb/Symbol/Type.h"
namespace lldb_private {
@@ -211,6 +211,22 @@ namespace lldb_private {
return *this;
}
+ bool
+ GetNonCacheable () const
+ {
+ return (m_flags & lldb::eTypeOptionNonCacheable) == lldb::eTypeOptionNonCacheable;
+ }
+
+ Flags&
+ SetNonCacheable (bool value = true)
+ {
+ if (value)
+ m_flags |= lldb::eTypeOptionNonCacheable;
+ else
+ m_flags &= ~lldb::eTypeOptionNonCacheable;
+ return *this;
+ }
+
uint32_t
GetValue ()
{
@@ -252,6 +268,11 @@ namespace lldb_private {
{
return m_flags.GetSkipReferences();
}
+ bool
+ NonCacheable () const
+ {
+ return m_flags.GetNonCacheable();
+ }
virtual bool
DoesPrintChildren (ValueObject* valobj) const
@@ -319,6 +340,12 @@ namespace lldb_private {
m_flags.SetHideItemNames(value);
}
+ virtual void
+ SetNonCacheable (bool value)
+ {
+ m_flags.SetNonCacheable(value);
+ }
+
uint32_t
GetOptions ()
{
@@ -501,8 +528,8 @@ namespace lldb_private {
{
std::string m_function_name;
std::string m_python_script;
- lldb::ScriptInterpreterObjectSP m_script_function_sp;
-
+ StructuredData::ObjectSP m_script_function_sp;
+
ScriptSummaryFormat(const TypeSummaryImpl::Flags& flags,
const char *function_name,
const char* python_script = NULL);
diff --git a/include/lldb/DataFormatters/TypeSynthetic.h b/include/lldb/DataFormatters/TypeSynthetic.h
index 675c43b1f311..ff6691c9a1b8 100644
--- a/include/lldb/DataFormatters/TypeSynthetic.h
+++ b/include/lldb/DataFormatters/TypeSynthetic.h
@@ -23,6 +23,7 @@
#include "lldb/lldb-public.h"
#include "lldb/lldb-enumerations.h"
+#include "lldb/Core/StructuredData.h"
#include "lldb/Core/ValueObject.h"
namespace lldb_private {
@@ -235,6 +236,22 @@ namespace lldb_private {
return *this;
}
+ bool
+ GetNonCacheable () const
+ {
+ return (m_flags & lldb::eTypeOptionNonCacheable) == lldb::eTypeOptionNonCacheable;
+ }
+
+ Flags&
+ SetNonCacheable (bool value = true)
+ {
+ if (value)
+ m_flags |= lldb::eTypeOptionNonCacheable;
+ else
+ m_flags &= ~lldb::eTypeOptionNonCacheable;
+ return *this;
+ }
+
uint32_t
GetValue ()
{
@@ -276,6 +293,11 @@ namespace lldb_private {
{
return m_flags.GetSkipReferences();
}
+ bool
+ NonCacheable () const
+ {
+ return m_flags.GetNonCacheable();
+ }
void
SetCascades (bool value)
@@ -295,6 +317,12 @@ namespace lldb_private {
m_flags.SetSkipReferences(value);
}
+ void
+ SetNonCacheable (bool value)
+ {
+ m_flags.SetNonCacheable(value);
+ }
+
uint32_t
GetOptions ()
{
@@ -551,7 +579,7 @@ namespace lldb_private {
{
private:
std::string m_python_class;
- lldb::ScriptInterpreterObjectSP m_wrapper_sp;
+ StructuredData::ObjectSP m_wrapper_sp;
ScriptInterpreter *m_interpreter;
public:
diff --git a/include/lldb/DataFormatters/TypeValidator.h b/include/lldb/DataFormatters/TypeValidator.h
index b501e47943fa..d06fac01f824 100644
--- a/include/lldb/DataFormatters/TypeValidator.h
+++ b/include/lldb/DataFormatters/TypeValidator.h
@@ -115,6 +115,22 @@ public:
return *this;
}
+ bool
+ GetNonCacheable () const
+ {
+ return (m_flags & lldb::eTypeOptionNonCacheable) == lldb::eTypeOptionNonCacheable;
+ }
+
+ Flags&
+ SetNonCacheable (bool value = true)
+ {
+ if (value)
+ m_flags |= lldb::eTypeOptionNonCacheable;
+ else
+ m_flags &= ~lldb::eTypeOptionNonCacheable;
+ return *this;
+ }
+
uint32_t
GetValue ()
{
@@ -153,6 +169,11 @@ public:
{
return m_flags.GetSkipReferences();
}
+ bool
+ NonCacheable () const
+ {
+ return m_flags.GetNonCacheable();
+ }
void
SetCascades (bool value)
@@ -172,6 +193,12 @@ public:
m_flags.SetSkipReferences(value);
}
+ void
+ SetNonCacheable (bool value)
+ {
+ m_flags.SetNonCacheable(value);
+ }
+
uint32_t
GetOptions ()
{
diff --git a/include/lldb/DataFormatters/ValueObjectPrinter.h b/include/lldb/DataFormatters/ValueObjectPrinter.h
index 235d5389ee75..dc05fd482676 100644
--- a/include/lldb/DataFormatters/ValueObjectPrinter.h
+++ b/include/lldb/DataFormatters/ValueObjectPrinter.h
@@ -75,6 +75,8 @@ struct DumpValueObjectOptions
DumpValueObjectOptions (const DumpValueObjectOptions& rhs) = default;
+ DumpValueObjectOptions (ValueObject& valobj);
+
DumpValueObjectOptions&
SetMaximumPointerDepth(uint32_t depth = 0)
{
@@ -246,6 +248,9 @@ struct DumpValueObjectOptions
class ValueObjectPrinter
{
public:
+
+ ValueObjectPrinter (ValueObject* valobj,
+ Stream* s);
ValueObjectPrinter (ValueObject* valobj,
Stream* s,
diff --git a/include/lldb/DataFormatters/VectorType.h b/include/lldb/DataFormatters/VectorType.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/include/lldb/DataFormatters/VectorType.h
diff --git a/include/lldb/Expression/ClangASTSource.h b/include/lldb/Expression/ClangASTSource.h
index 3e41a9e69e9b..46140d2f2e64 100644
--- a/include/lldb/Expression/ClangASTSource.h
+++ b/include/lldb/Expression/ClangASTSource.h
@@ -15,6 +15,7 @@
#include "clang/Basic/IdentifierTable.h"
#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
#include "lldb/Symbol/ClangASTImporter.h"
+#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Target/Target.h"
#include "llvm/ADT/SmallSet.h"
@@ -45,39 +46,40 @@ public:
/// @param[in] declMap
/// A reference to the LLDB object that handles entity lookup.
//------------------------------------------------------------------
- ClangASTSource (const lldb::TargetSP &target) :
+ ClangASTSource (const lldb::TargetSP &target) :
m_import_in_progress (false),
m_lookups_enabled (false),
m_target (target),
m_ast_context (NULL),
+ m_active_lexical_decls (),
m_active_lookups ()
{
m_ast_importer = m_target->GetClangASTImporter();
}
-
+
//------------------------------------------------------------------
/// Destructor
//------------------------------------------------------------------
- ~ClangASTSource();
-
+ ~ClangASTSource();
+
//------------------------------------------------------------------
/// Interface stubs.
//------------------------------------------------------------------
- clang::Decl *GetExternalDecl (uint32_t) { return NULL; }
- clang::Stmt *GetExternalDeclStmt (uint64_t) { return NULL; }
- clang::Selector GetExternalSelector (uint32_t) { return clang::Selector(); }
- uint32_t GetNumExternalSelectors () { return 0; }
- clang::CXXBaseSpecifier *GetExternalCXXBaseSpecifiers (uint64_t Offset)
+ clang::Decl *GetExternalDecl (uint32_t) override { return NULL; }
+ clang::Stmt *GetExternalDeclStmt (uint64_t) override { return NULL; }
+ clang::Selector GetExternalSelector (uint32_t) override { return clang::Selector(); }
+ uint32_t GetNumExternalSelectors () override { return 0; }
+ clang::CXXBaseSpecifier *GetExternalCXXBaseSpecifiers (uint64_t Offset) override
{ return NULL; }
void MaterializeVisibleDecls (const clang::DeclContext *DC)
{ return; }
-
+
void InstallASTContext (clang::ASTContext *ast_context)
{
m_ast_context = ast_context;
m_ast_importer->InstallMapCompleter(ast_context, *this);
}
-
+
//
// APIs for ExternalASTSource
//
@@ -100,10 +102,8 @@ public:
/// @return
/// Whatever SetExternalVisibleDeclsForName returns.
//------------------------------------------------------------------
- bool
- FindExternalVisibleDeclsByName (const clang::DeclContext *DC,
- clang::DeclarationName Name);
-
+ bool FindExternalVisibleDeclsByName(const clang::DeclContext *DC, clang::DeclarationName Name) override;
+
//------------------------------------------------------------------
/// Enumerate all Decls in a given lexical context.
///
@@ -117,11 +117,10 @@ public:
/// @param[in] Decls
/// A vector that is filled in with matching Decls.
//------------------------------------------------------------------
- clang::ExternalLoadResult
- FindExternalLexicalDecls (const clang::DeclContext *DC,
- bool (*isKindWeWant)(clang::Decl::Kind),
- llvm::SmallVectorImpl<clang::Decl*> &Decls);
-
+ clang::ExternalLoadResult FindExternalLexicalDecls(const clang::DeclContext *DC,
+ bool (*isKindWeWant)(clang::Decl::Kind),
+ llvm::SmallVectorImpl<clang::Decl *> &Decls) override;
+
//------------------------------------------------------------------
/// Specify the layout of the contents of a RecordDecl.
///
@@ -154,33 +153,28 @@ public:
///
/// @return
/// True <=> the layout is valid.
- //-----------------------------------------------------------------
- bool
- layoutRecordType(const clang::RecordDecl *Record,
- uint64_t &Size,
- uint64_t &Alignment,
- llvm::DenseMap <const clang::FieldDecl *, uint64_t> &FieldOffsets,
- llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
- llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets);
-
+ //-----------------------------------------------------------------
+ bool layoutRecordType(const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
+ llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets) override;
+
//------------------------------------------------------------------
/// Complete a TagDecl.
///
/// @param[in] Tag
/// The Decl to be completed in place.
//------------------------------------------------------------------
- virtual void
- CompleteType (clang::TagDecl *Tag);
-
+ void CompleteType(clang::TagDecl *Tag) override;
+
//------------------------------------------------------------------
/// Complete an ObjCInterfaceDecl.
///
/// @param[in] Class
/// The Decl to be completed in place.
//------------------------------------------------------------------
- virtual void
- CompleteType (clang::ObjCInterfaceDecl *Class);
-
+ void CompleteType(clang::ObjCInterfaceDecl *Class) override;
+
//------------------------------------------------------------------
/// Called on entering a translation unit. Tells Clang by calling
/// setHasExternalVisibleStorage() and setHasExternalLexicalStorage()
@@ -189,8 +183,8 @@ public:
/// @param[in] ASTConsumer
/// Unused.
//------------------------------------------------------------------
- void StartTranslationUnit (clang::ASTConsumer *Consumer);
-
+ void StartTranslationUnit(clang::ASTConsumer *Consumer) override;
+
//
// APIs for NamespaceMapCompleter
//
@@ -209,10 +203,9 @@ public:
/// The map for the namespace's parent namespace, if there is
/// one.
//------------------------------------------------------------------
- void CompleteNamespaceMap (ClangASTImporter::NamespaceMapSP &namespace_map,
- const ConstString &name,
- ClangASTImporter::NamespaceMapSP &parent_map) const;
-
+ void CompleteNamespaceMap(ClangASTImporter::NamespaceMapSP &namespace_map, const ConstString &name,
+ ClangASTImporter::NamespaceMapSP &parent_map) const override;
+
//
// Helper APIs
//
@@ -249,41 +242,37 @@ public:
m_original(original)
{
}
-
+
bool
- FindExternalVisibleDeclsByName (const clang::DeclContext *DC,
- clang::DeclarationName Name)
+ FindExternalVisibleDeclsByName(const clang::DeclContext *DC, clang::DeclarationName Name) override
{
return m_original.FindExternalVisibleDeclsByName(DC, Name);
}
-
- clang::ExternalLoadResult
- FindExternalLexicalDecls (const clang::DeclContext *DC,
- bool (*isKindWeWant)(clang::Decl::Kind),
- llvm::SmallVectorImpl<clang::Decl*> &Decls)
+
+ clang::ExternalLoadResult
+ FindExternalLexicalDecls(const clang::DeclContext *DC, bool (*isKindWeWant)(clang::Decl::Kind),
+ llvm::SmallVectorImpl<clang::Decl *> &Decls) override
{
return m_original.FindExternalLexicalDecls(DC, isKindWeWant, Decls);
}
-
+
void
- CompleteType (clang::TagDecl *Tag)
+ CompleteType(clang::TagDecl *Tag) override
{
return m_original.CompleteType(Tag);
}
-
- void
- CompleteType (clang::ObjCInterfaceDecl *Class)
+
+ void
+ CompleteType(clang::ObjCInterfaceDecl *Class) override
{
return m_original.CompleteType(Class);
}
-
- bool
- layoutRecordType(const clang::RecordDecl *Record,
- uint64_t &Size,
- uint64_t &Alignment,
- llvm::DenseMap <const clang::FieldDecl *, uint64_t> &FieldOffsets,
- llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
- llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets)
+
+ bool
+ layoutRecordType(const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
+ llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets) override
{
return m_original.layoutRecordType(Record,
Size,
@@ -293,7 +282,8 @@ public:
VirtualBaseOffsets);
}
- void StartTranslationUnit (clang::ASTConsumer *Consumer)
+ void
+ StartTranslationUnit(clang::ASTConsumer *Consumer) override
{
return m_original.StartTranslationUnit(Consumer);
}
@@ -413,8 +403,9 @@ protected:
bool m_lookups_enabled;
const lldb::TargetSP m_target; ///< The target to use in finding variables and types.
- clang::ASTContext *m_ast_context; ///< The AST context requests are coming in for.
+ clang::ASTContext *m_ast_context; ///< The AST context requests are coming in for.
ClangASTImporter *m_ast_importer; ///< The target's AST importer.
+ std::set<const clang::Decl *> m_active_lexical_decls;
std::set<const char *> m_active_lookups;
};
@@ -485,8 +476,12 @@ struct NameSearchContext {
///
/// @param[in] type
/// The opaque QualType for the FunDecl being registered.
+ ///
+ /// @param[in] extern_c
+ /// If true, build an extern "C" linkage specification for this.
//------------------------------------------------------------------
- clang::NamedDecl *AddFunDecl(const ClangASTType &type);
+ clang::NamedDecl *AddFunDecl(const ClangASTType &type,
+ bool extern_c = false);
//------------------------------------------------------------------
/// Create a FunDecl with the name being searched for and generic
@@ -513,7 +508,7 @@ struct NameSearchContext {
/// The DeclContextLookupResult, usually returned as the result
/// of querying a DeclContext.
//------------------------------------------------------------------
- void AddLookupResult (clang::DeclContextLookupConstResult result);
+ void AddLookupResult (clang::DeclContextLookupResult result);
//------------------------------------------------------------------
/// Add a NamedDecl to the list of results.
diff --git a/include/lldb/Expression/ClangExpressionDeclMap.h b/include/lldb/Expression/ClangExpressionDeclMap.h
index 8a4aa82b8727..f24500ab5237 100644
--- a/include/lldb/Expression/ClangExpressionDeclMap.h
+++ b/include/lldb/Expression/ClangExpressionDeclMap.h
@@ -100,6 +100,9 @@ public:
WillParse (ExecutionContext &exe_ctx,
Materializer *materializer);
+ void
+ InstallCodeGenerator (clang::ASTConsumer *code_gen);
+
//------------------------------------------------------------------
/// [Used by ClangExpressionParser] For each variable that had an unknown
/// type at the beginning of parsing, determine its final type now.
@@ -396,11 +399,6 @@ private:
{
public:
ParserVars(ClangExpressionDeclMap &decl_map) :
- m_exe_ctx(),
- m_sym_ctx(),
- m_persistent_vars(NULL),
- m_enable_lookups(false),
- m_materializer(NULL),
m_decl_map(decl_map)
{
}
@@ -415,12 +413,13 @@ private:
return NULL;
}
- ExecutionContext m_exe_ctx; ///< The execution context to use when parsing.
- SymbolContext m_sym_ctx; ///< The symbol context to use in finding variables and types.
- ClangPersistentVariables *m_persistent_vars; ///< The persistent variables for the process.
- bool m_enable_lookups; ///< Set to true during parsing if we have found the first "$__lldb" name.
- TargetInfo m_target_info; ///< Basic information about the target.
- Materializer *m_materializer; ///< If non-NULL, the materializer to use when reporting used variables.
+ ExecutionContext m_exe_ctx; ///< The execution context to use when parsing.
+ SymbolContext m_sym_ctx; ///< The symbol context to use in finding variables and types.
+ ClangPersistentVariables *m_persistent_vars = nullptr; ///< The persistent variables for the process.
+ bool m_enable_lookups = false; ///< Set to true during parsing if we have found the first "$__lldb" name.
+ TargetInfo m_target_info; ///< Basic information about the target.
+ Materializer *m_materializer = nullptr; ///< If non-NULL, the materializer to use when reporting used variables.
+ clang::ASTConsumer *m_code_gen = nullptr; ///< If non-NULL, a code generator that receives new top-level functions.
private:
ClangExpressionDeclMap &m_decl_map;
DISALLOW_COPY_AND_ASSIGN (ParserVars);
diff --git a/include/lldb/Expression/ClangExpressionParser.h b/include/lldb/Expression/ClangExpressionParser.h
index 0f578c55942e..21a27a489bcd 100644
--- a/include/lldb/Expression/ClangExpressionParser.h
+++ b/include/lldb/Expression/ClangExpressionParser.h
@@ -145,7 +145,6 @@ private:
std::unique_ptr<clang::CompilerInstance> m_compiler; ///< The Clang compiler used to parse expressions into IR
std::unique_ptr<clang::Builtin::Context> m_builtin_context; ///< Context for Clang built-ins
std::unique_ptr<clang::SelectorTable> m_selector_table; ///< Selector table for Objective-C methods
- std::unique_ptr<clang::ASTContext> m_ast_context; ///< The AST context used to hold types and names for the parser
std::unique_ptr<clang::CodeGenerator> m_code_generator; ///< The Clang object that generates IR
class LLDBPreprocessorCallbacks;
diff --git a/include/lldb/Expression/ClangFunction.h b/include/lldb/Expression/ClangFunction.h
index c122b21be279..cf7e2592021f 100644
--- a/include/lldb/Expression/ClangFunction.h
+++ b/include/lldb/Expression/ClangFunction.h
@@ -22,6 +22,7 @@
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObjectList.h"
#include "lldb/Expression/ClangExpression.h"
+#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Target/Process.h"
namespace lldb_private
@@ -412,7 +413,7 @@ private:
//------------------------------------------------------------------
// Note: the parser needs to be destructed before the execution unit, so
- // declare the the execution unit first.
+ // declare the execution unit first.
std::shared_ptr<IRExecutionUnit> m_execution_unit_sp;
std::unique_ptr<ClangExpressionParser> m_parser; ///< The parser responsible for compiling the function.
lldb::ModuleWP m_jit_module_wp;
diff --git a/include/lldb/Expression/ClangModulesDeclVendor.h b/include/lldb/Expression/ClangModulesDeclVendor.h
index a35b86a665ff..a8297c8fa331 100644
--- a/include/lldb/Expression/ClangModulesDeclVendor.h
+++ b/include/lldb/Expression/ClangModulesDeclVendor.h
@@ -15,6 +15,7 @@
#include "lldb/Symbol/DeclVendor.h"
#include "lldb/Target/Platform.h"
+#include <set>
#include <vector>
namespace lldb_private
@@ -34,6 +35,10 @@ public:
static ClangModulesDeclVendor *
Create(Target &target);
+ typedef std::vector<ConstString> ModulePath;
+ typedef uintptr_t ModuleID;
+ typedef std::vector<ModuleID> ModuleVector;
+
//------------------------------------------------------------------
/// Add a module to the list of modules to search.
///
@@ -41,6 +46,10 @@ public:
/// The path to the exact module to be loaded. E.g., if the desired
/// module is std.io, then this should be { "std", "io" }.
///
+ /// @param[in] exported_modules
+ /// If non-NULL, a pointer to a vector to populate with the ID of every
+ /// module that is re-exported by the specified module.
+ ///
/// @param[in] error_stream
/// A stream to populate with the output of the Clang parser when
/// it tries to load the module.
@@ -51,7 +60,69 @@ public:
/// load, then this will always return false for this ModuleImporter.
//------------------------------------------------------------------
virtual bool
- AddModule(std::vector<llvm::StringRef> &path, Stream &error_stream) = 0;
+ AddModule(ModulePath &path,
+ ModuleVector *exported_modules,
+ Stream &error_stream) = 0;
+
+ //------------------------------------------------------------------
+ /// Add all modules referred to in a given compilation unit to the list
+ /// of modules to search.
+ ///
+ /// @param[in] cu
+ /// The compilation unit to scan for imported modules.
+ ///
+ /// @param[in] exported_modules
+ /// A vector to populate with the ID of each module loaded (directly
+ /// and via re-exports) in this way.
+ ///
+ /// @param[in] error_stream
+ /// A stream to populate with the output of the Clang parser when
+ /// it tries to load the modules.
+ ///
+ /// @return
+ /// True if all modules referred to by the compilation unit could be
+ /// loaded; false if one could not be loaded. If the compiler
+ /// encountered a fatal error during a previous module
+ /// load, then this will always return false for this ModuleImporter.
+ //------------------------------------------------------------------
+ virtual bool
+ AddModulesForCompileUnit(CompileUnit &cu,
+ ModuleVector &exported_modules,
+ Stream &error_stream) = 0;
+
+ //------------------------------------------------------------------
+ /// Enumerate all the macros that are defined by a given set of modules
+ /// that are already imported.
+ ///
+ /// @param[in] modules
+ /// The unique IDs for all modules to query. Later modules have higher
+ /// priority, just as if you @imported them in that order. This matters
+ /// if module A #defines a macro and module B #undefs it.
+ ///
+ /// @param[in] handler
+ /// A function to call with the text of each #define (including the
+ /// #define directive). #undef directives are not included; we simply
+ /// elide any corresponding #define. If this function returns true,
+ /// we stop the iteration immediately.
+ //------------------------------------------------------------------
+ virtual void
+ ForEachMacro(const ModuleVector &modules,
+ std::function<bool (const std::string &)> handler) = 0;
+
+ //------------------------------------------------------------------
+ /// Query whether Clang supports modules for a particular language.
+ /// LLDB uses this to decide whether to try to find the modules loaded
+ /// by a gaiven compile unit.
+ ///
+ /// @param[in] language
+ /// The language to query for.
+ ///
+ /// @return
+ /// True if Clang has modules for the given language.
+ //------------------------------------------------------------------
+ static bool
+ LanguageSupportsClangModules (lldb::LanguageType language);
+
};
}
diff --git a/include/lldb/Expression/ClangPersistentVariables.h b/include/lldb/Expression/ClangPersistentVariables.h
index 6d9dae954734..247f87fae41b 100644
--- a/include/lldb/Expression/ClangPersistentVariables.h
+++ b/include/lldb/Expression/ClangPersistentVariables.h
@@ -11,6 +11,8 @@
#define liblldb_ClangPersistentVariables_h_
#include "lldb/Expression/ClangExpressionVariable.h"
+#include "lldb/Expression/ClangModulesDeclVendor.h"
+
#include "llvm/ADT/DenseMap.h"
namespace lldb_private
@@ -63,11 +65,25 @@ public:
clang::TypeDecl *
GetPersistentType (const ConstString &name);
+ void
+ AddHandLoadedClangModule(ClangModulesDeclVendor::ModuleID module)
+ {
+ m_hand_loaded_clang_modules.push_back(module);
+ }
+
+ const ClangModulesDeclVendor::ModuleVector &GetHandLoadedClangModules()
+ {
+ return m_hand_loaded_clang_modules;
+ }
+
private:
uint32_t m_next_persistent_variable_id; ///< The counter used by GetNextResultName().
typedef llvm::DenseMap<const char *, clang::TypeDecl *> PersistentTypeMap;
PersistentTypeMap m_persistent_types; ///< The persistent types declared by the user.
+
+ ClangModulesDeclVendor::ModuleVector m_hand_loaded_clang_modules; ///< These are Clang modules we hand-loaded; these are the highest-
+ ///< priority source for macros.
};
}
diff --git a/include/lldb/Expression/ClangUserExpression.h b/include/lldb/Expression/ClangUserExpression.h
index f51c9851789a..dbea48148e14 100644
--- a/include/lldb/Expression/ClangUserExpression.h
+++ b/include/lldb/Expression/ClangUserExpression.h
@@ -45,8 +45,7 @@ namespace lldb_private
class ClangUserExpression : public ClangExpression
{
public:
- typedef std::shared_ptr<ClangUserExpression> ClangUserExpressionSP;
-
+
enum { kDefaultTimeout = 500000u };
//------------------------------------------------------------------
/// Constructor
@@ -146,7 +145,7 @@ public:
Execute (Stream &error_stream,
ExecutionContext &exe_ctx,
const EvaluateExpressionOptions& options,
- ClangUserExpressionSP &shared_ptr_to_me,
+ lldb::ClangUserExpressionSP &shared_ptr_to_me,
lldb::ClangExpressionVariableSP &result);
//------------------------------------------------------------------
@@ -307,7 +306,7 @@ public:
static const Error::ValueType kNoResult = 0x1001; ///< ValueObject::GetError() returns this if there is no result from the expression.
private:
//------------------------------------------------------------------
- /// Populate m_cplusplus and m_objectivec based on the environment.
+ /// Populate m_in_cplusplus_method and m_in_objectivec_method based on the environment.
//------------------------------------------------------------------
void
@@ -349,9 +348,9 @@ private:
std::unique_ptr<ASTResultSynthesizer> m_result_synthesizer; ///< The result synthesizer, if one is needed.
lldb::ModuleWP m_jit_module_wp;
bool m_enforce_valid_object; ///< True if the expression parser should enforce the presence of a valid class pointer in order to generate the expression as a method.
- bool m_cplusplus; ///< True if the expression is compiled as a C++ member function (true if it was parsed when exe_ctx was in a C++ method).
- bool m_objectivec; ///< True if the expression is compiled as an Objective-C method (true if it was parsed when exe_ctx was in an Objective-C method).
- bool m_static_method; ///< True if the expression is compiled as a static (or class) method (currently true if it was parsed when exe_ctx was in an Objective-C class method).
+ bool m_in_cplusplus_method; ///< True if the expression is compiled as a C++ member function (true if it was parsed when exe_ctx was in a C++ method).
+ bool m_in_objectivec_method; ///< True if the expression is compiled as an Objective-C method (true if it was parsed when exe_ctx was in an Objective-C method).
+ bool m_in_static_method; ///< True if the expression is compiled as a static (or class) method (currently true if it was parsed when exe_ctx was in an Objective-C class method).
bool m_needs_object_ptr; ///< True if "this" or "self" must be looked up and passed in. False if the expression doesn't really use them and they can be NULL.
bool m_const_object; ///< True if "this" is const.
Target *m_target; ///< The target for storing persistent data like types and variables.
diff --git a/include/lldb/Expression/IRForTarget.h b/include/lldb/Expression/IRForTarget.h
index 0ad34904f563..b81fab7a8a83 100644
--- a/include/lldb/Expression/IRForTarget.h
+++ b/include/lldb/Expression/IRForTarget.h
@@ -640,6 +640,9 @@ private:
return m_stream_string;
}
lldb::addr_t Allocate();
+
+ lldb::TargetSP
+ GetTarget();
private:
lldb_private::IRExecutionUnit &m_execution_unit;
lldb_private::StreamString m_stream_string;
diff --git a/include/lldb/Expression/IRMemoryMap.h b/include/lldb/Expression/IRMemoryMap.h
index 4faa5226d9b4..0da8384c8e63 100644
--- a/include/lldb/Expression/IRMemoryMap.h
+++ b/include/lldb/Expression/IRMemoryMap.h
@@ -69,14 +69,22 @@ public:
// This function can return NULL.
ExecutionContextScope *GetBestExecutionContextScope() const;
+ lldb::TargetSP
+ GetTarget ()
+ {
+ return m_target_wp.lock();
+ }
+
protected:
// This function should only be used if you know you are using the JIT.
// Any other cases should use GetBestExecutionContextScope().
- lldb::ProcessWP GetProcessWP ()
+
+ lldb::ProcessWP &
+ GetProcessWP ()
{
return m_process_wp;
}
-
+
private:
struct Allocation
{
diff --git a/include/lldb/Expression/IRToDWARF.h b/include/lldb/Expression/IRToDWARF.h
index 43dc99d6d476..a4ae9b7ebfae 100644
--- a/include/lldb/Expression/IRToDWARF.h
+++ b/include/lldb/Expression/IRToDWARF.h
@@ -11,7 +11,7 @@
#define liblldb_IRToDWARF_h_
#include "llvm/Pass.h"
-#include "llvm/PassManager.h"
+#include "llvm/IR/LegacyPassManager.h"
#include "lldb/lldb-public.h"
diff --git a/include/lldb/Host/Editline.h b/include/lldb/Host/Editline.h
index 9fce193efc9f..697be4cd8e77 100644
--- a/include/lldb/Host/Editline.h
+++ b/include/lldb/Host/Editline.h
@@ -171,17 +171,13 @@ namespace lldb_private {
uint32_t
GetCurrentLine();
- /// Hides the current input session in preparation for output
- void
- Hide();
-
- /// Prepare to return to editing after a call to Hide()
- void
- Refresh();
-
/// Interrupt the current edit as if ^C was pressed
bool
Interrupt();
+
+ /// Cancel this edit and oblitarate all trace of it
+ bool
+ Cancel();
/// Register a callback for the tab key
void
@@ -207,6 +203,9 @@ namespace lldb_private {
bool
GetLines (int first_line_number, StringList &lines, bool &interrupted);
+ void
+ PrintAsync (Stream *stream, const char *s, size_t len);
+
private:
/// Sets the lowest line number for multi-line editing sessions. A value of zero suppresses
@@ -335,7 +334,6 @@ namespace lldb_private {
bool m_multiline_enabled = false;
std::vector<EditLineStringType> m_input_lines;
EditorStatus m_editor_status;
- bool m_editor_getting_char = false;
bool m_color_prompts = true;
int m_terminal_width = 0;
int m_base_line_number = 0;
@@ -359,6 +357,8 @@ namespace lldb_private {
const char * m_fix_indentation_callback_chars = nullptr;
CompleteCallbackType m_completion_callback = nullptr;
void * m_completion_callback_baton = nullptr;
+
+ Mutex m_output_mutex;
};
}
diff --git a/include/lldb/Host/File.h b/include/lldb/Host/File.h
index 8219cc06fdc2..5747cb5adcfd 100644
--- a/include/lldb/Host/File.h
+++ b/include/lldb/Host/File.h
@@ -470,7 +470,7 @@ public:
GetPermissions(Error &error) const;
static uint32_t
- GetPermissions (const char *path, Error &error);
+ GetPermissions(const FileSpec &file_spec, Error &error);
//------------------------------------------------------------------
diff --git a/include/lldb/Host/FileSpec.h b/include/lldb/Host/FileSpec.h
index 173d948e687b..d0338d41db1b 100644
--- a/include/lldb/Host/FileSpec.h
+++ b/include/lldb/Host/FileSpec.h
@@ -11,6 +11,8 @@
#define liblldb_FileSpec_h_
#if defined(__cplusplus)
+#include <functional>
+
#include "lldb/lldb-private.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/STLUtils.h"
@@ -78,6 +80,12 @@ public:
//------------------------------------------------------------------
explicit FileSpec (const char *path, bool resolve_path, PathSyntax syntax = ePathSyntaxHostNative);
+ explicit FileSpec (const char *path, bool resolve_path, ArchSpec arch);
+
+ explicit FileSpec(const std::string &path, bool resolve_path, PathSyntax syntax = ePathSyntaxHostNative);
+
+ explicit FileSpec(const std::string &path, bool resolve_path, ArchSpec arch);
+
//------------------------------------------------------------------
/// Copy constructor
///
@@ -259,7 +267,7 @@ public:
/// The stream to which to dump the object description.
//------------------------------------------------------------------
void
- Dump (Stream *s) const;
+ Dump(Stream *s) const;
//------------------------------------------------------------------
/// Existence test.
@@ -359,16 +367,25 @@ public:
IsSourceImplementationFile () const;
//------------------------------------------------------------------
- /// Returns true if the filespec represents path that is relative
- /// path to the current working directory.
+ /// Returns true if the filespec represents a relative path.
///
/// @return
- /// \b true if the filespec represents a current working
- /// directory relative path, \b false otherwise.
+ /// \b true if the filespec represents a relative path,
+ /// \b false otherwise.
//------------------------------------------------------------------
bool
- IsRelativeToCurrentWorkingDirectory () const;
-
+ IsRelative() const;
+
+ //------------------------------------------------------------------
+ /// Returns true if the filespec represents an absolute path.
+ ///
+ /// @return
+ /// \b true if the filespec represents an absolute path,
+ /// \b false otherwise.
+ //------------------------------------------------------------------
+ bool
+ IsAbsolute() const;
+
TimeValue
GetModificationTime () const;
@@ -408,6 +425,20 @@ public:
std::string
GetPath (bool denormalize = true) const;
+ const char *
+ GetCString(bool denormalize = true) const;
+
+ //------------------------------------------------------------------
+ /// Extract the full path to the file.
+ ///
+ /// Extract the directory and path into an llvm::SmallVectorImpl<>
+ ///
+ /// @return
+ /// Returns a std::string with the directory and filename
+ /// concatenated.
+ //------------------------------------------------------------------
+ void GetPath(llvm::SmallVectorImpl<char> &path, bool denormalize = true) const;
+
//------------------------------------------------------------------
/// Extract the extension of the file.
///
@@ -530,6 +561,45 @@ public:
lldb::DataBufferSP
MemoryMapFileContents (off_t offset = 0, size_t length = SIZE_MAX) const;
+
+ //------------------------------------------------------------------
+ /// Memory map part of, or the entire contents of, a file only if
+ /// the file is local (not on a network mount).
+ ///
+ /// Returns a shared pointer to a data buffer that contains all or
+ /// part of the contents of a file. The data will be memory mapped
+ /// if the file is local and will lazily page in data from the file
+ /// as memory is accessed. If the data is memory mapped, the data
+ /// that is mapped will start \a offset bytes into the file, and
+ /// \a length bytes will be mapped. If \a length is
+ /// greater than the number of bytes available in the file starting
+ /// at \a offset, the number of bytes will be appropriately
+ /// truncated. The final number of bytes that get mapped can be
+ /// verified using the DataBuffer::GetByteSize() function on the return
+ /// shared data pointer object contents.
+ ///
+ /// If the file is on a network mount the data will be read into a
+ /// heap buffer immediately so that accesses to the data won't later
+ /// cause a crash if we touch a page that isn't paged in and the
+ /// network mount has been disconnected or gone away.
+ ///
+ /// @param[in] offset
+ /// The offset in bytes from the beginning of the file where
+ /// memory mapping should begin.
+ ///
+ /// @param[in] length
+ /// The size in bytes that should be mapped starting \a offset
+ /// bytes into the file. If \a length is \c SIZE_MAX, map
+ /// as many bytes as possible.
+ ///
+ /// @return
+ /// A shared pointer to the memory mapped data. This shared
+ /// pointer can contain a NULL DataBuffer pointer, so the contained
+ /// pointer must be checked prior to using it.
+ //------------------------------------------------------------------
+ lldb::DataBufferSP
+ MemoryMapFileContentsIfLocal(off_t file_offset, size_t file_size) const;
+
//------------------------------------------------------------------
/// Read part of, or the entire contents of, a file into a heap based data buffer.
///
@@ -579,9 +649,12 @@ public:
lldb::DataBufferSP
ReadFileContentsAsCString(Error *error_ptr = NULL);
- static void Normalize(llvm::SmallVectorImpl<char> &path, PathSyntax syntax = ePathSyntaxHostNative);
- static void DeNormalize(llvm::SmallVectorImpl<char> &path, PathSyntax syntax = ePathSyntaxHostNative);
-
+ //------------------------------------------------------------------
+ /// Normalize a pathname by collapsing redundant separators and
+ /// up-level references.
+ //------------------------------------------------------------------
+ void
+ NormalizePath ();
//------------------------------------------------------------------
/// Run through the input string, replaying the effect of any ".." and produce
@@ -613,6 +686,15 @@ public:
void
SetFile (const char *path, bool resolve_path, PathSyntax syntax = ePathSyntaxHostNative);
+ void
+ SetFile(const char *path, bool resolve_path, ArchSpec arch);
+
+ void
+ SetFile(const std::string &path, bool resolve_path, PathSyntax syntax = ePathSyntaxHostNative);
+
+ void
+ SetFile(const std::string &path, bool resolve_path, ArchSpec arch);
+
bool
IsResolved () const
{
@@ -668,10 +750,25 @@ public:
FileSpec
CopyByRemovingLastPathComponent () const;
-
+
void
- AppendPathComponent (const char *new_path);
-
+ PrependPathComponent(const char *new_path);
+
+ void
+ PrependPathComponent(const std::string &new_path);
+
+ void
+ PrependPathComponent(const FileSpec &new_path);
+
+ void
+ AppendPathComponent(const char *new_path);
+
+ void
+ AppendPathComponent(const std::string &new_path);
+
+ void
+ AppendPathComponent(const FileSpec &new_path);
+
void
RemoveLastPathComponent ();
@@ -706,8 +803,7 @@ public:
typedef EnumerateDirectoryResult (*EnumerateDirectoryCallbackType) (void *baton,
FileType file_type,
- const FileSpec &spec
-);
+ const FileSpec &spec);
static EnumerateDirectoryResult
EnumerateDirectory (const char *dir_path,
@@ -717,6 +813,11 @@ public:
EnumerateDirectoryCallbackType callback,
void *callback_baton);
+ typedef std::function <EnumerateDirectoryResult(FileType file_type, const FileSpec &spec)> DirectoryCallback;
+
+ static EnumerateDirectoryResult
+ ForEachItemInDirectory (const char *dir_path, DirectoryCallback const &callback);
+
protected:
//------------------------------------------------------------------
// Member variables
diff --git a/include/lldb/Host/FileSystem.h b/include/lldb/Host/FileSystem.h
index adcbfc9d590d..bea1ec80172e 100644
--- a/include/lldb/Host/FileSystem.h
+++ b/include/lldb/Host/FileSystem.h
@@ -24,19 +24,36 @@ class FileSystem
public:
static FileSpec::PathSyntax GetNativePathSyntax();
- static Error MakeDirectory(const char *path, uint32_t mode);
- static Error DeleteDirectory(const char *path, bool recurse);
+ static Error MakeDirectory(const FileSpec &file_spec, uint32_t mode);
+ static Error DeleteDirectory(const FileSpec &file_spec, bool recurse);
- static Error GetFilePermissions(const char *path, uint32_t &file_permissions);
- static Error SetFilePermissions(const char *path, uint32_t file_permissions);
+ static Error GetFilePermissions(const FileSpec &file_spec,
+ uint32_t &file_permissions);
+ static Error SetFilePermissions(const FileSpec &file_spec,
+ uint32_t file_permissions);
static lldb::user_id_t GetFileSize(const FileSpec &file_spec);
static bool GetFileExists(const FileSpec &file_spec);
- static Error Symlink(const char *src, const char *dst);
- static Error Readlink(const char *path, char *buf, size_t buf_len);
- static Error Unlink(const char *path);
+ static Error Hardlink(const FileSpec &src, const FileSpec &dst);
+ static Error Symlink(const FileSpec &src, const FileSpec &dst);
+ static Error Readlink(const FileSpec &src, FileSpec &dst);
+ static Error Unlink(const FileSpec &file_spec);
static bool CalculateMD5(const FileSpec &file_spec, uint64_t &low, uint64_t &high);
+ static bool CalculateMD5(const FileSpec &file_spec,
+ uint64_t offset,
+ uint64_t length,
+ uint64_t &low,
+ uint64_t &high);
+
+ static bool CalculateMD5AsString(const FileSpec &file_spec, std::string& digest_str);
+ static bool CalculateMD5AsString(const FileSpec &file_spec,
+ uint64_t offset,
+ uint64_t length,
+ std::string& digest_str);
+
+ /// Return \b true if \a spec is on a locally mounted file system, \b false otherwise.
+ static bool IsLocal(const FileSpec &spec);
};
}
diff --git a/include/lldb/Host/Host.h b/include/lldb/Host/Host.h
index 9a68c698c826..caf33634057d 100644
--- a/include/lldb/Host/Host.h
+++ b/include/lldb/Host/Host.h
@@ -133,9 +133,6 @@ public:
static const char *
GetSignalAsCString (int signo);
- static void
- WillTerminate ();
-
typedef void (*ThreadLocalStorageCleanupCallback) (void *p);
static lldb::thread_key_t
@@ -236,12 +233,16 @@ public:
GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &proc_info);
#if defined (__APPLE__) || defined (__linux__) || defined (__FreeBSD__) || defined (__GLIBC__) || defined (__NetBSD__)
+#if !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
+
static short GetPosixspawnFlags(const ProcessLaunchInfo &launch_info);
static Error LaunchProcessPosixSpawn(const char *exe_path, const ProcessLaunchInfo &launch_info, lldb::pid_t &pid);
static bool AddPosixSpawnFileAction(void *file_actions, const FileAction *info, Log *log, Error &error);
-#endif
+
+#endif // !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
+#endif // defined (__APPLE__) || defined (__linux__) || defined (__FreeBSD__) || defined (__GLIBC__) || defined(__NetBSD__)
static const lldb_private::UnixSignalsSP&
GetUnixSignals ();
@@ -249,14 +250,33 @@ public:
static Error
LaunchProcess (ProcessLaunchInfo &launch_info);
+ //------------------------------------------------------------------
+ /// Perform expansion of the command-line for this launch info
+ /// This can potentially involve wildcard expansion
+ // environment variable replacement, and whatever other
+ // argument magic the platform defines as part of its typical
+ // user experience
+ //------------------------------------------------------------------
+ static Error
+ ShellExpandArguments (ProcessLaunchInfo &launch_info);
+
+ static Error
+ RunShellCommand(const char *command, // Shouldn't be NULL
+ const FileSpec &working_dir, // Pass empty FileSpec to use the current working directory
+ int *status_ptr, // Pass NULL if you don't want the process exit status
+ int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
+ std::string *command_output, // Pass NULL if you don't want the command output
+ uint32_t timeout_sec,
+ bool run_in_default_shell = true);
+
static Error
- RunShellCommand (const char *command, // Shouldn't be NULL
- const char *working_dir, // Pass NULL to use the current working directory
- int *status_ptr, // Pass NULL if you don't want the process exit status
- int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
- std::string *command_output, // Pass NULL if you don't want the command output
- uint32_t timeout_sec,
- bool run_in_default_shell = true);
+ RunShellCommand(const Args& args,
+ const FileSpec &working_dir, // Pass empty FileSpec to use the current working directory
+ int *status_ptr, // Pass NULL if you don't want the process exit status
+ int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
+ std::string *command_output, // Pass NULL if you don't want the command output
+ uint32_t timeout_sec,
+ bool run_in_default_shell = true);
static lldb::DataBufferSP
GetAuxvData (lldb_private::Process *process);
@@ -268,9 +288,6 @@ public:
OpenFileInExternalEditor (const FileSpec &file_spec,
uint32_t line_no);
- static void
- Backtrace (Stream &strm, uint32_t max_frames);
-
static size_t
GetEnvironment (StringList &env);
};
diff --git a/include/lldb/Host/HostInfo.h b/include/lldb/Host/HostInfo.h
index cbbf6cd2d49c..6bb009997896 100644
--- a/include/lldb/Host/HostInfo.h
+++ b/include/lldb/Host/HostInfo.h
@@ -38,8 +38,13 @@
#include "lldb/Host/windows/HostInfoWindows.h"
#define HOST_INFO_TYPE HostInfoWindows
#elif defined(__linux__)
+#if defined(__ANDROID_NDK__)
+#include "lldb/Host/android/HostInfoAndroid.h"
+#define HOST_INFO_TYPE HostInfoAndroid
+#else
#include "lldb/Host/linux/HostInfoLinux.h"
#define HOST_INFO_TYPE HostInfoLinux
+#endif
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include "lldb/Host/freebsd/HostInfoFreeBSD.h"
#define HOST_INFO_TYPE HostInfoFreeBSD
diff --git a/include/lldb/Host/HostInfoBase.h b/include/lldb/Host/HostInfoBase.h
index 5a8a06329500..6a5f784ebba3 100644
--- a/include/lldb/Host/HostInfoBase.h
+++ b/include/lldb/Host/HostInfoBase.h
@@ -115,7 +115,9 @@ class HostInfoBase
protected:
static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
static bool ComputeSupportExeDirectory(FileSpec &file_spec);
- static bool ComputeTempFileDirectory(FileSpec &file_spec);
+ static bool ComputeProcessTempFileDirectory(FileSpec &file_spec);
+ static bool ComputeGlobalTempFileDirectory(FileSpec &file_spec);
+ static bool ComputeTempFileBaseDirectory(FileSpec &file_spec);
static bool ComputeHeaderDirectory(FileSpec &file_spec);
static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
static bool ComputeClangDirectory(FileSpec &file_spec);
diff --git a/include/lldb/Host/LockFile.h b/include/lldb/Host/LockFile.h
new file mode 100644
index 000000000000..a89560481874
--- /dev/null
+++ b/include/lldb/Host/LockFile.h
@@ -0,0 +1,27 @@
+//===-- LockFile.h ----------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_LockFile_h_
+#define liblldb_Host_LockFile_h_
+
+#if defined(_WIN32)
+#include "lldb/Host/windows/LockFileWindows.h"
+namespace lldb_private
+{
+typedef LockFileWindows LockFile;
+}
+#else
+#include "lldb/Host/posix/LockFilePosix.h"
+namespace lldb_private
+{
+typedef LockFilePosix LockFile;
+}
+#endif
+
+#endif // liblldb_Host_LockFile_h_
diff --git a/include/lldb/Host/LockFileBase.h b/include/lldb/Host/LockFileBase.h
new file mode 100644
index 000000000000..35dd7d817c59
--- /dev/null
+++ b/include/lldb/Host/LockFileBase.h
@@ -0,0 +1,73 @@
+//===-- LockFileBase.h ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_LockFileBase_h_
+#define liblldb_Host_LockFileBase_h_
+
+#include "lldb/Core/Error.h"
+
+#include <functional>
+
+namespace lldb_private
+{
+
+class LockFileBase
+{
+public:
+ virtual ~LockFileBase () = default;
+
+ bool
+ IsLocked () const;
+
+ Error
+ WriteLock (const uint64_t start, const uint64_t len);
+ Error
+ TryWriteLock (const uint64_t start, const uint64_t len);
+
+ Error
+ ReadLock (const uint64_t start, const uint64_t len);
+ Error
+ TryReadLock (const uint64_t start, const uint64_t len);
+
+ Error
+ Unlock ();
+
+protected:
+ using Locker = std::function<Error (const uint64_t, const uint64_t)>;
+
+ LockFileBase (int fd);
+
+ virtual bool
+ IsValidFile () const;
+
+ virtual Error
+ DoWriteLock (const uint64_t start, const uint64_t len) = 0;
+ virtual Error
+ DoTryWriteLock (const uint64_t start, const uint64_t len) = 0;
+
+ virtual Error
+ DoReadLock (const uint64_t start, const uint64_t len) = 0;
+ virtual Error
+ DoTryReadLock (const uint64_t start, const uint64_t len) = 0;
+
+ virtual Error
+ DoUnlock () = 0;
+
+ Error
+ DoLock (const Locker &locker, const uint64_t start, const uint64_t len);
+
+ int m_fd; // not owned.
+ bool m_locked;
+ uint64_t m_start;
+ uint64_t m_len;
+};
+
+}
+
+#endif
diff --git a/include/lldb/Host/PipeBase.h b/include/lldb/Host/PipeBase.h
index 5ef2bb530281..8680a252d8b6 100644
--- a/include/lldb/Host/PipeBase.h
+++ b/include/lldb/Host/PipeBase.h
@@ -40,6 +40,8 @@ class PipeBase
virtual int GetWriteFileDescriptor() const = 0;
virtual int ReleaseReadFileDescriptor() = 0;
virtual int ReleaseWriteFileDescriptor() = 0;
+ virtual void CloseReadFileDescriptor() = 0;
+ virtual void CloseWriteFileDescriptor() = 0;
// Close both descriptors
virtual void Close() = 0;
diff --git a/include/lldb/Host/Socket.h b/include/lldb/Host/Socket.h
index ee85f85fcaf2..f4599b5ab87b 100644
--- a/include/lldb/Host/Socket.h
+++ b/include/lldb/Host/Socket.h
@@ -56,7 +56,12 @@ public:
// Initialize a Tcp Socket object in listening mode. listen and accept are implemented
// separately because the caller may wish to manipulate or query the socket after it is
// initialized, but before entering a blocking accept.
- static Error TcpListen(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket, Predicate<uint16_t>* predicate);
+ static Error TcpListen(
+ llvm::StringRef host_and_port,
+ bool child_processes_inherit,
+ Socket *&socket,
+ Predicate<uint16_t>* predicate,
+ int backlog = 5);
static Error TcpConnect(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket);
static Error UdpConnect(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&send_socket, Socket *&recv_socket);
static Error UnixDomainConnect(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket);
diff --git a/include/lldb/Host/Time.h b/include/lldb/Host/Time.h
new file mode 100644
index 000000000000..1481d381053d
--- /dev/null
+++ b/include/lldb/Host/Time.h
@@ -0,0 +1,26 @@
+//===-- Time.h --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Include system time headers, adding missing functions as necessary
+
+#ifndef liblldb_Host_Time_h_
+#define liblldb_Host_Time_h_
+
+#ifdef __ANDROID_NDK__
+#include <android/api-level.h>
+#endif
+
+#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
+#include <time64.h>
+extern time_t timegm(struct tm* t);
+#else
+#include <time.h>
+#endif
+
+#endif // liblldb_Host_Time_h_
diff --git a/include/lldb/Host/XML.h b/include/lldb/Host/XML.h
new file mode 100644
index 000000000000..e3547d834635
--- /dev/null
+++ b/include/lldb/Host/XML.h
@@ -0,0 +1,234 @@
+//===-- XML.h ---------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_XML_h_
+#define liblldb_XML_h_
+
+// C Includes
+
+#if defined( LIBXML2_DEFINED )
+#include <libxml/xmlreader.h>
+#endif
+
+// C++ Includes
+
+#include <functional>
+#include <string>
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-private.h"
+#include "llvm/ADT/StringRef.h"
+#include "lldb/Core/StreamString.h"
+#include "lldb/Core/StructuredData.h"
+
+
+namespace lldb_private {
+
+#if defined( LIBXML2_DEFINED )
+ typedef xmlNodePtr XMLNodeImpl;
+ typedef xmlDocPtr XMLDocumentImpl;
+#else
+ typedef void * XMLNodeImpl;
+ typedef void * XMLDocumentImpl;
+#endif
+
+ class XMLNode;
+
+ typedef std::vector<std::string> NamePath;
+ typedef std::function <bool(const XMLNode &node)> NodeCallback;
+ typedef std::function <bool(const llvm::StringRef &name, const llvm::StringRef &value)> AttributeCallback;
+
+ class XMLNode
+ {
+ public:
+ XMLNode();
+
+ XMLNode(XMLNodeImpl node);
+
+ ~XMLNode();
+
+ explicit operator bool() const
+ {
+ return IsValid();
+ }
+
+ void
+ Clear();
+
+ bool
+ IsValid() const;
+
+ bool
+ IsElement () const;
+
+ llvm::StringRef
+ GetName() const;
+
+ bool
+ GetElementText (std::string &text) const;
+
+ bool
+ GetElementTextAsUnsigned (uint64_t &value, uint64_t fail_value = 0, int base = 0) const;
+
+ bool
+ GetElementTextAsFloat (double &value, double fail_value = 0.0) const;
+
+ bool
+ NameIs (const char *name) const;
+
+ XMLNode
+ GetParent() const;
+
+ XMLNode
+ GetSibling() const;
+
+ XMLNode
+ GetChild () const;
+
+ llvm::StringRef
+ GetAttributeValue(const char *name, const char *fail_value = NULL) const;
+
+ XMLNode
+ FindFirstChildElementWithName (const char *name) const;
+
+ XMLNode
+ GetElementForPath (const NamePath &path);
+
+ //----------------------------------------------------------------------
+ // Iterate through all sibling nodes of any type
+ //----------------------------------------------------------------------
+ void
+ ForEachSiblingNode (NodeCallback const &callback) const;
+
+ //----------------------------------------------------------------------
+ // Iterate through only the sibling nodes that are elements
+ //----------------------------------------------------------------------
+ void
+ ForEachSiblingElement (NodeCallback const &callback) const;
+
+ //----------------------------------------------------------------------
+ // Iterate through only the sibling nodes that are elements and whose
+ // name matches \a name.
+ //----------------------------------------------------------------------
+ void
+ ForEachSiblingElementWithName (const char *name, NodeCallback const &callback) const;
+
+ void
+ ForEachChildNode (NodeCallback const &callback) const;
+
+ void
+ ForEachChildElement (NodeCallback const &callback) const;
+
+ void
+ ForEachChildElementWithName (const char *name, NodeCallback const &callback) const;
+
+ void
+ ForEachAttribute (AttributeCallback const &callback) const;
+
+ protected:
+ XMLNodeImpl m_node;
+ };
+
+ class XMLDocument
+ {
+ public:
+
+ XMLDocument ();
+
+ ~XMLDocument ();
+
+ explicit operator bool() const
+ {
+ return IsValid();
+ }
+
+ bool
+ IsValid() const;
+
+ void
+ Clear();
+
+ bool
+ ParseFile (const char *path);
+
+ bool
+ ParseMemory (const char *xml, size_t xml_length, const char *url = "untitled.xml");
+
+ //----------------------------------------------------------------------
+ // If \a name is NULL, just get the root element node, else only return
+ // a value XMLNode if the name of the root element matches \a name.
+ //----------------------------------------------------------------------
+ XMLNode
+ GetRootElement(const char *required_name = nullptr);
+
+ const std::string &
+ GetErrors() const;
+
+ static void
+ ErrorCallback (void *ctx, const char *format, ...);
+
+ static bool
+ XMLEnabled ();
+
+ protected:
+ XMLDocumentImpl m_document;
+ StreamString m_errors;
+ };
+
+ class ApplePropertyList
+ {
+ public:
+ ApplePropertyList();
+
+ ApplePropertyList(const char *path);
+
+ ~ApplePropertyList();
+
+ bool
+ ParseFile (const char *path);
+
+ const std::string &
+ GetErrors() const;
+
+ explicit operator bool() const
+ {
+ return IsValid();
+ }
+
+ bool
+ IsValid() const;
+
+ XMLNode
+ GetValueNode (const char *key) const;
+
+ bool
+ GetValueAsString (const char *key, std::string &value) const;
+
+ StructuredData::ObjectSP
+ GetStructuredData();
+
+ protected:
+
+ // Using a node returned from GetValueNode() extract its value as a
+ // string (if possible). Array and dictionary nodes will return false
+ // as they have no string value. Boolean nodes will return true and
+ // \a value will be "true" or "false" as the string value comes from
+ // the element name itself. All other nodes will return the text
+ // content of the XMLNode.
+ static bool
+ ExtractStringFromValueNode (const XMLNode &node, std::string &value);
+
+ XMLDocument m_xml_doc;
+ XMLNode m_dict_node;
+ };
+} // namespace lldb_private
+
+#endif // liblldb_XML_h_
diff --git a/include/lldb/Host/common/NativeBreakpointList.h b/include/lldb/Host/common/NativeBreakpointList.h
index 51617330d075..aba2f8a74cdc 100644
--- a/include/lldb/Host/common/NativeBreakpointList.h
+++ b/include/lldb/Host/common/NativeBreakpointList.h
@@ -42,6 +42,9 @@ namespace lldb_private
Error
GetBreakpoint (lldb::addr_t addr, NativeBreakpointSP &breakpoint_sp);
+ Error
+ RemoveTrapsFromBuffer(lldb::addr_t addr, void *buf, size_t size) const;
+
private:
typedef std::map<lldb::addr_t, NativeBreakpointSP> BreakpointMap;
diff --git a/include/lldb/Host/common/NativeProcessProtocol.h b/include/lldb/Host/common/NativeProcessProtocol.h
index 83c14a5ab37a..f6a685aae147 100644
--- a/include/lldb/Host/common/NativeProcessProtocol.h
+++ b/include/lldb/Host/common/NativeProcessProtocol.h
@@ -16,6 +16,7 @@
#include "lldb/lldb-types.h"
#include "lldb/Core/Error.h"
#include "lldb/Host/Mutex.h"
+#include "llvm/ADT/StringRef.h"
#include "NativeBreakpointList.h"
#include "NativeWatchpointList.h"
@@ -90,13 +91,16 @@ namespace lldb_private
GetMemoryRegionInfo (lldb::addr_t load_addr, MemoryRegionInfo &range_info);
virtual Error
- ReadMemory (lldb::addr_t addr, void *buf, lldb::addr_t size, lldb::addr_t &bytes_read) = 0;
+ ReadMemory(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read) = 0;
virtual Error
- WriteMemory (lldb::addr_t addr, const void *buf, lldb::addr_t size, lldb::addr_t &bytes_written) = 0;
+ ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read) = 0;
virtual Error
- AllocateMemory (lldb::addr_t size, uint32_t permissions, lldb::addr_t &addr) = 0;
+ WriteMemory(lldb::addr_t addr, const void *buf, size_t size, size_t &bytes_written) = 0;
+
+ virtual Error
+ AllocateMemory(size_t size, uint32_t permissions, lldb::addr_t &addr) = 0;
virtual Error
DeallocateMemory (lldb::addr_t addr) = 0;
@@ -283,6 +287,16 @@ namespace lldb_private
bool
UnregisterNativeDelegate (NativeDelegate &native_delegate);
+ // Called before termination of NativeProcessProtocol's instance.
+ virtual void
+ Terminate ();
+
+ virtual Error
+ GetLoadedModuleFileSpec(const char* module_path, FileSpec& file_spec) = 0;
+
+ virtual Error
+ GetFileLoadAddress(const llvm::StringRef& file_name, lldb::addr_t& load_addr) = 0;
+
protected:
lldb::pid_t m_pid;
diff --git a/include/lldb/Host/common/NativeRegisterContext.h b/include/lldb/Host/common/NativeRegisterContext.h
index e9c03e3c20a4..098f148f95d0 100644
--- a/include/lldb/Host/common/NativeRegisterContext.h
+++ b/include/lldb/Host/common/NativeRegisterContext.h
@@ -99,14 +99,26 @@ public:
virtual Error
ClearAllHardwareWatchpoints ();
+ virtual Error
+ IsWatchpointHit(uint32_t wp_index, bool &is_hit);
+
+ virtual Error
+ GetWatchpointHitIndex(uint32_t &wp_index, lldb::addr_t trap_addr);
+
+ virtual Error
+ IsWatchpointVacant (uint32_t wp_index, bool &is_vacant);
+
+ virtual lldb::addr_t
+ GetWatchpointAddress (uint32_t wp_index);
+
virtual bool
HardwareSingleStep (bool enable);
virtual Error
- ReadRegisterValueFromMemory (const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr, lldb::addr_t src_len, RegisterValue &reg_value);
+ ReadRegisterValueFromMemory (const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr, size_t src_len, RegisterValue &reg_value);
virtual Error
- WriteRegisterValueToMemory (const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, lldb::addr_t dst_len, const RegisterValue &reg_value);
+ WriteRegisterValueToMemory (const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, size_t dst_len, const RegisterValue &reg_value);
//------------------------------------------------------------------
// Subclasses should not override these
@@ -129,6 +141,9 @@ public:
lldb::addr_t
GetPC (lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
+ virtual lldb::addr_t
+ GetPCfromBreakpointLocation (lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
+
Error
SetPC (lldb::addr_t pc);
diff --git a/include/lldb/Host/common/SoftwareBreakpoint.h b/include/lldb/Host/common/SoftwareBreakpoint.h
index 1fed19eca612..83b3d18aa768 100644
--- a/include/lldb/Host/common/SoftwareBreakpoint.h
+++ b/include/lldb/Host/common/SoftwareBreakpoint.h
@@ -17,6 +17,8 @@ namespace lldb_private
{
class SoftwareBreakpoint : public NativeBreakpoint
{
+ friend class NativeBreakpointList;
+
public:
static Error
CreateSoftwareBreakpoint (NativeProcessProtocol &process, lldb::addr_t addr, size_t size_hint, NativeBreakpointSP &breakpoint_spn);
diff --git a/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h b/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
index 660b9d169bfc..bcbb6014b116 100644
--- a/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
+++ b/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
@@ -38,23 +38,25 @@ class ConnectionFileDescriptor : public Connection
ConnectionFileDescriptor(int fd, bool owns_fd);
+ ConnectionFileDescriptor(Socket* socket);
+
virtual ~ConnectionFileDescriptor();
- virtual bool IsConnected() const;
+ bool IsConnected() const override;
- virtual lldb::ConnectionStatus Connect(const char *s, Error *error_ptr);
+ lldb::ConnectionStatus Connect(const char *s, Error *error_ptr) override;
- virtual lldb::ConnectionStatus Disconnect(Error *error_ptr);
+ lldb::ConnectionStatus Disconnect(Error *error_ptr) override;
- virtual size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec, lldb::ConnectionStatus &status, Error *error_ptr);
+ size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec, lldb::ConnectionStatus &status, Error *error_ptr) override;
- virtual size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr);
+ size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr) override;
- virtual std::string GetURI();
+ std::string GetURI() override;
lldb::ConnectionStatus BytesAvailable(uint32_t timeout_usec, Error *error_ptr);
- bool InterruptRead();
+ bool InterruptRead() override;
lldb::IOObjectSP
GetReadObject()
@@ -104,6 +106,8 @@ class ConnectionFileDescriptor : public Connection
std::string m_uri;
private:
+ void InitializeSocket(Socket* socket);
+
DISALLOW_COPY_AND_ASSIGN(ConnectionFileDescriptor);
};
diff --git a/include/lldb/Host/posix/Fcntl.h b/include/lldb/Host/posix/Fcntl.h
new file mode 100644
index 000000000000..3e3a472f0a20
--- /dev/null
+++ b/include/lldb/Host/posix/Fcntl.h
@@ -0,0 +1,25 @@
+//===-- Fcntl.h -------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// This file defines fcntl functions & structures
+
+#ifndef liblldb_Host_posix_Fcntl_h_
+#define liblldb_Host_posix_Fcntl_h_
+
+#ifdef __ANDROID_NDK__
+#include <android/api-level.h>
+#endif
+
+#include <fcntl.h>
+
+#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
+#define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6)
+#endif
+
+#endif // liblldb_Host_posix_Fcntl_h_
diff --git a/include/lldb/Host/posix/HostProcessPosix.h b/include/lldb/Host/posix/HostProcessPosix.h
index 8c1b0599e114..c9534991361b 100644
--- a/include/lldb/Host/posix/HostProcessPosix.h
+++ b/include/lldb/Host/posix/HostProcessPosix.h
@@ -29,13 +29,13 @@ class HostProcessPosix : public HostNativeProcessBase
virtual Error Signal(int signo) const;
static Error Signal(lldb::process_t process, int signo);
- virtual Error Terminate();
- virtual Error GetMainModule(FileSpec &file_spec) const;
+ Error Terminate() override;
+ Error GetMainModule(FileSpec &file_spec) const override;
- virtual lldb::pid_t GetProcessId() const;
- virtual bool IsRunning() const;
+ lldb::pid_t GetProcessId() const override;
+ bool IsRunning() const override;
- virtual HostThread StartMonitoring(HostProcess::MonitorCallback callback, void *callback_baton, bool monitor_signals);
+ HostThread StartMonitoring(HostProcess::MonitorCallback callback, void *callback_baton, bool monitor_signals) override;
};
}
diff --git a/include/lldb/Host/posix/HostThreadPosix.h b/include/lldb/Host/posix/HostThreadPosix.h
index e0eaedf73be2..8839b8d4068b 100644
--- a/include/lldb/Host/posix/HostThreadPosix.h
+++ b/include/lldb/Host/posix/HostThreadPosix.h
@@ -24,8 +24,8 @@ class HostThreadPosix : public HostNativeThreadBase
HostThreadPosix(lldb::thread_t thread);
virtual ~HostThreadPosix();
- virtual Error Join(lldb::thread_result_t *result);
- virtual Error Cancel();
+ Error Join(lldb::thread_result_t *result) override;
+ Error Cancel() override;
Error Detach();
};
diff --git a/include/lldb/Host/posix/LockFilePosix.h b/include/lldb/Host/posix/LockFilePosix.h
new file mode 100644
index 000000000000..999397ec2bb5
--- /dev/null
+++ b/include/lldb/Host/posix/LockFilePosix.h
@@ -0,0 +1,42 @@
+//===-- LockFilePosix.h -----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_posix_LockFilePosix_h_
+#define liblldb_Host_posix_LockFilePosix_h_
+
+#include "lldb/Host/LockFileBase.h"
+
+namespace lldb_private {
+
+class LockFilePosix : public LockFileBase
+{
+public:
+ explicit LockFilePosix (int fd);
+ ~LockFilePosix ();
+
+protected:
+ Error
+ DoWriteLock (const uint64_t start, const uint64_t len) override;
+
+ Error
+ DoTryWriteLock (const uint64_t start, const uint64_t len) override;
+
+ Error
+ DoReadLock (const uint64_t start, const uint64_t len) override;
+
+ Error
+ DoTryReadLock (const uint64_t start, const uint64_t len) override;
+
+ Error
+ DoUnlock () override;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Host_posix_LockFilePosix_h_
diff --git a/include/lldb/Host/posix/PipePosix.h b/include/lldb/Host/posix/PipePosix.h
index fbdac66149d6..710b77d34bdc 100644
--- a/include/lldb/Host/posix/PipePosix.h
+++ b/include/lldb/Host/posix/PipePosix.h
@@ -16,7 +16,7 @@
namespace lldb_private {
//----------------------------------------------------------------------
-/// @class PipePosix PipePosix .h "lldb/Host/posix/PipePosix.h"
+/// @class PipePosix PipePosix.h "lldb/Host/posix/PipePosix.h"
/// @brief A posix-based implementation of Pipe, a class that abtracts
/// unix style pipes.
///
@@ -28,6 +28,11 @@ public:
static int kInvalidDescriptor;
PipePosix();
+ PipePosix(int read_fd, int write_fd);
+ PipePosix(const PipePosix &) = delete;
+ PipePosix(PipePosix &&pipe_posix);
+ PipePosix &operator=(const PipePosix &) = delete;
+ PipePosix &operator=(PipePosix &&pipe_posix);
~PipePosix() override;
@@ -55,6 +60,11 @@ public:
ReleaseReadFileDescriptor() override;
int
ReleaseWriteFileDescriptor() override;
+ void
+ CloseReadFileDescriptor() override;
+ void
+ CloseWriteFileDescriptor() override;
+
// Close both descriptors
void
@@ -69,11 +79,6 @@ public:
ReadWithTimeout(void *buf, size_t size, const std::chrono::microseconds &timeout, size_t &bytes_read) override;
private:
- void
- CloseReadFileDescriptor();
- void
- CloseWriteFileDescriptor();
-
int m_fds[2];
};
diff --git a/include/lldb/Host/posix/ProcessLauncherPosix.h b/include/lldb/Host/posix/ProcessLauncherPosix.h
index c0e2a36e4e5e..a5e57ccb26ed 100644
--- a/include/lldb/Host/posix/ProcessLauncherPosix.h
+++ b/include/lldb/Host/posix/ProcessLauncherPosix.h
@@ -18,7 +18,7 @@ namespace lldb_private
class ProcessLauncherPosix : public ProcessLauncher
{
public:
- virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, Error &error);
+ HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, Error &error) override;
};
}
diff --git a/include/lldb/Initialization/SystemInitializer.h b/include/lldb/Initialization/SystemInitializer.h
new file mode 100644
index 000000000000..c7f98f24ae48
--- /dev/null
+++ b/include/lldb/Initialization/SystemInitializer.h
@@ -0,0 +1,26 @@
+//===-- SystemInitializer.h -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_INITIALIZATION_SYSTEM_INITIALIZER_H
+#define LLDB_INITIALIZATION_SYSTEM_INITIALIZER_H
+
+namespace lldb_private
+{
+class SystemInitializer
+{
+ public:
+ SystemInitializer();
+ virtual ~SystemInitializer();
+
+ virtual void Initialize() = 0;
+ virtual void Terminate() = 0;
+};
+}
+
+#endif
diff --git a/include/lldb/Initialization/SystemInitializerCommon.h b/include/lldb/Initialization/SystemInitializerCommon.h
new file mode 100644
index 000000000000..af66c93a5e48
--- /dev/null
+++ b/include/lldb/Initialization/SystemInitializerCommon.h
@@ -0,0 +1,38 @@
+//===-- SystemInitializerCommon.h -------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_INITIALIZATION_SYSTEM_INITIALIZER_COMMON_H
+#define LLDB_INITIALIZATION_SYSTEM_INITIALIZER_COMMON_H
+
+#include "SystemInitializer.h"
+
+namespace lldb_private
+{
+//------------------------------------------------------------------
+/// Initializes common lldb functionality.
+///
+/// This class is responsible for initializing a subset of lldb
+/// useful to both debug servers and debug clients. Debug servers
+/// do not use all of LLDB and desire small binary sizes, so this
+/// functionality is separate. This class is used by constructing
+/// an instance of SystemLifetimeManager with this class passed to
+/// the constructor.
+//------------------------------------------------------------------
+class SystemInitializerCommon : public SystemInitializer
+{
+ public:
+ SystemInitializerCommon();
+ virtual ~SystemInitializerCommon();
+
+ void Initialize() override;
+ void Terminate() override;
+};
+}
+
+#endif
diff --git a/include/lldb/Initialization/SystemLifetimeManager.h b/include/lldb/Initialization/SystemLifetimeManager.h
new file mode 100644
index 000000000000..843ec2820677
--- /dev/null
+++ b/include/lldb/Initialization/SystemLifetimeManager.h
@@ -0,0 +1,42 @@
+//===-- SystemLifetimeManager.h -------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_INITIALIZATION_SYSTEM_LIFETIME_MANAGER_H
+#define LLDB_INITIALIZATION_SYSTEM_LIFETIME_MANAGER_H
+
+#include "lldb/lldb-private-types.h"
+#include "lldb/Host/Mutex.h"
+
+#include <memory>
+
+namespace lldb_private
+{
+class SystemInitializer;
+
+class SystemLifetimeManager
+{
+ public:
+ SystemLifetimeManager();
+ ~SystemLifetimeManager();
+
+ void Initialize(std::unique_ptr<SystemInitializer> initializer, LoadPluginCallbackType plugin_callback);
+ void Terminate();
+
+ private:
+ Mutex m_mutex;
+ std::unique_ptr<SystemInitializer> m_initializer;
+ bool m_initialized;
+
+ // Noncopyable.
+ SystemLifetimeManager(const SystemLifetimeManager &other) = delete;
+ SystemLifetimeManager &operator=(const SystemLifetimeManager &other) = delete;
+};
+}
+
+#endif
diff --git a/include/lldb/Interpreter/Args.h b/include/lldb/Interpreter/Args.h
index fe29df468de7..e11636b63f17 100644
--- a/include/lldb/Interpreter/Args.h
+++ b/include/lldb/Interpreter/Args.h
@@ -18,6 +18,7 @@
#include <utility>
// Other libraries and framework includes
+#include "llvm/ADT/StringRef.h"
// Project includes
#include "lldb/lldb-private-types.h"
#include "lldb/lldb-types.h"
@@ -75,11 +76,9 @@ public:
/// A NULL terminated command that will be copied and split up
/// into arguments.
///
- /// @see Args::SetCommandString(const char *)
+ /// @see Args::SetCommandString(llvm::StringRef)
//------------------------------------------------------------------
- Args (const char *command = NULL);
-
- Args (const char *command, size_t len);
+ Args (llvm::StringRef command = llvm::StringRef());
Args (const Args &rhs);
@@ -108,7 +107,7 @@ public:
/// that can be accessed via the accessor functions.
///
/// @param[in] command
- /// A NULL terminated command that will be copied and split up
+ /// A command StringRef that will be copied and split up
/// into arguments.
///
/// @see Args::GetArgumentCount() const
@@ -118,10 +117,7 @@ public:
/// @see Args::Unshift (const char *)
//------------------------------------------------------------------
void
- SetCommandString (const char *command);
-
- void
- SetCommandString (const char *command, size_t len);
+ SetCommandString (llvm::StringRef command);
bool
GetCommandString (std::string &command) const;
@@ -449,6 +445,9 @@ protected:
void
UpdateArgvFromArgs ();
+
+ llvm::StringRef
+ ParseSingleArgument (llvm::StringRef command);
};
} // namespace lldb_private
diff --git a/include/lldb/Interpreter/CommandInterpreter.h b/include/lldb/Interpreter/CommandInterpreter.h
index 20b6ff95be8b..1962050dffcb 100644
--- a/include/lldb/Interpreter/CommandInterpreter.h
+++ b/include/lldb/Interpreter/CommandInterpreter.h
@@ -625,6 +625,12 @@ public:
bool
GetPromptOnQuit () const;
+ void
+ SetPromptOnQuit (bool b);
+
+ void
+ ResolveCommand(const char *command_line, CommandReturnObject &result);
+
bool
GetStopCmdSourceOnError () const;
@@ -685,6 +691,13 @@ private:
Error
PreprocessCommand (std::string &command);
+ // Completely resolves aliases and abbreviations, returning a pointer to the
+ // final command object and updating command_line to the fully substituted
+ // and translated command.
+ CommandObject *
+ ResolveCommandImpl(std::string &command_line, CommandReturnObject &result);
+
+
Debugger &m_debugger; // The debugger session that this interpreter is associated with
ExecutionContextRef m_exe_ctx_ref; // The current execution context to use when handling commands
bool m_synchronous_execution;
diff --git a/include/lldb/Interpreter/CommandObject.h b/include/lldb/Interpreter/CommandObject.h
index bace3264dafa..c0901d5e3032 100644
--- a/include/lldb/Interpreter/CommandObject.h
+++ b/include/lldb/Interpreter/CommandObject.h
@@ -98,7 +98,7 @@ public:
return m_interpreter;
}
- const char *
+ virtual const char *
GetHelp ();
virtual const char *
@@ -114,6 +114,9 @@ public:
SetHelp (const char * str);
void
+ SetHelp (std::string str);
+
+ void
SetHelpLong (const char * str);
void
@@ -192,7 +195,7 @@ public:
static lldb::CommandArgumentType
LookupArgumentName (const char *arg_name);
- static ArgumentTableEntry *
+ static const ArgumentTableEntry *
FindArgumentDataByType (lldb::CommandArgumentType arg_type);
int
@@ -217,89 +220,6 @@ public:
bool
IsPairType (ArgumentRepetitionType arg_repeat_type);
-
- enum
- {
- //----------------------------------------------------------------------
- // eFlagRequiresTarget
- //
- // Ensures a valid target is contained in m_exe_ctx prior to executing
- // the command. If a target doesn't exist or is invalid, the command
- // will fail and CommandObject::GetInvalidTargetDescription() will be
- // returned as the error. CommandObject subclasses can override the
- // virtual function for GetInvalidTargetDescription() to provide custom
- // strings when needed.
- //----------------------------------------------------------------------
- eFlagRequiresTarget = (1u << 0),
- //----------------------------------------------------------------------
- // eFlagRequiresProcess
- //
- // Ensures a valid process is contained in m_exe_ctx prior to executing
- // the command. If a process doesn't exist or is invalid, the command
- // will fail and CommandObject::GetInvalidProcessDescription() will be
- // returned as the error. CommandObject subclasses can override the
- // virtual function for GetInvalidProcessDescription() to provide custom
- // strings when needed.
- //----------------------------------------------------------------------
- eFlagRequiresProcess = (1u << 1),
- //----------------------------------------------------------------------
- // eFlagRequiresThread
- //
- // Ensures a valid thread is contained in m_exe_ctx prior to executing
- // the command. If a thread doesn't exist or is invalid, the command
- // will fail and CommandObject::GetInvalidThreadDescription() will be
- // returned as the error. CommandObject subclasses can override the
- // virtual function for GetInvalidThreadDescription() to provide custom
- // strings when needed.
- //----------------------------------------------------------------------
- eFlagRequiresThread = (1u << 2),
- //----------------------------------------------------------------------
- // eFlagRequiresFrame
- //
- // Ensures a valid frame is contained in m_exe_ctx prior to executing
- // the command. If a frame doesn't exist or is invalid, the command
- // will fail and CommandObject::GetInvalidFrameDescription() will be
- // returned as the error. CommandObject subclasses can override the
- // virtual function for GetInvalidFrameDescription() to provide custom
- // strings when needed.
- //----------------------------------------------------------------------
- eFlagRequiresFrame = (1u << 3),
- //----------------------------------------------------------------------
- // eFlagRequiresRegContext
- //
- // Ensures a valid register context (from the selected frame if there
- // is a frame in m_exe_ctx, or from the selected thread from m_exe_ctx)
- // is available from m_exe_ctx prior to executing the command. If a
- // target doesn't exist or is invalid, the command will fail and
- // CommandObject::GetInvalidRegContextDescription() will be returned as
- // the error. CommandObject subclasses can override the virtual function
- // for GetInvalidRegContextDescription() to provide custom strings when
- // needed.
- //----------------------------------------------------------------------
- eFlagRequiresRegContext = (1u << 4),
- //----------------------------------------------------------------------
- // eFlagTryTargetAPILock
- //
- // Attempts to acquire the target lock if a target is selected in the
- // command interpreter. If the command object fails to acquire the API
- // lock, the command will fail with an appropriate error message.
- //----------------------------------------------------------------------
- eFlagTryTargetAPILock = (1u << 5),
- //----------------------------------------------------------------------
- // eFlagProcessMustBeLaunched
- //
- // Verifies that there is a launched process in m_exe_ctx, if there
- // isn't, the command will fail with an appropriate error message.
- //----------------------------------------------------------------------
- eFlagProcessMustBeLaunched = (1u << 6),
- //----------------------------------------------------------------------
- // eFlagProcessMustBePaused
- //
- // Verifies that there is a paused process in m_exe_ctx, if there
- // isn't, the command will fail with an appropriate error message.
- //----------------------------------------------------------------------
- eFlagProcessMustBePaused = (1u << 7)
- };
bool
ParseOptions (Args& args, CommandReturnObject &result);
diff --git a/include/lldb/Interpreter/OptionValue.h b/include/lldb/Interpreter/OptionValue.h
index 787430a96ef5..fd751f744de6 100644
--- a/include/lldb/Interpreter/OptionValue.h
+++ b/include/lldb/Interpreter/OptionValue.h
@@ -40,6 +40,7 @@ namespace lldb_private {
eTypeFileSpec,
eTypeFileSpecList,
eTypeFormat,
+ eTypeLanguage,
eTypePathMap,
eTypeProperties,
eTypeRegex,
@@ -106,7 +107,7 @@ namespace lldb_private {
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) = 0;
virtual Error
- SetValueFromCString (const char *value, VarSetOperationType op = eVarSetOperationAssign);
+ SetValueFromString (llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign);
virtual bool
Clear () = 0;
@@ -187,6 +188,7 @@ namespace lldb_private {
case 1u << eTypeFileSpec: return eTypeFileSpec;
case 1u << eTypeFileSpecList: return eTypeFileSpecList;
case 1u << eTypeFormat: return eTypeFormat;
+ case 1u << eTypeLanguage: return eTypeLanguage;
case 1u << eTypePathMap: return eTypePathMap;
case 1u << eTypeProperties: return eTypeProperties;
case 1u << eTypeRegex: return eTypeRegex;
@@ -270,6 +272,12 @@ namespace lldb_private {
const OptionValueFormat *
GetAsFormat () const;
+ OptionValueLanguage *
+ GetAsLanguage ();
+
+ const OptionValueLanguage *
+ GetAsLanguage () const;
+
OptionValuePathMappings *
GetAsPathMappings ();
@@ -348,6 +356,12 @@ namespace lldb_private {
bool
SetFormatValue (lldb::Format new_value);
+
+ lldb::LanguageType
+ GetLanguageValue (lldb::LanguageType fail_value = lldb::eLanguageTypeUnknown) const;
+
+ bool
+ SetLanguageValue (lldb::LanguageType new_language);
const FormatEntity::Entry *
GetFormatEntity () const;
diff --git a/include/lldb/Interpreter/OptionValueArch.h b/include/lldb/Interpreter/OptionValueArch.h
index 662e1ec9f627..3d5d72619efc 100644
--- a/include/lldb/Interpreter/OptionValueArch.h
+++ b/include/lldb/Interpreter/OptionValueArch.h
@@ -71,7 +71,7 @@ public:
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
- SetValueFromCString (const char *value,
+ SetValueFromString (llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
diff --git a/include/lldb/Interpreter/OptionValueArray.h b/include/lldb/Interpreter/OptionValueArray.h
index 39ae2f6f43d6..2e44f9f07438 100644
--- a/include/lldb/Interpreter/OptionValueArray.h
+++ b/include/lldb/Interpreter/OptionValueArray.h
@@ -49,7 +49,7 @@ public:
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
- SetValueFromCString (const char *value,
+ SetValueFromString (llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
diff --git a/include/lldb/Interpreter/OptionValueBoolean.h b/include/lldb/Interpreter/OptionValueBoolean.h
index e024f3a0f3db..214fd1649d39 100644
--- a/include/lldb/Interpreter/OptionValueBoolean.h
+++ b/include/lldb/Interpreter/OptionValueBoolean.h
@@ -54,7 +54,7 @@ public:
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
- SetValueFromCString (const char *value,
+ SetValueFromString (llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
diff --git a/include/lldb/Interpreter/OptionValueChar.h b/include/lldb/Interpreter/OptionValueChar.h
index 55f4b63538ea..8fc02093e3d9 100644
--- a/include/lldb/Interpreter/OptionValueChar.h
+++ b/include/lldb/Interpreter/OptionValueChar.h
@@ -54,7 +54,7 @@ public:
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
- SetValueFromCString (const char *value,
+ SetValueFromString (llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
diff --git a/include/lldb/Interpreter/OptionValueDictionary.h b/include/lldb/Interpreter/OptionValueDictionary.h
index 5fb698b9f221..efa15dd6ef88 100644
--- a/include/lldb/Interpreter/OptionValueDictionary.h
+++ b/include/lldb/Interpreter/OptionValueDictionary.h
@@ -50,7 +50,7 @@ public:
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
- SetValueFromCString (const char *value,
+ SetValueFromString (llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
diff --git a/include/lldb/Interpreter/OptionValueEnumeration.h b/include/lldb/Interpreter/OptionValueEnumeration.h
index 68beddfce0d0..e820729385de 100644
--- a/include/lldb/Interpreter/OptionValueEnumeration.h
+++ b/include/lldb/Interpreter/OptionValueEnumeration.h
@@ -55,7 +55,7 @@ public:
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
- SetValueFromCString (const char *value,
+ SetValueFromString (llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
diff --git a/include/lldb/Interpreter/OptionValueFileSpec.h b/include/lldb/Interpreter/OptionValueFileSpec.h
index 7e74b605660c..80dd77ecef2a 100644
--- a/include/lldb/Interpreter/OptionValueFileSpec.h
+++ b/include/lldb/Interpreter/OptionValueFileSpec.h
@@ -22,12 +22,14 @@ namespace lldb_private {
class OptionValueFileSpec : public OptionValue
{
public:
- OptionValueFileSpec ();
+ OptionValueFileSpec (bool resolve = true);
- OptionValueFileSpec (const FileSpec &value);
+ OptionValueFileSpec (const FileSpec &value,
+ bool resolve = true);
OptionValueFileSpec (const FileSpec &current_value,
- const FileSpec &default_value);
+ const FileSpec &default_value,
+ bool resolve = true);
virtual
~OptionValueFileSpec()
@@ -48,7 +50,7 @@ public:
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
- SetValueFromCString (const char *value,
+ SetValueFromString (llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
@@ -57,6 +59,7 @@ public:
m_current_value = m_default_value;
m_value_was_set = false;
m_data_sp.reset();
+ m_data_mod_time.Clear();
return true;
}
@@ -121,7 +124,9 @@ protected:
FileSpec m_current_value;
FileSpec m_default_value;
lldb::DataBufferSP m_data_sp;
+ TimeValue m_data_mod_time;
uint32_t m_completion_mask;
+ bool m_resolve;
};
} // namespace lldb_private
diff --git a/include/lldb/Interpreter/OptionValueFileSpecList.h b/include/lldb/Interpreter/OptionValueFileSpecList.h
index 792de4e23af6..a105d22e45f9 100644
--- a/include/lldb/Interpreter/OptionValueFileSpecList.h
+++ b/include/lldb/Interpreter/OptionValueFileSpecList.h
@@ -54,7 +54,7 @@ public:
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
- SetValueFromCString (const char *value,
+ SetValueFromString (llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
diff --git a/include/lldb/Interpreter/OptionValueFormat.h b/include/lldb/Interpreter/OptionValueFormat.h
index 245b2eeb5af1..06ed12854318 100644
--- a/include/lldb/Interpreter/OptionValueFormat.h
+++ b/include/lldb/Interpreter/OptionValueFormat.h
@@ -55,7 +55,7 @@ public:
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
- SetValueFromCString (const char *value,
+ SetValueFromString (llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
diff --git a/include/lldb/Interpreter/OptionValueFormatEntity.h b/include/lldb/Interpreter/OptionValueFormatEntity.h
index cc988998bda0..18ace3a6a1b6 100644
--- a/include/lldb/Interpreter/OptionValueFormatEntity.h
+++ b/include/lldb/Interpreter/OptionValueFormatEntity.h
@@ -43,7 +43,7 @@ public:
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
Error
- SetValueFromCString (const char *value,
+ SetValueFromString (llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
bool
diff --git a/include/lldb/Interpreter/OptionValueLanguage.h b/include/lldb/Interpreter/OptionValueLanguage.h
new file mode 100644
index 000000000000..fba5e22821e0
--- /dev/null
+++ b/include/lldb/Interpreter/OptionValueLanguage.h
@@ -0,0 +1,107 @@
+//===-- OptionValueLanguage.h -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueLanguage_h_
+#define liblldb_OptionValueLanguage_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-enumerations.h"
+#include "lldb/Interpreter/OptionValue.h"
+
+namespace lldb_private {
+
+class OptionValueLanguage : public OptionValue
+{
+public:
+ OptionValueLanguage (lldb::LanguageType value) :
+ OptionValue(),
+ m_current_value (value),
+ m_default_value (value)
+ {
+ }
+
+ OptionValueLanguage (lldb::LanguageType current_value,
+ lldb::LanguageType default_value) :
+ OptionValue(),
+ m_current_value (current_value),
+ m_default_value (default_value)
+ {
+ }
+
+ virtual
+ ~OptionValueLanguage ()
+ {
+ }
+
+ //---------------------------------------------------------------------
+ // Virtual subclass pure virtual overrides
+ //---------------------------------------------------------------------
+
+ OptionValue::Type
+ GetType () const override
+ {
+ return eTypeLanguage;
+ }
+
+ void
+ DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
+
+ Error
+ SetValueFromString (llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool
+ Clear () override
+ {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP
+ DeepCopy () const override;
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+
+ lldb::LanguageType
+ GetCurrentValue() const
+ {
+ return m_current_value;
+ }
+
+ lldb::LanguageType
+ GetDefaultValue() const
+ {
+ return m_default_value;
+ }
+
+ void
+ SetCurrentValue (lldb::LanguageType value)
+ {
+ m_current_value = value;
+ }
+
+ void
+ SetDefaultValue (lldb::LanguageType value)
+ {
+ m_default_value = value;
+ }
+
+protected:
+ lldb::LanguageType m_current_value;
+ lldb::LanguageType m_default_value;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueLanguage_h_
diff --git a/include/lldb/Interpreter/OptionValuePathMappings.h b/include/lldb/Interpreter/OptionValuePathMappings.h
index 7ebf4947c6af..7b476a9cd366 100644
--- a/include/lldb/Interpreter/OptionValuePathMappings.h
+++ b/include/lldb/Interpreter/OptionValuePathMappings.h
@@ -48,7 +48,7 @@ public:
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
- SetValueFromCString (const char *value,
+ SetValueFromString (llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
diff --git a/include/lldb/Interpreter/OptionValueProperties.h b/include/lldb/Interpreter/OptionValueProperties.h
index 6f7f4995ed15..405beefff6d1 100644
--- a/include/lldb/Interpreter/OptionValueProperties.h
+++ b/include/lldb/Interpreter/OptionValueProperties.h
@@ -61,7 +61,7 @@ public:
DeepCopy () const;
virtual Error
- SetValueFromCString (const char *value, VarSetOperationType op = eVarSetOperationAssign);
+ SetValueFromString (llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign);
virtual void
DumpValue (const ExecutionContext *exe_ctx,
diff --git a/include/lldb/Interpreter/OptionValueRegex.h b/include/lldb/Interpreter/OptionValueRegex.h
index 295bb98b69e6..5e04218dbfdf 100644
--- a/include/lldb/Interpreter/OptionValueRegex.h
+++ b/include/lldb/Interpreter/OptionValueRegex.h
@@ -49,7 +49,7 @@ public:
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
- SetValueFromCString (const char *value,
+ SetValueFromString (llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
diff --git a/include/lldb/Interpreter/OptionValueSInt64.h b/include/lldb/Interpreter/OptionValueSInt64.h
index 8bc8fb2da2d5..36ae97ccfcf8 100644
--- a/include/lldb/Interpreter/OptionValueSInt64.h
+++ b/include/lldb/Interpreter/OptionValueSInt64.h
@@ -77,7 +77,7 @@ public:
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
- SetValueFromCString (const char *value,
+ SetValueFromString (llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
diff --git a/include/lldb/Interpreter/OptionValueString.h b/include/lldb/Interpreter/OptionValueString.h
index a82e1403b74b..c75745d402be 100644
--- a/include/lldb/Interpreter/OptionValueString.h
+++ b/include/lldb/Interpreter/OptionValueString.h
@@ -137,7 +137,7 @@ public:
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
- SetValueFromCString (const char *value,
+ SetValueFromString (llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
diff --git a/include/lldb/Interpreter/OptionValueUInt64.h b/include/lldb/Interpreter/OptionValueUInt64.h
index 9b5496f9835c..51ff8818dcff 100644
--- a/include/lldb/Interpreter/OptionValueUInt64.h
+++ b/include/lldb/Interpreter/OptionValueUInt64.h
@@ -70,7 +70,7 @@ public:
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
- SetValueFromCString (const char *value,
+ SetValueFromString (llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
diff --git a/include/lldb/Interpreter/OptionValueUUID.h b/include/lldb/Interpreter/OptionValueUUID.h
index caf436e576f5..c6ab48a627f6 100644
--- a/include/lldb/Interpreter/OptionValueUUID.h
+++ b/include/lldb/Interpreter/OptionValueUUID.h
@@ -53,7 +53,7 @@ public:
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
- SetValueFromCString (const char *value,
+ SetValueFromString (llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
diff --git a/include/lldb/Interpreter/OptionValues.h b/include/lldb/Interpreter/OptionValues.h
index 2ccab994674b..44e1f0975826 100644
--- a/include/lldb/Interpreter/OptionValues.h
+++ b/include/lldb/Interpreter/OptionValues.h
@@ -21,6 +21,7 @@
#include "lldb/Interpreter/OptionValueFileSpec.h"
#include "lldb/Interpreter/OptionValueFileSpecList.h"
#include "lldb/Interpreter/OptionValueFormat.h"
+#include "lldb/Interpreter/OptionValueLanguage.h"
#include "lldb/Interpreter/OptionValueFormatEntity.h"
#include "lldb/Interpreter/OptionValuePathMappings.h"
#include "lldb/Interpreter/OptionValueProperties.h"
diff --git a/include/lldb/Interpreter/PythonDataObjects.h b/include/lldb/Interpreter/PythonDataObjects.h
index a1145b6f33d9..df281b533cba 100644
--- a/include/lldb/Interpreter/PythonDataObjects.h
+++ b/include/lldb/Interpreter/PythonDataObjects.h
@@ -17,12 +17,61 @@
// Project includes
#include "lldb/lldb-defines.h"
#include "lldb/Core/ConstString.h"
+#include "lldb/Core/StructuredData.h"
#include "lldb/Core/Flags.h"
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/lldb-python.h"
namespace lldb_private {
-
+class PythonString;
+class PythonList;
+class PythonDictionary;
+class PythonObject;
+class PythonInteger;
+
+class StructuredPythonObject : public StructuredData::Generic
+{
+ public:
+ StructuredPythonObject()
+ : StructuredData::Generic()
+ {
+ }
+
+ StructuredPythonObject(void *obj)
+ : StructuredData::Generic(obj)
+ {
+ Py_XINCREF(GetValue());
+ }
+
+ virtual ~StructuredPythonObject()
+ {
+ if (Py_IsInitialized())
+ Py_XDECREF(GetValue());
+ SetValue(nullptr);
+ }
+
+ bool
+ IsValid() const override
+ {
+ return GetValue() && GetValue() != Py_None;
+ }
+
+ void Dump(Stream &s) const override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(StructuredPythonObject);
+};
+
+enum class PyObjectType
+{
+ Unknown,
+ None,
+ Integer,
+ Dictionary,
+ List,
+ String
+};
+
class PythonObject
{
public:
@@ -42,8 +91,6 @@ namespace lldb_private {
{
Reset (rhs.m_py_obj);
}
-
- explicit PythonObject (const lldb::ScriptInterpreterObjectSP &script_object_sp);
virtual
~PythonObject ()
@@ -89,6 +136,8 @@ namespace lldb_private {
return m_py_obj;
}
+ PyObjectType GetObjectType() const;
+
PythonString
Repr ();
@@ -102,7 +151,9 @@ namespace lldb_private {
bool
IsNULLOrNone () const;
-
+
+ StructuredData::ObjectSP CreateStructuredObject() const;
+
protected:
PyObject* m_py_obj;
};
@@ -110,25 +161,25 @@ namespace lldb_private {
class PythonString: public PythonObject
{
public:
-
PythonString ();
PythonString (PyObject *o);
PythonString (const PythonObject &object);
- PythonString (const lldb::ScriptInterpreterObjectSP &script_object_sp);
- PythonString (const char* string);
+ PythonString (llvm::StringRef string);
+ PythonString (const char *string);
virtual ~PythonString ();
-
+
virtual bool
Reset (PyObject* py_obj = NULL);
- const char*
+ llvm::StringRef
GetString() const;
size_t
GetSize() const;
- void
- SetString (const char* string);
+ void SetString(llvm::StringRef string);
+
+ StructuredData::StringSP CreateStructuredString() const;
};
class PythonInteger: public PythonObject
@@ -138,18 +189,18 @@ namespace lldb_private {
PythonInteger ();
PythonInteger (PyObject* py_obj);
PythonInteger (const PythonObject &object);
- PythonInteger (const lldb::ScriptInterpreterObjectSP &script_object_sp);
PythonInteger (int64_t value);
virtual ~PythonInteger ();
virtual bool
Reset (PyObject* py_obj = NULL);
-
- int64_t
- GetInteger();
-
+
+ int64_t GetInteger() const;
+
void
SetInteger (int64_t value);
+
+ StructuredData::IntegerSP CreateStructuredInteger() const;
};
class PythonList: public PythonObject
@@ -159,24 +210,23 @@ namespace lldb_private {
PythonList (bool create_empty);
PythonList (PyObject* py_obj);
PythonList (const PythonObject &object);
- PythonList (const lldb::ScriptInterpreterObjectSP &script_object_sp);
PythonList (uint32_t count);
virtual ~PythonList ();
virtual bool
Reset (PyObject* py_obj = NULL);
-
- uint32_t
- GetSize();
-
- PythonObject
- GetItemAtIndex (uint32_t index);
-
+
+ uint32_t GetSize() const;
+
+ PythonObject GetItemAtIndex(uint32_t index) const;
+
void
SetItemAtIndex (uint32_t index, const PythonObject &object);
void
AppendItem (const PythonObject &object);
+
+ StructuredData::ArraySP CreateStructuredArray() const;
};
class PythonDictionary: public PythonObject
@@ -186,14 +236,13 @@ namespace lldb_private {
explicit PythonDictionary (bool create_empty);
PythonDictionary (PyObject* object);
PythonDictionary (const PythonObject &object);
- PythonDictionary (const lldb::ScriptInterpreterObjectSP &script_object_sp);
virtual ~PythonDictionary ();
virtual bool
Reset (PyObject* object = NULL);
-
- uint32_t GetSize();
-
+
+ uint32_t GetSize() const;
+
PythonObject
GetItemForKey (const PythonString &key) const;
@@ -222,6 +271,8 @@ namespace lldb_private {
void
SetItemForKey (const PythonString &key, const PythonObject& value);
+
+ StructuredData::DictionarySP CreateStructuredDictionary() const;
};
} // namespace lldb_private
diff --git a/include/lldb/Interpreter/ScriptInterpreter.h b/include/lldb/Interpreter/ScriptInterpreter.h
index 1b4b88161927..0f45dd8245e9 100644
--- a/include/lldb/Interpreter/ScriptInterpreter.h
+++ b/include/lldb/Interpreter/ScriptInterpreter.h
@@ -14,53 +14,12 @@
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Error.h"
+#include "lldb/Core/StructuredData.h"
#include "lldb/Utility/PseudoTerminal.h"
namespace lldb_private {
-
-class ScriptInterpreterObject
-{
-public:
- ScriptInterpreterObject() :
- m_object(NULL)
- {}
-
- ScriptInterpreterObject(void* obj) :
- m_object(obj)
- {}
-
- ScriptInterpreterObject(const ScriptInterpreterObject& rhs)
- : m_object(rhs.m_object)
- {}
-
- virtual void*
- GetObject()
- {
- return m_object;
- }
-
- explicit operator bool ()
- {
- return m_object != NULL;
- }
-
- ScriptInterpreterObject&
- operator = (const ScriptInterpreterObject& rhs)
- {
- if (this != &rhs)
- m_object = rhs.m_object;
- return *this;
- }
-
- virtual
- ~ScriptInterpreterObject()
- {}
-
-protected:
- void* m_object;
-};
class ScriptInterpreterLocker
{
@@ -82,87 +41,6 @@ class ScriptInterpreter
{
public:
- typedef void (*SWIGInitCallback) (void);
-
- typedef bool (*SWIGBreakpointCallbackFunction) (const char *python_function_name,
- const char *session_dictionary_name,
- const lldb::StackFrameSP& frame_sp,
- const lldb::BreakpointLocationSP &bp_loc_sp);
-
- typedef bool (*SWIGWatchpointCallbackFunction) (const char *python_function_name,
- const char *session_dictionary_name,
- const lldb::StackFrameSP& frame_sp,
- const lldb::WatchpointSP &wp_sp);
-
- typedef bool (*SWIGPythonTypeScriptCallbackFunction) (const char *python_function_name,
- void *session_dictionary,
- const lldb::ValueObjectSP& valobj_sp,
- void** pyfunct_wrapper,
- const lldb::TypeSummaryOptionsSP& options,
- std::string& retval);
-
- typedef void* (*SWIGPythonCreateSyntheticProvider) (const char *python_class_name,
- const char *session_dictionary_name,
- const lldb::ValueObjectSP& valobj_sp);
-
- typedef void* (*SWIGPythonCreateScriptedThreadPlan) (const char *python_class_name,
- const char *session_dictionary_name,
- const lldb::ThreadPlanSP& thread_plan_sp);
-
- typedef bool (*SWIGPythonCallThreadPlan) (void *implementor, const char *method_name, Event *event_sp, bool &got_error);
-
- typedef void* (*SWIGPythonCreateOSPlugin) (const char *python_class_name,
- const char *session_dictionary_name,
- const lldb::ProcessSP& process_sp);
-
- typedef uint32_t (*SWIGPythonCalculateNumChildren) (void *implementor);
- typedef void* (*SWIGPythonGetChildAtIndex) (void *implementor, uint32_t idx);
- typedef int (*SWIGPythonGetIndexOfChildWithName) (void *implementor, const char* child_name);
- typedef void* (*SWIGPythonCastPyObjectToSBValue) (void* data);
- typedef lldb::ValueObjectSP (*SWIGPythonGetValueObjectSPFromSBValue) (void* data);
- typedef bool (*SWIGPythonUpdateSynthProviderInstance) (void* data);
- typedef bool (*SWIGPythonMightHaveChildrenSynthProviderInstance) (void* data);
- typedef void* (*SWIGPythonGetValueSynthProviderInstance) (void *implementor);
-
- typedef bool (*SWIGPythonCallCommand) (const char *python_function_name,
- const char *session_dictionary_name,
- lldb::DebuggerSP& debugger,
- const char* args,
- lldb_private::CommandReturnObject& cmd_retobj,
- lldb::ExecutionContextRefSP exe_ctx_ref_sp);
-
- typedef bool (*SWIGPythonCallModuleInit) (const char *python_module_name,
- const char *session_dictionary_name,
- lldb::DebuggerSP& debugger);
-
- typedef bool (*SWIGPythonScriptKeyword_Process) (const char* python_function_name,
- const char* session_dictionary_name,
- lldb::ProcessSP& process,
- std::string& output);
- typedef bool (*SWIGPythonScriptKeyword_Thread) (const char* python_function_name,
- const char* session_dictionary_name,
- lldb::ThreadSP& thread,
- std::string& output);
-
- typedef bool (*SWIGPythonScriptKeyword_Target) (const char* python_function_name,
- const char* session_dictionary_name,
- lldb::TargetSP& target,
- std::string& output);
-
- typedef bool (*SWIGPythonScriptKeyword_Frame) (const char* python_function_name,
- const char* session_dictionary_name,
- lldb::StackFrameSP& frame,
- std::string& output);
-
- typedef bool (*SWIGPythonScriptKeyword_Value) (const char* python_function_name,
- const char* session_dictionary_name,
- lldb::ValueObjectSP& value,
- std::string& output);
-
- typedef void* (*SWIGPython_GetDynamicSetting) (void* module,
- const char* setting,
- const lldb::TargetSP& target_sp);
-
typedef enum
{
eScriptReturnTypeCharPtr,
@@ -324,95 +202,87 @@ public:
{
return false;
}
-
- virtual lldb::ScriptInterpreterObjectSP
- CreateSyntheticScriptedProvider (const char *class_name,
- lldb::ValueObjectSP valobj)
+
+ virtual StructuredData::ObjectSP
+ CreateSyntheticScriptedProvider(const char *class_name, lldb::ValueObjectSP valobj)
{
- return lldb::ScriptInterpreterObjectSP();
+ return StructuredData::ObjectSP();
}
-
- virtual lldb::ScriptInterpreterObjectSP
+
+ virtual StructuredData::GenericSP
+ CreateScriptCommandObject (const char *class_name)
+ {
+ return StructuredData::GenericSP();
+ }
+
+ virtual StructuredData::GenericSP
OSPlugin_CreatePluginObject (const char *class_name,
lldb::ProcessSP process_sp)
{
- return lldb::ScriptInterpreterObjectSP();
+ return StructuredData::GenericSP();
}
-
- virtual lldb::ScriptInterpreterObjectSP
- OSPlugin_RegisterInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp)
+
+ virtual StructuredData::DictionarySP
+ OSPlugin_RegisterInfo(StructuredData::ObjectSP os_plugin_object_sp)
{
- return lldb::ScriptInterpreterObjectSP();
+ return StructuredData::DictionarySP();
}
-
- virtual lldb::ScriptInterpreterObjectSP
- OSPlugin_ThreadsInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp)
+
+ virtual StructuredData::ArraySP
+ OSPlugin_ThreadsInfo(StructuredData::ObjectSP os_plugin_object_sp)
{
- return lldb::ScriptInterpreterObjectSP();
+ return StructuredData::ArraySP();
}
-
- virtual lldb::ScriptInterpreterObjectSP
- OSPlugin_RegisterContextData (lldb::ScriptInterpreterObjectSP os_plugin_object_sp,
- lldb::tid_t thread_id)
+
+ virtual StructuredData::StringSP
+ OSPlugin_RegisterContextData(StructuredData::ObjectSP os_plugin_object_sp, lldb::tid_t thread_id)
{
- return lldb::ScriptInterpreterObjectSP();
+ return StructuredData::StringSP();
}
- virtual lldb::ScriptInterpreterObjectSP
- OSPlugin_CreateThread (lldb::ScriptInterpreterObjectSP os_plugin_object_sp,
- lldb::tid_t tid,
- lldb::addr_t context)
+ virtual StructuredData::DictionarySP
+ OSPlugin_CreateThread(StructuredData::ObjectSP os_plugin_object_sp, lldb::tid_t tid, lldb::addr_t context)
{
- return lldb::ScriptInterpreterObjectSP();
+ return StructuredData::DictionarySP();
}
-
- virtual lldb::ScriptInterpreterObjectSP
- CreateScriptedThreadPlan (const char *class_name,
- lldb::ThreadPlanSP thread_plan_sp)
+
+ virtual StructuredData::ObjectSP
+ CreateScriptedThreadPlan(const char *class_name, lldb::ThreadPlanSP thread_plan_sp)
{
- return lldb::ScriptInterpreterObjectSP();
+ return StructuredData::ObjectSP();
}
virtual bool
- ScriptedThreadPlanExplainsStop (lldb::ScriptInterpreterObjectSP implementor_sp,
- Event *event,
- bool &script_error)
+ ScriptedThreadPlanExplainsStop(StructuredData::ObjectSP implementor_sp, Event *event, bool &script_error)
{
script_error = true;
return true;
}
virtual bool
- ScriptedThreadPlanShouldStop (lldb::ScriptInterpreterObjectSP implementor_sp,
- Event *event,
- bool &script_error)
+ ScriptedThreadPlanShouldStop(StructuredData::ObjectSP implementor_sp, Event *event, bool &script_error)
{
script_error = true;
return true;
}
virtual lldb::StateType
- ScriptedThreadPlanGetRunState (lldb::ScriptInterpreterObjectSP implementor_sp,
- bool &script_error)
+ ScriptedThreadPlanGetRunState(StructuredData::ObjectSP implementor_sp, bool &script_error)
{
script_error = true;
return lldb::eStateStepping;
}
- virtual lldb::ScriptInterpreterObjectSP
- LoadPluginModule (const FileSpec& file_spec,
- lldb_private::Error& error)
+ virtual StructuredData::ObjectSP
+ LoadPluginModule(const FileSpec &file_spec, lldb_private::Error &error)
{
- return lldb::ScriptInterpreterObjectSP();
+ return StructuredData::ObjectSP();
}
-
- virtual lldb::ScriptInterpreterObjectSP
- GetDynamicSettings (lldb::ScriptInterpreterObjectSP plugin_module_sp,
- Target* target,
- const char* setting_name,
- lldb_private::Error& error)
+
+ virtual StructuredData::DictionarySP
+ GetDynamicSettings(StructuredData::ObjectSP plugin_module_sp, Target *target, const char *setting_name, lldb_private::Error &error)
{
- return lldb::ScriptInterpreterObjectSP();
+ return StructuredData::DictionarySP();
}
virtual Error
@@ -464,13 +334,10 @@ public:
{
return;
}
-
+
virtual bool
- GetScriptedSummary (const char *function_name,
- lldb::ValueObjectSP valobj,
- lldb::ScriptInterpreterObjectSP& callee_wrapper_sp,
- const TypeSummaryOptions& options,
- std::string& retval)
+ GetScriptedSummary(const char *function_name, lldb::ValueObjectSP valobj, StructuredData::ObjectSP &callee_wrapper_sp,
+ const TypeSummaryOptions &options, std::string &retval)
{
return false;
}
@@ -480,39 +347,39 @@ public:
{
// Clean up any ref counts to SBObjects that might be in global variables
}
-
+
virtual size_t
- CalculateNumChildren (const lldb::ScriptInterpreterObjectSP& implementor)
+ CalculateNumChildren(const StructuredData::ObjectSP &implementor)
{
return 0;
}
-
+
virtual lldb::ValueObjectSP
- GetChildAtIndex (const lldb::ScriptInterpreterObjectSP& implementor, uint32_t idx)
+ GetChildAtIndex(const StructuredData::ObjectSP &implementor, uint32_t idx)
{
return lldb::ValueObjectSP();
}
-
+
virtual int
- GetIndexOfChildWithName (const lldb::ScriptInterpreterObjectSP& implementor, const char* child_name)
+ GetIndexOfChildWithName(const StructuredData::ObjectSP &implementor, const char *child_name)
{
return UINT32_MAX;
}
-
+
virtual bool
- UpdateSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor)
+ UpdateSynthProviderInstance(const StructuredData::ObjectSP &implementor)
{
return false;
}
-
+
virtual bool
- MightHaveChildrenSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor)
+ MightHaveChildrenSynthProviderInstance(const StructuredData::ObjectSP &implementor)
{
return true;
}
-
+
virtual lldb::ValueObjectSP
- GetSyntheticValue (const lldb::ScriptInterpreterObjectSP& implementor)
+ GetSyntheticValue(const StructuredData::ObjectSP &implementor)
{
return nullptr;
}
@@ -529,6 +396,17 @@ public:
}
virtual bool
+ RunScriptBasedCommand (StructuredData::GenericSP impl_obj_sp,
+ const char* args,
+ ScriptedCommandSynchronicity synchronicity,
+ lldb_private::CommandReturnObject& cmd_retobj,
+ Error& error,
+ const lldb_private::ExecutionContext& exe_ctx)
+ {
+ return false;
+ }
+
+ virtual bool
RunScriptFormatKeyword (const char* impl_function,
Process* process,
std::string& output,
@@ -586,26 +464,45 @@ public:
}
virtual bool
+ GetShortHelpForCommandObject (StructuredData::GenericSP cmd_obj_sp,
+ std::string& dest)
+ {
+ dest.clear();
+ return false;
+ }
+
+ virtual uint32_t
+ GetFlagsForCommandObject (StructuredData::GenericSP cmd_obj_sp)
+ {
+ return 0;
+ }
+
+ virtual bool
+ GetLongHelpForCommandObject (StructuredData::GenericSP cmd_obj_sp,
+ std::string& dest)
+ {
+ dest.clear();
+ return false;
+ }
+
+ virtual bool
CheckObjectExists (const char* name)
{
return false;
}
virtual bool
- LoadScriptingModule (const char* filename,
- bool can_reload,
- bool init_session,
- lldb_private::Error& error,
- lldb::ScriptInterpreterObjectSP* module_sp = nullptr)
+ LoadScriptingModule(const char *filename, bool can_reload, bool init_session, lldb_private::Error &error,
+ StructuredData::ObjectSP *module_sp = nullptr)
{
error.SetErrorString("loading unimplemented");
return false;
}
-
- virtual lldb::ScriptInterpreterObjectSP
- MakeScriptObject (void* object)
+
+ virtual bool
+ IsReservedWord (const char* word)
{
- return lldb::ScriptInterpreterObjectSP(new ScriptInterpreterObject(object));
+ return false;
}
virtual std::unique_ptr<ScriptInterpreterLocker>
@@ -622,32 +519,6 @@ public:
static std::string
LanguageToString (lldb::ScriptLanguage language);
-
- static void
- InitializeInterpreter (SWIGInitCallback python_swig_init_callback,
- SWIGBreakpointCallbackFunction swig_breakpoint_callback,
- SWIGWatchpointCallbackFunction swig_watchpoint_callback,
- SWIGPythonTypeScriptCallbackFunction swig_typescript_callback,
- SWIGPythonCreateSyntheticProvider swig_synthetic_script,
- SWIGPythonCalculateNumChildren swig_calc_children,
- SWIGPythonGetChildAtIndex swig_get_child_index,
- SWIGPythonGetIndexOfChildWithName swig_get_index_child,
- SWIGPythonCastPyObjectToSBValue swig_cast_to_sbvalue ,
- SWIGPythonGetValueObjectSPFromSBValue swig_get_valobj_sp_from_sbvalue,
- SWIGPythonUpdateSynthProviderInstance swig_update_provider,
- SWIGPythonMightHaveChildrenSynthProviderInstance swig_mighthavechildren_provider,
- SWIGPythonGetValueSynthProviderInstance swig_getvalue_provider,
- SWIGPythonCallCommand swig_call_command,
- SWIGPythonCallModuleInit swig_call_module_init,
- SWIGPythonCreateOSPlugin swig_create_os_plugin,
- SWIGPythonScriptKeyword_Process swig_run_script_keyword_process,
- SWIGPythonScriptKeyword_Thread swig_run_script_keyword_thread,
- SWIGPythonScriptKeyword_Target swig_run_script_keyword_target,
- SWIGPythonScriptKeyword_Frame swig_run_script_keyword_frame,
- SWIGPythonScriptKeyword_Value swig_run_script_keyword_value,
- SWIGPython_GetDynamicSetting swig_plugin_get,
- SWIGPythonCreateScriptedThreadPlan swig_thread_plan_script,
- SWIGPythonCallThreadPlan swig_call_thread_plan);
virtual void
ResetOutputFileHandle (FILE *new_fh) { } //By default, do nothing.
diff --git a/include/lldb/Interpreter/ScriptInterpreterPython.h b/include/lldb/Interpreter/ScriptInterpreterPython.h
index 94ed16e02ca2..058058ecccb5 100644
--- a/include/lldb/Interpreter/ScriptInterpreterPython.h
+++ b/include/lldb/Interpreter/ScriptInterpreterPython.h
@@ -33,8 +33,99 @@ class ScriptInterpreterPython :
public IOHandlerDelegateMultiline
{
public:
-
- friend class IOHandlerPythonInterpreter;
+ typedef void (*SWIGInitCallback) (void);
+
+ typedef bool (*SWIGBreakpointCallbackFunction) (const char *python_function_name,
+ const char *session_dictionary_name,
+ const lldb::StackFrameSP& frame_sp,
+ const lldb::BreakpointLocationSP &bp_loc_sp);
+
+ typedef bool (*SWIGWatchpointCallbackFunction) (const char *python_function_name,
+ const char *session_dictionary_name,
+ const lldb::StackFrameSP& frame_sp,
+ const lldb::WatchpointSP &wp_sp);
+
+ typedef bool (*SWIGPythonTypeScriptCallbackFunction) (const char *python_function_name,
+ void *session_dictionary,
+ const lldb::ValueObjectSP& valobj_sp,
+ void** pyfunct_wrapper,
+ const lldb::TypeSummaryOptionsSP& options,
+ std::string& retval);
+
+ typedef void* (*SWIGPythonCreateSyntheticProvider) (const char *python_class_name,
+ const char *session_dictionary_name,
+ const lldb::ValueObjectSP& valobj_sp);
+
+ typedef void* (*SWIGPythonCreateCommandObject) (const char *python_class_name,
+ const char *session_dictionary_name,
+ const lldb::DebuggerSP debugger_sp);
+
+ typedef void* (*SWIGPythonCreateScriptedThreadPlan) (const char *python_class_name,
+ const char *session_dictionary_name,
+ const lldb::ThreadPlanSP& thread_plan_sp);
+
+ typedef bool (*SWIGPythonCallThreadPlan) (void *implementor, const char *method_name, Event *event_sp, bool &got_error);
+
+ typedef void* (*SWIGPythonCreateOSPlugin) (const char *python_class_name,
+ const char *session_dictionary_name,
+ const lldb::ProcessSP& process_sp);
+
+ typedef size_t (*SWIGPythonCalculateNumChildren) (void *implementor);
+ typedef void* (*SWIGPythonGetChildAtIndex) (void *implementor, uint32_t idx);
+ typedef int (*SWIGPythonGetIndexOfChildWithName) (void *implementor, const char* child_name);
+ typedef void* (*SWIGPythonCastPyObjectToSBValue) (void* data);
+ typedef lldb::ValueObjectSP (*SWIGPythonGetValueObjectSPFromSBValue) (void* data);
+ typedef bool (*SWIGPythonUpdateSynthProviderInstance) (void* data);
+ typedef bool (*SWIGPythonMightHaveChildrenSynthProviderInstance) (void* data);
+ typedef void* (*SWIGPythonGetValueSynthProviderInstance) (void *implementor);
+
+ typedef bool (*SWIGPythonCallCommand) (const char *python_function_name,
+ const char *session_dictionary_name,
+ lldb::DebuggerSP& debugger,
+ const char* args,
+ lldb_private::CommandReturnObject& cmd_retobj,
+ lldb::ExecutionContextRefSP exe_ctx_ref_sp);
+
+ typedef bool (*SWIGPythonCallCommandObject) (void *implementor,
+ lldb::DebuggerSP& debugger,
+ const char* args,
+ lldb_private::CommandReturnObject& cmd_retobj,
+ lldb::ExecutionContextRefSP exe_ctx_ref_sp);
+
+
+ typedef bool (*SWIGPythonCallModuleInit) (const char *python_module_name,
+ const char *session_dictionary_name,
+ lldb::DebuggerSP& debugger);
+
+ typedef bool (*SWIGPythonScriptKeyword_Process) (const char* python_function_name,
+ const char* session_dictionary_name,
+ lldb::ProcessSP& process,
+ std::string& output);
+ typedef bool (*SWIGPythonScriptKeyword_Thread) (const char* python_function_name,
+ const char* session_dictionary_name,
+ lldb::ThreadSP& thread,
+ std::string& output);
+
+ typedef bool (*SWIGPythonScriptKeyword_Target) (const char* python_function_name,
+ const char* session_dictionary_name,
+ lldb::TargetSP& target,
+ std::string& output);
+
+ typedef bool (*SWIGPythonScriptKeyword_Frame) (const char* python_function_name,
+ const char* session_dictionary_name,
+ lldb::StackFrameSP& frame,
+ std::string& output);
+
+ typedef bool (*SWIGPythonScriptKeyword_Value) (const char* python_function_name,
+ const char* session_dictionary_name,
+ lldb::ValueObjectSP& value,
+ std::string& output);
+
+ typedef void* (*SWIGPython_GetDynamicSetting) (void* module,
+ const char* setting,
+ const lldb::TargetSP& target_sp);
+
+ friend class ::IOHandlerPythonInterpreter;
ScriptInterpreterPython (CommandInterpreter &interpreter);
@@ -79,74 +170,45 @@ public:
bool
GenerateScriptAliasFunction (StringList &input, std::string& output) override;
-
- lldb::ScriptInterpreterObjectSP
- CreateSyntheticScriptedProvider (const char *class_name,
- lldb::ValueObjectSP valobj) override;
- lldb::ScriptInterpreterObjectSP
- CreateScriptedThreadPlan (const char *class_name,
- lldb::ThreadPlanSP thread_plan) override;
+ StructuredData::ObjectSP CreateSyntheticScriptedProvider(const char *class_name, lldb::ValueObjectSP valobj) override;
+
+ StructuredData::GenericSP CreateScriptCommandObject (const char *class_name) override;
+
+ StructuredData::ObjectSP CreateScriptedThreadPlan(const char *class_name, lldb::ThreadPlanSP thread_plan) override;
+
+ bool ScriptedThreadPlanExplainsStop(StructuredData::ObjectSP implementor_sp, Event *event, bool &script_error) override;
+ bool ScriptedThreadPlanShouldStop(StructuredData::ObjectSP implementor_sp, Event *event, bool &script_error) override;
+ lldb::StateType ScriptedThreadPlanGetRunState(StructuredData::ObjectSP implementor_sp, bool &script_error) override;
+
+ StructuredData::GenericSP OSPlugin_CreatePluginObject(const char *class_name, lldb::ProcessSP process_sp) override;
+
+ StructuredData::DictionarySP OSPlugin_RegisterInfo(StructuredData::ObjectSP os_plugin_object_sp) override;
+
+ StructuredData::ArraySP OSPlugin_ThreadsInfo(StructuredData::ObjectSP os_plugin_object_sp) override;
+
+ StructuredData::StringSP OSPlugin_RegisterContextData(StructuredData::ObjectSP os_plugin_object_sp, lldb::tid_t thread_id) override;
+
+ StructuredData::DictionarySP OSPlugin_CreateThread(StructuredData::ObjectSP os_plugin_object_sp, lldb::tid_t tid,
+ lldb::addr_t context) override;
+
+ StructuredData::ObjectSP LoadPluginModule(const FileSpec &file_spec, lldb_private::Error &error) override;
+
+ StructuredData::DictionarySP GetDynamicSettings(StructuredData::ObjectSP plugin_module_sp, Target *target, const char *setting_name,
+ lldb_private::Error &error) override;
+
+ size_t CalculateNumChildren(const StructuredData::ObjectSP &implementor) override;
+
+ lldb::ValueObjectSP GetChildAtIndex(const StructuredData::ObjectSP &implementor, uint32_t idx) override;
+
+ int GetIndexOfChildWithName(const StructuredData::ObjectSP &implementor, const char *child_name) override;
+
+ bool UpdateSynthProviderInstance(const StructuredData::ObjectSP &implementor) override;
+
+ bool MightHaveChildrenSynthProviderInstance(const StructuredData::ObjectSP &implementor) override;
+
+ lldb::ValueObjectSP GetSyntheticValue(const StructuredData::ObjectSP &implementor) override;
- bool
- ScriptedThreadPlanExplainsStop (lldb::ScriptInterpreterObjectSP implementor_sp,
- Event *event,
- bool &script_error) override;
- bool
- ScriptedThreadPlanShouldStop (lldb::ScriptInterpreterObjectSP implementor_sp,
- Event *event,
- bool &script_error) override;
- lldb::StateType
- ScriptedThreadPlanGetRunState (lldb::ScriptInterpreterObjectSP implementor_sp,
- bool &script_error) override;
-
- lldb::ScriptInterpreterObjectSP
- OSPlugin_CreatePluginObject (const char *class_name,
- lldb::ProcessSP process_sp) override;
-
- lldb::ScriptInterpreterObjectSP
- OSPlugin_RegisterInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp) override;
-
- lldb::ScriptInterpreterObjectSP
- OSPlugin_ThreadsInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp) override;
-
- lldb::ScriptInterpreterObjectSP
- OSPlugin_RegisterContextData (lldb::ScriptInterpreterObjectSP os_plugin_object_sp,
- lldb::tid_t thread_id) override;
-
- lldb::ScriptInterpreterObjectSP
- OSPlugin_CreateThread (lldb::ScriptInterpreterObjectSP os_plugin_object_sp,
- lldb::tid_t tid,
- lldb::addr_t context) override;
-
- lldb::ScriptInterpreterObjectSP
- LoadPluginModule (const FileSpec& file_spec,
- lldb_private::Error& error) override;
-
- lldb::ScriptInterpreterObjectSP
- GetDynamicSettings (lldb::ScriptInterpreterObjectSP plugin_module_sp,
- Target* target,
- const char* setting_name,
- lldb_private::Error& error) override;
-
- size_t
- CalculateNumChildren (const lldb::ScriptInterpreterObjectSP& implementor) override;
-
- lldb::ValueObjectSP
- GetChildAtIndex (const lldb::ScriptInterpreterObjectSP& implementor, uint32_t idx) override;
-
- int
- GetIndexOfChildWithName (const lldb::ScriptInterpreterObjectSP& implementor, const char* child_name) override;
-
- bool
- UpdateSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor) override;
-
- bool
- MightHaveChildrenSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor) override;
-
- lldb::ValueObjectSP
- GetSyntheticValue (const lldb::ScriptInterpreterObjectSP& implementor) override;
-
bool
RunScriptBasedCommand(const char* impl_function,
const char* args,
@@ -155,6 +217,14 @@ public:
Error& error,
const lldb_private::ExecutionContext& exe_ctx) override;
+ bool
+ RunScriptBasedCommand (StructuredData::GenericSP impl_obj_sp,
+ const char* args,
+ ScriptedCommandSynchronicity synchronicity,
+ lldb_private::CommandReturnObject& cmd_retobj,
+ Error& error,
+ const lldb_private::ExecutionContext& exe_ctx) override;
+
Error
GenerateFunction(const char *signature, const StringList &input) override;
@@ -188,14 +258,10 @@ public:
WatchpointCallbackFunction (void *baton,
StoppointCallbackContext *context,
lldb::user_id_t watch_id);
-
- bool
- GetScriptedSummary (const char *function_name,
- lldb::ValueObjectSP valobj,
- lldb::ScriptInterpreterObjectSP& callee_wrapper_sp,
- const TypeSummaryOptions& options,
- std::string& retval) override;
-
+
+ bool GetScriptedSummary(const char *function_name, lldb::ValueObjectSP valobj, StructuredData::ObjectSP &callee_wrapper_sp,
+ const TypeSummaryOptions &options, std::string &retval) override;
+
void
Clear () override;
@@ -203,6 +269,15 @@ public:
GetDocumentationForItem (const char* item, std::string& dest) override;
bool
+ GetShortHelpForCommandObject(StructuredData::GenericSP cmd_obj_sp, std::string& dest) override;
+
+ uint32_t
+ GetFlagsForCommandObject (StructuredData::GenericSP cmd_obj_sp) override;
+
+ bool
+ GetLongHelpForCommandObject(StructuredData::GenericSP cmd_obj_sp, std::string& dest) override;
+
+ bool
CheckObjectExists (const char* name) override
{
if (!name || !name[0])
@@ -240,17 +315,13 @@ public:
ValueObject* value,
std::string& output,
Error& error) override;
-
+
+ bool LoadScriptingModule(const char *filename, bool can_reload, bool init_session, lldb_private::Error &error,
+ StructuredData::ObjectSP *module_sp = nullptr) override;
+
bool
- LoadScriptingModule (const char* filename,
- bool can_reload,
- bool init_session,
- lldb_private::Error& error,
- lldb::ScriptInterpreterObjectSP* module_sp = nullptr) override;
-
- lldb::ScriptInterpreterObjectSP
- MakeScriptObject (void* object) override;
-
+ IsReservedWord (const char* word) override;
+
std::unique_ptr<ScriptInterpreterLocker>
AcquireInterpreterLock () override;
@@ -278,10 +349,9 @@ public:
StringList
ReadCommandInputFromUser (FILE *in_file);
-
- virtual void
- ResetOutputFileHandle (FILE *new_fh) override;
-
+
+ void ResetOutputFileHandle(FILE *new_fh) override;
+
static void
InitializePrivate ();
@@ -291,6 +361,7 @@ public:
SWIGWatchpointCallbackFunction swig_watchpoint_callback,
SWIGPythonTypeScriptCallbackFunction swig_typescript_callback,
SWIGPythonCreateSyntheticProvider swig_synthetic_script,
+ SWIGPythonCreateCommandObject swig_create_cmd,
SWIGPythonCalculateNumChildren swig_calc_children,
SWIGPythonGetChildAtIndex swig_get_child_index,
SWIGPythonGetIndexOfChildWithName swig_get_index_child,
@@ -300,6 +371,7 @@ public:
SWIGPythonMightHaveChildrenSynthProviderInstance swig_mighthavechildren_provider,
SWIGPythonGetValueSynthProviderInstance swig_getvalue_provider,
SWIGPythonCallCommand swig_call_command,
+ SWIGPythonCallCommandObject swig_call_command_object,
SWIGPythonCallModuleInit swig_call_module_init,
SWIGPythonCreateOSPlugin swig_create_os_plugin,
SWIGPythonScriptKeyword_Process swig_run_script_keyword_process,
@@ -369,35 +441,6 @@ protected:
~SynchronicityHandler();
};
- class ScriptInterpreterPythonObject : public ScriptInterpreterObject
- {
- public:
- ScriptInterpreterPythonObject() :
- ScriptInterpreterObject()
- {}
-
- ScriptInterpreterPythonObject(void* obj) :
- ScriptInterpreterObject(obj)
- {
- Py_XINCREF(m_object);
- }
-
- explicit operator bool ()
- {
- return m_object && m_object != Py_None;
- }
-
-
- virtual
- ~ScriptInterpreterPythonObject()
- {
- if (Py_IsInitialized())
- Py_XDECREF(m_object);
- m_object = NULL;
- }
- private:
- DISALLOW_COPY_AND_ASSIGN (ScriptInterpreterPythonObject);
- };
public:
class Locker : public ScriptInterpreterLocker
{
@@ -450,6 +493,13 @@ public:
PyGILState_STATE m_GILState;
};
protected:
+ enum class AddLocation
+ {
+ Beginning,
+ End
+ };
+
+ static void AddToSysPath(AddLocation location, std::string path);
uint32_t
IsExecutingPython () const
diff --git a/include/lldb/Symbol/ClangASTContext.h b/include/lldb/Symbol/ClangASTContext.h
index a9096fe66151..a411e42fe0c5 100644
--- a/include/lldb/Symbol/ClangASTContext.h
+++ b/include/lldb/Symbol/ClangASTContext.h
@@ -235,7 +235,7 @@ public:
clang::IdentifierInfo &myIdent = ast->Idents.get(type_name.GetCString());
clang::DeclarationName myName = ast->DeclarationNames.getIdentifier(&myIdent);
- clang::DeclContext::lookup_const_result result = ast->getTranslationUnitDecl()->lookup(myName);
+ clang::DeclContext::lookup_result result = ast->getTranslationUnitDecl()->lookup(myName);
if (!result.empty())
{
diff --git a/include/lldb/Symbol/ClangASTType.h b/include/lldb/Symbol/ClangASTType.h
index 94c768780a00..2524751e092e 100644
--- a/include/lldb/Symbol/ClangASTType.h
+++ b/include/lldb/Symbol/ClangASTType.h
@@ -351,10 +351,10 @@ public:
//----------------------------------------------------------------------
uint64_t
- GetByteSize (ExecutionContext *exe_ctx) const;
+ GetByteSize (ExecutionContextScope *exe_scope) const;
uint64_t
- GetBitSize (ExecutionContext *exe_ctx) const;
+ GetBitSize (ExecutionContextScope *exe_scope) const;
lldb::Encoding
GetEncoding (uint64_t &count) const;
diff --git a/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h b/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
index 0c8121135ef0..41bb235636f0 100644
--- a/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
+++ b/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
@@ -34,13 +34,11 @@ public:
typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton, clang::ObjCInterfaceDecl *);
typedef void (*FindExternalVisibleDeclsByNameCallback)(void *baton, const clang::DeclContext *DC, clang::DeclarationName Name, llvm::SmallVectorImpl <clang::NamedDecl *> *results);
- typedef bool (*LayoutRecordTypeCallback)(void *baton,
- const clang::RecordDecl *Record,
- uint64_t &Size,
- uint64_t &Alignment,
- llvm::DenseMap <const clang::FieldDecl *, uint64_t> &FieldOffsets,
- llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
- llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets);
+ typedef bool (*LayoutRecordTypeCallback)(
+ void *baton, const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
+ llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets);
ClangExternalASTSourceCallbacks (CompleteTagDeclCallback tag_decl_callback,
CompleteObjCInterfaceDeclCallback objc_decl_callback,
@@ -59,39 +57,39 @@ public:
// clang::ExternalASTSource
//------------------------------------------------------------------
- virtual clang::Decl *
- GetExternalDecl (uint32_t ID)
+ clang::Decl *
+ GetExternalDecl(uint32_t ID) override
{
// This method only needs to be implemented if the AST source ever
// passes back decl sets as VisibleDeclaration objects.
return 0;
}
-
- virtual clang::Stmt *
- GetExternalDeclStmt (uint64_t Offset)
+
+ clang::Stmt *
+ GetExternalDeclStmt(uint64_t Offset) override
{
// This operation is meant to be used via a LazyOffsetPtr. It only
// needs to be implemented if the AST source uses methods like
// FunctionDecl::setLazyBody when building decls.
return 0;
}
-
- virtual clang::Selector
- GetExternalSelector (uint32_t ID)
+
+ clang::Selector
+ GetExternalSelector(uint32_t ID) override
{
// This operation only needs to be implemented if the AST source
// returns non-zero for GetNumKnownSelectors().
return clang::Selector();
}
- virtual uint32_t
- GetNumExternalSelectors()
+ uint32_t
+ GetNumExternalSelectors() override
{
return 0;
}
-
- virtual clang::CXXBaseSpecifier *
- GetExternalCXXBaseSpecifiers(uint64_t Offset)
+
+ clang::CXXBaseSpecifier *
+ GetExternalCXXBaseSpecifiers(uint64_t Offset) override
{
return NULL;
}
@@ -101,34 +99,26 @@ public:
{
return;
}
-
- virtual clang::ExternalLoadResult
- FindExternalLexicalDecls (const clang::DeclContext *decl_ctx,
- bool (*isKindWeWant)(clang::Decl::Kind),
- llvm::SmallVectorImpl<clang::Decl*> &decls)
+
+ clang::ExternalLoadResult
+ FindExternalLexicalDecls(const clang::DeclContext *decl_ctx, bool (*isKindWeWant)(clang::Decl::Kind),
+ llvm::SmallVectorImpl<clang::Decl *> &decls) override
{
// This is used to support iterating through an entire lexical context,
// which isn't something the debugger should ever need to do.
return clang::ELR_Failure;
}
-
- virtual bool
- FindExternalVisibleDeclsByName (const clang::DeclContext *decl_ctx,
- clang::DeclarationName decl_name);
-
- virtual void
- CompleteType (clang::TagDecl *tag_decl);
-
- virtual void
- CompleteType (clang::ObjCInterfaceDecl *objc_decl);
-
- bool
- layoutRecordType(const clang::RecordDecl *Record,
- uint64_t &Size,
- uint64_t &Alignment,
- llvm::DenseMap <const clang::FieldDecl *, uint64_t> &FieldOffsets,
- llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
- llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets);
+
+ bool FindExternalVisibleDeclsByName(const clang::DeclContext *decl_ctx, clang::DeclarationName decl_name) override;
+
+ void CompleteType(clang::TagDecl *tag_decl) override;
+
+ void CompleteType(clang::ObjCInterfaceDecl *objc_decl) override;
+
+ bool layoutRecordType(const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
+ llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets) override;
void
SetExternalSourceCallbacks (CompleteTagDeclCallback tag_decl_callback,
CompleteObjCInterfaceDeclCallback objc_decl_callback,
diff --git a/include/lldb/Symbol/CompileUnit.h b/include/lldb/Symbol/CompileUnit.h
index f9238ebba18c..e0c069352bf4 100644
--- a/include/lldb/Symbol/CompileUnit.h
+++ b/include/lldb/Symbol/CompileUnit.h
@@ -256,6 +256,18 @@ public:
//------------------------------------------------------------------
FileSpecList&
GetSupportFiles ();
+
+ //------------------------------------------------------------------
+ /// Get the compile unit's imported module list.
+ ///
+ /// This reports all the imports that the compile unit made,
+ /// including the current module.
+ ///
+ /// @return
+ /// A list of imported module names.
+ //------------------------------------------------------------------
+ const std::vector<ConstString> &
+ GetImportedModules ();
//------------------------------------------------------------------
/// Get the SymbolFile plug-in user data.
@@ -400,6 +412,8 @@ protected:
Flags m_flags; ///< Compile unit flags that help with partial parsing.
std::vector<lldb::FunctionSP> m_functions; ///< The sparsely populated list of shared pointers to functions
///< that gets populated as functions get partially parsed.
+ std::vector<ConstString> m_imported_modules; ///< All modules, including the current module, imported by this
+ ///< compile unit.
FileSpecList m_support_files; ///< Files associated with this compile unit's line table and declarations.
std::unique_ptr<LineTable> m_line_table_ap; ///< Line table that will get parsed on demand.
lldb::VariableListSP m_variables; ///< Global and static variable list that will get parsed on demand.
@@ -407,11 +421,12 @@ protected:
private:
enum
{
- flagsParsedAllFunctions = (1u << 0), ///< Have we already parsed all our functions
- flagsParsedVariables = (1u << 1), ///< Have we already parsed globals and statics?
- flagsParsedSupportFiles = (1u << 2), ///< Have we already parsed the support files for this compile unit?
- flagsParsedLineTable = (1u << 3), ///< Have we parsed the line table already?
- flagsParsedLanguage = (1u << 4) ///< Have we parsed the line table already?
+ flagsParsedAllFunctions = (1u << 0), ///< Have we already parsed all our functions
+ flagsParsedVariables = (1u << 1), ///< Have we already parsed globals and statics?
+ flagsParsedSupportFiles = (1u << 2), ///< Have we already parsed the support files for this compile unit?
+ flagsParsedLineTable = (1u << 3), ///< Have we parsed the line table already?
+ flagsParsedLanguage = (1u << 4), ///< Have we parsed the line table already?
+ flagsParsedImportedModules = (1u << 5) ///< Have we parsed the imported modules already?
};
DISALLOW_COPY_AND_ASSIGN (CompileUnit);
diff --git a/include/lldb/Symbol/DWARFCallFrameInfo.h b/include/lldb/Symbol/DWARFCallFrameInfo.h
index 27d1a52b49f8..cc497c039a4e 100644
--- a/include/lldb/Symbol/DWARFCallFrameInfo.h
+++ b/include/lldb/Symbol/DWARFCallFrameInfo.h
@@ -131,6 +131,16 @@ private:
void
GetCFIData();
+ // Applies the specified DWARF opcode to the given row. This function handle the commands
+ // operates only on a single row (these are the ones what can appear both in CIE and in FDE).
+ // Returns true if the opcode is handled and false otherwise.
+ bool
+ HandleCommonDwarfOpcode(uint8_t primary_opcode,
+ uint8_t extended_opcode,
+ int32_t data_align,
+ lldb::offset_t& offset,
+ UnwindPlan::Row& row);
+
ObjectFile& m_objfile;
lldb::SectionSP m_section_sp;
lldb::RegisterKind m_reg_kind;
diff --git a/include/lldb/Symbol/FuncUnwinders.h b/include/lldb/Symbol/FuncUnwinders.h
index 1e579c42acb8..0d4aabb5fd57 100644
--- a/include/lldb/Symbol/FuncUnwinders.h
+++ b/include/lldb/Symbol/FuncUnwinders.h
@@ -50,7 +50,7 @@ public:
GetUnwindPlanAtNonCallSite (Target& target, lldb_private::Thread& thread, int current_offset);
lldb::UnwindPlanSP
- GetUnwindPlanFastUnwind (lldb_private::Thread& Thread);
+ GetUnwindPlanFastUnwind (Target& target, lldb_private::Thread& thread);
lldb::UnwindPlanSP
GetUnwindPlanArchitectureDefault (lldb_private::Thread& thread);
@@ -111,7 +111,7 @@ public:
private:
lldb::UnwindAssemblySP
- GetUnwindAssemblyProfiler ();
+ GetUnwindAssemblyProfiler (Target& target);
UnwindTable& m_unwind_table;
AddressRange m_range;
diff --git a/include/lldb/Symbol/ObjectFile.h b/include/lldb/Symbol/ObjectFile.h
index 8bcf92de42e5..ff00ac26e67e 100644
--- a/include/lldb/Symbol/ObjectFile.h
+++ b/include/lldb/Symbol/ObjectFile.h
@@ -836,6 +836,13 @@ public:
{
return m_memory_addr != LLDB_INVALID_ADDRESS;
}
+
+ // Strip linker annotations (such as @@VERSION) from symbol names.
+ virtual std::string
+ StripLinkerSymbolAnnotations(llvm::StringRef symbol_name) const
+ {
+ return symbol_name.str();
+ }
protected:
//------------------------------------------------------------------
diff --git a/include/lldb/Symbol/Symbol.h b/include/lldb/Symbol/Symbol.h
index 0dd04b7112bc..ad11563634ea 100644
--- a/include/lldb/Symbol/Symbol.h
+++ b/include/lldb/Symbol/Symbol.h
@@ -39,11 +39,11 @@ public:
lldb::addr_t value,
lldb::addr_t size,
bool size_is_valid,
+ bool contains_linker_annotations,
uint32_t flags);
Symbol (uint32_t symID,
- const char *name,
- bool name_is_mangled,
+ const Mangled &mangled,
lldb::SymbolType type,
bool external,
bool is_debug,
@@ -51,6 +51,7 @@ public:
bool is_artificial,
const AddressRange &range,
bool size_is_valid,
+ bool contains_linker_annotations,
uint32_t flags);
Symbol (const Symbol& rhs);
@@ -71,25 +72,81 @@ public:
ValueIsAddress() const;
//------------------------------------------------------------------
- // Access the address value. Do NOT hand out the AddressRange as an
- // object as the byte size of the address range may not be filled in
- // and it should be accessed via GetByteSize().
+ // The GetAddressRef() accessor functions should only be called if
+ // you previously call ValueIsAddress() otherwise you might get an
+ // reference to an Address object that contains an constant integer
+ // value in m_addr_range.m_base_addr.m_offset which could be
+ // incorrectly used to represent an absolute address since it has
+ // no section.
//------------------------------------------------------------------
Address &
- GetAddress()
+ GetAddressRef()
+ {
+ return m_addr_range.GetBaseAddress();
+ }
+
+ const Address &
+ GetAddressRef() const
{
return m_addr_range.GetBaseAddress();
}
//------------------------------------------------------------------
+ // Makes sure the symbol's value is an address and returns the file
+ // address. Returns LLDB_INVALID_ADDRESS if the symbol's value isn't
+ // an address.
+ //------------------------------------------------------------------
+ lldb::addr_t
+ GetFileAddress () const;
+
+ //------------------------------------------------------------------
+ // Makes sure the symbol's value is an address and gets the load
+ // address using \a target if it is. Returns LLDB_INVALID_ADDRESS
+ // if the symbol's value isn't an address or if the section isn't
+ // loaded in \a target.
+ //------------------------------------------------------------------
+ lldb::addr_t
+ GetLoadAddress (Target *target) const;
+
+ //------------------------------------------------------------------
// Access the address value. Do NOT hand out the AddressRange as an
// object as the byte size of the address range may not be filled in
// and it should be accessed via GetByteSize().
//------------------------------------------------------------------
- const Address &
+ Address
GetAddress() const
{
- return m_addr_range.GetBaseAddress();
+ // Make sure the our value is an address before we hand a copy out.
+ // We use the Address inside m_addr_range to contain the value for
+ // symbols that are not address based symbols so we are using it
+ // for more than just addresses. For example undefined symbols on
+ // MacOSX have a nlist.n_value of 0 (zero) and this will get placed
+ // into m_addr_range.m_base_addr.m_offset and it will have no section.
+ // So in the GetAddress() accessor, we need to hand out an invalid
+ // address if the symbol's value isn't an address.
+ if (ValueIsAddress())
+ return m_addr_range.GetBaseAddress();
+ else
+ return Address();
+ }
+
+ // When a symbol's value isn't an address, we need to access the raw
+ // value. This function will ensure this symbol's value isn't an address
+ // and return the integer value if this checks out, otherwise it will
+ // return "fail_value" if the symbol is an address value.
+ uint64_t
+ GetIntegerValue (uint64_t fail_value = 0) const
+ {
+ if (ValueIsAddress())
+ {
+ // This symbol's value is an address. Use Symbol::GetAddress() to get the address.
+ return fail_value;
+ }
+ else
+ {
+ // The value is stored in the base address' offset
+ return m_addr_range.GetBaseAddress().GetOffset();
+ }
}
lldb::addr_t
@@ -131,7 +188,7 @@ public:
FileSpec
GetReExportedSymbolSharedLibrary () const;
- bool
+ void
SetReExportedSymbolName(const ConstString &name);
bool
@@ -272,6 +329,16 @@ public:
m_demangled_is_synthesized = b;
}
+ bool
+ ContainsLinkerAnnotations() const
+ {
+ return m_contains_linker_annotations;
+ }
+ void
+ SetContainsLinkerAnnotations(bool b)
+ {
+ m_contains_linker_annotations = b;
+ }
//------------------------------------------------------------------
/// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
///
@@ -325,7 +392,8 @@ protected:
m_size_is_synthesized:1,// non-zero if this symbol's size was calculated using a delta between this symbol and the next
m_size_is_valid:1,
m_demangled_is_synthesized:1, // The demangled name was created should not be used for expressions or other lookups
- m_type:8;
+ m_contains_linker_annotations:1, // The symbol name contains linker annotations, which are optional when doing name lookups
+ m_type:7;
Mangled m_mangled; // uniqued symbol name/mangled name pair
AddressRange m_addr_range; // Contains the value, or the section offset address when the value is an address in a section, and the size (if any)
uint32_t m_flags; // A copy of the flags from the original symbol table, the ObjectFile plug-in can interpret these
diff --git a/include/lldb/Symbol/SymbolContext.h b/include/lldb/Symbol/SymbolContext.h
index 64490627b84d..c48505e1064a 100644
--- a/include/lldb/Symbol/SymbolContext.h
+++ b/include/lldb/Symbol/SymbolContext.h
@@ -161,6 +161,32 @@ public:
///
/// @param[in] so_addr
/// The resolved section offset address.
+ ///
+ /// @param[in] show_fullpaths
+ /// When printing file paths (with the Module), whether the
+ /// base name of the Module should be printed or the full path.
+ ///
+ /// @param[in] show_module
+ /// Whether the module name should be printed followed by a
+ /// grave accent "`" character.
+ ///
+ /// @param[in] show_inlined_frames
+ /// If a given pc is in inlined function(s), whether the inlined
+ /// functions should be printed on separate lines in addition to
+ /// the concrete function containing the pc.
+ ///
+ /// @param[in] show_function_arguments
+ /// If false, this method will try to elide the function argument
+ /// types when printing the function name. This may be ambiguous
+ /// for languages that have function overloading - but it may
+ /// make the "function name" too long to include all the argument
+ /// types.
+ ///
+ /// @param[in] show_function_name
+ /// Normally this should be true - the function/symbol name should
+ /// be printed. In disassembly formatting, where we want a format
+ /// like "<*+36>", this should be false and "*" will be printed
+ /// instead.
//------------------------------------------------------------------
bool
DumpStopContext (Stream *s,
@@ -169,7 +195,8 @@ public:
bool show_fullpaths,
bool show_module,
bool show_inlined_frames,
- bool show_function_arguments) const;
+ bool show_function_arguments,
+ bool show_function_name) const;
//------------------------------------------------------------------
/// Get the address range contained within a symbol context.
diff --git a/include/lldb/Symbol/SymbolFile.h b/include/lldb/Symbol/SymbolFile.h
index 6df3d49fc464..0efe034235d5 100644
--- a/include/lldb/Symbol/SymbolFile.h
+++ b/include/lldb/Symbol/SymbolFile.h
@@ -124,6 +124,7 @@ public:
virtual size_t ParseCompileUnitFunctions (const SymbolContext& sc) = 0;
virtual bool ParseCompileUnitLineTable (const SymbolContext& sc) = 0;
virtual bool ParseCompileUnitSupportFiles (const SymbolContext& sc, FileSpecList& support_files) = 0;
+ virtual bool ParseImportedModules (const SymbolContext &sc, std::vector<ConstString> &imported_modules) = 0;
virtual size_t ParseFunctionBlocks (const SymbolContext& sc) = 0;
virtual size_t ParseTypes (const SymbolContext& sc) = 0;
virtual size_t ParseVariablesForContext (const SymbolContext& sc) = 0;
diff --git a/include/lldb/Symbol/SymbolVendor.h b/include/lldb/Symbol/SymbolVendor.h
index 82f902d4e07b..248918af2833 100644
--- a/include/lldb/Symbol/SymbolVendor.h
+++ b/include/lldb/Symbol/SymbolVendor.h
@@ -66,6 +66,10 @@ public:
virtual bool
ParseCompileUnitSupportFiles (const SymbolContext& sc,
FileSpecList& support_files);
+
+ virtual bool
+ ParseImportedModules (const SymbolContext &sc,
+ std::vector<ConstString> &imported_modules);
virtual size_t
ParseFunctionBlocks (const SymbolContext& sc);
@@ -164,6 +168,9 @@ public:
return m_sym_file_ap.get();
}
+ FileSpec
+ GetMainFileSpec() const;
+
// Get module unified section list symbol table.
virtual Symtab *
GetSymtab ();
diff --git a/include/lldb/Symbol/Symtab.h b/include/lldb/Symbol/Symtab.h
index dc08333e22fb..cf28c7e87ac5 100644
--- a/include/lldb/Symbol/Symtab.h
+++ b/include/lldb/Symbol/Symtab.h
@@ -58,6 +58,14 @@ public:
Symbol * SymbolAtIndex (size_t idx);
const Symbol * SymbolAtIndex (size_t idx) const;
Symbol * FindSymbolWithType (lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, uint32_t &start_idx);
+ //----------------------------------------------------------------------
+ /// Get the parent symbol for the given symbol.
+ ///
+ /// Many symbols in symbol tables are scoped by other symbols that
+ /// contain one or more symbol. This function will look for such a
+ /// containing symbol and return it if there is one.
+ //----------------------------------------------------------------------
+ const Symbol * GetParent (Symbol *symbol) const;
uint32_t AppendSymbolIndexesWithType (lldb::SymbolType symbol_type, std::vector<uint32_t>& indexes, uint32_t start_idx = 0, uint32_t end_index = UINT32_MAX) const;
uint32_t AppendSymbolIndexesWithTypeAndFlagsValue (lldb::SymbolType symbol_type, uint32_t flags_value, std::vector<uint32_t>& indexes, uint32_t start_idx = 0, uint32_t end_index = UINT32_MAX) const;
uint32_t AppendSymbolIndexesWithType (lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& matches, uint32_t start_idx = 0, uint32_t end_index = UINT32_MAX) const;
diff --git a/include/lldb/Symbol/Type.h b/include/lldb/Symbol/Type.h
index 51bd3dd82c92..c1784cb364a8 100644
--- a/include/lldb/Symbol/Type.h
+++ b/include/lldb/Symbol/Type.h
@@ -71,7 +71,12 @@ public:
eEncodingIsSyntheticUID
} EncodingDataType;
- typedef enum ResolveStateTag
+ // We must force the underlying type of the enum to be unsigned here. Not all compilers
+ // behave the same with regards to the default underlying type of an enum, but because
+ // this enum is used in an enum bitfield and integer comparisons are done with the value
+ // we need to guarantee that it's always unsigned so that, for example, eResolveStateFull
+ // doesn't compare less than eResolveStateUnresolved when used in a 2-bit bitfield.
+ typedef enum ResolveStateTag : unsigned
{
eResolveStateUnresolved = 0,
eResolveStateForward = 1,
@@ -300,7 +305,12 @@ protected:
ClangASTType m_clang_type;
struct Flags {
+#ifdef __GNUC__
+ // using unsigned type here to work around a very noisy gcc warning
+ unsigned clang_type_resolve_state : 2;
+#else
ResolveState clang_type_resolve_state : 2;
+#endif
bool is_complete_objc_class : 1;
} m_flags;
diff --git a/include/lldb/Symbol/UnwindPlan.h b/include/lldb/Symbol/UnwindPlan.h
index c482739cb8f6..bfc008a5b6bc 100644
--- a/include/lldb/Symbol/UnwindPlan.h
+++ b/include/lldb/Symbol/UnwindPlan.h
@@ -237,17 +237,178 @@ public:
} m_location;
};
+ class CFAValue
+ {
+ public:
+
+ enum ValueType
+ {
+ unspecified, // not specified
+ isRegisterPlusOffset, // CFA = register + offset
+ isRegisterDereferenced, // CFA = [reg]
+ isDWARFExpression // CFA = eval(dwarf_expr)
+ };
+
+ CFAValue() :
+ m_type(unspecified),
+ m_value()
+ {
+ }
+
+ bool
+ operator == (const CFAValue& rhs) const;
+
+ bool
+ operator != (const CFAValue &rhs) const
+ {
+ return !(*this == rhs);
+ }
+
+ void
+ SetUnspecified()
+ {
+ m_type = unspecified;
+ }
+
+ bool
+ IsUnspecified () const
+ {
+ return m_type == unspecified;
+ }
+
+ bool
+ IsRegisterPlusOffset () const
+ {
+ return m_type == isRegisterPlusOffset;
+ }
+
+ void
+ SetIsRegisterPlusOffset (uint32_t reg_num, int32_t offset)
+ {
+ m_type = isRegisterPlusOffset;
+ m_value.reg.reg_num = reg_num;
+ m_value.reg.offset = offset;
+ }
+
+ bool
+ IsRegisterDereferenced () const
+ {
+ return m_type == isRegisterDereferenced;
+ }
+
+ void
+ SetIsRegisterDereferenced (uint32_t reg_num)
+ {
+ m_type = isRegisterDereferenced;
+ m_value.reg.reg_num = reg_num;
+ }
+
+ bool
+ IsDWARFExpression () const
+ {
+ return m_type == isDWARFExpression;
+ }
+
+ void
+ SetIsDWARFExpression (const uint8_t *opcodes, uint32_t len)
+ {
+ m_type = isDWARFExpression;
+ m_value.expr.opcodes = opcodes;
+ m_value.expr.length = len;
+ }
+
+ uint32_t
+ GetRegisterNumber () const
+ {
+ if (m_type == isRegisterDereferenced || m_type == isRegisterPlusOffset)
+ return m_value.reg.reg_num;
+ return LLDB_INVALID_REGNUM;
+ }
+
+ ValueType
+ GetValueType () const
+ {
+ return m_type;
+ }
+
+ int32_t
+ GetOffset () const
+ {
+ if (m_type == isRegisterPlusOffset)
+ return m_value.reg.offset;
+ return 0;
+ }
+
+ void IncOffset (int32_t delta)
+ {
+ if (m_type == isRegisterPlusOffset)
+ m_value.reg.offset += delta;
+ }
+
+ void SetOffset (int32_t offset)
+ {
+ if (m_type == isRegisterPlusOffset)
+ m_value.reg.offset = offset;
+ }
+
+ void
+ GetDWARFExpr (const uint8_t **opcodes, uint16_t& len) const
+ {
+ if (m_type == isDWARFExpression)
+ {
+ *opcodes = m_value.expr.opcodes;
+ len = m_value.expr.length;
+ }
+ else
+ {
+ *opcodes = NULL;
+ len = 0;
+ }
+ }
+
+ const uint8_t *
+ GetDWARFExpressionBytes ()
+ {
+ if (m_type == isDWARFExpression)
+ return m_value.expr.opcodes;
+ return NULL;
+ }
+
+ int
+ GetDWARFExpressionLength ()
+ {
+ if (m_type == isDWARFExpression)
+ return m_value.expr.length;
+ return 0;
+ }
+
+ void
+ Dump (Stream &s,
+ const UnwindPlan* unwind_plan,
+ Thread* thread) const;
+
+ private:
+ ValueType m_type; // How do we compute CFA value?
+ union
+ {
+ struct {
+ // For m_type == isRegisterPlusOffset or m_type == isRegisterDereferenced
+ uint32_t reg_num; // The register number
+ // For m_type == isRegisterPlusOffset
+ int32_t offset;
+ } reg;
+ // For m_type == isDWARFExpression
+ struct {
+ const uint8_t *opcodes;
+ uint16_t length;
+ } expr;
+ } m_value;
+ }; // class CFAValue
+
public:
Row ();
-
- Row (const UnwindPlan::Row& rhs) :
- m_offset (rhs.m_offset),
- m_cfa_type (rhs.m_cfa_type),
- m_cfa_reg_num (rhs.m_cfa_reg_num),
- m_cfa_offset (rhs.m_cfa_offset),
- m_register_locations (rhs.m_register_locations)
- {
- }
+
+ Row (const UnwindPlan::Row& rhs) = default;
bool
operator == (const Row &rhs) const;
@@ -279,47 +440,9 @@ public:
m_offset += offset;
}
- // How we can reconstruct the CFA address for this stack frame, at this location
- enum CFAType
- {
- CFAIsRegisterPlusOffset, // the CFA value in a register plus (or minus) an offset
- CFAIsRegisterDereferenced // the address in a register is dereferenced to get CFA value
- };
-
- CFAType
- GetCFAType () const
- {
- return m_cfa_type;
- }
-
- void
- SetCFAType (CFAType cfa_type)
+ CFAValue& GetCFAValue()
{
- m_cfa_type = cfa_type;
- }
-
- // If GetCFAType() is CFAIsRegisterPlusOffset, add GetCFAOffset to the reg value to get CFA value
- // If GetCFAType() is CFAIsRegisterDereferenced, dereference the addr in the reg to get CFA value
- uint32_t
- GetCFARegister () const
- {
- return m_cfa_reg_num;
- }
-
- void
- SetCFARegister (uint32_t reg_num);
-
- // This should not be used when GetCFAType() is CFAIsRegisterDereferenced; will return 0 in that case.
- int32_t
- GetCFAOffset () const
- {
- return m_cfa_offset;
- }
-
- void
- SetCFAOffset (int32_t offset)
- {
- m_cfa_offset = offset;
+ return m_cfa_value;
}
bool
@@ -360,14 +483,7 @@ public:
typedef std::map<uint32_t, RegisterLocation> collection;
lldb::addr_t m_offset; // Offset into the function for this row
- CFAType m_cfa_type;
-
- // If m_cfa_type == CFAIsRegisterPlusOffset, the CFA address is computed as m_cfa_reg_num + m_cfa_offset
- // If m_cfa_type == CFAIsRegisterDereferenced, the CFA address is computed as *(m_cfa_reg_num) - i.e. the
- // address in m_cfa_reg_num is dereferenced and the pointer value read is the CFA addr.
- uint32_t m_cfa_reg_num; // The Call Frame Address register number
- int32_t m_cfa_offset; // The offset from the CFA for this row
-
+ CFAValue m_cfa_value;
collection m_register_locations;
}; // class Row
@@ -388,6 +504,22 @@ public:
{
}
+ // Performs a deep copy of the plan, including all the rows (expensive).
+ UnwindPlan (const UnwindPlan &rhs) :
+ m_plan_valid_address_range (rhs.m_plan_valid_address_range),
+ m_register_kind (rhs.m_register_kind),
+ m_return_addr_register (rhs.m_return_addr_register),
+ m_source_name (rhs.m_source_name),
+ m_plan_is_sourced_from_compiler (rhs.m_plan_is_sourced_from_compiler),
+ m_plan_is_valid_at_all_instruction_locations (rhs.m_plan_is_valid_at_all_instruction_locations),
+ m_lsda_address (rhs.m_lsda_address),
+ m_personality_func_addr (rhs.m_personality_func_addr)
+ {
+ m_row_list.reserve (rhs.m_row_list.size());
+ for (const RowSP &row_sp: rhs.m_row_list)
+ m_row_list.emplace_back (new Row (*row_sp));
+ }
+
~UnwindPlan ()
{
}
@@ -437,7 +569,7 @@ public:
{
if (m_row_list.empty())
return LLDB_INVALID_REGNUM;
- return m_row_list.front()->GetCFARegister();
+ return m_row_list.front()->GetCFAValue().GetRegisterNumber();
}
// This UnwindPlan may not be valid at every address of the function span.
diff --git a/include/lldb/Symbol/Variable.h b/include/lldb/Symbol/Variable.h
index 07295d090ee6..a345bcb8c23a 100644
--- a/include/lldb/Symbol/Variable.h
+++ b/include/lldb/Symbol/Variable.h
@@ -29,7 +29,7 @@ public:
//------------------------------------------------------------------
Variable (lldb::user_id_t uid,
const char *name,
- const char *mangled, // The mangled variable name for variables in namespaces
+ const char *mangled, // The mangled or fully qualified name of the variable.
const lldb::SymbolFileTypeSP &symfile_type_sp,
lldb::ValueType scope,
SymbolContextScope *owner_scope,
diff --git a/include/lldb/Target/CPPLanguageRuntime.h b/include/lldb/Target/CPPLanguageRuntime.h
index 43df9e67add0..3e51453566b3 100644
--- a/include/lldb/Target/CPPLanguageRuntime.h
+++ b/include/lldb/Target/CPPLanguageRuntime.h
@@ -153,6 +153,9 @@ public:
static uint32_t
FindEquivalentNames(ConstString type_name, std::vector<ConstString>& equivalents);
+ virtual size_t
+ GetAlternateManglings(const ConstString &mangled, std::vector<ConstString> &alternates) = 0;
+
protected:
//------------------------------------------------------------------
// Classes that inherit from CPPLanguageRuntime can see and modify these
diff --git a/include/lldb/Target/FileAction.h b/include/lldb/Target/FileAction.h
index 4015cbb5ea89..907c4d937beb 100644
--- a/include/lldb/Target/FileAction.h
+++ b/include/lldb/Target/FileAction.h
@@ -11,6 +11,7 @@
#define liblldb_Target_FileAction_h
#include <string>
+#include "lldb/Host/FileSpec.h"
namespace lldb_private
{
@@ -34,7 +35,7 @@ class FileAction
bool Duplicate(int fd, int dup_fd);
- bool Open(int fd, const char *path, bool read, bool write);
+ bool Open(int fd, const FileSpec &file_spec, bool read, bool write);
int
GetFD() const
@@ -54,16 +55,20 @@ class FileAction
return m_arg;
}
- const char *GetPath() const;
+ const char *
+ GetPath() const;
+
+ const FileSpec &
+ GetFileSpec() const;
void
Dump (Stream &stream) const;
protected:
- Action m_action; // The action for this file
- int m_fd; // An existing file descriptor
- int m_arg; // oflag for eFileActionOpen*, dup_fd for eFileActionDuplicate
- std::string m_path; // A file path to use for opening after fork or posix_spawn
+ Action m_action; // The action for this file
+ int m_fd; // An existing file descriptor
+ int m_arg; // oflag for eFileActionOpen*, dup_fd for eFileActionDuplicate
+ FileSpec m_file_spec; // A file spec to use for opening after fork or posix_spawn
};
} // namespace lldb_private
diff --git a/include/lldb/Target/LanguageRuntime.h b/include/lldb/Target/LanguageRuntime.h
index d5ed81956475..d8e5ada6c96f 100644
--- a/include/lldb/Target/LanguageRuntime.h
+++ b/include/lldb/Target/LanguageRuntime.h
@@ -34,6 +34,9 @@ public:
static LanguageRuntime*
FindPlugin (Process *process, lldb::LanguageType language);
+
+ static void
+ InitializeCommands (CommandObject* parent);
virtual lldb::LanguageType
GetLanguageType () const = 0;
@@ -80,16 +83,27 @@ public:
static lldb::BreakpointSP
CreateExceptionBreakpoint (Target &target,
- lldb::LanguageType language,
+ lldb::LanguageType language,
bool catch_bp,
bool throw_bp,
bool is_internal = false);
-
+
+ static Breakpoint::BreakpointPreconditionSP
+ CreateExceptionPrecondition (lldb::LanguageType language,
+ bool catch_bp,
+ bool throw_bp);
+
static lldb::LanguageType
GetLanguageTypeFromString (const char *string);
static const char *
GetNameForLanguageType (lldb::LanguageType language);
+
+ static void
+ PrintAllLanguages (Stream &s, const char *prefix, const char *suffix);
+
+ static bool
+ LanguageIsCPlusPlus (lldb::LanguageType language);
Process *
GetProcess()
@@ -109,6 +123,18 @@ public:
{
return false;
}
+
+ virtual bool
+ IsRuntimeSupportValue (ValueObject& valobj)
+ {
+ return false;
+ }
+
+ virtual void
+ ModulesDidLoad (const ModuleList &module_list)
+ {
+ return;
+ }
protected:
//------------------------------------------------------------------
diff --git a/include/lldb/Target/Memory.h b/include/lldb/Target/Memory.h
index 568bbcdf2f7c..bf1cc1878784 100644
--- a/include/lldb/Target/Memory.h
+++ b/include/lldb/Target/Memory.h
@@ -52,7 +52,7 @@ namespace lldb_private {
uint32_t
GetMemoryCacheLineSize() const
{
- return m_cache_line_byte_size ;
+ return m_L2_cache_line_byte_size ;
}
void
@@ -61,17 +61,26 @@ namespace lldb_private {
bool
RemoveInvalidRange (lldb::addr_t base_addr, lldb::addr_t byte_size);
+ // Allow external sources to populate data into the L1 memory cache
+ void
+ AddL1CacheData(lldb::addr_t addr, const void *src, size_t src_len);
+
+ void
+ AddL1CacheData(lldb::addr_t addr, const lldb::DataBufferSP &data_buffer_sp);
+
protected:
typedef std::map<lldb::addr_t, lldb::DataBufferSP> BlockMap;
typedef RangeArray<lldb::addr_t, lldb::addr_t, 4> InvalidRanges;
+ typedef Range<lldb::addr_t, lldb::addr_t> AddrRange;
//------------------------------------------------------------------
// Classes that inherit from MemoryCache can see and modify these
//------------------------------------------------------------------
- Process &m_process;
- uint32_t m_cache_line_byte_size;
Mutex m_mutex;
- BlockMap m_cache;
+ BlockMap m_L1_cache; // A first level memory cache whose chunk sizes vary that will be used only if the memory read fits entirely in a chunk
+ BlockMap m_L2_cache; // A memory cache of fixed size chinks (m_L2_cache_line_byte_size bytes in size each)
InvalidRanges m_invalid_ranges;
+ Process &m_process;
+ uint32_t m_L2_cache_line_byte_size;
private:
DISALLOW_COPY_AND_ASSIGN (MemoryCache);
};
diff --git a/include/lldb/Target/ObjCLanguageRuntime.h b/include/lldb/Target/ObjCLanguageRuntime.h
index 42a391478e3e..88874c767a1b 100644
--- a/include/lldb/Target/ObjCLanguageRuntime.h
+++ b/include/lldb/Target/ObjCLanguageRuntime.h
@@ -26,6 +26,8 @@
#include "lldb/Symbol/Type.h"
#include "lldb/Target/LanguageRuntime.h"
+class CommandObjectObjC_ClassTable_Dump;
+
namespace lldb_private {
class ClangUtilityFunction;
@@ -289,6 +291,48 @@ public:
protected:
std::unique_ptr<ClangASTContext> m_scratch_ast_ctx_ap;
};
+
+ class ObjCExceptionPrecondition : public Breakpoint::BreakpointPrecondition
+ {
+ public:
+ ObjCExceptionPrecondition();
+
+ virtual ~ObjCExceptionPrecondition() {}
+
+ bool EvaluatePrecondition(StoppointCallbackContext &context) override;
+ void DescribePrecondition(Stream &stream, lldb::DescriptionLevel level) override;
+ Error ConfigurePrecondition(Args &args) override;
+
+ protected:
+ void AddClassName(const char *class_name);
+
+ private:
+ std::unordered_set<std::string> m_class_names;
+ };
+
+ class TaggedPointerVendor
+ {
+ public:
+ virtual bool
+ IsPossibleTaggedPointer (lldb::addr_t ptr) = 0;
+
+ virtual ObjCLanguageRuntime::ClassDescriptorSP
+ GetClassDescriptor (lldb::addr_t ptr) = 0;
+
+ virtual
+ ~TaggedPointerVendor () { }
+ protected:
+ TaggedPointerVendor () = default;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendor);
+ };
+
+ virtual TaggedPointerVendor*
+ GetTaggedPointerVendor ()
+ {
+ return nullptr;
+ }
typedef std::shared_ptr<EncodingToType> EncodingToTypeSP;
@@ -313,8 +357,8 @@ public:
virtual
~ObjCLanguageRuntime();
- virtual lldb::LanguageType
- GetLanguageType () const
+ lldb::LanguageType
+ GetLanguageType () const override
{
return lldb::eLanguageTypeObjC;
}
@@ -515,10 +559,10 @@ public:
m_negative_complete_class_cache.clear();
}
- virtual bool
+ bool
GetTypeBitSize (const ClangASTType& clang_type,
- uint64_t &size);
-
+ uint64_t &size) override;
+
protected:
//------------------------------------------------------------------
// Classes that inherit from ObjCLanguageRuntime can see and modify these
@@ -645,6 +689,14 @@ protected:
ISAToDescriptorIterator
GetDescriptorIterator (const ConstString &name);
+ friend class ::CommandObjectObjC_ClassTable_Dump;
+
+ std::pair<ISAToDescriptorIterator,ISAToDescriptorIterator>
+ GetDescriptorIteratorPair (bool update_if_needed = true);
+
+ void
+ ReadObjCLibraryIfNeeded (const ModuleList &module_list);
+
DISALLOW_COPY_AND_ASSIGN (ObjCLanguageRuntime);
};
diff --git a/include/lldb/Target/Platform.h b/include/lldb/Target/Platform.h
index f4596bd00f0b..8f89e9b3cf5f 100644
--- a/include/lldb/Target/Platform.h
+++ b/include/lldb/Target/Platform.h
@@ -12,7 +12,9 @@
// C Includes
// C++ Includes
+#include <functional>
#include <map>
+#include <memory>
#include <string>
#include <vector>
@@ -23,7 +25,9 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/PluginInterface.h"
+#include "lldb/Core/UserSettingsController.h"
#include "lldb/Interpreter/Options.h"
+#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Mutex.h"
// TODO pull NativeDelegate class out of NativeProcessProtocol so we
@@ -32,6 +36,34 @@
namespace lldb_private {
+class ModuleCache;
+
+ enum MmapFlags {
+ eMmapFlagsPrivate = 1,
+ eMmapFlagsAnon = 2
+ };
+
+ class PlatformProperties : public Properties
+ {
+ public:
+ static ConstString
+ GetSettingName ();
+
+ PlatformProperties();
+
+ bool
+ GetUseModuleCache () const;
+ bool
+ SetUseModuleCache (bool use_module_cache);
+
+ FileSpec
+ GetModuleCacheDirectory () const;
+ bool
+ SetModuleCacheDirectory (const FileSpec& dir_spec);
+ };
+
+ typedef std::shared_ptr<PlatformProperties> PlatformPropertiesSP;
+
//----------------------------------------------------------------------
/// @class Platform Platform.h "lldb/Target/Platform.h"
/// @brief A plug-in interface definition class for debug platform that
@@ -49,9 +81,17 @@ namespace lldb_private {
public PluginInterface
{
public:
+ static void
+ Initialize ();
+
+ static void
+ Terminate ();
+
+ static const PlatformPropertiesSP &
+ GetGlobalPlatformProperties ();
//------------------------------------------------------------------
- /// Get the native host platform plug-in.
+ /// Get the native host platform plug-in.
///
/// There should only be one of these for each host that LLDB runs
/// upon that should be statically compiled in and registered using
@@ -277,15 +317,15 @@ namespace lldb_private {
{
return ArchSpec(); // Return an invalid architecture
}
-
- virtual ConstString
+
+ virtual FileSpec
GetRemoteWorkingDirectory()
{
return m_working_dir;
}
virtual bool
- SetRemoteWorkingDirectory(const ConstString &path);
+ SetRemoteWorkingDirectory(const FileSpec &working_dir);
virtual const char *
GetUserName (uint32_t uid);
@@ -336,14 +376,20 @@ namespace lldb_private {
LocateExecutableScriptingResources (Target *target,
Module &module,
Stream* feedback_stream);
-
+
virtual Error
- GetSharedModule (const ModuleSpec &module_spec,
+ GetSharedModule (const ModuleSpec &module_spec,
+ Process* process,
lldb::ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr,
lldb::ModuleSP *old_module_sp_ptr,
bool *did_create_ptr);
+ virtual bool
+ GetModuleSpec (const FileSpec& module_file_spec,
+ const ArchSpec& arch,
+ ModuleSpec &module_spec);
+
virtual Error
ConnectRemote (Args& args);
@@ -380,6 +426,16 @@ namespace lldb_private {
LaunchProcess (ProcessLaunchInfo &launch_info);
//------------------------------------------------------------------
+ /// Perform expansion of the command-line for this launch info
+ /// This can potentially involve wildcard expansion
+ // environment variable replacement, and whatever other
+ // argument magic the platform defines as part of its typical
+ // user experience
+ //------------------------------------------------------------------
+ virtual Error
+ ShellExpandArguments (ProcessLaunchInfo &launch_info);
+
+ //------------------------------------------------------------------
/// Kill process on a platform.
//------------------------------------------------------------------
virtual Error
@@ -577,12 +633,12 @@ namespace lldb_private {
virtual void
AddClangModuleCompilationOptions (Target *target, std::vector<std::string> &options);
- ConstString
- GetWorkingDirectory ();
-
+ FileSpec
+ GetWorkingDirectory();
+
bool
- SetWorkingDirectory (const ConstString &path);
-
+ SetWorkingDirectory(const FileSpec &working_dir);
+
// There may be modules that we don't want to find by default for operations like "setting breakpoint by name".
// The platform will return "true" from this call if the passed in module happens to be one of these.
@@ -593,13 +649,13 @@ namespace lldb_private {
}
virtual Error
- MakeDirectory (const char *path, uint32_t permissions);
-
+ MakeDirectory(const FileSpec &file_spec, uint32_t permissions);
+
virtual Error
- GetFilePermissions (const char *path, uint32_t &file_permissions);
+ GetFilePermissions(const FileSpec &file_spec, uint32_t &file_permissions);
virtual Error
- SetFilePermissions (const char *path, uint32_t file_permissions);
+ SetFilePermissions(const FileSpec &file_spec, uint32_t file_permissions);
virtual lldb::user_id_t
OpenFile (const FileSpec& file_spec,
@@ -656,8 +712,8 @@ namespace lldb_private {
uint32_t gid = UINT32_MAX);
virtual Error
- CreateSymlink (const char *src, // The name of the link is in src
- const char *dst);// The symlink points to dst
+ CreateSymlink(const FileSpec &src, // The name of the link is in src
+ const FileSpec &dst); // The symlink points to dst
//----------------------------------------------------------------------
/// Install a file or directory to the remote system.
@@ -693,7 +749,10 @@ namespace lldb_private {
GetFileExists (const lldb_private::FileSpec& file_spec);
virtual Error
- Unlink (const char *path);
+ Unlink(const FileSpec &file_spec);
+
+ virtual uint64_t
+ ConvertMmapFlagsToPlatform(const ArchSpec &arch, unsigned flags);
virtual bool
GetSupportsRSync ()
@@ -774,13 +833,13 @@ namespace lldb_private {
}
virtual lldb_private::Error
- RunShellCommand (const char *command, // Shouldn't be NULL
- const char *working_dir, // Pass NULL to use the current working directory
- int *status_ptr, // Pass NULL if you don't want the process exit status
- int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
- std::string *command_output, // Pass NULL if you don't want the command output
- uint32_t timeout_sec); // Timeout in seconds to wait for shell program to finish
-
+ RunShellCommand(const char *command, // Shouldn't be NULL
+ const FileSpec &working_dir, // Pass empty FileSpec to use the current working directory
+ int *status_ptr, // Pass NULL if you don't want the process exit status
+ int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
+ std::string *command_output, // Pass NULL if you don't want the command output
+ uint32_t timeout_sec); // Timeout in seconds to wait for shell program to finish
+
virtual void
SetLocalCacheDirectory (const char* local);
@@ -950,7 +1009,7 @@ namespace lldb_private {
bool m_system_arch_set_while_connected;
ConstString m_sdk_sysroot; // the root location of where the SDK files are all located
ConstString m_sdk_build;
- ConstString m_working_dir; // The working directory which is used when installing modules that have no install path set
+ FileSpec m_working_dir; // The working directory which is used when installing modules that have no install path set
std::string m_remote_url;
std::string m_name;
uint32_t m_major_os_version;
@@ -972,6 +1031,7 @@ namespace lldb_private {
std::string m_local_cache_directory;
std::vector<ConstString> m_trap_handlers;
bool m_calculated_trap_handlers;
+ const std::unique_ptr<ModuleCache> m_module_cache;
//------------------------------------------------------------------
/// Ask the Platform subclass to fill in the list of trap handler names
@@ -1074,7 +1134,45 @@ namespace lldb_private {
m_gid_map.clear();
}
+ Error
+ GetCachedExecutable (ModuleSpec &module_spec,
+ lldb::ModuleSP &module_sp,
+ const FileSpecList *module_search_paths_ptr,
+ Platform &remote_platform);
+
+ virtual Error
+ DownloadModuleSlice (const FileSpec& src_file_spec,
+ const uint64_t src_offset,
+ const uint64_t src_size,
+ const FileSpec& dst_file_spec);
+
+ virtual const char *
+ GetCacheHostname ();
+
private:
+ typedef std::function<Error (const ModuleSpec &)> ModuleResolver;
+
+ Error
+ GetRemoteSharedModule (const ModuleSpec &module_spec,
+ Process* process,
+ lldb::ModuleSP &module_sp,
+ const ModuleResolver &module_resolver,
+ bool *did_create_ptr);
+
+ bool
+ GetCachedSharedModule (const ModuleSpec& module_spec,
+ lldb::ModuleSP &module_sp,
+ bool *did_create_ptr);
+
+ Error
+ LoadCachedExecutable (const ModuleSpec &module_spec,
+ lldb::ModuleSP &module_sp,
+ const FileSpecList *module_search_paths_ptr,
+ Platform &remote_platform);
+
+ FileSpec
+ GetModuleCacheRoot ();
+
DISALLOW_COPY_AND_ASSIGN (Platform);
};
diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h
index 6608391b94fd..db0f0cfa028b 100644
--- a/include/lldb/Target/Process.h
+++ b/include/lldb/Target/Process.h
@@ -28,34 +28,26 @@
#include "lldb/Core/Communication.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Event.h"
-#include "lldb/Core/RangeMap.h"
-#include "lldb/Core/StringList.h"
#include "lldb/Core/ThreadSafeValue.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Breakpoint/BreakpointSiteList.h"
-#include "lldb/Expression/ClangPersistentVariables.h"
-#include "lldb/Expression/IRDynamicChecks.h"
-#include "lldb/Host/FileSpec.h"
-#include "lldb/Host/Host.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Host/ProcessRunLock.h"
-#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/Options.h"
#include "lldb/Target/ExecutionContextScope.h"
-#include "lldb/Target/JITLoaderList.h"
#include "lldb/Target/Memory.h"
-#include "lldb/Target/MemoryRegionInfo.h"
#include "lldb/Target/ProcessInfo.h"
#include "lldb/Target/ProcessLaunchInfo.h"
#include "lldb/Target/QueueList.h"
#include "lldb/Target/ThreadList.h"
-#include "lldb/Target/UnixSignals.h"
-#include "lldb/Utility/PseudoTerminal.h"
#include "lldb/Target/InstrumentationRuntime.h"
namespace lldb_private {
+template <typename B, typename S>
+struct Range;
+
//----------------------------------------------------------------------
// ProcessProperties
//----------------------------------------------------------------------
@@ -693,7 +685,20 @@ public:
else
m_running_user_expression--;
}
-
+
+ void
+ SetStopEventForLastNaturalStopID (lldb::EventSP event_sp)
+ {
+ m_last_natural_stop_event = event_sp;
+ }
+
+ lldb::EventSP GetStopEventForStopID (uint32_t stop_id) const
+ {
+ if (stop_id == m_last_natural_stop_id)
+ return m_last_natural_stop_event;
+ return lldb::EventSP();
+ }
+
private:
uint32_t m_stop_id;
uint32_t m_last_natural_stop_id;
@@ -701,6 +706,7 @@ private:
uint32_t m_memory_id;
uint32_t m_last_user_expression_resume;
uint32_t m_running_user_expression;
+ lldb::EventSP m_last_natural_stop_event;
};
inline bool operator== (const ProcessModID &lhs, const ProcessModID &rhs)
{
@@ -812,11 +818,12 @@ public:
virtual const ConstString &
GetFlavor () const;
- const lldb::ProcessSP &
+ lldb::ProcessSP
GetProcessSP() const
{
- return m_process_sp;
+ return m_process_wp.lock();
}
+
lldb::StateType
GetState() const
{
@@ -911,7 +918,7 @@ public:
m_restarted_reasons.push_back(reason);
}
- lldb::ProcessSP m_process_sp;
+ lldb::ProcessWP m_process_wp;
lldb::StateType m_state;
std::vector<std::string> m_restarted_reasons;
bool m_restarted; // For "eStateStopped" events, this is true if the target was automatically restarted.
@@ -1129,6 +1136,22 @@ public:
virtual const lldb::DataBufferSP
GetAuxvData();
+ //------------------------------------------------------------------
+ /// Sometimes processes know how to retrieve and load shared libraries.
+ /// This is normally done by DynamicLoader plug-ins, but sometimes the
+ /// connection to the process allows retrieving this information. The
+ /// dynamic loader plug-ins can use this function if they can't
+ /// determine the current shared library load state.
+ ///
+ /// @return
+ /// The number of shared libraries that were loaded
+ //------------------------------------------------------------------
+ virtual size_t
+ LoadModules ()
+ {
+ return 0;
+ }
+
protected:
virtual JITLoaderList &
GetJITLoaders ();
@@ -1351,11 +1374,19 @@ public:
/// This function is not meant to be overridden by Process
/// subclasses.
///
+ /// @param[in] force_kill
+ /// Whether lldb should force a kill (instead of a detach) from
+ /// the inferior process. Normally if lldb launched a binary and
+ /// Destory is called, lldb kills it. If lldb attached to a
+ /// running process and Destory is called, lldb detaches. If
+ /// this behavior needs to be over-ridden, this is the bool that
+ /// can be used.
+ ///
/// @return
/// Returns an error object.
//------------------------------------------------------------------
Error
- Destroy();
+ Destroy(bool force_kill);
//------------------------------------------------------------------
/// Sends a process a UNIX signal \a signal.
@@ -1370,18 +1401,10 @@ public:
Signal (int signal);
void
- SetUnixSignals (const UnixSignalsSP &signals_sp)
- {
- assert (signals_sp && "null signals_sp");
- m_unix_signals_sp = signals_sp;
- }
+ SetUnixSignals (const UnixSignalsSP &signals_sp);
UnixSignals &
- GetUnixSignals ()
- {
- assert (m_unix_signals_sp && "null m_unix_signals_sp");
- return *m_unix_signals_sp;
- }
+ GetUnixSignals ();
//==================================================================
// Plug-in Process Control Overrides
@@ -1445,31 +1468,14 @@ public:
/// @param[in] pid
/// The process ID that we should attempt to attach to.
///
- /// @return
- /// Returns \a pid if attaching was successful, or
- /// LLDB_INVALID_PROCESS_ID if attaching fails.
- //------------------------------------------------------------------
- virtual Error
- DoAttachToProcessWithID (lldb::pid_t pid)
- {
- Error error;
- error.SetErrorStringWithFormat("error: %s does not support attaching to a process by pid", GetPluginName().GetCString());
- return error;
- }
-
- //------------------------------------------------------------------
- /// Attach to an existing process using a process ID.
- ///
- /// @param[in] pid
- /// The process ID that we should attempt to attach to.
- ///
/// @param[in] attach_info
/// Information on how to do the attach. For example, GetUserID()
/// will return the uid to attach as.
///
/// @return
- /// Returns \a pid if attaching was successful, or
- /// LLDB_INVALID_PROCESS_ID if attaching fails.
+ /// Returns a successful Error attaching was successful, or
+ /// an appropriate (possibly platform-specific) error code if
+ /// attaching fails.
/// hanming : need flag
//------------------------------------------------------------------
virtual Error
@@ -1491,7 +1497,9 @@ public:
/// will return the uid to attach as.
///
/// @return
- /// Returns an error object.
+ /// Returns a successful Error attaching was successful, or
+ /// an appropriate (possibly platform-specific) error code if
+ /// attaching fails.
//------------------------------------------------------------------
virtual Error
DoAttachToProcessWithName (const char *process_name, const ProcessAttachInfo &attach_info)
@@ -1870,7 +1878,13 @@ public:
void
SendAsyncInterrupt ();
- void
+ //------------------------------------------------------------------
+ // Notify this process class that modules got loaded.
+ //
+ // If subclasses override this method, they must call this version
+ // before doing anything in the subclass version of the function.
+ //------------------------------------------------------------------
+ virtual void
ModulesDidLoad (ModuleList &module_list);
protected:
@@ -1961,11 +1975,17 @@ public:
}
uint32_t
- GetLastNaturalStopID()
+ GetLastNaturalStopID() const
{
return m_mod_id.GetLastNaturalStopID();
}
-
+
+ lldb::EventSP
+ GetStopEventForStopID (uint32_t stop_id) const
+ {
+ return m_mod_id.GetStopEventForStopID(stop_id);
+ }
+
//------------------------------------------------------------------
/// Set accessor for the process exit status (return code).
///
@@ -2399,33 +2419,8 @@ public:
/// Returns true if it was able to determine the attributes of the
/// memory region. False if not.
//------------------------------------------------------------------
-
virtual bool
- GetLoadAddressPermissions (lldb::addr_t load_addr, uint32_t &permissions)
- {
- MemoryRegionInfo range_info;
- permissions = 0;
- Error error (GetMemoryRegionInfo (load_addr, range_info));
- if (!error.Success())
- return false;
- if (range_info.GetReadable() == MemoryRegionInfo::eDontKnow
- || range_info.GetWritable() == MemoryRegionInfo::eDontKnow
- || range_info.GetExecutable() == MemoryRegionInfo::eDontKnow)
- {
- return false;
- }
-
- if (range_info.GetReadable() == MemoryRegionInfo::eYes)
- permissions |= lldb::ePermissionsReadable;
-
- if (range_info.GetWritable() == MemoryRegionInfo::eYes)
- permissions |= lldb::ePermissionsWritable;
-
- if (range_info.GetExecutable() == MemoryRegionInfo::eYes)
- permissions |= lldb::ePermissionsExecutable;
-
- return true;
- }
+ GetLoadAddressPermissions (lldb::addr_t load_addr, uint32_t &permissions);
//------------------------------------------------------------------
/// Determines whether executing JIT-compiled code in this process
@@ -2758,6 +2753,11 @@ public:
Listener *hijack_listener = NULL,
Stream *stream = NULL);
+ uint32_t
+ GetIOHandlerID () const
+ {
+ return m_iohandler_sync.GetValue();
+ }
//--------------------------------------------------------------------------------------
/// Waits for the process state to be running within a given msec timeout.
@@ -2768,14 +2768,9 @@ public:
/// @param[in] timeout_msec
/// The maximum time length to wait for the process to transition to the
/// eStateRunning state, specified in milliseconds.
- ///
- /// @return
- /// true if successfully signalled that process started and IOHandler pushes, false
- /// if it timed out.
//--------------------------------------------------------------------------------------
- bool
- SyncIOHandler (uint64_t timeout_msec);
-
+ void
+ SyncIOHandler (uint32_t iohandler_id, uint64_t timeout_msec);
lldb::StateType
WaitForStateChangedEvents (const TimeValue *timeout,
@@ -2906,10 +2901,7 @@ public:
return m_dynamic_checkers_ap.get();
}
- void SetDynamicCheckers(DynamicCheckerFunctions *dynamic_checkers)
- {
- m_dynamic_checkers_ap.reset(dynamic_checkers);
- }
+ void SetDynamicCheckers(DynamicCheckerFunctions *dynamic_checkers);
//------------------------------------------------------------------
/// Call this to set the lldb in the mode where it breaks on new thread
@@ -3010,17 +3002,10 @@ public:
void
ClearPreResumeActions ();
-
+
ProcessRunLock &
- GetRunLock ()
- {
- if (m_private_state_thread.EqualsThread(Host::GetCurrentThread()))
- return m_private_run_lock;
- else
- return m_public_run_lock;
- }
+ GetRunLock ();
-public:
virtual Error
SendEventData(const char *data)
{
@@ -3034,6 +3019,51 @@ public:
lldb::InstrumentationRuntimeSP
GetInstrumentationRuntime(lldb::InstrumentationRuntimeType type);
+ //------------------------------------------------------------------
+ /// Try to fetch the module specification for a module with the
+ /// given file name and architecture. Process sub-classes have to
+ /// override this method if they support platforms where the
+ /// Platform object can't get the module spec for all module.
+ ///
+ /// @param[in] module_file_spec
+ /// The file name of the module to get specification for.
+ ///
+ /// @param[in] arch
+ /// The architecture of the module to get specification for.
+ ///
+ /// @param[out] module_spec
+ /// The fetched module specification if the return value is
+ /// \b true, unchanged otherwise.
+ ///
+ /// @return
+ /// Returns \b true if the module spec fetched successfully,
+ /// \b false otherwise.
+ //------------------------------------------------------------------
+ virtual bool
+ GetModuleSpec(const FileSpec& module_file_spec, const ArchSpec& arch, ModuleSpec &module_spec);
+
+ //------------------------------------------------------------------
+ /// Try to find the load address of a file.
+ /// The load address is defined as the address of the first memory
+ /// region what contains data mapped from the specified file.
+ ///
+ /// @param[in] file
+ /// The name of the file whose load address we are looking for
+ ///
+ /// @param[out] is_loaded
+ /// \b True if the file is loaded into the memory and false
+ /// otherwise.
+ ///
+ /// @param[out] load_addr
+ /// The load address of the file if it is loaded into the
+ /// processes address space, LLDB_INVALID_ADDRESS otherwise.
+ //------------------------------------------------------------------
+ virtual Error
+ GetFileLoadAddress(const FileSpec& file, bool& is_loaded, lldb::addr_t& load_addr)
+ {
+ return Error("Not supported");
+ }
+
protected:
//------------------------------------------------------------------
@@ -3150,7 +3180,7 @@ protected:
Broadcaster m_private_state_control_broadcaster; // This is the control broadcaster, used to pause, resume & stop the private state thread.
Listener m_private_state_listener; // This is the listener for the private state thread.
Predicate<bool> m_private_state_control_wait; /// This Predicate is used to signal that a control operation is complete.
- HostThread m_private_state_thread; // Thread ID for the thread that watches internal state events
+ HostThread m_private_state_thread; ///< Thread ID for the thread that watches internal state events
ProcessModID m_mod_id; ///< Tracks the state of the process over stops and other alterations.
uint32_t m_process_unique_id; ///< Each lldb_private::Process class that is created gets a unique integer ID that increments with each new instance
uint32_t m_thread_index_id; ///< Each thread is created with a 1 based index that won't get re-used.
@@ -3170,22 +3200,22 @@ protected:
std::vector<lldb::addr_t> m_image_tokens;
Listener &m_listener;
BreakpointSiteList m_breakpoint_site_list; ///< This is the list of breakpoint locations we intend to insert in the target.
- std::unique_ptr<DynamicLoader> m_dyld_ap;
- std::unique_ptr<JITLoaderList> m_jit_loaders_ap;
- std::unique_ptr<DynamicCheckerFunctions> m_dynamic_checkers_ap; ///< The functions used by the expression parser to validate data that expressions use.
- std::unique_ptr<OperatingSystem> m_os_ap;
- std::unique_ptr<SystemRuntime> m_system_runtime_ap;
+ lldb::DynamicLoaderUP m_dyld_ap;
+ lldb::JITLoaderListUP m_jit_loaders_ap;
+ lldb::DynamicCheckerFunctionsUP m_dynamic_checkers_ap; ///< The functions used by the expression parser to validate data that expressions use.
+ lldb::OperatingSystemUP m_os_ap;
+ lldb::SystemRuntimeUP m_system_runtime_ap;
UnixSignalsSP m_unix_signals_sp; /// This is the current signal set for this process.
lldb::ABISP m_abi_sp;
lldb::IOHandlerSP m_process_input_reader;
Communication m_stdio_communication;
Mutex m_stdio_communication_mutex;
- bool m_stdio_disable; /// Remember process launch setting
+ bool m_stdin_forward; /// Remember if stdin must be forwarded to remote debug server
std::string m_stdout_data;
std::string m_stderr_data;
Mutex m_profile_data_comm_mutex;
std::vector<std::string> m_profile_data;
- Predicate<bool> m_iohandler_sync;
+ Predicate<uint32_t> m_iohandler_sync;
MemoryCache m_memory_cache;
AllocatedMemoryCache m_allocated_memory_cache;
bool m_should_detach; /// Should we detach if the process object goes away with an explicit call to Kill or Detach?
@@ -3199,7 +3229,8 @@ protected:
ArchSpec::StopInfoOverrideCallbackType m_stop_info_override_callback;
bool m_currently_handling_do_on_removals;
bool m_resume_requested; // If m_currently_handling_event or m_currently_handling_do_on_removals are true, Resume will only request a resume, using this flag to check.
- bool m_finalize_called;
+ bool m_finalizing; // This is set at the beginning of Process::Finalize() to stop functions from looking up or creating things during a finalize call
+ bool m_finalize_called; // This is set at the end of Process::Finalize()
bool m_clear_thread_plans_on_stop;
bool m_force_next_event_delivery;
lldb::StateType m_last_broadcast_state; /// This helps with the Public event coalescing in ShouldBroadcastEvent.
@@ -3225,7 +3256,7 @@ protected:
SetPrivateState (lldb::StateType state);
bool
- StartPrivateStateThread (bool force = false);
+ StartPrivateStateThread (bool is_secondary_thread = false);
void
StopPrivateStateThread ();
@@ -3236,11 +3267,22 @@ protected:
void
ResumePrivateStateThread ();
+ struct PrivateStateThreadArgs
+ {
+ Process *process;
+ bool is_secondary_thread;
+ };
+
static lldb::thread_result_t
PrivateStateThread (void *arg);
+ // The starts up the private state thread that will watch for events from the debugee.
+ // Pass true for is_secondary_thread in the case where you have to temporarily spin up a
+ // secondary state thread to handle events from a hand-called function on the primary
+ // private state thread.
+
lldb::thread_result_t
- RunPrivateStateThread ();
+ RunPrivateStateThread (bool is_secondary_thread);
void
HandlePrivateEvent (lldb::EventSP &event_sp);
@@ -3285,6 +3327,12 @@ protected:
bool
ProcessIOHandlerIsActive ();
+
+ bool
+ ProcessIOHandlerExists () const
+ {
+ return static_cast<bool>(m_process_input_reader);
+ }
Error
HaltForDestroyOrDetach(lldb::EventSP &exit_event_sp);
diff --git a/include/lldb/Target/ProcessInfo.h b/include/lldb/Target/ProcessInfo.h
index 0570cfc98651..1539e043d6fc 100644
--- a/include/lldb/Target/ProcessInfo.h
+++ b/include/lldb/Target/ProcessInfo.h
@@ -107,7 +107,7 @@ namespace lldb_private
}
void
- SetArchitecture (ArchSpec arch)
+ SetArchitecture (const ArchSpec& arch)
{
m_arch = arch;
}
diff --git a/include/lldb/Target/ProcessLaunchInfo.h b/include/lldb/Target/ProcessLaunchInfo.h
index 897704488e5f..92a3ed40736d 100644
--- a/include/lldb/Target/ProcessLaunchInfo.h
+++ b/include/lldb/Target/ProcessLaunchInfo.h
@@ -36,11 +36,11 @@ namespace lldb_private
ProcessLaunchInfo ();
- ProcessLaunchInfo (const char *stdin_path,
- const char *stdout_path,
- const char *stderr_path,
- const char *working_directory,
- uint32_t launch_flags);
+ ProcessLaunchInfo(const FileSpec &stdin_file_spec,
+ const FileSpec &stdout_file_spec,
+ const FileSpec &stderr_file_spec,
+ const FileSpec &working_dir,
+ uint32_t launch_flags);
void
AppendFileAction (const FileAction &info)
@@ -55,7 +55,8 @@ namespace lldb_private
AppendDuplicateFileAction (int fd, int dup_fd);
bool
- AppendOpenFileAction (int fd, const char *path, bool read, bool write);
+ AppendOpenFileAction(int fd, const FileSpec &file_spec,
+ bool read, bool write);
bool
AppendSuppressFileAction (int fd, bool read, bool write);
@@ -88,17 +89,11 @@ namespace lldb_private
return m_flags;
}
- const char *
- GetWorkingDirectory () const;
-
- void
- SetWorkingDirectory (const char *working_dir);
+ const FileSpec &
+ GetWorkingDirectory() const;
void
- SwapWorkingDirectory (std::string &working_dir)
- {
- m_working_dir.swap (working_dir);
- }
+ SetWorkingDirectory(const FileSpec &working_dir);
const char *
GetProcessPluginName () const;
@@ -132,6 +127,15 @@ namespace lldb_private
void
SetLaunchInSeparateProcessGroup (bool separate);
+
+ bool
+ GetShellExpandArguments () const
+ {
+ return m_flags.Test(lldb::eLaunchFlagShellExpandArguments);
+ }
+
+ void
+ SetShellExpandArguments (bool expand);
void
Clear ();
@@ -229,7 +233,7 @@ namespace lldb_private
}
protected:
- std::string m_working_dir;
+ FileSpec m_working_dir;
std::string m_plugin_name;
FileSpec m_shell;
Flags m_flags; // Bitwise OR of bits from lldb::LaunchFlags
diff --git a/include/lldb/Target/SectionLoadHistory.h b/include/lldb/Target/SectionLoadHistory.h
index 50dcfd3cc870..ddf46a1861ca 100644
--- a/include/lldb/Target/SectionLoadHistory.h
+++ b/include/lldb/Target/SectionLoadHistory.h
@@ -23,7 +23,7 @@ namespace lldb_private {
class SectionLoadHistory
{
public:
- enum {
+ enum : unsigned {
// Pass eStopIDNow to any function that takes a stop ID to get
// the current value.
eStopIDNow = UINT32_MAX
diff --git a/include/lldb/Target/StopInfo.h b/include/lldb/Target/StopInfo.h
index e0d029bcc956..d09900f7637d 100644
--- a/include/lldb/Target/StopInfo.h
+++ b/include/lldb/Target/StopInfo.h
@@ -116,6 +116,12 @@ public:
else
m_description.clear();
}
+
+ virtual bool
+ IsValidForOperatingSystemThread (Thread &thread)
+ {
+ return true;
+ }
// Sometimes the thread plan logic will know that it wants a given stop to stop or not,
// regardless of what the ordinary logic for that StopInfo would dictate. The main example
@@ -158,7 +164,7 @@ public:
CreateStopReasonWithWatchpointID (Thread &thread, lldb::break_id_t watch_id);
static lldb::StopInfoSP
- CreateStopReasonWithSignal (Thread &thread, int signo);
+ CreateStopReasonWithSignal (Thread &thread, int signo, const char *description = nullptr);
static lldb::StopInfoSP
CreateStopReasonToTrace (Thread &thread);
diff --git a/include/lldb/Target/Target.h b/include/lldb/Target/Target.h
index a33734fd5b63..427f68e4c5d4 100644
--- a/include/lldb/Target/Target.h
+++ b/include/lldb/Target/Target.h
@@ -18,24 +18,15 @@
// Project includes
#include "lldb/lldb-public.h"
#include "lldb/Breakpoint/BreakpointList.h"
-#include "lldb/Breakpoint/BreakpointLocationCollection.h"
#include "lldb/Breakpoint/WatchpointList.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Disassembler.h"
-#include "lldb/Core/Event.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/UserSettingsController.h"
-#include "lldb/Expression/ClangModulesDeclVendor.h"
-#include "lldb/Expression/ClangPersistentVariables.h"
-#include "lldb/Interpreter/Args.h"
-#include "lldb/Interpreter/OptionValueBoolean.h"
-#include "lldb/Interpreter/OptionValueEnumeration.h"
-#include "lldb/Interpreter/OptionValueFileSpec.h"
-#include "lldb/Symbol/SymbolContext.h"
-#include "lldb/Target/ABI.h"
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/Target/PathMappingList.h"
+#include "lldb/Target/ProcessLaunchInfo.h"
#include "lldb/Target/SectionLoadHistory.h"
namespace lldb_private {
@@ -73,9 +64,15 @@ public:
void
SetDefaultArchitecture (const ArchSpec& arch);
+ bool
+ GetMoveToNearestCode () const;
+
lldb::DynamicValueType
GetPreferDynamicValue() const;
-
+
+ bool
+ SetPreferDynamicValue (lldb::DynamicValueType d);
+
bool
GetDisableASLR () const;
@@ -117,7 +114,10 @@ public:
size_t
GetEnvironmentAsArgs (Args &env) const;
-
+
+ void
+ SetEnvironmentFromArgs (const Args &env);
+
bool
GetSkipPrologue() const;
@@ -130,6 +130,12 @@ public:
FileSpecList &
GetDebugFileSearchPaths ();
+ FileSpecList &
+ GetClangModuleSearchPaths ();
+
+ bool
+ GetEnableAutoImportClangModules () const;
+
bool
GetEnableSyntheticValue () const;
@@ -189,9 +195,46 @@ public:
void
SetUserSpecifiedTrapHandlerNames (const Args &args);
-};
-typedef std::shared_ptr<TargetProperties> TargetPropertiesSP;
+ bool
+ GetNonStopModeEnabled () const;
+
+ void
+ SetNonStopModeEnabled (bool b);
+
+ bool
+ GetDisplayRuntimeSupportValues () const;
+
+ void
+ SetDisplayRuntimeSupportValues (bool b);
+
+ const ProcessLaunchInfo &
+ GetProcessLaunchInfo();
+
+ void
+ SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info);
+
+private:
+ //------------------------------------------------------------------
+ // Callbacks for m_launch_info.
+ //------------------------------------------------------------------
+ static void Arg0ValueChangedCallback(void *target_property_ptr, OptionValue *);
+ static void RunArgsValueChangedCallback(void *target_property_ptr, OptionValue *);
+ static void EnvVarsValueChangedCallback(void *target_property_ptr, OptionValue *);
+ static void InheritEnvValueChangedCallback(void *target_property_ptr, OptionValue *);
+ static void InputPathValueChangedCallback(void *target_property_ptr, OptionValue *);
+ static void OutputPathValueChangedCallback(void *target_property_ptr, OptionValue *);
+ static void ErrorPathValueChangedCallback(void *target_property_ptr, OptionValue *);
+ static void DetachOnErrorValueChangedCallback(void *target_property_ptr, OptionValue *);
+ static void DisableASLRValueChangedCallback(void *target_property_ptr, OptionValue *);
+ static void DisableSTDIOValueChangedCallback(void *target_property_ptr, OptionValue *);
+
+private:
+ //------------------------------------------------------------------
+ // Member variables.
+ //------------------------------------------------------------------
+ ProcessLaunchInfo m_launch_info;
+};
class EvaluateExpressionOptions
{
@@ -200,19 +243,20 @@ public:
EvaluateExpressionOptions() :
m_execution_policy(eExecutionPolicyOnlyWhenNeeded),
m_language (lldb::eLanguageTypeUnknown),
- m_coerce_to_id(false),
- m_unwind_on_error(true),
+ m_prefix (), // A prefix specific to this expression that is added after the prefix from the settings (if any)
+ m_coerce_to_id (false),
+ m_unwind_on_error (true),
m_ignore_breakpoints (false),
- m_keep_in_memory(false),
- m_try_others(true),
- m_stop_others(true),
- m_debug(false),
- m_trap_exceptions(true),
- m_generate_debug_info(false),
- m_result_is_internal(false),
- m_use_dynamic(lldb::eNoDynamicValues),
- m_timeout_usec(default_timeout),
- m_one_thread_timeout_usec(0),
+ m_keep_in_memory (false),
+ m_try_others (true),
+ m_stop_others (true),
+ m_debug (false),
+ m_trap_exceptions (true),
+ m_generate_debug_info (false),
+ m_result_is_internal (false),
+ m_use_dynamic (lldb::eNoDynamicValues),
+ m_timeout_usec (default_timeout),
+ m_one_thread_timeout_usec (0),
m_cancel_callback (nullptr),
m_cancel_callback_baton (nullptr)
{
@@ -247,7 +291,24 @@ public:
{
return m_coerce_to_id;
}
-
+
+ const char *
+ GetPrefix () const
+ {
+ if (m_prefix.empty())
+ return NULL;
+ return m_prefix.c_str();
+ }
+
+ void
+ SetPrefix (const char *prefix)
+ {
+ if (prefix && prefix[0])
+ m_prefix = prefix;
+ else
+ m_prefix.clear();
+ }
+
void
SetCoerceToId (bool coerce = true)
{
@@ -419,6 +480,7 @@ public:
private:
ExecutionPolicy m_execution_policy;
lldb::LanguageType m_language;
+ std::string m_prefix;
bool m_coerce_to_id;
bool m_unwind_on_error;
bool m_ignore_breakpoints;
@@ -474,35 +536,49 @@ public:
class TargetEventData : public EventData
{
public:
+ TargetEventData (const lldb::TargetSP &target_sp);
+
+ TargetEventData (const lldb::TargetSP &target_sp, const ModuleList &module_list);
+
+ virtual
+ ~TargetEventData();
static const ConstString &
GetFlavorString ();
virtual const ConstString &
- GetFlavor () const;
-
- TargetEventData (const lldb::TargetSP &new_target_sp);
-
- lldb::TargetSP &
- GetTarget()
+ GetFlavor () const
{
- return m_target_sp;
+ return TargetEventData::GetFlavorString ();
}
- virtual
- ~TargetEventData();
-
virtual void
Dump (Stream *s) const;
- static const lldb::TargetSP
- GetTargetFromEvent (const lldb::EventSP &event_sp);
-
static const TargetEventData *
- GetEventDataFromEvent (const Event *event_sp);
+ GetEventDataFromEvent (const Event *event_ptr);
+
+ static lldb::TargetSP
+ GetTargetFromEvent (const Event *event_ptr);
+
+ static ModuleList
+ GetModuleListFromEvent (const Event *event_ptr);
+
+ const lldb::TargetSP &
+ GetTarget() const
+ {
+ return m_target_sp;
+ }
+
+ const ModuleList &
+ GetModuleList() const
+ {
+ return m_module_list;
+ }
private:
lldb::TargetSP m_target_sp;
+ ModuleList m_module_list;
DISALLOW_COPY_AND_ASSIGN (TargetEventData);
};
@@ -513,14 +589,14 @@ public:
static void
SettingsTerminate ();
-// static lldb::UserSettingsControllerSP &
-// GetSettingsController ();
-
static FileSpecList
GetDefaultExecutableSearchPaths ();
static FileSpecList
GetDefaultDebugFileSearchPaths ();
+
+ static FileSpecList
+ GetDefaultClangModuleSearchPaths ();
static ArchSpec
GetDefaultArchitecture ();
@@ -539,7 +615,7 @@ public:
// Settings accessors
//----------------------------------------------------------------------
- static const TargetPropertiesSP &
+ static const lldb::TargetPropertiesSP &
GetGlobalProperties();
@@ -617,7 +693,11 @@ public:
Error
Launch (ProcessLaunchInfo &launch_info,
- Stream *stream); // Optional stream to receive first stop info
+ Stream *stream); // Optional stream to receive first stop info
+
+ Error
+ Attach (ProcessAttachInfo &attach_info,
+ Stream *stream); // Optional stream to receive first stop info
//------------------------------------------------------------------
// This part handles the breakpoints.
@@ -646,7 +726,8 @@ public:
LazyBool check_inlines,
LazyBool skip_prologue,
bool internal,
- bool request_hardware);
+ bool request_hardware,
+ LazyBool move_to_nearest_code);
// Use this to create breakpoint that matches regex against the source lines in files given in source_file_list:
lldb::BreakpointSP
@@ -654,7 +735,8 @@ public:
const FileSpecList *source_file_list,
RegularExpression &source_regex,
bool internal,
- bool request_hardware);
+ bool request_hardware,
+ LazyBool move_to_nearest_code);
// Use this to create a breakpoint from a load address
lldb::BreakpointSP
@@ -681,7 +763,8 @@ public:
// Use this to create a function breakpoint by name in containingModule, or all modules if it is NULL
// When "skip_prologue is set to eLazyBoolCalculate, we use the current target
- // setting, else we use the values passed in
+ // setting, else we use the values passed in.
+ // func_name_type_mask is or'ed values from the FunctionNameType enum.
lldb::BreakpointSP
CreateBreakpoint (const FileSpecList *containingModules,
const FileSpecList *containingSourceFiles,
@@ -692,11 +775,17 @@ public:
bool request_hardware);
lldb::BreakpointSP
- CreateExceptionBreakpoint (enum lldb::LanguageType language, bool catch_bp, bool throw_bp, bool internal);
+ CreateExceptionBreakpoint (enum lldb::LanguageType language,
+ bool catch_bp,
+ bool throw_bp,
+ bool internal,
+ Args *additional_args = nullptr,
+ Error *additional_args_error = nullptr);
// This is the same as the func_name breakpoint except that you can specify a vector of names. This is cheaper
// than a regular expression breakpoint in the case where you just want to set a breakpoint on a set of names
// you already know.
+ // func_name_type_mask is or'ed values from the FunctionNameType enum.
lldb::BreakpointSP
CreateBreakpoint (const FileSpecList *containingModules,
const FileSpecList *containingSourceFiles,
@@ -779,6 +868,9 @@ public:
ClearAllWatchpointHitCounts ();
bool
+ ClearAllWatchpointHistoricValues ();
+
+ bool
IgnoreAllWatchpoints (uint32_t ignore_count);
bool
@@ -1001,12 +1093,6 @@ public:
bool
ModuleIsExcludedForUnconstrainedSearches (const lldb::ModuleSP &module_sp);
- ArchSpec &
- GetArchitecture ()
- {
- return m_arch;
- }
-
const ArchSpec &
GetArchitecture () const
{
@@ -1034,6 +1120,9 @@ public:
bool
SetArchitecture (const ArchSpec &arch_spec);
+ bool
+ MergeArchitecture (const ArchSpec &arch_spec);
+
Debugger &
GetDebugger ()
{
@@ -1182,10 +1271,7 @@ public:
const EvaluateExpressionOptions& options = EvaluateExpressionOptions());
ClangPersistentVariables &
- GetPersistentVariables()
- {
- return m_persistent_variables;
- }
+ GetPersistentVariables();
//------------------------------------------------------------------
// Target Stop Hooks
@@ -1223,10 +1309,7 @@ public:
// Set the specifier. The stop hook will own the specifier, and is responsible for deleting it when we're done.
void
- SetSpecifier (SymbolContextSpecifier *specifier)
- {
- m_specifier_sp.reset (specifier);
- }
+ SetSpecifier (SymbolContextSpecifier *specifier);
SymbolContextSpecifier *
GetSpecifier ()
@@ -1387,13 +1470,13 @@ protected:
lldb::ProcessSP m_process_sp;
lldb::SearchFilterSP m_search_filter_sp;
PathMappingList m_image_search_paths;
- std::unique_ptr<ClangASTContext> m_scratch_ast_context_ap;
- std::unique_ptr<ClangASTSource> m_scratch_ast_source_ap;
- std::unique_ptr<ClangASTImporter> m_ast_importer_ap;
- std::unique_ptr<ClangModulesDeclVendor> m_clang_modules_decl_vendor_ap;
- ClangPersistentVariables m_persistent_variables; ///< These are the persistent variables associated with this process for the expression parser.
+ lldb::ClangASTContextUP m_scratch_ast_context_ap;
+ lldb::ClangASTSourceUP m_scratch_ast_source_ap;
+ lldb::ClangASTImporterUP m_ast_importer_ap;
+ lldb::ClangModulesDeclVendorUP m_clang_modules_decl_vendor_ap;
+ lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the persistent variables associated with this process for the expression parser.
- std::unique_ptr<SourceManager> m_source_manager_ap;
+ lldb::SourceManagerUP m_source_manager_ap;
typedef std::map<lldb::user_id_t, StopHookSP> StopHookCollection;
StopHookCollection m_stop_hooks;
diff --git a/include/lldb/Target/Thread.h b/include/lldb/Target/Thread.h
index 25c0c0e92bec..c6a3c8e9851a 100644
--- a/include/lldb/Target/Thread.h
+++ b/include/lldb/Target/Thread.h
@@ -205,22 +205,23 @@ public:
void
SetState (lldb::StateType state);
- lldb::StateType
- GetResumeState () const
- {
- return m_resume_state;
- }
-
- // This sets the "external resume state" of the thread. If the thread is suspended here, it should never
- // get scheduled. Note that just because a thread is marked as "running" does not mean we will let it run in
- // a given bit of process control. For instance "step" tries to stay on the selected thread it was issued on,
- // which may involve suspending other threads temporarily. This temporary suspension is NOT reflected in the
- // state set here and reported in GetResumeState.
- //
- // If you are just preparing all threads to run, you should not override the threads that are
- // marked as suspended by the debugger. In that case, pass override_suspend = false. If you want
- // to force the thread to run (e.g. the "thread continue" command, or are resetting the state
- // (e.g. in SBThread::Resume()), then pass true to override_suspend.
+ //------------------------------------------------------------------
+ /// Sets the USER resume state for this thread. If you set a thread to suspended with
+ /// this API, it won't take part in any of the arbitration for ShouldResume, and will stay
+ /// suspended even when other threads do get to run.
+ ///
+ /// N.B. This is not the state that is used internally by thread plans to implement
+ /// staying on one thread while stepping over a breakpoint, etc. The is the
+ /// TemporaryResume state, and if you are implementing some bit of strategy in the stepping
+ /// machinery you should be using that state and not the user resume state.
+ ///
+ /// If you are just preparing all threads to run, you should not override the threads that are
+ /// marked as suspended by the debugger. In that case, pass override_suspend = false. If you want
+ /// to force the thread to run (e.g. the "thread continue" command, or are resetting the state
+ /// (e.g. in SBThread::Resume()), then pass true to override_suspend.
+ /// @return
+ /// The User resume state for this thread.
+ //------------------------------------------------------------------
void
SetResumeState (lldb::StateType state, bool override_suspend = false)
{
@@ -229,6 +230,21 @@ public:
m_resume_state = state;
}
+ //------------------------------------------------------------------
+ /// Gets the USER resume state for this thread. This is not the same as what
+ /// this thread is going to do for any particular step, however if this thread
+ /// returns eStateSuspended, then the process control logic will never allow this
+ /// thread to run.
+ ///
+ /// @return
+ /// The User resume state for this thread.
+ //------------------------------------------------------------------
+ lldb::StateType
+ GetResumeState () const
+ {
+ return m_resume_state;
+ }
+
// This function is called on all the threads before "ShouldResume" and
// "WillResume" in case a thread needs to change its state before the
// ThreadList polls all the threads to figure out which ones actually
@@ -1315,8 +1331,8 @@ protected:
lldb::ProcessWP m_process_wp; ///< The process that owns this thread.
lldb::StopInfoSP m_stop_info_sp; ///< The private stop reason for this thread
uint32_t m_stop_info_stop_id; // This is the stop id for which the StopInfo is valid. Can use this so you know that
- uint32_t m_stop_info_override_stop_id; // The stop ID containing the last time the stop info was checked against the stop info override
// the thread's m_stop_info_sp is current and you don't have to fetch it again
+ uint32_t m_stop_info_override_stop_id; // The stop ID containing the last time the stop info was checked against the stop info override
const uint32_t m_index_id; ///< A unique 1 based index assigned to each thread for easy UI/command line access.
lldb::RegisterContextSP m_reg_context_sp; ///< The register context for this thread's current register state.
lldb::StateType m_state; ///< The state of our process.
diff --git a/include/lldb/Target/ThreadPlanCallUserExpression.h b/include/lldb/Target/ThreadPlanCallUserExpression.h
index 67ac642de7bd..e40762c928b5 100644
--- a/include/lldb/Target/ThreadPlanCallUserExpression.h
+++ b/include/lldb/Target/ThreadPlanCallUserExpression.h
@@ -15,7 +15,6 @@
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
-#include "lldb/Expression/ClangUserExpression.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlan.h"
#include "lldb/Target/ThreadPlanCallFunction.h"
@@ -31,7 +30,7 @@ public:
Address &function,
llvm::ArrayRef<lldb::addr_t> args,
const EvaluateExpressionOptions &options,
- ClangUserExpression::ClangUserExpressionSP &user_expression_sp);
+ lldb::ClangUserExpressionSP &user_expression_sp);
virtual
~ThreadPlanCallUserExpression ();
@@ -62,12 +61,12 @@ public:
protected:
private:
- ClangUserExpression::ClangUserExpressionSP m_user_expression_sp; // This is currently just used to ensure the
- // User expression the initiated this ThreadPlan
- // lives as long as the thread plan does.
+ lldb::ClangUserExpressionSP m_user_expression_sp; // This is currently just used to ensure the
+ // User expression the initiated this ThreadPlan
+ // lives as long as the thread plan does.
bool m_manage_materialization = false;
- lldb::ClangExpressionVariableSP m_result_var_sp; // If we are left to manage the materialization,
- // then stuff the result expression variable here.
+ lldb::ClangExpressionVariableSP m_result_var_sp; // If we are left to manage the materialization,
+ // then stuff the result expression variable here.
DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallUserExpression);
};
diff --git a/include/lldb/Target/ThreadPlanPython.h b/include/lldb/Target/ThreadPlanPython.h
index fa41af1915cd..ffcee018a5fb 100644
--- a/include/lldb/Target/ThreadPlanPython.h
+++ b/include/lldb/Target/ThreadPlanPython.h
@@ -16,6 +16,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
+#include "lldb/Core/StructuredData.h"
#include "lldb/Core/UserID.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Target/Process.h"
@@ -68,8 +69,8 @@ protected:
GetPlanRunState ();
private:
- std::string m_class_name;
- lldb::ScriptInterpreterObjectSP m_implementation_sp;
+ std::string m_class_name;
+ StructuredData::ObjectSP m_implementation_sp;
DISALLOW_COPY_AND_ASSIGN(ThreadPlanPython);
};
diff --git a/include/lldb/Utility/ConvertEnum.h b/include/lldb/Utility/ConvertEnum.h
new file mode 100644
index 000000000000..6d37484b0112
--- /dev/null
+++ b/include/lldb/Utility/ConvertEnum.h
@@ -0,0 +1,22 @@
+//===-- ConvertEnum.h -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLDB_UTILITY_CONVERTENUM_H
+#define LLDB_UTILITY_CONVERTENUM_H
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-private-enumerations.h"
+
+namespace lldb_private
+{
+
+const char *GetVoteAsCString(Vote vote);
+const char *GetSectionTypeAsCString(lldb::SectionType sect_type);
+}
+
+#endif
diff --git a/include/lldb/Utility/JSON.h b/include/lldb/Utility/JSON.h
new file mode 100644
index 000000000000..45ddb71b5e03
--- /dev/null
+++ b/include/lldb/Utility/JSON.h
@@ -0,0 +1,276 @@
+//===---------------------JSON.h --------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef utility_JSON_h_
+#define utility_JSON_h_
+
+#include "lldb/Core/Stream.h"
+
+#include <inttypes.h>
+#include <map>
+#include <memory>
+#include <stdint.h>
+#include <string>
+#include <vector>
+
+#include "llvm/Support/Casting.h"
+
+namespace lldb_private {
+ class JSONValue
+ {
+ public:
+ virtual void
+ Write (Stream& s) = 0;
+
+ typedef std::shared_ptr<JSONValue> SP;
+
+ enum class Kind
+ {
+ String,
+ Number,
+ True,
+ False,
+ Null,
+ Object,
+ Array
+ };
+
+ JSONValue (Kind k) :
+ m_kind(k)
+ {}
+
+ Kind
+ GetKind() const
+ {
+ return m_kind;
+ }
+
+ virtual
+ ~JSONValue () = default;
+
+ private:
+ const Kind m_kind;
+ };
+
+ class JSONString : public JSONValue
+ {
+ public:
+ JSONString ();
+ JSONString (const char* s);
+ JSONString (const std::string& s);
+
+ JSONString (const JSONString& s) = delete;
+ JSONString&
+ operator = (const JSONString& s) = delete;
+
+ virtual void
+ Write (Stream& s);
+
+ typedef std::shared_ptr<JSONString> SP;
+
+ std::string
+ GetData () { return m_data; }
+
+ static bool classof(const JSONValue *V)
+ {
+ return V->GetKind() == JSONValue::Kind::String;
+ }
+
+ virtual
+ ~JSONString () = default;
+
+ private:
+
+ static std::string
+ json_string_quote_metachars (const std::string&);
+
+ std::string m_data;
+ };
+
+ class JSONNumber : public JSONValue
+ {
+ public:
+ JSONNumber ();
+ JSONNumber (int64_t i);
+
+ JSONNumber (const JSONNumber& s) = delete;
+ JSONNumber&
+ operator = (const JSONNumber& s) = delete;
+
+ virtual void
+ Write (Stream& s);
+
+ typedef std::shared_ptr<JSONNumber> SP;
+
+ int64_t
+ GetData () { return m_data; }
+
+ static bool classof(const JSONValue *V)
+ {
+ return V->GetKind() == JSONValue::Kind::Number;
+ }
+
+ virtual
+ ~JSONNumber () = default;
+
+ private:
+ int64_t m_data;
+ };
+
+ class JSONTrue : public JSONValue
+ {
+ public:
+ JSONTrue ();
+
+ JSONTrue (const JSONTrue& s) = delete;
+ JSONTrue&
+ operator = (const JSONTrue& s) = delete;
+
+ virtual void
+ Write (Stream& s);
+
+ typedef std::shared_ptr<JSONTrue> SP;
+
+ static bool classof(const JSONValue *V)
+ {
+ return V->GetKind() == JSONValue::Kind::True;
+ }
+
+ virtual
+ ~JSONTrue () = default;
+ };
+
+ class JSONFalse : public JSONValue
+ {
+ public:
+ JSONFalse ();
+
+ JSONFalse (const JSONFalse& s) = delete;
+ JSONFalse&
+ operator = (const JSONFalse& s) = delete;
+
+ virtual void
+ Write (Stream& s);
+
+ typedef std::shared_ptr<JSONFalse> SP;
+
+ static bool classof(const JSONValue *V)
+ {
+ return V->GetKind() == JSONValue::Kind::False;
+ }
+
+ virtual
+ ~JSONFalse () = default;
+ };
+
+ class JSONNull : public JSONValue
+ {
+ public:
+ JSONNull ();
+
+ JSONNull (const JSONNull& s) = delete;
+ JSONNull&
+ operator = (const JSONNull& s) = delete;
+
+ virtual void
+ Write (Stream& s);
+
+ typedef std::shared_ptr<JSONNull> SP;
+
+ static bool classof(const JSONValue *V)
+ {
+ return V->GetKind() == JSONValue::Kind::Null;
+ }
+
+ virtual
+ ~JSONNull () = default;
+ };
+
+ class JSONObject : public JSONValue
+ {
+ public:
+ JSONObject ();
+
+ JSONObject (const JSONObject& s) = delete;
+ JSONObject&
+ operator = (const JSONObject& s) = delete;
+
+ virtual void
+ Write (Stream& s);
+
+ typedef std::shared_ptr<JSONObject> SP;
+
+ static bool classof(const JSONValue *V)
+ {
+ return V->GetKind() == JSONValue::Kind::Object;
+ }
+
+ bool
+ SetObject (const std::string& key,
+ JSONValue::SP value);
+
+ JSONValue::SP
+ GetObject (const std::string& key);
+
+ virtual
+ ~JSONObject () = default;
+
+ private:
+ typedef std::map<std::string, JSONValue::SP> Map;
+ typedef Map::iterator Iterator;
+ Map m_elements;
+ };
+
+ class JSONArray : public JSONValue
+ {
+ public:
+ JSONArray ();
+
+ JSONArray (const JSONArray& s) = delete;
+ JSONArray&
+ operator = (const JSONArray& s) = delete;
+
+ virtual void
+ Write (Stream& s);
+
+ typedef std::shared_ptr<JSONArray> SP;
+
+ static bool classof(const JSONValue *V)
+ {
+ return V->GetKind() == JSONValue::Kind::Array;
+ }
+
+ private:
+ typedef std::vector<JSONValue::SP> Vector;
+ typedef Vector::iterator Iterator;
+ typedef Vector::size_type Index;
+ typedef Vector::size_type Size;
+
+ public:
+ bool
+ SetObject (Index i,
+ JSONValue::SP value);
+
+ bool
+ AppendObject (JSONValue::SP value);
+
+ JSONValue::SP
+ GetObject (Index i);
+
+ Size
+ GetNumElements ();
+
+ virtual
+ ~JSONArray () = default;
+
+ Vector m_elements;
+ };
+}
+
+#endif // utility_ProcessStructReader_h_
diff --git a/include/lldb/Utility/LLDBAssert.h b/include/lldb/Utility/LLDBAssert.h
new file mode 100644
index 000000000000..5ca252f20032
--- /dev/null
+++ b/include/lldb/Utility/LLDBAssert.h
@@ -0,0 +1,30 @@
+//===----------------- LLDBAssert.h --------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef utility_LLDBAssert_h_
+#define utility_LLDBAssert_h_
+
+#include <assert.h>
+
+#ifdef LLDB_CONFIGURATION_DEBUG
+#define lldbassert(x) assert(x)
+#else
+#define lldbassert(x) lldb_private::lldb_assert(x, #x, __FUNCTION__, __FILE__, __LINE__)
+#endif
+
+namespace lldb_private {
+ void
+ lldb_assert (bool expression,
+ const char* expr_text,
+ const char* func,
+ const char* file,
+ unsigned int line);
+}
+
+#endif // utility_LLDBAssert_h_
diff --git a/include/lldb/Utility/NameMatches.h b/include/lldb/Utility/NameMatches.h
new file mode 100644
index 000000000000..5fe6565d06f9
--- /dev/null
+++ b/include/lldb/Utility/NameMatches.h
@@ -0,0 +1,19 @@
+//===-- NameMatches.h -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLDB_UTILITY_NAMEMATCHES_H
+#define LLDB_UTILITY_NAMEMATCHES_H
+
+#include "lldb/lldb-private-enumerations.h"
+
+namespace lldb_private
+{
+bool NameMatches(const char *name, NameMatchType match_type, const char *match);
+}
+
+#endif
diff --git a/include/lldb/Utility/PseudoTerminal.h b/include/lldb/Utility/PseudoTerminal.h
index 6ee598cefe08..595b2fc19bfd 100644
--- a/include/lldb/Utility/PseudoTerminal.h
+++ b/include/lldb/Utility/PseudoTerminal.h
@@ -175,7 +175,7 @@ public:
/// occur. This can be NULL if no error status is desired.
///
/// @return
- /// @li \b true when the a master files descriptor is
+ /// @li \b true when the master files descriptor is
/// successfully opened.
/// @li \b false if anything goes wrong.
///
@@ -207,7 +207,7 @@ public:
/// occur. This can be NULL if no error status is desired.
///
/// @return
- /// @li \b true when the a master files descriptor is
+ /// @li \b true when the master files descriptor is
/// successfully opened.
/// @li \b false if anything goes wrong.
///
diff --git a/include/lldb/Utility/SharingPtr.h b/include/lldb/Utility/SharingPtr.h
index 1b5f86bbe2df..5c77dad9f7ff 100644
--- a/include/lldb/Utility/SharingPtr.h
+++ b/include/lldb/Utility/SharingPtr.h
@@ -154,6 +154,7 @@ public:
void swap(SharingPtr& r);
void reset();
template<class Y> void reset(Y* p);
+ void reset(std::nullptr_t);
element_type* get() const {return ptr_;}
element_type& operator*() const {return *ptr_;}
@@ -295,6 +296,14 @@ SharingPtr<T>::reset()
}
template<class T>
+inline
+void
+SharingPtr<T>::reset (std::nullptr_t p)
+{
+ reset();
+}
+
+template<class T>
template<class Y>
inline
void
@@ -547,7 +556,7 @@ public:
if (cb_)
cb_(baton_, *this, false);
}
-
+
void SetCallback(Callback cb, void* baton)
{
cb_ = cb;
diff --git a/include/lldb/lldb-defines.h b/include/lldb/lldb-defines.h
index add182c13ecb..9dce69aef32b 100644
--- a/include/lldb/lldb-defines.h
+++ b/include/lldb/lldb-defines.h
@@ -12,7 +12,7 @@
#include "lldb/lldb-types.h"
-#if defined (_WIN32)
+#if defined (_MSC_VER)
#if defined(EXPORT_LIBLLDB)
#define LLDB_API __declspec(dllexport)
#elif defined(IMPORT_LIBLLDB)
diff --git a/include/lldb/lldb-enumerations.h b/include/lldb/lldb-enumerations.h
index f70ee0cd7b28..28614ffb23e1 100644
--- a/include/lldb/lldb-enumerations.h
+++ b/include/lldb/lldb-enumerations.h
@@ -10,12 +10,34 @@
#ifndef LLDB_lldb_enumerations_h_
#define LLDB_lldb_enumerations_h_
+#ifndef SWIG
+// With MSVC, the default type of an enum is always signed, even if one of the
+// enumerator values is too large to fit into a signed integer but would
+// otherwise fit into an unsigned integer. As a result of this, all of LLDB's
+// flag-style enumerations that specify something like eValueFoo = 1u << 31
+// result in negative values. This usually just results in a benign warning,
+// but in a few places we actually do comparisons on the enum values, which
+// would cause a real bug. Furthermore, there's no way to silence only this
+// warning, as it's part of -Wmicrosoft which also catches a whole slew of
+// other useful issues.
+//
+// To make matters worse, early versions of SWIG don't recognize the syntax
+// of specifying the underlying type of an enum (and Python doesn't care anyway)
+// so we need a way to specify the underlying type when the enum is being used
+// from C++ code, but just use a regular enum when swig is pre-processing.
+#define FLAGS_ENUM(Name) enum Name : unsigned
+#define FLAGS_ANONYMOUS_ENUM() enum : unsigned
+#else
+#define FLAGS_ENUM(Name) enum Name
+#define FLAGS_ANONYMOUS_ENUM() enum
+#endif
+
namespace lldb {
//----------------------------------------------------------------------
// Process and Thread States
//----------------------------------------------------------------------
- typedef enum StateType
+ enum StateType
{
eStateInvalid = 0,
eStateUnloaded, ///< Process is object is valid, but not currently loaded
@@ -31,12 +53,12 @@ namespace lldb {
eStateSuspended ///< Process or thread is in a suspended state as far
///< as the debugger is concerned while other processes
///< or threads get the chance to run.
- } StateType;
+ };
//----------------------------------------------------------------------
// Launch Flags
//----------------------------------------------------------------------
- typedef enum LaunchFlags
+ FLAGS_ENUM(LaunchFlags)
{
eLaunchFlagNone = 0u,
eLaunchFlagExec = (1u << 0), ///< Exec when launching and turn the calling process into a new process
@@ -49,46 +71,49 @@ namespace lldb {
eLaunchFlagLaunchInSeparateProcessGroup = (1u << 7), ///< Launch the process in a separate process group
eLaunchFlagDontSetExitStatus = (1u << 8), ///< If you are going to hand the process off (e.g. to debugserver)
///< set this flag so lldb & the handee don't race to set its exit status.
- eLaunchFlagDetachOnError = (1u << 9) ///< If set, then the client stub should detach rather than killing the debugee
+ eLaunchFlagDetachOnError = (1u << 9), ///< If set, then the client stub should detach rather than killing the debugee
///< if it loses connection with lldb.
- } LaunchFlags;
+ eLaunchFlagShellExpandArguments = (1u << 10), ///< Perform shell-style argument expansion
+ eLaunchFlagCloseTTYOnExit = (1u << 11), ///< Close the open TTY on exit
+ };
//----------------------------------------------------------------------
// Thread Run Modes
//----------------------------------------------------------------------
- typedef enum RunMode {
+ enum RunMode
+ {
eOnlyThisThread,
eAllThreads,
eOnlyDuringStepping
- } RunMode;
+ };
//----------------------------------------------------------------------
// Byte ordering definitions
//----------------------------------------------------------------------
- typedef enum ByteOrder
+ enum ByteOrder
{
eByteOrderInvalid = 0,
eByteOrderBig = 1,
eByteOrderPDP = 2,
eByteOrderLittle = 4
- } ByteOrder;
+ };
//----------------------------------------------------------------------
// Register encoding definitions
//----------------------------------------------------------------------
- typedef enum Encoding
+ enum Encoding
{
eEncodingInvalid = 0,
eEncodingUint, // unsigned integer
eEncodingSint, // signed integer
eEncodingIEEE754, // float
eEncodingVector // vector registers
- } Encoding;
+ };
//----------------------------------------------------------------------
// Display format definitions
//----------------------------------------------------------------------
- typedef enum Format
+ enum Format
{
eFormatDefault = 0,
eFormatInvalid = 0,
@@ -131,29 +156,29 @@ namespace lldb {
eFormatInstruction, // Disassemble an opcode
eFormatVoid, // Do not print this
kNumFormats
- } Format;
+ };
//----------------------------------------------------------------------
// Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls
//----------------------------------------------------------------------
- typedef enum DescriptionLevel
+ enum DescriptionLevel
{
eDescriptionLevelBrief = 0,
eDescriptionLevelFull,
eDescriptionLevelVerbose,
eDescriptionLevelInitial,
kNumDescriptionLevels
- } DescriptionLevel;
+ };
//----------------------------------------------------------------------
// Script interpreter types
//----------------------------------------------------------------------
- typedef enum ScriptLanguage
+ enum ScriptLanguage
{
eScriptLanguageNone,
eScriptLanguagePython,
eScriptLanguageDefault = eScriptLanguagePython
- } ScriptLanguage;
+ };
//----------------------------------------------------------------------
// Register numbering types
@@ -161,7 +186,7 @@ namespace lldb {
// any of these to the lldb internal register numbering scheme
// (eRegisterKindLLDB).
//----------------------------------------------------------------------
- typedef enum RegisterKind
+ enum RegisterKind
{
eRegisterKindGCC = 0, // the register numbers seen in eh_frame
eRegisterKindDWARF, // the register numbers seen DWARF
@@ -169,12 +194,12 @@ namespace lldb {
eRegisterKindGDB, // the register numbers gdb uses (matches stabs numbers)
eRegisterKindLLDB, // lldb's internal register numbers
kNumRegisterKinds
- } RegisterKind;
+ };
//----------------------------------------------------------------------
// Thread stop reasons
//----------------------------------------------------------------------
- typedef enum StopReason
+ enum StopReason
{
eStopReasonInvalid = 0,
eStopReasonNone,
@@ -187,12 +212,12 @@ namespace lldb {
eStopReasonPlanComplete,
eStopReasonThreadExiting,
eStopReasonInstrumentation
- } StopReason;
+ };
//----------------------------------------------------------------------
// Command Return Status Types
//----------------------------------------------------------------------
- typedef enum ReturnStatus
+ enum ReturnStatus
{
eReturnStatusInvalid,
eReturnStatusSuccessFinishNoResult,
@@ -202,13 +227,13 @@ namespace lldb {
eReturnStatusStarted,
eReturnStatusFailed,
eReturnStatusQuit
- } ReturnStatus;
+ };
//----------------------------------------------------------------------
// The results of expression evaluation:
//----------------------------------------------------------------------
- typedef enum ExpressionResults
+ enum ExpressionResults
{
eExpressionCompleted = 0,
eExpressionSetupError,
@@ -219,12 +244,12 @@ namespace lldb {
eExpressionTimedOut,
eExpressionResultUnavailable,
eExpressionStoppedForDebug
- } ExpressionResults;
+ };
//----------------------------------------------------------------------
// Connection Status Types
//----------------------------------------------------------------------
- typedef enum ConnectionStatus
+ enum ConnectionStatus
{
eConnectionStatusSuccess, // Success
eConnectionStatusEndOfFile, // End-of-file encountered
@@ -233,9 +258,9 @@ namespace lldb {
eConnectionStatusNoConnection, // No connection
eConnectionStatusLostConnection, // Lost connection while connected to a valid connection
eConnectionStatusInterrupted // Interrupted read
- } ConnectionStatus;
+ };
- typedef enum ErrorType
+ enum ErrorType
{
eErrorTypeInvalid,
eErrorTypeGeneric, ///< Generic errors that can be any value.
@@ -243,10 +268,10 @@ namespace lldb {
eErrorTypePOSIX, ///< POSIX error codes.
eErrorTypeExpression, ///< These are from the ExpressionResults enum.
eErrorTypeWin32 ///< Standard Win32 error codes.
- } ErrorType;
+ };
- typedef enum ValueType
+ enum ValueType
{
eValueTypeInvalid = 0,
eValueTypeVariableGlobal = 1, // globals variable
@@ -256,20 +281,20 @@ namespace lldb {
eValueTypeRegister = 5, // stack frame register value
eValueTypeRegisterSet = 6, // A collection of stack frame register values
eValueTypeConstResult = 7 // constant result variables
- } ValueType;
+ };
//----------------------------------------------------------------------
// Token size/granularities for Input Readers
//----------------------------------------------------------------------
- typedef enum InputReaderGranularity
+ enum InputReaderGranularity
{
eInputReaderGranularityInvalid = 0,
eInputReaderGranularityByte,
eInputReaderGranularityWord,
eInputReaderGranularityLine,
eInputReaderGranularityAll
- } InputReaderGranularity;
+ };
//------------------------------------------------------------------
/// These mask bits allow a common interface for queries that can
@@ -281,7 +306,7 @@ namespace lldb {
/// in this class, and requests that that item be resolved, or
/// indicates that the member did get resolved.
//------------------------------------------------------------------
- typedef enum SymbolContextItem
+ FLAGS_ENUM(SymbolContextItem)
{
eSymbolContextTarget = (1u << 0), ///< Set when \a target is requested from a query, or was located in query results
eSymbolContextModule = (1u << 1), ///< Set when \a module is requested from a query, or was located in query results
@@ -295,16 +320,16 @@ namespace lldb {
///< eSymbolContextVariable is potentially expensive to lookup so it isn't included in
///< eSymbolContextEverything which stops it from being used during frame PC lookups and
///< many other potential address to symbol context lookups.
- } SymbolContextItem;
+ };
- typedef enum Permissions
+ FLAGS_ENUM(Permissions)
{
ePermissionsWritable = (1u << 0),
ePermissionsReadable = (1u << 1),
ePermissionsExecutable = (1u << 2)
- } Permissions;
+ };
- typedef enum InputReaderAction
+ enum InputReaderAction
{
eInputReaderActivate, // reader is newly pushed onto the reader stack
eInputReaderAsynchronousOutputWritten, // an async output event occurred; the reader may want to do something
@@ -314,9 +339,9 @@ namespace lldb {
eInputReaderInterrupt, // reader received an interrupt signal (probably from a control-c)
eInputReaderEndOfFile, // reader received an EOF char (probably from a control-d)
eInputReaderDone // reader was just popped off the stack and is done
- } InputReaderAction;
+ };
- typedef enum BreakpointEventType
+ FLAGS_ENUM(BreakpointEventType)
{
eBreakpointEventTypeInvalidType = (1u << 0),
eBreakpointEventTypeAdded = (1u << 1),
@@ -330,9 +355,9 @@ namespace lldb {
eBreakpointEventTypeConditionChanged = (1u << 9),
eBreakpointEventTypeIgnoreChanged = (1u << 10),
eBreakpointEventTypeThreadChanged = (1u << 11)
- } BreakpointEventType;
+ };
- typedef enum WatchpointEventType
+ FLAGS_ENUM(WatchpointEventType)
{
eWatchpointEventTypeInvalidType = (1u << 0),
eWatchpointEventTypeAdded = (1u << 1),
@@ -344,7 +369,7 @@ namespace lldb {
eWatchpointEventTypeIgnoreChanged = (1u << 10),
eWatchpointEventTypeThreadChanged = (1u << 11),
eWatchpointEventTypeTypeChanged = (1u << 12)
- } WatchpointEventType;
+ };
//----------------------------------------------------------------------
@@ -355,7 +380,7 @@ namespace lldb {
/// The enum -> string code is in LanguageRuntime.cpp, don't change this
/// table without updating that code as well.
//----------------------------------------------------------------------
- typedef enum LanguageType
+ enum LanguageType
{
eLanguageTypeUnknown = 0x0000, ///< Unknown or invalid language value.
eLanguageTypeC89 = 0x0001, ///< ISO C:1989.
@@ -395,31 +420,39 @@ namespace lldb {
eLanguageTypeC_plus_plus_14 = 0x0021, ///< ISO C++:2014.
eLanguageTypeFortran03 = 0x0022, ///< ISO Fortran 2003.
eLanguageTypeFortran08 = 0x0023, ///< ISO Fortran 2008.
+ // Vendor Extensions
+ // Note: LanguageRuntime::GetNameForLanguageType
+ // assumes these can be used as indexes into array language_names, and
+ // Language::SetLanguageFromCString and Language::AsCString
+ // assume these can be used as indexes into array g_languages.
+ eLanguageTypeMipsAssembler = 0x0024, ///< Mips_Assembler.
+ eLanguageTypeExtRenderScript = 0x0025, ///< RenderScript.
eNumLanguageTypes
- } LanguageType;
+ };
- typedef enum InstrumentationRuntimeType {
+ enum InstrumentationRuntimeType
+ {
eInstrumentationRuntimeTypeAddressSanitizer = 0x0000,
eNumInstrumentationRuntimeTypes
- } InstrumentationRuntimeType;
+ };
- typedef enum DynamicValueType
+ enum DynamicValueType
{
eNoDynamicValues = 0,
eDynamicCanRunTarget = 1,
eDynamicDontRunTarget = 2
- } DynamicValueType;
+ };
- typedef enum AccessType
+ enum AccessType
{
eAccessNone,
eAccessPublic,
eAccessPrivate,
eAccessProtected,
eAccessPackage
- } AccessType;
+ };
- typedef enum CommandArgumentType
+ enum CommandArgumentType
{
eArgTypeAddress = 0,
eArgTypeAddressOrExpression,
@@ -493,6 +526,7 @@ namespace lldb {
eArgTypeThreadID,
eArgTypeThreadIndex,
eArgTypeThreadName,
+ eArgTypeTypeName,
eArgTypeUnsignedInteger,
eArgTypeUnixSignal,
eArgTypeVarName,
@@ -504,12 +538,12 @@ namespace lldb {
eArgTypeWatchpointIDRange,
eArgTypeWatchType,
eArgTypeLastArg // Always keep this entry as the last entry in this enumeration!!
- } CommandArgumentType;
+ };
//----------------------------------------------------------------------
// Symbol types
//----------------------------------------------------------------------
- typedef enum SymbolType
+ enum SymbolType
{
eSymbolTypeAny = 0,
eSymbolTypeInvalid = 0,
@@ -541,9 +575,9 @@ namespace lldb {
eSymbolTypeObjCMetaClass,
eSymbolTypeObjCIVar,
eSymbolTypeReExported
- } SymbolType;
+ };
- typedef enum SectionType
+ enum SectionType
{
eSectionTypeInvalid,
eSectionTypeCode,
@@ -582,17 +616,16 @@ namespace lldb {
eSectionTypeEHFrame,
eSectionTypeCompactUnwind, // compact unwind section in Mach-O, __TEXT,__unwind_info
eSectionTypeOther
-
- } SectionType;
+ };
- typedef enum EmulateInstructionOptions
+ FLAGS_ENUM(EmulateInstructionOptions)
{
eEmulateInstructionOptionNone = (0u),
eEmulateInstructionOptionAutoAdvancePC = (1u << 0),
eEmulateInstructionOptionIgnoreConditions = (1u << 1)
- } EmulateInstructionOptions;
+ };
- typedef enum FunctionNameType
+ FLAGS_ENUM(FunctionNameType)
{
eFunctionNameTypeNone = 0u,
eFunctionNameTypeAuto = (1u << 1), // Automatically figure out which FunctionNameType
@@ -607,13 +640,13 @@ namespace lldb {
eFunctionNameTypeMethod = (1u << 4), // Find function by method name (C++) with no namespace or arguments
eFunctionNameTypeSelector = (1u << 5), // Find function by selector name (ObjC) names
eFunctionNameTypeAny = eFunctionNameTypeAuto // DEPRECATED: use eFunctionNameTypeAuto
- } FunctionNameType;
+ };
//----------------------------------------------------------------------
// Basic types enumeration for the public API SBType::GetBasicType()
//----------------------------------------------------------------------
- typedef enum BasicType
+ enum BasicType
{
eBasicTypeInvalid = 0,
eBasicTypeVoid = 1,
@@ -648,9 +681,9 @@ namespace lldb {
eBasicTypeObjCSel,
eBasicTypeNullPtr,
eBasicTypeOther
- } BasicType;
+ };
- typedef enum TypeClass
+ FLAGS_ENUM(TypeClass)
{
eTypeClassInvalid = (0u),
eTypeClassArray = (1u << 0),
@@ -675,9 +708,9 @@ namespace lldb {
eTypeClassOther = (1u << 31),
// Define a mask that can be used for any type when finding types
eTypeClassAny = (0xffffffffu)
- } TypeClass;
+ };
- typedef enum TemplateArgumentKind
+ enum TemplateArgumentKind
{
eTemplateArgumentKindNull = 0,
eTemplateArgumentKindType,
@@ -688,13 +721,13 @@ namespace lldb {
eTemplateArgumentKindExpression,
eTemplateArgumentKindPack
- } TemplateArgumentKind;
+ };
//----------------------------------------------------------------------
// Options that can be set for a formatter to alter its behavior
// Not all of these are applicable to all formatter types
//----------------------------------------------------------------------
- typedef enum TypeOptions
+ FLAGS_ENUM(TypeOptions)
{
eTypeOptionNone = (0u),
eTypeOptionCascade = (1u << 0),
@@ -703,8 +736,9 @@ namespace lldb {
eTypeOptionHideChildren = (1u << 3),
eTypeOptionHideValue = (1u << 4),
eTypeOptionShowOneLiner = (1u << 5),
- eTypeOptionHideNames = (1u << 6)
- } TypeOptions;
+ eTypeOptionHideNames = (1u << 6),
+ eTypeOptionNonCacheable = (1u << 7)
+ };
//----------------------------------------------------------------------
// This is the return value for frame comparisons. If you are comparing frame A to frame B
@@ -717,7 +751,7 @@ namespace lldb {
// 5) If the two frames are on different threads or processes the comparision is Invalid
// 6) If for some reason we can't figure out what went on, we return Unknown.
//----------------------------------------------------------------------
- typedef enum FrameComparison
+ enum FrameComparison
{
eFrameCompareInvalid,
eFrameCompareUnknown,
@@ -725,7 +759,7 @@ namespace lldb {
eFrameCompareSameParent,
eFrameCompareYounger,
eFrameCompareOlder
- } FrameComparison;
+ };
//----------------------------------------------------------------------
// Address Class
@@ -737,7 +771,7 @@ namespace lldb {
// might contain PC relative data and the object file might be able to
// tell us that an address in code is data.
//----------------------------------------------------------------------
- typedef enum AddressClass
+ enum AddressClass
{
eAddressClassInvalid,
eAddressClassUnknown,
@@ -746,7 +780,7 @@ namespace lldb {
eAddressClassData,
eAddressClassDebug,
eAddressClassRuntime
- } AddressClass;
+ };
//----------------------------------------------------------------------
// File Permissions
@@ -755,7 +789,7 @@ namespace lldb {
// used with functions that set 'mode_t' to certain values for
// permissions.
//----------------------------------------------------------------------
- typedef enum FilePermissions
+ FLAGS_ENUM(FilePermissions)
{
eFilePermissionsUserRead = (1u << 8),
eFilePermissionsUserWrite = (1u << 7),
@@ -788,7 +822,7 @@ namespace lldb {
eFilePermissionsEveryoneRWX = (eFilePermissionsEveryoneR | eFilePermissionsEveryoneW | eFilePermissionsEveryoneX ),
eFilePermissionsFileDefault = eFilePermissionsUserRW,
eFilePermissionsDirectoryDefault = eFilePermissionsUserRWX,
- } FilePermissions;
+ };
//----------------------------------------------------------------------
// Queue work item types
@@ -796,24 +830,24 @@ namespace lldb {
// The different types of work that can be enqueued on a libdispatch
// aka Grand Central Dispatch (GCD) queue.
//----------------------------------------------------------------------
- typedef enum QueueItemKind
+ enum QueueItemKind
{
eQueueItemKindUnknown = 0,
eQueueItemKindFunction,
eQueueItemKindBlock
- } QueueItemKind;
+ };
//----------------------------------------------------------------------
// Queue type
// libdispatch aka Grand Central Dispatch (GCD) queues can be either serial
// (executing on one thread) or concurrent (executing on multiple threads).
//----------------------------------------------------------------------
- typedef enum QueueKind
+ enum QueueKind
{
eQueueKindUnknown = 0,
eQueueKindSerial,
eQueueKindConcurrent
- } QueueKind;
+ };
//----------------------------------------------------------------------
// Expression Evaluation Stages
@@ -821,13 +855,13 @@ namespace lldb {
// expression evaluation callback, so that you can interrupt expression
// evaluation at the various points in its lifecycle.
//----------------------------------------------------------------------
- typedef enum ExpressionEvaluationPhase
+ enum ExpressionEvaluationPhase
{
eExpressionEvaluationParse = 0,
eExpressionEvaluationIRGen,
eExpressionEvaluationExecution,
eExpressionEvaluationComplete
- } ExpressionEvaluationPhase;
+ };
//----------------------------------------------------------------------
@@ -835,13 +869,13 @@ namespace lldb {
// Indicates what types of events cause the watchpoint to fire.
// Used by Native*Protocol-related classes.
//----------------------------------------------------------------------
- typedef enum WatchpointKind
+ FLAGS_ENUM(WatchpointKind)
{
eWatchpointKindRead = (1u << 0),
eWatchpointKindWrite = (1u << 1)
- } WatchpointKind;
+ };
- typedef enum GdbSignal
+ enum GdbSignal
{
eGdbSignalBadAccess = 0x91,
eGdbSignalBadInstruction = 0x92,
@@ -849,52 +883,55 @@ namespace lldb {
eGdbSignalEmulation = 0x94,
eGdbSignalSoftware = 0x95,
eGdbSignalBreakpoint = 0x96
- } GdbRemoteSignal;
+ };
//----------------------------------------------------------------------
// Used with SBHost::GetPath (lldb::PathType) to find files that are
// related to LLDB on the current host machine. Most files are relative
// to LLDB or are in known locations.
//----------------------------------------------------------------------
- typedef enum PathType
- {
- ePathTypeLLDBShlibDir, // The directory where the lldb.so (unix) or LLDB mach-o file in LLDB.framework (MacOSX) exists
- ePathTypeSupportExecutableDir, // Find LLDB support executable directory (debugserver, etc)
- ePathTypeHeaderDir, // Find LLDB header file directory
- ePathTypePythonDir, // Find Python modules (PYTHONPATH) directory
- ePathTypeLLDBSystemPlugins, // System plug-ins directory
- ePathTypeLLDBUserPlugins, // User plug-ins directory
- ePathTypeLLDBTempSystemDir, // The LLDB temp directory for this system that will be cleaned up on exit
- ePathTypeClangDir // Find path to Clang builtin headers
- } PathType;
+ enum PathType
+ {
+ ePathTypeLLDBShlibDir, // The directory where the lldb.so (unix) or LLDB mach-o file in LLDB.framework (MacOSX) exists
+ ePathTypeSupportExecutableDir, // Find LLDB support executable directory (debugserver, etc)
+ ePathTypeHeaderDir, // Find LLDB header file directory
+ ePathTypePythonDir, // Find Python modules (PYTHONPATH) directory
+ ePathTypeLLDBSystemPlugins, // System plug-ins directory
+ ePathTypeLLDBUserPlugins, // User plug-ins directory
+ ePathTypeLLDBTempSystemDir, // The LLDB temp directory for this system that will be cleaned up on exit
+ ePathTypeGlobalLLDBTempSystemDir, // The LLDB temp directory for this system, NOT cleaned up on a process exit.
+ ePathTypeClangDir // Find path to Clang builtin headers
+ };
//----------------------------------------------------------------------
// Kind of member function
// Used by the type system
//----------------------------------------------------------------------
- typedef enum MemberFunctionKind
+ enum MemberFunctionKind
{
eMemberFunctionKindUnknown = 0, // Not sure what the type of this is
eMemberFunctionKindConstructor, // A function used to create instances
eMemberFunctionKindDestructor, // A function used to tear down existing instances
eMemberFunctionKindInstanceMethod, // A function that applies to a specific instance
eMemberFunctionKindStaticMethod // A function that applies to a type rather than any instance
- } MemberFunctionKind;
+ };
//----------------------------------------------------------------------
// String matching algorithm used by SBTarget
//----------------------------------------------------------------------
- typedef enum MatchType {
+ enum MatchType
+ {
eMatchTypeNormal,
eMatchTypeRegex,
eMatchTypeStartsWith
- } MatchType;
+ };
//----------------------------------------------------------------------
// Bitmask that describes details about a type
//----------------------------------------------------------------------
- typedef enum TypeFlags {
+ FLAGS_ENUM(TypeFlags)
+ {
eTypeHasChildren = (1u << 0),
eTypeHasValue = (1u << 1),
eTypeIsArray = (1u << 2),
@@ -917,17 +954,100 @@ namespace lldb {
eTypeIsFloat = (1u << 19),
eTypeIsComplex = (1u << 20),
eTypeIsSigned = (1u << 21)
- } TypeFlags;
+ };
+
+ FLAGS_ENUM(CommandFlags)
+ {
+ //----------------------------------------------------------------------
+ // eCommandRequiresTarget
+ //
+ // Ensures a valid target is contained in m_exe_ctx prior to executing
+ // the command. If a target doesn't exist or is invalid, the command
+ // will fail and CommandObject::GetInvalidTargetDescription() will be
+ // returned as the error. CommandObject subclasses can override the
+ // virtual function for GetInvalidTargetDescription() to provide custom
+ // strings when needed.
+ //----------------------------------------------------------------------
+ eCommandRequiresTarget = (1u << 0),
+ //----------------------------------------------------------------------
+ // eCommandRequiresProcess
+ //
+ // Ensures a valid process is contained in m_exe_ctx prior to executing
+ // the command. If a process doesn't exist or is invalid, the command
+ // will fail and CommandObject::GetInvalidProcessDescription() will be
+ // returned as the error. CommandObject subclasses can override the
+ // virtual function for GetInvalidProcessDescription() to provide custom
+ // strings when needed.
+ //----------------------------------------------------------------------
+ eCommandRequiresProcess = (1u << 1),
+ //----------------------------------------------------------------------
+ // eCommandRequiresThread
+ //
+ // Ensures a valid thread is contained in m_exe_ctx prior to executing
+ // the command. If a thread doesn't exist or is invalid, the command
+ // will fail and CommandObject::GetInvalidThreadDescription() will be
+ // returned as the error. CommandObject subclasses can override the
+ // virtual function for GetInvalidThreadDescription() to provide custom
+ // strings when needed.
+ //----------------------------------------------------------------------
+ eCommandRequiresThread = (1u << 2),
+ //----------------------------------------------------------------------
+ // eCommandRequiresFrame
+ //
+ // Ensures a valid frame is contained in m_exe_ctx prior to executing
+ // the command. If a frame doesn't exist or is invalid, the command
+ // will fail and CommandObject::GetInvalidFrameDescription() will be
+ // returned as the error. CommandObject subclasses can override the
+ // virtual function for GetInvalidFrameDescription() to provide custom
+ // strings when needed.
+ //----------------------------------------------------------------------
+ eCommandRequiresFrame = (1u << 3),
+ //----------------------------------------------------------------------
+ // eCommandRequiresRegContext
+ //
+ // Ensures a valid register context (from the selected frame if there
+ // is a frame in m_exe_ctx, or from the selected thread from m_exe_ctx)
+ // is available from m_exe_ctx prior to executing the command. If a
+ // target doesn't exist or is invalid, the command will fail and
+ // CommandObject::GetInvalidRegContextDescription() will be returned as
+ // the error. CommandObject subclasses can override the virtual function
+ // for GetInvalidRegContextDescription() to provide custom strings when
+ // needed.
+ //----------------------------------------------------------------------
+ eCommandRequiresRegContext = (1u << 4),
+ //----------------------------------------------------------------------
+ // eCommandTryTargetAPILock
+ //
+ // Attempts to acquire the target lock if a target is selected in the
+ // command interpreter. If the command object fails to acquire the API
+ // lock, the command will fail with an appropriate error message.
+ //----------------------------------------------------------------------
+ eCommandTryTargetAPILock = (1u << 5),
+ //----------------------------------------------------------------------
+ // eCommandProcessMustBeLaunched
+ //
+ // Verifies that there is a launched process in m_exe_ctx, if there
+ // isn't, the command will fail with an appropriate error message.
+ //----------------------------------------------------------------------
+ eCommandProcessMustBeLaunched = (1u << 6),
+ //----------------------------------------------------------------------
+ // eCommandProcessMustBePaused
+ //
+ // Verifies that there is a paused process in m_exe_ctx, if there
+ // isn't, the command will fail with an appropriate error message.
+ //----------------------------------------------------------------------
+ eCommandProcessMustBePaused = (1u << 7)
+ };
//----------------------------------------------------------------------
// Whether a summary should cap how much data it returns to users or not
//----------------------------------------------------------------------
- typedef enum TypeSummaryCapping {
+ enum TypeSummaryCapping
+ {
eTypeSummaryCapped = true,
eTypeSummaryUncapped = false
- } TypeSummaryCapping;
+ };
} // namespace lldb
-
#endif // LLDB_lldb_enumerations_h_
diff --git a/include/lldb/lldb-forward.h b/include/lldb/lldb-forward.h
index 53f59dd62096..e0c2ae4b8b8d 100644
--- a/include/lldb/lldb-forward.h
+++ b/include/lldb/lldb-forward.h
@@ -58,6 +58,7 @@ class ClangExpressionVariableList;
class ClangExpressionVariableList;
class ClangExpressionVariables;
class ClangFunction;
+class ClangModulesDeclVendor;
class ClangPersistentVariables;
class ClangUserExpression;
class ClangUtilityFunction;
@@ -82,6 +83,7 @@ class Debugger;
class Declaration;
class Disassembler;
struct DumpValueObjectOptions;
+class DynamicCheckerFunctions;
class DynamicLoader;
class Editline;
class EmulateInstruction;
@@ -111,8 +113,9 @@ class IOHandler;
class IOObject;
class IRExecutionUnit;
class JITLoader;
+class JITLoaderList;
class LanguageRuntime;
-class SystemRuntime;
+class MemoryRegionInfo;
class LineTable;
class Listener;
class Log;
@@ -146,6 +149,7 @@ class OptionValueEnumeration;
class OptionValueFileSpec;
class OptionValueFileSpecList;
class OptionValueFormat;
+class OptionValueLanguage;
class OptionValueFormatEntity;
class OptionValuePathMappings;
class OptionValueProperties;
@@ -167,11 +171,6 @@ class ProcessInstanceInfoMatch;
class ProcessLaunchInfo;
class Property;
struct PropertyDefinition;
-class PythonArray;
-class PythonDictionary;
-class PythonInteger;
-class PythonObject;
-class PythonString;
class RegisterCheckpoint;
class RegisterContext;
class RegisterLocation;
@@ -181,9 +180,7 @@ class RegularExpression;
class Scalar;
class ScriptInterpreter;
class ScriptInterpreterLocker;
-class ScriptInterpreterObject;
#ifndef LLDB_DISABLE_PYTHON
-class ScriptInterpreterPython;
struct ScriptSummaryFormat;
#endif
class SearchFilter;
@@ -209,6 +206,7 @@ class StreamFile;
class StreamString;
class StringList;
struct StringSummaryFormat;
+class SystemRuntime;
class TypeSummaryImpl;
class TypeSummaryOptions;
class Symbol;
@@ -231,6 +229,7 @@ class QueueItem;
class QueueImpl;
class Target;
class TargetList;
+class TargetProperties;
class Thread;
class ThreadCollection;
class ThreadList;
@@ -300,7 +299,13 @@ namespace lldb {
typedef std::weak_ptr<lldb_private::BreakpointLocation> BreakpointLocationWP;
typedef std::shared_ptr<lldb_private::BreakpointResolver> BreakpointResolverSP;
typedef std::shared_ptr<lldb_private::Broadcaster> BroadcasterSP;
+ typedef std::unique_ptr<lldb_private::ClangASTContext> ClangASTContextUP;
+ typedef std::unique_ptr<lldb_private::ClangASTImporter> ClangASTImporterUP;
+ typedef std::unique_ptr<lldb_private::ClangASTSource> ClangASTSourceUP;
typedef std::shared_ptr<lldb_private::ClangExpressionVariable> ClangExpressionVariableSP;
+ typedef std::unique_ptr<lldb_private::ClangModulesDeclVendor> ClangModulesDeclVendorUP;
+ typedef std::unique_ptr<lldb_private::ClangPersistentVariables> ClangPersistentVariablesUP;
+ typedef std::shared_ptr<lldb_private::ClangUserExpression> ClangUserExpressionSP;
typedef std::shared_ptr<lldb_private::CommandObject> CommandObjectSP;
typedef std::shared_ptr<lldb_private::Communication> CommunicationSP;
typedef std::shared_ptr<lldb_private::Connection> ConnectionSP;
@@ -310,7 +315,9 @@ namespace lldb {
typedef std::shared_ptr<lldb_private::Debugger> DebuggerSP;
typedef std::weak_ptr<lldb_private::Debugger> DebuggerWP;
typedef std::shared_ptr<lldb_private::Disassembler> DisassemblerSP;
+ typedef std::unique_ptr<lldb_private::DynamicCheckerFunctions> DynamicCheckerFunctionsUP;
typedef std::shared_ptr<lldb_private::DynamicLoader> DynamicLoaderSP;
+ typedef std::unique_ptr<lldb_private::DynamicLoader> DynamicLoaderUP;
typedef std::shared_ptr<lldb_private::Event> EventSP;
typedef std::shared_ptr<lldb_private::ExecutionContextRef> ExecutionContextRefSP;
typedef std::shared_ptr<lldb_private::File> FileSP;
@@ -322,8 +329,10 @@ namespace lldb {
typedef std::shared_ptr<lldb_private::IOHandler> IOHandlerSP;
typedef std::shared_ptr<lldb_private::IOObject> IOObjectSP;
typedef std::shared_ptr<lldb_private::JITLoader> JITLoaderSP;
+ typedef std::unique_ptr<lldb_private::JITLoaderList> JITLoaderListUP;
typedef std::shared_ptr<lldb_private::LanguageRuntime> LanguageRuntimeSP;
typedef std::shared_ptr<lldb_private::SystemRuntime> SystemRuntimeSP;
+ typedef std::unique_ptr<lldb_private::SystemRuntime> SystemRuntimeUP;
typedef std::shared_ptr<lldb_private::LineTable> LineTableSP;
typedef std::shared_ptr<lldb_private::Listener> ListenerSP;
typedef std::shared_ptr<lldb_private::LogChannel> LogChannelSP;
@@ -334,6 +343,7 @@ namespace lldb {
typedef std::weak_ptr<lldb_private::ObjectFile> ObjectFileWP;
typedef std::shared_ptr<lldb_private::ObjectFileJITDelegate> ObjectFileJITDelegateSP;
typedef std::weak_ptr<lldb_private::ObjectFileJITDelegate> ObjectFileJITDelegateWP;
+ typedef std::unique_ptr<lldb_private::OperatingSystem> OperatingSystemUP;
typedef std::shared_ptr<lldb_private::OptionValue> OptionValueSP;
typedef std::weak_ptr<lldb_private::OptionValue> OptionValueWP;
typedef std::shared_ptr<lldb_private::OptionValueArch> OptionValueArchSP;
@@ -363,15 +373,16 @@ namespace lldb {
typedef std::shared_ptr<lldb_private::Queue> QueueSP;
typedef std::weak_ptr<lldb_private::Queue> QueueWP;
typedef std::shared_ptr<lldb_private::QueueItem> QueueItemSP;
- typedef std::shared_ptr<lldb_private::ScriptInterpreterObject> ScriptInterpreterObjectSP;
#ifndef LLDB_DISABLE_PYTHON
typedef std::shared_ptr<lldb_private::ScriptSummaryFormat> ScriptSummaryFormatSP;
#endif // #ifndef LLDB_DISABLE_PYTHON
typedef std::shared_ptr<lldb_private::Section> SectionSP;
+ typedef std::unique_ptr<lldb_private::SectionList> SectionListUP;
typedef std::weak_ptr<lldb_private::Section> SectionWP;
typedef std::shared_ptr<lldb_private::SectionLoadList> SectionLoadListSP;
typedef std::shared_ptr<lldb_private::SearchFilter> SearchFilterSP;
typedef std::shared_ptr<lldb_private::Settings> SettingsSP;
+ typedef std::unique_ptr<lldb_private::SourceManager> SourceManagerUP;
typedef std::shared_ptr<lldb_private::StackFrame> StackFrameSP;
typedef std::unique_ptr<lldb_private::StackFrame> StackFrameUP;
typedef std::weak_ptr<lldb_private::StackFrame> StackFrameWP;
@@ -386,10 +397,12 @@ namespace lldb {
typedef std::shared_ptr<lldb_private::SymbolFileType> SymbolFileTypeSP;
typedef std::weak_ptr<lldb_private::SymbolFileType> SymbolFileTypeWP;
typedef std::shared_ptr<lldb_private::SymbolContextSpecifier> SymbolContextSpecifierSP;
+ typedef std::unique_ptr<lldb_private::SymbolVendor> SymbolVendorUP;
typedef std::shared_ptr<lldb_private::SyntheticChildren> SyntheticChildrenSP;
typedef std::shared_ptr<lldb_private::SyntheticChildrenFrontEnd> SyntheticChildrenFrontEndSP;
typedef std::shared_ptr<lldb_private::Target> TargetSP;
typedef std::weak_ptr<lldb_private::Target> TargetWP;
+ typedef std::shared_ptr<lldb_private::TargetProperties> TargetPropertiesSP;
typedef std::shared_ptr<lldb_private::Thread> ThreadSP;
typedef std::weak_ptr<lldb_private::Thread> ThreadWP;
typedef std::shared_ptr<lldb_private::ThreadCollection> ThreadCollectionSP;
@@ -419,7 +432,7 @@ namespace lldb {
typedef std::shared_ptr<lldb_private::VariableList> VariableListSP;
typedef std::shared_ptr<lldb_private::ValueObjectList> ValueObjectListSP;
typedef std::shared_ptr<lldb_private::Watchpoint> WatchpointSP;
-
+
} // namespace lldb
diff --git a/include/lldb/lldb-private-interfaces.h b/include/lldb/lldb-private-interfaces.h
index f35938ce17b7..7b5c1c9d2c05 100644
--- a/include/lldb/lldb-private-interfaces.h
+++ b/include/lldb/lldb-private-interfaces.h
@@ -29,6 +29,7 @@ namespace lldb_private
typedef EmulateInstruction * (*EmulateInstructionCreateInstance) (const ArchSpec &arch, InstructionType inst_type);
typedef OperatingSystem* (*OperatingSystemCreateInstance) (Process *process, bool force);
typedef LanguageRuntime *(*LanguageRuntimeCreateInstance) (Process *process, lldb::LanguageType language);
+ typedef lldb::CommandObjectSP (*LanguageRuntimeGetCommandObject) (CommandInterpreter& interpreter);
typedef SystemRuntime *(*SystemRuntimeCreateInstance) (Process *process);
typedef lldb::PlatformSP (*PlatformCreateInstance) (bool force, const ArchSpec *arch);
typedef lldb::ProcessSP (*ProcessCreateInstance) (Target &target, Listener &listener, const FileSpec *crash_file_path);
diff --git a/include/lldb/lldb-private-types.h b/include/lldb/lldb-private-types.h
index cd4867238ef9..cce637fce279 100644
--- a/include/lldb/lldb-private-types.h
+++ b/include/lldb/lldb-private-types.h
@@ -14,11 +14,22 @@
#include "lldb/lldb-private.h"
+namespace llvm
+{
+namespace sys
+{
+class DynamicLibrary;
+}
+}
+
namespace lldb_private
{
class Platform;
class ExecutionContext;
+ typedef llvm::sys::DynamicLibrary (*LoadPluginCallbackType)(const lldb::DebuggerSP &debugger_sp,
+ const FileSpec &spec, Error &error);
+
//----------------------------------------------------------------------
// Every register is described in detail including its name, alternate
// name (optional), encoding, size in bytes and the default display
diff --git a/include/lldb/lldb-private.h b/include/lldb/lldb-private.h
index bbd974303f1f..951b22fc94c5 100644
--- a/include/lldb/lldb-private.h
+++ b/include/lldb/lldb-private.h
@@ -23,66 +23,13 @@
#include "lldb/lldb-public.h"
#include "lldb/lldb-private-enumerations.h"
#include "lldb/lldb-private-interfaces.h"
-#include "lldb/lldb-private-log.h"
#include "lldb/lldb-private-types.h"
namespace lldb_private {
-//------------------------------------------------------------------
-/// Initializes lldb.
-///
-/// This function should be called prior to using any lldb
-/// classes to ensure they have a chance to do any static
-/// initialization that they need to do.
-//------------------------------------------------------------------
-void
-Initialize();
-
-
-//------------------------------------------------------------------
-/// Notifies any classes that lldb will be terminating soon.
-///
-/// This function will be called when the Debugger shared instance
-/// is being destructed and will give classes the ability to clean
-/// up any threads or other resources they have that they might not
-/// be able to clean up in their own destructors.
-///
-/// Internal classes that need this ability will need to add their
-/// void T::WillTerminate() method in the body of this function in
-/// lldb.cpp to ensure it will get called.
-///
-/// TODO: when we start having external plug-ins, we will need a way
-/// for plug-ins to register a WillTerminate callback.
-//------------------------------------------------------------------
-void
-WillTerminate();
-
-//------------------------------------------------------------------
-/// Terminates lldb
-///
-/// This function optionally can be called when clients are done
-/// using lldb functionality to free up any static resources
-/// that have been allocated during initialization or during
-/// function calls. No lldb functions should be called after
-/// calling this function without again calling DCInitialize()
-/// again.
-//------------------------------------------------------------------
-void
-Terminate();
-
-
const char *
GetVersion ();
-const char *
-GetVoteAsCString (Vote vote);
-
-const char *
-GetSectionTypeAsCString (lldb::SectionType sect_type);
-
-bool
-NameMatches (const char *name, NameMatchType match_type, const char *match);
-
} // namespace lldb_private