aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2014-11-25 21:00:58 +0000
committerEd Maste <emaste@FreeBSD.org>2014-11-25 21:00:58 +0000
commit0cac4ca3916ac24ab6139d03cbfd18db9e715bfe (patch)
treec94307da318be46e5aeea1a325c1e91749506e4f /include
parent03b99097822ca3ac69252d9afae716a584ed56c4 (diff)
downloadsrc-0cac4ca3916ac24ab6139d03cbfd18db9e715bfe.tar.gz
src-0cac4ca3916ac24ab6139d03cbfd18db9e715bfe.zip
Import LLDB as of upstream SVN r216948 (git 50f7fe44)vendor/lldb/lldb-r216948
This corresponds with the branchpoint for the 3.5 release. A number of files not required for the FreeBSD build have been removed. Sponsored by: DARPA, AFRL
Notes
Notes: svn path=/vendor/lldb/dist/; revision=275072 svn path=/vendor/lldb/lldb-r216948/; revision=275074; tag=vendor/lldb/lldb-r216948
Diffstat (limited to 'include')
-rw-r--r--include/lldb/API/SBBreakpoint.h8
-rw-r--r--include/lldb/API/SBBreakpointLocation.h6
-rw-r--r--include/lldb/API/SBDefines.h111
-rw-r--r--include/lldb/API/SBError.h2
-rw-r--r--include/lldb/API/SBExpressionOptions.h34
-rw-r--r--include/lldb/API/SBFileSpec.h2
-rw-r--r--include/lldb/API/SBFrame.h2
-rw-r--r--include/lldb/API/SBHostOS.h7
-rw-r--r--include/lldb/API/SBListener.h2
-rw-r--r--include/lldb/API/SBProcess.h6
-rw-r--r--include/lldb/API/SBQueue.h8
-rw-r--r--include/lldb/API/SBQueueItem.h1
-rw-r--r--include/lldb/API/SBStream.h3
-rw-r--r--include/lldb/API/SBTarget.h45
-rw-r--r--include/lldb/API/SBThread.h13
-rw-r--r--include/lldb/API/SBType.h8
-rw-r--r--include/lldb/API/SBTypeEnumMember.h98
-rw-r--r--include/lldb/API/SBUnixSignals.h84
-rw-r--r--include/lldb/API/SBValue.h7
-rw-r--r--include/lldb/Breakpoint/Breakpoint.h2
-rw-r--r--include/lldb/Breakpoint/BreakpointLocationList.h2
-rw-r--r--include/lldb/Breakpoint/BreakpointOptions.h5
-rw-r--r--include/lldb/Breakpoint/BreakpointSite.h11
-rw-r--r--include/lldb/Breakpoint/Watchpoint.h4
-rw-r--r--include/lldb/Core/Address.h6
-rw-r--r--include/lldb/Core/AddressRange.h4
-rw-r--r--include/lldb/Core/ArchSpec.h46
-rw-r--r--include/lldb/Core/ClangForward.h1
-rw-r--r--include/lldb/Core/Communication.h4
-rw-r--r--include/lldb/Core/ConnectionFileDescriptor.h88
-rw-r--r--include/lldb/Core/ConstString.h8
-rw-r--r--include/lldb/Core/DataBuffer.h2
-rw-r--r--include/lldb/Core/DataBufferHeap.h3
-rw-r--r--include/lldb/Core/DataBufferMemoryMap.h11
-rw-r--r--include/lldb/Core/DataEncoder.h6
-rw-r--r--include/lldb/Core/Debugger.h24
-rw-r--r--include/lldb/Core/EmulateInstruction.h20
-rw-r--r--include/lldb/Core/Error.h9
-rw-r--r--include/lldb/Core/IOHandler.h49
-rw-r--r--include/lldb/Core/Listener.h2
-rw-r--r--include/lldb/Core/Mangled.h6
-rw-r--r--include/lldb/Core/Module.h58
-rw-r--r--include/lldb/Core/ModuleList.h15
-rw-r--r--include/lldb/Core/ModuleSpec.h6
-rw-r--r--include/lldb/Core/PluginManager.h23
-rw-r--r--include/lldb/Core/RegisterValue.h6
-rw-r--r--include/lldb/Core/RegularExpression.h12
-rw-r--r--include/lldb/Core/Section.h14
-rw-r--r--include/lldb/Core/SourceManager.h2
-rw-r--r--include/lldb/Core/Stream.h2
-rw-r--r--include/lldb/Core/StructuredData.h486
-rw-r--r--include/lldb/Core/UserID.h6
-rw-r--r--include/lldb/Core/Value.h25
-rw-r--r--include/lldb/Core/ValueObject.h35
-rw-r--r--include/lldb/Core/ValueObjectChild.h5
-rw-r--r--include/lldb/Core/ValueObjectConstResult.h3
-rw-r--r--include/lldb/Core/ValueObjectDynamicValue.h3
-rw-r--r--include/lldb/Core/ValueObjectMemory.h3
-rw-r--r--include/lldb/Core/ValueObjectRegister.h3
-rw-r--r--include/lldb/Core/ValueObjectSyntheticFilter.h3
-rw-r--r--include/lldb/Core/ValueObjectVariable.h3
-rw-r--r--include/lldb/Core/dwarf.h2
-rw-r--r--include/lldb/DataFormatters/CXXFormatterFunctions.h114
-rw-r--r--include/lldb/DataFormatters/FormatManager.h27
-rw-r--r--include/lldb/DataFormatters/TypeFormat.h9
-rw-r--r--include/lldb/DataFormatters/TypeSummary.h18
-rw-r--r--include/lldb/DataFormatters/ValueObjectPrinter.h2
-rw-r--r--include/lldb/Expression/ASTStructExtractor.h2
-rw-r--r--include/lldb/Expression/ClangExpressionDeclMap.h8
-rw-r--r--include/lldb/Expression/ClangExpressionParser.h15
-rw-r--r--include/lldb/Expression/ClangExpressionVariable.h10
-rw-r--r--include/lldb/Expression/ClangFunction.h14
-rw-r--r--include/lldb/Expression/ClangUserExpression.h23
-rw-r--r--include/lldb/Expression/ClangUtilityFunction.h8
-rw-r--r--include/lldb/Expression/DWARFExpression.h13
-rw-r--r--include/lldb/Expression/ExpressionSourceCode.h5
-rw-r--r--include/lldb/Expression/IRExecutionUnit.h87
-rw-r--r--include/lldb/Expression/IRForTarget.h12
-rw-r--r--include/lldb/Expression/IRMemoryMap.h12
-rw-r--r--include/lldb/Host/Condition.h2
-rw-r--r--include/lldb/Host/Config.h2
-rw-r--r--include/lldb/Host/Debug.h244
-rw-r--r--include/lldb/Host/DynamicLibrary.h51
-rw-r--r--include/lldb/Host/Editline.h51
-rw-r--r--include/lldb/Host/Endian.h2
-rw-r--r--include/lldb/Host/File.h20
-rw-r--r--include/lldb/Host/FileCache.h45
-rw-r--r--include/lldb/Host/FileSpec.h78
-rw-r--r--include/lldb/Host/FileSystem.h43
-rw-r--r--include/lldb/Host/Host.h257
-rw-r--r--include/lldb/Host/HostGetOpt.h6
-rw-r--r--include/lldb/Host/HostInfo.h61
-rw-r--r--include/lldb/Host/HostInfoBase.h119
-rw-r--r--include/lldb/Host/HostProcess.h44
-rw-r--r--include/lldb/Host/IOObject.h61
-rw-r--r--include/lldb/Host/OptionParser.h13
-rw-r--r--include/lldb/Host/Pipe.h83
-rw-r--r--include/lldb/Host/Predicate.h12
-rw-r--r--include/lldb/Host/Socket.h103
-rw-r--r--include/lldb/Host/SocketAddress.h6
-rw-r--r--include/lldb/Host/Symbols.h2
-rw-r--r--include/lldb/Host/Terminal.h2
-rw-r--r--include/lldb/Host/TimeValue.h6
-rw-r--r--include/lldb/Host/freebsd/HostInfoFreeBSD.h29
-rw-r--r--include/lldb/Host/posix/HostInfoPosix.h40
-rw-r--r--include/lldb/Host/posix/HostProcessPosix.h46
-rw-r--r--include/lldb/Interpreter/Args.h6
-rw-r--r--include/lldb/Interpreter/CommandCompletions.h2
-rw-r--r--include/lldb/Interpreter/CommandInterpreter.h10
-rw-r--r--include/lldb/Interpreter/CommandObject.h33
-rw-r--r--include/lldb/Interpreter/CommandOptionValidators.h30
-rw-r--r--include/lldb/Interpreter/CommandReturnObject.h13
-rw-r--r--include/lldb/Interpreter/Options.h8
-rw-r--r--include/lldb/Interpreter/PythonDataObjects.h6
-rw-r--r--include/lldb/Interpreter/ScriptInterpreter.h51
-rw-r--r--include/lldb/Interpreter/ScriptInterpreterPython.h41
-rw-r--r--include/lldb/Symbol/Block.h12
-rw-r--r--include/lldb/Symbol/ClangASTContext.h38
-rw-r--r--include/lldb/Symbol/ClangASTImporter.h2
-rw-r--r--include/lldb/Symbol/ClangASTType.h19
-rw-r--r--include/lldb/Symbol/ClangExternalASTSourceCommon.h2
-rw-r--r--include/lldb/Symbol/CompileUnit.h8
-rw-r--r--include/lldb/Symbol/DWARFCallFrameInfo.h2
-rw-r--r--include/lldb/Symbol/Declaration.h4
-rw-r--r--include/lldb/Symbol/FuncUnwinders.h11
-rw-r--r--include/lldb/Symbol/Function.h16
-rw-r--r--include/lldb/Symbol/LineEntry.h4
-rw-r--r--include/lldb/Symbol/LineTable.h4
-rw-r--r--include/lldb/Symbol/ObjectContainer.h4
-rw-r--r--include/lldb/Symbol/ObjectFile.h97
-rw-r--r--include/lldb/Symbol/Symbol.h15
-rw-r--r--include/lldb/Symbol/SymbolContext.h8
-rw-r--r--include/lldb/Symbol/SymbolContextScope.h6
-rw-r--r--include/lldb/Symbol/SymbolFile.h12
-rw-r--r--include/lldb/Symbol/SymbolVendor.h7
-rw-r--r--include/lldb/Symbol/Symtab.h1
-rw-r--r--include/lldb/Symbol/Type.h174
-rw-r--r--include/lldb/Symbol/UnwindPlan.h3
-rw-r--r--include/lldb/Symbol/UnwindTable.h9
-rw-r--r--include/lldb/Symbol/VariableList.h4
-rw-r--r--include/lldb/Target/ABI.h63
-rw-r--r--include/lldb/Target/CPPLanguageRuntime.h2
-rw-r--r--include/lldb/Target/ExecutionContext.h38
-rw-r--r--include/lldb/Target/ExecutionContextScope.h2
-rw-r--r--include/lldb/Target/FileAction.h68
-rw-r--r--include/lldb/Target/JITLoader.h90
-rw-r--r--include/lldb/Target/JITLoaderList.h60
-rw-r--r--include/lldb/Target/MemoryRegionInfo.h104
-rw-r--r--include/lldb/Target/NativeRegisterContext.h190
-rw-r--r--include/lldb/Target/NativeRegisterContextRegisterInfo.h44
-rw-r--r--include/lldb/Target/ObjCLanguageRuntime.h41
-rw-r--r--include/lldb/Target/PathMappingList.h2
-rw-r--r--include/lldb/Target/Platform.h84
-rw-r--r--include/lldb/Target/Process.h977
-rw-r--r--include/lldb/Target/ProcessInfo.h188
-rw-r--r--include/lldb/Target/ProcessLaunchInfo.h225
-rw-r--r--include/lldb/Target/Queue.h13
-rw-r--r--include/lldb/Target/QueueItem.h53
-rw-r--r--include/lldb/Target/QueueList.h4
-rw-r--r--include/lldb/Target/RegisterContext.h43
-rw-r--r--include/lldb/Target/StackFrame.h6
-rw-r--r--include/lldb/Target/StopInfo.h7
-rw-r--r--include/lldb/Target/SystemRuntime.h79
-rw-r--r--include/lldb/Target/Target.h79
-rw-r--r--include/lldb/Target/TargetList.h2
-rw-r--r--include/lldb/Target/Thread.h256
-rw-r--r--include/lldb/Target/ThreadPlan.h38
-rw-r--r--include/lldb/Target/ThreadPlanCallFunction.h8
-rw-r--r--include/lldb/Target/ThreadPlanCallUserExpression.h26
-rw-r--r--include/lldb/Target/ThreadPlanShouldStopHere.h85
-rw-r--r--include/lldb/Target/ThreadPlanStepInRange.h39
-rw-r--r--include/lldb/Target/ThreadPlanStepInstruction.h2
-rw-r--r--include/lldb/Target/ThreadPlanStepOut.h27
-rw-r--r--include/lldb/Target/ThreadPlanStepOverRange.h19
-rw-r--r--include/lldb/Target/ThreadPlanStepRange.h1
-rw-r--r--include/lldb/Target/UnwindAssembly.h5
-rw-r--r--include/lldb/Utility/CleanUp.h6
-rw-r--r--include/lldb/Utility/PseudoTerminal.h4
-rw-r--r--include/lldb/Utility/SafeMachO.h113
-rw-r--r--include/lldb/Utility/SharedCluster.h23
-rw-r--r--include/lldb/Utility/SharingPtr.h15
-rw-r--r--include/lldb/Utility/StringLexer.h62
-rw-r--r--include/lldb/lldb-defines.h23
-rw-r--r--include/lldb/lldb-enumerations.h137
-rw-r--r--include/lldb/lldb-forward.h13
-rw-r--r--include/lldb/lldb-private-enumerations.h46
-rw-r--r--include/lldb/lldb-private-forward.h41
-rw-r--r--include/lldb/lldb-private-interfaces.h6
-rw-r--r--include/lldb/lldb-private-log.h1
-rw-r--r--include/lldb/lldb-private-types.h16
-rw-r--r--include/lldb/lldb-python.h16
-rw-r--r--include/lldb/lldb-types.h41
192 files changed, 5203 insertions, 2274 deletions
diff --git a/include/lldb/API/SBBreakpoint.h b/include/lldb/API/SBBreakpoint.h
index be9c499798e1..86d49c29a821 100644
--- a/include/lldb/API/SBBreakpoint.h
+++ b/include/lldb/API/SBBreakpoint.h
@@ -117,7 +117,13 @@ public:
void
SetCallback (BreakpointHitCallback callback, void *baton);
-
+
+ void
+ SetScriptCallbackFunction (const char *callback_function_name);
+
+ SBError
+ SetScriptCallbackBody (const char *script_body_text);
+
size_t
GetNumResolvedLocations() const;
diff --git a/include/lldb/API/SBBreakpointLocation.h b/include/lldb/API/SBBreakpointLocation.h
index 3b2ca2cf88e8..fd9f246de4ff 100644
--- a/include/lldb/API/SBBreakpointLocation.h
+++ b/include/lldb/API/SBBreakpointLocation.h
@@ -59,6 +59,12 @@ public:
GetCondition ();
void
+ SetScriptCallbackFunction (const char *callback_function_name);
+
+ SBError
+ SetScriptCallbackBody (const char *script_body_text);
+
+ void
SetThreadID (lldb::tid_t sb_thread_id);
lldb::tid_t
diff --git a/include/lldb/API/SBDefines.h b/include/lldb/API/SBDefines.h
index 8779d43d1f40..30ea0dfda56e 100644
--- a/include/lldb/API/SBDefines.h
+++ b/include/lldb/API/SBDefines.h
@@ -21,62 +21,71 @@
#include "lldb/lldb-types.h"
#include "lldb/lldb-versioning.h"
-// Forward Declarations
+#ifdef SWIG
+#define LLDB_API
+#endif
+// Forward Declarations
namespace lldb {
-class SBAddress;
-class SBBlock;
-class SBBreakpoint;
-class SBBreakpointLocation;
-class SBBroadcaster;
-class SBCommand;
-class SBCommandInterpreter;
-class SBCommandPluginInterface;
-class SBCommandReturnObject;
-class SBCommunication;
-class SBCompileUnit;
-class SBData;
-class SBDebugger;
-class SBDeclaration;
-class SBError;
-class SBEvent;
-class SBEventList;
-class SBExpressionOptions;
-class SBFileSpec;
-class SBFileSpecList;
-class SBFrame;
-class SBFunction;
-class SBHostOS;
-class SBInstruction;
-class SBInstructionList;
-class SBLineEntry;
-class SBListener;
-class SBModule;
-class SBModuleSpec;
-class SBModuleSpecList;
-class SBProcess;
-class SBSourceManager;
-class SBStream;
-class SBStringList;
-class SBSymbol;
-class SBSymbolContext;
-class SBSymbolContextList;
-class SBTarget;
-class SBThread;
-class SBType;
-class SBTypeCategory;
-class SBTypeFilter;
-class SBTypeFormat;
-class SBTypeNameSpecifier;
-class SBTypeSummary;
+class LLDB_API SBAddress;
+class LLDB_API SBBlock;
+class LLDB_API SBBreakpoint;
+class LLDB_API SBBreakpointLocation;
+class LLDB_API SBBroadcaster;
+class LLDB_API SBCommand;
+class LLDB_API SBCommandInterpreter;
+class LLDB_API SBCommandPluginInterface;
+class LLDB_API SBCommandReturnObject;
+class LLDB_API SBCommunication;
+class LLDB_API SBCompileUnit;
+class LLDB_API SBData;
+class LLDB_API SBDebugger;
+class LLDB_API SBDeclaration;
+class LLDB_API SBError;
+class LLDB_API SBEvent;
+class LLDB_API SBEventList;
+class LLDB_API SBExpressionOptions;
+class LLDB_API SBFileSpec;
+class LLDB_API SBFileSpecList;
+class LLDB_API SBFrame;
+class LLDB_API SBFunction;
+class LLDB_API SBHostOS;
+class LLDB_API SBInstruction;
+class LLDB_API SBInstructionList;
+class LLDB_API SBLineEntry;
+class LLDB_API SBListener;
+class LLDB_API SBModule;
+class LLDB_API SBModuleSpec;
+class LLDB_API SBModuleSpecList;
+class LLDB_API SBProcess;
+class LLDB_API SBQueue;
+class LLDB_API SBQueueItem;
+class LLDB_API SBSection;
+class LLDB_API SBSourceManager;
+class LLDB_API SBStream;
+class LLDB_API SBStringList;
+class LLDB_API SBSymbol;
+class LLDB_API SBSymbolContext;
+class LLDB_API SBSymbolContextList;
+class LLDB_API SBTarget;
+class LLDB_API SBThread;
+class LLDB_API SBType;
+class LLDB_API SBTypeCategory;
+class LLDB_API SBTypeEnumMember;
+class LLDB_API SBTypeEnumMemberList;
+class LLDB_API SBTypeFilter;
+class LLDB_API SBTypeFormat;
+class LLDB_API SBTypeNameSpecifier;
+class LLDB_API SBTypeSummary;
#ifndef LLDB_DISABLE_PYTHON
-class SBTypeSynthetic;
+class LLDB_API SBTypeSynthetic;
#endif
-class SBTypeList;
-class SBValue;
-class SBValueList;
-class SBWatchpoint;
+class LLDB_API SBTypeList;
+class LLDB_API SBValue;
+class LLDB_API SBValueList;
+class LLDB_API SBWatchpoint;
+class LLDB_API SBUnixSignals;
}
diff --git a/include/lldb/API/SBError.h b/include/lldb/API/SBError.h
index 25d7e81a3be5..b9908658c5bc 100644
--- a/include/lldb/API/SBError.h
+++ b/include/lldb/API/SBError.h
@@ -77,6 +77,8 @@ protected:
friend class SBTarget;
friend class SBValue;
friend class SBWatchpoint;
+ friend class SBBreakpoint;
+ friend class SBBreakpointLocation;
lldb_private::Error *
get();
diff --git a/include/lldb/API/SBExpressionOptions.h b/include/lldb/API/SBExpressionOptions.h
index 6a3a640432f6..c3592880c46a 100644
--- a/include/lldb/API/SBExpressionOptions.h
+++ b/include/lldb/API/SBExpressionOptions.h
@@ -56,20 +56,54 @@ public:
uint32_t
GetTimeoutInMicroSeconds () const;
+ // Set the timeout for the expression, 0 means wait forever.
void
SetTimeoutInMicroSeconds (uint32_t timeout = 0);
+ uint32_t
+ GetOneThreadTimeoutInMicroSeconds () const;
+
+ // Set the timeout for running on one thread, 0 means use the default behavior.
+ // If you set this higher than the overall timeout, you'll get an error when you
+ // try to run the expression.
+ void
+ SetOneThreadTimeoutInMicroSeconds (uint32_t timeout = 0);
+
bool
GetTryAllThreads () const;
void
SetTryAllThreads (bool run_others = true);
+
+ bool
+ GetStopOthers() const;
+
+ void
+ SetStopOthers(bool stop_others = true);
bool
GetTrapExceptions () const;
void
SetTrapExceptions (bool trap_exceptions = true);
+
+ void
+ SetLanguage (lldb::LanguageType language);
+
+ void
+ SetCancelCallback (lldb::ExpressionCancelCallback callback, void *baton);
+
+ bool
+ GetGenerateDebugInfo ();
+
+ void
+ SetGenerateDebugInfo (bool b = true);
+
+ bool
+ GetSuppressPersistentResult ();
+
+ void
+ SetSuppressPersistentResult (bool b = false);
protected:
diff --git a/include/lldb/API/SBFileSpec.h b/include/lldb/API/SBFileSpec.h
index 5d4447f74e64..d262b98d0fd7 100644
--- a/include/lldb/API/SBFileSpec.h
+++ b/include/lldb/API/SBFileSpec.h
@@ -21,7 +21,7 @@ public:
SBFileSpec (const lldb::SBFileSpec &rhs);
- SBFileSpec (const char *path);// Deprected, use SBFileSpec (const char *path, bool resolve)
+ SBFileSpec (const char *path);// Deprecated, use SBFileSpec (const char *path, bool resolve)
SBFileSpec (const char *path, bool resolve);
diff --git a/include/lldb/API/SBFrame.h b/include/lldb/API/SBFrame.h
index 4ae38c13bede..f6b84ab1ddac 100644
--- a/include/lldb/API/SBFrame.h
+++ b/include/lldb/API/SBFrame.h
@@ -75,7 +75,7 @@ public:
/// Get the appropriate function name for this frame. Inlined functions in
/// LLDB are represented by Blocks that have inlined function information, so
/// just looking at the SBFunction or SBSymbol for a frame isn't enough.
- /// This function will return the appriopriate function, symbol or inlined
+ /// This function will return the appropriate function, symbol or inlined
/// function name for the frame.
///
/// This function returns:
diff --git a/include/lldb/API/SBHostOS.h b/include/lldb/API/SBHostOS.h
index e5fab6fe7849..7ab22caaaad9 100644
--- a/include/lldb/API/SBHostOS.h
+++ b/include/lldb/API/SBHostOS.h
@@ -25,12 +25,15 @@ public:
static lldb::SBFileSpec
GetLLDBPythonPath ();
+ static lldb::SBFileSpec
+ GetLLDBPath (lldb::PathType path_type);
+
static void
ThreadCreated (const char *name);
static lldb::thread_t
ThreadCreate (const char *name,
- thread_func_t thread_function,
+ lldb::thread_func_t thread_function,
void *thread_arg,
lldb::SBError *err);
@@ -43,7 +46,7 @@ public:
lldb::SBError *err);
static bool
ThreadJoin (lldb::thread_t thread,
- thread_result_t *result,
+ lldb::thread_result_t *result,
lldb::SBError *err);
diff --git a/include/lldb/API/SBListener.h b/include/lldb/API/SBListener.h
index c5a047341741..4a11ec1072f1 100644
--- a/include/lldb/API/SBListener.h
+++ b/include/lldb/API/SBListener.h
@@ -55,7 +55,7 @@ public:
StopListeningForEvents (const lldb::SBBroadcaster& broadcaster,
uint32_t event_mask);
- // Returns true if an event was recieved, false if we timed out.
+ // Returns true if an event was received, false if we timed out.
bool
WaitForEvent (uint32_t num_seconds,
lldb::SBEvent &event);
diff --git a/include/lldb/API/SBProcess.h b/include/lldb/API/SBProcess.h
index f2846710c614..4b59462ca3f1 100644
--- a/include/lldb/API/SBProcess.h
+++ b/include/lldb/API/SBProcess.h
@@ -221,6 +221,9 @@ public:
lldb::SBError
Signal (int signal);
+ lldb::SBUnixSignals
+ GetUnixSignals();
+
void
SendAsyncInterrupt();
@@ -279,6 +282,9 @@ public:
lldb::SBError
UnloadImage (uint32_t image_token);
+ lldb::SBError
+ SendEventData (const char *data);
+
//------------------------------------------------------------------
/// Return the number of different thread-origin extended backtraces
/// this process can support.
diff --git a/include/lldb/API/SBQueue.h b/include/lldb/API/SBQueue.h
index 6ab9aa09f466..fbb1952902f8 100644
--- a/include/lldb/API/SBQueue.h
+++ b/include/lldb/API/SBQueue.h
@@ -14,7 +14,6 @@
#include "lldb/lldb-forward.h"
#include "lldb/API/SBDefines.h"
-#include "lldb/API/SBQueueItem.h"
namespace lldb {
@@ -62,8 +61,15 @@ public:
lldb::SBQueueItem
GetPendingItemAtIndex (uint32_t);
+ uint32_t
+ GetNumRunningItems ();
+
+ lldb::QueueKind
+ GetKind ();
+
protected:
friend class SBProcess;
+ friend class SBThread;
void
SetQueue (const lldb::QueueSP& queue_sp);
diff --git a/include/lldb/API/SBQueueItem.h b/include/lldb/API/SBQueueItem.h
index 355c5ac90a23..c90f36eeb573 100644
--- a/include/lldb/API/SBQueueItem.h
+++ b/include/lldb/API/SBQueueItem.h
@@ -12,7 +12,6 @@
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBAddress.h"
-#include "lldb/API/SBThread.h"
namespace lldb {
diff --git a/include/lldb/API/SBStream.h b/include/lldb/API/SBStream.h
index 038adf68542c..fb69c12f0a91 100644
--- a/include/lldb/API/SBStream.h
+++ b/include/lldb/API/SBStream.h
@@ -51,7 +51,7 @@ public:
RedirectToFileDescriptor (int fd, bool transfer_fh_ownership);
// If the stream is redirected to a file, forget about the file and if
- // ownership of the file was transfered to this object, close the file.
+ // ownership of the file was transferred to this object, close the file.
// If the stream is backed by a local cache, clear this cache.
void
Clear ();
@@ -86,6 +86,7 @@ protected:
friend class SBTarget;
friend class SBThread;
friend class SBType;
+ friend class SBTypeEnumMember;
friend class SBTypeMember;
friend class SBValue;
friend class SBWatchpoint;
diff --git a/include/lldb/API/SBTarget.h b/include/lldb/API/SBTarget.h
index 230dffc68251..370d40d0454a 100644
--- a/include/lldb/API/SBTarget.h
+++ b/include/lldb/API/SBTarget.h
@@ -47,6 +47,35 @@ public:
void
SetGroupID (uint32_t gid);
+ SBFileSpec
+ GetExecutableFile ();
+
+ //----------------------------------------------------------------------
+ /// Set the executable file that will be used to launch the process and
+ /// optionally set it as the first argument in the argument vector.
+ ///
+ /// This only needs to be specified if clients wish to carefully control
+ /// the exact path will be used to launch a binary. If you create a
+ /// target with a symlink, that symlink will get resolved in the target
+ /// and the resolved path will get used to launch the process. Calling
+ /// this function can help you still launch your process using the
+ /// path of your choice.
+ ///
+ /// If this function is not called prior to launching with
+ /// SBTarget::Launch(...), the target will use the resolved executable
+ /// path that was used to create the target.
+ ///
+ /// @param[in] exe_file
+ /// The override path to use when launching the executable.
+ ///
+ /// @param[in] add_as_first_arg
+ /// If true, then the path will be inserted into the argument vector
+ /// prior to launching. Otherwise the argument vector will be left
+ /// alone.
+ //----------------------------------------------------------------------
+ void
+ SetExecutableFile (SBFileSpec exe_file, bool add_as_first_arg);
+
uint32_t
GetNumArguments ();
@@ -110,6 +139,18 @@ public:
bool
AddSuppressFileAction (int fd, bool read, bool write);
+ void
+ SetLaunchEventData (const char *data);
+
+ const char *
+ GetLaunchEventData () const;
+
+ bool
+ GetDetachOnError() const;
+
+ void
+ SetDetachOnError(bool enable);
+
protected:
friend class SBTarget;
@@ -331,7 +372,7 @@ public:
/// Some launch options specified by logical OR'ing
/// lldb::LaunchFlags enumeration values together.
///
- /// @param[in] stop_at_endtry
+ /// @param[in] stop_at_entry
/// If false do not stop the inferior at the entry point.
///
/// @param[out]
@@ -580,7 +621,7 @@ public:
//------------------------------------------------------------------
- /// The the section base load addresses for all sections in a module.
+ /// Clear the section base load addresses for all sections in a module.
///
/// @param[in] module
/// The module to unload.
diff --git a/include/lldb/API/SBThread.h b/include/lldb/API/SBThread.h
index 04b6c86e6d89..07a43ebee7ce 100644
--- a/include/lldb/API/SBThread.h
+++ b/include/lldb/API/SBThread.h
@@ -41,6 +41,9 @@ public:
~SBThread();
+ lldb::SBQueue
+ GetQueue () const;
+
bool
IsValid() const;
@@ -97,6 +100,9 @@ public:
lldb::queue_id_t
GetQueueID() const;
+ bool
+ GetInfoItemByPathAsString ( const char *path, SBStream &strm);
+
void
StepOver (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
@@ -136,8 +142,8 @@ public:
/// the other threads in a process are allowed to run. So when
/// SBProcess::Continue() is called, any threads that aren't suspended will
/// be allowed to run. If any of the SBThread functions for stepping are
- /// called (StepOver, StepInto, StepOut, StepInstruction, RunToAddres), the
- /// thread will not be allowed to run and these funtions will simply return.
+ /// called (StepOver, StepInto, StepOut, StepInstruction, RunToAddress), the
+ /// thread will not be allowed to run and these functions will simply return.
///
/// Eventually we plan to add support for thread centric debugging where
/// each thread is controlled individually and each thread would broadcast
@@ -207,6 +213,9 @@ public:
uint32_t
GetExtendedBacktraceOriginatingIndexID ();
+ bool
+ SafeToCallFunctions ();
+
protected:
friend class SBBreakpoint;
friend class SBBreakpointLocation;
diff --git a/include/lldb/API/SBType.h b/include/lldb/API/SBType.h
index 2cd9b4459a33..363aa59e35aa 100644
--- a/include/lldb/API/SBType.h
+++ b/include/lldb/API/SBType.h
@@ -143,6 +143,9 @@ public:
lldb::SBTypeMember
GetVirtualBaseClassAtIndex (uint32_t idx);
+ lldb::SBTypeEnumMemberList
+ GetEnumMembers();
+
uint32_t
GetNumberOfTemplateArguments ();
@@ -161,6 +164,9 @@ public:
const char*
GetName();
+ const char *
+ GetDisplayTypeName ();
+
lldb::TypeClass
GetTypeClass ();
@@ -199,6 +205,8 @@ protected:
friend class SBFunction;
friend class SBModule;
friend class SBTarget;
+ friend class SBTypeEnumMember;
+ friend class SBTypeEnumMemberList;
friend class SBTypeNameSpecifier;
friend class SBTypeMember;
friend class SBTypeList;
diff --git a/include/lldb/API/SBTypeEnumMember.h b/include/lldb/API/SBTypeEnumMember.h
new file mode 100644
index 000000000000..75c9917989c2
--- /dev/null
+++ b/include/lldb/API/SBTypeEnumMember.h
@@ -0,0 +1,98 @@
+
+//===-- SBTypeEnumMember.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_SBTypeEnumMember_h_
+#define LLDB_SBTypeEnumMember_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class SBTypeEnumMember
+{
+public:
+ SBTypeEnumMember ();
+
+ SBTypeEnumMember (const SBTypeEnumMember& rhs);
+
+ ~SBTypeEnumMember();
+
+ SBTypeEnumMember&
+ operator = (const SBTypeEnumMember& rhs);
+
+ bool
+ IsValid() const;
+
+ int64_t
+ GetValueAsSigned();
+
+ uint64_t
+ GetValueAsUnsigned();
+
+ const char *
+ GetName ();
+
+ lldb::SBType
+ GetType ();
+
+ bool
+ GetDescription (lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+protected:
+ friend class SBType;
+ friend class SBTypeEnumMemberList;
+
+ void
+ reset (lldb_private::TypeEnumMemberImpl *);
+
+ lldb_private::TypeEnumMemberImpl &
+ ref ();
+
+ const lldb_private::TypeEnumMemberImpl &
+ ref () const;
+
+ lldb::TypeEnumMemberImplSP m_opaque_sp;
+
+ SBTypeEnumMember (const lldb::TypeEnumMemberImplSP &);
+};
+
+class SBTypeEnumMemberList
+{
+public:
+ SBTypeEnumMemberList();
+
+ SBTypeEnumMemberList(const SBTypeEnumMemberList& rhs);
+
+ ~SBTypeEnumMemberList();
+
+ SBTypeEnumMemberList&
+ operator = (const SBTypeEnumMemberList& rhs);
+
+ bool
+ IsValid();
+
+ void
+ Append (SBTypeEnumMember entry);
+
+ SBTypeEnumMember
+ GetTypeEnumMemberAtIndex (uint32_t index);
+
+ uint32_t
+ GetSize();
+
+
+private:
+ std::unique_ptr<lldb_private::TypeEnumMemberListImpl> m_opaque_ap;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBTypeEnumMember_h_
diff --git a/include/lldb/API/SBUnixSignals.h b/include/lldb/API/SBUnixSignals.h
new file mode 100644
index 000000000000..40bbed8b48ef
--- /dev/null
+++ b/include/lldb/API/SBUnixSignals.h
@@ -0,0 +1,84 @@
+//===-- SBUnixSignals.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_SBUnixSignals_h_
+#define LLDB_SBUnixSignals_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class SBUnixSignals {
+public:
+ SBUnixSignals ();
+
+ SBUnixSignals (const lldb::SBUnixSignals &rhs);
+
+ ~SBUnixSignals();
+
+ const SBUnixSignals &
+ operator =(const lldb::SBUnixSignals &rhs);
+
+ void
+ Clear ();
+
+ bool
+ IsValid () const;
+
+ const char *
+ GetSignalAsCString (int32_t signo) const;
+
+ int32_t
+ GetSignalNumberFromName (const char *name) const;
+
+ bool
+ GetShouldSuppress (int32_t signo) const;
+
+ bool
+ SetShouldSuppress (int32_t signo,
+ bool value);
+
+ bool
+ GetShouldStop (int32_t signo) const;
+
+ bool
+ SetShouldStop (int32_t signo,
+ bool value);
+
+ bool
+ GetShouldNotify (int32_t signo) const;
+
+ bool
+ SetShouldNotify (int32_t signo, bool value);
+
+ int32_t
+ GetNumSignals () const;
+
+ int32_t
+ GetSignalAtIndex (int32_t index) const;
+
+protected:
+ friend class SBProcess;
+
+ SBUnixSignals (lldb::ProcessSP &process_sp);
+
+ lldb::ProcessSP
+ GetSP() const;
+
+ void
+ SetSP (const lldb::ProcessSP &process_sp);
+
+private:
+ lldb::ProcessWP m_opaque_wp;
+};
+
+
+} // namespace lldb
+
+#endif // LLDB_SBUnixSignals_h_
diff --git a/include/lldb/API/SBValue.h b/include/lldb/API/SBValue.h
index 2b9a344b9300..93b869ba9c5c 100644
--- a/include/lldb/API/SBValue.h
+++ b/include/lldb/API/SBValue.h
@@ -50,6 +50,9 @@ public:
const char *
GetTypeName ();
+
+ const char *
+ GetDisplayTypeName ();
size_t
GetByteSize ();
@@ -173,7 +176,7 @@ public:
//------------------------------------------------------------------
/// Get a child value by index from a value.
///
- /// Structs, unions, classes, arrays and and pointers have child
+ /// Structs, unions, classes, arrays and pointers have child
/// values that can be access by index.
///
/// Structs and unions access child members using a zero based index
@@ -208,7 +211,7 @@ public:
/// The index of the child value to get
///
/// @param[in] use_dynamic
- /// An enumeration that specifies wether to get dynamic values,
+ /// An enumeration that specifies whether to get dynamic values,
/// and also if the target can be run to figure out the dynamic
/// type of the child value.
///
diff --git a/include/lldb/Breakpoint/Breakpoint.h b/include/lldb/Breakpoint/Breakpoint.h
index 749ff8d1a09c..15693f86e382 100644
--- a/include/lldb/Breakpoint/Breakpoint.h
+++ b/include/lldb/Breakpoint/Breakpoint.h
@@ -431,7 +431,7 @@ public:
/// @param[in] is_synchronous
/// If \b true the callback will be run on the private event thread
/// before the stop event gets reported. If false, the callback will get
- /// handled on the public event thead after the stop has been posted.
+ /// handled on the public event thread after the stop has been posted.
///
/// @return
/// \b true if the process should stop when you hit the breakpoint.
diff --git a/include/lldb/Breakpoint/BreakpointLocationList.h b/include/lldb/Breakpoint/BreakpointLocationList.h
index ec34641b727c..0d8062eb644c 100644
--- a/include/lldb/Breakpoint/BreakpointLocationList.h
+++ b/include/lldb/Breakpoint/BreakpointLocationList.h
@@ -143,7 +143,7 @@ public:
ClearAllBreakpointSites ();
//------------------------------------------------------------------
- /// Tells all the breakopint locations in this list to attempt to
+ /// Tells all the breakpoint locations in this list to attempt to
/// resolve any possible breakpoint sites.
//------------------------------------------------------------------
void
diff --git a/include/lldb/Breakpoint/BreakpointOptions.h b/include/lldb/Breakpoint/BreakpointOptions.h
index 728f5932fa06..eb374ad69603 100644
--- a/include/lldb/Breakpoint/BreakpointOptions.h
+++ b/include/lldb/Breakpoint/BreakpointOptions.h
@@ -145,7 +145,8 @@ public:
/// @return
/// The synchronicity of our callback.
//------------------------------------------------------------------
- bool IsCallbackSynchronous () {
+ bool IsCallbackSynchronous () const
+ {
return m_callback_is_synchronous;
}
@@ -280,7 +281,7 @@ public:
/// Returns true if the breakpoint option has a callback set.
//------------------------------------------------------------------
bool
- HasCallback();
+ HasCallback() const;
//------------------------------------------------------------------
/// This is the default empty callback.
diff --git a/include/lldb/Breakpoint/BreakpointSite.h b/include/lldb/Breakpoint/BreakpointSite.h
index 271a23c2e451..1d2cbea18f9f 100644
--- a/include/lldb/Breakpoint/BreakpointSite.h
+++ b/include/lldb/Breakpoint/BreakpointSite.h
@@ -19,6 +19,7 @@
// Project includes
#include "lldb/lldb-private.h"
+#include "lldb/Host/Mutex.h"
#include "lldb/Core/UserID.h"
#include "lldb/Breakpoint/StoppointLocation.h"
#include "lldb/Breakpoint/BreakpointLocationCollection.h"
@@ -33,7 +34,7 @@ namespace lldb_private {
/// The BreakpointSite class handles the physical breakpoint that is
/// actually inserted in the target program. As such, it is also the
/// one that gets hit, when the program stops. It keeps a list of all
-/// BreakpointLocations that share this phsyical site. When the
+/// BreakpointLocations that share this physical site. When the
/// breakpoint is hit, all the locations are informed by the breakpoint
/// site. Breakpoint sites are owned by the process.
//----------------------------------------------------------------------
@@ -50,7 +51,7 @@ public:
// and m_trap_opcode contain the saved and written opcode.
eHardware, // Breakpoint site is set as a hardware breakpoint
eExternal // Breakpoint site is managed by an external debug nub or
- // debug interface where memory reads trasparently will not
+ // debug interface where memory reads transparently will not
// display any breakpoint opcodes.
};
@@ -123,7 +124,7 @@ public:
/// Sets whether the current breakpoint site is enabled or not
///
/// @param[in] enabled
- /// \b true if the breakoint is enabled, \b false otherwise.
+ /// \b true if the breakpoint is enabled, \b false otherwise.
//------------------------------------------------------------------
void
SetEnabled (bool enabled);
@@ -172,7 +173,7 @@ public:
GetNumberOfOwners ();
//------------------------------------------------------------------
- /// This method returns the the breakpoint location at index \a index
+ /// This method returns the breakpoint location at index \a index
/// located at this breakpoint site. The owners are listed ordinally
/// from 0 to GetNumberOfOwners() - 1 so you can use this method to iterate
/// over the owners
@@ -257,6 +258,7 @@ public:
private:
friend class Process;
+ friend class BreakpointLocation;
//------------------------------------------------------------------
/// The method removes the owner at \a break_loc_id from this breakpoint list.
@@ -276,6 +278,7 @@ private:
// Consider adding an optimization where if there is only one
// owner, we don't store a list. The usual case will be only one owner...
BreakpointLocationCollection m_owners; ///< This has the BreakpointLocations that share this breakpoint site.
+ Mutex m_owners_mutex; ///< This mutex protects the owners collection.
static lldb::break_id_t
GetNextID();
diff --git a/include/lldb/Breakpoint/Watchpoint.h b/include/lldb/Breakpoint/Watchpoint.h
index 5dbed03d5406..8493775eec34 100644
--- a/include/lldb/Breakpoint/Watchpoint.h
+++ b/include/lldb/Breakpoint/Watchpoint.h
@@ -134,7 +134,7 @@ public:
/// @param[in] is_synchronous
/// If \b true the callback will be run on the private event thread
/// before the stop event gets reported. If false, the callback will get
- /// handled on the public event thead after the stop has been posted.
+ /// handled on the public event thread after the stop has been posted.
///
/// @return
/// \b true if the process should stop when you hit the watchpoint.
@@ -215,7 +215,7 @@ private:
// undergoing a pair of temporary disable/enable actions to avoid recursively
// triggering further watchpoint events.
uint32_t m_disabled_count; // Keep track of the count that the watchpoint is disabled while in ephemeral mode.
- // At the end of the ephemeral mode when the watchpoint is to be enabled agian,
+ // At the end of the ephemeral mode when the watchpoint is to be enabled again,
// we check the count, if it is more than 1, it means the user-supplied actions
// actually want the watchpoint to be disabled!
uint32_t m_watch_read:1, // 1 if we stop when the watched data is read from
diff --git a/include/lldb/Core/Address.h b/include/lldb/Core/Address.h
index 322019395ae7..8dd2339f9207 100644
--- a/include/lldb/Core/Address.h
+++ b/include/lldb/Core/Address.h
@@ -230,7 +230,7 @@ public:
/// offset based address, and \a style lets the user choose.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
///
/// @param[in] style
/// The display style for the address.
@@ -310,7 +310,7 @@ public:
///
/// This function will first resolve its address to a load address.
/// Then, if the address turns out to be in code address, return the
- /// load address for a an opcode. This address object might have
+ /// load address for an opcode. This address object might have
/// extra bits set (bit zero will be set to Thumb functions for an
/// ARM target) that are required for changing the program counter
/// and this function will remove any bits that are intended for
@@ -362,7 +362,7 @@ public:
/// offset (for absolute addresses that have no section).
///
/// @return
- /// Returns \b true if the the offset is valid, \b false
+ /// Returns \b true if the offset is valid, \b false
/// otherwise.
//------------------------------------------------------------------
bool
diff --git a/include/lldb/Core/AddressRange.h b/include/lldb/Core/AddressRange.h
index bd3ab2ab5da5..9d781f3e85ae 100644
--- a/include/lldb/Core/AddressRange.h
+++ b/include/lldb/Core/AddressRange.h
@@ -189,7 +189,7 @@ public:
/// how the base address gets displayed.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
///
/// @param[in] style
/// The display style for the address.
@@ -215,7 +215,7 @@ public:
/// and pointer values, reference counts, etc.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
//------------------------------------------------------------------
void
DumpDebug (Stream *s) const;
diff --git a/include/lldb/Core/ArchSpec.h b/include/lldb/Core/ArchSpec.h
index 1ccb385783a0..255beee573b6 100644
--- a/include/lldb/Core/ArchSpec.h
+++ b/include/lldb/Core/ArchSpec.h
@@ -50,6 +50,7 @@ public:
eCore_arm_armv7m,
eCore_arm_armv7em,
eCore_arm_xscale,
+
eCore_thumb,
eCore_thumbv4t,
eCore_thumbv5,
@@ -57,11 +58,14 @@ public:
eCore_thumbv6,
eCore_thumbv6m,
eCore_thumbv7,
- eCore_thumbv7f,
eCore_thumbv7s,
eCore_thumbv7k,
+ eCore_thumbv7f,
eCore_thumbv7m,
eCore_thumbv7em,
+ eCore_arm_arm64,
+ eCore_arm_armv8,
+ eCore_arm_aarch64,
eCore_mips64,
@@ -89,6 +93,7 @@ public:
eCore_x86_32_i386,
eCore_x86_32_i486,
eCore_x86_32_i486sx,
+ eCore_x86_32_i686,
eCore_x86_64_x86_64,
eCore_x86_64_x86_64h, // Haswell enabled x86_64
@@ -98,6 +103,12 @@ public:
eCore_uknownMach32,
eCore_uknownMach64,
+
+ eCore_kalimba,
+ eCore_kalimba3,
+ eCore_kalimba4,
+ eCore_kalimba5,
+
kNumCores,
kCore_invalid,
@@ -107,6 +118,7 @@ public:
kCore_ppc_any,
kCore_ppc64_any,
kCore_x86_32_any,
+ kCore_x86_64_any,
kCore_hexagon_any,
kCore_arm_first = eCore_arm_generic,
@@ -122,10 +134,16 @@ public:
kCore_ppc64_last = eCore_ppc64_ppc970_64,
kCore_x86_32_first = eCore_x86_32_i386,
- kCore_x86_32_last = eCore_x86_32_i486sx,
+ kCore_x86_32_last = eCore_x86_32_i686,
+
+ kCore_x86_64_first = eCore_x86_64_x86_64,
+ kCore_x86_64_last = eCore_x86_64_x86_64h,
kCore_hexagon_first = eCore_hexagon_generic,
- kCore_hexagon_last = eCore_hexagon_hexagonv5
+ kCore_hexagon_last = eCore_hexagon_hexagonv5,
+
+ kCore_kalimba_first = eCore_kalimba,
+ kCore_kalimba_last = eCore_kalimba5
};
//------------------------------------------------------------------
@@ -228,7 +246,7 @@ public:
///
/// This will be something like "ubuntu", "fedora", etc. on Linux.
/// This should be the same value returned by
- /// Host::GetDistributionId ().
+ /// HostInfo::GetDistributionId ().
///------------------------------------------------------------------
void
SetDistributionId (const char* distribution_id);
@@ -302,7 +320,7 @@ public:
///
/// @param[in] cpu The required CPU type.
///
- /// @return True if the object and CPU type were sucessfully set.
+ /// @return True if the object and CPU type were successfully set.
//------------------------------------------------------------------
bool
SetArchitecture (ArchitectureType arch_type,
@@ -351,6 +369,24 @@ public:
GetMachOCPUSubType () const;
//------------------------------------------------------------------
+ /// Architecture data byte width accessor
+ ///
+ /// @return the size in 8-bit (host) bytes of a minimum addressable
+ /// unit from the Architecture's data bus
+ //------------------------------------------------------------------
+ uint32_t
+ GetDataByteSize() const;
+
+ //------------------------------------------------------------------
+ /// Architecture code byte width accessor
+ ///
+ /// @return the size in 8-bit (host) bytes of a minimum addressable
+ /// unit from the Architecture's code bus
+ //------------------------------------------------------------------
+ uint32_t
+ GetCodeByteSize() const;
+
+ //------------------------------------------------------------------
/// Architecture tripple accessor.
///
/// @return A triple describing this ArchSpec.
diff --git a/include/lldb/Core/ClangForward.h b/include/lldb/Core/ClangForward.h
index 0b3f13a16602..ef7308d25f7f 100644
--- a/include/lldb/Core/ClangForward.h
+++ b/include/lldb/Core/ClangForward.h
@@ -58,6 +58,7 @@ namespace clang
class DiagnosticsEngine;
class DiagnosticOptions;
class EnumDecl;
+ class EnumConstantDecl;
class Expr;
class ExternalASTSource;
class ExtVectorElementExpr;
diff --git a/include/lldb/Core/Communication.h b/include/lldb/Core/Communication.h
index 2dde55044171..7e8209d7d9c6 100644
--- a/include/lldb/Core/Communication.h
+++ b/include/lldb/Core/Communication.h
@@ -59,7 +59,7 @@ namespace lldb_private {
///
/// bool Communication::StartReadThread (Error *);
///
-/// If true is returned a read thead has been spawned that will
+/// If true is returned a read thread has been spawned that will
/// continually execute a call to the pure virtual DoRead function:
///
/// size_t Communication::ReadFromConnection (void *, size_t, uint32_t);
@@ -300,7 +300,7 @@ public:
//------------------------------------------------------------------
/// The static read thread function. This function will call
/// the "DoRead" function continuously and wait for data to become
- /// avaialble. When data is received it will append the available
+ /// available. When data is received it will append the available
/// data to the internal cache and broadcast a
/// \b eBroadcastBitReadThreadGotBytes event.
///
diff --git a/include/lldb/Core/ConnectionFileDescriptor.h b/include/lldb/Core/ConnectionFileDescriptor.h
index 15598c9b1335..75d0202fcf6c 100644
--- a/include/lldb/Core/ConnectionFileDescriptor.h
+++ b/include/lldb/Core/ConnectionFileDescriptor.h
@@ -10,24 +10,23 @@
#ifndef liblldb_ConnectionFileDescriptor_h_
#define liblldb_ConnectionFileDescriptor_h_
-// C Includes
-#ifndef _WIN32
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#endif
-
// C++ Includes
#include <memory>
+#include "lldb/lldb-forward.h"
+
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Connection.h"
#include "lldb/Host/Mutex.h"
+#include "lldb/Host/Pipe.h"
#include "lldb/Host/Predicate.h"
+#include "lldb/Host/IOObject.h"
namespace lldb_private {
+class Error;
+class Socket;
class SocketAddress;
class ConnectionFileDescriptor :
@@ -64,81 +63,52 @@ public:
lldb::ConnectionStatus &status,
Error *error_ptr);
- // If the read file descriptor is a socket, then return
- // the port number that is being used by the socket.
- uint16_t
- GetReadPort () const;
-
- // If the write file descriptor is a socket, then return
- // the port number that is being used by the socket.
- uint16_t
- GetWritePort () const;
+ lldb::ConnectionStatus
+ BytesAvailable (uint32_t timeout_usec, Error *error_ptr);
- uint16_t
- GetBoundPort (uint32_t timeout_sec);
+ bool
+ InterruptRead ();
-protected:
+ lldb::IOObjectSP GetReadObject() { return m_read_sp; }
+ const lldb::IOObjectSP GetReadObject() const { return m_read_sp; }
- typedef enum
- {
- eFDTypeFile, // Other FD requireing read/write
- eFDTypeSocket, // Socket requiring send/recv
- eFDTypeSocketUDP // Unconnected UDP socket requiring sendto/recvfrom
- } FDType;
+ uint16_t GetListeningPort(uint32_t timeout_sec);
+
+protected:
void
OpenCommandPipe ();
void
CloseCommandPipe ();
-
- lldb::ConnectionStatus
- BytesAvailable (uint32_t timeout_usec, Error *error_ptr);
lldb::ConnectionStatus
SocketListen (const char *host_and_port, Error *error_ptr);
-
+
lldb::ConnectionStatus
ConnectTCP (const char *host_and_port, Error *error_ptr);
-
+
lldb::ConnectionStatus
ConnectUDP (const char *args, Error *error_ptr);
lldb::ConnectionStatus
- NamedSocketAccept (const char *socket_name, Error *error_ptr);
-
- lldb::ConnectionStatus
NamedSocketConnect (const char *socket_name, Error *error_ptr);
-
+
lldb::ConnectionStatus
- Close (int& fd, FDType type, Error *error);
-
- int m_fd_send;
- int m_fd_recv;
- FDType m_fd_send_type;
- FDType m_fd_recv_type;
- std::unique_ptr<SocketAddress> m_udp_send_sockaddr;
- uint32_t m_socket_timeout_usec;
- int m_pipe_read; // A pipe that we select on the reading end of along with
- int m_pipe_write; // m_fd_recv so we can force ourselves out of the select.
- Mutex m_mutex;
- Predicate<uint16_t> m_port_predicate; // Used when binding to port zero to wait for the thread that creates the socket, binds and listens to resolve the port number
- bool m_should_close_fd; // True if this class should close the file descriptor when it goes away.
- bool m_shutting_down; // This marks that we are shutting down so if we get woken up from BytesAvailable
- // to disconnect, we won't try to read again.
+ NamedSocketAccept (const char *socket_name, Error *error_ptr);
- static uint16_t
- GetSocketPort (int fd);
-
- static int
- GetSocketOption(int fd, int level, int option_name, int &option_value);
+ lldb::IOObjectSP m_read_sp;
+ lldb::IOObjectSP m_write_sp;
- static int
- SetSocketOption(int fd, int level, int option_name, int option_value);
-
- bool
- SetSocketReceiveTimeout (uint32_t timeout_usec);
+ Predicate<uint16_t> m_port_predicate; // Used when binding to port zero to wait for the thread
+ // that creates the socket, binds and listens to resolve
+ // the port number.
+ Pipe m_pipe;
+ Mutex m_mutex;
+ bool m_shutting_down; // This marks that we are shutting down so if we get woken up from
+ // BytesAvailable to disconnect, we won't try to read again.
+ bool m_waiting_for_accept;
private:
DISALLOW_COPY_AND_ASSIGN (ConnectionFileDescriptor);
};
diff --git a/include/lldb/Core/ConstString.h b/include/lldb/Core/ConstString.h
index 684cc8f921ed..cfa237c46862 100644
--- a/include/lldb/Core/ConstString.h
+++ b/include/lldb/Core/ConstString.h
@@ -303,7 +303,7 @@ public:
/// returns an integer result.
///
/// NOTE: only call this function when you want a true string
- /// comparision. If you want string equality use the, use the ==
+ /// comparison. If you want string equality use the, use the ==
/// operator as it is much more efficient. Also if you want string
/// inequality, use the != operator for the same reasons.
///
@@ -383,7 +383,7 @@ public:
//------------------------------------------------------------------
/// Set the C string value and its mangled counterpart.
///
- /// Object files and debug sybmols often use mangled string to
+ /// Object files and debug symbols often use mangled string to
/// represent the linkage name for a symbol, function or global.
/// The string pool can efficiently store these values and their
/// counterparts so when we run into another instance of a mangled
@@ -406,7 +406,7 @@ public:
/// Retrieve the mangled or demangled counterpart for a mangled
/// or demangled ConstString.
///
- /// Object files and debug sybmols often use mangled string to
+ /// Object files and debug symbols often use mangled string to
/// represent the linkage name for a symbol, function or global.
/// The string pool can efficiently store these values and their
/// counterparts so when we run into another instance of a mangled
@@ -478,7 +478,7 @@ public:
//------------------------------------------------------------------
/// Get the size in bytes of the current global string pool.
///
- /// Reports the the size in bytes of all shared C string values,
+ /// Reports the size in bytes of all shared C string values,
/// containers and any other values as a byte size for the
/// entire string pool.
///
diff --git a/include/lldb/Core/DataBuffer.h b/include/lldb/Core/DataBuffer.h
index e64245dead3d..64e2a8857837 100644
--- a/include/lldb/Core/DataBuffer.h
+++ b/include/lldb/Core/DataBuffer.h
@@ -20,7 +20,7 @@ namespace lldb_private {
/// @class DataBuffer DataBuffer.h "lldb/Core/DataBuffer.h"
/// @brief A pure virtual protocol class for abstracted data buffers.
///
-/// DataBuffer is an abtract class that gets packaged into a shared pointer
+/// DataBuffer is an abstract class that gets packaged into a shared pointer
/// that can use to implement various ways to store data (on the heap,
/// memory mapped, cached inferior memory). It gets used by DataExtractor
/// so many DataExtractor objects can share the same data and sub-ranges
diff --git a/include/lldb/Core/DataBufferHeap.h b/include/lldb/Core/DataBufferHeap.h
index dac9a28befb9..ad73fabe5f1e 100644
--- a/include/lldb/Core/DataBufferHeap.h
+++ b/include/lldb/Core/DataBufferHeap.h
@@ -122,6 +122,9 @@ public:
CopyData (const void *src, lldb::offset_t src_len);
void
+ AppendData (const void *src, uint64_t src_len);
+
+ void
Clear();
private:
diff --git a/include/lldb/Core/DataBufferMemoryMap.h b/include/lldb/Core/DataBufferMemoryMap.h
index d4a448a5df52..944b975a318a 100644
--- a/include/lldb/Core/DataBufferMemoryMap.h
+++ b/include/lldb/Core/DataBufferMemoryMap.h
@@ -100,7 +100,12 @@ public:
/// @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.
+ /// as many bytes as possible. Even though it may be possible
+ /// for a 32-bit host debugger to debug a 64-bit target, size_t
+ /// still dictates the maximum possible size that can be mapped
+ /// into this process. For this kind of cross-arch debugging
+ /// scenario, mappings and views should be managed at a higher
+ /// level.
///
/// @return
/// The number of bytes mapped starting from the \a offset.
@@ -108,7 +113,7 @@ public:
size_t
MemoryMapFromFileSpec (const FileSpec* file,
lldb::offset_t offset = 0,
- lldb::offset_t length = SIZE_MAX,
+ size_t length = SIZE_MAX,
bool writeable = false);
//------------------------------------------------------------------
@@ -137,7 +142,7 @@ public:
size_t
MemoryMapFromFileDescriptor (int fd,
lldb::offset_t offset,
- lldb::offset_t length,
+ size_t length,
bool write,
bool fd_is_file);
diff --git a/include/lldb/Core/DataEncoder.h b/include/lldb/Core/DataEncoder.h
index 658cce0d2b4b..7cd5d6808152 100644
--- a/include/lldb/Core/DataEncoder.h
+++ b/include/lldb/Core/DataEncoder.h
@@ -173,7 +173,7 @@ public:
}
//------------------------------------------------------------------
- /// Get a the data start pointer.
+ /// Get the data start pointer.
///
/// @return
/// Returns a pointer to the first byte contained in this
@@ -234,7 +234,7 @@ public:
/// The size in byte of the integer to encode.
///
/// @param[in] value
- /// The integer value to write. The least significate bytes of
+ /// The integer value to write. The least significant bytes of
/// the integer value will be written if the size is less than
/// 8 bytes.
///
@@ -253,7 +253,7 @@ public:
/// start encoding.
///
/// @param[int] src
- /// The buffer that contains the the bytes to encode.
+ /// The buffer that contains the bytes to encode.
///
/// @param[in] src_len
/// The number of bytes to encode.
diff --git a/include/lldb/Core/Debugger.h b/include/lldb/Core/Debugger.h
index e80ec8516793..7ab62e5b7f3a 100644
--- a/include/lldb/Core/Debugger.h
+++ b/include/lldb/Core/Debugger.h
@@ -31,6 +31,14 @@
#include "lldb/Target/Platform.h"
#include "lldb/Target/TargetList.h"
+namespace llvm
+{
+namespace sys
+{
+class DynamicLibrary;
+}
+}
+
namespace lldb_private {
//----------------------------------------------------------------------
@@ -51,9 +59,9 @@ friend class SourceManager; // For GetSourceFileCache.
public:
- typedef lldb::DynamicLibrarySP (*LoadPluginCallbackType) (const lldb::DebuggerSP &debugger_sp,
- const FileSpec& spec,
- Error& error);
+ 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);
@@ -352,6 +360,13 @@ public:
void
CancelForwardEvents (const lldb::ListenerSP &listener_sp);
+
+ bool
+ IsHandlingEvents () const
+ {
+ return IS_VALID_LLDB_HOST_THREAD(m_event_handler_thread);
+ }
+
protected:
friend class CommandInterpreter;
@@ -415,12 +430,11 @@ protected:
lldb::StreamSP m_log_callback_stream_sp;
ConstString m_instance_name;
static LoadPluginCallbackType g_load_plugin_callback;
- typedef std::vector<lldb::DynamicLibrarySP> LoadedPluginsList;
+ typedef std::vector<llvm::sys::DynamicLibrary> LoadedPluginsList;
LoadedPluginsList m_loaded_plugins;
lldb::thread_t m_event_handler_thread;
lldb::thread_t m_io_handler_thread;
lldb::ListenerSP m_forward_listener_sp;
- bool m_event_handler_thread_alive;
void
InstanceInitialize ();
diff --git a/include/lldb/Core/EmulateInstruction.h b/include/lldb/Core/EmulateInstruction.h
index 19a3269ae374..774d80968ff9 100644
--- a/include/lldb/Core/EmulateInstruction.h
+++ b/include/lldb/Core/EmulateInstruction.h
@@ -94,7 +94,7 @@ public:
enum ContextType
{
eContextInvalid = 0,
- // Read an instruciton opcode from memory
+ // Read an instruction opcode from memory
eContextReadOpcode,
// Usually used for writing a register value whose source value is an
@@ -223,13 +223,13 @@ public:
struct ISAAndImmediate
{
uint32_t isa;
- uint32_t unsigned_data32; // immdiate data
+ uint32_t unsigned_data32; // immediate data
} ISAAndImmediate;
struct ISAAndImmediateSigned
{
uint32_t isa;
- int32_t signed_data32; // signed immdiate data
+ int32_t signed_data32; // signed immediate data
} ISAAndImmediateSigned;
uint32_t isa;
@@ -409,7 +409,7 @@ public:
TestEmulation (Stream *out_stream, ArchSpec &arch, OptionValueDictionary *test_data) = 0;
virtual bool
- GetRegisterInfo (uint32_t reg_kind, uint32_t reg_num, RegisterInfo &reg_info) = 0;
+ GetRegisterInfo (lldb::RegisterKind reg_kind, uint32_t reg_num, RegisterInfo &reg_info) = 0;
//----------------------------------------------------------------------
// Optional overrides
@@ -421,7 +421,7 @@ public:
CreateFunctionEntryUnwind (UnwindPlan &unwind_plan);
static const char *
- TranslateRegister (uint32_t reg_kind, uint32_t reg_num, std::string &reg_name);
+ TranslateRegister (lldb::RegisterKind reg_kind, uint32_t reg_num, std::string &reg_name);
//----------------------------------------------------------------------
// RegisterInfo variants
@@ -449,25 +449,25 @@ public:
// Register kind and number variants
//----------------------------------------------------------------------
bool
- ReadRegister (uint32_t reg_kind,
+ ReadRegister (lldb::RegisterKind reg_kind,
uint32_t reg_num,
RegisterValue& reg_value);
bool
WriteRegister (const Context &context,
- uint32_t reg_kind,
+ lldb::RegisterKind reg_kind,
uint32_t reg_num,
const RegisterValue& reg_value);
uint64_t
- ReadRegisterUnsigned (uint32_t reg_kind,
+ ReadRegisterUnsigned (lldb::RegisterKind reg_kind,
uint32_t reg_num,
uint64_t fail_value,
bool *success_ptr);
bool
WriteRegisterUnsigned (const Context &context,
- uint32_t reg_kind,
+ lldb::RegisterKind reg_kind,
uint32_t reg_num,
uint64_t reg_value);
@@ -611,7 +611,7 @@ public:
static bool
GetBestRegisterKindAndNumber (const RegisterInfo *reg_info,
- uint32_t &reg_kind,
+ lldb::RegisterKind &reg_kind,
uint32_t &reg_num);
static uint32_t
diff --git a/include/lldb/Core/Error.h b/include/lldb/Core/Error.h
index 39c67f621c92..a1687689fc3f 100644
--- a/include/lldb/Core/Error.h
+++ b/include/lldb/Core/Error.h
@@ -209,6 +209,13 @@ public:
void
SetMachError (uint32_t err);
+
+ void
+ SetExpressionError (lldb::ExpressionResults, const char *mssg);
+
+ int
+ SetExpressionErrorWithFormat (lldb::ExpressionResults, const char *format, ...) __attribute__ ((format (printf, 3,4)));
+
//------------------------------------------------------------------
/// Set accesssor with an error value and type.
///
@@ -301,7 +308,7 @@ protected:
/// Member variables
//------------------------------------------------------------------
ValueType m_code; ///< Error code as an integer value.
- lldb::ErrorType m_type; ///< The type of the above error code.
+ lldb::ErrorType m_type; ///< The type of the above error code.
mutable std::string m_string; ///< A string representation of the error code.
};
diff --git a/include/lldb/Core/IOHandler.h b/include/lldb/Core/IOHandler.h
index 78d1e7447db4..f477ebd48007 100644
--- a/include/lldb/Core/IOHandler.h
+++ b/include/lldb/Core/IOHandler.h
@@ -73,7 +73,7 @@ namespace lldb_private {
// Called when CTRL+C is pressed which usually causes
// Debugger::DispatchInputInterrupt to be called.
- virtual void
+ virtual bool
Interrupt () = 0;
virtual void
@@ -191,7 +191,7 @@ namespace lldb_private {
///
/// This will return true if the input stream is a terminal (tty or
/// pty) and can cause IO handlers to do different things (like
- /// for a comfirmation when deleting all breakpoints).
+ /// for a confirmation when deleting all breakpoints).
//------------------------------------------------------------------
bool
GetIsInteractive ();
@@ -200,9 +200,9 @@ namespace lldb_private {
/// Check if the input is coming from a real terminal.
///
/// A real terminal has a valid size with a certain number of rows
- /// and colums. If this function returns true, then terminal escape
+ /// and columns. If this function returns true, then terminal escape
/// sequences are expected to work (cursor movement escape sequences,
- /// clearning lines, etc).
+ /// clearing lines, etc).
//------------------------------------------------------------------
bool
GetIsRealTerminal ();
@@ -267,7 +267,7 @@ namespace lldb_private {
//------------------------------------------------------------------
/// Called when a line or lines have been retrieved.
///
- /// This funtion can handle the current line and possibly call
+ /// This function can handle the current line and possibly call
/// IOHandler::SetIsDone(true) when the IO handler is done like when
/// "quit" is entered as a command, of when an empty line is
/// received. It is up to the delegate to determine when a line
@@ -304,11 +304,22 @@ namespace lldb_private {
virtual ConstString
- GetControlSequence (char ch)
+ IOHandlerGetControlSequence (char ch)
{
return ConstString();
}
+ //------------------------------------------------------------------
+ // Intercept the IOHandler::Interrupt() calls and do something.
+ //
+ // Return true if the interrupt was handled, false if the IOHandler
+ // should continue to try handle the interrupt itself.
+ //------------------------------------------------------------------
+ virtual bool
+ IOHandlerInterrupt (IOHandler &io_handler)
+ {
+ return false;
+ }
protected:
Completion m_completion; // Support for common builtin completions
bool m_io_handler_done;
@@ -338,7 +349,7 @@ namespace lldb_private {
}
virtual ConstString
- GetControlSequence (char ch)
+ IOHandlerGetControlSequence (char ch)
{
if (ch == 'd')
return ConstString (m_end_line + "\n");
@@ -364,7 +375,9 @@ namespace lldb_private {
// The last line was edited, if this line is empty, then we are done
// getting our multiple lines.
if (lines[line_idx] == m_end_line)
+ {
return LineStatus::Done;
+ }
}
return LineStatus::Success;
}
@@ -380,6 +393,7 @@ namespace lldb_private {
const char *editline_name, // Used for saving history files
const char *prompt,
bool multi_line,
+ uint32_t line_number_start, // If non-zero show line numbers starting at 'line_number_start'
IOHandlerDelegate &delegate);
IOHandlerEditline (Debugger &debugger,
@@ -390,6 +404,7 @@ namespace lldb_private {
const char *editline_name, // Used for saving history files
const char *prompt,
bool multi_line,
+ uint32_t line_number_start, // If non-zero show line numbers starting at 'line_number_start'
IOHandlerDelegate &delegate);
virtual
@@ -407,7 +422,7 @@ namespace lldb_private {
virtual void
Cancel ();
- virtual void
+ virtual bool
Interrupt ();
virtual void
@@ -423,7 +438,7 @@ namespace lldb_private {
virtual ConstString
GetControlSequence (char ch)
{
- return m_delegate.GetControlSequence (ch);
+ return m_delegate.IOHandlerGetControlSequence (ch);
}
virtual const char *
@@ -433,11 +448,14 @@ namespace lldb_private {
SetPrompt (const char *prompt);
bool
- GetLine (std::string &line);
+ GetLine (std::string &line, bool &interrupted);
bool
- GetLines (StringList &lines);
-
+ GetLines (StringList &lines, bool &interrupted);
+
+ void
+ SetBaseLineNumber (uint32_t line);
+
private:
static LineStatus
LineCompletedCallback (Editline *editline,
@@ -458,6 +476,7 @@ namespace lldb_private {
std::unique_ptr<Editline> m_editline_ap;
IOHandlerDelegate &m_delegate;
std::string m_prompt;
+ uint32_t m_base_line_number; // If non-zero, then show line numbers in prompt
bool m_multi_line;
};
@@ -517,7 +536,7 @@ namespace lldb_private {
virtual void
Cancel ();
- virtual void
+ virtual bool
Interrupt ();
virtual void
@@ -551,8 +570,8 @@ namespace lldb_private {
virtual void
Refresh ();
- virtual void
- Interrupt ();
+ virtual bool
+ HandleInterrupt ();
virtual void
GotEOF();
diff --git a/include/lldb/Core/Listener.h b/include/lldb/Core/Listener.h
index a12a65d705db..2dbd2eb436ce 100644
--- a/include/lldb/Core/Listener.h
+++ b/include/lldb/Core/Listener.h
@@ -76,7 +76,7 @@ public:
StopListeningForEvents (Broadcaster* broadcaster,
uint32_t event_mask);
- // Returns true if an event was recieved, false if we timed out.
+ // Returns true if an event was received, false if we timed out.
bool
WaitForEvent (const TimeValue *timeout,
lldb::EventSP &event_sp);
diff --git a/include/lldb/Core/Mangled.h b/include/lldb/Core/Mangled.h
index 8732dc00270c..7dc0eca3e8db 100644
--- a/include/lldb/Core/Mangled.h
+++ b/include/lldb/Core/Mangled.h
@@ -153,7 +153,7 @@ public:
/// demangled name to be computed currently (we don't use the accessor).
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
//----------------------------------------------------------------------
void
Dump (Stream *s) const;
@@ -162,7 +162,7 @@ public:
/// Dump a debug description of this object to a Stream \a s.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
//----------------------------------------------------------------------
void
DumpDebug (Stream *s) const;
@@ -219,7 +219,7 @@ public:
/// Which name would you prefer to get?
///
/// @return
- /// A const reference to the the preferred name string object if this
+ /// A const reference to the preferred name string object if this
/// object has a valid name of that kind, else a const reference to the
/// other name is returned.
//----------------------------------------------------------------------
diff --git a/include/lldb/Core/Module.h b/include/lldb/Core/Module.h
index 56650582791b..bfde7cbc5db9 100644
--- a/include/lldb/Core/Module.h
+++ b/include/lldb/Core/Module.h
@@ -68,7 +68,7 @@ public:
/// use ModuleList::GetSharedModule().
///
/// @param[in] file_spec
- /// The file specification for the on disk repesentation of
+ /// The file specification for the on disk representation of
/// this executable image.
///
/// @param[in] arch
@@ -88,10 +88,14 @@ public:
Module (const FileSpec& file_spec,
const ArchSpec& arch,
const ConstString *object_name = NULL,
- off_t object_offset = 0,
+ lldb::offset_t object_offset = 0,
const TimeValue *object_mod_time_ptr = NULL);
Module (const ModuleSpec &module_spec);
+
+ static lldb::ModuleSP
+ CreateJITModule (const lldb::ObjectFileJITDelegateSP &delegate_sp);
+
//------------------------------------------------------------------
/// Destructor.
//------------------------------------------------------------------
@@ -193,7 +197,7 @@ public:
/// in a module.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
//------------------------------------------------------------------
void
Dump (Stream *s);
@@ -415,7 +419,7 @@ public:
VariableList& variable_list);
//------------------------------------------------------------------
- /// Find global and static variables by regular exression.
+ /// Find global and static variables by regular expression.
///
/// @param[in] regex
/// A regular expression to use when matching the name.
@@ -468,11 +472,11 @@ public:
///
/// @param[in] type_name
/// The name of the type we are looking for that is a fully
- /// or partially qualfieid type name.
+ /// or partially qualified type name.
///
/// @param[in] exact_match
- /// If \b true, \a type_name is fully qualifed and must match
- /// exactly. If \b false, \a type_name is a partially qualfied
+ /// If \b true, \a type_name is fully qualified and must match
+ /// exactly. If \b false, \a type_name is a partially qualified
/// name where the leading namespaces or classes can be
/// omitted to make finding types that a user may type
/// easier.
@@ -700,14 +704,40 @@ public:
virtual SectionList *
GetSectionList ();
+ //------------------------------------------------------------------
+ /// Notify the module that the file addresses for the Sections have
+ /// been updated.
+ ///
+ /// If the Section file addresses for a module are updated, this
+ /// method should be called. Any parts of the module, object file,
+ /// or symbol file that has cached those file addresses must invalidate
+ /// or update its cache.
+ //------------------------------------------------------------------
+ virtual void
+ SectionFileAddressesChanged ();
+
uint32_t
GetVersion (uint32_t *versions, uint32_t num_versions);
- // Load an object file from memory.
+ //------------------------------------------------------------------
+ /// Load an object file from memory.
+ ///
+ /// If available, the size of the object file in memory may be
+ /// passed to avoid additional round trips to process memory.
+ /// If the size is not provided, a default value is used. This
+ /// value should be large enough to enable the ObjectFile plugins
+ /// to read the header of the object file without going back to the
+ /// process.
+ ///
+ /// @return
+ /// The object file loaded from memory or NULL, if the operation
+ /// failed (see the `error` for more information in that case).
+ //------------------------------------------------------------------
ObjectFile *
GetMemoryObjectFile (const lldb::ProcessSP &process_sp,
lldb::addr_t header_addr,
- Error &error);
+ Error &error,
+ size_t size_to_read = 512);
//------------------------------------------------------------------
/// Get the symbol vendor interface for the current architecture.
///
@@ -755,12 +785,12 @@ public:
/// A debugging function that will cause everything in a module to
/// be parsed.
///
- /// All compile units will be pasred, along with all globals and
+ /// All compile units will be parsed, along with all globals and
/// static variables and all functions for those compile units.
/// All types, scopes, local variables, static variables, global
/// variables, and line tables will be parsed. This can be used
/// prior to dumping a module to see a complete list of the
- /// resuling debug information that gets parsed, or as a debug
+ /// resulting debug information that gets parsed, or as a debug
/// function to ensure that the module can consume all of the
/// debug data the symbol vendor provides.
//------------------------------------------------------------------
@@ -948,7 +978,7 @@ public:
//------------------------------------------------------------------
// Return true if the file backing this module has changed since the
- // module was originally created since we saved the intial file
+ // module was originally created since we saved the initial file
// modification time when the module first gets created.
//------------------------------------------------------------------
bool
@@ -1156,7 +1186,9 @@ protected:
friend class SymbolFile;
private:
-
+
+ Module (); // Only used internally by CreateJITModule ()
+
size_t
FindTypes_Impl (const SymbolContext& sc,
const ConstString &name,
diff --git a/include/lldb/Core/ModuleList.h b/include/lldb/Core/ModuleList.h
index f03f79fb00ce..c3074d4d6510 100644
--- a/include/lldb/Core/ModuleList.h
+++ b/include/lldb/Core/ModuleList.h
@@ -15,6 +15,7 @@
#include "lldb/lldb-private.h"
#include "lldb/Host/Mutex.h"
+#include "lldb/Utility/Iterable.h"
namespace lldb_private {
@@ -137,7 +138,7 @@ public:
///
/// Clears the list of modules and releases a reference to each
/// module object and if the reference count goes to zero, the
- /// module will be deleted. Also relese all memory that might be
+ /// module will be deleted. Also release all memory that might be
/// held by any collection classes (like std::vector)
//------------------------------------------------------------------
void
@@ -149,7 +150,7 @@ public:
/// the supplied stream \a s.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
///
/// @see Module::Dump(Stream *) const
//------------------------------------------------------------------
@@ -307,7 +308,7 @@ public:
VariableList& variable_list) const;
//------------------------------------------------------------------
- /// Find global and static variables by regular exression.
+ /// Find global and static variables by regular expression.
///
/// @param[in] regex
/// A regular expression to use when matching the name.
@@ -577,6 +578,14 @@ protected:
Notifier* m_notifier;
+public:
+ typedef LockingAdaptedIterable<collection, lldb::ModuleSP, vector_adapter> ModuleIterable;
+ ModuleIterable
+ Modules()
+ {
+ return ModuleIterable(m_modules, GetMutex());
+ }
+
};
} // namespace lldb_private
diff --git a/include/lldb/Core/ModuleSpec.h b/include/lldb/Core/ModuleSpec.h
index dfeb7b73ca37..195fd991f8de 100644
--- a/include/lldb/Core/ModuleSpec.h
+++ b/include/lldb/Core/ModuleSpec.h
@@ -370,7 +370,6 @@ public:
if (dumped_something)
strm.PutCString(", ");
strm.Printf("object_mod_time = 0x%" PRIx64, m_object_mod_time.GetAsSecondsSinceJan1_1970());
- dumped_something = true;
}
}
@@ -387,14 +386,15 @@ public:
if (!FileSpec::Equal(fspec, GetFileSpec(), fspec.GetDirectory().IsEmpty() == false))
return false;
}
- if (match_module_spec.GetPlatformFileSpecPtr())
+ if (GetPlatformFileSpec() && match_module_spec.GetPlatformFileSpecPtr())
{
const FileSpec &fspec = match_module_spec.GetPlatformFileSpec();
if (!FileSpec::Equal(fspec, GetPlatformFileSpec(), fspec.GetDirectory().IsEmpty() == false))
return false;
}
- if (match_module_spec.GetSymbolFileSpecPtr())
+ // Only match the symbol file spec if there is one in this ModuleSpec
+ if (GetSymbolFileSpec() && match_module_spec.GetSymbolFileSpecPtr())
{
const FileSpec &fspec = match_module_spec.GetSymbolFileSpec();
if (!FileSpec::Equal(fspec, GetSymbolFileSpec(), fspec.GetDirectory().IsEmpty() == false))
diff --git a/include/lldb/Core/PluginManager.h b/include/lldb/Core/PluginManager.h
index e02f43f4fa8b..a2ac67bf9f25 100644
--- a/include/lldb/Core/PluginManager.h
+++ b/include/lldb/Core/PluginManager.h
@@ -80,6 +80,24 @@ public:
GetDynamicLoaderCreateCallbackForPluginName (const ConstString &name);
//------------------------------------------------------------------
+ // JITLoader
+ //------------------------------------------------------------------
+ static bool
+ RegisterPlugin (const ConstString &name,
+ const char *description,
+ JITLoaderCreateInstance create_callback,
+ DebuggerInitializeCallback debugger_init_callback = NULL);
+
+ static bool
+ UnregisterPlugin (JITLoaderCreateInstance create_callback);
+
+ static JITLoaderCreateInstance
+ GetJITLoaderCreateCallbackAtIndex (uint32_t idx);
+
+ static JITLoaderCreateInstance
+ GetJITLoaderCreateCallbackForPluginName (const ConstString &name);
+
+ //------------------------------------------------------------------
// EmulateInstruction
//------------------------------------------------------------------
static bool
@@ -157,7 +175,8 @@ public:
const char *description,
ObjectFileCreateInstance create_callback,
ObjectFileCreateMemoryInstance create_memory_callback,
- ObjectFileGetModuleSpecifications get_module_specifications);
+ ObjectFileGetModuleSpecifications get_module_specifications,
+ ObjectFileSaveCore save_core = NULL);
static bool
UnregisterPlugin (ObjectFileCreateInstance create_callback);
@@ -177,6 +196,8 @@ public:
static ObjectFileCreateMemoryInstance
GetObjectFileCreateMemoryCallbackForPluginName (const ConstString &name);
+ static Error
+ SaveCore (const lldb::ProcessSP &process_sp, const FileSpec &outfile);
//------------------------------------------------------------------
// ObjectContainer
diff --git a/include/lldb/Core/RegisterValue.h b/include/lldb/Core/RegisterValue.h
index cf29cea46d36..1b1a71a11c5a 100644
--- a/include/lldb/Core/RegisterValue.h
+++ b/include/lldb/Core/RegisterValue.h
@@ -374,6 +374,12 @@ namespace lldb_private {
uint32_t
GetByteSize () const;
+ static uint32_t
+ GetMaxByteSize ()
+ {
+ return kMaxRegisterByteSize;
+ }
+
void
Clear();
diff --git a/include/lldb/Core/RegularExpression.h b/include/lldb/Core/RegularExpression.h
index c116d439b94a..8e36811fa750 100644
--- a/include/lldb/Core/RegularExpression.h
+++ b/include/lldb/Core/RegularExpression.h
@@ -119,7 +119,7 @@ public:
RegularExpression ();
//------------------------------------------------------------------
- /// Constructor that takes a regulare expression with flags.
+ /// Constructor that takes a regular expression with flags.
///
/// Constructor that compiles \a re using \a flags and stores the
/// resulting compiled regular expression into this object.
@@ -129,7 +129,7 @@ public:
/// compile.
///
/// @param[in] flags
- /// Flags that are passed the the \c regcomp() function.
+ /// Flags that are passed to the \c regcomp() function.
//------------------------------------------------------------------
explicit
RegularExpression (const char* re, int flags);
@@ -141,7 +141,7 @@ public:
//------------------------------------------------------------------
/// Destructor.
///
- /// Any previosuly compiled regular expression contained in this
+ /// Any previously compiled regular expression contained in this
/// object will be freed.
//------------------------------------------------------------------
~RegularExpression ();
@@ -154,10 +154,10 @@ public:
/// Compile a regular expression.
///
/// Compile a regular expression using the supplied regular
- /// expression text and flags. The compied regular expression lives
+ /// expression text and flags. The compiled regular expression lives
/// in this object so that it can be readily used for regular
/// expression matches. Execute() can be called after the regular
- /// expression is compiled. Any previosuly compiled regular
+ /// expression is compiled. Any previously compiled regular
/// expression contained in this object will be freed.
///
/// @param[in] re
@@ -165,7 +165,7 @@ public:
/// expression to compile.
///
/// @param[in] flags
- /// Flags that are passed the the \c regcomp() function.
+ /// Flags that are passed to the \c regcomp() function.
///
/// @return
/// \b true if the regular expression compiles successfully,
diff --git a/include/lldb/Core/Section.h b/include/lldb/Core/Section.h
index 437eaf59b9c4..32dac5f35b84 100644
--- a/include/lldb/Core/Section.h
+++ b/include/lldb/Core/Section.h
@@ -119,6 +119,7 @@ public:
lldb::addr_t vm_size,
lldb::offset_t file_offset,
lldb::offset_t file_size,
+ uint32_t log2align,
uint32_t flags);
// Create a section that is a child of parent_section_sp
@@ -132,6 +133,7 @@ public:
lldb::addr_t vm_size,
lldb::offset_t file_offset,
lldb::offset_t file_size,
+ uint32_t log2align,
uint32_t flags);
~Section ();
@@ -284,6 +286,17 @@ public:
return m_obj_file;
}
+ uint32_t GetLog2Align()
+ {
+ return m_log2align;
+ }
+
+ void
+ SetLog2Align(uint32_t align)
+ {
+ m_log2align = align;
+ }
+
protected:
@@ -296,6 +309,7 @@ protected:
lldb::addr_t m_byte_size; // Size in bytes that this section will occupy in memory at runtime
lldb::offset_t m_file_offset; // Object file offset (if any)
lldb::offset_t m_file_size; // Object file size (can be smaller than m_byte_size for zero filled sections...)
+ uint32_t m_log2align; // log_2(align) of the section (i.e. section has to be aligned to 2^m_log2align)
SectionList m_children; // Child sections
bool m_fake:1, // If true, then this section only can contain the address if one of its
// children contains an address. This allows for gaps between the children
diff --git a/include/lldb/Core/SourceManager.h b/include/lldb/Core/SourceManager.h
index d8c9eccd3477..0f65be1bee4b 100644
--- a/include/lldb/Core/SourceManager.h
+++ b/include/lldb/Core/SourceManager.h
@@ -85,7 +85,7 @@ public:
CalculateLineOffsets (uint32_t line = UINT32_MAX);
FileSpec m_file_spec_orig; // The original file spec that was used (can be different from m_file_spec)
- FileSpec m_file_spec; // The actualy file spec being used (if the target has source mappings, this might be different from m_file_spec_orig)
+ FileSpec m_file_spec; // The actually file spec being used (if the target has source mappings, this might be different from m_file_spec_orig)
TimeValue m_mod_time; // Keep the modification time that this file data is valid for
uint32_t m_source_map_mod_id; // If the target uses path remappings, be sure to clear our notion of a source file if the path modification ID changes
lldb::DataBufferSP m_data_sp;
diff --git a/include/lldb/Core/Stream.h b/include/lldb/Core/Stream.h
index 0fd4aac041a9..11780aa6ff0f 100644
--- a/include/lldb/Core/Stream.h
+++ b/include/lldb/Core/Stream.h
@@ -472,7 +472,7 @@ public:
/// Indent the current line in the stream.
///
/// Indent the current line using the current indentation level and
- /// print an optional string following the idenatation spaces.
+ /// print an optional string following the indentation spaces.
///
/// @param[in] s
/// A C string to print following the indentation. If NULL, just
diff --git a/include/lldb/Core/StructuredData.h b/include/lldb/Core/StructuredData.h
new file mode 100644
index 000000000000..a4cabf4fe352
--- /dev/null
+++ b/include/lldb/Core/StructuredData.h
@@ -0,0 +1,486 @@
+//===-- StructuredData.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_StructuredData_h_
+#define liblldb_StructuredData_h_
+
+// C Includes
+// C++ Includes
+
+#include <map>
+#include <utility>
+#include <vector>
+#include <string>
+
+#include "llvm/ADT/StringRef.h"
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-defines.h"
+#include "lldb/Core/ConstString.h"
+#include "lldb/Core/Stream.h"
+
+namespace lldb_private {
+
+//----------------------------------------------------------------------
+/// @class StructuredData StructuredData.h "lldb/Core/StructuredData.h"
+/// @brief A class which can hold structured data
+///
+/// The StructuredData class is designed to hold the data from a JSON
+/// or plist style file -- a serialized data structure with dictionaries
+/// (maps, hashes), arrays, and concrete values like integers, floating
+/// point numbers, strings, booleans.
+///
+/// StructuredData does not presuppose any knowledge of the schema for
+/// the data it is holding; it can parse JSON data, for instance, and
+/// other parts of lldb can iterate through the parsed data set to find
+/// keys and values that may be present.
+//----------------------------------------------------------------------
+
+class StructuredData
+{
+public:
+
+ class Object;
+ class Array;
+ class Integer;
+ class Float;
+ class Boolean;
+ class String;
+ class Dictionary;
+
+ typedef std::shared_ptr<Object> ObjectSP;
+ typedef std::shared_ptr<Array> ArraySP;
+ typedef std::shared_ptr<Dictionary> DictionarySP;
+
+ enum class Type {
+ eTypeInvalid = -1,
+ eTypeNull = 0,
+ eTypeArray,
+ eTypeInteger,
+ eTypeFloat,
+ eTypeBoolean,
+ eTypeString,
+ eTypeDictionary
+ };
+
+ class Object :
+ public std::enable_shared_from_this<Object>
+ {
+ public:
+
+ Object (Type t = Type::eTypeInvalid) :
+ m_type (t)
+ {
+ }
+
+ virtual ~Object ()
+ {
+ }
+
+ virtual void
+ Clear ()
+ {
+ m_type = Type::eTypeInvalid;
+ }
+
+ Type
+ GetType () const
+ {
+ return m_type;
+ }
+
+ void
+ SetType (Type t)
+ {
+ m_type = t;
+ }
+
+ Array *
+ GetAsArray ()
+ {
+ if (m_type == Type::eTypeArray)
+ return (Array *)this;
+ return NULL;
+ }
+
+ Dictionary *
+ GetAsDictionary ()
+ {
+ if (m_type == Type::eTypeDictionary)
+ return (Dictionary *)this;
+ return NULL;
+ }
+
+ Integer *
+ GetAsInteger ()
+ {
+ if (m_type == Type::eTypeInteger)
+ return (Integer *)this;
+ return NULL;
+ }
+
+ Float *
+ GetAsFloat ()
+ {
+ if (m_type == Type::eTypeFloat)
+ return (Float *)this;
+ return NULL;
+ }
+
+ Boolean *
+ GetAsBoolean ()
+ {
+ if (m_type == Type::eTypeBoolean)
+ return (Boolean *)this;
+ return NULL;
+ }
+
+ String *
+ GetAsString ()
+ {
+ if (m_type == Type::eTypeString)
+ return (String *)this;
+ return NULL;
+ }
+
+ ObjectSP
+ GetObjectForDotSeparatedPath (llvm::StringRef path);
+
+ virtual void
+ Dump (Stream &s) const = 0;
+
+ private:
+ Type m_type;
+ };
+
+ class Array : public Object
+ {
+ public:
+ Array () :
+ Object (Type::eTypeArray)
+ {
+ }
+
+ virtual
+ ~Array()
+ {
+ }
+
+ size_t
+ GetSize()
+ {
+ return m_items.size();
+ }
+
+ ObjectSP
+ operator[](size_t idx)
+ {
+ if (idx < m_items.size())
+ return m_items[idx];
+ return ObjectSP();
+ }
+
+ ObjectSP
+ GetItemAtIndex (size_t idx)
+ {
+ if (idx < m_items.size())
+ return m_items[idx];
+ return ObjectSP();
+ }
+
+ void
+ Push(ObjectSP item)
+ {
+ m_items.push_back(item);
+ }
+
+ void
+ AddItem(ObjectSP item)
+ {
+ m_items.push_back(item);
+ }
+
+ virtual void
+ Dump (Stream &s) const;
+
+ protected:
+ typedef std::vector<ObjectSP> collection;
+ collection m_items;
+ };
+
+
+ class Integer : public Object
+ {
+ public:
+ Integer () :
+ Object (Type::eTypeInteger),
+ m_value ()
+ {
+ }
+
+ virtual ~Integer()
+ {
+ }
+
+ void
+ SetValue (uint64_t value)
+ {
+ m_value = value;
+ }
+
+ uint64_t
+ GetValue ()
+ {
+ return m_value;
+ }
+
+ virtual void
+ Dump (Stream &s) const;
+
+ protected:
+ uint64_t m_value;
+ };
+
+ class Float : public Object
+ {
+ public:
+ Float () :
+ Object (Type::eTypeFloat),
+ m_value ()
+ {
+ }
+
+ virtual ~Float()
+ {
+ }
+
+ void
+ SetValue (double value)
+ {
+ m_value = value;
+ }
+
+ double
+ GetValue ()
+ {
+ return m_value;
+ }
+
+ virtual void
+ Dump (Stream &s) const;
+
+ protected:
+ double m_value;
+ };
+
+ class Boolean : public Object
+ {
+ public:
+ Boolean () :
+ Object (Type::eTypeBoolean),
+ m_value ()
+ {
+ }
+
+ virtual ~Boolean()
+ {
+ }
+
+ void
+ SetValue (bool value)
+ {
+ m_value = value;
+ }
+
+ bool
+ GetValue ()
+ {
+ return m_value;
+ }
+
+ virtual void
+ Dump (Stream &s) const;
+
+ protected:
+ bool m_value;
+ };
+
+
+
+ class String : public Object
+ {
+ public:
+ String () :
+ Object (Type::eTypeString),
+ m_value ()
+ {
+ }
+
+ void
+ SetValue (std::string string)
+ {
+ m_value = string;
+ }
+
+ std::string
+ GetValue ()
+ {
+ return m_value;
+ }
+
+ virtual void
+ Dump (Stream &s) const;
+
+ protected:
+ std::string m_value;
+ };
+
+ class Dictionary : public Object
+ {
+ public:
+ Dictionary () :
+ Object (Type::eTypeDictionary),
+ m_dict ()
+ {
+ }
+
+ virtual ~Dictionary()
+ {
+ }
+ size_t
+ GetSize()
+ {
+ return m_dict.size();
+ }
+
+ ObjectSP
+ GetKeys()
+ {
+ ObjectSP object_sp(new Array ());
+ Array *array = object_sp->GetAsArray();
+ collection::const_iterator iter;
+ for (iter = m_dict.begin(); iter != m_dict.end(); ++iter)
+ {
+ ObjectSP key_object_sp(new String());
+ key_object_sp->GetAsString()->SetValue(iter->first.AsCString());
+ array->Push(key_object_sp);
+ }
+ return object_sp;
+ }
+
+ ObjectSP
+ GetValueForKey (const char *key)
+ {
+ ObjectSP value_sp;
+ if (key)
+ {
+ ConstString key_cs(key);
+ for (collection::const_iterator iter = m_dict.begin(); iter != m_dict.end(); ++iter)
+ {
+ if (key_cs == iter->first)
+ {
+ value_sp = iter->second;
+ break;
+ }
+ }
+ }
+ return value_sp;
+ }
+
+ bool
+ HasKey (const char *key)
+ {
+ ConstString key_cs (key);
+ collection::const_iterator search = m_dict.find(key_cs);
+ if (search != m_dict.end())
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ void
+ AddItem (const char *key, ObjectSP value)
+ {
+ ConstString key_cs(key);
+ m_dict[key_cs] = value;
+ }
+
+ void
+ AddIntegerItem (const char *key, uint64_t value)
+ {
+ ObjectSP val_obj (new Integer());
+ val_obj->GetAsInteger()->SetValue (value);
+ AddItem (key, val_obj);
+ }
+
+ void
+ AddFloatItem (const char *key, double value)
+ {
+ ObjectSP val_obj (new Float());
+ val_obj->GetAsFloat()->SetValue (value);
+ AddItem (key, val_obj);
+ }
+
+ void
+ AddStringItem (const char *key, std::string value)
+ {
+ ObjectSP val_obj (new String());
+ val_obj->GetAsString()->SetValue (value);
+ AddItem (key, val_obj);
+ }
+
+ void
+ AddBooleanItem (const char *key, bool value)
+ {
+ ObjectSP val_obj (new Boolean());
+ val_obj->GetAsBoolean()->SetValue (value);
+ AddItem (key, val_obj);
+ }
+
+ virtual void
+ Dump (Stream &s) const;
+
+ protected:
+ typedef std::map<ConstString, ObjectSP> collection;
+ collection m_dict;
+ };
+
+ class Null : public Object
+ {
+ public:
+ Null () :
+ Object (Type::eTypeNull)
+ {
+ }
+
+ virtual ~Null()
+ {
+ }
+
+ virtual void
+ Dump (Stream &s) const;
+
+ protected:
+ };
+
+
+ static ObjectSP
+ ParseJSON (std::string json_text);
+
+}; // class StructuredData
+
+
+} // namespace lldb_private
+
+#endif // liblldb_StructuredData_h_
diff --git a/include/lldb/Core/UserID.h b/include/lldb/Core/UserID.h
index ea6af74759bf..230e43fa551f 100644
--- a/include/lldb/Core/UserID.h
+++ b/include/lldb/Core/UserID.h
@@ -19,12 +19,12 @@ namespace lldb_private {
/// @class UserID UserID.h "lldb/Core/UserID.h"
/// @brief A mix in class that contains a generic user ID.
///
-/// UserID is desinged as a mix in class that can contain an integer
-/// based unique identifier for a varietly of objects in lldb.
+/// UserID is designed as a mix in class that can contain an integer
+/// based unique identifier for a variety of objects in lldb.
///
/// The value for this identifier is chosen by each parser plug-in. A
/// value should be chosen that makes sense for each kind of object
-/// should and allows quick access to further and more in depth parsing.
+/// and should allow quick access to further and more in depth parsing.
///
/// Symbol table entries can use this to store the original symbol table
/// index, functions can use it to store the symbol table index or the
diff --git a/include/lldb/Core/Value.h b/include/lldb/Core/Value.h
index c7d44322333c..957cedeb0dcc 100644
--- a/include/lldb/Core/Value.h
+++ b/include/lldb/Core/Value.h
@@ -124,9 +124,15 @@ public:
Value();
Value(const Scalar& scalar);
Value(const Vector& vector);
- Value(const uint8_t *bytes, int len);
+ Value(const void *bytes, int len);
Value(const Value &rhs);
+ void
+ SetBytes (const void *bytes, int len);
+
+ void
+ AppendBytes (const void *bytes, int len);
+
Value &
operator=(const Value &rhs);
@@ -232,8 +238,23 @@ public:
return false;
}
- void
+ size_t
ResizeData(size_t len);
+
+ size_t
+ AppendDataToHostBuffer (const Value &rhs);
+
+ DataBufferHeap &
+ GetBuffer ()
+ {
+ return m_data_buffer;
+ }
+
+ const DataBufferHeap &
+ GetBuffer () const
+ {
+ return m_data_buffer;
+ }
bool
ValueOf(ExecutionContext *exe_ctx);
diff --git a/include/lldb/Core/ValueObject.h b/include/lldb/Core/ValueObject.h
index e2847c778484..6a08ec6507f9 100644
--- a/include/lldb/Core/ValueObject.h
+++ b/include/lldb/Core/ValueObject.h
@@ -35,7 +35,7 @@ namespace lldb_private {
/// ValueObject:
///
/// This abstract class provides an interface to a particular value, be it a register, a local or global variable,
-/// that is evaluated in some particular scope. The ValueObject also has the capibility of being the "child" of
+/// that is evaluated in some particular scope. The ValueObject also has the capability of being the "child" of
/// some other variable object, and in turn of having children.
/// If a ValueObject is a root variable object - having no parent - then it must be constructed with respect to some
/// particular ExecutionContextScope. If it is a child, it inherits the ExecutionContextScope from its parent.
@@ -380,7 +380,7 @@ public:
GetTypeImpl ();
//------------------------------------------------------------------
- // Sublasses must implement the functions below.
+ // Subclasses must implement the functions below.
//------------------------------------------------------------------
virtual uint64_t
GetByteSize() = 0;
@@ -389,12 +389,15 @@ public:
GetValueType() const = 0;
//------------------------------------------------------------------
- // Sublasses can implement the functions below.
+ // Subclasses can implement the functions below.
//------------------------------------------------------------------
virtual ConstString
GetTypeName();
virtual ConstString
+ GetDisplayTypeName();
+
+ virtual ConstString
GetQualifiedTypeName();
virtual lldb::LanguageType
@@ -427,6 +430,9 @@ public:
return false;
}
+ bool
+ IsBaseClass (uint32_t& depth);
+
virtual bool
IsDereferenceOfParent ()
{
@@ -465,7 +471,7 @@ public:
return true;
}
- virtual off_t
+ virtual lldb::offset_t
GetByteOffset()
{
return 0;
@@ -528,7 +534,7 @@ public:
GetDeclaration (Declaration &decl);
//------------------------------------------------------------------
- // The functions below should NOT be modified by sublasses
+ // The functions below should NOT be modified by subclasses
//------------------------------------------------------------------
const Error &
GetError();
@@ -671,6 +677,9 @@ public:
GetSyntheticChildAtOffset(uint32_t offset, const ClangASTType& type, bool can_create);
virtual lldb::ValueObjectSP
+ GetSyntheticBase (uint32_t offset, const ClangASTType& type, bool can_create);
+
+ virtual lldb::ValueObjectSP
GetDynamicValue (lldb::DynamicValueType valueType);
lldb::DynamicValueType
@@ -712,6 +721,10 @@ public:
{
}
+ // Find the address of the C++ vtable pointer
+ virtual lldb::addr_t
+ GetCPPVTableAddress(AddressType &address_type);
+
virtual lldb::ValueObjectSP
Cast (const ClangASTType &clang_ast_type);
@@ -762,7 +775,7 @@ public:
static lldb::ValueObjectSP
CreateValueObjectFromData (const char* name,
- DataExtractor& data,
+ const DataExtractor& data,
const ExecutionContext& exe_ctx,
ClangASTType type);
@@ -793,7 +806,7 @@ public:
uint32_t item_count = 1);
virtual uint64_t
- GetData (DataExtractor& data);
+ GetData (DataExtractor& data, Error &error);
virtual bool
SetData (DataExtractor &data, Error &error);
@@ -961,7 +974,7 @@ protected:
void
SetChildrenCount (size_t count)
{
- m_children_count = count;
+ Clear(count);
}
size_t
@@ -971,10 +984,10 @@ protected:
}
void
- Clear()
+ Clear(size_t new_count = 0)
{
- m_children_count = 0;
Mutex::Locker locker(m_mutex);
+ m_children_count = new_count;
m_children.clear();
}
@@ -1127,7 +1140,7 @@ protected:
ClearDynamicTypeInformation ();
//------------------------------------------------------------------
- // Sublasses must implement the functions below.
+ // Subclasses must implement the functions below.
//------------------------------------------------------------------
virtual ClangASTType
diff --git a/include/lldb/Core/ValueObjectChild.h b/include/lldb/Core/ValueObjectChild.h
index 780529a4af11..07d1f294bd80 100644
--- a/include/lldb/Core/ValueObjectChild.h
+++ b/include/lldb/Core/ValueObjectChild.h
@@ -32,7 +32,7 @@ public:
return m_byte_size;
}
- virtual off_t
+ virtual lldb::offset_t
GetByteOffset()
{
return m_byte_offset;
@@ -62,6 +62,9 @@ public:
virtual ConstString
GetQualifiedTypeName();
+ virtual ConstString
+ GetDisplayTypeName();
+
virtual bool
IsInScope ();
diff --git a/include/lldb/Core/ValueObjectConstResult.h b/include/lldb/Core/ValueObjectConstResult.h
index 4964d0589a09..dd87fc848ae8 100644
--- a/include/lldb/Core/ValueObjectConstResult.h
+++ b/include/lldb/Core/ValueObjectConstResult.h
@@ -80,6 +80,9 @@ public:
virtual ConstString
GetTypeName();
+ virtual ConstString
+ GetDisplayTypeName();
+
virtual bool
IsInScope ();
diff --git a/include/lldb/Core/ValueObjectDynamicValue.h b/include/lldb/Core/ValueObjectDynamicValue.h
index 68f88c96e545..7607bd38137d 100644
--- a/include/lldb/Core/ValueObjectDynamicValue.h
+++ b/include/lldb/Core/ValueObjectDynamicValue.h
@@ -37,6 +37,9 @@ public:
virtual ConstString
GetQualifiedTypeName();
+
+ virtual ConstString
+ GetDisplayTypeName();
virtual size_t
CalculateNumChildren();
diff --git a/include/lldb/Core/ValueObjectMemory.h b/include/lldb/Core/ValueObjectMemory.h
index 627d73eb4b27..41b43188a46a 100644
--- a/include/lldb/Core/ValueObjectMemory.h
+++ b/include/lldb/Core/ValueObjectMemory.h
@@ -47,6 +47,9 @@ public:
virtual ConstString
GetTypeName();
+ virtual ConstString
+ GetDisplayTypeName();
+
virtual size_t
CalculateNumChildren();
diff --git a/include/lldb/Core/ValueObjectRegister.h b/include/lldb/Core/ValueObjectRegister.h
index 6820629f08e1..f7c7683d60bc 100644
--- a/include/lldb/Core/ValueObjectRegister.h
+++ b/include/lldb/Core/ValueObjectRegister.h
@@ -45,6 +45,9 @@ public:
virtual ConstString
GetQualifiedTypeName();
+
+ virtual ConstString
+ GetDisplayTypeName();
virtual size_t
CalculateNumChildren();
diff --git a/include/lldb/Core/ValueObjectSyntheticFilter.h b/include/lldb/Core/ValueObjectSyntheticFilter.h
index f1d8c885c255..e12698f49bb1 100644
--- a/include/lldb/Core/ValueObjectSyntheticFilter.h
+++ b/include/lldb/Core/ValueObjectSyntheticFilter.h
@@ -41,6 +41,9 @@ public:
virtual ConstString
GetQualifiedTypeName();
+
+ virtual ConstString
+ GetDisplayTypeName();
virtual bool
MightHaveChildren();
diff --git a/include/lldb/Core/ValueObjectVariable.h b/include/lldb/Core/ValueObjectVariable.h
index 8a30b00f6bbd..0e32d09057dc 100644
--- a/include/lldb/Core/ValueObjectVariable.h
+++ b/include/lldb/Core/ValueObjectVariable.h
@@ -39,6 +39,9 @@ public:
virtual ConstString
GetQualifiedTypeName();
+
+ virtual ConstString
+ GetDisplayTypeName();
virtual size_t
CalculateNumChildren();
diff --git a/include/lldb/Core/dwarf.h b/include/lldb/Core/dwarf.h
index 91c8dfb9d0da..9fa8816229a9 100644
--- a/include/lldb/Core/dwarf.h
+++ b/include/lldb/Core/dwarf.h
@@ -12,7 +12,7 @@
#include <stdint.h>
-// Get the DWARF constant defintions from llvm
+// Get the DWARF constant definitions from llvm
#include "llvm/Support/Dwarf.h"
// and stuff them in our default namespace
using namespace llvm::dwarf;
diff --git a/include/lldb/DataFormatters/CXXFormatterFunctions.h b/include/lldb/DataFormatters/CXXFormatterFunctions.h
index c53ef9589eea..753ffa1bae1b 100644
--- a/include/lldb/DataFormatters/CXXFormatterFunctions.h
+++ b/include/lldb/DataFormatters/CXXFormatterFunctions.h
@@ -19,6 +19,7 @@
#include "lldb/DataFormatters/FormatClasses.h"
#include "lldb/DataFormatters/TypeSynthetic.h"
#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Target.h"
#include "clang/AST/ASTContext.h"
@@ -26,6 +27,9 @@
namespace lldb_private {
namespace formatters
{
+ StackFrame*
+ GetViableFrame (ExecutionContext exe_ctx);
+
bool
ExtractValueFromObjCExpression (ValueObject &valobj,
const char* target_type,
@@ -140,6 +144,9 @@ namespace lldb_private {
NSStringSummaryProvider (ValueObject& valobj, Stream& stream);
bool
+ NSTaggedString_SummaryProvider (ObjCLanguageRuntime::ClassDescriptorSP descriptor, Stream& stream);
+
+ bool
NSAttributedStringSummaryProvider (ValueObject& valobj, Stream& stream);
bool
@@ -176,113 +183,6 @@ namespace lldb_private {
extern template bool
ObjCSELSummaryProvider<false> (ValueObject&, Stream&);
- class NSArrayMSyntheticFrontEnd : public SyntheticChildrenFrontEnd
- {
- private:
- struct DataDescriptor_32
- {
- uint32_t _used;
- uint32_t _priv1 : 2 ;
- uint32_t _size : 30;
- uint32_t _priv2 : 2;
- uint32_t offset : 30;
- uint32_t _priv3;
- uint32_t _data;
- };
- struct DataDescriptor_64
- {
- uint64_t _used;
- uint64_t _priv1 : 2 ;
- uint64_t _size : 62;
- uint64_t _priv2 : 2;
- uint64_t offset : 62;
- uint32_t _priv3;
- uint64_t _data;
- };
- public:
- NSArrayMSyntheticFrontEnd (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
- ~NSArrayMSyntheticFrontEnd ();
- private:
- ExecutionContextRef m_exe_ctx_ref;
- uint8_t m_ptr_size;
- DataDescriptor_32 *m_data_32;
- DataDescriptor_64 *m_data_64;
- ClangASTType m_id_type;
- std::vector<lldb::ValueObjectSP> m_children;
- };
-
- class NSArrayISyntheticFrontEnd : public SyntheticChildrenFrontEnd
- {
- public:
- NSArrayISyntheticFrontEnd (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
- ~NSArrayISyntheticFrontEnd ();
- private:
- ExecutionContextRef m_exe_ctx_ref;
- uint8_t m_ptr_size;
- uint64_t m_items;
- lldb::addr_t m_data_ptr;
- ClangASTType m_id_type;
- std::vector<lldb::ValueObjectSP> m_children;
- };
-
- class NSArrayCodeRunningSyntheticFrontEnd : public SyntheticChildrenFrontEnd
- {
- public:
- NSArrayCodeRunningSyntheticFrontEnd (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
- ~NSArrayCodeRunningSyntheticFrontEnd ();
- };
-
SyntheticChildrenFrontEnd* NSArraySyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
class NSDictionaryISyntheticFrontEnd : public SyntheticChildrenFrontEnd
diff --git a/include/lldb/DataFormatters/FormatManager.h b/include/lldb/DataFormatters/FormatManager.h
index 24ec877ee515..0b9144dffa17 100644
--- a/include/lldb/DataFormatters/FormatManager.h
+++ b/include/lldb/DataFormatters/FormatManager.h
@@ -25,6 +25,7 @@
#include "lldb/DataFormatters/TypeCategoryMap.h"
#include <atomic>
+#include <functional>
namespace lldb_private {
@@ -39,6 +40,14 @@ class FormatManager : public IFormatChangeListener
typedef TypeCategoryMap::MapType::iterator CategoryMapIterator;
public:
+ template <typename FormatterType>
+ using HardcodedFormatterFinder = std::function<typename FormatterType::SharedPointer (lldb_private::ValueObject&,
+ lldb::DynamicValueType,
+ FormatManager&)>;
+
+ template <typename FormatterType>
+ using HardcodedFormatterFinders = std::vector<HardcodedFormatterFinder<FormatterType>>;
+
typedef TypeCategoryMap::CallbackType CategoryCallback;
FormatManager ();
@@ -260,6 +269,19 @@ private:
ConstString m_vectortypes_category_name;
ConstString m_appkit_category_name;
+ HardcodedFormatterFinders<TypeFormatImpl> m_hardcoded_formats;
+ HardcodedFormatterFinders<TypeSummaryImpl> m_hardcoded_summaries;
+ HardcodedFormatterFinders<SyntheticChildren> m_hardcoded_synthetics;
+
+ lldb::TypeFormatImplSP
+ GetHardcodedFormat (ValueObject&,lldb::DynamicValueType);
+
+ lldb::TypeSummaryImplSP
+ GetHardcodedSummaryFormat (ValueObject&,lldb::DynamicValueType);
+
+ lldb::SyntheticChildrenSP
+ GetHardcodedSyntheticChildren (ValueObject&,lldb::DynamicValueType);
+
TypeCategoryMap&
GetCategories ()
{
@@ -281,8 +303,11 @@ private:
void
LoadObjCFormatters ();
+
+ void
+ LoadHardcodedFormatters ();
};
} // namespace lldb_private
-
+
#endif // lldb_FormatManager_h_
diff --git a/include/lldb/DataFormatters/TypeFormat.h b/include/lldb/DataFormatters/TypeFormat.h
index 20fa8f2d4e7f..1090d7843e53 100644
--- a/include/lldb/DataFormatters/TypeFormat.h
+++ b/include/lldb/DataFormatters/TypeFormat.h
@@ -14,6 +14,7 @@
// C++ Includes
#include <string>
+#include <unordered_map>
// Other libraries and framework includes
@@ -135,7 +136,7 @@ namespace lldb_private {
typedef std::shared_ptr<TypeFormatImpl> SharedPointer;
typedef bool(*ValueCallback)(void*, ConstString, const lldb::TypeFormatImplSP&);
- virtual ~TypeFormatImpl () = default;
+ virtual ~TypeFormatImpl ();
bool
Cascades () const
@@ -229,7 +230,7 @@ namespace lldb_private {
typedef std::shared_ptr<TypeFormatImpl_Format> SharedPointer;
typedef bool(*ValueCallback)(void*, ConstString, const TypeFormatImpl_Format::SharedPointer&);
- virtual ~TypeFormatImpl_Format () = default;
+ virtual ~TypeFormatImpl_Format ();
lldb::Format
GetFormat () const
@@ -272,7 +273,7 @@ namespace lldb_private {
typedef std::shared_ptr<TypeFormatImpl_EnumType> SharedPointer;
typedef bool(*ValueCallback)(void*, ConstString, const TypeFormatImpl_EnumType::SharedPointer&);
- ~TypeFormatImpl_EnumType () = default;
+ ~TypeFormatImpl_EnumType ();
ConstString
GetTypeName ()
@@ -301,7 +302,7 @@ namespace lldb_private {
protected:
ConstString m_enum_type;
- mutable std::map<void*,ClangASTType> m_types;
+ mutable std::unordered_map<void*,ClangASTType> m_types;
private:
DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl_EnumType);
diff --git a/include/lldb/DataFormatters/TypeSummary.h b/include/lldb/DataFormatters/TypeSummary.h
index 1c195ab2ba4d..699494336cc6 100644
--- a/include/lldb/DataFormatters/TypeSummary.h
+++ b/include/lldb/DataFormatters/TypeSummary.h
@@ -225,14 +225,14 @@ namespace lldb_private {
return m_flags.GetSkipReferences();
}
- bool
- DoesPrintChildren () const
+ virtual bool
+ DoesPrintChildren (ValueObject* valobj) const
{
return !m_flags.GetDontShowChildren();
}
- bool
- DoesPrintValue () const
+ virtual bool
+ DoesPrintValue (ValueObject* valobj) const
{
return !m_flags.GetDontShowValue();
}
@@ -243,8 +243,8 @@ namespace lldb_private {
return m_flags.GetShowMembersOneLiner();
}
- bool
- HideNames () const
+ virtual bool
+ HideNames (ValueObject* valobj) const
{
return m_flags.GetHideItemNames();
}
@@ -267,13 +267,13 @@ namespace lldb_private {
m_flags.SetSkipReferences(value);
}
- void
+ virtual void
SetDoesPrintChildren (bool value)
{
m_flags.SetDontShowChildren(!value);
}
- void
+ virtual void
SetDoesPrintValue (bool value)
{
m_flags.SetDontShowValue(!value);
@@ -285,7 +285,7 @@ namespace lldb_private {
m_flags.SetShowMembersOneLiner(value);
}
- void
+ virtual void
SetHideNames (bool value)
{
m_flags.SetHideItemNames(value);
diff --git a/include/lldb/DataFormatters/ValueObjectPrinter.h b/include/lldb/DataFormatters/ValueObjectPrinter.h
index 375bb50c876d..bfe2d9c402d3 100644
--- a/include/lldb/DataFormatters/ValueObjectPrinter.h
+++ b/include/lldb/DataFormatters/ValueObjectPrinter.h
@@ -386,7 +386,7 @@ private:
std::string m_summary;
std::string m_error;
- friend class StringSummaryFormat;
+ friend struct StringSummaryFormat;
DISALLOW_COPY_AND_ASSIGN(ValueObjectPrinter);
};
diff --git a/include/lldb/Expression/ASTStructExtractor.h b/include/lldb/Expression/ASTStructExtractor.h
index a1518de83d6d..9e467797a398 100644
--- a/include/lldb/Expression/ASTStructExtractor.h
+++ b/include/lldb/Expression/ASTStructExtractor.h
@@ -30,7 +30,7 @@ namespace lldb_private {
///
/// The definition of this struct is itself in the body of the wrapper function,
/// so Clang does the structure layout itself. ASTStructExtractor reads through
-/// the AST for the wrapper funtion and finds the struct.
+/// the AST for the wrapper function and finds the struct.
//----------------------------------------------------------------------
class ASTStructExtractor : public clang::SemaConsumer
{
diff --git a/include/lldb/Expression/ClangExpressionDeclMap.h b/include/lldb/Expression/ClangExpressionDeclMap.h
index b04e1bd6f116..8a4aa82b8727 100644
--- a/include/lldb/Expression/ClangExpressionDeclMap.h
+++ b/include/lldb/Expression/ClangExpressionDeclMap.h
@@ -167,7 +167,7 @@ public:
const ConstString &name,
llvm::Value *value,
size_t size,
- off_t alignment);
+ lldb::offset_t alignment);
//------------------------------------------------------------------
/// [Used by IRForTarget] Finalize the struct, laying out the position
@@ -198,7 +198,7 @@ public:
bool
GetStructInfo (uint32_t &num_elements,
size_t &size,
- off_t &alignment);
+ lldb::offset_t &alignment);
//------------------------------------------------------------------
/// [Used by IRForTarget] Get specific information about one field
@@ -234,7 +234,7 @@ public:
bool
GetStructElement (const clang::NamedDecl *&decl,
llvm::Value *&value,
- off_t &offset,
+ lldb::offset_t &offset,
ConstString &name,
uint32_t index);
@@ -461,7 +461,7 @@ private:
{
}
- off_t m_struct_alignment; ///< The alignment of the struct in bytes.
+ lldb::offset_t m_struct_alignment; ///< The alignment of the struct in bytes.
size_t m_struct_size; ///< The size of the struct in bytes.
bool m_struct_laid_out; ///< True if the struct has been laid out and the layout is valid (that is, no new fields have been added since).
ConstString m_result_name; ///< The name of the result variable ($1, for example)
diff --git a/include/lldb/Expression/ClangExpressionParser.h b/include/lldb/Expression/ClangExpressionParser.h
index 3247f2094ba6..c79494d1a521 100644
--- a/include/lldb/Expression/ClangExpressionParser.h
+++ b/include/lldb/Expression/ClangExpressionParser.h
@@ -40,7 +40,7 @@ public:
//------------------------------------------------------------------
/// Constructor
///
- /// Initializes class variabes.
+ /// Initializes class variables.
///
/// @param[in] exe_scope,
/// If non-NULL, an execution context scope that can help to
@@ -51,7 +51,8 @@ public:
/// The expression to be parsed.
//------------------------------------------------------------------
ClangExpressionParser (ExecutionContextScope *exe_scope,
- ClangExpression &expr);
+ ClangExpression &expr,
+ bool generate_debug_info);
//------------------------------------------------------------------
/// Destructor
@@ -84,9 +85,9 @@ public:
/// and func_end do not delimit an allocated region; the allocated
/// region may begin before func_addr.)
///
- /// @param[in] execution_unit_ap
+ /// @param[in] execution_unit_sp
/// After parsing, ownership of the execution unit for
- /// for the expression is handed to this unique pointer.
+ /// for the expression is handed to this shared pointer.
///
/// @param[in] exe_ctx
/// The execution context to write the function into.
@@ -112,7 +113,7 @@ public:
Error
PrepareForExecution (lldb::addr_t &func_addr,
lldb::addr_t &func_end,
- std::unique_ptr<IRExecutionUnit> &execution_unit_ap,
+ std::shared_ptr<IRExecutionUnit> &execution_unit_sp,
ExecutionContext &exe_ctx,
bool &can_interpret,
lldb_private::ExecutionPolicy execution_policy);
@@ -134,6 +135,9 @@ public:
DisassembleFunction (Stream &stream,
ExecutionContext &exe_ctx);
+ bool
+ GetGenerateDebugInfo () const;
+
private:
ClangExpression & m_expr; ///< The expression to be parsed
std::unique_ptr<llvm::LLVMContext> m_llvm_context; ///< The LLVM context to generate IR into
@@ -143,7 +147,6 @@ private:
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
- std::unique_ptr<IRExecutionUnit> m_execution_unit; ///< The container for the finished Module
};
}
diff --git a/include/lldb/Expression/ClangExpressionVariable.h b/include/lldb/Expression/ClangExpressionVariable.h
index 620e604fb18c..5ee7a3058946 100644
--- a/include/lldb/Expression/ClangExpressionVariable.h
+++ b/include/lldb/Expression/ClangExpressionVariable.h
@@ -162,9 +162,9 @@ public:
{
}
- off_t m_alignment; ///< The required alignment of the variable, in bytes
- size_t m_size; ///< The space required for the variable, in bytes
- off_t m_offset; ///< The offset of the variable in the struct, in bytes
+ lldb::offset_t m_alignment; ///< The required alignment of the variable, in bytes
+ size_t m_size; ///< The space required for the variable, in bytes
+ lldb::offset_t m_offset; ///< The offset of the variable in the struct, in bytes
};
private:
@@ -237,8 +237,8 @@ public:
// this function is used to copy the address-of m_live_sp into m_frozen_sp
// this is necessary because the results of certain cast and pointer-arithmetic
// operations (such as those described in bugzilla issues 11588 and 11618) generate
- // frozen objcts that do not have a valid address-of, which can be troublesome when
- // using synthetic children providers. transferring the address-of the live object
+ // frozen objects that do not have a valid address-of, which can be troublesome when
+ // using synthetic children providers. Transferring the address-of the live object
// solves these issues and provides the expected user-level behavior
void
TransferAddress (bool force = false);
diff --git a/include/lldb/Expression/ClangFunction.h b/include/lldb/Expression/ClangFunction.h
index e150d389b416..61d56729f93d 100644
--- a/include/lldb/Expression/ClangFunction.h
+++ b/include/lldb/Expression/ClangFunction.h
@@ -88,7 +88,8 @@ public:
ClangFunction (ExecutionContextScope &exe_scope,
Function &function_ptr,
ClangASTContext *ast_context,
- const ValueList &arg_value_list);
+ const ValueList &arg_value_list,
+ const char *name);
//------------------------------------------------------------------
/// Constructor
@@ -114,7 +115,8 @@ public:
ClangFunction (ExecutionContextScope &exe_scope,
const ClangASTType &return_type,
const Address& function_address,
- const ValueList &arg_value_list);
+ const ValueList &arg_value_list,
+ const char *name);
//------------------------------------------------------------------
/// Destructor
@@ -251,9 +253,9 @@ public:
/// The result value will be put here after running the function.
///
/// @return
- /// Returns one of the ExecutionResults enum indicating function call status.
+ /// Returns one of the ExpressionResults enum indicating function call status.
//------------------------------------------------------------------
- ExecutionResults
+ lldb::ExpressionResults
ExecuteFunction(ExecutionContext &exe_ctx,
lldb::addr_t *args_addr_ptr,
const EvaluateExpressionOptions &options,
@@ -410,7 +412,9 @@ private:
//------------------------------------------------------------------
std::unique_ptr<ClangExpressionParser> m_parser; ///< The parser responsible for compiling the function.
- std::unique_ptr<IRExecutionUnit> m_execution_unit_ap;
+ std::shared_ptr<IRExecutionUnit> m_execution_unit_sp;
+ lldb::ModuleWP m_jit_module_wp;
+ std::string m_name; ///< The name of this clang function - for debugging purposes.
Function *m_function_ptr; ///< The function we're going to call. May be NULL if we don't have debug info for the function.
Address m_function_addr; ///< If we don't have the FunctionSP, we at least need the address & return type.
diff --git a/include/lldb/Expression/ClangUserExpression.h b/include/lldb/Expression/ClangUserExpression.h
index 83fdf1c21955..9d2e9093c0bd 100644
--- a/include/lldb/Expression/ClangUserExpression.h
+++ b/include/lldb/Expression/ClangUserExpression.h
@@ -105,7 +105,8 @@ public:
Parse (Stream &error_stream,
ExecutionContext &exe_ctx,
lldb_private::ExecutionPolicy execution_policy,
- bool keep_result_in_memory);
+ bool keep_result_in_memory,
+ bool generate_debug_info);
bool
CanInterpret ()
@@ -143,7 +144,7 @@ public:
/// @return
/// A Process::Execution results value.
//------------------------------------------------------------------
- ExecutionResults
+ lldb::ExpressionResults
Execute (Stream &error_stream,
ExecutionContext &exe_ctx,
const EvaluateExpressionOptions& options,
@@ -166,7 +167,7 @@ public:
///
/// @param[in] function_stack_pointer
/// A pointer to the base of the function's stack frame. This
- /// is used to determine whether the expession result resides in
+ /// is used to determine whether the expression result resides in
/// memory that will still be valid, or whether it needs to be
/// treated as homeless for the purpose of future expressions.
///
@@ -295,9 +296,9 @@ public:
/// fails to parse, run, or evaluated.
///
/// @result
- /// A Process::ExecutionResults value. eExecutionCompleted for success.
+ /// A Process::ExpressionResults value. eExpressionCompleted for success.
//------------------------------------------------------------------
- static ExecutionResults
+ static lldb::ExpressionResults
Evaluate (ExecutionContext &exe_ctx,
const EvaluateExpressionOptions& options,
const char *expr_cstr,
@@ -308,7 +309,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_objetivec based on the environment.
+ /// Populate m_cplusplus and m_objectivec based on the environment.
//------------------------------------------------------------------
void
@@ -344,11 +345,11 @@ private:
std::string m_transformed_text; ///< The text of the expression, as send to the parser
ResultType m_desired_type; ///< The type to coerce the expression's result to. If eResultTypeAny, inferred from the expression.
- std::unique_ptr<ClangExpressionDeclMap> m_expr_decl_map; ///< The map to use when parsing the expression.
- std::unique_ptr<IRExecutionUnit> m_execution_unit_ap; ///< The execution unit the expression is stored in.
- std::unique_ptr<Materializer> m_materializer_ap; ///< The materializer to use when running the expression.
- std::unique_ptr<ASTResultSynthesizer> m_result_synthesizer; ///< The result synthesizer, if one is needed.
-
+ std::unique_ptr<ClangExpressionDeclMap> m_expr_decl_map; ///< The map to use when parsing the expression.
+ std::shared_ptr<IRExecutionUnit> m_execution_unit_sp; ///< The execution unit the expression is stored in.
+ std::unique_ptr<Materializer> m_materializer_ap; ///< The materializer to use when running the expression.
+ 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).
diff --git a/include/lldb/Expression/ClangUtilityFunction.h b/include/lldb/Expression/ClangUtilityFunction.h
index 6da8e5ec3a8b..bb5601fa2914 100644
--- a/include/lldb/Expression/ClangUtilityFunction.h
+++ b/include/lldb/Expression/ClangUtilityFunction.h
@@ -168,10 +168,10 @@ public:
private:
std::unique_ptr<ClangExpressionDeclMap> m_expr_decl_map; ///< The map to use when parsing and materializing the expression.
- std::unique_ptr<IRExecutionUnit> m_execution_unit_ap;
-
- std::string m_function_text; ///< The text of the function. Must be a well-formed translation unit.
- std::string m_function_name; ///< The name of the function.
+ std::shared_ptr<IRExecutionUnit> m_execution_unit_sp;
+ lldb::ModuleWP m_jit_module_wp;
+ std::string m_function_text; ///< The text of the function. Must be a well-formed translation unit.
+ std::string m_function_name; ///< The name of the function.
};
} // namespace lldb_private
diff --git a/include/lldb/Expression/DWARFExpression.h b/include/lldb/Expression/DWARFExpression.h
index 5ecdf7fe9ee5..9ddecc053e00 100644
--- a/include/lldb/Expression/DWARFExpression.h
+++ b/include/lldb/Expression/DWARFExpression.h
@@ -222,6 +222,17 @@ public:
lldb::offset_t data_offset,
lldb::offset_t data_length);
+ void
+ CopyOpcodeData (const void *data,
+ lldb::offset_t data_length,
+ lldb::ByteOrder byte_order,
+ uint8_t addr_byte_size);
+
+ void
+ CopyOpcodeData (uint64_t const_value,
+ lldb::offset_t const_value_byte_size,
+ uint8_t addr_byte_size);
+
//------------------------------------------------------------------
/// Tells the expression that it refers to a location list.
@@ -347,7 +358,7 @@ public:
const DataExtractor& opcodes,
const lldb::offset_t offset,
const lldb::offset_t length,
- const uint32_t reg_set,
+ const lldb::RegisterKind reg_set,
const Value* initial_value_ptr,
Value& result,
Error *error_ptr);
diff --git a/include/lldb/Expression/ExpressionSourceCode.h b/include/lldb/Expression/ExpressionSourceCode.h
index be1014ae3047..2dd09378fcd2 100644
--- a/include/lldb/Expression/ExpressionSourceCode.h
+++ b/include/lldb/Expression/ExpressionSourceCode.h
@@ -17,6 +17,8 @@
namespace lldb_private
{
+class ExecutionContext;
+
class ExpressionSourceCode
{
public:
@@ -53,7 +55,8 @@ public:
bool GetText (std::string &text,
lldb::LanguageType wrapping_language,
bool const_object,
- bool static_method) const;
+ bool static_method,
+ ExecutionContext &exe_ctx) const;
private:
ExpressionSourceCode (const char *name,
diff --git a/include/lldb/Expression/IRExecutionUnit.h b/include/lldb/Expression/IRExecutionUnit.h
index 2820317e108e..3f28351a6928 100644
--- a/include/lldb/Expression/IRExecutionUnit.h
+++ b/include/lldb/Expression/IRExecutionUnit.h
@@ -30,6 +30,7 @@
#include "lldb/Expression/ClangExpressionParser.h"
#include "lldb/Expression/IRMemoryMap.h"
#include "lldb/Host/Mutex.h"
+#include "lldb/Symbol/ObjectFile.h"
namespace llvm {
@@ -60,7 +61,10 @@ class Error;
/// into the target process, the IRExecutionUnit knows how to copy the
/// emitted code into the target process.
//----------------------------------------------------------------------
-class IRExecutionUnit : public IRMemoryMap
+class IRExecutionUnit :
+ public std::enable_shared_from_this<IRExecutionUnit>,
+ public IRMemoryMap,
+ public ObjectFileJITDelegate
{
public:
//------------------------------------------------------------------
@@ -77,12 +81,14 @@ public:
//------------------------------------------------------------------
~IRExecutionUnit();
- llvm::Module *GetModule()
+ llvm::Module *
+ GetModule()
{
return m_module;
}
- llvm::Function *GetFunction()
+ llvm::Function *
+ GetFunction()
{
if (m_module)
return m_module->getFunction (m_name.AsCString());
@@ -90,9 +96,10 @@ public:
return NULL;
}
- void GetRunnableInfo(Error &error,
- lldb::addr_t &func_addr,
- lldb::addr_t &func_end);
+ void
+ GetRunnableInfo (Error &error,
+ lldb::addr_t &func_addr,
+ lldb::addr_t &func_end);
//------------------------------------------------------------------
/// Accessors for IRForTarget and other clients that may want binary
@@ -100,11 +107,36 @@ public:
/// IRExecutionUnit unless the client explicitly chooses to free it.
//------------------------------------------------------------------
- lldb::addr_t WriteNow(const uint8_t *bytes,
- size_t size,
- Error &error);
+ lldb::addr_t
+ WriteNow (const uint8_t *bytes,
+ size_t size,
+ Error &error);
+
+ void
+ FreeNow (lldb::addr_t allocation);
+
+ //------------------------------------------------------------------
+ /// ObjectFileJITDelegate overrides
+ //------------------------------------------------------------------
+ virtual lldb::ByteOrder
+ GetByteOrder () const;
- void FreeNow(lldb::addr_t allocation);
+ virtual uint32_t
+ GetAddressByteSize () const;
+
+ virtual void
+ PopulateSymtab (lldb_private::ObjectFile *obj_file,
+ lldb_private::Symtab &symtab);
+
+ virtual void
+ PopulateSectionList (lldb_private::ObjectFile *obj_file,
+ lldb_private::SectionList &section_list);
+
+ virtual bool
+ GetArchitecture (lldb_private::ArchSpec &arch);
+
+ lldb::ModuleSP
+ GetJITModule ();
private:
//------------------------------------------------------------------
@@ -180,6 +212,7 @@ private:
public:
MemoryManager (IRExecutionUnit &parent);
+ virtual ~MemoryManager();
//------------------------------------------------------------------
/// Passthrough interface stub
//------------------------------------------------------------------
@@ -423,7 +456,7 @@ private:
//------------------------------------------------------------------
/// Constructor
///
- /// Initializes class variabes.
+ /// Initializes class variables.
///
/// @param[in] name
/// The name of the function.
@@ -450,31 +483,47 @@ private:
//----------------------------------------------------------------------
/// @class AllocationRecord IRExecutionUnit.h "lldb/Expression/IRExecutionUnit.h"
- /// @brief Enacpsulates a single allocation request made by the JIT.
+ /// @brief Encapsulates a single allocation request made by the JIT.
///
/// Allocations made by the JIT are first queued up and then applied in
/// bulk to the underlying process.
//----------------------------------------------------------------------
+ enum class AllocationKind {
+ Stub, Code, Data, Global, Bytes
+ };
+
+ static lldb::SectionType
+ GetSectionTypeFromSectionName (const llvm::StringRef &name,
+ AllocationKind alloc_kind);
+
struct AllocationRecord {
- lldb::addr_t m_process_address;
- uintptr_t m_host_address;
- uint32_t m_permissions;
- size_t m_size;
- unsigned m_alignment;
- unsigned m_section_id;
+ std::string m_name;
+ lldb::addr_t m_process_address;
+ uintptr_t m_host_address;
+ uint32_t m_permissions;
+ lldb::SectionType m_sect_type;
+ size_t m_size;
+ unsigned m_alignment;
+ unsigned m_section_id;
AllocationRecord (uintptr_t host_address,
uint32_t permissions,
+ lldb::SectionType sect_type,
size_t size,
unsigned alignment,
- unsigned section_id = eSectionIDInvalid) :
+ unsigned section_id,
+ const char *name) :
+ m_name (),
m_process_address(LLDB_INVALID_ADDRESS),
m_host_address(host_address),
m_permissions(permissions),
+ m_sect_type (sect_type),
m_size(size),
m_alignment(alignment),
m_section_id(section_id)
{
+ if (name && name[0])
+ m_name = name;
}
void dump (Log *log);
diff --git a/include/lldb/Expression/IRForTarget.h b/include/lldb/Expression/IRForTarget.h
index 502f796d15a1..0ad34904f563 100644
--- a/include/lldb/Expression/IRForTarget.h
+++ b/include/lldb/Expression/IRForTarget.h
@@ -61,6 +61,12 @@ namespace lldb_private {
class IRForTarget : public llvm::ModulePass
{
public:
+ enum class LookupResult {
+ Success,
+ Fail,
+ Ignore
+ };
+
//------------------------------------------------------------------
/// Constructor
///
@@ -182,7 +188,7 @@ private:
//------------------------------------------------------------------
//------------------------------------------------------------------
- /// Get the address of a fuction, and a location to put the complete
+ /// Get the address of a function, and a location to put the complete
/// Value of the function if one is available.
///
/// @param[in] function
@@ -201,7 +207,7 @@ private:
/// @return
/// The pointer.
//------------------------------------------------------------------
- bool
+ LookupResult
GetFunctionAddress (llvm::Function *function,
uint64_t &ptr,
lldb_private::ConstString &name,
@@ -573,7 +579,7 @@ private:
ReplaceStrings ();
//------------------------------------------------------------------
- /// A basick block-level pass to find all literals that will be
+ /// A basic block-level pass to find all literals that will be
/// allocated as statics by the JIT (in contrast to the Strings,
/// which already are statics) and synthesize loads for them.
//------------------------------------------------------------------
diff --git a/include/lldb/Expression/IRMemoryMap.h b/include/lldb/Expression/IRMemoryMap.h
index affe19350e3f..4faa5226d9b4 100644
--- a/include/lldb/Expression/IRMemoryMap.h
+++ b/include/lldb/Expression/IRMemoryMap.h
@@ -27,7 +27,8 @@ namespace lldb_private
/// This class encapsulates a group of memory objects that must be readable
/// or writable from the host process regardless of whether the process
/// exists. This allows the IR interpreter as well as JITted code to access
-/// the same memory.
+/// the same memory. All allocations made by this class are represented as
+/// disjoint intervals.
///
/// Point queries against this group of memory objects can be made by the
/// address in the tar at which they reside. If the inferior does not
@@ -66,7 +67,7 @@ public:
uint32_t GetAddressByteSize();
// This function can return NULL.
- ExecutionContextScope *GetBestExecutionContextScope();
+ ExecutionContextScope *GetBestExecutionContextScope() const;
protected:
// This function should only be used if you know you are using the JIT.
@@ -118,7 +119,12 @@ private:
lldb::addr_t FindSpace (size_t size);
bool ContainsHostOnlyAllocations ();
AllocationMap::iterator FindAllocation (lldb::addr_t addr, size_t size);
- bool IntersectsAllocation (lldb::addr_t addr, size_t size);
+
+ // Returns true if the given allocation intersects any allocation in the memory map.
+ bool IntersectsAllocation (lldb::addr_t addr, size_t size) const;
+
+ // Returns true if the two given allocations intersect each other.
+ static bool AllocationsIntersect (lldb::addr_t addr1, size_t size1, lldb::addr_t addr2, size_t size2);
};
}
diff --git a/include/lldb/Host/Condition.h b/include/lldb/Host/Condition.h
index 2f1858b75a56..7431315c37a0 100644
--- a/include/lldb/Host/Condition.h
+++ b/include/lldb/Host/Condition.h
@@ -25,7 +25,7 @@ class TimeValue;
///
/// A class that wraps up a pthread condition (pthread_cond_t). The
/// class will create a pthread condition when an instance is
-/// constructed, and detroy it when it is destructed. It also provides
+/// constructed, and destroy it when it is destructed. It also provides
/// access to the standard pthread condition calls.
//----------------------------------------------------------------------
class Condition
diff --git a/include/lldb/Host/Config.h b/include/lldb/Host/Config.h
index 80616b747cf5..af6b98a7912a 100644
--- a/include/lldb/Host/Config.h
+++ b/include/lldb/Host/Config.h
@@ -18,7 +18,7 @@
#include "lldb/Host/linux/Config.h"
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__NetBSD__)
#include "lldb/Host/freebsd/Config.h"
diff --git a/include/lldb/Host/Debug.h b/include/lldb/Host/Debug.h
index 2cb758e1b733..87dffb9865c2 100644
--- a/include/lldb/Host/Debug.h
+++ b/include/lldb/Host/Debug.h
@@ -10,14 +10,11 @@
#ifndef liblldb_Debug_h_
#define liblldb_Debug_h_
-#include "lldb/lldb-private.h"
-#include "lldb/Core/Error.h"
-#include "lldb/Core/StreamString.h"
-#include "lldb/Host/Mutex.h"
#include <vector>
+#include "lldb/lldb-private.h"
namespace lldb_private {
-
+
//------------------------------------------------------------------
// Tells a thread what it needs to do when the process is resumed.
//------------------------------------------------------------------
@@ -27,7 +24,7 @@ namespace lldb_private {
lldb::StateType state; // Valid values are eStateStopped/eStateSuspended, eStateRunning, and eStateStepping.
int signal; // When resuming this thread, resume it with this signal if this value is > 0
};
-
+
//------------------------------------------------------------------
// A class that contains instructions for all threads for
// NativeProcessProtocol::Resume(). Each thread can either run, stay
@@ -43,15 +40,14 @@ namespace lldb_private {
m_signal_handled ()
{
}
-
+
ResumeActionList (lldb::StateType default_action, int signal) :
m_actions(),
m_signal_handled ()
{
SetDefaultThreadActionIfNeeded (default_action, signal);
}
-
-
+
ResumeActionList (const ResumeAction *actions, size_t num_actions) :
m_actions (),
m_signal_handled ()
@@ -62,7 +58,7 @@ namespace lldb_private {
m_signal_handled.assign (num_actions, false);
}
}
-
+
~ResumeActionList()
{
}
@@ -72,14 +68,14 @@ namespace lldb_private {
{
return m_actions.empty();
}
-
+
void
Append (const ResumeAction &action)
{
m_actions.push_back (action);
m_signal_handled.push_back (false);
}
-
+
void
AppendAction (lldb::tid_t tid,
lldb::StateType state,
@@ -88,25 +84,25 @@ namespace lldb_private {
ResumeAction action = { tid, state, signal };
Append (action);
}
-
+
void
AppendResumeAll ()
{
AppendAction (LLDB_INVALID_THREAD_ID, lldb::eStateRunning);
}
-
+
void
AppendSuspendAll ()
{
AppendAction (LLDB_INVALID_THREAD_ID, lldb::eStateStopped);
}
-
+
void
AppendStepAll ()
{
AppendAction (LLDB_INVALID_THREAD_ID, lldb::eStateStepping);
}
-
+
const ResumeAction *
GetActionForThread (lldb::tid_t tid, bool default_ok) const
{
@@ -120,7 +116,7 @@ namespace lldb_private {
return GetActionForThread (LLDB_INVALID_THREAD_ID, false);
return NULL;
}
-
+
size_t
NumActionsWithState (lldb::StateType state) const
{
@@ -133,7 +129,7 @@ namespace lldb_private {
}
return count;
}
-
+
bool
SetDefaultThreadActionIfNeeded (lldb::StateType action, int signal)
{
@@ -147,7 +143,7 @@ namespace lldb_private {
}
return false;
}
-
+
void
SetSignalHandledForThread (lldb::tid_t tid) const
{
@@ -161,26 +157,26 @@ namespace lldb_private {
}
}
}
-
+
const ResumeAction *
GetFirst() const
{
return m_actions.data();
}
-
+
size_t
GetSize () const
{
return m_actions.size();
}
-
+
void
Clear()
{
m_actions.clear();
m_signal_handled.clear();
}
-
+
protected:
std::vector<ResumeAction> m_actions;
mutable std::vector<bool> m_signal_handled;
@@ -191,13 +187,13 @@ namespace lldb_private {
lldb::StopReason reason;
union
{
- // eStopTypeSignal
+ // eStopReasonSignal
struct
{
uint32_t signo;
} signal;
-
- // eStopTypeException
+
+ // eStopReasonException
struct
{
uint64_t type;
@@ -206,201 +202,5 @@ namespace lldb_private {
} exception;
} details;
};
-
- //------------------------------------------------------------------
- // NativeThreadProtocol
- //------------------------------------------------------------------
- class NativeThreadProtocol {
-
- public:
- NativeThreadProtocol (NativeProcessProtocol *process, lldb::tid_t tid) :
- m_process (process),
- m_tid (tid)
- {
- }
-
- virtual ~NativeThreadProtocol()
- {
- }
- virtual const char *GetName() = 0;
- virtual lldb::StateType GetState () = 0;
- virtual Error ReadRegister (uint32_t reg, RegisterValue &reg_value) = 0;
- virtual Error WriteRegister (uint32_t reg, const RegisterValue &reg_value) = 0;
- virtual Error SaveAllRegisters (lldb::DataBufferSP &data_sp) = 0;
- virtual Error RestoreAllRegisters (lldb::DataBufferSP &data_sp) = 0;
- virtual bool GetStopReason (ThreadStopInfo &stop_info) = 0;
-
- lldb::tid_t
- GetID() const
- {
- return m_tid;
- }
- protected:
- NativeProcessProtocol *m_process;
- lldb::tid_t m_tid;
- };
-
-
- //------------------------------------------------------------------
- // NativeProcessProtocol
- //------------------------------------------------------------------
- class NativeProcessProtocol {
- public:
-
- static NativeProcessProtocol *
- CreateInstance (lldb::pid_t pid);
-
- // lldb_private::Host calls should be used to launch a process for debugging, and
- // then the process should be attached to. When attaching to a process
- // lldb_private::Host calls should be used to locate the process to attach to,
- // and then this function should be called.
- NativeProcessProtocol (lldb::pid_t pid) :
- m_pid (pid),
- m_threads(),
- m_threads_mutex (Mutex::eMutexTypeRecursive),
- m_state (lldb::eStateInvalid),
- m_exit_status(0),
- m_exit_description()
- {
- }
-
- public:
- virtual ~NativeProcessProtocol ()
- {
- }
-
- virtual Error Resume (const ResumeActionList &resume_actions) = 0;
- virtual Error Halt () = 0;
- virtual Error Detach () = 0;
- virtual Error Signal (int signo) = 0;
- virtual Error Kill () = 0;
-
- virtual Error ReadMemory (lldb::addr_t addr, void *buf, lldb::addr_t size, lldb::addr_t &bytes_read) = 0;
- virtual Error WriteMemory (lldb::addr_t addr, const void *buf, lldb::addr_t size, lldb::addr_t &bytes_written) = 0;
- virtual Error AllocateMemory (lldb::addr_t size, uint32_t permissions, lldb::addr_t &addr) = 0;
- virtual Error DeallocateMemory (lldb::addr_t addr) = 0;
-
- virtual lldb::addr_t GetSharedLibraryInfoAddress () = 0;
-
- virtual bool IsAlive () = 0;
- virtual size_t UpdateThreads () = 0;
- virtual bool GetArchitecture (ArchSpec &arch) = 0;
-
- //----------------------------------------------------------------------
- // Breakpoint functions
- //----------------------------------------------------------------------
- virtual Error SetBreakpoint (lldb::addr_t addr, size_t size, bool hardware) = 0;
- virtual Error RemoveBreakpoint (lldb::addr_t addr, size_t size) = 0;
-
- //----------------------------------------------------------------------
- // Watchpoint functions
- //----------------------------------------------------------------------
- virtual uint32_t GetMaxWatchpoints () = 0;
- virtual Error SetWatchpoint (lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware) = 0;
- virtual Error RemoveWatchpoint (lldb::addr_t addr) = 0;
-
-
- //----------------------------------------------------------------------
- // Accessors
- //----------------------------------------------------------------------
- lldb::pid_t
- GetID() const
- {
- return m_pid;
- }
-
- lldb::StateType
- GetState () const
- {
- return m_state;
- }
-
- bool
- IsRunning () const
- {
- return m_state == lldb::eStateRunning || IsStepping();
- }
-
- bool
- IsStepping () const
- {
- return m_state == lldb::eStateStepping;
- }
-
- bool
- CanResume () const
- {
- return m_state == lldb::eStateStopped;
- }
-
-
- void
- SetState (lldb::StateType state)
- {
- m_state = state;
- }
-
- //----------------------------------------------------------------------
- // Exit Status
- //----------------------------------------------------------------------
- virtual bool
- GetExitStatus (int *status)
- {
- if (m_state == lldb::eStateExited)
- {
- *status = m_exit_status;
- return true;
- }
- *status = 0;
- return false;
- }
- virtual bool
- SetExitStatus (int status, const char *exit_description)
- {
- // Exit status already set
- if (m_state == lldb::eStateExited)
- return false;
- m_state = lldb::eStateExited;
- m_exit_status = status;
- if (exit_description && exit_description[0])
- m_exit_description = exit_description;
- else
- m_exit_description.clear();
- return true;
- }
-
- //----------------------------------------------------------------------
- // Access to threads
- //----------------------------------------------------------------------
- lldb::NativeThreadProtocolSP
- GetThreadAtIndex (uint32_t idx)
- {
- Mutex::Locker locker(m_threads_mutex);
- if (idx < m_threads.size())
- return m_threads[idx];
- return lldb::NativeThreadProtocolSP();
- }
-
- lldb::NativeThreadProtocolSP
- GetThreadByID (lldb::tid_t tid)
- {
- Mutex::Locker locker(m_threads_mutex);
- for (auto thread_sp : m_threads)
- {
- if (thread_sp->GetID() == tid)
- return thread_sp;
- }
- return lldb::NativeThreadProtocolSP();
- }
-
- protected:
- lldb::pid_t m_pid;
- std::vector<lldb::NativeThreadProtocolSP> m_threads;
- mutable Mutex m_threads_mutex;
- lldb::StateType m_state;
- int m_exit_status;
- std::string m_exit_description;
- };
-
}
#endif // #ifndef liblldb_Debug_h_
diff --git a/include/lldb/Host/DynamicLibrary.h b/include/lldb/Host/DynamicLibrary.h
deleted file mode 100644
index 1fcc7d1883cf..000000000000
--- a/include/lldb/Host/DynamicLibrary.h
+++ /dev/null
@@ -1,51 +0,0 @@
-//===-- DynamicLibrary.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_DynamicLibrary_h_
-#define liblldb_DynamicLibrary_h_
-
-#include "lldb/Host/FileSpec.h"
-#include "lldb/Host/Host.h"
-
-namespace lldb_private {
-
-class DynamicLibrary
-{
-public:
- DynamicLibrary (const FileSpec& spec, uint32_t options = Host::eDynamicLibraryOpenOptionLazy |
- Host::eDynamicLibraryOpenOptionLocal |
- Host::eDynamicLibraryOpenOptionLimitGetSymbol);
-
- ~DynamicLibrary ();
-
- template <typename T = void*>
- T GetSymbol (const char* name)
- {
- Error err;
- if (!m_handle)
- return (T)NULL;
- void* symbol = Host::DynamicLibraryGetSymbol (m_handle, name, err);
- if (!symbol)
- return (T)NULL;
- return (T)symbol;
- }
-
- bool
- IsValid ();
-
-private:
- lldb_private::FileSpec m_filespec;
- void* m_handle;
-
- DISALLOW_COPY_AND_ASSIGN (DynamicLibrary);
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_DynamicLibrary_h_
diff --git a/include/lldb/Host/Editline.h b/include/lldb/Host/Editline.h
index b92de1052f29..5cba8465d654 100644
--- a/include/lldb/Host/Editline.h
+++ b/include/lldb/Host/Editline.h
@@ -23,9 +23,11 @@
#include <string>
#include <vector>
+#include "lldb/Core/ConnectionFileDescriptor.h"
#include "lldb/Host/Condition.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Mutex.h"
+#include "lldb/Host/Predicate.h"
namespace lldb_private {
@@ -33,6 +35,10 @@ namespace lldb_private {
/// @class Editline Editline.h "lldb/Host/Editline.h"
/// @brief A class that encapsulates editline functionality.
//----------------------------------------------------------------------
+class EditlineHistory;
+
+typedef std::shared_ptr<EditlineHistory> EditlineHistorySP;
+
class Editline
{
public:
@@ -58,6 +64,7 @@ public:
Editline(const char *prog, // Used for the history file and for editrc program name
const char *prompt,
+ bool configure_for_multiline,
FILE *fin,
FILE *fout,
FILE *ferr);
@@ -65,10 +72,13 @@ public:
~Editline();
Error
- GetLine (std::string &line);
+ GetLine (std::string &line,
+ bool &interrupted);
Error
- GetLines (const std::string &end_line, StringList &lines);
+ GetLines (const std::string &end_line,
+ StringList &lines,
+ bool &interrupted);
bool
LoadHistory ();
@@ -97,7 +107,7 @@ public:
void
Refresh();
- void
+ bool
Interrupt ();
void
@@ -118,11 +128,6 @@ public:
size_t
Push (const char *bytes, size_t len);
-
- // Cache bytes and use them for input without using a FILE. Calling this function
- // will set the getc callback in the editline
- size_t
- SetInputBuffer (const char *c, size_t len);
static int
GetCharFromInputFileCallback (::EditLine *e, char *c);
@@ -135,21 +140,21 @@ public:
void
SetPrompt (const char *p);
-
+
+ void
+ ShowLineNumbers (bool enable, uint32_t line_offset)
+ {
+ m_prompt_with_line_numbers = enable;
+ m_line_offset = line_offset;
+ }
+
private:
Error
PrivateGetLine(std::string &line);
- FileSpec
- GetHistoryFile();
-
unsigned char
HandleCompletion (int ch);
-
- int
- GetChar (char *c);
-
static unsigned char
CallbackEditPrevLine (::EditLine *e, int ch);
@@ -169,9 +174,6 @@ private:
static FILE *
GetFilePointer (::EditLine *e, int fd);
- static int
- GetCharInputBufferCallback (::EditLine *e, char *c);
-
enum class Command
{
None = 0,
@@ -179,22 +181,19 @@ private:
EditNextLine,
};
::EditLine *m_editline;
- ::History *m_history;
- ::HistEvent m_history_event;
- std::string m_program;
+ EditlineHistorySP m_history_sp;
std::string m_prompt;
std::string m_lines_prompt;
- std::string m_getc_buffer;
- Mutex m_getc_mutex;
- Condition m_getc_cond;
+ lldb_private::Predicate<bool> m_getting_char;
CompleteCallbackType m_completion_callback;
void *m_completion_callback_baton;
-// Mutex m_gets_mutex; // Make sure only one thread
LineCompletedCallbackType m_line_complete_callback;
void *m_line_complete_callback_baton;
Command m_lines_command;
+ uint32_t m_line_offset;
uint32_t m_lines_curr_line;
uint32_t m_lines_max_line;
+ ConnectionFileDescriptor m_file;
bool m_prompt_with_line_numbers;
bool m_getting_line;
bool m_got_eof; // Set to true when we detect EOF
diff --git a/include/lldb/Host/Endian.h b/include/lldb/Host/Endian.h
index 610f3ce95c41..1ae3c40b5ca4 100644
--- a/include/lldb/Host/Endian.h
+++ b/include/lldb/Host/Endian.h
@@ -20,7 +20,7 @@ namespace endian {
{
uint32_t num;
uint8_t bytes[sizeof(uint32_t)];
- } const endianTest = { (uint16_t)0x01020304 };
+ } const endianTest = { 0x01020304 };
inline ByteOrder InlHostByteOrder() { return (ByteOrder)endianTest.bytes[0]; }
diff --git a/include/lldb/Host/File.h b/include/lldb/Host/File.h
index 814d96059f37..2738679b5e03 100644
--- a/include/lldb/Host/File.h
+++ b/include/lldb/Host/File.h
@@ -16,6 +16,7 @@
#include <sys/types.h>
#include "lldb/lldb-private.h"
+#include "lldb/Host/IOObject.h"
namespace lldb_private {
@@ -26,7 +27,7 @@ namespace lldb_private {
/// A file class that divides abstracts the LLDB core from host file
/// functionality.
//----------------------------------------------------------------------
-class File
+class File : public IOObject
{
public:
static int kInvalidDescriptor;
@@ -48,22 +49,22 @@ public:
ConvertOpenOptionsForPOSIXOpen (uint32_t open_options);
File() :
+ IOObject(eFDTypeFile, false),
m_descriptor (kInvalidDescriptor),
m_stream (kInvalidStream),
m_options (0),
m_own_stream (false),
- m_own_descriptor (false),
m_is_interactive (eLazyBoolCalculate),
m_is_real_terminal (eLazyBoolCalculate)
{
}
File (FILE *fh, bool transfer_ownership) :
+ IOObject(eFDTypeFile, false),
m_descriptor (kInvalidDescriptor),
m_stream (fh),
m_options (0),
m_own_stream (transfer_ownership),
- m_own_descriptor (false),
m_is_interactive (eLazyBoolCalculate),
m_is_real_terminal (eLazyBoolCalculate)
{
@@ -118,11 +119,11 @@ public:
uint32_t permissions = lldb::eFilePermissionsFileDefault);
File (int fd, bool transfer_ownership) :
+ IOObject(eFDTypeFile, transfer_ownership),
m_descriptor (fd),
m_stream (kInvalidStream),
m_options (0),
- m_own_stream (false),
- m_own_descriptor (transfer_ownership)
+ m_own_stream (false)
{
}
@@ -222,6 +223,10 @@ public:
int
GetDescriptor() const;
+ WaitableHandle
+ GetWaitableHandle();
+
+
void
SetDescriptor(int fd, bool transfer_ownership);
@@ -331,7 +336,7 @@ public:
///
/// @param[in/out] offset
/// The offset to seek to within the file relative to the
- /// end of the file which gets filled in the the resulting
+ /// end of the file which gets filled in with the resulting
/// absolute file offset.
///
/// @param[in] error_ptr
@@ -482,7 +487,7 @@ public:
///
/// Just knowing a file is a interactive isn't enough, we also need
/// to know if the terminal has a width and height so we can do
- /// cursor movement and other terminal maninpulations by sending
+ /// cursor movement and other terminal manipulations by sending
/// escape sequences.
///
/// @return
@@ -541,7 +546,6 @@ protected:
FILE *m_stream;
uint32_t m_options;
bool m_own_stream;
- bool m_own_descriptor;
LazyBool m_is_interactive;
LazyBool m_is_real_terminal;
};
diff --git a/include/lldb/Host/FileCache.h b/include/lldb/Host/FileCache.h
new file mode 100644
index 000000000000..779ff983de98
--- /dev/null
+++ b/include/lldb/Host/FileCache.h
@@ -0,0 +1,45 @@
+//===-- FileCache.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_FileCache_h
+#define liblldb_Host_FileCache_h
+
+#include <stdint.h>
+
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-types.h"
+
+#include "lldb/Core/Error.h"
+#include "lldb/Host/FileSpec.h"
+
+namespace lldb_private
+{
+class FileCache
+{
+ private:
+ FileCache() {}
+
+ typedef std::map<lldb::user_id_t, lldb::FileSP> FDToFileMap;
+
+ public:
+ static FileCache &GetInstance();
+
+ lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags, uint32_t mode, Error &error);
+ bool CloseFile(lldb::user_id_t fd, Error &error);
+
+ uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src, uint64_t src_len, Error &error);
+ uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, uint64_t dst_len, Error &error);
+
+ private:
+ static FileCache *m_instance;
+
+ FDToFileMap m_cache;
+};
+}
+
+#endif
diff --git a/include/lldb/Host/FileSpec.h b/include/lldb/Host/FileSpec.h
index dfc4e4ae0fe3..ef73bb2ede0f 100644
--- a/include/lldb/Host/FileSpec.h
+++ b/include/lldb/Host/FileSpec.h
@@ -51,6 +51,13 @@ public:
eFileTypeOther
} FileType;
+ enum PathSyntax
+ {
+ ePathSyntaxPosix,
+ ePathSyntaxWindows,
+ ePathSyntaxHostNative
+ };
+
FileSpec();
//------------------------------------------------------------------
@@ -69,7 +76,7 @@ public:
///
/// @see FileSpec::SetFile (const char *path, bool resolve)
//------------------------------------------------------------------
- explicit FileSpec (const char *path, bool resolve_path);
+ explicit FileSpec (const char *path, bool resolve_path, PathSyntax syntax = ePathSyntaxHostNative);
//------------------------------------------------------------------
/// Copy constructor
@@ -249,7 +256,7 @@ public:
/// by a directory delimiter, and the filename.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
//------------------------------------------------------------------
void
Dump (Stream *s) const;
@@ -263,6 +270,15 @@ public:
bool
Exists () const;
+ //------------------------------------------------------------------
+ /// Check if a file is readable by the current user
+ ///
+ /// @return
+ /// \b true if the file exists on disk and is readable, \b false
+ /// otherwise.
+ //------------------------------------------------------------------
+ bool
+ Readable () const;
//------------------------------------------------------------------
/// Expanded existence test.
@@ -291,6 +307,9 @@ public:
uint64_t
GetByteSize() const;
+ PathSyntax
+ GetPathSyntax() const;
+
//------------------------------------------------------------------
/// Directory string get accessor.
///
@@ -375,7 +394,7 @@ public:
/// still NULL terminated).
//------------------------------------------------------------------
size_t
- GetPath (char *path, size_t max_path_length) const;
+ GetPath (char *path, size_t max_path_length, bool denormalize = true) const;
//------------------------------------------------------------------
/// Extract the full path to the file.
@@ -387,7 +406,7 @@ public:
/// concatenated.
//------------------------------------------------------------------
std::string
- GetPath () const;
+ GetPath (bool denormalize = true) const;
//------------------------------------------------------------------
/// Extract the extension of the file.
@@ -486,7 +505,7 @@ public:
/// Returns a shared pointer to a data buffer that contains all or
/// part of the contents of a file. The data is memory mapped and
/// will lazily page in data from the file as memory is accessed.
- /// The data that is mappped will start \a offset bytes into the
+ /// 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
@@ -504,7 +523,7 @@ public:
/// as many bytes as possible.
///
/// @return
- /// A shared pointer to the memeory mapped data. This shared
+ /// 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.
//------------------------------------------------------------------
@@ -559,8 +578,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);
+
//------------------------------------------------------------------
- /// Change the file specificed with a new path.
+ /// Change the file specified with a new path.
///
/// Update the contents of this object with a new path. The path will
/// be split up into a directory and filename and stored as uniqued
@@ -574,7 +597,7 @@ public:
/// the static FileSpec::Resolve.
//------------------------------------------------------------------
void
- SetFile (const char *path, bool resolve_path);
+ SetFile (const char *path, bool resolve_path, PathSyntax syntax = ePathSyntaxHostNative);
bool
IsResolved () const
@@ -617,27 +640,14 @@ public:
ReadFileLines (STLStringArray &lines);
//------------------------------------------------------------------
- /// Resolves user name and links in \a src_path, and writes the output
- /// to \a dst_path. Note if the path pointed to by \a src_path does not
- /// exist, the contents of \a src_path will be copied to \a dst_path
- /// unchanged.
+ /// Resolves user name and links in \a path, and overwrites the input
+ /// argument with the resolved path.
///
- /// @param[in] src_path
- /// Input path to be resolved.
- ///
- /// @param[in] dst_path
- /// Buffer to store the resolved path.
- ///
- /// @param[in] dst_len
- /// Size of the buffer pointed to by dst_path.
- ///
- /// @result
- /// The number of characters required to write the resolved path. If the
- /// resolved path doesn't fit in dst_len, dst_len-1 characters will
- /// be written to \a dst_path, but the actual required length will still be returned.
+ /// @param[in] path
+ /// Input path to be resolved, in the form of a llvm::SmallString or similar.
//------------------------------------------------------------------
- static size_t
- Resolve (const char *src_path, char *dst_path, size_t dst_len);
+ static void
+ Resolve (llvm::SmallVectorImpl<char> &path);
FileSpec
CopyByAppendingPathComponent (const char *new_path) const;
@@ -665,18 +675,9 @@ public:
///
/// @param[in] dst_path
/// Buffer to store the resolved path.
- ///
- /// @param[in] dst_len
- /// Size of the buffer pointed to by dst_path.
- ///
- /// @result
- /// The number of characters required to write the resolved path, or 0 if
- /// the user name could not be found. If the
- /// resolved path doesn't fit in dst_len, dst_len-1 characters will
- /// be written to \a dst_path, but the actual required length will still be returned.
//------------------------------------------------------------------
- static size_t
- ResolveUsername (const char *src_path, char *dst_path, size_t dst_len);
+ static void
+ ResolveUsername (llvm::SmallVectorImpl<char> &path);
static size_t
ResolvePartialUsername (const char *partial_name, StringList &matches);
@@ -709,6 +710,7 @@ protected:
ConstString m_directory; ///< The uniqued directory path
ConstString m_filename; ///< The uniqued filename path
mutable bool m_is_resolved; ///< True if this path has been resolved.
+ PathSyntax m_syntax; ///< The syntax that this path uses (e.g. Windows / Posix)
};
//----------------------------------------------------------------------
diff --git a/include/lldb/Host/FileSystem.h b/include/lldb/Host/FileSystem.h
new file mode 100644
index 000000000000..adcbfc9d590d
--- /dev/null
+++ b/include/lldb/Host/FileSystem.h
@@ -0,0 +1,43 @@
+//===-- FileSystem.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_FileSystem_h
+#define liblldb_Host_FileSystem_h
+
+#include <stdint.h>
+
+#include "lldb/lldb-types.h"
+
+#include "lldb/Core/Error.h"
+#include "lldb/Host/FileSpec.h"
+
+namespace lldb_private
+{
+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 GetFilePermissions(const char *path, uint32_t &file_permissions);
+ static Error SetFilePermissions(const char *path, 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 bool CalculateMD5(const FileSpec &file_spec, uint64_t &low, uint64_t &high);
+};
+}
+
+#endif
diff --git a/include/lldb/Host/Host.h b/include/lldb/Host/Host.h
index 862b1ed79432..19ed7b01e80f 100644
--- a/include/lldb/Host/Host.h
+++ b/include/lldb/Host/Host.h
@@ -17,11 +17,16 @@
#include <string>
#include "lldb/lldb-private.h"
+#include "lldb/lldb-private-forward.h"
#include "lldb/Core/StringList.h"
#include "lldb/Host/File.h"
+#include "lldb/Host/FileSpec.h"
namespace lldb_private {
+class FileAction;
+class ProcessLaunchInfo;
+
//----------------------------------------------------------------------
/// @class Host Host.h "lldb/Host/Host.h"
/// @brief A class that provides host computer information.
@@ -32,6 +37,10 @@ namespace lldb_private {
class Host
{
public:
+
+ /// A value of std::numeric_limits<uint32_t>::max() is used if there is no practical limit.
+ static const uint32_t MAX_THREAD_NAME_LENGTH;
+
typedef bool (*MonitorChildProcessCallback) (void *callback_baton,
lldb::pid_t pid,
bool exited,
@@ -48,11 +57,11 @@ public:
/// thread so the callback function must be thread safe.
///
/// When the callback gets called, the return value indicates if
- /// minotoring should stop. If \b true is returned from \a callback
+ /// monitoring should stop. If \b true is returned from \a callback
/// the information will be removed. If \b false is returned then
/// monitoring will continue. If the child process exits, the
/// monitoring will automatically stop after the callback returned
- /// ragardless of the callback return value.
+ /// regardless of the callback return value.
///
/// @param[in] callback
/// A function callback to call when a child receives a signal
@@ -83,68 +92,6 @@ public:
lldb::pid_t pid,
bool monitor_signals);
- //------------------------------------------------------------------
- /// Get the host page size.
- ///
- /// @return
- /// The size in bytes of a VM page on the host system.
- //------------------------------------------------------------------
- static size_t
- GetPageSize();
-
- //------------------------------------------------------------------
- /// Returns the endianness of the host system.
- ///
- /// @return
- /// Returns the endianness of the host system as a lldb::ByteOrder
- /// enumeration.
- //------------------------------------------------------------------
- static lldb::ByteOrder
- GetByteOrder ();
-
- //------------------------------------------------------------------
- /// Returns the number of CPUs on this current host.
- ///
- /// @return
- /// Number of CPUs on this current host, or zero if the number
- /// of CPUs can't be determined on this host.
- //------------------------------------------------------------------
- static uint32_t
- GetNumberCPUS ();
-
- static bool
- GetOSVersion (uint32_t &major,
- uint32_t &minor,
- uint32_t &update);
-
- static bool
- GetOSBuildString (std::string &s);
-
- static bool
- GetOSKernelDescription (std::string &s);
-
- static bool
- GetHostname (std::string &s);
-
- static const char *
- GetUserName (uint32_t uid, std::string &user_name);
-
- static const char *
- GetGroupName (uint32_t gid, std::string &group_name);
-
- static uint32_t
- GetUserID ();
-
- static uint32_t
- GetGroupID ();
-
- static uint32_t
- GetEffectiveUserID ();
-
- static uint32_t
- GetEffectiveGroupID ();
-
-
enum SystemLogType
{
eSystemLogWarning,
@@ -158,67 +105,6 @@ public:
SystemLog (SystemLogType type, const char *format, va_list args);
//------------------------------------------------------------------
- /// Gets the host architecture.
- ///
- /// @return
- /// A const architecture object that represents the host
- /// architecture.
- //------------------------------------------------------------------
- enum SystemDefaultArchitecture
- {
- eSystemDefaultArchitecture, // The overall default architecture that applications will run on this host
- eSystemDefaultArchitecture32, // If this host supports 32 bit programs, return the default 32 bit arch
- eSystemDefaultArchitecture64 // If this host supports 64 bit programs, return the default 64 bit arch
- };
-
- static const ArchSpec &
- GetArchitecture (SystemDefaultArchitecture arch_kind = eSystemDefaultArchitecture);
-
- //------------------------------------------------------------------
- /// Gets the host vendor string.
- ///
- /// @return
- /// A const string object containing the host vendor name.
- //------------------------------------------------------------------
- static const ConstString &
- GetVendorString ();
-
- //------------------------------------------------------------------
- /// Gets the host Operating System (OS) string.
- ///
- /// @return
- /// A const string object containing the host OS name.
- //------------------------------------------------------------------
- static const ConstString &
- GetOSString ();
-
- //------------------------------------------------------------------
- /// Gets the host target triple as a const string.
- ///
- /// @return
- /// A const string object containing the host target triple.
- //------------------------------------------------------------------
- static const ConstString &
- GetTargetTriple ();
-
- //------------------------------------------------------------------
- /// Gets the name of the distribution (i.e. distributor id).
- ///
- /// On Linux, this will return the equivalent of lsb_release -i.
- /// Android will return 'android'. Other systems may return
- /// nothing.
- ///
- /// @return
- /// A ConstString reference containing the OS distribution id.
- /// The return string will be all lower case, with whitespace
- /// replaced with underscores. The return string will be
- /// empty (result.AsCString() will return NULL) if the distribution
- /// cannot be obtained.
- //------------------------------------------------------------------
- static const ConstString &
- GetDistributionId ();
-
- //------------------------------------------------------------------
/// Get the process ID for the calling process.
///
/// @return
@@ -259,7 +145,7 @@ public:
///
/// This function call lets the current host OS do any thread
/// specific initialization that it needs, including naming the
- /// thread. No cleanup routine is exptected to be called
+ /// thread. No cleanup routine is expected to be called
///
/// @param[in] name
/// The current thread's name in the current process.
@@ -357,16 +243,6 @@ public:
SetShortThreadName (lldb::pid_t pid, lldb::tid_t tid, const char *name, size_t len);
//------------------------------------------------------------------
- /// Gets the FileSpec of the current process (the process that
- /// that is running the LLDB code).
- ///
- /// @return
- /// \b A file spec with the program name.
- //------------------------------------------------------------------
- static FileSpec
- GetProgramFileSpec ();
-
- //------------------------------------------------------------------
/// Given an address in the current process (the process that
/// is running the LLDB code), return the name of the module that
/// it comes from. This can be useful when you need to know the
@@ -383,8 +259,6 @@ public:
//------------------------------------------------------------------
static FileSpec
GetModuleFileSpecForHostAddress (const void *host_addr);
-
-
//------------------------------------------------------------------
/// If you have an executable that is in a bundle and want to get
@@ -410,7 +284,7 @@ public:
//------------------------------------------------------------------
/// When executable files may live within a directory, where the
/// directory represents an executable bundle (like the MacOSX
- /// app bundles), the locate the executable within the containing
+ /// app bundles), then locate the executable within the containing
/// bundle.
///
/// @param[in,out] file
@@ -426,28 +300,6 @@ public:
ResolveExecutableInBundle (FileSpec &file);
//------------------------------------------------------------------
- /// Find a resource files that are related to LLDB.
- ///
- /// Operating systems have different ways of storing shared
- /// libraries and related resources. This function abstracts the
- /// access to these paths.
- ///
- /// @param[in] path_type
- /// The type of LLDB resource path you are looking for. If the
- /// enumeration ends with "Dir", then only the \a file_spec's
- /// directory member gets filled in.
- ///
- /// @param[in] file_spec
- /// A file spec that gets filled in with the appriopriate path.
- ///
- /// @return
- /// \b true if \a resource_path was resolved, \a false otherwise.
- //------------------------------------------------------------------
- static bool
- GetLLDBPath (PathType path_type,
- FileSpec &file_spec);
-
- //------------------------------------------------------------------
/// Set a string that can be displayed if host application crashes.
///
/// Some operating systems have the ability to print a description
@@ -477,14 +329,19 @@ public:
static bool
GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &proc_info);
-#if defined (__APPLE__) || defined (__linux__) || defined (__FreeBSD__) || defined (__GLIBC__)
+#if defined (__APPLE__) || defined (__linux__) || defined (__FreeBSD__) || defined (__GLIBC__) || defined (__NetBSD__)
static short
GetPosixspawnFlags (ProcessLaunchInfo &launch_info);
static Error
LaunchProcessPosixSpawn (const char *exe_path, ProcessLaunchInfo &launch_info, ::pid_t &pid);
+
+ static bool AddPosixSpawnFileAction(void *file_actions, const FileAction *info, Log *log, Error &error);
#endif
+ static const lldb_private::UnixSignalsSP&
+ GetUnixSignals ();
+
static lldb::pid_t
LaunchApplication (const FileSpec &app_file_spec);
@@ -503,6 +360,9 @@ public:
static lldb::DataBufferSP
GetAuxvData (lldb_private::Process *process);
+ static lldb::DataBufferSP
+ GetAuxvData (lldb::pid_t pid);
+
static lldb::TargetSP
GetDummyTarget (Debugger &debugger);
@@ -515,79 +375,6 @@ public:
static size_t
GetEnvironment (StringList &env);
-
- enum DynamicLibraryOpenOptions
- {
- eDynamicLibraryOpenOptionLazy = (1u << 0), // Lazily resolve symbols in this dynamic library
- eDynamicLibraryOpenOptionLocal = (1u << 1), // Only open a shared library with local access (hide it from the global symbol namespace)
- eDynamicLibraryOpenOptionLimitGetSymbol = (1u << 2) // DynamicLibraryGetSymbol calls on this handle will only return matches from this shared library
- };
- static void *
- DynamicLibraryOpen (const FileSpec &file_spec,
- uint32_t options,
- Error &error);
-
- static Error
- DynamicLibraryClose (void *dynamic_library_handle);
-
- static void *
- DynamicLibraryGetSymbol (void *dynamic_library_handle,
- const char *symbol_name,
- Error &error);
-
- static Error
- MakeDirectory (const char* path, uint32_t mode);
-
- static Error
- GetFilePermissions (const char* path, uint32_t &file_permissions);
-
- static Error
- SetFilePermissions (const char* path, uint32_t file_permissions);
-
- 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 lldb::user_id_t
- OpenFile (const FileSpec& file_spec,
- uint32_t flags,
- uint32_t mode,
- Error &error);
-
- static bool
- CloseFile (lldb::user_id_t fd,
- Error &error);
-
- static uint64_t
- WriteFile (lldb::user_id_t fd,
- uint64_t offset,
- const void* src,
- uint64_t src_len,
- Error &error);
-
- static uint64_t
- ReadFile (lldb::user_id_t fd,
- uint64_t offset,
- void* dst,
- uint64_t dst_len,
- Error &error);
-
- static lldb::user_id_t
- GetFileSize (const FileSpec& file_spec);
-
- static bool
- GetFileExists (const FileSpec& file_spec);
-
- static bool
- CalculateMD5 (const FileSpec& file_spec,
- uint64_t &low,
- uint64_t &high);
-
};
} // namespace lldb_private
diff --git a/include/lldb/Host/HostGetOpt.h b/include/lldb/Host/HostGetOpt.h
index f4b2c87be230..761c1a118600 100644
--- a/include/lldb/Host/HostGetOpt.h
+++ b/include/lldb/Host/HostGetOpt.h
@@ -10,11 +10,15 @@
#ifndef _MSC_VER
+#ifdef _WIN32
+#define _BSD_SOURCE // Required so that getopt.h defines optreset
+#endif
+
#include <unistd.h>
#include <getopt.h>
#else
-#include <lldb/Host/windows/GetOptInc.h>
+#include <lldb/Host/windows/getopt/GetOptInc.h>
#endif
diff --git a/include/lldb/Host/HostInfo.h b/include/lldb/Host/HostInfo.h
new file mode 100644
index 000000000000..cbbf6cd2d49c
--- /dev/null
+++ b/include/lldb/Host/HostInfo.h
@@ -0,0 +1,61 @@
+//===-- HostInfoBase.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_Host_HostInfo_h_
+#define lldb_Host_HostInfo_h_
+
+//----------------------------------------------------------------------
+/// @class HostInfo HostInfo.h "lldb/Host/HostInfo.h"
+/// @brief A class that provides host computer information.
+///
+/// HostInfo is a class that answers information about the host operating
+/// system. Note that HostInfo is NOT intended to be used to manipulate or
+/// control the operating system.
+///
+/// HostInfo is implemented in an OS-specific class (for example
+/// HostInfoWindows) in a separate file, and then typedefed to HostInfo here.
+/// Users of the class reference it as HostInfo::method().
+///
+/// Not all hosts provide the same functionality. It is important that methods
+/// only be implemented at the lowest level at which they make sense. It should
+/// be up to the clients of the class to ensure that they not attempt to call a
+/// method which doesn't make sense for a particular platform. For example,
+/// when implementing a method that only makes sense on a posix-compliant
+/// system, implement it on HostInfoPosix, and not on HostInfoBase with a
+/// default implementation. This way, users of HostInfo are required to think
+/// about the implications of calling a particular method and if used in a
+/// context where the method doesn't make sense, will generate a compiler error.
+///
+//----------------------------------------------------------------------
+
+#if defined(_WIN32)
+#include "lldb/Host/windows/HostInfoWindows.h"
+#define HOST_INFO_TYPE HostInfoWindows
+#elif defined(__linux__)
+#include "lldb/Host/linux/HostInfoLinux.h"
+#define HOST_INFO_TYPE HostInfoLinux
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#include "lldb/Host/freebsd/HostInfoFreeBSD.h"
+#define HOST_INFO_TYPE HostInfoFreeBSD
+#elif defined(__APPLE__)
+#include "lldb/Host/macosx/HostInfoMacOSX.h"
+#define HOST_INFO_TYPE HostInfoMacOSX
+#else
+#include "lldb/Host/posix/HostInfoPosix.h"
+#define HOST_INFO_TYPE HostInfoPosix
+#endif
+
+namespace lldb_private
+{
+typedef HOST_INFO_TYPE HostInfo;
+}
+
+#undef HOST_INFO_TYPE
+
+#endif
diff --git a/include/lldb/Host/HostInfoBase.h b/include/lldb/Host/HostInfoBase.h
new file mode 100644
index 000000000000..f890dbc0b01b
--- /dev/null
+++ b/include/lldb/Host/HostInfoBase.h
@@ -0,0 +1,119 @@
+//===-- HostInfoBase.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_Host_HostInfoBase_h_
+#define lldb_Host_HostInfoBase_h_
+
+#include "lldb/Core/ArchSpec.h"
+#include "lldb/Host/FileSpec.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "llvm/ADT/StringRef.h"
+
+#include <stdint.h>
+
+#include <string>
+
+namespace lldb_private
+{
+
+class FileSpec;
+
+class HostInfoBase
+{
+ private:
+ // Static class, unconstructable.
+ HostInfoBase() {}
+ ~HostInfoBase() {}
+
+ public:
+ static void Initialize();
+
+ //------------------------------------------------------------------
+ /// Returns the number of CPUs on this current host.
+ ///
+ /// @return
+ /// Number of CPUs on this current host, or zero if the number
+ /// of CPUs can't be determined on this host.
+ //------------------------------------------------------------------
+ static uint32_t GetNumberCPUS();
+
+ //------------------------------------------------------------------
+ /// Gets the host vendor string.
+ ///
+ /// @return
+ /// A const string object containing the host vendor name.
+ //------------------------------------------------------------------
+ static llvm::StringRef GetVendorString();
+
+ //------------------------------------------------------------------
+ /// Gets the host Operating System (OS) string.
+ ///
+ /// @return
+ /// A const string object containing the host OS name.
+ //------------------------------------------------------------------
+ static llvm::StringRef GetOSString();
+
+ //------------------------------------------------------------------
+ /// Gets the host target triple as a const string.
+ ///
+ /// @return
+ /// A const string object containing the host target triple.
+ //------------------------------------------------------------------
+ static llvm::StringRef GetTargetTriple();
+
+ //------------------------------------------------------------------
+ /// Gets the host architecture.
+ ///
+ /// @return
+ /// A const architecture object that represents the host
+ /// architecture.
+ //------------------------------------------------------------------
+ enum ArchitectureKind
+ {
+ eArchKindDefault, // The overall default architecture that applications will run on this host
+ eArchKind32, // If this host supports 32 bit programs, return the default 32 bit arch
+ eArchKind64 // If this host supports 64 bit programs, return the default 64 bit arch
+ };
+
+ static const ArchSpec &GetArchitecture(ArchitectureKind arch_kind = eArchKindDefault);
+
+ //------------------------------------------------------------------
+ /// Find a resource files that are related to LLDB.
+ ///
+ /// Operating systems have different ways of storing shared
+ /// libraries and related resources. This function abstracts the
+ /// access to these paths.
+ ///
+ /// @param[in] path_type
+ /// The type of LLDB resource path you are looking for. If the
+ /// enumeration ends with "Dir", then only the \a file_spec's
+ /// directory member gets filled in.
+ ///
+ /// @param[in] file_spec
+ /// A file spec that gets filled in with the appropriate path.
+ ///
+ /// @return
+ /// \b true if \a resource_path was resolved, \a false otherwise.
+ //------------------------------------------------------------------
+ static bool GetLLDBPath(lldb::PathType type, FileSpec &file_spec);
+
+ protected:
+ static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
+ static bool ComputeSupportExeDirectory(FileSpec &file_spec);
+ static bool ComputeTempFileDirectory(FileSpec &file_spec);
+ static bool ComputeHeaderDirectory(FileSpec &file_spec);
+ static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
+ static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
+
+ static void ComputeHostArchitectureSupport(ArchSpec &arch_32, ArchSpec &arch_64);
+};
+}
+
+#endif
diff --git a/include/lldb/Host/HostProcess.h b/include/lldb/Host/HostProcess.h
new file mode 100644
index 000000000000..2c10709ce942
--- /dev/null
+++ b/include/lldb/Host/HostProcess.h
@@ -0,0 +1,44 @@
+//===-- HostProcess.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_Host_HostProcess_h_
+#define lldb_Host_HostProcess_h_
+
+//----------------------------------------------------------------------
+/// @class HostInfo HostInfo.h "lldb/Host/HostProcess.h"
+/// @brief A class that represents a running process on the host machine.
+///
+/// HostProcess allows querying and manipulation of processes running on the
+/// host machine. It is not intended to be represent a process which is
+/// being debugged, although the native debug engine of a platform may likely
+/// back inferior processes by a HostProcess.
+///
+/// HostProcess is implemented using static polymorphism so that on any given
+/// platform, an instance of HostProcess will always be able to bind statically
+/// to the concrete Process implementation for that platform. See HostInfo
+/// for more details.
+///
+//----------------------------------------------------------------------
+
+#if defined(_WIN32)
+#include "lldb/Host/windows/HostProcessWindows.h"
+#define HOST_PROCESS_TYPE HostProcessWindows
+#else
+#include "lldb/Host/posix/HostProcessPosix.h"
+#define HOST_PROCESS_TYPE HostProcessPosix
+#endif
+
+namespace lldb_private
+{
+ typedef HOST_PROCESS_TYPE HostProcess;
+}
+
+#undef HOST_PROCESS_TYPE
+
+#endif
diff --git a/include/lldb/Host/IOObject.h b/include/lldb/Host/IOObject.h
new file mode 100644
index 000000000000..532b1fd1bfce
--- /dev/null
+++ b/include/lldb/Host/IOObject.h
@@ -0,0 +1,61 @@
+//===-- IOObject.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_Common_IOObject_h_
+#define liblldb_Host_Common_IOObject_h_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class IOObject
+{
+public:
+ typedef enum
+ {
+ eFDTypeFile, // Other FD requiring read/write
+ eFDTypeSocket, // Socket requiring send/recv
+ } FDType;
+
+ // TODO: On Windows this should be a HANDLE, and wait should use
+ // WaitForMultipleObjects
+ typedef int WaitableHandle;
+ static const WaitableHandle kInvalidHandleValue;
+
+ IOObject(FDType type, bool should_close)
+ : m_fd_type(type)
+ , m_should_close_fd(should_close)
+ {
+ }
+ virtual ~IOObject() {}
+
+ virtual Error Read (void *buf, size_t &num_bytes) = 0;
+ virtual Error Write (const void *buf, size_t &num_bytes) = 0;
+ virtual bool IsValid() const = 0;
+ virtual Error Close() = 0;
+
+ FDType GetFdType() const { return m_fd_type; }
+
+ virtual WaitableHandle GetWaitableHandle() = 0;
+
+protected:
+ FDType m_fd_type;
+ bool m_should_close_fd; // True if this class should close the file descriptor when it goes away.
+
+private:
+ DISALLOW_COPY_AND_ASSIGN (IOObject);
+};
+
+}
+
+#endif
diff --git a/include/lldb/Host/OptionParser.h b/include/lldb/Host/OptionParser.h
index ca83eeb1ed77..5aa7db5d34bf 100644
--- a/include/lldb/Host/OptionParser.h
+++ b/include/lldb/Host/OptionParser.h
@@ -16,18 +16,17 @@ struct option;
namespace lldb_private {
-typedef struct Option
+struct OptionDefinition;
+
+struct Option
{
- // name of long option
- const char *name;
- // one of no_argument, required_argument, and optional_argument:
- // whether option takes an argument
- int has_arg;
+ // The definition of the option that this refers to.
+ const OptionDefinition *definition;
// if not NULL, set *flag to val when option found
int *flag;
// if flag not NULL, value to set *flag to; else return value
int val;
-} Option;
+};
class OptionParser
{
diff --git a/include/lldb/Host/Pipe.h b/include/lldb/Host/Pipe.h
new file mode 100644
index 000000000000..b36c85cfbe87
--- /dev/null
+++ b/include/lldb/Host/Pipe.h
@@ -0,0 +1,83 @@
+//===-- Pipe.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_Pipe_h_
+#define liblldb_Pipe_h_
+#if defined(__cplusplus)
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+//----------------------------------------------------------------------
+/// @class Pipe Pipe.h "lldb/Host/Pipe.h"
+/// @brief A class that abtracts unix style pipes.
+///
+/// A class that abstracts the LLDB core from host pipe functionality.
+//----------------------------------------------------------------------
+class Pipe
+{
+public:
+ static int kInvalidDescriptor;
+
+ Pipe();
+
+ ~Pipe();
+
+ bool
+ Open();
+
+ bool
+ IsValid() const;
+
+ bool
+ ReadDescriptorIsValid() const;
+
+ bool
+ WriteDescriptorIsValid() const;
+
+ int
+ GetReadFileDescriptor() const;
+
+ int
+ GetWriteFileDescriptor() const;
+
+ // Close both descriptors
+ void
+ Close();
+
+ bool
+ CloseReadFileDescriptor();
+
+ bool
+ CloseWriteFileDescriptor();
+
+ int
+ ReleaseReadFileDescriptor();
+
+ int
+ ReleaseWriteFileDescriptor();
+
+ size_t
+ Read (void *buf, size_t size);
+
+ size_t
+ Write (const void *buf, size_t size);
+private:
+ int m_fds[2];
+};
+
+} // namespace lldb_private
+
+#endif // #if defined(__cplusplus)
+#endif // liblldb_Pipe_h_
diff --git a/include/lldb/Host/Predicate.h b/include/lldb/Host/Predicate.h
index 6ddf20b67c69..f0e83ea5894b 100644
--- a/include/lldb/Host/Predicate.h
+++ b/include/lldb/Host/Predicate.h
@@ -78,7 +78,7 @@ public:
//------------------------------------------------------------------
/// Destructor.
///
- /// Destrory the condition, mutex, and T objects.
+ /// Destroy the condition, mutex, and T objects.
//------------------------------------------------------------------
~Predicate ()
{
@@ -112,7 +112,7 @@ public:
/// The new value to set.
///
/// @param[in] broadcast_type
- /// A value indicating when and if to broadast. See the
+ /// A value indicating when and if to broadcast. See the
/// PredicateBroadcastType enumeration for details.
///
/// @see Predicate::Broadcast()
@@ -140,7 +140,7 @@ public:
/// The bits to set in \a m_value.
///
/// @param[in] broadcast_type
- /// A value indicating when and if to broadast. See the
+ /// A value indicating when and if to broadcast. See the
/// PredicateBroadcastType enumeration for details.
///
/// @see Predicate::Broadcast()
@@ -168,7 +168,7 @@ public:
/// The bits to clear in \a m_value.
///
/// @param[in] broadcast_type
- /// A value indicating when and if to broadast. See the
+ /// A value indicating when and if to broadcast. See the
/// PredicateBroadcastType enumeration for details.
///
/// @see Predicate::Broadcast()
@@ -464,7 +464,7 @@ public:
protected:
//----------------------------------------------------------------------
- // pthread condition and mutex variable to controll access and allow
+ // pthread condition and mutex variable to control access and allow
// blocking between the main thread and the spotlight index thread.
//----------------------------------------------------------------------
T m_value; ///< The templatized value T that we are protecting access to
@@ -477,7 +477,7 @@ private:
/// Broadcast if needed.
///
/// Check to see if we need to broadcast to our condition variable
- /// depedning on the \a old_value and on the \a broadcast_type.
+ /// depending on the \a old_value and on the \a broadcast_type.
///
/// If \a broadcast_type is eBroadcastNever, no broadcast will be
/// sent.
diff --git a/include/lldb/Host/Socket.h b/include/lldb/Host/Socket.h
new file mode 100644
index 000000000000..0f3aa073001c
--- /dev/null
+++ b/include/lldb/Host/Socket.h
@@ -0,0 +1,103 @@
+//===-- Socket.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_Socket_h_
+#define liblldb_Host_Socket_h_
+
+#include <string>
+
+#include "lldb/lldb-private.h"
+
+#include "lldb/Core/Error.h"
+#include "lldb/Host/IOObject.h"
+#include "lldb/Host/Predicate.h"
+#include "lldb/Host/SocketAddress.h"
+
+#ifdef _WIN32
+#include "lldb/Host/windows/windows.h"
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#endif
+
+namespace llvm
+{
+ class StringRef;
+}
+
+namespace lldb_private {
+
+#if defined(_MSC_VER)
+ typedef SOCKET NativeSocket;
+#else
+ typedef int NativeSocket;
+#endif
+
+class Socket : public IOObject
+{
+public:
+ typedef enum
+ {
+ ProtocolTcp,
+ ProtocolUdp,
+ ProtocolUnixDomain
+ } SocketProtocol;
+
+ static const NativeSocket kInvalidSocketValue;
+
+ Socket(NativeSocket socket, SocketProtocol protocol, bool should_close);
+ ~Socket();
+
+ // 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, Socket *&socket, Predicate<uint16_t>* predicate);
+ static Error TcpConnect(llvm::StringRef host_and_port, Socket *&socket);
+ static Error UdpConnect(llvm::StringRef host_and_port, Socket *&send_socket, Socket *&recv_socket);
+ static Error UnixDomainConnect(llvm::StringRef host_and_port, Socket *&socket);
+ static Error UnixDomainAccept(llvm::StringRef host_and_port, Socket *&socket);
+
+ // Blocks on a listening socket until a connection is received. This method assumes that
+ // |this->m_socket| is a listening socket, created via either TcpListen() or via the native
+ // constructor that takes a NativeSocket, which itself was created via a call to |listen()|
+ Error BlockingAccept(llvm::StringRef host_and_port, Socket *&socket);
+
+ int GetOption (int level, int option_name, int &option_value);
+ int SetOption (int level, int option_name, int option_value);
+
+ static uint16_t GetPortNumber(const NativeSocket& socket);
+ uint16_t GetPortNumber () const;
+
+ NativeSocket GetNativeSocket () const { return m_socket; }
+ SocketProtocol GetSocketProtocol() const { return m_protocol; }
+
+ virtual Error Read (void *buf, size_t &num_bytes);
+ virtual Error Write (const void *buf, size_t &num_bytes);
+
+ virtual Error PreDisconnect();
+ virtual Error Close();
+
+ virtual bool IsValid() const { return m_socket != kInvalidSocketValue; }
+ virtual WaitableHandle GetWaitableHandle();
+
+protected:
+ static bool
+ DecodeHostAndPort (llvm::StringRef host_and_port,
+ std::string &host_str,
+ std::string &port_str,
+ int32_t& port,
+ Error *error_ptr);
+
+
+ SocketProtocol m_protocol;
+ NativeSocket m_socket;
+ SocketAddress m_udp_send_sockaddr; // Send address used for UDP connections.
+};
+}
+
+#endif
diff --git a/include/lldb/Host/SocketAddress.h b/include/lldb/Host/SocketAddress.h
index 4dc62102103a..3598a42a82d0 100644
--- a/include/lldb/Host/SocketAddress.h
+++ b/include/lldb/Host/SocketAddress.h
@@ -16,7 +16,7 @@
#ifdef _WIN32
#include "lldb/Host/windows/windows.h"
#include <winsock2.h>
-#include <WS2tcpip.h>
+#include <ws2tcpip.h>
typedef ADDRESS_FAMILY sa_family_t;
#else
#include <sys/socket.h>
@@ -82,7 +82,7 @@ public:
GetLength () const;
//------------------------------------------------------------------
- // Get the mex length for the the largest socket address supported.
+ // Get the max length for the largest socket address supported.
//------------------------------------------------------------------
static socklen_t
GetMaxLength ();
@@ -203,7 +203,7 @@ public:
// Conversion operators to allow getting the contents of this class
// as a pointer to the appropriate structure. This allows an instance
// of this class to be used in calls that take one of the sockaddr
- // structure variants without having to manally use the correct
+ // structure variants without having to manually use the correct
// accessor function.
//------------------------------------------------------------------
diff --git a/include/lldb/Host/Symbols.h b/include/lldb/Host/Symbols.h
index 652a614e6355..d6c86333d709 100644
--- a/include/lldb/Host/Symbols.h
+++ b/include/lldb/Host/Symbols.h
@@ -50,7 +50,7 @@ public:
// Locate the object and symbol file given a module specification.
//
// Locating the file can try to download the file from a corporate build
- // respository, or using any other means necessary to locate both the
+ // repository, or using any other means necessary to locate both the
// unstripped object file and the debug symbols.
// The force_lookup argument controls whether the external program is called
// unconditionally to find the symbol file, or if the user's settings are
diff --git a/include/lldb/Host/Terminal.h b/include/lldb/Host/Terminal.h
index 5ea88c515637..4a6017fc2eee 100644
--- a/include/lldb/Host/Terminal.h
+++ b/include/lldb/Host/Terminal.h
@@ -101,7 +101,7 @@ public:
///
/// @param[in] save_process_group
/// If \b true, save the process group settings, else do not
- /// save the process group setttings for a TTY.
+ /// save the process group settings for a TTY.
///
/// @return
/// Returns \b true if \a fd describes a TTY and if the state
diff --git a/include/lldb/Host/TimeValue.h b/include/lldb/Host/TimeValue.h
index ba230045307f..1792d343a6a6 100644
--- a/include/lldb/Host/TimeValue.h
+++ b/include/lldb/Host/TimeValue.h
@@ -15,11 +15,7 @@
#ifndef _MSC_VER
#include <sys/time.h>
-// BEGIN: MinGW work around
-#if !defined(_STRUCT_TIMESPEC) && !defined(HAVE_STRUCT_TIMESPEC)
-#include <pthread.h>
-#endif
-// END: MinGW work around
+
#endif
// C++ Includes
diff --git a/include/lldb/Host/freebsd/HostInfoFreeBSD.h b/include/lldb/Host/freebsd/HostInfoFreeBSD.h
new file mode 100644
index 000000000000..1404a4b1525c
--- /dev/null
+++ b/include/lldb/Host/freebsd/HostInfoFreeBSD.h
@@ -0,0 +1,29 @@
+//===-- HostInfoFreeBSD.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_Host_freebsd_HostInfoFreeBSD_h_
+#define lldb_Host_freebsd_HostInfoFreeBSD_h_
+
+#include "lldb/Host/FileSpec.h"
+#include "lldb/Host/posix/HostInfoPosix.h"
+
+namespace lldb_private
+{
+
+class HostInfoFreeBSD : public HostInfoPosix
+{
+ public:
+ static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
+ static bool GetOSBuildString(std::string &s);
+ static bool GetOSKernelDescription(std::string &s);
+ static FileSpec GetProgramFileSpec();
+};
+}
+
+#endif
diff --git a/include/lldb/Host/posix/HostInfoPosix.h b/include/lldb/Host/posix/HostInfoPosix.h
new file mode 100644
index 000000000000..6e0dcbe48021
--- /dev/null
+++ b/include/lldb/Host/posix/HostInfoPosix.h
@@ -0,0 +1,40 @@
+//===-- HostInfoPosix.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_Host_posix_HostInfoPosix_h_
+#define lldb_Host_posix_HostInfoPosix_h_
+
+#include "lldb/Host/HostInfoBase.h"
+
+namespace lldb_private
+{
+
+class HostInfoPosix : public HostInfoBase
+{
+ friend class HostInfoBase;
+
+ public:
+ static size_t GetPageSize();
+ static bool GetHostname(std::string &s);
+ static const char *LookupUserName(uint32_t uid, std::string &user_name);
+ static const char *LookupGroupName(uint32_t gid, std::string &group_name);
+
+ static uint32_t GetUserID();
+ static uint32_t GetGroupID();
+ static uint32_t GetEffectiveUserID();
+ static uint32_t GetEffectiveGroupID();
+
+ protected:
+ static bool ComputeSupportExeDirectory(FileSpec &file_spec);
+ static bool ComputeHeaderDirectory(FileSpec &file_spec);
+ static bool ComputePythonDirectory(FileSpec &file_spec);
+};
+}
+
+#endif
diff --git a/include/lldb/Host/posix/HostProcessPosix.h b/include/lldb/Host/posix/HostProcessPosix.h
new file mode 100644
index 000000000000..aa003ee4845e
--- /dev/null
+++ b/include/lldb/Host/posix/HostProcessPosix.h
@@ -0,0 +1,46 @@
+//===-- HostProcessPosix.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_Host_HostProcesPosix_h_
+#define lldb_Host_HostProcesPosix_h_
+
+#include "lldb/lldb-types.h"
+#include "lldb/Core/Error.h"
+#include "lldb/Target/ProcessLaunchInfo.h"
+
+namespace lldb_private
+{
+
+class FileSpec;
+
+class HostProcessPosix
+{
+ public:
+ static const lldb::pid_t kInvalidProcessId;
+
+ HostProcessPosix();
+ ~HostProcessPosix();
+
+ Error Signal(int signo) const;
+ static Error Signal(lldb::pid_t pid, int signo);
+
+ Error Create(lldb::pid_t pid);
+ Error Terminate(int signo);
+ Error GetMainModule(FileSpec &file_spec) const;
+
+ lldb::pid_t GetProcessId() const;
+ bool IsRunning() const;
+
+ private:
+
+ lldb::pid_t m_pid;
+};
+}
+
+#endif
diff --git a/include/lldb/Interpreter/Args.h b/include/lldb/Interpreter/Args.h
index 27feca63e4ad..06617f1e5926 100644
--- a/include/lldb/Interpreter/Args.h
+++ b/include/lldb/Interpreter/Args.h
@@ -293,7 +293,7 @@ public:
/// A copy \a arg_cstr will be made.
///
/// @param[in] arg_cstr
- /// The argument to push on the front the the argument stack.
+ /// The argument to push on the front of the argument stack.
///
/// @param[in] quote_char
/// If the argument was originally quoted, put in the quote char here.
@@ -308,7 +308,7 @@ public:
/// Parse the arguments in the contained arguments.
///
/// The arguments that are consumed by the argument parsing process
- /// will be removed from the argument vector. The arguements that
+ /// will be removed from the argument vector. The arguments that
/// get processed start at the second argument. The first argument
/// is assumed to be the command and will not be touched.
///
@@ -430,7 +430,7 @@ public:
EncodeEscapeSequences (const char *src, std::string &dst);
// ExpandEscapeSequences will change a string of possibly non-printable
- // characters and expand them into text. So '\n' will turn into two chracters
+ // characters and expand them into text. So '\n' will turn into two characters
// like "\n" which is suitable for human reading. When a character is not
// printable and isn't one of the common in escape sequences listed in the
// help for EncodeEscapeSequences, then it will be encoded as octal. Printable
diff --git a/include/lldb/Interpreter/CommandCompletions.h b/include/lldb/Interpreter/CommandCompletions.h
index c4ab1b61adeb..9df3041584ea 100644
--- a/include/lldb/Interpreter/CommandCompletions.h
+++ b/include/lldb/Interpreter/CommandCompletions.h
@@ -195,7 +195,7 @@ public:
};
//----------------------------------------------------------------------
- // SouceFileCompleter implements the source file completer
+ // SourceFileCompleter implements the source file completer
//----------------------------------------------------------------------
class SourceFileCompleter : public Completer
{
diff --git a/include/lldb/Interpreter/CommandInterpreter.h b/include/lldb/Interpreter/CommandInterpreter.h
index bcb9b5538c84..c33d71a6dbbb 100644
--- a/include/lldb/Interpreter/CommandInterpreter.h
+++ b/include/lldb/Interpreter/CommandInterpreter.h
@@ -252,7 +252,7 @@ public:
// This version just returns matches, and doesn't compute the substring. It is here so the
// Help command can call it for the first argument.
- // word_complete tells whether a the completions are considered a "complete" response (so the
+ // word_complete tells whether the completions are considered a "complete" response (so the
// completer should complete the quote & put a space after the word.
int
@@ -332,6 +332,9 @@ public:
void
Initialize ();
+
+ void
+ Clear ();
void
SetScriptLanguage (lldb::ScriptLanguage lang);
@@ -476,12 +479,15 @@ protected:
std::string &line);
virtual ConstString
- GetControlSequence (char ch)
+ IOHandlerGetControlSequence (char ch)
{
if (ch == 'd')
return ConstString("quit\n");
return ConstString();
}
+
+ virtual bool
+ IOHandlerInterrupt (IOHandler &io_handler);
size_t
GetProcessOutput ();
diff --git a/include/lldb/Interpreter/CommandObject.h b/include/lldb/Interpreter/CommandObject.h
index 8544fd9f9c3f..7bdf55a393d7 100644
--- a/include/lldb/Interpreter/CommandObject.h
+++ b/include/lldb/Interpreter/CommandObject.h
@@ -269,7 +269,7 @@ public:
//
// 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 availble from m_exe_ctx prior to executing the command. If a
+ // 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
@@ -460,25 +460,37 @@ public:
return NULL;
}
- CommandOverrideCallback
- GetOverrideCallback () const
+ bool
+ HasOverrideCallback () const
{
- return m_command_override_callback;
+ return m_command_override_callback || m_deprecated_command_override_callback;
}
- void *
- GetOverrideCallbackBaton () const
+ void
+ SetOverrideCallback (lldb::CommandOverrideCallback callback, void *baton)
{
- return m_command_override_baton;
+ m_deprecated_command_override_callback = callback;
+ m_command_override_baton = baton;
}
-
+
void
- SetOverrideCallback (CommandOverrideCallback callback, void *baton)
+ SetOverrideCallback (lldb::CommandOverrideCallbackWithResult callback, void *baton)
{
m_command_override_callback = callback;
m_command_override_baton = baton;
}
+ bool
+ InvokeOverrideCallback (const char **argv, CommandReturnObject &result)
+ {
+ if (m_command_override_callback)
+ return m_command_override_callback(m_command_override_baton, argv, result);
+ else if (m_deprecated_command_override_callback)
+ return m_deprecated_command_override_callback(m_command_override_baton, argv);
+ else
+ return false;
+ }
+
virtual bool
Execute (const char *args_string, CommandReturnObject &result) = 0;
@@ -540,7 +552,8 @@ protected:
bool m_is_alias;
Flags m_flags;
std::vector<CommandArgumentEntry> m_arguments;
- CommandOverrideCallback m_command_override_callback;
+ lldb::CommandOverrideCallback m_deprecated_command_override_callback;
+ lldb::CommandOverrideCallbackWithResult m_command_override_callback;
void * m_command_override_baton;
// Helper function to populate IDs or ID ranges as the command argument data
diff --git a/include/lldb/Interpreter/CommandOptionValidators.h b/include/lldb/Interpreter/CommandOptionValidators.h
new file mode 100644
index 000000000000..6be247ad4b65
--- /dev/null
+++ b/include/lldb/Interpreter/CommandOptionValidators.h
@@ -0,0 +1,30 @@
+//===-- CommandOptionValidators.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_CommandOptionValidators_h_
+#define liblldb_CommandOptionValidators_h_
+
+#include "lldb/lldb-private-types.h"
+
+namespace lldb_private {
+
+class Platform;
+class ExecutionContext;
+
+class PosixPlatformCommandOptionValidator : public OptionValidator
+{
+ virtual bool IsValid(Platform &platform, const ExecutionContext &target) const;
+ virtual const char* ShortConditionString() const;
+ virtual const char* LongConditionString() const;
+};
+
+} // namespace lldb_private
+
+
+#endif // liblldb_CommandOptionValidators_h_
diff --git a/include/lldb/Interpreter/CommandReturnObject.h b/include/lldb/Interpreter/CommandReturnObject.h
index acd03992e5e6..b922e1731d7e 100644
--- a/include/lldb/Interpreter/CommandReturnObject.h
+++ b/include/lldb/Interpreter/CommandReturnObject.h
@@ -160,9 +160,17 @@ public:
bool
HasResult ();
- bool GetDidChangeProcessState ();
+ bool
+ GetDidChangeProcessState ();
+
+ void
+ SetDidChangeProcessState (bool b);
- void SetDidChangeProcessState (bool b);
+ bool
+ GetInteractive () const;
+
+ void
+ SetInteractive (bool b);
private:
enum
@@ -176,6 +184,7 @@ private:
lldb::ReturnStatus m_status;
bool m_did_change_process_state;
+ bool m_interactive; // If true, then the input handle from the debugger will be hooked up
};
} // namespace lldb_private
diff --git a/include/lldb/Interpreter/Options.h b/include/lldb/Interpreter/Options.h
index 2b4ac1190557..6ecf08d28e75 100644
--- a/include/lldb/Interpreter/Options.h
+++ b/include/lldb/Interpreter/Options.h
@@ -159,7 +159,7 @@ public:
void
OutputFormattedUsageText (Stream &strm,
- const char *text,
+ const OptionDefinition &option_def,
uint32_t output_max_columns);
void
@@ -301,6 +301,12 @@ public:
int max_return_elements,
bool &word_complete,
StringList &matches);
+
+ CommandInterpreter&
+ GetInterpreter()
+ {
+ return m_interpreter;
+ }
protected:
// This is a set of options expressed as indexes into the options table for this Option.
diff --git a/include/lldb/Interpreter/PythonDataObjects.h b/include/lldb/Interpreter/PythonDataObjects.h
index 63f1ad5f67bf..a1145b6f33d9 100644
--- a/include/lldb/Interpreter/PythonDataObjects.h
+++ b/include/lldb/Interpreter/PythonDataObjects.h
@@ -62,9 +62,11 @@ namespace lldb_private {
{
if (py_obj != m_py_obj)
{
- Py_XDECREF(m_py_obj);
+ if (Py_IsInitialized())
+ Py_XDECREF(m_py_obj);
m_py_obj = py_obj;
- Py_XINCREF(m_py_obj);
+ if (Py_IsInitialized())
+ Py_XINCREF(m_py_obj);
}
return true;
}
diff --git a/include/lldb/Interpreter/ScriptInterpreter.h b/include/lldb/Interpreter/ScriptInterpreter.h
index 1d62c9b0fb52..5a8322f8eb4f 100644
--- a/include/lldb/Interpreter/ScriptInterpreter.h
+++ b/include/lldb/Interpreter/ScriptInterpreter.h
@@ -254,16 +254,20 @@ public:
return error;
}
- virtual bool
+ virtual Error
ExportFunctionDefinitionToInterpreter (StringList &function_def)
{
- return false;
+ Error error;
+ error.SetErrorString("not implemented");
+ return error;
}
- virtual bool
+ virtual Error
GenerateBreakpointCommandCallbackData (StringList &input, std::string& output)
{
- return false;
+ Error error;
+ error.SetErrorString("not implemented");
+ return error;
}
virtual bool
@@ -359,24 +363,44 @@ public:
return lldb::ScriptInterpreterObjectSP();
}
- virtual bool
+ virtual Error
GenerateFunction(const char *signature, const StringList &input)
{
- return false;
+ Error error;
+ error.SetErrorString("unimplemented");
+ return error;
}
virtual void
- CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options,
+ CollectDataForBreakpointCommandCallback (std::vector<BreakpointOptions *> &options,
CommandReturnObject &result);
virtual void
CollectDataForWatchpointCommandCallback (WatchpointOptions *wp_options,
CommandReturnObject &result);
+ /// Set the specified text as the callback for the breakpoint.
+ Error
+ SetBreakpointCommandCallback (std::vector<BreakpointOptions *> &bp_options_vec,
+ const char *callback_text);
+
+ virtual Error
+ SetBreakpointCommandCallback (BreakpointOptions *bp_options,
+ const char *callback_text)
+ {
+ Error error;
+ error.SetErrorString("unimplemented");
+ return error;
+ }
+
+ void
+ SetBreakpointCommandCallbackFunction (std::vector<BreakpointOptions *> &bp_options_vec,
+ const char *function_name);
+
/// Set a one-liner as the callback for the breakpoint.
virtual void
- SetBreakpointCommandCallback (BreakpointOptions *bp_options,
- const char *oneliner)
+ SetBreakpointCommandCallbackFunction (BreakpointOptions *bp_options,
+ const char *function_name)
{
return;
}
@@ -398,6 +422,12 @@ public:
return false;
}
+ virtual void
+ Clear ()
+ {
+ // Clean up any ref counts to SBObjects that might be in global variables
+ }
+
virtual size_t
CalculateNumChildren (const lldb::ScriptInterpreterObjectSP& implementor)
{
@@ -545,9 +575,6 @@ public:
SWIGPythonScriptKeyword_Frame swig_run_script_keyword_frame,
SWIGPython_GetDynamicSetting swig_plugin_get);
- static void
- TerminateInterpreter ();
-
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 ba532808673f..14a62d67fde6 100644
--- a/include/lldb/Interpreter/ScriptInterpreterPython.h
+++ b/include/lldb/Interpreter/ScriptInterpreterPython.h
@@ -24,6 +24,8 @@
#include "lldb/Interpreter/PythonDataObjects.h"
#include "lldb/Host/Terminal.h"
+class IOHandlerPythonInterpreter;
+
namespace lldb_private {
class ScriptInterpreterPython :
@@ -56,7 +58,7 @@ public:
ExecuteMultipleLines (const char *in_string,
const ExecuteScriptOptions &options = ExecuteScriptOptions());
- bool
+ Error
ExportFunctionDefinitionToInterpreter (StringList &function_def);
bool
@@ -130,10 +132,10 @@ public:
lldb_private::CommandReturnObject& cmd_retobj,
Error& error);
- bool
+ Error
GenerateFunction(const char *signature, const StringList &input);
- bool
+ Error
GenerateBreakpointCommandCallbackData (StringList &input, std::string& output);
bool
@@ -170,6 +172,9 @@ public:
lldb::ScriptInterpreterObjectSP& callee_wrapper_sp,
std::string& retval);
+ virtual void
+ Clear ();
+
virtual bool
GetDocumentationForItem (const char* item, std::string& dest);
@@ -220,17 +225,21 @@ public:
AcquireInterpreterLock ();
void
- CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options,
+ CollectDataForBreakpointCommandCallback (std::vector<BreakpointOptions *> &bp_options_vec,
CommandReturnObject &result);
void
CollectDataForWatchpointCommandCallback (WatchpointOptions *wp_options,
CommandReturnObject &result);
- /// Set a Python one-liner as the callback for the breakpoint.
- void
+ /// Set the callback body text into the callback for the breakpoint.
+ Error
SetBreakpointCommandCallback (BreakpointOptions *bp_options,
- const char *oneliner);
+ const char *callback_body);
+
+ void
+ SetBreakpointCommandCallbackFunction (BreakpointOptions *bp_options,
+ const char *function_name);
/// Set a one-liner as the callback for the watchpoint.
void
@@ -275,6 +284,19 @@ public:
}
+ PyThreadState *
+ GetThreadState()
+ {
+ return m_command_thread_state;
+ }
+
+ void
+ SetThreadState (PyThreadState *s)
+ {
+ if (s)
+ m_command_thread_state = s;
+ }
+
//----------------------------------------------------------------------
// IOHandlerDelegate
//----------------------------------------------------------------------
@@ -335,7 +357,8 @@ protected:
virtual
~ScriptInterpreterPythonObject()
{
- Py_XDECREF(m_object);
+ if (Py_IsInitialized())
+ Py_XDECREF(m_object);
m_object = NULL;
}
private:
@@ -392,7 +415,7 @@ public:
// FILE* m_tmp_fh;
PyGILState_STATE m_GILState;
};
-private:
+protected:
enum ActiveIOHandler {
eIOHandlerNone,
diff --git a/include/lldb/Symbol/Block.h b/include/lldb/Symbol/Block.h
index 4a305e3cbbec..59671b00b3b8 100644
--- a/include/lldb/Symbol/Block.h
+++ b/include/lldb/Symbol/Block.h
@@ -29,13 +29,13 @@ namespace lldb_private {
/// Block objects. The BlockList object contains a section offset
/// address range, and Block objects contain one or more ranges
/// which are offsets into that range. Blocks are can have discontiguous
-/// ranges within the BlockList adress range, and each block can
+/// ranges within the BlockList address range, and each block can
/// contain child blocks each with their own sets of ranges.
///
/// Each block has a variable list that represents local, argument, and
/// static variables that are scoped to the block.
///
-/// Inlined functions are representated by attaching a
+/// Inlined functions are represented by attaching a
/// InlineFunctionInfo shared pointer object to a block. Inlined
/// functions are represented as named blocks.
//----------------------------------------------------------------------
@@ -169,7 +169,7 @@ public:
/// Dump the block contents.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
///
/// @param[in] base_addr
/// The resolved start address of the Function's address
@@ -348,7 +348,7 @@ public:
/// Get const accessor for any inlined function information.
///
/// @return
- /// A comst pointer to any inlined function information, or NULL
+ /// A const pointer to any inlined function information, or NULL
/// if this is a regular block.
//------------------------------------------------------------------
const InlineFunctionInfo*
@@ -455,7 +455,7 @@ public:
GetRangeIndexContainingAddress (const Address& addr);
//------------------------------------------------------------------
- // Since blocks might have multiple discontiguous addresss ranges,
+ // Since blocks might have multiple discontiguous address ranges,
// we need to be able to get at any of the address ranges in a block.
//------------------------------------------------------------------
bool
@@ -477,7 +477,7 @@ protected:
collection m_children;
RangeList m_ranges;
lldb::InlineFunctionInfoSP m_inlineInfoSP; ///< Inlined function information.
- lldb::VariableListSP m_variable_list_sp; ///< The variable list for all local, static and paramter variables scoped to this block.
+ lldb::VariableListSP m_variable_list_sp; ///< The variable list for all local, static and parameter variables scoped to this block.
bool m_parsed_block_info:1, ///< Set to true if this block and it's children have all been parsed
m_parsed_block_variables:1,
m_parsed_child_blocks:1;
diff --git a/include/lldb/Symbol/ClangASTContext.h b/include/lldb/Symbol/ClangASTContext.h
index 75fc07b480e1..2bb911c6e566 100644
--- a/include/lldb/Symbol/ClangASTContext.h
+++ b/include/lldb/Symbol/ClangASTContext.h
@@ -18,7 +18,6 @@
#include <vector>
// Other libraries and framework includes
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallVector.h"
#include "clang/AST/TemplateBase.h"
@@ -44,6 +43,9 @@ public:
ClangASTContext (const char *triple = NULL);
~ClangASTContext();
+
+ static ClangASTContext*
+ GetASTContext (clang::ASTContext* ast_ctx);
clang::ASTContext *
getASTContext();
@@ -72,8 +74,7 @@ public:
clang::DiagnosticConsumer *
getDiagnosticConsumer();
- clang::TargetOptions *
- getTargetOptions();
+ std::shared_ptr<clang::TargetOptions> &getTargetOptions();
clang::TargetInfo *
getTargetInfo();
@@ -94,7 +95,7 @@ public:
HasExternalSource ();
void
- SetExternalSource (llvm::OwningPtr<clang::ExternalASTSource> &ast_source_ap);
+ SetExternalSource (llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> &ast_source_ap);
void
RemoveExternalSource ();
@@ -259,8 +260,8 @@ public:
return 0;
}
- llvm::SmallVector<const char *, 8> names;
- llvm::SmallVector<clang::TemplateArgument, 8> args;
+ llvm::SmallVector<const char *, 2> names;
+ llvm::SmallVector<clang::TemplateArgument, 2> args;
};
clang::FunctionTemplateDecl *
@@ -395,6 +396,29 @@ public:
const ClangASTType &integer_qual_type);
//------------------------------------------------------------------
+ // Integer type functions
+ //------------------------------------------------------------------
+
+ ClangASTType
+ GetIntTypeFromBitSize (size_t bit_size, bool is_signed)
+ {
+ return GetIntTypeFromBitSize (getASTContext(), bit_size, is_signed);
+ }
+
+ static ClangASTType
+ GetIntTypeFromBitSize (clang::ASTContext *ast,
+ size_t bit_size, bool is_signed);
+
+ ClangASTType
+ GetPointerSizedIntType (bool is_signed)
+ {
+ return GetPointerSizedIntType (getASTContext(), is_signed);
+ }
+
+ static ClangASTType
+ GetPointerSizedIntType (clang::ASTContext *ast, bool is_signed);
+
+ //------------------------------------------------------------------
// Floating point functions
//------------------------------------------------------------------
@@ -419,7 +443,7 @@ protected:
std::unique_ptr<clang::SourceManager> m_source_manager_ap;
std::unique_ptr<clang::DiagnosticsEngine> m_diagnostics_engine_ap;
std::unique_ptr<clang::DiagnosticConsumer> m_diagnostic_consumer_ap;
- llvm::IntrusiveRefCntPtr<clang::TargetOptions> m_target_options_rp;
+ std::shared_ptr<clang::TargetOptions> m_target_options_rp;
std::unique_ptr<clang::TargetInfo> m_target_info_ap;
std::unique_ptr<clang::IdentifierTable> m_identifier_table_ap;
std::unique_ptr<clang::SelectorTable> m_selector_table_ap;
diff --git a/include/lldb/Symbol/ClangASTImporter.h b/include/lldb/Symbol/ClangASTImporter.h
index dc6ce6b5b95b..ee4fcada8a6d 100644
--- a/include/lldb/Symbol/ClangASTImporter.h
+++ b/include/lldb/Symbol/ClangASTImporter.h
@@ -166,7 +166,7 @@ public:
void BuildNamespaceMap (const clang::NamespaceDecl *decl);
//
- // Comleters for maps
+ // Completers for maps
//
class MapCompleter
diff --git a/include/lldb/Symbol/ClangASTType.h b/include/lldb/Symbol/ClangASTType.h
index 19b5d6ec6727..4dd17031e568 100644
--- a/include/lldb/Symbol/ClangASTType.h
+++ b/include/lldb/Symbol/ClangASTType.h
@@ -155,6 +155,9 @@ public:
bool
IsFunctionType (bool *is_variadic_ptr = NULL) const;
+ uint32_t
+ IsHomogeneousAggregate (ClangASTType* base_type_ptr) const;
+
size_t
GetNumberOfFunctionArguments () const;
@@ -210,7 +213,7 @@ public:
IsPointerOrReferenceType (ClangASTType *pointee_type = NULL) const;
bool
- IsReferenceType (ClangASTType *pointee_type = NULL) const;
+ IsReferenceType (ClangASTType *pointee_type = nullptr, bool* is_rvalue = nullptr) const;
bool
IsScalarType () const;
@@ -261,6 +264,9 @@ public:
ConstString
GetTypeName () const;
+ ConstString
+ GetDisplayTypeName () const;
+
uint32_t
GetTypeInfo (ClangASTType *pointee_or_element_clang_type = NULL) const;
@@ -309,7 +315,7 @@ public:
clang::DeclContext *decl_ctx) const;
ClangASTType
- GetArrayElementType (uint64_t& stride) const;
+ GetArrayElementType (uint64_t *stride = nullptr) const;
ClangASTType
GetCanonicalType () const;
@@ -317,7 +323,7 @@ public:
ClangASTType
GetFullyUnqualifiedType () const;
- // Returns -1 if this isn't a function of if the fucntion doesn't have a prototype
+ // Returns -1 if this isn't a function of if the function doesn't have a prototype
// Returns a value >= 0 if there is a prototype.
int
GetFunctionArgumentCount () const;
@@ -420,7 +426,6 @@ public:
ClangASTType
GetChildClangTypeAtIndex (ExecutionContext *exe_ctx,
- const char *parent_name,
size_t idx,
bool transparent_pointers,
bool omit_empty_base_classes,
@@ -431,7 +436,8 @@ public:
uint32_t &child_bitfield_bit_size,
uint32_t &child_bitfield_bit_offset,
bool &child_is_base_class,
- bool &child_is_deref_of_parent) const;
+ bool &child_is_deref_of_parent,
+ ValueObject *valobj) const;
// Lookup a child given a name. This function will match base class names
// and member member names in "clang_type" only, not descendants.
@@ -641,6 +647,9 @@ public:
AddressType address_type,
StreamString &new_value);
+ clang::EnumDecl *
+ GetAsEnumDecl () const;
+
clang::RecordDecl *
GetAsRecordDecl () const;
diff --git a/include/lldb/Symbol/ClangExternalASTSourceCommon.h b/include/lldb/Symbol/ClangExternalASTSourceCommon.h
index 72d77e74ca90..20c4b4354367 100644
--- a/include/lldb/Symbol/ClangExternalASTSourceCommon.h
+++ b/include/lldb/Symbol/ClangExternalASTSourceCommon.h
@@ -11,7 +11,7 @@
#define liblldb_ClangExternalASTSourceCommon_h
// Clang headers like to use NDEBUG inside of them to enable/disable debug
-// releated features using "#ifndef NDEBUG" preprocessor blocks to do one thing
+// related features using "#ifndef NDEBUG" preprocessor blocks to do one thing
// or another. This is bad because it means that if clang was built in release
// mode, it assumes that you are building in release mode which is not always
// the case. You can end up with functions that are defined as empty in header
diff --git a/include/lldb/Symbol/CompileUnit.h b/include/lldb/Symbol/CompileUnit.h
index 5de93670c5a7..f9238ebba18c 100644
--- a/include/lldb/Symbol/CompileUnit.h
+++ b/include/lldb/Symbol/CompileUnit.h
@@ -115,7 +115,7 @@ public:
/// parse the debug information.
///
/// @param[in] function_sp
- /// A shared pointer to the a Function object.
+ /// A shared pointer to the Function object.
//------------------------------------------------------------------
void
AddFunction(lldb::FunctionSP& function_sp);
@@ -178,7 +178,7 @@ public:
/// Dump the compile unit contents to the stream \a s.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
///
/// @param[in] show_context
/// If \b true, variables will dump their symbol context
@@ -199,7 +199,7 @@ public:
///
/// Multiple calls to this function can find all entries that match
/// a given file and line by starting with \a start_idx equal to zero,
- /// and calling this function back with the return valeu + 1.
+ /// and calling this function back with the return value + 1.
///
/// @param[in] start_idx
/// The zero based index at which to start looking for matches.
@@ -377,7 +377,7 @@ public:
/// using a LineEntry base address will be able to be resolved.
///
/// @param[out] sc_list
- /// A SymbolContext list class that willl get any matching
+ /// A SymbolContext list class that will get any matching
/// entries appended to.
///
/// @return
diff --git a/include/lldb/Symbol/DWARFCallFrameInfo.h b/include/lldb/Symbol/DWARFCallFrameInfo.h
index 13a14f8c4041..e67a5a2a8e2c 100644
--- a/include/lldb/Symbol/DWARFCallFrameInfo.h
+++ b/include/lldb/Symbol/DWARFCallFrameInfo.h
@@ -100,7 +100,7 @@ private:
typedef std::shared_ptr<CIE> CIESP;
- typedef std::map<off_t, CIESP> cie_map_t;
+ typedef std::map<dw_offset_t, CIESP> cie_map_t;
// Start address (file address), size, offset of FDE location
// used for finding an FDE for a given File address; the start address field is
diff --git a/include/lldb/Symbol/Declaration.h b/include/lldb/Symbol/Declaration.h
index f014571595f0..73dede556eae 100644
--- a/include/lldb/Symbol/Declaration.h
+++ b/include/lldb/Symbol/Declaration.h
@@ -136,7 +136,7 @@ public:
/// supplied stream \a s.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
//------------------------------------------------------------------
void
Dump (Stream *s, bool show_fullpaths) const;
@@ -236,7 +236,7 @@ public:
/// Set accessor for the declaration file specification.
///
/// @param[in] file_spec
- /// The new declaration file specifciation.
+ /// The new declaration file specification.
//------------------------------------------------------------------
void
SetFile (const FileSpec& file_spec)
diff --git a/include/lldb/Symbol/FuncUnwinders.h b/include/lldb/Symbol/FuncUnwinders.h
index 7af063402289..0cf584239f95 100644
--- a/include/lldb/Symbol/FuncUnwinders.h
+++ b/include/lldb/Symbol/FuncUnwinders.h
@@ -21,7 +21,7 @@ public:
// This is often sourced from the eh_frame exception handling info
// 2. Unwinding from a non-call site (any location in the function)
// This is often done by analyzing the function prologue assembly
- // langauge instructions
+ // language instructions
// 3. A fast unwind method for this function which only retrieves a
// limited set of registers necessary to walk the stack
// 4. An architectural default unwind plan when none of the above are
@@ -31,7 +31,7 @@ public:
// instructions are finished for migrating breakpoints past the
// stack frame setup instructions when we don't have line table information.
- FuncUnwinders (lldb_private::UnwindTable& unwind_table, const lldb::UnwindAssemblySP& assembly_profiler, AddressRange range);
+ FuncUnwinders (lldb_private::UnwindTable& unwind_table, AddressRange range);
~FuncUnwinders ();
@@ -44,7 +44,7 @@ public:
GetUnwindPlanAtCallSite (int current_offset);
lldb::UnwindPlanSP
- GetUnwindPlanAtNonCallSite (lldb_private::Thread& thread);
+ GetUnwindPlanAtNonCallSite (Target& target, lldb_private::Thread& thread, int current_offset);
lldb::UnwindPlanSP
GetUnwindPlanFastUnwind (lldb_private::Thread& Thread);
@@ -76,8 +76,11 @@ public:
InvalidateNonCallSiteUnwindPlan (lldb_private::Thread& Thread);
private:
+
+ lldb::UnwindAssemblySP
+ GetUnwindAssemblyProfiler ();
+
UnwindTable& m_unwind_table;
- lldb::UnwindAssemblySP m_assembly_profiler;
AddressRange m_range;
Mutex m_mutex;
diff --git a/include/lldb/Symbol/Function.h b/include/lldb/Symbol/Function.h
index dcea24c0b632..5954cf520d70 100644
--- a/include/lldb/Symbol/Function.h
+++ b/include/lldb/Symbol/Function.h
@@ -24,7 +24,7 @@ namespace lldb_private {
/// @class FunctionInfo Function.h "lldb/Symbol/Function.h"
/// @brief A class that contains generic function information.
///
-/// This provides generic function information that gets resused between
+/// This provides generic function information that gets reused between
/// inline functions and function types.
//----------------------------------------------------------------------
class FunctionInfo
@@ -94,7 +94,7 @@ public:
/// supplied stream \a s.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
//------------------------------------------------------------------
void
Dump (Stream *s, bool show_fullpaths) const;
@@ -234,7 +234,7 @@ public:
/// supplied stream \a s.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
//------------------------------------------------------------------
void
Dump(Stream *s, bool show_fullpaths) const;
@@ -316,14 +316,14 @@ private:
/// (Function::m_type), and contains lexical blocks
/// (Function::m_blocks).
///
-/// The function inforation is split into a few pieces:
+/// The function information is split into a few pieces:
/// @li The concrete instance information
/// @li The abstract information
///
/// The abstract information is found in the function type (Type) that
/// describes a function information, return type and parameter types.
///
-/// The concreate information is the address range information and
+/// The concrete information is the address range information and
/// specific locations for an instance of this function.
//----------------------------------------------------------------------
class Function :
@@ -547,7 +547,7 @@ public:
//------------------------------------------------------------------
/// Get accessor for the type that describes the function
- /// return value type, and paramter types.
+ /// return value type, and parameter types.
///
/// @return
/// A type object pointer.
@@ -557,7 +557,7 @@ public:
//------------------------------------------------------------------
/// Get const accessor for the type that describes the function
- /// return value type, and paramter types.
+ /// return value type, and parameter types.
///
/// @return
/// A const type object pointer.
@@ -578,7 +578,7 @@ public:
/// supplied stream \a s.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
///
/// @param[in] show_context
/// If \b true, variables will dump their symbol context
diff --git a/include/lldb/Symbol/LineEntry.h b/include/lldb/Symbol/LineEntry.h
index d7750cd34916..082caea3b12f 100644
--- a/include/lldb/Symbol/LineEntry.h
+++ b/include/lldb/Symbol/LineEntry.h
@@ -59,7 +59,7 @@ struct LineEntry
/// supplied stream \a s.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
///
/// @param[in] comp_unit
/// The compile unit object that contains the support file
@@ -98,7 +98,7 @@ struct LineEntry
/// line entry to the supplied stream \a s.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
///
/// @param[in] comp_unit
/// The compile unit object that contains the support file
diff --git a/include/lldb/Symbol/LineTable.h b/include/lldb/Symbol/LineTable.h
index 477c8455ded8..3e25ad17e94e 100644
--- a/include/lldb/Symbol/LineTable.h
+++ b/include/lldb/Symbol/LineTable.h
@@ -85,7 +85,7 @@ public:
bool is_epilogue_begin,
bool is_terminal_entry);
- // Used to instantiate the LineSequence helper classw
+ // Used to instantiate the LineSequence helper class
LineSequence*
CreateLineSequenceContainer ();
@@ -111,7 +111,7 @@ public:
/// Dump all line entries in this line table to the stream \a s.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
///
/// @param[in] style
/// The display style for the address.
diff --git a/include/lldb/Symbol/ObjectContainer.h b/include/lldb/Symbol/ObjectContainer.h
index 7fb686245057..679e8f03b67a 100644
--- a/include/lldb/Symbol/ObjectContainer.h
+++ b/include/lldb/Symbol/ObjectContainer.h
@@ -85,7 +85,7 @@ public:
/// if it has been parsed.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
//------------------------------------------------------------------
virtual void
Dump (Stream *s) const = 0;
@@ -168,7 +168,7 @@ public:
/// and the next plug-in can attempt to parse an object file.
///
/// @return
- /// Returns \b true if the header was parsed succesfully, \b
+ /// Returns \b true if the header was parsed successfully, \b
/// false otherwise.
//------------------------------------------------------------------
virtual bool
diff --git a/include/lldb/Symbol/ObjectFile.h b/include/lldb/Symbol/ObjectFile.h
index afa1f9b40902..bdc6ae8c9e81 100644
--- a/include/lldb/Symbol/ObjectFile.h
+++ b/include/lldb/Symbol/ObjectFile.h
@@ -21,6 +21,36 @@
#include "lldb/Symbol/UnwindTable.h"
namespace lldb_private {
+
+class ObjectFileJITDelegate
+{
+public:
+ ObjectFileJITDelegate ()
+ {
+ }
+
+ virtual
+ ~ObjectFileJITDelegate()
+ {
+ }
+
+ virtual lldb::ByteOrder
+ GetByteOrder () const = 0;
+
+ virtual uint32_t
+ GetAddressByteSize () const = 0;
+
+ virtual void
+ PopulateSymtab (lldb_private::ObjectFile *obj_file,
+ lldb_private::Symtab &symtab) = 0;
+
+ virtual void
+ PopulateSectionList (lldb_private::ObjectFile *obj_file,
+ lldb_private::SectionList &section_list) = 0;
+
+ virtual bool
+ GetArchitecture (lldb_private::ArchSpec &arch) = 0;
+};
//----------------------------------------------------------------------
/// @class ObjectFile ObjectFile.h "lldb/Symbol/ObjectFile.h"
@@ -32,23 +62,11 @@ namespace lldb_private {
/// for an object file.
///
/// Object files can be represented by the entire file, or by part of a
-/// file. Examples of object files that are part of a file include
-/// object files that contain information for multiple architectures in
-/// the same file, or archive files that contain multiple objects
-/// (ranlib archives) (possibly for multiple architectures as well).
+/// file. An example of a partial file ObjectFile is one that contains
+/// information for one of multiple architectures in the same file.
///
-/// Object archive files (e.g. ranlib archives) can contain
-/// multiple .o (object) files that must be selected by index or by name.
-/// The number of objects that an ObjectFile contains can be determined
-/// using the ObjectFile::GetNumObjects() const
-/// function, and followed by a call to
-/// ObjectFile::SelectObjectAtIndex (uint32_t) to change the currently
-/// selected object. Objects can also be selected by name using the
-/// ObjectFile::SelectObject(const char *) function.
-///
-/// Once an architecture is selected (and an object is selected for
-/// for archives), the object file information can be extracted from
-/// this abstract class.
+/// Once an architecture is selected the object file information can be
+/// extracted from this abstract class.
//----------------------------------------------------------------------
class ObjectFile:
public std::enable_shared_from_this<ObjectFile>,
@@ -68,6 +86,7 @@ public:
eTypeObjectFile, /// An intermediate object file
eTypeSharedLibrary, /// A shared library that can be used during execution
eTypeStubLibrary, /// A library that can be linked against but not used for execution
+ eTypeJIT, /// JIT code that has symbols, sections and possibly debug info
eTypeUnknown
} Type;
@@ -77,7 +96,8 @@ public:
eStrataUnknown,
eStrataUser,
eStrataKernel,
- eStrataRawImage
+ eStrataRawImage,
+ eStrataJIT
} Strata;
//------------------------------------------------------------------
@@ -91,7 +111,7 @@ public:
const FileSpec *file_spec_ptr,
lldb::offset_t file_offset,
lldb::offset_t length,
- lldb::DataBufferSP& data_sp,
+ const lldb::DataBufferSP& data_sp,
lldb::offset_t data_offset);
ObjectFile (const lldb::ModuleSP &module_sp,
@@ -117,7 +137,7 @@ public:
/// if it has been parsed.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
//------------------------------------------------------------------
virtual void
Dump (Stream *s) = 0;
@@ -354,6 +374,16 @@ public:
virtual void
CreateSections (SectionList &unified_section_list) = 0;
+
+ //------------------------------------------------------------------
+ /// Notify the ObjectFile that the file addresses in the Sections
+ /// for this module have been changed.
+ //------------------------------------------------------------------
+ virtual void
+ SectionFileAddressesChanged ()
+ {
+ }
+
//------------------------------------------------------------------
/// Gets the symbol table for the currently selected architecture
/// (and object for archives).
@@ -439,7 +469,7 @@ public:
/// Gets the symbol file spec list for this object file.
///
/// If the object file format contains a debug symbol file link,
- /// the values will be return in the FileSpecList.
+ /// the values will be returned in the FileSpecList.
///
/// @return
/// Returns filespeclist.
@@ -451,6 +481,21 @@ public:
}
//------------------------------------------------------------------
+ /// Gets the file spec list of libraries re-exported by this object file.
+ ///
+ /// If the object file format has the notion of one library re-exporting the symbols from another,
+ /// the re-exported libraries will be returned in the FileSpecList.
+ ///
+ /// @return
+ /// Returns filespeclist.
+ //------------------------------------------------------------------
+ virtual lldb_private::FileSpecList
+ GetReExportedLibraries ()
+ {
+ return FileSpecList();
+ }
+
+ //------------------------------------------------------------------
/// Sets the load address for an entire module, assuming a rigid
/// slide of sections, if possible in the implementation.
///
@@ -486,7 +531,7 @@ public:
/// and the next plug-in can attempt to parse an object file.
///
/// @return
- /// Returns \b true if the header was parsed succesfully, \b
+ /// Returns \b true if the header was parsed successfully, \b
/// false otherwise.
//------------------------------------------------------------------
virtual bool
@@ -751,17 +796,17 @@ public:
size_t byte_size);
size_t
- GetData (off_t offset, size_t length, DataExtractor &data) const;
+ GetData (lldb::offset_t offset, size_t length, DataExtractor &data) const;
size_t
- CopyData (off_t offset, size_t length, void *dst) const;
+ CopyData (lldb::offset_t offset, size_t length, void *dst) const;
- size_t
+ virtual size_t
ReadSectionData (const Section *section,
- off_t section_offset,
+ lldb::offset_t section_offset,
void *dst,
size_t dst_len) const;
- size_t
+ virtual size_t
ReadSectionData (const Section *section,
DataExtractor& section_data) const;
diff --git a/include/lldb/Symbol/Symbol.h b/include/lldb/Symbol/Symbol.h
index db32ba373e42..0dd04b7112bc 100644
--- a/include/lldb/Symbol/Symbol.h
+++ b/include/lldb/Symbol/Symbol.h
@@ -92,6 +92,9 @@ public:
return m_addr_range.GetBaseAddress();
}
+ lldb::addr_t
+ ResolveCallableAddress(Target &target) const;
+
const ConstString &
GetName () const
{
@@ -135,7 +138,7 @@ public:
SetReExportedSymbolSharedLibrary (const FileSpec &fspec);
Symbol *
- ResolveReExportedSymbol (Target &target);
+ ResolveReExportedSymbol (Target &target) const;
uint32_t
GetSiblingIndex () const;
@@ -303,7 +306,15 @@ public:
Stream &strm);
protected:
-
+ // This is the internal guts of ResolveReExportedSymbol, it assumes reexport_name is not null, and that module_spec
+ // is valid. We track the modules we've already seen to make sure we don't get caught in a cycle.
+
+ Symbol *
+ ResolveReExportedSymbolInModuleSpec (Target &target,
+ ConstString &reexport_name,
+ lldb_private::ModuleSpec &module_spec,
+ lldb_private::ModuleList &seen_modules) const;
+
uint32_t m_uid; // User ID (usually the original symbol table index)
uint16_t m_type_data; // data specific to m_type
uint16_t m_type_data_resolved:1, // True if the data in m_type_data has already been calculated
diff --git a/include/lldb/Symbol/SymbolContext.h b/include/lldb/Symbol/SymbolContext.h
index 6fdd828bd9f2..c26b7a0b9a10 100644
--- a/include/lldb/Symbol/SymbolContext.h
+++ b/include/lldb/Symbol/SymbolContext.h
@@ -140,7 +140,7 @@ public:
/// supplied stream \a s.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
//------------------------------------------------------------------
void
Dump (Stream *s, Target *target) const;
@@ -157,7 +157,7 @@ public:
/// was stopped will be displayed.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
///
/// @param[in] so_addr
/// The resolved section offset address.
@@ -409,7 +409,7 @@ private:
/// the result of a query that can contain a multiple results. Examples
/// of such queries include:
/// @li Looking up a function by name.
-/// @li Finding all addressses for a specified file and line number.
+/// @li Finding all addresses for a specified file and line number.
//----------------------------------------------------------------------
class SymbolContextList
{
@@ -465,7 +465,7 @@ public:
/// the list to the supplied stream \a s.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
//------------------------------------------------------------------
void
Dump(Stream *s, Target *target) const;
diff --git a/include/lldb/Symbol/SymbolContextScope.h b/include/lldb/Symbol/SymbolContextScope.h
index 693cc0131e27..a02b4523a4c0 100644
--- a/include/lldb/Symbol/SymbolContextScope.h
+++ b/include/lldb/Symbol/SymbolContextScope.h
@@ -75,7 +75,7 @@ public:
~SymbolContextScope () {}
//------------------------------------------------------------------
- /// Reconstruct the object's symbolc context into \a sc.
+ /// Reconstruct the object's symbol context into \a sc.
///
/// The object should fill in as much of the SymbolContext as it
/// can so function calls that require a symbol context can be made
@@ -119,11 +119,11 @@ public:
}
//------------------------------------------------------------------
- /// Dump the object's symbolc context to the stream \a s.
+ /// Dump the object's symbol context to the stream \a s.
///
/// The object should dump its symbol context to the stream \a s.
/// This function is widely used in the DumpDebug and verbose output
- /// for lldb objets.
+ /// for lldb objects.
///
/// @param[in] s
/// The stream to which to dump the object's symbol context.
diff --git a/include/lldb/Symbol/SymbolFile.h b/include/lldb/Symbol/SymbolFile.h
index 5b774e3a7d13..6df3d49fc464 100644
--- a/include/lldb/Symbol/SymbolFile.h
+++ b/include/lldb/Symbol/SymbolFile.h
@@ -67,7 +67,7 @@ public:
/// Each symbol file gets to respond with a mask of abilities that
/// it supports for each object file. This happens when we are
/// trying to figure out which symbol file plug-in will get used
- /// for a given object file. The plug-in that resoonds with the
+ /// for a given object file. The plug-in that responds with the
/// best mix of "SymbolFile::Abilities" bits set, will get chosen to
/// be the symbol file parser. This allows each plug-in to check for
/// sections that contain data a symbol file plug-in would need. For
@@ -152,6 +152,16 @@ public:
ObjectFile* GetObjectFile() { return m_obj_file; }
const ObjectFile* GetObjectFile() const { return m_obj_file; }
+
+ //------------------------------------------------------------------
+ /// Notify the SymbolFile that the file addresses in the Sections
+ /// for this module have been changed.
+ //------------------------------------------------------------------
+ virtual void
+ SectionFileAddressesChanged ()
+ {
+ }
+
protected:
ObjectFile* m_obj_file; // The object file that symbols can be extracted from.
diff --git a/include/lldb/Symbol/SymbolVendor.h b/include/lldb/Symbol/SymbolVendor.h
index 0eeea4eb466b..82f902d4e07b 100644
--- a/include/lldb/Symbol/SymbolVendor.h
+++ b/include/lldb/Symbol/SymbolVendor.h
@@ -173,6 +173,13 @@ public:
ClearSymtab ();
//------------------------------------------------------------------
+ /// Notify the SymbolVendor that the file addresses in the Sections
+ /// for this module have been changed.
+ //------------------------------------------------------------------
+ virtual void
+ SectionFileAddressesChanged ();
+
+ //------------------------------------------------------------------
// PluginInterface protocol
//------------------------------------------------------------------
virtual ConstString
diff --git a/include/lldb/Symbol/Symtab.h b/include/lldb/Symbol/Symtab.h
index 5dfb1c822d51..dc08333e22fb 100644
--- a/include/lldb/Symbol/Symtab.h
+++ b/include/lldb/Symbol/Symtab.h
@@ -46,6 +46,7 @@ public:
Symbol * Resize (size_t count);
uint32_t AddSymbol(const Symbol& symbol);
size_t GetNumSymbols() const;
+ void SectionFileAddressesChanged ();
void Dump(Stream *s, Target *target, SortOrder sort_type);
void Dump(Stream *s, Target *target, std::vector<uint32_t>& indexes) const;
uint32_t GetIndexForSymbol (const Symbol *symbol) const;
diff --git a/include/lldb/Symbol/Type.h b/include/lldb/Symbol/Type.h
index da327439936c..eaa150e78ace 100644
--- a/include/lldb/Symbol/Type.h
+++ b/include/lldb/Symbol/Type.h
@@ -17,6 +17,8 @@
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/Declaration.h"
+#include "llvm/ADT/APSInt.h"
+
#include <set>
namespace lldb_private {
@@ -103,6 +105,11 @@ public:
void
DumpTypeName(Stream *s);
+ // Since Type instances only keep a "SymbolFile *" internally, other classes
+ // like TypeImpl need make sure the module is still around before playing with
+ // Type instances. They can store a weak pointer to the Module;
+ lldb::ModuleSP
+ GetModule();
void
GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_name);
@@ -306,16 +313,18 @@ protected:
// these classes are used to back the SBType* objects
-class TypePair {
-private:
- ClangASTType clang_type;
- lldb::TypeSP type_sp;
-
+class TypePair
+{
public:
- TypePair () : clang_type(), type_sp() {}
+ TypePair () :
+ clang_type(),
+ type_sp()
+ {
+ }
+
TypePair (ClangASTType type) :
- clang_type(type),
- type_sp()
+ clang_type(type),
+ type_sp()
{
}
@@ -368,6 +377,16 @@ public:
return ConstString ();
}
+ ConstString
+ GetDisplayTypeName () const
+ {
+ if (type_sp)
+ return type_sp->GetClangForwardType().GetDisplayTypeName();
+ if (clang_type)
+ return clang_type.GetDisplayTypeName();
+ return ConstString();
+ }
+
void
SetType (ClangASTType type)
{
@@ -455,6 +474,17 @@ public:
{
return clang_type.GetASTContext();
}
+
+ lldb::ModuleSP
+ GetModule () const
+ {
+ if (type_sp)
+ return type_sp->GetModule();
+ return lldb::ModuleSP();
+ }
+protected:
+ ClangASTType clang_type;
+ lldb::TypeSP type_sp;
};
class TypeImpl
@@ -467,30 +497,30 @@ public:
TypeImpl(const TypeImpl& rhs);
- TypeImpl (lldb::TypeSP type_sp);
+ TypeImpl (const lldb::TypeSP &type_sp);
- TypeImpl (ClangASTType clang_type);
+ TypeImpl (const ClangASTType &clang_type);
- TypeImpl (lldb::TypeSP type_sp, ClangASTType dynamic);
+ TypeImpl (const lldb::TypeSP &type_sp, const ClangASTType &dynamic);
- TypeImpl (ClangASTType clang_type, ClangASTType dynamic);
+ TypeImpl (const ClangASTType &clang_type, const ClangASTType &dynamic);
- TypeImpl (TypePair pair, ClangASTType dynamic);
+ TypeImpl (const TypePair &pair, const ClangASTType &dynamic);
void
- SetType (lldb::TypeSP type_sp);
+ SetType (const lldb::TypeSP &type_sp);
void
- SetType (ClangASTType clang_type);
+ SetType (const ClangASTType &clang_type);
void
- SetType (lldb::TypeSP type_sp, ClangASTType dynamic);
+ SetType (const lldb::TypeSP &type_sp, const ClangASTType &dynamic);
void
- SetType (ClangASTType clang_type, ClangASTType dynamic);
+ SetType (const ClangASTType &clang_type, const ClangASTType &dynamic);
void
- SetType (TypePair pair, ClangASTType dynamic);
+ SetType (const TypePair &pair, const ClangASTType &dynamic);
TypeImpl&
operator = (const TypeImpl& rhs);
@@ -511,6 +541,9 @@ public:
ConstString
GetName () const;
+ ConstString
+ GetDisplayTypeName () const;
+
TypeImpl
GetPointerType () const;
@@ -543,6 +576,11 @@ public:
lldb::DescriptionLevel description_level);
private:
+
+ bool
+ CheckModule (lldb::ModuleSP &module_sp) const;
+
+ lldb::ModuleWP m_module_wp;
TypePair m_static_type;
ClangASTType m_dynamic_type;
};
@@ -772,7 +810,105 @@ private:
TypePair m_type_pair;
ConstString m_type_name;
};
-
+
+class TypeEnumMemberImpl
+{
+public:
+ TypeEnumMemberImpl () :
+ m_integer_type_sp(),
+ m_name("<invalid>"),
+ m_value(),
+ m_valid(false)
+ {
+ }
+
+ TypeEnumMemberImpl (const clang::EnumConstantDecl* enum_member_decl,
+ const lldb_private::ClangASTType& integer_type);
+
+ TypeEnumMemberImpl (const TypeEnumMemberImpl& rhs) :
+ m_integer_type_sp(rhs.m_integer_type_sp),
+ m_name(rhs.m_name),
+ m_value(rhs.m_value),
+ m_valid(rhs.m_valid)
+ {
+ }
+
+ TypeEnumMemberImpl&
+ operator = (const TypeEnumMemberImpl& rhs);
+
+ bool
+ IsValid ()
+ {
+ return m_valid;
+ }
+
+ const ConstString &
+ GetName () const
+ {
+ return m_name;
+ }
+
+ const lldb::TypeImplSP &
+ GetIntegerType () const
+ {
+ return m_integer_type_sp;
+ }
+
+ uint64_t
+ GetValueAsUnsigned () const
+ {
+ return *m_value.getRawData();
+ }
+
+ int64_t
+ GetValueAsSigned () const
+ {
+ return (int64_t) *m_value.getRawData();
+ }
+
+protected:
+ lldb::TypeImplSP m_integer_type_sp;
+ ConstString m_name;
+ llvm::APSInt m_value;
+ bool m_valid;
+};
+
+class TypeEnumMemberListImpl
+{
+public:
+ TypeEnumMemberListImpl() :
+ m_content()
+ {
+ }
+
+ void
+ Append (const lldb::TypeEnumMemberImplSP& type)
+ {
+ m_content.push_back(type);
+ }
+
+ void
+ Append (const lldb_private::TypeEnumMemberListImpl& type_list);
+
+ lldb::TypeEnumMemberImplSP
+ GetTypeEnumMemberAtIndex(size_t idx)
+ {
+ lldb::TypeEnumMemberImplSP enum_member;
+ if (idx < GetSize())
+ enum_member = m_content[idx];
+ return enum_member;
+ }
+
+ size_t
+ GetSize()
+ {
+ return m_content.size();
+ }
+
+private:
+ std::vector<lldb::TypeEnumMemberImplSP> m_content;
+};
+
} // namespace lldb_private
#endif // liblldb_Type_h_
diff --git a/include/lldb/Symbol/UnwindPlan.h b/include/lldb/Symbol/UnwindPlan.h
index 6fc5ce042357..e1b146fe219e 100644
--- a/include/lldb/Symbol/UnwindPlan.h
+++ b/include/lldb/Symbol/UnwindPlan.h
@@ -365,6 +365,9 @@ public:
void
AppendRow (const RowSP& row_sp);
+ void
+ InsertRow (const RowSP& row_sp);
+
// Returns a pointer to the best row for the given offset into the function's instructions.
// If offset is -1 it indicates that the function start is unknown - the final row in the UnwindPlan is returned.
// In practice, the UnwindPlan for a function with no known start address will be the architectural default
diff --git a/include/lldb/Symbol/UnwindTable.h b/include/lldb/Symbol/UnwindTable.h
index 3a99eb463df4..3a89f9f1f3c6 100644
--- a/include/lldb/Symbol/UnwindTable.h
+++ b/include/lldb/Symbol/UnwindTable.h
@@ -13,7 +13,8 @@
#include <map>
-#include "lldb/lldb-private.h"
+#include "lldb/lldb-private.h"
+#include "lldb/Host/Mutex.h"
namespace lldb_private {
@@ -42,6 +43,9 @@ public:
lldb::FuncUnwindersSP
GetUncachedFuncUnwindersContainingAddress (const Address& addr, SymbolContext &sc);
+ bool
+ GetArchitecture (lldb_private::ArchSpec &arch);
+
private:
void
Dump (Stream &s);
@@ -56,8 +60,7 @@ private:
collection m_unwinds;
bool m_initialized; // delay some initialization until ObjectFile is set up
-
- lldb::UnwindAssemblySP m_assembly_profiler;
+ Mutex m_mutex;
DWARFCallFrameInfo* m_eh_frame;
diff --git a/include/lldb/Symbol/VariableList.h b/include/lldb/Symbol/VariableList.h
index 08efd3d5b9a1..5f8f2a225650 100644
--- a/include/lldb/Symbol/VariableList.h
+++ b/include/lldb/Symbol/VariableList.h
@@ -60,10 +60,10 @@ public:
AppendVariablesIfUnique(VariableList &var_list);
// Returns the actual number of unique variables that were added to the
- // list. "total_matches" will get updated with the actualy number of
+ // list. "total_matches" will get updated with the actually number of
// matches that were found regardless of whether they were unique or not
// to allow for error conditions when nothing is found, versus conditions
- // where any varaibles that match "regex" were already in "var_list".
+ // where any variables that match "regex" were already in "var_list".
size_t
AppendVariablesIfUnique (const RegularExpression& regex,
VariableList &var_list,
diff --git a/include/lldb/Target/ABI.h b/include/lldb/Target/ABI.h
index cc6c46cf0ec9..8809c0047fa0 100644
--- a/include/lldb/Target/ABI.h
+++ b/include/lldb/Target/ABI.h
@@ -20,24 +20,58 @@
#include "llvm/ADT/ArrayRef.h"
+// forward define the llvm::Type class
+namespace llvm { class Type; }
+
namespace lldb_private {
class ABI :
public PluginInterface
{
public:
+
+ struct CallArgument
+ {
+ enum eType
+ {
+ HostPointer = 0, /* pointer to host data */
+ TargetValue , /* value is on the target or literal */
+ };
+ eType type; /* value of eType */
+ size_t size; /* size in bytes of this argument */
+ union {
+ lldb::addr_t value; /* literal value */
+ uint8_t *data; /* host data pointer */
+ };
+ };
+
virtual
~ABI();
virtual size_t
GetRedZoneSize () const = 0;
-
+
virtual bool
- PrepareTrivialCall (Thread &thread,
- lldb::addr_t sp,
- lldb::addr_t functionAddress,
- lldb::addr_t returnAddress,
- llvm::ArrayRef<lldb::addr_t> args) const = 0;
+ PrepareTrivialCall ( lldb_private::Thread &thread,
+ lldb::addr_t sp,
+ lldb::addr_t functionAddress,
+ lldb::addr_t returnAddress,
+ llvm::ArrayRef<lldb::addr_t> args) const = 0;
+
+ // Prepare trivial call used from ThreadPlanFunctionCallGDB
+ // AD:
+ // . Because i don't want to change other ABI's this is not declared pure virtual.
+ // The dummy implementation will simply fail. Only HexagonABI will currently
+ // use this method.
+ // . Two PrepareTrivialCall's is not good design so perhaps this should be combined.
+ //
+ virtual bool
+ PrepareTrivialCall ( lldb_private::Thread &thread,
+ lldb::addr_t sp,
+ lldb::addr_t functionAddress,
+ lldb::addr_t returnAddress,
+ llvm::Type &prototype,
+ llvm::ArrayRef<CallArgument> args) const;
virtual bool
GetArgumentValues (Thread &thread,
@@ -48,16 +82,26 @@ public:
ClangASTType &type,
bool persistent = true) const;
+ // specialized to work with llvm IR types
+ lldb::ValueObjectSP
+ GetReturnValueObject (Thread &thread,
+ llvm::Type &type,
+ bool persistent = true) const;
+
// Set the Return value object in the current frame as though a function with
virtual Error
SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) = 0;
protected:
// This is the method the ABI will call to actually calculate the return value.
- // Don't put it in a persistant value object, that will be done by the ABI::GetReturnValueObject.
+ // Don't put it in a persistent value object, that will be done by the ABI::GetReturnValueObject.
virtual lldb::ValueObjectSP
- GetReturnValueObjectImpl (Thread &thread,
- ClangASTType &type) const = 0;
+ GetReturnValueObjectImpl (Thread &thread, ClangASTType &ast_type) const = 0;
+
+ // specialized to work with llvm IR types
+ virtual lldb::ValueObjectSP
+ GetReturnValueObjectImpl( Thread &thread, llvm::Type &ir_type ) const;
+
public:
virtual bool
CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan) = 0;
@@ -108,7 +152,6 @@ public:
virtual bool
FunctionCallsChangeCFA () = 0;
-
bool
GetRegisterInfoByName (const ConstString &name, RegisterInfo &info);
diff --git a/include/lldb/Target/CPPLanguageRuntime.h b/include/lldb/Target/CPPLanguageRuntime.h
index 98a4ab88cb25..daf8a67d2a9d 100644
--- a/include/lldb/Target/CPPLanguageRuntime.h
+++ b/include/lldb/Target/CPPLanguageRuntime.h
@@ -136,7 +136,7 @@ public:
static bool
StripNamespacesFromVariableName (const char *name, const char *&base_name_start, const char *&base_name_end);
- // in some cases, compilers will output different names for one same type. when tht happens, it might be impossible
+ // in some cases, compilers will output different names for one same type. when that happens, it might be impossible
// to construct SBType objects for a valid type, because the name that is available is not the same as the name that
// can be used as a search key in FindTypes(). the equivalents map here is meant to return possible alternative names
// for a type through which a search can be conducted. Currently, this is only enabled for C++ but can be extended
diff --git a/include/lldb/Target/ExecutionContext.h b/include/lldb/Target/ExecutionContext.h
index f825c2e72e6d..50f2beaf949b 100644
--- a/include/lldb/Target/ExecutionContext.h
+++ b/include/lldb/Target/ExecutionContext.h
@@ -18,10 +18,10 @@
/// variable value from a data section in one of the object files in
/// a target). There are two types of objects that hold onto execution
/// contexts: ExecutionContextRef and ExecutionContext. Both of these
-/// objects are deascribed below.
+/// objects are described below.
///
/// Not all objects in an ExectionContext objects will be valid. If you want
-/// to refer stronly (ExectionContext) or weakly (ExectionContextRef) to
+/// to refer strongly (ExectionContext) or weakly (ExectionContextRef) to
/// a process, then only the process and target references will be valid.
/// For threads, only the thread, process and target references will be
/// filled in. For frames, all of the objects will be filled in.
@@ -49,7 +49,7 @@ namespace lldb_private {
/// context that might change over time. For example, if an object wants
/// to refer to a stack frame, it should hold onto an ExecutionContextRef
/// to a frame object. The backing object that represents the stack frame
-/// might change over time and instaces of this object can track the logical
+/// might change over time and instances of this object can track the logical
/// object that refers to a frame even if it does change.
///
/// These objects also don't keep execution objects around longer than they
@@ -64,7 +64,7 @@ namespace lldb_private {
/// don't keep these objects around, they are safe to keep around.
///
/// The general rule of thumb is all long lived objects that want to
-/// refer to execution contexts should use ExecutionContextRef objcts.
+/// refer to execution contexts should use ExecutionContextRef objects.
/// The ExecutionContext class is used to temporarily get shared
/// pointers to any execution context objects that are still around
/// so they are guaranteed to exist during a function that requires the
@@ -89,7 +89,7 @@ public:
/// Construct using an ExecutionContext object that might be NULL.
///
/// If \a exe_ctx_ptr is valid, then make weak references to any
- /// valid objects in the ExecutionContext, othewise no weak
+ /// valid objects in the ExecutionContext, otherwise no weak
/// references to any execution context objects will be made.
//------------------------------------------------------------------
ExecutionContextRef (const ExecutionContext *exe_ctx_ptr);
@@ -104,7 +104,7 @@ public:
//------------------------------------------------------------------
/// Assignment operator
///
- /// Copy all weak refernces in \a rhs.
+ /// Copy all weak references in \a rhs.
//------------------------------------------------------------------
ExecutionContextRef &
operator =(const ExecutionContextRef &rhs);
@@ -112,7 +112,7 @@ public:
//------------------------------------------------------------------
/// Assignment operator from a ExecutionContext
///
- /// Make weak refernces to any stringly referenced objects in \a exe_ctx.
+ /// Make weak references to any strongly referenced objects in \a exe_ctx.
//------------------------------------------------------------------
ExecutionContextRef &
operator =(const ExecutionContext &exe_ctx);
@@ -129,13 +129,13 @@ public:
/// Construct using an execution context scope.
///
/// If the ExecutionContextScope object is valid and refers to a frame,
- /// make weak refernces too the frame, thread, process and target.
+ /// make weak references too the frame, thread, process and target.
/// If the ExecutionContextScope object is valid and refers to a thread,
- /// make weak refernces too the thread, process and target.
+ /// make weak references too the thread, process and target.
/// If the ExecutionContextScope object is valid and refers to a process,
- /// make weak refernces too the process and target.
+ /// make weak references too the process and target.
/// If the ExecutionContextScope object is valid and refers to a target,
- /// make weak refernces too the target.
+ /// make weak references too the target.
//------------------------------------------------------------------
ExecutionContextRef (ExecutionContextScope *exe_scope);
@@ -143,13 +143,13 @@ public:
/// Construct using an execution context scope.
///
/// If the ExecutionContextScope object refers to a frame,
- /// make weak refernces too the frame, thread, process and target.
+ /// make weak references too the frame, thread, process and target.
/// If the ExecutionContextScope object refers to a thread,
- /// make weak refernces too the thread, process and target.
+ /// make weak references too the thread, process and target.
/// If the ExecutionContextScope object refers to a process,
- /// make weak refernces too the process and target.
+ /// make weak references too the process and target.
/// If the ExecutionContextScope object refers to a target,
- /// make weak refernces too the target.
+ /// make weak references too the target.
//------------------------------------------------------------------
ExecutionContextRef (ExecutionContextScope &exe_scope);
@@ -302,8 +302,8 @@ public:
//------------------------------------------------------------------
/// Returns true if this object has a weak reference to a thread.
- /// The return value is only an indication of wether this object has
- /// a weak reference and does not indicate wether the weak rerference
+ /// The return value is only an indication of whether this object has
+ /// a weak reference and does not indicate whether the weak reference
/// is valid or not.
//------------------------------------------------------------------
bool
@@ -314,8 +314,8 @@ public:
//------------------------------------------------------------------
/// Returns true if this object has a weak reference to a frame.
- /// The return value is only an indication of wether this object has
- /// a weak reference and does not indicate wether the weak rerference
+ /// The return value is only an indication of whether this object has
+ /// a weak reference and does not indicate whether the weak reference
/// is valid or not.
//------------------------------------------------------------------
bool
diff --git a/include/lldb/Target/ExecutionContextScope.h b/include/lldb/Target/ExecutionContextScope.h
index 7ba40971af2c..4a1b17d5a114 100644
--- a/include/lldb/Target/ExecutionContextScope.h
+++ b/include/lldb/Target/ExecutionContextScope.h
@@ -29,7 +29,7 @@ namespace lldb_private {
/// ExecutionContext object in the object state. Examples of these
/// objects include: Process, Thread, RegisterContext and StackFrame.
///
-/// Bbjects can contain a valid pointer to an instance of this so they
+/// Objects can contain a valid pointer to an instance of this so they
/// can reconstruct the execution context.
///
/// Objects that adhere to this protocol can reconstruct enough of a
diff --git a/include/lldb/Target/FileAction.h b/include/lldb/Target/FileAction.h
new file mode 100644
index 000000000000..db84c0ef468c
--- /dev/null
+++ b/include/lldb/Target/FileAction.h
@@ -0,0 +1,68 @@
+//===-- ProcessLaunchInfo.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_Target_FileAction_h
+#define liblldb_Target_FileAction_h
+
+#include <string>
+
+namespace lldb_private
+{
+
+class FileAction
+{
+ public:
+ enum Action
+ {
+ eFileActionNone,
+ eFileActionClose,
+ eFileActionDuplicate,
+ eFileActionOpen
+ };
+
+ FileAction();
+
+ void Clear();
+
+ bool Close(int fd);
+
+ bool Duplicate(int fd, int dup_fd);
+
+ bool Open(int fd, const char *path, bool read, bool write);
+
+ int
+ GetFD() const
+ {
+ return m_fd;
+ }
+
+ Action
+ GetAction() const
+ {
+ return m_action;
+ }
+
+ int
+ GetActionArgument() const
+ {
+ return m_arg;
+ }
+
+ const char *GetPath() 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
+};
+
+} // namespace lldb_private
+
+#endif
diff --git a/include/lldb/Target/JITLoader.h b/include/lldb/Target/JITLoader.h
new file mode 100644
index 000000000000..c15ae5a876f1
--- /dev/null
+++ b/include/lldb/Target/JITLoader.h
@@ -0,0 +1,90 @@
+//===-- JITLoader.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_JITLoader_h_
+#define liblldb_JITLoader_h_
+
+#include <vector>
+
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Target/JITLoaderList.h"
+
+namespace lldb_private {
+
+//----------------------------------------------------------------------
+/// @class JITLoader JITLoader.h "lldb/Target/JITLoader.h"
+/// @brief A plug-in interface definition class for JIT loaders.
+///
+/// Plugins of this kind listen for code generated at runtime in the
+/// target. They are very similar to dynamic loader, with the difference
+/// that they do not have information about the target's dyld and
+/// that there may be multiple JITLoader plugins per process, while
+/// there is at most one DynamicLoader.
+//----------------------------------------------------------------------
+class JITLoader :
+ public PluginInterface
+{
+public:
+ //------------------------------------------------------------------
+ /// Find a JIT loader plugin for a given process.
+ ///
+ /// Scans the installed DynamicLoader plug-ins and tries to find
+ /// all applicable instances for the current process.
+ ///
+ /// @param[in] process
+ /// The process for which to try and locate a JIT loader
+ /// plug-in instance.
+ ///
+ //------------------------------------------------------------------
+ static void
+ LoadPlugins (Process *process, lldb_private::JITLoaderList &list);
+
+ //------------------------------------------------------------------
+ /// Construct with a process.
+ //------------------------------------------------------------------
+ JITLoader (Process *process);
+
+ virtual
+ ~JITLoader ();
+
+ //------------------------------------------------------------------
+ /// Called after attaching a process.
+ ///
+ /// Allow JITLoader plug-ins to execute some code after
+ /// attaching to a process.
+ //------------------------------------------------------------------
+ virtual void
+ DidAttach () = 0;
+
+ //------------------------------------------------------------------
+ /// Called after launching a process.
+ ///
+ /// Allow JITLoader plug-ins to execute some code after
+ /// the process has stopped for the first time on launch.
+ //------------------------------------------------------------------
+ virtual void
+ DidLaunch () = 0;
+
+ //------------------------------------------------------------------
+ /// Called after a new shared object has been loaded so that it can
+ /// be probed for JIT entry point hooks.
+ //------------------------------------------------------------------
+ virtual void
+ ModulesDidLoad (lldb_private::ModuleList &module_list) = 0;
+
+protected:
+ //------------------------------------------------------------------
+ // Member variables.
+ //------------------------------------------------------------------
+ Process* m_process;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_JITLoader_h_
diff --git a/include/lldb/Target/JITLoaderList.h b/include/lldb/Target/JITLoaderList.h
new file mode 100644
index 000000000000..f933a61e9952
--- /dev/null
+++ b/include/lldb/Target/JITLoaderList.h
@@ -0,0 +1,60 @@
+//===-- JITLoaderList.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_JITLoaderList_h_
+#define liblldb_JITLoaderList_h_
+
+#include <vector>
+
+#include "lldb/lldb-forward.h"
+#include "lldb/Host/Mutex.h"
+
+namespace lldb_private {
+
+//----------------------------------------------------------------------
+/// @class JITLoaderList JITLoaderList.h "lldb/Target/JITLoaderList.h"
+///
+/// Class used by the Process to hold a list of its JITLoaders.
+//----------------------------------------------------------------------
+class JITLoaderList
+{
+public:
+
+ JITLoaderList();
+ ~JITLoaderList();
+
+ void
+ Append (const lldb::JITLoaderSP &jit_loader_sp);
+
+ void
+ Remove (const lldb::JITLoaderSP &jit_loader_sp);
+
+ size_t
+ GetSize() const;
+
+ lldb::JITLoaderSP
+ GetLoaderAtIndex (size_t idx);
+
+ void
+ DidLaunch();
+
+ void
+ DidAttach();
+
+ void
+ ModulesDidLoad (ModuleList &module_list);
+
+private:
+ std::vector<lldb::JITLoaderSP> m_jit_loaders_vec;
+ lldb_private::Mutex m_jit_loaders_mutex;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_JITLoaderList_h_
diff --git a/include/lldb/Target/MemoryRegionInfo.h b/include/lldb/Target/MemoryRegionInfo.h
new file mode 100644
index 000000000000..0726ad15e876
--- /dev/null
+++ b/include/lldb/Target/MemoryRegionInfo.h
@@ -0,0 +1,104 @@
+//===-- MemoryRegionInfo.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_MemoryRegionInfo_h
+#define lldb_MemoryRegionInfo_h
+
+#include "lldb/Core/RangeMap.h"
+#include "lldb/Utility/Range.h"
+
+namespace lldb_private
+{
+ class MemoryRegionInfo
+ {
+ public:
+ typedef Range<lldb::addr_t, lldb::addr_t> RangeType;
+
+ enum OptionalBool {
+ eDontKnow = -1,
+ eNo = 0,
+ eYes = 1
+ };
+
+ MemoryRegionInfo () :
+ m_range (),
+ m_read (eDontKnow),
+ m_write (eDontKnow),
+ m_execute (eDontKnow)
+ {
+ }
+
+ ~MemoryRegionInfo ()
+ {
+ }
+
+ RangeType &
+ GetRange()
+ {
+ return m_range;
+ }
+
+ void
+ Clear()
+ {
+ m_range.Clear();
+ m_read = m_write = m_execute = eDontKnow;
+ }
+
+ const RangeType &
+ GetRange() const
+ {
+ return m_range;
+ }
+
+ OptionalBool
+ GetReadable () const
+ {
+ return m_read;
+ }
+
+ OptionalBool
+ GetWritable () const
+ {
+ return m_write;
+ }
+
+ OptionalBool
+ GetExecutable () const
+ {
+ return m_execute;
+ }
+
+ void
+ SetReadable (OptionalBool val)
+ {
+ m_read = val;
+ }
+
+ void
+ SetWritable (OptionalBool val)
+ {
+ m_write = val;
+ }
+
+ void
+ SetExecutable (OptionalBool val)
+ {
+ m_execute = val;
+ }
+
+ protected:
+ RangeType m_range;
+ OptionalBool m_read;
+ OptionalBool m_write;
+ OptionalBool m_execute;
+ };
+}
+
+#endif // #ifndef lldb_MemoryRegionInfo_h
diff --git a/include/lldb/Target/NativeRegisterContext.h b/include/lldb/Target/NativeRegisterContext.h
new file mode 100644
index 000000000000..fa4ab013f234
--- /dev/null
+++ b/include/lldb/Target/NativeRegisterContext.h
@@ -0,0 +1,190 @@
+//===-- NativeRegisterContext.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_NativeRegisterContext_h_
+#define liblldb_NativeRegisterContext_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class NativeThreadProtocol;
+
+class NativeRegisterContext:
+ public std::enable_shared_from_this<NativeRegisterContext>
+{
+public:
+ //------------------------------------------------------------------
+ // Constructors and Destructors
+ //------------------------------------------------------------------
+ NativeRegisterContext (NativeThreadProtocol &thread, uint32_t concrete_frame_idx);
+
+ virtual
+ ~NativeRegisterContext ();
+
+ // void
+ // InvalidateIfNeeded (bool force);
+
+ //------------------------------------------------------------------
+ // Subclasses must override these functions
+ //------------------------------------------------------------------
+ // virtual void
+ // InvalidateAllRegisters () = 0;
+
+ virtual uint32_t
+ GetRegisterCount () const = 0;
+
+ virtual const RegisterInfo *
+ GetRegisterInfoAtIndex (uint32_t reg) const = 0;
+
+ const char *
+ GetRegisterSetNameForRegisterAtIndex (uint32_t reg_index) const;
+
+ virtual uint32_t
+ GetRegisterSetCount () const = 0;
+
+ virtual const RegisterSet *
+ GetRegisterSet (uint32_t set_index) const = 0;
+
+ virtual Error
+ ReadRegister (const RegisterInfo *reg_info, RegisterValue &reg_value) = 0;
+
+ virtual Error
+ WriteRegister (const RegisterInfo *reg_info, const RegisterValue &reg_value) = 0;
+
+ virtual Error
+ ReadAllRegisterValues (lldb::DataBufferSP &data_sp) = 0;
+
+ virtual Error
+ WriteAllRegisterValues (const lldb::DataBufferSP &data_sp) = 0;
+
+ uint32_t
+ ConvertRegisterKindToRegisterNumber (uint32_t kind, uint32_t num) const;
+
+ //------------------------------------------------------------------
+ // Subclasses can override these functions if desired
+ //------------------------------------------------------------------
+ virtual uint32_t
+ NumSupportedHardwareBreakpoints ();
+
+ virtual uint32_t
+ SetHardwareBreakpoint (lldb::addr_t addr, size_t size);
+
+ virtual bool
+ ClearHardwareBreakpoint (uint32_t hw_idx);
+
+ virtual uint32_t
+ NumSupportedHardwareWatchpoints ();
+
+ virtual uint32_t
+ SetHardwareWatchpoint (lldb::addr_t addr, size_t size, uint32_t watch_flags);
+
+ virtual bool
+ ClearHardwareWatchpoint (uint32_t hw_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);
+
+ virtual Error
+ WriteRegisterValueToMemory (const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, lldb::addr_t dst_len, const RegisterValue &reg_value);
+
+ //------------------------------------------------------------------
+ // Subclasses should not override these
+ //------------------------------------------------------------------
+ virtual lldb::tid_t
+ GetThreadID() const;
+
+ virtual NativeThreadProtocol &
+ GetThread ()
+ {
+ return m_thread;
+ }
+
+ const RegisterInfo *
+ GetRegisterInfoByName (const char *reg_name, uint32_t start_idx = 0);
+
+ const RegisterInfo *
+ GetRegisterInfo (uint32_t reg_kind, uint32_t reg_num);
+
+ lldb::addr_t
+ GetPC (lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
+
+ Error
+ SetPC (lldb::addr_t pc);
+
+ lldb::addr_t
+ GetSP (lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
+
+ Error
+ SetSP (lldb::addr_t sp);
+
+ lldb::addr_t
+ GetFP (lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
+
+ Error
+ SetFP (lldb::addr_t fp);
+
+ const char *
+ GetRegisterName (uint32_t reg);
+
+ lldb::addr_t
+ GetReturnAddress (lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
+
+ lldb::addr_t
+ GetFlags (lldb::addr_t fail_value = 0);
+
+ lldb::addr_t
+ ReadRegisterAsUnsigned (uint32_t reg, lldb::addr_t fail_value);
+
+ lldb::addr_t
+ ReadRegisterAsUnsigned (const RegisterInfo *reg_info, lldb::addr_t fail_value);
+
+ Error
+ WriteRegisterFromUnsigned (uint32_t reg, uint64_t uval);
+
+ Error
+ WriteRegisterFromUnsigned (const RegisterInfo *reg_info, uint64_t uval);
+
+ // uint32_t
+ // GetStopID () const
+ // {
+ // return m_stop_id;
+ // }
+
+ // void
+ // SetStopID (uint32_t stop_id)
+ // {
+ // m_stop_id = stop_id;
+ // }
+
+protected:
+ //------------------------------------------------------------------
+ // Classes that inherit from RegisterContext can see and modify these
+ //------------------------------------------------------------------
+ NativeThreadProtocol &m_thread; // The thread that this register context belongs to.
+ uint32_t m_concrete_frame_idx; // The concrete frame index for this register context
+ // uint32_t m_stop_id; // The stop ID that any data in this context is valid for
+
+private:
+ //------------------------------------------------------------------
+ // For RegisterContext only
+ //------------------------------------------------------------------
+ DISALLOW_COPY_AND_ASSIGN (NativeRegisterContext);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_NativeRegisterContext_h_
diff --git a/include/lldb/Target/NativeRegisterContextRegisterInfo.h b/include/lldb/Target/NativeRegisterContextRegisterInfo.h
new file mode 100644
index 000000000000..5631005ca56e
--- /dev/null
+++ b/include/lldb/Target/NativeRegisterContextRegisterInfo.h
@@ -0,0 +1,44 @@
+//===-- NativeRegisterContextRegisterInfo.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_NativeRegisterContextRegisterInfo_h
+#define lldb_NativeRegisterContextRegisterInfo_h
+
+#include <memory>
+
+#include "NativeRegisterContext.h"
+#include "Plugins/Process/Utility/RegisterInfoInterface.h"
+
+namespace lldb_private
+{
+ class NativeRegisterContextRegisterInfo: public NativeRegisterContext
+ {
+ public:
+ ///
+ /// Construct a NativeRegisterContextRegisterInfo, taking ownership
+ /// of the register_info_interface pointer.
+ ///
+ NativeRegisterContextRegisterInfo (NativeThreadProtocol &thread,
+ uint32_t concrete_frame_idx,
+ RegisterInfoInterface *register_info_interface);
+
+ uint32_t
+ GetRegisterCount () const override;
+
+ const RegisterInfo *
+ GetRegisterInfoAtIndex (uint32_t reg_index) const override;
+
+ const RegisterInfoInterface&
+ GetRegisterInfoInterface () const;
+
+ private:
+ std::unique_ptr<RegisterInfoInterface> m_register_info_interface_up;
+ };
+}
+#endif
diff --git a/include/lldb/Target/ObjCLanguageRuntime.h b/include/lldb/Target/ObjCLanguageRuntime.h
index 7bac57256444..12254f942e42 100644
--- a/include/lldb/Target/ObjCLanguageRuntime.h
+++ b/include/lldb/Target/ObjCLanguageRuntime.h
@@ -20,6 +20,7 @@
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/PluginInterface.h"
+#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Symbol/TypeVendor.h"
#include "lldb/Target/LanguageRuntime.h"
@@ -221,7 +222,7 @@ public:
Describe (std::function <void (ObjCISA)> const &superclass_func,
std::function <bool (const char*, const char*)> const &instance_method_func,
std::function <bool (const char*, const char*)> const &class_method_func,
- std::function <bool (const char *, const char *, lldb::addr_t, uint64_t)> const &ivar_func)
+ std::function <bool (const char *, const char *, lldb::addr_t, uint64_t)> const &ivar_func) const
{
return false;
}
@@ -238,6 +239,25 @@ public:
m_type_wp = type_sp;
}
+ struct iVarDescriptor {
+ ConstString m_name;
+ ClangASTType m_type;
+ uint64_t m_size;
+ int32_t m_offset;
+ };
+
+ virtual size_t
+ GetNumIVars ()
+ {
+ return 0;
+ }
+
+ virtual iVarDescriptor
+ GetIVarAtIndex (size_t idx)
+ {
+ return iVarDescriptor();
+ }
+
protected:
bool
IsPointerValid (lldb::addr_t value,
@@ -252,6 +272,25 @@ public:
lldb::TypeWP m_type_wp;
};
+ class EncodingToType
+ {
+ public:
+ virtual ClangASTType RealizeType (ClangASTContext& ast_ctx, const char* name, bool allow_unknownanytype);
+ virtual ClangASTType RealizeType (const char* name, bool allow_unknownanytype);
+
+ virtual ClangASTType RealizeType (clang::ASTContext& ast_ctx, const char* name, bool allow_unknownanytype) = 0;
+
+ virtual ~EncodingToType();
+
+ protected:
+ std::unique_ptr<ClangASTContext> m_scratch_ast_ctx_ap;
+ };
+
+ typedef std::shared_ptr<EncodingToType> EncodingToTypeSP;
+
+ virtual EncodingToTypeSP
+ GetEncodingToType ();
+
virtual ClassDescriptorSP
GetClassDescriptor (ValueObject& in_value);
diff --git a/include/lldb/Target/PathMappingList.h b/include/lldb/Target/PathMappingList.h
index b5bcbbfd768f..17185cb68495 100644
--- a/include/lldb/Target/PathMappingList.h
+++ b/include/lldb/Target/PathMappingList.h
@@ -78,7 +78,7 @@ public:
bool notify);
bool
- Remove (off_t index, bool notify);
+ Remove (size_t index, bool notify);
bool
Remove (const ConstString &path, bool notify);
diff --git a/include/lldb/Target/Platform.h b/include/lldb/Target/Platform.h
index 80011fd120de..e3d6abe3f398 100644
--- a/include/lldb/Target/Platform.h
+++ b/include/lldb/Target/Platform.h
@@ -18,6 +18,7 @@
// Other libraries and framework includes
// Project includes
+#include "lldb/lldb-private-forward.h"
#include "lldb/lldb-public.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/ConstString.h"
@@ -25,6 +26,10 @@
#include "lldb/Interpreter/Options.h"
#include "lldb/Host/Mutex.h"
+// TODO pull NativeDelegate class out of NativeProcessProtocol so we
+// can just forward ref the NativeDelegate rather than include it here.
+#include "../../../source/Host/common/NativeProcessProtocol.h"
+
namespace lldb_private {
//----------------------------------------------------------------------
@@ -174,13 +179,13 @@ namespace lldb_private {
/// m_arch - The architecture we are looking for when resolving
/// the symbol file.
/// m_uuid - The UUID of the executable and symbol file. This
- /// can often be used to match up an exectuable with
+ /// can often be used to match up an executable with
/// a symbol file, or resolve an symbol file in a
/// symbol file bundle.
///
/// @param[out] sym_file
/// The resolved symbol file spec if the returned error
- /// indicates succes.
+ /// indicates success.
///
/// @return
/// Returns an error that describes success or failure.
@@ -215,7 +220,7 @@ namespace lldb_private {
bool
GetOSKernelDescription (std::string &s);
- // Returns the the name of the platform
+ // Returns the name of the platform
ConstString
GetName ();
@@ -241,7 +246,7 @@ namespace lldb_private {
//
// Remote classes must be connected for this to succeed. Local
// subclasses don't need to override this function as it will just
- // call the Host::GetOSVersion().
+ // call the HostInfo::GetOSVersion().
//------------------------------------------------------------------
virtual bool
GetRemoteOSVersion ()
@@ -326,7 +331,8 @@ namespace lldb_private {
//----------------------------------------------------------------------
virtual FileSpecList
LocateExecutableScriptingResources (Target *target,
- Module &module);
+ Module &module,
+ Stream* feedback_stream);
virtual Error
GetSharedModule (const ModuleSpec &module_spec,
@@ -349,7 +355,7 @@ namespace lldb_private {
/// A zero based architecture index
///
/// @param[out] arch
- /// A copy of the archgitecture at index if the return value is
+ /// A copy of the architecture at index if the return value is
/// \b true.
///
/// @return
@@ -413,7 +419,7 @@ namespace lldb_private {
/// attempt to attach to the process with the process ID of \a pid.
/// The platform subclass should return an appropriate ProcessSP
/// subclass that is attached to the process, or an empty shared
- /// pointer with an appriopriate error.
+ /// pointer with an appropriate error.
///
/// @param[in] pid
/// The process ID that we should attempt to attach to.
@@ -422,7 +428,7 @@ namespace lldb_private {
/// An appropriate ProcessSP containing a valid shared pointer
/// to the default Process subclass for the platform that is
/// attached to the process, or an empty shared pointer with an
- /// appriopriate error fill into the \a error object.
+ /// appropriate error fill into the \a error object.
//------------------------------------------------------------------
virtual lldb::ProcessSP
Attach (ProcessAttachInfo &attach_info,
@@ -858,13 +864,72 @@ namespace lldb_private {
virtual const std::vector<ConstString> &
GetTrapHandlerSymbolNames ();
+ //------------------------------------------------------------------
+ /// Launch a process for debugging.
+ ///
+ /// This differs from Launch in that it returns a NativeProcessProtocol.
+ /// Currently used by lldb-gdbserver.
+ ///
+ /// @param[in] launch_info
+ /// Information required to launch the process.
+ ///
+ /// @param[in] native_delegate
+ /// The delegate that will receive messages regarding the
+ /// inferior. Must outlive the NativeProcessProtocol
+ /// instance.
+ ///
+ /// @param[out] process_sp
+ /// On successful return from the method, this parameter
+ /// contains the shared pointer to the
+ /// NativeProcessProtocol that can be used to manipulate
+ /// the native process.
+ ///
+ /// @return
+ /// An error object indicating if the operation succeeded,
+ /// and if not, what error occurred.
+ //------------------------------------------------------------------
+ virtual Error
+ LaunchNativeProcess (
+ ProcessLaunchInfo &launch_info,
+ lldb_private::NativeProcessProtocol::NativeDelegate &native_delegate,
+ NativeProcessProtocolSP &process_sp);
+
+ //------------------------------------------------------------------
+ /// Attach to an existing process on the given platform.
+ ///
+ /// This method differs from Attach() in that it returns a
+ /// NativeProcessProtocol. Currently this is used by lldb-gdbserver.
+ ///
+ /// @param[in] pid
+ /// pid of the process locatable by the platform.
+ ///
+ /// @param[in] native_delegate
+ /// The delegate that will receive messages regarding the
+ /// inferior. Must outlive the NativeProcessProtocol
+ /// instance.
+ ///
+ /// @param[out] process_sp
+ /// On successful return from the method, this parameter
+ /// contains the shared pointer to the
+ /// NativeProcessProtocol that can be used to manipulate
+ /// the native process.
+ ///
+ /// @return
+ /// An error object indicating if the operation succeeded,
+ /// and if not, what error occurred.
+ //------------------------------------------------------------------
+ virtual Error
+ AttachNativeProcess (lldb::pid_t pid,
+ lldb_private::NativeProcessProtocol::NativeDelegate &native_delegate,
+ NativeProcessProtocolSP &process_sp);
+
protected:
bool m_is_host;
// Set to true when we are able to actually set the OS version while
// being connected. For remote platforms, we might set the version ahead
// of time before we actually connect and this version might change when
// we actually connect to a remote platform. For the host platform this
- // will be set to the once we call Host::GetOSVersion().
+ // will be set to the once we call HostInfo::GetOSVersion().
bool m_os_version_set_while_connected;
bool m_system_arch_set_while_connected;
ConstString m_sdk_sysroot; // the root location of where the SDK files are all located
@@ -892,6 +957,7 @@ namespace lldb_private {
std::string m_local_cache_directory;
std::vector<ConstString> m_trap_handlers;
bool m_calculated_trap_handlers;
+ Mutex m_trap_handler_mutex;
//------------------------------------------------------------------
/// Ask the Platform subclass to fill in the list of trap handler names
diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h
index b74347d37e68..641707c58deb 100644
--- a/include/lldb/Target/Process.h
+++ b/include/lldb/Target/Process.h
@@ -42,7 +42,11 @@
#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"
@@ -104,232 +108,6 @@ public:
typedef std::shared_ptr<ProcessProperties> ProcessPropertiesSP;
//----------------------------------------------------------------------
-// ProcessInfo
-//
-// A base class for information for a process. This can be used to fill
-// out information for a process prior to launching it, or it can be
-// used for an instance of a process and can be filled in with the
-// existing values for that process.
-//----------------------------------------------------------------------
-class ProcessInfo
-{
-public:
- ProcessInfo () :
- m_executable (),
- m_arguments (),
- m_environment (),
- m_uid (UINT32_MAX),
- m_gid (UINT32_MAX),
- m_arch(),
- m_pid (LLDB_INVALID_PROCESS_ID)
- {
- }
-
- ProcessInfo (const char *name,
- const ArchSpec &arch,
- lldb::pid_t pid) :
- m_executable (name, false),
- m_arguments (),
- m_environment(),
- m_uid (UINT32_MAX),
- m_gid (UINT32_MAX),
- m_arch (arch),
- m_pid (pid)
- {
- }
-
- void
- Clear ()
- {
- m_executable.Clear();
- m_arguments.Clear();
- m_environment.Clear();
- m_uid = UINT32_MAX;
- m_gid = UINT32_MAX;
- m_arch.Clear();
- m_pid = LLDB_INVALID_PROCESS_ID;
- }
-
- const char *
- GetName() const
- {
- return m_executable.GetFilename().GetCString();
- }
-
- size_t
- GetNameLength() const
- {
- return m_executable.GetFilename().GetLength();
- }
-
- FileSpec &
- GetExecutableFile ()
- {
- return m_executable;
- }
-
- void
- SetExecutableFile (const FileSpec &exe_file, bool add_exe_file_as_first_arg)
- {
- if (exe_file)
- {
- m_executable = exe_file;
- if (add_exe_file_as_first_arg)
- {
- char filename[PATH_MAX];
- if (exe_file.GetPath(filename, sizeof(filename)))
- m_arguments.InsertArgumentAtIndex (0, filename);
- }
- }
- else
- {
- m_executable.Clear();
- }
- }
-
- const FileSpec &
- GetExecutableFile () const
- {
- return m_executable;
- }
-
- uint32_t
- GetUserID() const
- {
- return m_uid;
- }
-
- uint32_t
- GetGroupID() const
- {
- return m_gid;
- }
-
- bool
- UserIDIsValid () const
- {
- return m_uid != UINT32_MAX;
- }
-
- bool
- GroupIDIsValid () const
- {
- return m_gid != UINT32_MAX;
- }
-
- void
- SetUserID (uint32_t uid)
- {
- m_uid = uid;
- }
-
- void
- SetGroupID (uint32_t gid)
- {
- m_gid = gid;
- }
-
- ArchSpec &
- GetArchitecture ()
- {
- return m_arch;
- }
-
- const ArchSpec &
- GetArchitecture () const
- {
- return m_arch;
- }
-
- void
- SetArchitecture (ArchSpec arch)
- {
- m_arch = arch;
- }
-
- lldb::pid_t
- GetProcessID () const
- {
- return m_pid;
- }
-
- void
- SetProcessID (lldb::pid_t pid)
- {
- m_pid = pid;
- }
-
- bool
- ProcessIDIsValid() const
- {
- return m_pid != LLDB_INVALID_PROCESS_ID;
- }
-
- void
- Dump (Stream &s, Platform *platform) const;
-
- Args &
- GetArguments ()
- {
- return m_arguments;
- }
-
- const Args &
- GetArguments () const
- {
- return m_arguments;
- }
-
- const char *
- GetArg0 () const
- {
- if (m_arg0.empty())
- return NULL;
- return m_arg0.c_str();
- }
-
- void
- SetArg0 (const char *arg)
- {
- if (arg && arg[0])
- m_arg0 = arg;
- else
- m_arg0.clear();
- }
-
- void
- SetArguments (const Args& args, bool first_arg_is_executable);
-
- void
- SetArguments (char const **argv, bool first_arg_is_executable);
-
- Args &
- GetEnvironmentEntries ()
- {
- return m_environment;
- }
-
- const Args &
- GetEnvironmentEntries () const
- {
- return m_environment;
- }
-
-protected:
- FileSpec m_executable;
- std::string m_arg0; // argv[0] if supported. If empty, then use m_executable.
- // Not all process plug-ins support specifying an argv[0]
- // that differs from the resolved platform executable
- // (which is in m_executable)
- Args m_arguments; // All program arguments except argv[0]
- Args m_environment;
- uint32_t m_uid;
- uint32_t m_gid;
- ArchSpec m_arch;
- lldb::pid_t m_pid;
-};
-
-//----------------------------------------------------------------------
// ProcessInstanceInfo
//
// Describes an existing process and any discoverable information that
@@ -434,445 +212,10 @@ protected:
lldb::pid_t m_parent_pid;
};
-
//----------------------------------------------------------------------
-// ProcessLaunchInfo
+// ProcessAttachInfo
//
-// Describes any information that is required to launch a process.
-//----------------------------------------------------------------------
-
-class ProcessLaunchInfo : public ProcessInfo
-{
-public:
-
- class FileAction
- {
- public:
- enum Action
- {
- eFileActionNone,
- eFileActionClose,
- eFileActionDuplicate,
- eFileActionOpen
- };
-
-
- FileAction () :
- m_action (eFileActionNone),
- m_fd (-1),
- m_arg (-1),
- m_path ()
- {
- }
-
- void
- Clear()
- {
- m_action = eFileActionNone;
- m_fd = -1;
- m_arg = -1;
- m_path.clear();
- }
-
- bool
- Close (int fd);
-
- bool
- Duplicate (int fd, int dup_fd);
-
- bool
- Open (int fd, const char *path, bool read, bool write);
-
-#ifndef LLDB_DISABLE_POSIX
- static bool
- AddPosixSpawnFileAction (void *file_actions,
- const FileAction *info,
- Log *log,
- Error& error);
-#endif
-
- int
- GetFD () const
- {
- return m_fd;
- }
-
- Action
- GetAction () const
- {
- return m_action;
- }
-
- int
- GetActionArgument () const
- {
- return m_arg;
- }
-
- const char *
- GetPath () const
- {
- if (m_path.empty())
- return NULL;
- return m_path.c_str();
- }
-
- 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
- };
-
- ProcessLaunchInfo () :
- ProcessInfo(),
- m_working_dir (),
- m_plugin_name (),
- m_shell (),
- m_flags (0),
- m_file_actions (),
- m_pty (),
- m_resume_count (0),
- m_monitor_callback (NULL),
- m_monitor_callback_baton (NULL),
- m_monitor_signals (false),
- m_hijack_listener_sp ()
- {
- }
-
- ProcessLaunchInfo (const char *stdin_path,
- const char *stdout_path,
- const char *stderr_path,
- const char *working_directory,
- uint32_t launch_flags) :
- ProcessInfo(),
- m_working_dir (),
- m_plugin_name (),
- m_shell (),
- m_flags (launch_flags),
- m_file_actions (),
- m_pty (),
- m_resume_count (0),
- m_monitor_callback (NULL),
- m_monitor_callback_baton (NULL),
- m_monitor_signals (false),
- m_hijack_listener_sp ()
- {
- if (stdin_path)
- {
- ProcessLaunchInfo::FileAction file_action;
- const bool read = true;
- const bool write = false;
- if (file_action.Open(STDIN_FILENO, stdin_path, read, write))
- AppendFileAction (file_action);
- }
- if (stdout_path)
- {
- ProcessLaunchInfo::FileAction file_action;
- const bool read = false;
- const bool write = true;
- if (file_action.Open(STDOUT_FILENO, stdout_path, read, write))
- AppendFileAction (file_action);
- }
- if (stderr_path)
- {
- ProcessLaunchInfo::FileAction file_action;
- const bool read = false;
- const bool write = true;
- if (file_action.Open(STDERR_FILENO, stderr_path, read, write))
- AppendFileAction (file_action);
- }
- if (working_directory)
- SetWorkingDirectory(working_directory);
- }
-
- void
- AppendFileAction (const FileAction &info)
- {
- m_file_actions.push_back(info);
- }
-
- bool
- AppendCloseFileAction (int fd)
- {
- FileAction file_action;
- if (file_action.Close (fd))
- {
- AppendFileAction (file_action);
- return true;
- }
- return false;
- }
-
- bool
- AppendDuplicateFileAction (int fd, int dup_fd)
- {
- FileAction file_action;
- if (file_action.Duplicate (fd, dup_fd))
- {
- AppendFileAction (file_action);
- return true;
- }
- return false;
- }
-
- bool
- AppendOpenFileAction (int fd, const char *path, bool read, bool write)
- {
- FileAction file_action;
- if (file_action.Open (fd, path, read, write))
- {
- AppendFileAction (file_action);
- return true;
- }
- return false;
- }
-
- bool
- AppendSuppressFileAction (int fd, bool read, bool write)
- {
- FileAction file_action;
- if (file_action.Open (fd, "/dev/null", read, write))
- {
- AppendFileAction (file_action);
- return true;
- }
- return false;
- }
-
- void
- FinalizeFileActions (Target *target,
- bool default_to_use_pty);
-
- size_t
- GetNumFileActions () const
- {
- return m_file_actions.size();
- }
-
- const FileAction *
- GetFileActionAtIndex (size_t idx) const
- {
- if (idx < m_file_actions.size())
- return &m_file_actions[idx];
- return NULL;
- }
-
- const FileAction *
- GetFileActionForFD (int fd) const
- {
- for (size_t idx=0, count=m_file_actions.size(); idx < count; ++idx)
- {
- if (m_file_actions[idx].GetFD () == fd)
- return &m_file_actions[idx];
- }
- return NULL;
- }
-
- Flags &
- GetFlags ()
- {
- return m_flags;
- }
-
- const Flags &
- GetFlags () const
- {
- return m_flags;
- }
-
- const char *
- GetWorkingDirectory () const
- {
- if (m_working_dir.empty())
- return NULL;
- return m_working_dir.c_str();
- }
-
- void
- SetWorkingDirectory (const char *working_dir)
- {
- if (working_dir && working_dir[0])
- m_working_dir.assign (working_dir);
- else
- m_working_dir.clear();
- }
-
- void
- SwapWorkingDirectory (std::string &working_dir)
- {
- m_working_dir.swap (working_dir);
- }
-
-
- const char *
- GetProcessPluginName () const
- {
- if (m_plugin_name.empty())
- return NULL;
- return m_plugin_name.c_str();
- }
-
- void
- SetProcessPluginName (const char *plugin)
- {
- if (plugin && plugin[0])
- m_plugin_name.assign (plugin);
- else
- m_plugin_name.clear();
- }
-
- const char *
- GetShell () const
- {
- if (m_shell.empty())
- return NULL;
- return m_shell.c_str();
- }
-
- void
- SetShell (const char * path)
- {
- if (path && path[0])
- {
- m_shell.assign (path);
- m_flags.Set (lldb::eLaunchFlagLaunchInShell);
- }
- else
- {
- m_shell.clear();
- m_flags.Clear (lldb::eLaunchFlagLaunchInShell);
- }
- }
-
- uint32_t
- GetResumeCount () const
- {
- return m_resume_count;
- }
-
- void
- SetResumeCount (uint32_t c)
- {
- m_resume_count = c;
- }
-
- bool
- GetLaunchInSeparateProcessGroup ()
- {
- return m_flags.Test(lldb::eLaunchFlagLaunchInSeparateProcessGroup);
- }
-
- void
- SetLaunchInSeparateProcessGroup (bool separate)
- {
- if (separate)
- m_flags.Set(lldb::eLaunchFlagLaunchInSeparateProcessGroup);
- else
- m_flags.Clear (lldb::eLaunchFlagLaunchInSeparateProcessGroup);
-
- }
-
- void
- Clear ()
- {
- ProcessInfo::Clear();
- m_working_dir.clear();
- m_plugin_name.clear();
- m_shell.clear();
- m_flags.Clear();
- m_file_actions.clear();
- m_resume_count = 0;
- m_hijack_listener_sp.reset();
- }
-
- bool
- ConvertArgumentsForLaunchingInShell (Error &error,
- bool localhost,
- bool will_debug,
- bool first_arg_is_full_shell_command,
- int32_t num_resumes);
-
- void
- SetMonitorProcessCallback (Host::MonitorChildProcessCallback callback,
- void *baton,
- bool monitor_signals)
- {
- m_monitor_callback = callback;
- m_monitor_callback_baton = baton;
- m_monitor_signals = monitor_signals;
- }
-
- Host::MonitorChildProcessCallback
- GetMonitorProcessCallback ()
- {
- return m_monitor_callback;
- }
-
- const void*
- GetMonitorProcessBaton () const
- {
- return m_monitor_callback_baton;
- }
-
- // If the LaunchInfo has a monitor callback, then arrange to monitor the process.
- // Return true if the LaunchInfo has taken care of monitoring the process, and false if the
- // caller might want to monitor the process themselves.
-
- bool
- MonitorProcess () const
- {
- if (GetFlags().Test(lldb::eLaunchFlagsDontMonitorProcess))
- return true;
-
- if (m_monitor_callback && ProcessIDIsValid())
- {
- Host::StartMonitoringChildProcess (m_monitor_callback,
- m_monitor_callback_baton,
- GetProcessID(),
- m_monitor_signals);
- return true;
- }
- return false;
- }
-
- lldb_utility::PseudoTerminal &
- GetPTY ()
- {
- return m_pty;
- }
-
- lldb::ListenerSP
- GetHijackListener () const
- {
- return m_hijack_listener_sp;
- }
-
- void
- SetHijackListener (const lldb::ListenerSP &listener_sp)
- {
- m_hijack_listener_sp = listener_sp;
- }
-
-
-protected:
- std::string m_working_dir;
- std::string m_plugin_name;
- std::string m_shell;
- Flags m_flags; // Bitwise OR of bits from lldb::LaunchFlags
- std::vector<FileAction> m_file_actions; // File actions for any other files
- lldb_utility::PseudoTerminal m_pty;
- uint32_t m_resume_count; // How many times do we resume after launching
- Host::MonitorChildProcessCallback m_monitor_callback;
- void *m_monitor_callback_baton;
- bool m_monitor_signals;
- lldb::ListenerSP m_hijack_listener_sp;
-};
-
-//----------------------------------------------------------------------
-// ProcessLaunchInfo
-//
-// Describes any information that is required to launch a process.
+// Describes any information that is required to attach to a process.
//----------------------------------------------------------------------
class ProcessAttachInfo : public ProcessInstanceInfo
@@ -884,7 +227,8 @@ public:
m_resume_count (0),
m_wait_for_launch (false),
m_ignore_existing (true),
- m_continue_once_attached (false)
+ m_continue_once_attached (false),
+ m_detach_on_error (true)
{
}
@@ -894,12 +238,14 @@ public:
m_resume_count (0),
m_wait_for_launch (false),
m_ignore_existing (true),
- m_continue_once_attached (false)
+ m_continue_once_attached (false),
+ m_detach_on_error(true)
{
ProcessInfo::operator= (launch_info);
SetProcessPluginName (launch_info.GetProcessPluginName());
SetResumeCount (launch_info.GetResumeCount());
SetHijackListener(launch_info.GetHijackListener());
+ m_detach_on_error = launch_info.GetDetachOnError();
}
bool
@@ -1002,7 +348,18 @@ public:
m_hijack_listener_sp = listener_sp;
}
-
+ bool
+ GetDetachOnError () const
+ {
+ return m_detach_on_error;
+ }
+
+ void
+ SetDetachOnError (bool enable)
+ {
+ m_detach_on_error = enable;
+ }
+
protected:
lldb::ListenerSP m_hijack_listener_sp;
std::string m_plugin_name;
@@ -1010,6 +367,7 @@ protected:
bool m_wait_for_launch;
bool m_ignore_existing;
bool m_continue_once_attached; // Supports the use-case scenario of immediately continuing the process once attached.
+ bool m_detach_on_error; // If we are debugging remotely, instruct the stub to detach rather than killing the target on error.
};
class ProcessLaunchCommandOptions : public Options
@@ -1034,6 +392,7 @@ public:
OptionParsingStarting ()
{
launch_info.Clear();
+ disable_aslr = eLazyBoolCalculate;
}
const OptionDefinition*
@@ -1049,6 +408,7 @@ public:
// Instance variables to hold the values for command options.
ProcessLaunchInfo launch_info;
+ lldb_private::LazyBool disable_aslr;
};
//----------------------------------------------------------------------
@@ -1321,91 +681,6 @@ inline bool operator!= (const ProcessModID &lhs, const ProcessModID &rhs)
return false;
}
-class MemoryRegionInfo
-{
-public:
- typedef Range<lldb::addr_t, lldb::addr_t> RangeType;
-
- enum OptionalBool {
- eDontKnow = -1,
- eNo = 0,
- eYes = 1
- };
-
- MemoryRegionInfo () :
- m_range (),
- m_read (eDontKnow),
- m_write (eDontKnow),
- m_execute (eDontKnow)
- {
- }
-
- ~MemoryRegionInfo ()
- {
- }
-
- RangeType &
- GetRange()
- {
- return m_range;
- }
-
- void
- Clear()
- {
- m_range.Clear();
- m_read = m_write = m_execute = eDontKnow;
- }
-
- const RangeType &
- GetRange() const
- {
- return m_range;
- }
-
- OptionalBool
- GetReadable () const
- {
- return m_read;
- }
-
- OptionalBool
- GetWritable () const
- {
- return m_write;
- }
-
- OptionalBool
- GetExecutable () const
- {
- return m_execute;
- }
-
- void
- SetReadable (OptionalBool val)
- {
- m_read = val;
- }
-
- void
- SetWritable (OptionalBool val)
- {
- m_write = val;
- }
-
- void
- SetExecutable (OptionalBool val)
- {
- m_execute = val;
- }
-
-protected:
- RangeType m_range;
- OptionalBool m_read;
- OptionalBool m_write;
- OptionalBool m_execute;
-};
-
//----------------------------------------------------------------------
/// @class Process Process.h "lldb/Target/Process.h"
/// @brief A plug-in interface definition class for debugging a process.
@@ -1418,7 +693,8 @@ class Process :
public ExecutionContextScope,
public PluginInterface
{
- friend class ClangFunction; // For WaitForStateChangeEventsPrivate
+ friend class ClangFunction; // For WaitForStateChangeEventsPrivate
+ friend class Debugger; // For PopProcessIOHandler and ProcessIOHandlerIsActive
friend class ProcessEventData;
friend class StopInfo;
friend class Target;
@@ -1619,10 +895,17 @@ public:
//------------------------------------------------------------------
/// Construct with a shared pointer to a target, and the Process listener.
+ /// Uses the Host UnixSignalsSP by default.
//------------------------------------------------------------------
Process(Target &target, Listener &listener);
//------------------------------------------------------------------
+ /// Construct with a shared pointer to a target, the Process listener,
+ /// and the appropriate UnixSignalsSP for the process.
+ //------------------------------------------------------------------
+ Process(Target &target, Listener &listener, const UnixSignalsSP &unix_signals_sp);
+
+ //------------------------------------------------------------------
/// Destructor.
///
/// The destructor is virtual since this class is designed to be
@@ -1753,10 +1036,6 @@ public:
///
/// Launch a new process by spawning a new process using the
/// target object's executable module's file as the file to launch.
- /// Arguments are given in \a argv, and the environment variables
- /// are in \a envp. Standard input and output files can be
- /// optionally re-directed to \a stdin_path, \a stdout_path, and
- /// \a stderr_path.
///
/// This function is not meant to be overridden by Process
/// subclasses. It will first call Process::WillLaunch (Module *)
@@ -1766,32 +1045,9 @@ public:
/// DoLaunch returns \b true, then Process::DidLaunch() will be
/// called.
///
- /// @param[in] argv
- /// The argument array.
- ///
- /// @param[in] envp
- /// The environment array.
- ///
- /// @param[in] launch_flags
- /// Flags to modify the launch (@see lldb::LaunchFlags)
- ///
- /// @param[in] stdin_path
- /// The path to use when re-directing the STDIN of the new
- /// process. If all stdXX_path arguments are NULL, a pseudo
- /// terminal will be used.
- ///
- /// @param[in] stdout_path
- /// The path to use when re-directing the STDOUT of the new
- /// process. If all stdXX_path arguments are NULL, a pseudo
- /// terminal will be used.
- ///
- /// @param[in] stderr_path
- /// The path to use when re-directing the STDERR of the new
- /// process. If all stdXX_path arguments are NULL, a pseudo
- /// terminal will be used.
- ///
- /// @param[in] working_directory
- /// The working directory to have the child process run in
+ /// @param[in] launch_info
+ /// Details regarding the environment, STDIN/STDOUT/STDERR
+ /// redirection, working path, etc. related to the requested launch.
///
/// @return
/// An error object. Call GetID() to get the process ID if
@@ -1824,6 +1080,22 @@ public:
GetDynamicLoader ();
//------------------------------------------------------------------
+ // Returns AUXV structure found in many ELF-based environments.
+ //
+ // The default action is to return an empty data buffer.
+ //
+ // @return
+ // A data buffer containing the contents of the AUXV data.
+ //------------------------------------------------------------------
+ virtual const lldb::DataBufferSP
+ GetAuxvData();
+
+protected:
+ virtual JITLoaderList &
+ GetJITLoaders ();
+
+public:
+ //------------------------------------------------------------------
/// Get the system runtime plug-in for this process.
///
/// @return
@@ -1930,7 +1202,7 @@ public:
//------------------------------------------------------------------
/// Register for process and thread notifications.
///
- /// Clients can register nofication callbacks by filling out a
+ /// Clients can register notification callbacks by filling out a
/// Process::Notifications structure and calling this function.
///
/// @param[in] callbacks
@@ -1946,7 +1218,7 @@ public:
//------------------------------------------------------------------
/// Unregister for process and thread notifications.
///
- /// Clients can unregister nofication callbacks by passing a copy of
+ /// Clients can unregister notification callbacks by passing a copy of
/// the original baton and callbacks in \a callbacks.
///
/// @param[in] callbacks
@@ -2056,10 +1328,18 @@ public:
Error
Signal (int signal);
- virtual UnixSignals &
+ void
+ SetUnixSignals (const UnixSignalsSP &signals_sp)
+ {
+ assert (signals_sp && "null signals_sp");
+ m_unix_signals_sp = signals_sp;
+ }
+
+ UnixSignals &
GetUnixSignals ()
{
- return m_unix_signals;
+ assert (m_unix_signals_sp && "null m_unix_signals_sp");
+ return *m_unix_signals_sp;
}
//==================================================================
@@ -2183,11 +1463,17 @@ public:
//------------------------------------------------------------------
/// Called after attaching a process.
///
+ /// @param[in] process_arch
+ /// If you can figure out the process architecture after attach, fill it in here.
+ ///
/// Allow Process plug-ins to execute some code after attaching to
/// a process.
//------------------------------------------------------------------
virtual void
- DidAttach () {}
+ DidAttach (ArchSpec &process_arch)
+ {
+ process_arch.Clear();
+ }
//------------------------------------------------------------------
@@ -2229,46 +1515,21 @@ public:
//------------------------------------------------------------------
/// Launch a new process.
///
- /// Launch a new process by spawning a new process using \a module's
- /// file as the file to launch. Arguments are given in \a argv,
- /// and the environment variables are in \a envp. Standard input
- /// and output files can be optionally re-directed to \a stdin_path,
- /// \a stdout_path, and \a stderr_path.
+ /// Launch a new process by spawning a new process using
+ /// \a exe_module's file as the file to launch. Launch details are
+ /// provided in \a launch_info.
///
- /// @param[in] module
+ /// @param[in] exe_module
/// The module from which to extract the file specification and
/// launch.
///
- /// @param[in] argv
- /// The argument array.
- ///
- /// @param[in] envp
- /// The environment array.
- ///
- /// @param[in] launch_flags
- /// Flags to modify the launch (@see lldb::LaunchFlags)
- ///
- /// @param[in] stdin_path
- /// The path to use when re-directing the STDIN of the new
- /// process. If all stdXX_path arguments are NULL, a pseudo
- /// terminal will be used.
- ///
- /// @param[in] stdout_path
- /// The path to use when re-directing the STDOUT of the new
- /// process. If all stdXX_path arguments are NULL, a pseudo
- /// terminal will be used.
- ///
- /// @param[in] stderr_path
- /// The path to use when re-directing the STDERR of the new
- /// process. If all stdXX_path arguments are NULL, a pseudo
- /// terminal will be used.
- ///
- /// @param[in] working_directory
- /// The working directory to have the child process run in
+ /// @param[in] launch_info
+ /// Details (e.g. arguments, stdio redirection, etc.) for the
+ /// requested launch.
///
/// @return
- /// A new valid process ID, or LLDB_INVALID_PROCESS_ID if
- /// launching fails.
+ /// An Error instance indicating success or failure of the
+ /// operation.
//------------------------------------------------------------------
virtual Error
DoLaunch (Module *exe_module,
@@ -2454,7 +1715,7 @@ public:
DoSignal (int signal)
{
Error error;
- error.SetErrorStringWithFormat("error: %s does not support senging signals to processes", GetPluginName().GetCString());
+ error.SetErrorStringWithFormat("error: %s does not support sending signals to processes", GetPluginName().GetCString());
return error;
}
@@ -2546,14 +1807,14 @@ public:
lldb::StateType
GetState ();
- ExecutionResults
+ lldb::ExpressionResults
RunThreadPlan (ExecutionContext &exe_ctx,
lldb::ThreadPlanSP &thread_plan_sp,
const EvaluateExpressionOptions &options,
Stream &errors);
static const char *
- ExecutionResultAsCString (ExecutionResults result);
+ ExecutionResultAsCString (lldb::ExpressionResults result);
void
GetStatus (Stream &ostrm);
@@ -2568,6 +1829,9 @@ public:
void
SendAsyncInterrupt ();
+ void
+ ModulesDidLoad (ModuleList &module_list);
+
protected:
void
@@ -2904,7 +2168,7 @@ public:
///
/// The value contained in \a scalar will be swapped to match the
/// byte order of the process that is being debugged. If \a size is
- /// less than the size of scalar, the least significate \a size bytes
+ /// less than the size of scalar, the least significant \a size bytes
/// from scalar will be written. If \a size is larger than the byte
/// size of scalar, then the extra space will be padded with zeros
/// and the scalar value will be placed in the least significant
@@ -3070,7 +2334,8 @@ public:
lldb::ModuleSP
ReadModuleFromMemory (const FileSpec& file_spec,
- lldb::addr_t header_addr);
+ lldb::addr_t header_addr,
+ size_t size_to_read = 512);
//------------------------------------------------------------------
/// Attempt to get the attributes for a region of memory in the process.
@@ -3412,6 +2677,25 @@ public:
bool wait_always = true,
Listener *hijack_listener = NULL);
+
+ //--------------------------------------------------------------------------------------
+ /// Waits for the process state to be running within a given msec timeout.
+ ///
+ /// The main purpose of this is to implement an interlock waiting for HandlePrivateEvent
+ /// to push an IOHandler.
+ ///
+ /// @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);
+
+
lldb::StateType
WaitForStateChangedEvents (const TimeValue *timeout,
lldb::EventSP &event_sp,
@@ -3582,12 +2866,6 @@ public:
void
SetSTDIOFileDescriptor (int file_descriptor);
- void
- WatchForSTDIN (IOHandler &io_handler);
-
- void
- CancelWatchForSTDIN (bool exited);
-
//------------------------------------------------------------------
// Add a permanent region of memory that should never be read or
// written to. This can be used to ensure that memory reads or writes
@@ -3633,8 +2911,17 @@ public:
else
return m_public_run_lock;
}
-
+
+public:
+ virtual Error
+ SendEventData(const char *data)
+ {
+ Error return_error ("Sending an event is not supported for this process.");
+ return return_error;
+ }
+
protected:
+
//------------------------------------------------------------------
// NextEventAction provides a way to register an action on the next
// event that is delivered to this process. There is currently only
@@ -3690,13 +2977,9 @@ protected:
class AttachCompletionHandler : public NextEventAction
{
public:
- AttachCompletionHandler (Process *process, uint32_t exec_count) :
- NextEventAction (process),
- m_exec_count (exec_count)
- {
- }
+ AttachCompletionHandler (Process *process, uint32_t exec_count);
- virtual
+ virtual
~AttachCompletionHandler()
{
}
@@ -3753,7 +3036,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.
- lldb::thread_t m_private_state_thread; // Thread ID for the thread that watches interal state events
+ lldb::thread_t 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.
@@ -3773,10 +3056,11 @@ protected:
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;
- UnixSignals m_unix_signals; /// This is the current signal set for this process.
+ 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;
@@ -3785,6 +3069,7 @@ protected:
std::string m_stderr_data;
Mutex m_profile_data_comm_mutex;
std::vector<std::string> m_profile_data;
+ Predicate<bool> 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?
@@ -3874,15 +3159,15 @@ protected:
static void
STDIOReadThreadBytesReceived (void *baton, const void *src, size_t src_len);
- void
+ bool
PushProcessIOHandler ();
- void
+ bool
PopProcessIOHandler ();
- void
- ResetProcessIOHandler ();
-
+ bool
+ ProcessIOHandlerIsActive ();
+
Error
HaltForDestroyOrDetach(lldb::EventSP &exit_event_sp);
diff --git a/include/lldb/Target/ProcessInfo.h b/include/lldb/Target/ProcessInfo.h
new file mode 100644
index 000000000000..0570cfc98651
--- /dev/null
+++ b/include/lldb/Target/ProcessInfo.h
@@ -0,0 +1,188 @@
+//===-- ProcessInfo.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_ProcessInfo_h_
+#define liblldb_ProcessInfo_h_
+
+// LLDB headers
+#include "lldb/Core/ArchSpec.h"
+#include "lldb/Host/FileSpec.h"
+#include "lldb/Interpreter/Args.h"
+
+namespace lldb_private
+{
+ //----------------------------------------------------------------------
+ // ProcessInfo
+ //
+ // A base class for information for a process. This can be used to fill
+ // out information for a process prior to launching it, or it can be
+ // used for an instance of a process and can be filled in with the
+ // existing values for that process.
+ //----------------------------------------------------------------------
+ class ProcessInfo
+ {
+ public:
+ ProcessInfo ();
+
+ ProcessInfo (const char *name,
+ const ArchSpec &arch,
+ lldb::pid_t pid);
+
+ void
+ Clear ();
+
+ const char *
+ GetName() const;
+
+ size_t
+ GetNameLength() const;
+
+ FileSpec &
+ GetExecutableFile ()
+ {
+ return m_executable;
+ }
+
+ void
+ SetExecutableFile (const FileSpec &exe_file, bool add_exe_file_as_first_arg);
+
+ const FileSpec &
+ GetExecutableFile () const
+ {
+ return m_executable;
+ }
+
+ uint32_t
+ GetUserID() const
+ {
+ return m_uid;
+ }
+
+ uint32_t
+ GetGroupID() const
+ {
+ return m_gid;
+ }
+
+ bool
+ UserIDIsValid () const
+ {
+ return m_uid != UINT32_MAX;
+ }
+
+ bool
+ GroupIDIsValid () const
+ {
+ return m_gid != UINT32_MAX;
+ }
+
+ void
+ SetUserID (uint32_t uid)
+ {
+ m_uid = uid;
+ }
+
+ void
+ SetGroupID (uint32_t gid)
+ {
+ m_gid = gid;
+ }
+
+ ArchSpec &
+ GetArchitecture ()
+ {
+ return m_arch;
+ }
+
+ const ArchSpec &
+ GetArchitecture () const
+ {
+ return m_arch;
+ }
+
+ void
+ SetArchitecture (ArchSpec arch)
+ {
+ m_arch = arch;
+ }
+
+ lldb::pid_t
+ GetProcessID () const
+ {
+ return m_pid;
+ }
+
+ void
+ SetProcessID (lldb::pid_t pid)
+ {
+ m_pid = pid;
+ }
+
+ bool
+ ProcessIDIsValid() const
+ {
+ return m_pid != LLDB_INVALID_PROCESS_ID;
+ }
+
+ void
+ Dump (Stream &s, Platform *platform) const;
+
+ Args &
+ GetArguments ()
+ {
+ return m_arguments;
+ }
+
+ const Args &
+ GetArguments () const
+ {
+ return m_arguments;
+ }
+
+ const char *
+ GetArg0 () const;
+
+ void
+ SetArg0 (const char *arg);
+
+ void
+ SetArguments (const Args& args, bool first_arg_is_executable);
+
+ void
+ SetArguments (char const **argv, bool first_arg_is_executable);
+
+ Args &
+ GetEnvironmentEntries ()
+ {
+ return m_environment;
+ }
+
+ const Args &
+ GetEnvironmentEntries () const
+ {
+ return m_environment;
+ }
+
+ protected:
+ FileSpec m_executable;
+ std::string m_arg0; // argv[0] if supported. If empty, then use m_executable.
+ // Not all process plug-ins support specifying an argv[0]
+ // that differs from the resolved platform executable
+ // (which is in m_executable)
+ Args m_arguments; // All program arguments except argv[0]
+ Args m_environment;
+ uint32_t m_uid;
+ uint32_t m_gid;
+ ArchSpec m_arch;
+ lldb::pid_t m_pid;
+ };
+}
+
+#endif // #ifndef liblldb_ProcessInfo_h_
+
diff --git a/include/lldb/Target/ProcessLaunchInfo.h b/include/lldb/Target/ProcessLaunchInfo.h
new file mode 100644
index 000000000000..77d829a7e476
--- /dev/null
+++ b/include/lldb/Target/ProcessLaunchInfo.h
@@ -0,0 +1,225 @@
+//===-- ProcessLaunchInfo.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_ProcessLaunch_Info_h
+#define liblldb_ProcessLaunch_Info_h
+
+// C++ Headers
+#include <string>
+
+// LLDB Headers
+#include "lldb/Core/Flags.h"
+#include "lldb/Host/Host.h"
+#include "lldb/Target/FileAction.h"
+#include "lldb/Target/ProcessInfo.h"
+#include "lldb/Utility/PseudoTerminal.h"
+
+namespace lldb_private
+{
+
+ //----------------------------------------------------------------------
+ // ProcessLaunchInfo
+ //
+ // Describes any information that is required to launch a process.
+ //----------------------------------------------------------------------
+
+ class ProcessLaunchInfo : public ProcessInfo
+ {
+ public:
+
+ ProcessLaunchInfo ();
+
+ ProcessLaunchInfo (const char *stdin_path,
+ const char *stdout_path,
+ const char *stderr_path,
+ const char *working_directory,
+ uint32_t launch_flags);
+
+ void
+ AppendFileAction (const FileAction &info)
+ {
+ m_file_actions.push_back(info);
+ }
+
+ bool
+ AppendCloseFileAction (int fd);
+
+ bool
+ AppendDuplicateFileAction (int fd, int dup_fd);
+
+ bool
+ AppendOpenFileAction (int fd, const char *path, bool read, bool write);
+
+ bool
+ AppendSuppressFileAction (int fd, bool read, bool write);
+
+ void
+ FinalizeFileActions (Target *target,
+ bool default_to_use_pty);
+
+ size_t
+ GetNumFileActions () const
+ {
+ return m_file_actions.size();
+ }
+
+ const FileAction *
+ GetFileActionAtIndex (size_t idx) const;
+
+ const FileAction *
+ GetFileActionForFD (int fd) const;
+
+ Flags &
+ GetFlags ()
+ {
+ return m_flags;
+ }
+
+ const Flags &
+ GetFlags () const
+ {
+ return m_flags;
+ }
+
+ const char *
+ GetWorkingDirectory () const;
+
+ void
+ SetWorkingDirectory (const char *working_dir);
+
+ void
+ SwapWorkingDirectory (std::string &working_dir)
+ {
+ m_working_dir.swap (working_dir);
+ }
+
+ const char *
+ GetProcessPluginName () const;
+
+ void
+ SetProcessPluginName (const char *plugin);
+
+ const char *
+ GetShell () const;
+
+ void
+ SetShell (const char * path);
+
+ uint32_t
+ GetResumeCount () const
+ {
+ return m_resume_count;
+ }
+
+ void
+ SetResumeCount (uint32_t c)
+ {
+ m_resume_count = c;
+ }
+
+ bool
+ GetLaunchInSeparateProcessGroup ()
+ {
+ return m_flags.Test(lldb::eLaunchFlagLaunchInSeparateProcessGroup);
+ }
+
+ void
+ SetLaunchInSeparateProcessGroup (bool separate);
+
+ void
+ Clear ();
+
+ bool
+ ConvertArgumentsForLaunchingInShell (Error &error,
+ bool localhost,
+ bool will_debug,
+ bool first_arg_is_full_shell_command,
+ int32_t num_resumes);
+
+ void
+ SetMonitorProcessCallback (Host::MonitorChildProcessCallback callback,
+ void *baton,
+ bool monitor_signals);
+
+ Host::MonitorChildProcessCallback
+ GetMonitorProcessCallback ()
+ {
+ return m_monitor_callback;
+ }
+
+ const void*
+ GetMonitorProcessBaton () const
+ {
+ return m_monitor_callback_baton;
+ }
+
+ // If the LaunchInfo has a monitor callback, then arrange to monitor the process.
+ // Return true if the LaunchInfo has taken care of monitoring the process, and false if the
+ // caller might want to monitor the process themselves.
+
+ bool
+ MonitorProcess () const;
+
+ lldb_utility::PseudoTerminal &
+ GetPTY ()
+ {
+ return m_pty;
+ }
+
+ lldb::ListenerSP
+ GetHijackListener () const
+ {
+ return m_hijack_listener_sp;
+ }
+
+ void
+ SetHijackListener (const lldb::ListenerSP &listener_sp)
+ {
+ m_hijack_listener_sp = listener_sp;
+ }
+
+
+ void
+ SetLaunchEventData (const char *data)
+ {
+ m_event_data.assign (data);
+ }
+
+ const char *
+ GetLaunchEventData () const
+ {
+ return m_event_data.c_str();
+ }
+
+ void
+ SetDetachOnError (bool enable);
+
+ bool
+ GetDetachOnError () const
+ {
+ return m_flags.Test(lldb::eLaunchFlagDetachOnError);
+ }
+
+ protected:
+ std::string m_working_dir;
+ std::string m_plugin_name;
+ std::string m_shell;
+ Flags m_flags; // Bitwise OR of bits from lldb::LaunchFlags
+ std::vector<FileAction> m_file_actions; // File actions for any other files
+ lldb_utility::PseudoTerminal m_pty;
+ uint32_t m_resume_count; // How many times do we resume after launching
+ Host::MonitorChildProcessCallback m_monitor_callback;
+ void *m_monitor_callback_baton;
+ bool m_monitor_signals;
+ std::string m_event_data; // A string passed to the plugin launch, having no meaning to the upper levels of lldb.
+ lldb::ListenerSP m_hijack_listener_sp;
+ };
+}
+
+#endif // liblldb_ProcessLaunch_Info_h
diff --git a/include/lldb/Target/Queue.h b/include/lldb/Target/Queue.h
index 32ee24aebc11..514481fe8c9d 100644
--- a/include/lldb/Target/Queue.h
+++ b/include/lldb/Target/Queue.h
@@ -168,6 +168,18 @@ public:
m_pending_items.push_back (item);
}
+ //------------------------------------------------------------------
+ /// Return the kind (serial, concurrent) of this queue
+ ///
+ /// @return
+ // Whether this is a serial or a concurrent queue
+ //------------------------------------------------------------------
+ lldb::QueueKind
+ GetKind ();
+
+ void
+ SetKind (lldb::QueueKind kind);
+
private:
//------------------------------------------------------------------
// For Queue only
@@ -180,6 +192,7 @@ private:
uint32_t m_pending_work_items_count;
std::vector<lldb::QueueItemSP> m_pending_items;
lldb::addr_t m_dispatch_queue_t_addr; // address of libdispatch dispatch_queue_t for this Queue
+ lldb::QueueKind m_kind;
DISALLOW_COPY_AND_ASSIGN (Queue);
};
diff --git a/include/lldb/Target/QueueItem.h b/include/lldb/Target/QueueItem.h
index 76270da3bee6..c69c825a7976 100644
--- a/include/lldb/Target/QueueItem.h
+++ b/include/lldb/Target/QueueItem.h
@@ -14,6 +14,7 @@
#include "lldb/lldb-private.h"
#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/ConstString.h"
@@ -37,7 +38,7 @@ class QueueItem :
{
public:
- QueueItem (lldb::QueueSP queue_sp);
+ QueueItem (lldb::QueueSP queue_sp, lldb::ProcessSP process_sp, lldb::addr_t item_ref, lldb_private::Address address);
~QueueItem ();
@@ -49,7 +50,7 @@ public:
/// represents. eQueueItemKindUnknown may be returned.
//------------------------------------------------------------------
lldb::QueueItemKind
- GetKind () const;
+ GetKind ();
//------------------------------------------------------------------
/// Set the type of work item this is
@@ -124,10 +125,7 @@ public:
}
lldb::addr_t
- GetItemThatEnqueuedThis ()
- {
- return m_item_that_enqueued_this_ref;
- }
+ GetItemThatEnqueuedThis ();
void
SetEnqueueingThreadID (lldb::tid_t tid)
@@ -136,10 +134,7 @@ public:
}
lldb::tid_t
- GetEnqueueingThreadID ()
- {
- return m_enqueueing_thread_id;
- }
+ GetEnqueueingThreadID ();
void
SetEnqueueingQueueID (lldb::queue_id_t qid)
@@ -148,10 +143,7 @@ public:
}
lldb::queue_id_t
- GetEnqueueingQueueID ()
- {
- return m_enqueueing_queue_id;
- }
+ GetEnqueueingQueueID ();
void
SetTargetQueueID (lldb::queue_id_t qid)
@@ -166,10 +158,7 @@ public:
}
uint32_t
- GetStopID ()
- {
- return m_stop_id;
- }
+ GetStopID ();
void
SetEnqueueingBacktrace (std::vector<lldb::addr_t> backtrace)
@@ -178,10 +167,7 @@ public:
}
std::vector<lldb::addr_t> &
- GetEnqueueingBacktrace ()
- {
- return m_backtrace;
- }
+ GetEnqueueingBacktrace ();
void
SetThreadLabel (std::string thread_name)
@@ -190,10 +176,7 @@ public:
}
std::string
- GetThreadLabel ()
- {
- return m_thread_label;
- }
+ GetThreadLabel ();
void
SetQueueLabel (std::string queue_name)
@@ -202,10 +185,7 @@ public:
}
std::string
- GetQueueLabel ()
- {
- return m_queue_label;
- }
+ GetQueueLabel ();
void
SetTargetQueueLabel (std::string queue_name)
@@ -213,11 +193,22 @@ public:
m_target_queue_label = queue_name;
}
+ lldb::ProcessSP
+ GetProcessSP ();
+
protected:
+ void
+ FetchEntireItem ();
+
+
lldb::QueueWP m_queue_wp;
- lldb::QueueItemKind m_kind;
+ lldb::ProcessWP m_process_wp;
+
+ lldb::addr_t m_item_ref; // the token we can be used to fetch more information about this queue item
lldb_private::Address m_address;
+ bool m_have_fetched_entire_item;
+ lldb::QueueItemKind m_kind;
lldb::addr_t m_item_that_enqueued_this_ref; // a handle that we can pass into libBacktraceRecording
// to get the QueueItem that enqueued this item
lldb::tid_t m_enqueueing_thread_id; // thread that enqueued this item
diff --git a/include/lldb/Target/QueueList.h b/include/lldb/Target/QueueList.h
index 964c1099233e..12a0ea52d7f4 100644
--- a/include/lldb/Target/QueueList.h
+++ b/include/lldb/Target/QueueList.h
@@ -98,7 +98,7 @@ public:
///
/// @return
/// A QueueSP to the queue requested, if it is present in the QueueList.
- /// An empty QueueSP willbe returned if this queue was not found.
+ /// An empty QueueSP will be returned if this queue was not found.
//------------------------------------------------------------------
lldb::QueueSP
FindQueueByID (lldb::queue_id_t qid);
@@ -114,7 +114,7 @@ public:
///
/// @return
/// A QueueSP to the queue requested, if it is present in the QueueList.
- /// An empty QueueSP willbe returned if this queue was not found.
+ /// An empty QueueSP will be returned if this queue was not found.
//------------------------------------------------------------------
lldb::QueueSP
FindQueueByIndexID (uint32_t index_id);
diff --git a/include/lldb/Target/RegisterContext.h b/include/lldb/Target/RegisterContext.h
index 421acc03cb22..9108d4575259 100644
--- a/include/lldb/Target/RegisterContext.h
+++ b/include/lldb/Target/RegisterContext.h
@@ -86,9 +86,44 @@ public:
bool
CopyFromRegisterContext (lldb::RegisterContextSP context);
-
+
+ //------------------------------------------------------------------
+ /// Convert from a given register numbering scheme to the lldb register
+ /// numbering scheme
+ ///
+ /// There may be multiple ways to enumerate the registers for a given
+ /// architecture. ABI references will specify one to be used with
+ /// DWARF, the register numberings from stabs (aka "gcc"), there may
+ /// be a variation used for eh_frame unwind instructions (e.g. on Darwin),
+ /// and so on. Register 5 by itself is meaningless - RegisterKind
+ /// enumeration tells you what context that number should be translated as.
+ ///
+ /// Inside lldb, register numbers are in the eRegisterKindLLDB scheme;
+ /// arguments which take a register number should take one in that
+ /// scheme.
+ ///
+ /// eRegisterKindGeneric is a special numbering scheme which gives us
+ /// constant values for the pc, frame register, stack register, etc., for
+ /// use within lldb. They may not be defined for all architectures but
+ /// it allows generic code to translate these common registers into the
+ /// lldb numbering scheme.
+ ///
+ /// This method translates a given register kind + register number into
+ /// the eRegisterKindLLDB register numbering.
+ ///
+ /// @param [in] kind
+ /// The register numbering scheme (RegisterKind) that the following
+ /// register number is in.
+ ///
+ /// @param [in] num
+ /// A register number in the 'kind' register numbering scheme.
+ ///
+ /// @return
+ /// The equivalent register number in the eRegisterKindLLDB
+ /// numbering scheme, if possible, else LLDB_INVALID_REGNUM.
+ //------------------------------------------------------------------
virtual uint32_t
- ConvertRegisterKindToRegisterNumber (uint32_t kind, uint32_t num) = 0;
+ ConvertRegisterKindToRegisterNumber (lldb::RegisterKind kind, uint32_t num) = 0;
//------------------------------------------------------------------
// Subclasses can override these functions if desired
@@ -136,7 +171,7 @@ public:
GetRegisterInfoByName (const char *reg_name, uint32_t start_idx = 0);
const RegisterInfo *
- GetRegisterInfo (uint32_t reg_kind, uint32_t reg_num);
+ GetRegisterInfo (lldb::RegisterKind reg_kind, uint32_t reg_num);
uint64_t
GetPC (uint64_t fail_value = LLDB_INVALID_ADDRESS);
@@ -179,7 +214,7 @@ public:
bool
WriteRegisterFromUnsigned (const RegisterInfo *reg_info, uint64_t uval);
bool
- ConvertBetweenRegisterKinds (int source_rk, uint32_t source_regnum, int target_rk, uint32_t& target_regnum);
+ ConvertBetweenRegisterKinds (lldb::RegisterKind source_rk, uint32_t source_regnum, lldb::RegisterKind target_rk, uint32_t& target_regnum);
//------------------------------------------------------------------
// lldb::ExecutionContextScope pure virtual functions
diff --git a/include/lldb/Target/StackFrame.h b/include/lldb/Target/StackFrame.h
index e7b57cd26ac9..1274dcc64bd3 100644
--- a/include/lldb/Target/StackFrame.h
+++ b/include/lldb/Target/StackFrame.h
@@ -177,7 +177,7 @@ public:
///
/// The StackFrame maintains this SymbolContext and adds additional information
/// to it on an as-needed basis. This helps to avoid different functions
- /// looking up symbolic information for a given pc value multple times.
+ /// looking up symbolic information for a given pc value multiple times.
///
/// @params [in] resolve_scope
/// Flags from the SymbolContextItem enumerated type which specify what
@@ -261,7 +261,7 @@ public:
///
/// @param[in] get_file_globals
/// Whether to also retrieve compilation-unit scoped variables
- /// that are visisble to the entire compilation unit (e.g. file
+ /// that are visible to the entire compilation unit (e.g. file
/// static in C, globals that are homed in this CU).
///
/// @return
@@ -279,7 +279,7 @@ public:
///
/// @param[in] get_file_globals
/// Whether to also retrieve compilation-unit scoped variables
- /// that are visisble to the entire compilation unit (e.g. file
+ /// that are visible to the entire compilation unit (e.g. file
/// static in C, globals that are homed in this CU).
///
/// @return
diff --git a/include/lldb/Target/StopInfo.h b/include/lldb/Target/StopInfo.h
index 3435d392e2b9..8de40e852f4c 100644
--- a/include/lldb/Target/StopInfo.h
+++ b/include/lldb/Target/StopInfo.h
@@ -157,7 +157,9 @@ public:
CreateStopReasonToTrace (Thread &thread);
static lldb::StopInfoSP
- CreateStopReasonWithPlan (lldb::ThreadPlanSP &plan, lldb::ValueObjectSP return_valobj_sp);
+ CreateStopReasonWithPlan (lldb::ThreadPlanSP &plan,
+ lldb::ValueObjectSP return_valobj_sp,
+ lldb::ClangExpressionVariableSP expression_variable_sp);
static lldb::StopInfoSP
CreateStopReasonWithException (Thread &thread, const char *description);
@@ -168,6 +170,9 @@ public:
static lldb::ValueObjectSP
GetReturnValueObject (lldb::StopInfoSP &stop_info_sp);
+ static lldb::ClangExpressionVariableSP
+ GetExpressionVariable (lldb::StopInfoSP &stop_info_sp);
+
protected:
// Perform any action that is associated with this stop. This is done as the
// Event is removed from the event queue. ProcessEventData::DoOnRemoval does the job.
diff --git a/include/lldb/Target/SystemRuntime.h b/include/lldb/Target/SystemRuntime.h
index 363ce122c4f3..18f38f79bdbd 100644
--- a/include/lldb/Target/SystemRuntime.h
+++ b/include/lldb/Target/SystemRuntime.h
@@ -20,6 +20,7 @@
#include "lldb/Core/ConstString.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/PluginInterface.h"
+#include "lldb/Core/StructuredData.h"
#include "lldb/Target/QueueList.h"
#include "lldb/Target/QueueItem.h"
#include "lldb/lldb-private.h"
@@ -222,7 +223,7 @@ public:
/// get the queue name and return it.
///
/// @param [in] dispatch_qaddr
- /// The address of the dispatch_queue_t structure for this thread.
+ /// The address of the dispatch_qaddr pointer for this thread.
///
/// @return
/// The string of this queue's name. An empty string is returned if the
@@ -244,7 +245,7 @@ public:
/// get the queue ID and return it.
///
/// @param [in] dispatch_qaddr
- /// The address of the dispatch_queue_t structure for this thread.
+ /// The address of the dispatch_qaddr pointer for this thread.
///
/// @return
/// The queue ID, or if it could not be retrieved, LLDB_INVALID_QUEUE_ID.
@@ -256,6 +257,26 @@ public:
}
//------------------------------------------------------------------
+ /// Get the libdispatch_queue_t address for the queue given the thread's dispatch_qaddr.
+ ///
+ /// On systems using libdispatch queues, a thread may be associated with a queue.
+ /// There will be a call to get the thread's dispatch_qaddr.
+ /// Given the thread's dispatch_qaddr, find the libdispatch_queue_t address and
+ /// return it.
+ ///
+ /// @param [in] dispatch_qaddr
+ /// The address of the dispatch_qaddr pointer for this thread.
+ ///
+ /// @return
+ /// The libdispatch_queue_t address, or LLDB_INVALID_ADDRESS if unavailable/not found.
+ //------------------------------------------------------------------
+ virtual lldb::addr_t
+ GetLibdispatchQueueAddressFromThreadQAddress (lldb::addr_t dispatch_qaddr)
+ {
+ return LLDB_INVALID_ADDRESS;
+ }
+
+ //------------------------------------------------------------------
/// Get the pending work items for a libdispatch Queue
///
/// If this system/process is using libdispatch and the runtime can do so,
@@ -270,6 +291,60 @@ public:
{
}
+ //------------------------------------------------------------------
+ /// Complete the fields in a QueueItem
+ ///
+ /// PopulatePendingItemsForQueue() may not fill in all of the QueueItem
+ /// details; when the remaining fields are needed, they will be
+ /// fetched by call this method.
+ ///
+ /// @param [in] queue_item
+ /// The QueueItem that we will be completing.
+ ///
+ /// @param [in] item_ref
+ /// The item_ref token that is needed to retrieve the rest of the
+ /// information about the QueueItem.
+ //------------------------------------------------------------------
+ virtual void
+ CompleteQueueItem (lldb_private::QueueItem *queue_item, lldb::addr_t item_ref)
+ {
+ }
+
+ //------------------------------------------------------------------
+ /// Add key-value pairs to the StructuredData dictionary object with
+ /// information debugserver may need when constructing the jThreadExtendedInfo
+ /// packet.
+ ///
+ /// @param [out] dict
+ /// Dictionary to which key-value pairs should be added; they will
+ /// be sent to the remote gdb server stub as arguments in the
+ /// jThreadExtendedInfo request.
+ //------------------------------------------------------------------
+ virtual void
+ AddThreadExtendedInfoPacketHints (lldb_private::StructuredData::ObjectSP dict)
+ {
+ }
+
+ /// Determine whether it is safe to run an expression on a given thread
+ ///
+ /// If a system must not run functions on a thread in some particular state,
+ /// this method gives a way for it to flag that the expression should not be
+ /// run.
+ ///
+ /// @param [in] thread_sp
+ /// The thread we want to run the expression on.
+ ///
+ /// @return
+ /// True will be returned if there are no known problems with running an
+ /// expression on this thread. False means that the inferior function
+ /// call should not be made on this thread.
+ //------------------------------------------------------------------
+ virtual bool
+ SafeToCallFunctionsOnThisThread (lldb::ThreadSP thread_sp)
+ {
+ return true;
+ }
+
protected:
//------------------------------------------------------------------
// Member variables.
diff --git a/include/lldb/Target/Target.h b/include/lldb/Target/Target.h
index e65a511ab77a..64f3edf0fc4f 100644
--- a/include/lldb/Target/Target.h
+++ b/include/lldb/Target/Target.h
@@ -82,6 +82,12 @@ public:
SetDisableASLR (bool b);
bool
+ GetDetachOnError () const;
+
+ void
+ SetDetachOnError (bool b);
+
+ bool
GetDisableSTDIO () const;
void
@@ -201,9 +207,15 @@ public:
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_timeout_usec(default_timeout),
+ m_one_thread_timeout_usec(0),
+ m_cancel_callback (nullptr),
+ m_cancel_callback_baton (nullptr)
+ {
+ }
ExecutionPolicy
GetExecutionPolicy () const
@@ -301,6 +313,18 @@ public:
m_timeout_usec = timeout;
}
+ uint32_t
+ GetOneThreadTimeoutUsec () const
+ {
+ return m_one_thread_timeout_usec;
+ }
+
+ void
+ SetOneThreadTimeoutUsec (uint32_t timeout = 0)
+ {
+ m_one_thread_timeout_usec = timeout;
+ }
+
bool
GetTryAllThreads () const
{
@@ -335,6 +359,20 @@ public:
SetDebug(bool b)
{
m_debug = b;
+ if (m_debug)
+ m_generate_debug_info = true;
+ }
+
+ bool
+ GetGenerateDebugInfo() const
+ {
+ return m_generate_debug_info;
+ }
+
+ void
+ SetGenerateDebugInfo(bool b)
+ {
+ m_generate_debug_info = b;
}
bool
@@ -348,6 +386,34 @@ public:
{
m_trap_exceptions = b;
}
+
+ void
+ SetCancelCallback (lldb::ExpressionCancelCallback callback, void *baton)
+ {
+ m_cancel_callback_baton = baton;
+ m_cancel_callback = callback;
+ }
+
+ bool
+ InvokeCancelCallback (lldb::ExpressionEvaluationPhase phase) const
+ {
+ if (m_cancel_callback == nullptr)
+ return false;
+ else
+ return m_cancel_callback (phase, m_cancel_callback_baton);
+ }
+
+ void
+ SetResultIsInternal (bool b)
+ {
+ m_result_is_internal = b;
+ }
+
+ bool
+ GetResultIsInternal () const
+ {
+ return m_result_is_internal;
+ }
private:
ExecutionPolicy m_execution_policy;
@@ -360,8 +426,13 @@ private:
bool m_stop_others;
bool m_debug;
bool m_trap_exceptions;
+ bool m_generate_debug_info;
+ bool m_result_is_internal;
lldb::DynamicValueType m_use_dynamic;
uint32_t m_timeout_usec;
+ uint32_t m_one_thread_timeout_usec;
+ lldb::ExpressionCancelCallback m_cancel_callback;
+ void *m_cancel_callback_baton;
};
//----------------------------------------------------------------------
@@ -513,7 +584,7 @@ public:
/// in a target.
///
/// @param[in] s
- /// The stream to which to dump the object descripton.
+ /// The stream to which to dump the object description.
//------------------------------------------------------------------
void
Dump (Stream *s, lldb::DescriptionLevel description_level);
@@ -1086,7 +1157,7 @@ public:
// we provide a way for expressions to be evaluated from the Target itself.
// If an expression is going to be run, then it should have a frame filled
// in in th execution context.
- ExecutionResults
+ lldb::ExpressionResults
EvaluateExpression (const char *expression,
StackFrame *frame,
lldb::ValueObjectSP &result_valobj_sp,
diff --git a/include/lldb/Target/TargetList.h b/include/lldb/Target/TargetList.h
index 41404e11c7fa..6abf13e8704c 100644
--- a/include/lldb/Target/TargetList.h
+++ b/include/lldb/Target/TargetList.h
@@ -121,7 +121,7 @@ public:
//------------------------------------------------------------------
/// Delete a Target object from the list.
///
- /// When clients are done with the Target objets, this function
+ /// When clients are done with the Target objects, this function
/// should be called to release the memory associated with a target
/// object.
///
diff --git a/include/lldb/Target/Thread.h b/include/lldb/Target/Thread.h
index 20687e977bff..cba09e164105 100644
--- a/include/lldb/Target/Thread.h
+++ b/include/lldb/Target/Thread.h
@@ -14,6 +14,7 @@
#include "lldb/Host/Mutex.h"
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Event.h"
+#include "lldb/Core/StructuredData.h"
#include "lldb/Core/UserID.h"
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Target/ExecutionContextScope.h"
@@ -49,6 +50,12 @@ public:
bool
GetTraceEnabledState() const;
+
+ bool
+ GetStepInAvoidsNoDebug () const;
+
+ bool
+ GetStepOutAvoidsNoDebug () const;
};
typedef std::shared_ptr<ThreadProperties> ThreadPropertiesSP;
@@ -153,7 +160,25 @@ public:
static const ThreadPropertiesSP &
GetGlobalProperties();
- Thread (Process &process, lldb::tid_t tid);
+ //------------------------------------------------------------------
+ /// Constructor
+ ///
+ /// @param [in] process
+ ///
+ /// @param [in] tid
+ ///
+ /// @param [in] use_invalid_index_id
+ /// Optional parameter, defaults to false. The only subclass that
+ /// is likely to set use_invalid_index_id == true is the HistoryThread
+ /// class. In that case, the Thread we are constructing represents
+ /// a thread from earlier in the program execution. We may have the
+ /// tid of the original thread that they represent but we don't want
+ /// to reuse the IndexID of that thread, or create a new one. If a
+ /// client wants to know the original thread's IndexID, they should use
+ /// Thread::GetExtendedBacktraceOriginatingIndexID().
+ //------------------------------------------------------------------
+ Thread (Process &process, lldb::tid_t tid, bool use_invalid_index_id = false);
+
virtual ~Thread();
lldb::ProcessSP
@@ -185,10 +210,22 @@ public:
{
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.
void
- SetResumeState (lldb::StateType state)
+ SetResumeState (lldb::StateType state, bool override_suspend = false)
{
+ if (m_resume_state == lldb::eStateSuspended && !override_suspend)
+ return;
m_resume_state = state;
}
@@ -270,6 +307,28 @@ public:
return NULL;
}
+ //------------------------------------------------------------------
+ /// Retrieve a dictionary of information about this thread
+ ///
+ /// On Mac OS X systems there may be voucher information.
+ /// The top level dictionary returned will have an "activity" key and the
+ /// value of the activity is a dictionary. Keys in that dictionary will
+ /// be "name" and "id", among others.
+ /// There may also be "trace_messages" (an array) with each entry in that array
+ /// being a dictionary (keys include "message" with the text of the trace
+ /// message).
+ //------------------------------------------------------------------
+ StructuredData::ObjectSP
+ GetExtendedInfo ()
+ {
+ if (m_extended_info_fetched == false)
+ {
+ m_extended_info = FetchThreadExtendedInfo ();
+ m_extended_info_fetched = true;
+ }
+ return m_extended_info;
+ }
+
virtual const char *
GetName ()
{
@@ -281,6 +340,21 @@ public:
{
}
+ //------------------------------------------------------------------
+ /// Retrieve the Queue ID for the queue currently using this Thread
+ ///
+ /// If this Thread is doing work on behalf of a libdispatch/GCD queue,
+ /// retrieve the QueueID.
+ ///
+ /// This is a unique identifier for the libdispatch/GCD queue in a
+ /// process. Often starting at 1 for the initial system-created
+ /// queues and incrementing, a QueueID will not be reused for a
+ /// different queue during the lifetime of a proces.
+ ///
+ /// @return
+ /// A QueueID if the Thread subclass implements this, else
+ /// LLDB_INVALID_QUEUE_ID.
+ //------------------------------------------------------------------
virtual lldb::queue_id_t
GetQueueID ()
{
@@ -292,6 +366,16 @@ public:
{
}
+ //------------------------------------------------------------------
+ /// Retrieve the Queue name for the queue currently using this Thread
+ ///
+ /// If this Thread is doing work on behalf of a libdispatch/GCD queue,
+ /// retrieve the Queue name.
+ ///
+ /// @return
+ /// The Queue name, if the Thread subclass implements this, else
+ /// NULL.
+ //------------------------------------------------------------------
virtual const char *
GetQueueName ()
{
@@ -303,6 +387,44 @@ public:
{
}
+ //------------------------------------------------------------------
+ /// Retrieve the Queue for this thread, if any.
+ ///
+ /// @return
+ /// A QueueSP for the queue that is currently associated with this
+ /// thread.
+ /// An empty shared pointer indicates that this thread is not
+ /// associated with a queue, or libdispatch queues are not
+ /// supported on this target.
+ //------------------------------------------------------------------
+ virtual lldb::QueueSP
+ GetQueue ()
+ {
+ return lldb::QueueSP();
+ }
+
+ //------------------------------------------------------------------
+ /// Retrieve the address of the libdispatch_queue_t struct for queue
+ /// currently using this Thread
+ ///
+ /// If this Thread is doing work on behalf of a libdispatch/GCD queue,
+ /// retrieve the address of the libdispatch_queue_t structure describing
+ /// the queue.
+ ///
+ /// This address may be reused for different queues later in the Process
+ /// lifetime and should not be used to identify a queue uniquely. Use
+ /// the GetQueueID() call for that.
+ ///
+ /// @return
+ /// The Queue's libdispatch_queue_t address if the Thread subclass
+ /// implements this, else LLDB_INVALID_ADDRESS.
+ //------------------------------------------------------------------
+ virtual lldb::addr_t
+ GetQueueLibdispatchQueueAddress ()
+ {
+ return LLDB_INVALID_ADDRESS;
+ }
+
virtual uint32_t
GetStackFrameCount()
{
@@ -412,6 +534,9 @@ public:
void
DumpUsingSettingsFormat (Stream &strm, uint32_t frame_idx);
+ bool
+ GetDescription (Stream &s, lldb::DescriptionLevel level, bool json_output);
+
//------------------------------------------------------------------
/// Default implementation for stepping into.
///
@@ -422,17 +547,22 @@ public:
/// If true and the frame has debug info, then do a source level
/// step in, else do a single instruction step in.
///
- /// @param[in] avoid_code_without_debug_info
+ /// @param[in] step_in_avoids_code_without_debug_info
/// If \a true, then avoid stepping into code that doesn't have
- /// debug info, else step into any code regardless of wether it
+ /// debug info, else step into any code regardless of whether it
/// has debug info.
///
+ /// @param[in] step_out_avoids_code_without_debug_info
+ /// If \a true, then if you step out to code with no debug info, keep
+ /// stepping out till you get to code with debug info.
+ ///
/// @return
/// An error that describes anything that went wrong
//------------------------------------------------------------------
virtual Error
StepIn (bool source_step,
- bool avoid_code_without_debug_info);
+ LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate,
+ LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
//------------------------------------------------------------------
/// Default implementation for stepping over.
@@ -448,7 +578,8 @@ public:
/// An error that describes anything that went wrong
//------------------------------------------------------------------
virtual Error
- StepOver (bool source_step);
+ StepOver (bool source_step,
+ LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
//------------------------------------------------------------------
/// Default implementation for stepping out.
@@ -487,6 +618,19 @@ public:
virtual lldb::addr_t
GetThreadLocalData (const lldb::ModuleSP module);
+ //------------------------------------------------------------------
+ /// Check whether this thread is safe to run functions
+ ///
+ /// The SystemRuntime may know of certain thread states (functions in
+ /// process of execution, for instance) which can make it unsafe for
+ /// functions to be called.
+ ///
+ /// @return
+ /// True if it is safe to call functions on this thread.
+ /// False if function calls should be avoided on this thread.
+ //------------------------------------------------------------------
+ virtual bool
+ SafeToCallFunctions ();
//------------------------------------------------------------------
// Thread Plan Providers:
@@ -574,14 +718,19 @@ public:
/// @param[in] stop_other_threads
/// \b true if we will stop other threads while we single step this one.
///
+ /// @param[in] step_out_avoids_code_without_debug_info
+ /// If eLazyBoolYes, if the step over steps out it will continue to step out till it comes to a frame with debug info.
+ /// If eLazyBoolCalculate, we will consult the default set in the thread.
+ ///
/// @return
/// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepOverRange (bool abort_other_plans,
- const AddressRange &range,
- const SymbolContext &addr_context,
- lldb::RunMode stop_other_threads);
+ const AddressRange &range,
+ const SymbolContext &addr_context,
+ lldb::RunMode stop_other_threads,
+ LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
//------------------------------------------------------------------
/// Queues the plan used to step through an address range, stepping into functions.
@@ -609,19 +758,25 @@ public:
/// @param[in] stop_other_threads
/// \b true if we will stop other threads while we single step this one.
///
- /// @param[in] avoid_code_without_debug_info
- /// If \b true we will step out if we step into code with no debug info.
+ /// @param[in] step_in_avoids_code_without_debug_info
+ /// If eLazyBoolYes we will step out if we step into code with no debug info.
+ /// If eLazyBoolCalculate we will consult the default set in the thread.
+ ///
+ /// @param[in] step_out_avoids_code_without_debug_info
+ /// If eLazyBoolYes, if the step over steps out it will continue to step out till it comes to a frame with debug info.
+ /// If eLazyBoolCalculate, it will consult the default set in the thread.
///
/// @return
/// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepInRange (bool abort_other_plans,
- const AddressRange &range,
- const SymbolContext &addr_context,
- const char *step_in_target,
- lldb::RunMode stop_other_threads,
- bool avoid_code_without_debug_info);
+ const AddressRange &range,
+ const SymbolContext &addr_context,
+ const char *step_in_target,
+ lldb::RunMode stop_other_threads,
+ LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate,
+ LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
//------------------------------------------------------------------
/// Queue the plan used to step out of the function at the current PC of
@@ -648,6 +803,10 @@ public:
/// @param[in] run_vote
/// See standard meanings for the stop & run votes in ThreadPlan.h.
///
+ /// @param[in] step_out_avoids_code_without_debug_info
+ /// If eLazyBoolYes, if the step over steps out it will continue to step out till it comes to a frame with debug info.
+ /// If eLazyBoolCalculate, it will consult the default set in the thread.
+ ///
/// @return
/// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
//------------------------------------------------------------------
@@ -658,7 +817,46 @@ public:
bool stop_other_threads,
Vote stop_vote, // = eVoteYes,
Vote run_vote, // = eVoteNoOpinion);
- uint32_t frame_idx);
+ uint32_t frame_idx,
+ LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
+
+ //------------------------------------------------------------------
+ /// Queue the plan used to step out of the function at the current PC of
+ /// a thread. This version does not consult the should stop here callback, and should only
+ /// be used by other thread plans when they need to retain control of the step out.
+ ///
+ /// @param[in] abort_other_plans
+ /// \b true if we discard the currently queued plans and replace them with this one.
+ /// Otherwise this plan will go on the end of the plan stack.
+ ///
+ /// @param[in] addr_context
+ /// When dealing with stepping through inlined functions the current PC is not enough information to know
+ /// what "step" means. For instance a series of nested inline functions might start at the same address.
+ // The \a addr_context provides the current symbol context the step
+ /// is supposed to be out of.
+ // FIXME: Currently unused.
+ ///
+ /// @param[in] first_insn
+ /// \b true if this is the first instruction of a function.
+ ///
+ /// @param[in] stop_other_threads
+ /// \b true if we will stop other threads while we single step this one.
+ ///
+ /// @param[in] stop_vote
+ /// @param[in] run_vote
+ /// See standard meanings for the stop & run votes in ThreadPlan.h.
+ ///
+ /// @return
+ /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ //------------------------------------------------------------------
+ virtual lldb::ThreadPlanSP
+ QueueThreadPlanForStepOutNoShouldStop (bool abort_other_plans,
+ SymbolContext *addr_context,
+ bool first_insn,
+ bool stop_other_threads,
+ Vote stop_vote, // = eVoteYes,
+ Vote run_vote, // = eVoteNoOpinion);
+ uint32_t frame_idx);
//------------------------------------------------------------------
/// Gets the plan used to step through the code that steps from a function
@@ -768,6 +966,17 @@ public:
GetReturnValueObject ();
//------------------------------------------------------------------
+ /// Gets the outer-most expression variable from the completed plans
+ ///
+ /// @return
+ /// A ClangExpressionVariableSP, either empty if there is no
+ /// plan completed an expression during the current stop
+ /// or the expression variable that was made for the completed expression.
+ //------------------------------------------------------------------
+ lldb::ClangExpressionVariableSP
+ GetExpressionVariable ();
+
+ //------------------------------------------------------------------
/// Checks whether the given plan is in the completed plans for this
/// stop.
///
@@ -1066,6 +1275,13 @@ protected:
return false;
}
+ // Subclasses that have a way to get an extended info dictionary for this thread should
+ // fill
+ virtual lldb_private::StructuredData::ObjectSP
+ FetchThreadExtendedInfo ()
+ {
+ return StructuredData::ObjectSP();
+ }
lldb::StackFrameListSP
GetStackFrameList ();
@@ -1091,11 +1307,13 @@ protected:
int m_resume_signal; ///< The signal that should be used when continuing this thread.
lldb::StateType m_resume_state; ///< This state is used to force a thread to be suspended from outside the ThreadPlan logic.
lldb::StateType m_temporary_resume_state; ///< This state records what the thread was told to do by the thread plan logic for the current resume.
- /// It gets set in Thread::ShoudResume.
+ /// It gets set in Thread::ShouldResume.
std::unique_ptr<lldb_private::Unwind> m_unwinder_ap;
bool m_destroy_called; // This is used internally to make sure derived Thread classes call DestroyThread.
LazyBool m_override_should_notify;
private:
+ bool m_extended_info_fetched; // Have we tried to retrieve the m_extended_info for this thread?
+ StructuredData::ObjectSP m_extended_info; // The extended info for this thread
//------------------------------------------------------------------
// For Thread only
//------------------------------------------------------------------
diff --git a/include/lldb/Target/ThreadPlan.h b/include/lldb/Target/ThreadPlan.h
index 3c83fd1b9630..1f20841906d3 100644
--- a/include/lldb/Target/ThreadPlan.h
+++ b/include/lldb/Target/ThreadPlan.h
@@ -501,11 +501,26 @@ public:
return m_thread.GetStopInfo ();
}
+ // If the completion of the thread plan stepped out of a function, the return value of the function
+ // might have been captured by the thread plan (currently only ThreadPlanStepOut does this.)
+ // If so, the ReturnValueObject can be retrieved from here.
+
virtual lldb::ValueObjectSP
GetReturnValueObject ()
{
return lldb::ValueObjectSP();
}
+
+ // If the thread plan managing the evaluation of a user expression lives longer than the command
+ // that instigated the expression (generally because the expression evaluation hit a breakpoint, and
+ // the user regained control at that point) a subsequent process control command step/continue/etc. might
+ // complete the expression evaluations. If so, the result of the expression evaluation will show up here.
+
+ virtual lldb::ClangExpressionVariableSP
+ GetExpressionVariable ()
+ {
+ return lldb::ClangExpressionVariableSP();
+ }
// If a thread plan stores the state before it was run, then you might
// want to restore the state when it is done. This will do that job.
@@ -524,6 +539,27 @@ public:
return false;
}
+ virtual bool
+ SetIterationCount (size_t count)
+ {
+ if (m_takes_iteration_count)
+ {
+ // Don't tell me to do something 0 times...
+ if (count == 0)
+ return false;
+ m_iteration_count = count;
+ }
+ return m_takes_iteration_count;
+ }
+
+ virtual size_t
+ GetIterationCount ()
+ {
+ if (!m_takes_iteration_count)
+ return 0;
+ else
+ return m_iteration_count;
+ }
protected:
//------------------------------------------------------------------
// Classes that inherit from ThreadPlan can see and modify these
@@ -578,6 +614,8 @@ protected:
Thread &m_thread;
Vote m_stop_vote;
Vote m_run_vote;
+ bool m_takes_iteration_count = false;
+ int32_t m_iteration_count = 1;
private:
//------------------------------------------------------------------
diff --git a/include/lldb/Target/ThreadPlanCallFunction.h b/include/lldb/Target/ThreadPlanCallFunction.h
index 18f1d0facbf6..12200ab76553 100644
--- a/include/lldb/Target/ThreadPlanCallFunction.h
+++ b/include/lldb/Target/ThreadPlanCallFunction.h
@@ -52,9 +52,6 @@ public:
virtual bool
StopOthers ();
- virtual void
- SetStopOthers (bool new_value);
-
virtual lldb::StateType
GetPlanRunState ();
@@ -128,7 +125,10 @@ public:
m_takedown_done = true;
}
-protected:
+ virtual void
+ SetStopOthers (bool new_value);
+
+protected:
void ReportRegisterState (const char *message);
virtual bool
diff --git a/include/lldb/Target/ThreadPlanCallUserExpression.h b/include/lldb/Target/ThreadPlanCallUserExpression.h
index 5eb7cc1cd452..67ac642de7bd 100644
--- a/include/lldb/Target/ThreadPlanCallUserExpression.h
+++ b/include/lldb/Target/ThreadPlanCallUserExpression.h
@@ -40,21 +40,35 @@ public:
GetDescription (Stream *s, lldb::DescriptionLevel level);
virtual void
- WillPop ()
- {
- ThreadPlanCallFunction::WillPop();
- if (m_user_expression_sp)
- m_user_expression_sp.reset();
- }
+ WillPop ();
virtual lldb::StopInfoSP
GetRealStopInfo();
+ virtual bool
+ MischiefManaged ();
+
+ void
+ TransferExpressionOwnership ()
+ {
+ m_manage_materialization = true;
+ }
+
+ virtual lldb::ClangExpressionVariableSP
+ GetExpressionVariable ()
+ {
+ return m_result_var_sp;
+ }
+
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.
+ 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.
+
DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallUserExpression);
};
diff --git a/include/lldb/Target/ThreadPlanShouldStopHere.h b/include/lldb/Target/ThreadPlanShouldStopHere.h
index 62068b78ae4e..26e4a1ec4fe7 100644
--- a/include/lldb/Target/ThreadPlanShouldStopHere.h
+++ b/include/lldb/Target/ThreadPlanShouldStopHere.h
@@ -21,8 +21,9 @@ namespace lldb_private {
// This is an interface that ThreadPlans can adopt to allow flexible modifications of the behavior
// when a thread plan comes to a place where it would ordinarily stop. If such modification makes
// sense for your plan, inherit from this class, and when you would be about to stop (in your ShouldStop
-// method), call InvokeShouldStopHereCallback, and if that returns a non-NULL plan, execute that
-// plan instead of stopping.
+// method), call InvokeShouldStopHereCallback, passing in the frame comparison between where the step operation
+// started and where you arrived. If it returns true, then QueueStepOutFromHere will queue the plan
+// to execute instead of stopping.
//
// The classic example of the use of this is ThreadPlanStepInRange not stopping in frames that have
// no debug information.
@@ -34,27 +35,84 @@ namespace lldb_private {
class ThreadPlanShouldStopHere
{
public:
+ struct ThreadPlanShouldStopHereCallbacks
+ {
+ ThreadPlanShouldStopHereCallbacks()
+ {
+ should_stop_here_callback = nullptr;
+ step_from_here_callback = nullptr;
+ }
+
+ ThreadPlanShouldStopHereCallbacks(ThreadPlanShouldStopHereCallback should_stop,
+ ThreadPlanStepFromHereCallback step_from_here)
+ {
+ should_stop_here_callback = should_stop;
+ step_from_here_callback = step_from_here;
+ }
+
+ void
+ Clear()
+ {
+ should_stop_here_callback = nullptr;
+ step_from_here_callback = nullptr;
+ }
+
+ ThreadPlanShouldStopHereCallback should_stop_here_callback;
+ ThreadPlanStepFromHereCallback step_from_here_callback;
+ };
+
enum
{
eNone = 0,
- eAvoidInlines = (1 << 0),
- eAvoidNoDebug = (1 << 1)
+ eAvoidInlines = (1 << 0),
+ eStepInAvoidNoDebug = (1 << 1),
+ eStepOutAvoidNoDebug = (1 << 2)
};
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
+ ThreadPlanShouldStopHere (ThreadPlan *owner);
+
ThreadPlanShouldStopHere (ThreadPlan *owner,
- ThreadPlanShouldStopHereCallback callback = NULL,
+ const ThreadPlanShouldStopHereCallbacks *callbacks,
void *baton = NULL);
virtual
~ThreadPlanShouldStopHere();
-
+
+ // Set the ShouldStopHere callbacks. Pass in null to clear them and have no special behavior (though you
+ // can also call ClearShouldStopHereCallbacks for that purpose. If you pass in a valid pointer, it will
+ // adopt the non-null fields, and any null fields will be set to the default values.
+
void
- SetShouldStopHereCallback (ThreadPlanShouldStopHereCallback callback, void *baton);
+ SetShouldStopHereCallbacks (const ThreadPlanShouldStopHereCallbacks *callbacks, void *baton)
+ {
+ if (callbacks)
+ {
+ m_callbacks = *callbacks;
+ if (!m_callbacks.should_stop_here_callback)
+ m_callbacks.should_stop_here_callback = ThreadPlanShouldStopHere::DefaultShouldStopHereCallback;
+ if (!m_callbacks.step_from_here_callback)
+ m_callbacks.step_from_here_callback = ThreadPlanShouldStopHere::DefaultStepFromHereCallback;
+ }
+ else
+ {
+ ClearShouldStopHereCallbacks ();
+ }
+ m_baton = baton;
+ }
+
+ void
+ ClearShouldStopHereCallbacks()
+ {
+ m_callbacks.Clear();
+ }
+ bool
+ InvokeShouldStopHereCallback (lldb::FrameComparison operation);
+
lldb::ThreadPlanSP
- InvokeShouldStopHereCallback ();
+ CheckShouldStopHereAndQueueStepOut (lldb::FrameComparison operation);
lldb_private::Flags &
GetFlags ()
@@ -69,13 +127,22 @@ public:
}
protected:
+ static bool
+ DefaultShouldStopHereCallback (ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation, void *baton);
+
+ static lldb::ThreadPlanSP
+ DefaultStepFromHereCallback (ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation, void *baton);
+
+ virtual lldb::ThreadPlanSP
+ QueueStepOutFromHerePlan (Flags &flags, lldb::FrameComparison operation);
+
// Implement this, and call it in the plan's constructor to set the default flags.
virtual void SetFlagsToDefault () = 0;
//------------------------------------------------------------------
// Classes that inherit from ThreadPlanShouldStopHere can see and modify these
//------------------------------------------------------------------
- ThreadPlanShouldStopHereCallback m_callback;
+ ThreadPlanShouldStopHereCallbacks m_callbacks;
void * m_baton;
ThreadPlan *m_owner;
lldb_private::Flags m_flags;
diff --git a/include/lldb/Target/ThreadPlanStepInRange.h b/include/lldb/Target/ThreadPlanStepInRange.h
index 2f741f179bd4..3a22e97e30d0 100644
--- a/include/lldb/Target/ThreadPlanStepInRange.h
+++ b/include/lldb/Target/ThreadPlanStepInRange.h
@@ -30,13 +30,17 @@ public:
ThreadPlanStepInRange (Thread &thread,
const AddressRange &range,
const SymbolContext &addr_context,
- lldb::RunMode stop_others);
-
+ lldb::RunMode stop_others,
+ LazyBool step_in_avoids_code_without_debug_info,
+ LazyBool step_out_avoids_code_without_debug_info);
+
ThreadPlanStepInRange (Thread &thread,
const AddressRange &range,
const SymbolContext &addr_context,
const char *step_into_function_name,
- lldb::RunMode stop_others);
+ lldb::RunMode stop_others,
+ LazyBool step_in_avoids_code_without_debug_info,
+ LazyBool step_out_avoids_code_without_debug_info);
virtual
~ThreadPlanStepInRange ();
@@ -54,9 +58,6 @@ public:
m_step_into_target.SetCString(target);
}
- static lldb::ThreadPlanSP
- DefaultShouldStopHereCallback (ThreadPlan *current_plan, Flags &flags, void *baton);
-
static void
SetDefaultFlagValue (uint32_t new_value);
@@ -64,13 +65,26 @@ public:
IsVirtualStep();
protected:
+ static bool
+ DefaultShouldStopHereCallback (ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation, void *baton);
+
virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
virtual bool
DoPlanExplainsStop (Event *event_ptr);
virtual void
- SetFlagsToDefault ();
+ SetFlagsToDefault ()
+ {
+ GetFlags().Set(ThreadPlanStepInRange::s_default_flag_values);
+ }
+
+ void
+ SetCallbacks()
+ {
+ ThreadPlanShouldStopHere::ThreadPlanShouldStopHereCallbacks callbacks(ThreadPlanStepInRange::DefaultShouldStopHereCallback, nullptr);
+ SetShouldStopHereCallbacks (&callbacks, nullptr);
+ }
bool
FrameMatchesAvoidCriteria ();
@@ -81,20 +95,23 @@ private:
Thread::QueueThreadPlanForStepOverRange (bool abort_other_plans,
const AddressRange &range,
const SymbolContext &addr_context,
- lldb::RunMode stop_others);
+ lldb::RunMode stop_others,
+ LazyBool avoid_code_without_debug_info);
friend lldb::ThreadPlanSP
Thread::QueueThreadPlanForStepInRange (bool abort_other_plans,
const AddressRange &range,
const SymbolContext &addr_context,
const char *step_in_target,
lldb::RunMode stop_others,
- bool avoid_code_without_debug_info);
-
+ LazyBool step_in_avoids_code_without_debug_info,
+ LazyBool step_out_avoids_code_without_debug_info);
+ void SetupAvoidNoDebug(LazyBool step_in_avoids_code_without_debug_info,
+ LazyBool step_out_avoids_code_without_debug_info);
// Need an appropriate marker for the current stack so we can tell step out
// from step in.
- static uint32_t s_default_flag_values;
+ static uint32_t s_default_flag_values; // These are the default flag values for the ThreadPlanStepThrough.
lldb::ThreadPlanSP m_sub_plan_sp; // Keep track of the last plan we were running. If it fails, we should stop.
std::unique_ptr<RegularExpression> m_avoid_regexp_ap;
bool m_step_past_prologue; // FIXME: For now hard-coded to true, we could put a switch in for this if there's
diff --git a/include/lldb/Target/ThreadPlanStepInstruction.h b/include/lldb/Target/ThreadPlanStepInstruction.h
index eb4a64bcbc84..86069ffd9eb5 100644
--- a/include/lldb/Target/ThreadPlanStepInstruction.h
+++ b/include/lldb/Target/ThreadPlanStepInstruction.h
@@ -32,6 +32,7 @@ public:
virtual lldb::StateType GetPlanRunState ();
virtual bool WillStop ();
virtual bool MischiefManaged ();
+ virtual bool IsPlanStale ();
protected:
virtual bool DoPlanExplainsStop (Event *event_ptr);
@@ -41,6 +42,7 @@ protected:
bool stop_others,
Vote stop_vote,
Vote run_vote);
+ void SetUpState ();
private:
friend lldb::ThreadPlanSP
diff --git a/include/lldb/Target/ThreadPlanStepOut.h b/include/lldb/Target/ThreadPlanStepOut.h
index 2737978a4edc..8c140dc9d95d 100644
--- a/include/lldb/Target/ThreadPlanStepOut.h
+++ b/include/lldb/Target/ThreadPlanStepOut.h
@@ -16,10 +16,12 @@
// Project includes
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlan.h"
+#include "lldb/Target/ThreadPlanShouldStopHere.h"
namespace lldb_private {
-class ThreadPlanStepOut : public ThreadPlan
+class ThreadPlanStepOut : public ThreadPlan,
+ public ThreadPlanShouldStopHere
{
public:
ThreadPlanStepOut (Thread &thread,
@@ -28,7 +30,8 @@ public:
bool stop_others,
Vote stop_vote,
Vote run_vote,
- uint32_t frame_idx);
+ uint32_t frame_idx,
+ LazyBool step_out_avoids_code_without_debug_info);
virtual ~ThreadPlanStepOut ();
@@ -48,21 +51,29 @@ public:
}
protected:
+ virtual void
+ SetFlagsToDefault ()
+ {
+ GetFlags().Set(ThreadPlanStepOut::s_default_flag_values);
+ }
+
virtual bool DoPlanExplainsStop (Event *event_ptr);
virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
bool QueueInlinedStepPlan (bool queue_now);
private:
- SymbolContext *m_step_from_context;
+ static uint32_t s_default_flag_values; // These are the default flag values for the ThreadPlanStepThrough.
+
lldb::addr_t m_step_from_insn;
StackID m_step_out_to_id;
StackID m_immediate_step_from_id;
lldb::break_id_t m_return_bp_id;
lldb::addr_t m_return_addr;
- bool m_first_insn;
bool m_stop_others;
- lldb::ThreadPlanSP m_step_through_inline_plan_sp;
- lldb::ThreadPlanSP m_step_out_plan_sp;
+ lldb::ThreadPlanSP m_step_out_to_inline_plan_sp; // This plan implements step out to the real function containing
+ // an inlined frame so we can then step out of that.
+ lldb::ThreadPlanSP m_step_through_inline_plan_sp; // This plan then steps past the inlined frame(s).
+ lldb::ThreadPlanSP m_step_out_further_plan_sp; // This plan keeps stepping out if ShouldStopHere told us to.
Function *m_immediate_step_from_function;
lldb::ValueObjectSP m_return_valobj_sp;
@@ -73,8 +84,10 @@ private:
bool stop_others,
Vote stop_vote,
Vote run_vote,
- uint32_t frame_idx);
+ uint32_t frame_idx,
+ LazyBool step_out_avoids_code_without_debug_info);
+ void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info);
// Need an appropriate marker for the current stack so we can tell step out
// from step in.
diff --git a/include/lldb/Target/ThreadPlanStepOverRange.h b/include/lldb/Target/ThreadPlanStepOverRange.h
index 2cb5288272ea..d47c6c9429d5 100644
--- a/include/lldb/Target/ThreadPlanStepOverRange.h
+++ b/include/lldb/Target/ThreadPlanStepOverRange.h
@@ -21,14 +21,16 @@
namespace lldb_private {
-class ThreadPlanStepOverRange : public ThreadPlanStepRange
+class ThreadPlanStepOverRange : public ThreadPlanStepRange,
+ ThreadPlanShouldStopHere
{
public:
ThreadPlanStepOverRange (Thread &thread,
const AddressRange &range,
const SymbolContext &addr_context,
- lldb::RunMode stop_others);
+ lldb::RunMode stop_others,
+ LazyBool step_out_avoids_no_debug);
virtual ~ThreadPlanStepOverRange ();
@@ -38,9 +40,20 @@ public:
protected:
virtual bool DoPlanExplainsStop (Event *event_ptr);
virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
-
+
+ virtual void
+ SetFlagsToDefault ()
+ {
+ GetFlags().Set(ThreadPlanStepOverRange::s_default_flag_values);
+ }
+
+
+
private:
+ static uint32_t s_default_flag_values;
+
+ void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info);
bool IsEquivalentContext(const SymbolContext &context);
bool m_first_resume;
diff --git a/include/lldb/Target/ThreadPlanStepRange.h b/include/lldb/Target/ThreadPlanStepRange.h
index 486fd6528390..3487e9ad66cb 100644
--- a/include/lldb/Target/ThreadPlanStepRange.h
+++ b/include/lldb/Target/ThreadPlanStepRange.h
@@ -77,6 +77,7 @@ protected:
std::vector<AddressRange> m_address_ranges;
lldb::RunMode m_stop_others;
StackID m_stack_id; // Use the stack ID so we can tell step out from step in.
+ StackID m_parent_stack_id; // Use the parent stack ID so we can identify tail calls and the like.
bool m_no_more_plans; // Need this one so we can tell if we stepped into a call,
// but can't continue, in which case we are done.
bool m_first_run_event; // We want to broadcast only one running event, our first.
diff --git a/include/lldb/Target/UnwindAssembly.h b/include/lldb/Target/UnwindAssembly.h
index 254382ac029d..963949cf07d5 100644
--- a/include/lldb/Target/UnwindAssembly.h
+++ b/include/lldb/Target/UnwindAssembly.h
@@ -33,6 +33,11 @@ public:
UnwindPlan& unwind_plan) = 0;
virtual bool
+ AugmentUnwindPlanFromCallSite (AddressRange& func,
+ Thread& thread,
+ UnwindPlan& unwind_plan) = 0;
+
+ virtual bool
GetFastUnwindPlan (AddressRange& func,
Thread& thread,
UnwindPlan &unwind_plan) = 0;
diff --git a/include/lldb/Utility/CleanUp.h b/include/lldb/Utility/CleanUp.h
index ab15d1999b7d..9dd3ca5fe12b 100644
--- a/include/lldb/Utility/CleanUp.h
+++ b/include/lldb/Utility/CleanUp.h
@@ -27,7 +27,7 @@ namespace lldb_utility {
// file descriptors, opaque handles, pointers, etc). If more complex
// type T objects are desired, we need to probably specialize this class
// to take "const T&" for all input T parameters. Yet if a type T is
-// complex already it might be better to build the cleanup funcionality
+// complex already it might be better to build the cleanup functionality
// into T.
//
// The cleanup function must take one argument that is of type T.
@@ -163,7 +163,7 @@ public:
//----------------------------------------------------------------------
// Cancels the cleanup that would have been called on "m_current_value"
// if it was valid. This function can be used to release the value
- // contained in this object so ownership can be transfered to the caller.
+ // contained in this object so ownership can be transferred to the caller.
//----------------------------------------------------------------------
value_type
release ()
@@ -296,7 +296,7 @@ public:
//----------------------------------------------------------------------
// Cancels the cleanup that would have been called on "m_current_value"
// if it was valid. This function can be used to release the value
- // contained in this object so ownership can be transfered to the caller.
+ // contained in this object so ownership can be transferred to the caller.
//----------------------------------------------------------------------
value_type
release ()
diff --git a/include/lldb/Utility/PseudoTerminal.h b/include/lldb/Utility/PseudoTerminal.h
index c79800fab75c..6ee598cefe08 100644
--- a/include/lldb/Utility/PseudoTerminal.h
+++ b/include/lldb/Utility/PseudoTerminal.h
@@ -23,7 +23,7 @@ namespace lldb_utility {
/// @class PseudoTerminal PseudoTerminal.h "lldb/Core/PseudoTerminal.h"
/// @brief A pseudo terminal helper class.
///
-/// The pseudo terminal class abtracts the use of pseudo terminals on
+/// The pseudo terminal class abstracts the use of pseudo terminals on
/// the host system.
//----------------------------------------------------------------------
class PseudoTerminal
@@ -46,7 +46,7 @@ public:
/// Destructor
///
/// The destructor will close the master and slave file descriptors
- /// if they are valid and ownwership has not been released using
+ /// if they are valid and ownership has not been released using
/// one of:
/// @li PseudoTerminal::ReleaseMasterFileDescriptor()
/// @li PseudoTerminal::ReleaseSaveFileDescriptor()
diff --git a/include/lldb/Utility/SafeMachO.h b/include/lldb/Utility/SafeMachO.h
new file mode 100644
index 000000000000..2a831ed89b80
--- /dev/null
+++ b/include/lldb/Utility/SafeMachO.h
@@ -0,0 +1,113 @@
+//===-- SafeMachO.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_SafeMachO_h_
+#define liblldb_SafeMachO_h_
+
+// This header file is required to work around collisions between the defines in mach/machine.h, and enum members
+// of the same name in llvm's MachO.h. If you want to use llvm/Support/MachO.h, use this file instead.
+// The caveats are:
+// 1) You can only use the MachO.h enums, you can't use the defines. That won't make a difference since the values
+// are the same.
+// 2) If you need any header file that relies on mach/machine.h, you must include that first.
+// 3) This isn't a total solution, it doesn't undef every define that MachO.h has borrowed from various system headers,
+// only the ones that come from mach/machine.h because that is the one we ended up pulling in from various places.
+//
+
+#undef CPU_ARCH_MASK
+#undef CPU_ARCH_ABI64
+
+#undef CPU_TYPE_ANY
+#undef CPU_TYPE_X86
+#undef CPU_TYPE_I386
+#undef CPU_TYPE_X86_64
+#undef CPU_TYPE_MC98000
+#undef CPU_TYPE_ARM
+#undef CPU_TYPE_ARM64
+#undef CPU_TYPE_SPARC
+#undef CPU_TYPE_POWERPC
+#undef CPU_TYPE_POWERPC64
+
+#undef CPU_SUB_TYPE_MASK
+#undef CPU_SUB_TYPE_LIB64
+
+#undef CPU_SUBTYPE_MULTIPLE
+
+#undef CPU_SUBTYPE_I386_ALL
+#undef CPU_SUBTYPE_386
+#undef CPU_SUBTYPE_486
+#undef CPU_SUBTYPE_486SX
+#undef CPU_SUBTYPE_586
+#undef CPU_SUBTYPE_PENT
+#undef CPU_SUBTYPE_PENTPRO
+#undef CPU_SUBTYPE_PENTII_M3
+#undef CPU_SUBTYPE_PENTII_M5
+#undef CPU_SUBTYPE_CELERON
+#undef CPU_SUBTYPE_CELERON_MOBILE
+#undef CPU_SUBTYPE_PENTIUM_3
+#undef CPU_SUBTYPE_PENTIUM_3_M
+#undef CPU_SUBTYPE_PENTIUM_3_XEON
+#undef CPU_SUBTYPE_PENTIUM_M
+#undef CPU_SUBTYPE_PENTIUM_4
+#undef CPU_SUBTYPE_PENTIUM_4_M
+#undef CPU_SUBTYPE_ITANIUM
+#undef CPU_SUBTYPE_ITANIUM_2
+#undef CPU_SUBTYPE_XEON
+#undef CPU_SUBTYPE_XEON_MP
+
+#undef CPU_SUBTYPE_X86_ALL
+#undef CPU_SUBTYPE_X86_64_ALL
+#undef CPU_SUBTYPE_X86_ARCH1
+#undef CPU_SUBTYPE_X86_64_H
+
+#undef CPU_SUBTYPE_INTEL
+#undef CPU_SUBTYPE_INTEL_FAMILY
+#undef CPU_SUBTYPE_INTEL_FAMILY_MAX
+#undef CPU_SUBTYPE_INTEL_MODEL
+#undef CPU_SUBTYPE_INTEL_MODEL_ALL
+
+#undef CPU_SUBTYPE_ARM
+#undef CPU_SUBTYPE_ARM_ALL
+#undef CPU_SUBTYPE_ARM_V4T
+#undef CPU_SUBTYPE_ARM_V6
+#undef CPU_SUBTYPE_ARM_V5
+#undef CPU_SUBTYPE_ARM_V5TEJ
+#undef CPU_SUBTYPE_ARM_XSCALE
+#undef CPU_SUBTYPE_ARM_V7
+
+#undef CPU_SUBTYPE_ARM_V7S
+#undef CPU_SUBTYPE_ARM_V7K
+#undef CPU_SUBTYPE_ARM_V6M
+#undef CPU_SUBTYPE_ARM_V7M
+#undef CPU_SUBTYPE_ARM_V7EM
+
+#undef CPU_SUBTYPE_ARM64_ALL
+
+#undef CPU_SUBTYPE_SPARC_ALL
+
+#undef CPU_SUBTYPE_POWERPC
+#undef CPU_SUBTYPE_POWERPC_ALL
+#undef CPU_SUBTYPE_POWERPC_601
+#undef CPU_SUBTYPE_POWERPC_602
+#undef CPU_SUBTYPE_POWERPC_603
+#undef CPU_SUBTYPE_POWERPC_603e
+#undef CPU_SUBTYPE_POWERPC_603ev
+#undef CPU_SUBTYPE_POWERPC_604
+#undef CPU_SUBTYPE_POWERPC_604e
+#undef CPU_SUBTYPE_POWERPC_620
+#undef CPU_SUBTYPE_POWERPC_750
+#undef CPU_SUBTYPE_POWERPC_7400
+#undef CPU_SUBTYPE_POWERPC_7450
+#undef CPU_SUBTYPE_POWERPC_970
+
+#undef CPU_SUBTYPE_MC980000_ALL
+#undef CPU_SUBTYPE_MC98601
+
+#include "llvm/Support/MachO.h"
+
+#endif // liblldb_SafeMachO_h_
diff --git a/include/lldb/Utility/SharedCluster.h b/include/lldb/Utility/SharedCluster.h
index 991af4b4fa49..3a34d8ddb415 100644
--- a/include/lldb/Utility/SharedCluster.h
+++ b/include/lldb/Utility/SharedCluster.h
@@ -13,6 +13,8 @@
#include "lldb/Utility/SharingPtr.h"
#include "lldb/Host/Mutex.h"
+#include "llvm/ADT/SmallPtrSet.h"
+
namespace lldb_private {
namespace imp
@@ -50,11 +52,12 @@ public:
~ClusterManager ()
{
- size_t n_items = m_objects.size();
- for (size_t i = 0; i < n_items; i++)
+ for (typename llvm::SmallPtrSet<T *, 16>::iterator pos = m_objects.begin(), end = m_objects.end(); pos != end; ++pos)
{
- delete m_objects[i];
+ T *object = *pos;
+ delete object;
}
+
// Decrement refcount should have been called on this ClusterManager,
// and it should have locked the mutex, now we will unlock it before
// we destroy it...
@@ -64,8 +67,7 @@ public:
void ManageObject (T *new_object)
{
Mutex::Locker locker (m_mutex);
- if (!ContainsObject(new_object))
- m_objects.push_back (new_object);
+ m_objects.insert (new_object);
}
typename lldb_private::SharingPtr<T> GetSharedPointer(T *desired_object)
@@ -73,20 +75,13 @@ public:
{
Mutex::Locker locker (m_mutex);
m_external_ref++;
- assert (ContainsObject(desired_object));
+ assert (m_objects.count(desired_object));
}
return typename lldb_private::SharingPtr<T> (desired_object, new imp::shared_ptr_refcount<ClusterManager> (this));
}
private:
- bool ContainsObject (const T *desired_object)
- {
- typename std::vector<T *>::iterator pos, end = m_objects.end();
- pos = std::find(m_objects.begin(), end, desired_object);
- return pos != end;
- }
-
void DecrementRefCount ()
{
m_mutex.Lock();
@@ -99,7 +94,7 @@ private:
friend class imp::shared_ptr_refcount<ClusterManager>;
- std::vector<T *> m_objects;
+ llvm::SmallPtrSet<T *, 16> m_objects;
int m_external_ref;
Mutex m_mutex;
};
diff --git a/include/lldb/Utility/SharingPtr.h b/include/lldb/Utility/SharingPtr.h
index c451ee6e3593..1b5f86bbe2df 100644
--- a/include/lldb/Utility/SharingPtr.h
+++ b/include/lldb/Utility/SharingPtr.h
@@ -15,7 +15,7 @@
// Microsoft Visual C++ currently does not enable std::atomic to work
// in CLR mode - as such we need to "hack around it" for MSVC++ builds only
-// using Windows specific instrinsics instead of the C++11 atomic support
+// using Windows specific intrinsics instead of the C++11 atomic support
#ifdef _MSC_VER
#include <intrin.h>
#else
@@ -69,8 +69,8 @@ public:
private:
virtual void on_zero_shared();
- // Outlaw copy constructor and assignment operator to keep effictive C++
- // warnings down to a minumum
+ // Outlaw copy constructor and assignment operator to keep effective C++
+ // warnings down to a minimum
shared_ptr_pointer (const shared_ptr_pointer &);
shared_ptr_pointer & operator=(const shared_ptr_pointer &);
};
@@ -138,6 +138,7 @@ private:
struct nat {int for_bool_;};
public:
SharingPtr();
+ SharingPtr(std::nullptr_t);
template<class Y> explicit SharingPtr(Y* p);
template<class Y> explicit SharingPtr(Y* p, imp::shared_count *ctrl_block);
template<class Y> SharingPtr(const SharingPtr<Y>& r, element_type *p);
@@ -191,6 +192,14 @@ SharingPtr<T>::SharingPtr()
cntrl_(0)
{
}
+
+template<class T>
+inline
+SharingPtr<T>::SharingPtr(std::nullptr_t)
+: ptr_(0),
+cntrl_(0)
+{
+}
template<class T>
template<class Y>
diff --git a/include/lldb/Utility/StringLexer.h b/include/lldb/Utility/StringLexer.h
new file mode 100644
index 000000000000..42c169c5cf94
--- /dev/null
+++ b/include/lldb/Utility/StringLexer.h
@@ -0,0 +1,62 @@
+//===--------------------- StringLexer.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_StringLexer_h_
+#define utility_StringLexer_h_
+
+#include <string>
+#include <list>
+
+namespace lldb_utility {
+
+class StringLexer
+{
+public:
+ typedef std::string::size_type Position;
+ typedef std::string::size_type Size;
+
+ typedef std::string::value_type Character;
+
+ StringLexer (std::string s);
+
+ StringLexer (const StringLexer& rhs);
+
+ Character
+ Peek ();
+
+ bool
+ NextIf (Character c);
+
+ Character
+ Next ();
+
+ bool
+ HasAtLeast (Size s);
+
+ bool
+ HasAny (Character c);
+
+ void
+ PutBack (Character c);
+
+ StringLexer&
+ operator = (const StringLexer& rhs);
+
+private:
+ std::string m_data;
+ Position m_position;
+ std::list<Character> m_putback_data;
+
+ void
+ Consume();
+};
+
+} // namespace lldb_private
+
+#endif // #ifndef utility_StringLexer_h_
diff --git a/include/lldb/lldb-defines.h b/include/lldb/lldb-defines.h
index 82307d2f5310..f8028c793233 100644
--- a/include/lldb/lldb-defines.h
+++ b/include/lldb/lldb-defines.h
@@ -12,6 +12,22 @@
#include "lldb/lldb-types.h"
+#if defined (_WIN32)
+ #if defined(EXPORT_LIBLLDB)
+ #define LLDB_API __declspec(dllexport)
+ #elif defined(IMPORT_LIBLLDB)
+ #define LLDB_API __declspec(dllimport)
+ #else
+ #define LLDB_API
+ #endif
+#else // defined (_MSC_VER)
+ #define LLDB_API
+#endif
+
+#if !defined(INT32_MAX)
+ #define INT32_MAX 2147483647
+#endif
+
#if !defined(UINT32_MAX)
#define UINT32_MAX 4294967295U
#endif
@@ -75,6 +91,7 @@
#define LLDB_INVALID_INDEX32 UINT32_MAX
#define LLDB_INVALID_IVAR_OFFSET UINT32_MAX
#define LLDB_INVALID_IMAGE_TOKEN UINT32_MAX
+#define LLDB_INVALID_MODULE_VERSION UINT32_MAX
#define LLDB_INVALID_REGNUM UINT32_MAX
#define LLDB_INVALID_UID UINT64_MAX
#define LLDB_INVALID_PROCESS_ID 0
@@ -86,7 +103,7 @@
#define LLDB_INVALID_QUEUE_ID 0
//----------------------------------------------------------------------
-/// CPU Type defintions
+/// CPU Type definitions
//----------------------------------------------------------------------
#define LLDB_ARCH_DEFAULT "systemArch"
#define LLDB_ARCH_DEFAULT_32BIT "systemArch32"
@@ -94,7 +111,7 @@
#define LLDB_INVALID_CPUTYPE (0xFFFFFFFEu)
//----------------------------------------------------------------------
-/// Option Set defintions
+/// Option Set definitions
//----------------------------------------------------------------------
// FIXME: I'm sure there's some #define magic that can create all 32 sets on the
// fly. That would have the added benefit of making this unreadable.
@@ -112,7 +129,7 @@
#define LLDB_OPT_SET_10 (1U << 9)
#define LLDB_OPT_SET_FROM_TO(A, B) (((1U << (B)) - 1) ^ (((1U << (A))-1) >> 1))
-#ifdef _WIN32
+#if defined (_WIN32) && !defined (MAX_PATH)
#define MAX_PATH 260
#endif
diff --git a/include/lldb/lldb-enumerations.h b/include/lldb/lldb-enumerations.h
index 347e20f21df6..612487fd4fad 100644
--- a/include/lldb/lldb-enumerations.h
+++ b/include/lldb/lldb-enumerations.h
@@ -39,16 +39,18 @@ namespace lldb {
typedef enum LaunchFlags
{
eLaunchFlagNone = 0u,
- eLaunchFlagExec = (1u << 0), ///< Exec when launching and turn the calling process into a new process
- eLaunchFlagDebug = (1u << 1), ///< Stop as soon as the process launches to allow the process to be debugged
- eLaunchFlagStopAtEntry = (1u << 2), ///< Stop at the program entry point instead of auto-continuing when launching or attaching at entry point
- eLaunchFlagDisableASLR = (1u << 3), ///< Disable Address Space Layout Randomization
- eLaunchFlagDisableSTDIO = (1u << 4), ///< Disable stdio for inferior process (e.g. for a GUI app)
- eLaunchFlagLaunchInTTY = (1u << 5), ///< Launch the process in a new TTY if supported by the host
- eLaunchFlagLaunchInShell= (1u << 6), ///< Launch the process inside a shell to get shell expansion
+ eLaunchFlagExec = (1u << 0), ///< Exec when launching and turn the calling process into a new process
+ eLaunchFlagDebug = (1u << 1), ///< Stop as soon as the process launches to allow the process to be debugged
+ eLaunchFlagStopAtEntry = (1u << 2), ///< Stop at the program entry point instead of auto-continuing when launching or attaching at entry point
+ eLaunchFlagDisableASLR = (1u << 3), ///< Disable Address Space Layout Randomization
+ eLaunchFlagDisableSTDIO = (1u << 4), ///< Disable stdio for inferior process (e.g. for a GUI app)
+ eLaunchFlagLaunchInTTY = (1u << 5), ///< Launch the process in a new TTY if supported by the host
+ eLaunchFlagLaunchInShell= (1u << 6), ///< Launch the process inside a shell to get shell expansion
eLaunchFlagLaunchInSeparateProcessGroup = (1u << 7), ///< Launch the process in a separate process group
- eLaunchFlagsDontMonitorProcess = (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 reap it.
+ 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
+ ///< if it loses connection with lldb.
} LaunchFlags;
//----------------------------------------------------------------------
@@ -155,13 +157,16 @@ namespace lldb {
//----------------------------------------------------------------------
// Register numbering types
+ // See RegisterContext::ConvertRegisterKindToRegisterNumber to convert
+ // any of these to the lldb internal register numbering scheme
+ // (eRegisterKindLLDB).
//----------------------------------------------------------------------
typedef enum RegisterKind
{
eRegisterKindGCC = 0, // the register numbers seen in eh_frame
eRegisterKindDWARF, // the register numbers seen DWARF
eRegisterKindGeneric, // insn ptr reg, stack ptr reg, etc not specific to any particular target
- eRegisterKindGDB, // the register numbers gdb uses (matches stabs numbers?)
+ eRegisterKindGDB, // the register numbers gdb uses (matches stabs numbers)
eRegisterKindLLDB, // lldb's internal register numbers
kNumRegisterKinds
} RegisterKind;
@@ -200,6 +205,22 @@ namespace lldb {
//----------------------------------------------------------------------
+ // The results of expression evaluation:
+ //----------------------------------------------------------------------
+ typedef enum ExpressionResults
+ {
+ eExpressionCompleted = 0,
+ eExpressionSetupError,
+ eExpressionParseError,
+ eExpressionDiscarded,
+ eExpressionInterrupted,
+ eExpressionHitBreakpoint,
+ eExpressionTimedOut,
+ eExpressionResultUnavailable,
+ eExpressionStoppedForDebug
+ } ExpressionResults;
+
+ //----------------------------------------------------------------------
// Connection Status Types
//----------------------------------------------------------------------
typedef enum ConnectionStatus
@@ -209,7 +230,8 @@ namespace lldb {
eConnectionStatusError, // Check GetError() for details
eConnectionStatusTimedOut, // Request timed out
eConnectionStatusNoConnection, // No connection
- eConnectionStatusLostConnection // Lost connection while connected to a valid connection
+ eConnectionStatusLostConnection, // Lost connection while connected to a valid connection
+ eConnectionStatusInterrupted // Interrupted read
} ConnectionStatus;
typedef enum ErrorType
@@ -217,7 +239,9 @@ namespace lldb {
eErrorTypeInvalid,
eErrorTypeGeneric, ///< Generic errors that can be any value.
eErrorTypeMachKernel, ///< Mach kernel error codes.
- eErrorTypePOSIX ///< POSIX error codes.
+ eErrorTypePOSIX, ///< POSIX error codes.
+ eErrorTypeExpression, ///< These are from the ExpressionResults enum.
+ eErrorTypeWin32 ///< Standard Win32 error codes.
} ErrorType;
@@ -349,6 +373,18 @@ namespace lldb {
eLanguageTypeUPC = 0x0012, ///< Unified Parallel C.
eLanguageTypeD = 0x0013, ///< D.
eLanguageTypePython = 0x0014, ///< Python.
+ eLanguageTypeOpenCL = 0x0015, ///< OpenCL.
+ eLanguageTypeGo = 0x0016, ///< Go.
+ eLanguageTypeModula3 = 0x0017, ///< Modula 3.
+ eLanguageTypeHaskell = 0x0018, ///< Haskell.
+ eLanguageTypeC_plus_plus_03 = 0x0019, ///< ISO C++:2003.
+ eLanguageTypeC_plus_plus_11 = 0x001a, ///< ISO C++:2011.
+ eLanguageTypeOCaml = 0x001b, ///< OCaml.
+ eLanguageTypeRust = 0x001c, ///< Rust.
+ eLanguageTypeC11 = 0x001d, ///< ISO C:2011.
+ eLanguageTypeSwift = 0x001e, ///< Swift.
+ eLanguageTypeJulia = 0x001f, ///< Julia.
+ eLanguageTypeDylan = 0x0020, ///< Dylan.
eNumLanguageTypes
} LanguageType;
@@ -653,14 +689,22 @@ namespace lldb {
} TypeOptions;
//----------------------------------------------------------------------
- // This is the return value for frame comparisons. When frame A pushes
- // frame B onto the stack, frame A is OLDER than frame B.
+ // This is the return value for frame comparisons. If you are comparing frame A to frame B
+ // the following cases arise:
+ // 1) When frame A pushes frame B (or a frame that ends up pushing B) A is Older than B.
+ // 2) When frame A pushed frame B (or if frame A is on the stack but B is not) A is Younger than B
+ // 3) When frame A and frame B have the same StackID, they are Equal.
+ // 4) When frame A and frame B have the same immediate parent frame, but are not equal, the comparision yields
+ // SameParent.
+ // 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
{
eFrameCompareInvalid,
eFrameCompareUnknown,
eFrameCompareEqual,
+ eFrameCompareSameParent,
eFrameCompareYounger,
eFrameCompareOlder
} FrameComparison;
@@ -741,6 +785,71 @@ namespace lldb {
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
+ {
+ eQueueKindUnknown = 0,
+ eQueueKindSerial,
+ eQueueKindConcurrent
+ } QueueKind;
+
+ //----------------------------------------------------------------------
+ // Expression Evaluation Stages
+ // These are the cancellable stages of expression evaluation, passed to the
+ // expression evaluation callback, so that you can interrupt expression
+ // evaluation at the various points in its lifecycle.
+ //----------------------------------------------------------------------
+ typedef enum ExpressionEvaluationPhase
+ {
+ eExpressionEvaluationParse = 0,
+ eExpressionEvaluationIRGen,
+ eExpressionEvaluationExecution,
+ eExpressionEvaluationComplete
+ } ExpressionEvaluationPhase;
+
+
+ //----------------------------------------------------------------------
+ // Watchpoint Kind
+ // Indicates what types of events cause the watchpoint to fire.
+ // Used by Native*Protocol-related classes.
+ //----------------------------------------------------------------------
+ typedef enum WatchpointKind
+ {
+ eWatchpointKindRead = (1u << 0),
+ eWatchpointKindWrite = (1u << 1)
+ } WatchpointKind;
+
+ typedef enum GdbSignal
+ {
+ eGdbSignalBadAccess = 0x91,
+ eGdbSignalBadInstruction = 0x92,
+ eGdbSignalArithmetic = 0x93,
+ 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
+
+ } PathType;
+
} // namespace lldb
diff --git a/include/lldb/lldb-forward.h b/include/lldb/lldb-forward.h
index 43e589e39521..b3d15224acb5 100644
--- a/include/lldb/lldb-forward.h
+++ b/include/lldb/lldb-forward.h
@@ -80,7 +80,6 @@ class Debugger;
class Declaration;
class Disassembler;
struct DumpValueObjectOptions;
-class DynamicLibrary;
class DynamicLoader;
class Editline;
class EmulateInstruction;
@@ -106,7 +105,9 @@ class InlineFunctionInfo;
class Instruction;
class InstructionList;
class IOHandler;
+class IOObject;
class IRExecutionUnit;
+class JITLoader;
class LanguageRuntime;
class SystemRuntime;
class LineTable;
@@ -127,6 +128,7 @@ class OptionGroup;
class OptionGroupOptions;
class OptionGroupPlatform;
class ObjectFile;
+class ObjectFileJITDelegate;
class OperatingSystem;
class Options;
class OptionValue;
@@ -242,9 +244,12 @@ class TypeImpl;
class TypeList;
class TypeListImpl;
class TypeMemberImpl;
+class TypeEnumMemberImpl;
+class TypeEnumMemberListImpl;
class TypeNameSpecifierImpl;
class TypePair;
class UUID;
+class UnixSignals;
class Unwind;
class UnwindAssembly;
class UnwindPlan;
@@ -295,7 +300,6 @@ 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::shared_ptr<lldb_private::DynamicLibrary> DynamicLibrarySP;
typedef std::shared_ptr<lldb_private::DynamicLoader> DynamicLoaderSP;
typedef std::shared_ptr<lldb_private::Event> EventSP;
typedef std::shared_ptr<lldb_private::ExecutionContextRef> ExecutionContextRefSP;
@@ -305,6 +309,8 @@ namespace lldb {
typedef std::shared_ptr<lldb_private::InlineFunctionInfo> InlineFunctionInfoSP;
typedef std::shared_ptr<lldb_private::Instruction> InstructionSP;
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::shared_ptr<lldb_private::LanguageRuntime> LanguageRuntimeSP;
typedef std::shared_ptr<lldb_private::SystemRuntime> SystemRuntimeSP;
typedef std::shared_ptr<lldb_private::LineTable> LineTableSP;
@@ -314,6 +320,8 @@ namespace lldb {
typedef std::weak_ptr<lldb_private::Module> ModuleWP;
typedef std::shared_ptr<lldb_private::ObjectFile> ObjectFileSP;
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::shared_ptr<lldb_private::OptionValue> OptionValueSP;
typedef std::weak_ptr<lldb_private::OptionValue> OptionValueWP;
typedef std::shared_ptr<lldb_private::OptionValueArch> OptionValueArchSP;
@@ -377,6 +385,7 @@ namespace lldb {
typedef std::weak_ptr<lldb_private::Type> TypeWP;
typedef std::shared_ptr<lldb_private::TypeCategoryImpl> TypeCategoryImplSP;
typedef std::shared_ptr<lldb_private::TypeImpl> TypeImplSP;
+ typedef std::shared_ptr<lldb_private::TypeEnumMemberImpl> TypeEnumMemberImplSP;
typedef std::shared_ptr<lldb_private::TypeFilterImpl> TypeFilterImplSP;
typedef std::shared_ptr<lldb_private::TypeFormatImpl> TypeFormatImplSP;
typedef std::shared_ptr<lldb_private::TypeNameSpecifierImpl> TypeNameSpecifierImplSP;
diff --git a/include/lldb/lldb-private-enumerations.h b/include/lldb/lldb-private-enumerations.h
index c2273f5dfe2e..ee1589fe24ed 100644
--- a/include/lldb/lldb-private-enumerations.h
+++ b/include/lldb/lldb-private-enumerations.h
@@ -105,40 +105,6 @@ typedef enum SortOrder
eSortOrderByName
} SortOrder;
-
-//----------------------------------------------------------------------
-// Used in conjunction with Host::GetLLDBPath () to find files that
-// are related to
-//----------------------------------------------------------------------
-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
-
-} PathType;
-
-
-//----------------------------------------------------------------------
-// We can execute ThreadPlans on one thread with various fall-back modes
-// (try other threads after timeout, etc.) This enum gives the result of
-// thread plan executions.
-//----------------------------------------------------------------------
-typedef enum ExecutionResults
-{
- eExecutionSetupError,
- eExecutionCompleted,
- eExecutionDiscarded,
- eExecutionInterrupted,
- eExecutionHitBreakpoint,
- eExecutionTimedOut,
- eExecutionStoppedForDebug
-} ExecutionResults;
-
typedef enum ObjCRuntimeVersions {
eObjC_VersionUnknown = 0,
eAppleObjC_V1 = 1,
@@ -178,7 +144,7 @@ typedef enum NameMatchType
typedef enum InstructionType
{
eInstructionTypeAny, // Support for any instructions at all (at least one)
- eInstructionTypePrologueEpilogue, // All prologue and epilogue instructons that push and pop register values and modify sp/fp
+ eInstructionTypePrologueEpilogue, // All prologue and epilogue instructions that push and pop register values and modify sp/fp
eInstructionTypePCModifying, // Any instruction that modifies the program counter/instruction pointer
eInstructionTypeAll // All instructions of any kind
@@ -262,6 +228,16 @@ enum class LineStatus {
Done // Lines are complete
};
+//----------------------------------------------------------------------
+// Exit Type for inferior processes
+//----------------------------------------------------------------------
+typedef enum ExitType {
+ eExitTypeInvalid,
+ eExitTypeExit, // The exit status represents the return code from normal program exit (i.e. WIFEXITED() was true)
+ eExitTypeSignal, // The exit status represents the signal number that caused the program to exit (i.e. WIFSIGNALED() was true)
+ eExitTypeStop, // The exit status represents the stop signal that caused the program to exit (i.e. WIFSTOPPED() was true)
+} ExitType;
+
} // namespace lldb_private
diff --git a/include/lldb/lldb-private-forward.h b/include/lldb/lldb-private-forward.h
new file mode 100644
index 000000000000..424aa4cc53f4
--- /dev/null
+++ b/include/lldb/lldb-private-forward.h
@@ -0,0 +1,41 @@
+//===-- lldb-private-forward.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_lldb_private_forward_h_
+#define LLDB_lldb_private_forward_h_
+
+#if defined(__cplusplus)
+
+#include <memory>
+
+namespace lldb_private
+{
+ // ---------------------------------------------------------------
+ // Class forward decls.
+ // ---------------------------------------------------------------
+ class NativeBreakpoint;
+ class NativeBreakpointList;
+ class NativeProcessProtocol;
+ class NativeRegisterContext;
+ class NativeThreadProtocol;
+ class UnixSignals;
+
+ // ---------------------------------------------------------------
+ // SP/WP decls.
+ // ---------------------------------------------------------------
+ typedef std::shared_ptr<NativeBreakpoint> NativeBreakpointSP;
+ typedef std::shared_ptr<lldb_private::NativeProcessProtocol> NativeProcessProtocolSP;
+ typedef std::weak_ptr<lldb_private::NativeProcessProtocol> NativeProcessProtocolWP;
+ typedef std::shared_ptr<lldb_private::NativeRegisterContext> NativeRegisterContextSP;
+ typedef std::shared_ptr<lldb_private::NativeThreadProtocol> NativeThreadProtocolSP;
+ typedef std::shared_ptr<lldb_private::UnixSignals> UnixSignalsSP;
+}
+
+#endif // #if defined(__cplusplus)
+#endif // #ifndef LLDB_lldb_private_forward_h_
diff --git a/include/lldb/lldb-private-interfaces.h b/include/lldb/lldb-private-interfaces.h
index 5a2da8989f35..3251d6a9fe6c 100644
--- a/include/lldb/lldb-private-interfaces.h
+++ b/include/lldb/lldb-private-interfaces.h
@@ -19,10 +19,12 @@ namespace lldb_private
typedef lldb::ABISP (*ABICreateInstance) (const ArchSpec &arch);
typedef Disassembler* (*DisassemblerCreateInstance) (const ArchSpec &arch, const char *flavor);
typedef DynamicLoader* (*DynamicLoaderCreateInstance) (Process* process, bool force);
+ typedef lldb::JITLoaderSP (*JITLoaderCreateInstance) (Process *process, bool force);
typedef ObjectContainer* (*ObjectContainerCreateInstance) (const lldb::ModuleSP &module_sp, lldb::DataBufferSP& data_sp, lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t offset, lldb::offset_t length);
typedef size_t (*ObjectFileGetModuleSpecifications) (const FileSpec &file, lldb::DataBufferSP& data_sp, lldb::offset_t data_offset, lldb::offset_t file_offset, lldb::offset_t length, ModuleSpecList &module_specs);
typedef ObjectFile* (*ObjectFileCreateInstance) (const lldb::ModuleSP &module_sp, lldb::DataBufferSP& data_sp, lldb::offset_t data_offset, const FileSpec* file, lldb::offset_t file_offset, lldb::offset_t length);
typedef ObjectFile* (*ObjectFileCreateMemoryInstance) (const lldb::ModuleSP &module_sp, lldb::DataBufferSP& data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t offset);
+ typedef bool (*ObjectFileSaveCore) (const lldb::ProcessSP &process_sp, const FileSpec &outfile, Error &error);
typedef LogChannel* (*LogChannelCreateInstance) ();
typedef EmulateInstruction * (*EmulateInstructionCreateInstance) (const ArchSpec &arch, InstructionType inst_type);
typedef OperatingSystem* (*OperatingSystemCreateInstance) (Process *process, bool force);
@@ -34,10 +36,10 @@ namespace lldb_private
typedef SymbolVendor* (*SymbolVendorCreateInstance) (const lldb::ModuleSP &module_sp, lldb_private::Stream *feedback_strm); // Module can be NULL for default system symbol vendor
typedef bool (*BreakpointHitCallback) (void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
typedef bool (*WatchpointHitCallback) (void *baton, StoppointCallbackContext *context, lldb::user_id_t watch_id);
- typedef lldb::ThreadPlanSP (*ThreadPlanShouldStopHereCallback) (ThreadPlan *current_plan, Flags &flags, void *baton);
+ typedef bool (*ThreadPlanShouldStopHereCallback) (ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation, void *baton);
+ typedef lldb::ThreadPlanSP (*ThreadPlanStepFromHereCallback) (ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation, void *baton);
typedef UnwindAssembly* (*UnwindAssemblyCreateInstance) (const ArchSpec &arch);
typedef int (*ComparisonFunction)(const void *, const void *);
- typedef bool (*CommandOverrideCallback)(void *baton, const char **argv);
typedef void (*DebuggerInitializeCallback)(Debugger &debugger);
} // namespace lldb_private
diff --git a/include/lldb/lldb-private-log.h b/include/lldb/lldb-private-log.h
index 9d8d735dcf41..dc37ae2c7c42 100644
--- a/include/lldb/lldb-private-log.h
+++ b/include/lldb/lldb-private-log.h
@@ -46,6 +46,7 @@
#define LIBLLDB_LOG_OS (1u << 24)
#define LIBLLDB_LOG_PLATFORM (1u << 25)
#define LIBLLDB_LOG_SYSTEM_RUNTIME (1u << 26)
+#define LIBLLDB_LOG_JIT_LOADER (1u << 27)
#define LIBLLDB_LOG_ALL (UINT32_MAX)
#define LIBLLDB_LOG_DEFAULT (LIBLLDB_LOG_PROCESS |\
LIBLLDB_LOG_THREAD |\
diff --git a/include/lldb/lldb-private-types.h b/include/lldb/lldb-private-types.h
index 4340af114be3..12a9324008d8 100644
--- a/include/lldb/lldb-private-types.h
+++ b/include/lldb/lldb-private-types.h
@@ -16,6 +16,9 @@
namespace lldb_private
{
+ class Platform;
+ class ExecutionContext;
+
//----------------------------------------------------------------------
// Every register is described in detail including its name, alternate
// name (optional), encoding, size in bytes and the default display
@@ -51,8 +54,16 @@ namespace lldb_private
const char *string_value;
const char *usage;
} OptionEnumValueElement;
+
+ struct OptionValidator
+ {
+ virtual ~OptionValidator() { }
+ virtual bool IsValid(Platform &platform, const ExecutionContext &target) const = 0;
+ virtual const char * ShortConditionString() const = 0;
+ virtual const char * LongConditionString() const = 0;
+ };
- typedef struct
+ struct OptionDefinition
{
uint32_t usage_mask; // Used to mark options that can be used together. If (1 << n & usage_mask) != 0
// then this option belongs to option set n.
@@ -60,12 +71,13 @@ namespace lldb_private
const char *long_option; // Full name for this option.
int short_option; // Single character for this option.
int option_has_arg; // no_argument, required_argument or optional_argument
+ OptionValidator* validator; // If non-NULL, option is valid iff |validator->IsValid()|, otherwise always valid.
OptionEnumValueElement *enum_values; // If non-NULL an array of enum values.
uint32_t completion_type; // Cookie the option class can use to do define the argument completion.
lldb::CommandArgumentType argument_type; // Type of argument this option takes
const char *usage_text; // Full text explaining what this options does and what (if any) argument to
// pass it.
- } OptionDefinition;
+ };
} // namespace lldb_private
diff --git a/include/lldb/lldb-python.h b/include/lldb/lldb-python.h
index ce5c8176a3c3..c8ef054f60e1 100644
--- a/include/lldb/lldb-python.h
+++ b/include/lldb/lldb-python.h
@@ -13,13 +13,19 @@
// Python.h needs to be included before any system headers in order to avoid redefinition of macros
#ifdef LLDB_DISABLE_PYTHON
-
// Python is disabled in this build
-
#else
-
-#include <Python.h>
-
+ #if defined(__linux__)
+ // features.h will define _POSIX_C_SOURCE if _GNU_SOURCE is defined. This value
+ // may be different from the value that Python defines it to be which results
+ // in a warning. Undefine _POSIX_C_SOURCE before including Python.h The same
+ // holds for _XOPEN_SOURCE.
+ #undef _POSIX_C_SOURCE
+ #undef _XOPEN_SOURCE
+ #endif
+
+ // Include python for non windows machines
+ #include <Python.h>
#endif // LLDB_DISABLE_PYTHON
#endif // LLDB_lldb_python_h_
diff --git a/include/lldb/lldb-types.h b/include/lldb/lldb-types.h
index 5851b5d3f923..fee920f5b198 100644
--- a/include/lldb/lldb-types.h
+++ b/include/lldb/lldb-types.h
@@ -49,37 +49,46 @@ namespace lldb
typedef void* mutex_t;
typedef void* condition_t;
typedef void* rwlock_t;
+ typedef void* process_t; // Process type is HANDLE
typedef uintptr_t thread_t; // Host thread type
typedef uint32_t thread_key_t;
typedef void * thread_arg_t; // Host thread argument type
typedef unsigned thread_result_t; // Host thread result type
typedef thread_result_t (*thread_func_t)(void *); // Host thread function type
- typedef void (*LogOutputCallback) (const char *, void *baton);
- typedef bool (*CommandOverrideCallback)(void *baton, const char **argv);
}
#else
#include <pthread.h>
-namespace lldb {
- //----------------------------------------------------------------------
- // MacOSX Types
- //----------------------------------------------------------------------
- typedef ::pthread_mutex_t mutex_t;
- typedef pthread_cond_t condition_t;
- typedef pthread_rwlock_t rwlock_t;
- typedef pthread_t thread_t; // Host thread type
- typedef pthread_key_t thread_key_t;
- typedef void * thread_arg_t; // Host thread argument type
- typedef void * thread_result_t; // Host thread result type
- typedef void * (*thread_func_t)(void *); // Host thread function type
- typedef void (*LogOutputCallback) (const char *, void *baton);
- typedef bool (*CommandOverrideCallback)(void *baton, const char **argv);
+namespace lldb
+{
+ //----------------------------------------------------------------------
+ // MacOSX Types
+ //----------------------------------------------------------------------
+ typedef ::pthread_mutex_t mutex_t;
+ typedef pthread_cond_t condition_t;
+ typedef pthread_rwlock_t rwlock_t;
+ typedef uint64_t process_t; // Process type is just a pid.
+ typedef pthread_t thread_t; // Host thread type
+ typedef pthread_key_t thread_key_t;
+ typedef void * thread_arg_t; // Host thread argument type
+ typedef void * thread_result_t; // Host thread result type
+ typedef void * (*thread_func_t)(void *); // Host thread function type
} // namespace lldb
#endif
+namespace lldb
+{
+ typedef void (*LogOutputCallback) (const char *, void *baton);
+ typedef bool (*CommandOverrideCallback)(void *baton, const char **argv);
+ typedef bool (*CommandOverrideCallbackWithResult)(void *baton,
+ const char **argv,
+ lldb_private::CommandReturnObject &result);
+ typedef bool (*ExpressionCancelCallback) (ExpressionEvaluationPhase phase, void *baton);
+}
+
#define LLDB_INVALID_HOST_THREAD ((lldb::thread_t)NULL)
#define IS_VALID_LLDB_HOST_THREAD(t) ((t) != LLDB_INVALID_HOST_THREAD)