aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2013-12-03 18:51:59 +0000
committerEd Maste <emaste@FreeBSD.org>2013-12-03 18:51:59 +0000
commit86758c718870f701bc69c1ca05495305ed1c5b85 (patch)
treeb2051e4e4856cc58ac7e2d20242b870b4f355ca1 /include
parentf21a844f60ae6c74fcf1fddca32461acce3c1ee0 (diff)
downloadsrc-86758c718870f701bc69c1ca05495305ed1c5b85.tar.gz
src-86758c718870f701bc69c1ca05495305ed1c5b85.zip
Import lldb as of SVN r196259 (git 3be86e5)vendor/lldb/lldb-r196259
(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=258882 svn path=/vendor/lldb/lldb-r196259/; revision=258883; tag=vendor/lldb/lldb-r196259
Diffstat (limited to 'include')
-rw-r--r--include/lldb/API/SBDebugger.h10
-rw-r--r--include/lldb/API/SBError.h1
-rw-r--r--include/lldb/API/SBExpressionOptions.h6
-rw-r--r--include/lldb/API/SBFileSpec.h7
-rw-r--r--include/lldb/API/SBModule.h36
-rw-r--r--include/lldb/API/SBPlatform.h198
-rw-r--r--include/lldb/API/SBTarget.h17
-rw-r--r--include/lldb/API/SBThread.h5
-rw-r--r--include/lldb/Breakpoint/Breakpoint.h18
-rw-r--r--include/lldb/Breakpoint/BreakpointList.h19
-rw-r--r--include/lldb/Breakpoint/BreakpointLocationList.h5
-rw-r--r--include/lldb/Core/Address.h12
-rw-r--r--include/lldb/Core/Debugger.h14
-rw-r--r--include/lldb/Core/Module.h13
-rw-r--r--include/lldb/DataFormatters/CXXFormatterFunctions.h2
-rw-r--r--include/lldb/DataFormatters/FormatCache.h1
-rw-r--r--include/lldb/DataFormatters/FormatClasses.h84
-rw-r--r--include/lldb/DataFormatters/FormatManager.h30
-rw-r--r--include/lldb/DataFormatters/FormatNavigator.h226
-rw-r--r--include/lldb/DataFormatters/TypeCategory.h8
-rw-r--r--include/lldb/Expression/ClangFunction.h227
-rw-r--r--include/lldb/Expression/ClangUserExpression.h4
-rw-r--r--include/lldb/Host/Debug.h406
-rw-r--r--include/lldb/Host/File.h43
-rw-r--r--include/lldb/Host/FileSpec.h17
-rw-r--r--include/lldb/Host/Host.h21
-rw-r--r--include/lldb/Host/OptionParser.h5
-rw-r--r--include/lldb/Interpreter/PythonDataObjects.h6
-rw-r--r--include/lldb/Interpreter/ScriptInterpreterPython.h7
-rw-r--r--include/lldb/Symbol/TypeList.h11
-rw-r--r--include/lldb/Target/ABI.h9
-rw-r--r--include/lldb/Target/LanguageRuntime.h6
-rw-r--r--include/lldb/Target/Platform.h103
-rw-r--r--include/lldb/Target/Process.h27
-rw-r--r--include/lldb/Target/RegisterCheckpoint.h71
-rw-r--r--include/lldb/Target/RegisterContext.h18
-rw-r--r--include/lldb/Target/SystemRuntime.h7
-rw-r--r--include/lldb/Target/Target.h92
-rw-r--r--include/lldb/Target/Thread.h174
-rw-r--r--include/lldb/Target/ThreadList.h11
-rw-r--r--include/lldb/Target/ThreadPlanCallFunction.h32
-rw-r--r--include/lldb/Target/ThreadPlanCallUserExpression.h10
-rw-r--r--include/lldb/Utility/Iterable.h225
-rw-r--r--include/lldb/Utility/PythonPointer.h6
-rw-r--r--include/lldb/lldb-enumerations.h42
-rw-r--r--include/lldb/lldb-forward.h3
-rw-r--r--include/lldb/lldb-private-enumerations.h3
-rw-r--r--include/lldb/lldb-python.h4
48 files changed, 1567 insertions, 735 deletions
diff --git a/include/lldb/API/SBDebugger.h b/include/lldb/API/SBDebugger.h
index 518cbf67c932..80e6969cbd3a 100644
--- a/include/lldb/API/SBDebugger.h
+++ b/include/lldb/API/SBDebugger.h
@@ -10,9 +10,11 @@
#ifndef LLDB_SBDebugger_h_
#define LLDB_SBDebugger_h_
-#include "lldb/API/SBDefines.h"
#include <stdio.h>
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBPlatform.h"
+
namespace lldb {
class SBDebugger
@@ -153,6 +155,12 @@ public:
void
SetSelectedTarget (SBTarget& target);
+ lldb::SBPlatform
+ GetSelectedPlatform();
+
+ void
+ SetSelectedPlatform(lldb::SBPlatform &platform);
+
lldb::SBSourceManager
GetSourceManager ();
diff --git a/include/lldb/API/SBError.h b/include/lldb/API/SBError.h
index a6d3dacb4549..12b34ec6dbc3 100644
--- a/include/lldb/API/SBError.h
+++ b/include/lldb/API/SBError.h
@@ -72,6 +72,7 @@ protected:
friend class SBCommunication;
friend class SBHostOS;
friend class SBInputReader;
+ friend class SBPlatform;
friend class SBProcess;
friend class SBThread;
friend class SBTarget;
diff --git a/include/lldb/API/SBExpressionOptions.h b/include/lldb/API/SBExpressionOptions.h
index eed9ed528bef..6a3a640432f6 100644
--- a/include/lldb/API/SBExpressionOptions.h
+++ b/include/lldb/API/SBExpressionOptions.h
@@ -65,6 +65,12 @@ public:
void
SetTryAllThreads (bool run_others = true);
+ bool
+ GetTrapExceptions () const;
+
+ void
+ SetTrapExceptions (bool trap_exceptions = true);
+
protected:
SBExpressionOptions (lldb_private::EvaluateExpressionOptions &expression_options);
diff --git a/include/lldb/API/SBFileSpec.h b/include/lldb/API/SBFileSpec.h
index e44abe4759c6..5d4447f74e64 100644
--- a/include/lldb/API/SBFileSpec.h
+++ b/include/lldb/API/SBFileSpec.h
@@ -45,6 +45,12 @@ public:
const char *
GetDirectory() const;
+ void
+ SetFilename(const char *filename);
+
+ void
+ SetDirectory(const char *directory);
+
uint32_t
GetPath (char *dst_path, size_t dst_len) const;
@@ -65,6 +71,7 @@ private:
friend class SBLineEntry;
friend class SBModule;
friend class SBModuleSpec;
+ friend class SBPlatform;
friend class SBProcess;
friend class SBSourceManager;
friend class SBThread;
diff --git a/include/lldb/API/SBModule.h b/include/lldb/API/SBModule.h
index a3c4879aa2f9..f5955b39734d 100644
--- a/include/lldb/API/SBModule.h
+++ b/include/lldb/API/SBModule.h
@@ -76,6 +76,42 @@ public:
bool
SetPlatformFileSpec (const lldb::SBFileSpec &platform_file);
+ //------------------------------------------------------------------
+ /// Get accessor for the remote install path for a module.
+ ///
+ /// When debugging to a remote platform by connecting to a remote
+ /// platform, the install path of the module can be set. If the
+ /// install path is set, every time the process is about to launch
+ /// the target will install this module on the remote platform prior
+ /// to launching.
+ ///
+ /// @return
+ /// A file specification object.
+ //------------------------------------------------------------------
+ lldb::SBFileSpec
+ GetRemoteInstallFileSpec ();
+
+ //------------------------------------------------------------------
+ /// Set accessor for the remote install path for a module.
+ ///
+ /// When debugging to a remote platform by connecting to a remote
+ /// platform, the install path of the module can be set. If the
+ /// install path is set, every time the process is about to launch
+ /// the target will install this module on the remote platform prior
+ /// to launching.
+ ///
+ /// If \a file specifies a full path to an install location, the
+ /// module will be installed to this path. If the path is relative
+ /// (no directory specified, or the path is partial like "usr/lib"
+ /// or "./usr/lib", then the install path will be resolved using
+ /// the platform's current working directory as the base path.
+ ///
+ /// @param[in]
+ /// A file specification object.
+ //------------------------------------------------------------------
+ bool
+ SetRemoteInstallFileSpec (lldb::SBFileSpec &file);
+
lldb::ByteOrder
GetByteOrder ();
diff --git a/include/lldb/API/SBPlatform.h b/include/lldb/API/SBPlatform.h
new file mode 100644
index 000000000000..16a546d81f9b
--- /dev/null
+++ b/include/lldb/API/SBPlatform.h
@@ -0,0 +1,198 @@
+//===-- SBPlatform.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_SBPlatform_h_
+#define LLDB_SBPlatform_h_
+
+#include "lldb/API/SBDefines.h"
+
+struct PlatformConnectOptions;
+struct PlatformShellCommand;
+
+namespace lldb {
+
+ class SBPlatformConnectOptions
+ {
+ public:
+ SBPlatformConnectOptions (const char *url);
+
+ SBPlatformConnectOptions (const SBPlatformConnectOptions &rhs);
+
+ ~SBPlatformConnectOptions ();
+
+ void
+ operator=(const SBPlatformConnectOptions &rhs);
+
+ const char *
+ GetURL();
+
+ void
+ SetURL(const char *url);
+
+ bool
+ GetRsyncEnabled();
+
+ void
+ EnableRsync (const char *options,
+ const char *remote_path_prefix,
+ bool omit_remote_hostname);
+
+ void
+ DisableRsync ();
+
+ const char *
+ GetLocalCacheDirectory();
+
+ void
+ SetLocalCacheDirectory(const char *path);
+ protected:
+ PlatformConnectOptions *m_opaque_ptr;
+ };
+
+ class SBPlatformShellCommand
+ {
+ public:
+ SBPlatformShellCommand (const char *shell_command);
+
+ SBPlatformShellCommand (const SBPlatformShellCommand &rhs);
+
+ ~SBPlatformShellCommand();
+
+ void
+ Clear();
+
+ const char *
+ GetCommand();
+
+ void
+ SetCommand(const char *shell_command);
+
+ const char *
+ GetWorkingDirectory ();
+
+ void
+ SetWorkingDirectory (const char *path);
+
+ uint32_t
+ GetTimeoutSeconds ();
+
+ void
+ SetTimeoutSeconds (uint32_t sec);
+
+ int
+ GetSignal ();
+
+ int
+ GetStatus ();
+
+ const char *
+ GetOutput ();
+
+ protected:
+ friend class SBPlatform;
+
+ PlatformShellCommand *m_opaque_ptr;
+ };
+
+ class SBPlatform
+ {
+ public:
+
+ SBPlatform ();
+
+ SBPlatform (const char *platform_name);
+
+ ~SBPlatform();
+
+ bool
+ IsValid () const;
+
+ void
+ Clear ();
+
+ const char *
+ GetWorkingDirectory();
+
+ bool
+ SetWorkingDirectory(const char *path);
+
+ const char *
+ GetName ();
+
+ SBError
+ ConnectRemote (SBPlatformConnectOptions &connect_options);
+
+ void
+ DisconnectRemote ();
+
+ bool
+ IsConnected();
+
+ //----------------------------------------------------------------------
+ // The following functions will work if the platform is connected
+ //----------------------------------------------------------------------
+ const char *
+ GetTriple();
+
+ const char *
+ GetHostname ();
+
+ const char *
+ GetOSBuild ();
+
+ const char *
+ GetOSDescription ();
+
+ uint32_t
+ GetOSMajorVersion ();
+
+ uint32_t
+ GetOSMinorVersion ();
+
+ uint32_t
+ GetOSUpdateVersion ();
+
+ SBError
+ Put (SBFileSpec &src, SBFileSpec &dst);
+
+ SBError
+ Get (SBFileSpec &src, SBFileSpec &dst);
+
+ SBError
+ Install (SBFileSpec& src, SBFileSpec& dst);
+
+ SBError
+ Run (SBPlatformShellCommand &shell_command);
+
+ SBError
+ MakeDirectory (const char *path, uint32_t file_permissions = eFilePermissionsDirectoryDefault);
+
+ uint32_t
+ GetFilePermissions (const char *path);
+
+ SBError
+ SetFilePermissions (const char *path, uint32_t file_permissions);
+
+ protected:
+
+ friend class SBDebugger;
+ friend class SBTarget;
+
+ lldb::PlatformSP
+ GetSP () const;
+
+ void
+ SetSP (const lldb::PlatformSP& platform_sp);
+
+ lldb::PlatformSP m_opaque_sp;
+ };
+
+} // namespace lldb
+
+#endif // LLDB_SBPlatform_h_
diff --git a/include/lldb/API/SBTarget.h b/include/lldb/API/SBTarget.h
index 7bcf91c16d77..b41c11811549 100644
--- a/include/lldb/API/SBTarget.h
+++ b/include/lldb/API/SBTarget.h
@@ -268,6 +268,23 @@ public:
GetProcess ();
//------------------------------------------------------------------
+ /// Install any binaries that need to be installed.
+ ///
+ /// This function does nothing when debugging on the host system.
+ /// When connected to remote platforms, the target's main executable
+ /// and any modules that have their remote install path set will be
+ /// installed on the remote platform. If the main executable doesn't
+ /// have an install location set, it will be installed in the remote
+ /// platform's working directory.
+ ///
+ /// @return
+ /// An error describing anything that went wrong during
+ /// installation.
+ //------------------------------------------------------------------
+ SBError
+ Install();
+
+ //------------------------------------------------------------------
/// Launch a new process.
///
/// Launch a new process by spawning a new process using the
diff --git a/include/lldb/API/SBThread.h b/include/lldb/API/SBThread.h
index d062d7121303..6542dca1f95a 100644
--- a/include/lldb/API/SBThread.h
+++ b/include/lldb/API/SBThread.h
@@ -202,7 +202,10 @@ public:
GetStatus (lldb::SBStream &status) const;
SBThread
- GetExtendedBacktrace (const char *type);
+ GetExtendedBacktraceThread (const char *type);
+
+ uint32_t
+ GetExtendedBacktraceOriginatingIndexID ();
protected:
friend class SBBreakpoint;
diff --git a/include/lldb/Breakpoint/Breakpoint.h b/include/lldb/Breakpoint/Breakpoint.h
index 30cc3314af3a..e82d6eacf7a8 100644
--- a/include/lldb/Breakpoint/Breakpoint.h
+++ b/include/lldb/Breakpoint/Breakpoint.h
@@ -311,6 +311,24 @@ public:
//------------------------------------------------------------------
lldb::BreakpointLocationSP
GetLocationAtIndex (size_t index);
+
+ //------------------------------------------------------------------
+ /// Removes all invalid breakpoint locations.
+ ///
+ /// Removes all breakpoint locations with architectures that aren't
+ /// compatible with \a arch. Also remove any breakpoint locations
+ /// with whose locations have address where the section has been
+ /// deleted (module and object files no longer exist).
+ ///
+ /// This is typically used after the process calls exec, or anytime
+ /// the architecture of the target changes.
+ ///
+ /// @param[in] arch
+ /// If valid, check the module in each breakpoint to make sure
+ /// they are compatible, otherwise, ignore architecture.
+ //------------------------------------------------------------------
+ void
+ RemoveInvalidLocations (const ArchSpec &arch);
//------------------------------------------------------------------
// The next section deals with various breakpoint options.
diff --git a/include/lldb/Breakpoint/BreakpointList.h b/include/lldb/Breakpoint/BreakpointList.h
index c6708db118df..27f80d0ffe09 100644
--- a/include/lldb/Breakpoint/BreakpointList.h
+++ b/include/lldb/Breakpoint/BreakpointList.h
@@ -132,6 +132,25 @@ public:
bool
Remove (lldb::break_id_t breakID, bool notify);
+
+ //------------------------------------------------------------------
+ /// Removes all invalid breakpoint locations.
+ ///
+ /// Removes all breakpoint locations in the list with architectures
+ /// that aren't compatible with \a arch. Also remove any breakpoint
+ /// locations with whose locations have address where the section
+ /// has been deleted (module and object files no longer exist).
+ ///
+ /// This is typically used after the process calls exec, or anytime
+ /// the architecture of the target changes.
+ ///
+ /// @param[in] arch
+ /// If valid, check the module in each breakpoint to make sure
+ /// they are compatible, otherwise, ignore architecture.
+ //------------------------------------------------------------------
+ void
+ RemoveInvalidLocations (const ArchSpec &arch);
+
void
SetEnabledAll (bool enabled);
diff --git a/include/lldb/Breakpoint/BreakpointLocationList.h b/include/lldb/Breakpoint/BreakpointLocationList.h
index 1cba23d9118e..b25208659c7f 100644
--- a/include/lldb/Breakpoint/BreakpointLocationList.h
+++ b/include/lldb/Breakpoint/BreakpointLocationList.h
@@ -250,6 +250,9 @@ protected:
bool
RemoveLocation (const lldb::BreakpointLocationSP &bp_loc_sp);
+
+ void
+ RemoveInvalidLocations (const ArchSpec &arch);
typedef std::vector<lldb::BreakpointLocationSP> collection;
typedef std::map<lldb_private::Address,
@@ -257,7 +260,7 @@ protected:
Address::ModulePointerAndOffsetLessThanFunctionObject> addr_map;
Breakpoint &m_owner;
- collection m_locations;
+ collection m_locations; // Vector of locations, sorted by ID
addr_map m_address_to_location;
mutable Mutex m_mutex;
lldb::break_id_t m_next_id;
diff --git a/include/lldb/Core/Address.h b/include/lldb/Core/Address.h
index da7cc5c03d38..322019395ae7 100644
--- a/include/lldb/Core/Address.h
+++ b/include/lldb/Core/Address.h
@@ -534,6 +534,16 @@ public:
bool
CalculateSymbolContextLineEntry (LineEntry &line_entry) const;
+ //------------------------------------------------------------------
+ // Returns true if the section should be valid, but isn't because
+ // the shared pointer to the section can't be reconstructed from
+ // a weak pointer that contains a valid weak reference to a section.
+ // Returns false if the section weak pointer has no reference to
+ // a section, or if the section is still valid
+ //------------------------------------------------------------------
+ bool
+ SectionWasDeleted() const;
+
protected:
//------------------------------------------------------------------
// Member variables.
@@ -550,7 +560,7 @@ protected:
// have a valid section.
//------------------------------------------------------------------
bool
- SectionWasDeleted() const;
+ SectionWasDeletedPrivate() const;
};
diff --git a/include/lldb/Core/Debugger.h b/include/lldb/Core/Debugger.h
index 671b378df807..a3c6d5eeb93d 100644
--- a/include/lldb/Core/Debugger.h
+++ b/include/lldb/Core/Debugger.h
@@ -17,9 +17,6 @@
#include <stack>
#include "lldb/lldb-public.h"
-
-#include "lldb/API/SBDefines.h"
-
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Communication.h"
#include "lldb/Core/InputReaderStack.h"
@@ -55,6 +52,10 @@ friend class SourceManager; // For GetSourceFileCache.
public:
+ typedef lldb::DynamicLibrarySP (*LoadPluginCallbackType) (const lldb::DebuggerSP &debugger_sp,
+ const FileSpec& spec,
+ Error& error);
+
static lldb::DebuggerSP
CreateInstance (lldb::LogOutputCallback log_callback = NULL, void *baton = NULL);
@@ -65,7 +66,7 @@ public:
FindTargetWithProcess (Process *process);
static void
- Initialize ();
+ Initialize (LoadPluginCallbackType load_plugin_callback);
static void
Terminate ();
@@ -333,9 +334,7 @@ public:
{
return m_instance_name;
}
-
- typedef bool (*LLDBCommandPluginInit) (lldb::SBDebugger& debugger);
-
+
bool
LoadPlugin (const FileSpec& spec, Error& error);
@@ -377,6 +376,7 @@ protected:
LogStreamMap m_log_streams;
lldb::StreamSP m_log_callback_stream_sp;
ConstString m_instance_name;
+ static LoadPluginCallbackType g_load_plugin_callback;
typedef std::vector<lldb::DynamicLibrarySP> LoadedPluginsList;
LoadedPluginsList m_loaded_plugins;
diff --git a/include/lldb/Core/Module.h b/include/lldb/Core/Module.h
index 1473fb90cf85..cae5a30be704 100644
--- a/include/lldb/Core/Module.h
+++ b/include/lldb/Core/Module.h
@@ -570,6 +570,18 @@ public:
}
const FileSpec &
+ GetRemoteInstallFileSpec () const
+ {
+ return m_remote_install_file;
+ }
+
+ void
+ SetRemoteInstallFileSpec (const FileSpec &file)
+ {
+ m_remote_install_file = file;
+ }
+
+ const FileSpec &
GetSymbolFileFileSpec () const
{
return m_symfile_spec;
@@ -1059,6 +1071,7 @@ protected:
lldb_private::UUID m_uuid; ///< Each module is assumed to have a unique identifier to help match it up to debug symbols.
FileSpec m_file; ///< The file representation on disk for this module (if there is one).
FileSpec m_platform_file;///< The path to the module on the platform on which it is being debugged
+ FileSpec m_remote_install_file; ///< If set when debugging on remote platforms, this module will be installed at this location
FileSpec m_symfile_spec; ///< If this path is valid, then this is the file that _will_ be used as the symbol file for this module
ConstString m_object_name; ///< The name an object within this module that is selected, or empty of the module is represented by \a m_file.
uint64_t m_object_offset;
diff --git a/include/lldb/DataFormatters/CXXFormatterFunctions.h b/include/lldb/DataFormatters/CXXFormatterFunctions.h
index 433c2a3c407b..415ef9be59ef 100644
--- a/include/lldb/DataFormatters/CXXFormatterFunctions.h
+++ b/include/lldb/DataFormatters/CXXFormatterFunctions.h
@@ -17,6 +17,8 @@
#include "lldb/Core/ConstString.h"
#include "lldb/DataFormatters/FormatClasses.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Target.h"
#include "clang/AST/ASTContext.h"
diff --git a/include/lldb/DataFormatters/FormatCache.h b/include/lldb/DataFormatters/FormatCache.h
index bd9e20ccc9ee..1505d7c46189 100644
--- a/include/lldb/DataFormatters/FormatCache.h
+++ b/include/lldb/DataFormatters/FormatCache.h
@@ -18,6 +18,7 @@
// Project includes
#include "lldb/lldb-public.h"
#include "lldb/Core/ConstString.h"
+#include "lldb/Host/Mutex.h"
#include "lldb/DataFormatters/FormatClasses.h"
namespace lldb_private {
diff --git a/include/lldb/DataFormatters/FormatClasses.h b/include/lldb/DataFormatters/FormatClasses.h
index 6d9a50e8f2c5..651160371c69 100644
--- a/include/lldb/DataFormatters/FormatClasses.h
+++ b/include/lldb/DataFormatters/FormatClasses.h
@@ -10,9 +10,6 @@
#ifndef lldb_FormatClasses_h_
#define lldb_FormatClasses_h_
-// C Includes
-#include <stdint.h>
-
// C++ Includes
#include <string>
#include <vector>
@@ -23,17 +20,86 @@
#include "lldb/lldb-public.h"
#include "lldb/lldb-enumerations.h"
-#include "lldb/Core/ValueObject.h"
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/Type.h"
-#include "lldb/DataFormatters/TypeFormat.h"
-#include "lldb/DataFormatters/TypeSummary.h"
-#include "lldb/DataFormatters/TypeSynthetic.h"
-
namespace lldb_private {
+class FormattersMatchCandidate
+{
+public:
+
+ FormattersMatchCandidate (ConstString name,
+ uint32_t reason,
+ bool strip_ptr,
+ bool strip_ref,
+ bool strip_tydef) :
+ m_type_name(name),
+ m_reason(reason),
+ m_stripped_pointer(strip_ptr),
+ m_stripped_reference(strip_ref),
+ m_stripped_typedef(strip_tydef)
+ {
+ }
+
+ ~FormattersMatchCandidate ()
+ {}
+
+ ConstString
+ GetTypeName () const
+ {
+ return m_type_name;
+ }
+
+ uint32_t
+ GetReason () const
+ {
+ return m_reason;
+ }
+
+ bool
+ DidStripPointer () const
+ {
+ return m_stripped_pointer;
+ }
+
+ bool
+ DidStripReference () const
+ {
+ return m_stripped_reference;
+ }
+
+ bool
+ DidStripTypedef () const
+ {
+ return m_stripped_typedef;
+ }
+
+ template <class Formatter>
+ bool
+ IsMatch (const std::shared_ptr<Formatter>& formatter_sp) const
+ {
+ if (!formatter_sp)
+ return false;
+ if (formatter_sp->Cascades() == false && DidStripTypedef())
+ return false;
+ if (formatter_sp->SkipsPointers() && DidStripPointer())
+ return false;
+ if (formatter_sp->SkipsReferences() && DidStripReference())
+ return false;
+ return true;
+ }
+
+private:
+ ConstString m_type_name;
+ uint32_t m_reason;
+ bool m_stripped_pointer;
+ bool m_stripped_reference;
+ bool m_stripped_typedef;
+};
+
+typedef std::vector<FormattersMatchCandidate> FormattersMatchVector;
+
class TypeNameSpecifierImpl
{
public:
diff --git a/include/lldb/DataFormatters/FormatManager.h b/include/lldb/DataFormatters/FormatManager.h
index 3c90c993e0c4..750e53008318 100644
--- a/include/lldb/DataFormatters/FormatManager.h
+++ b/include/lldb/DataFormatters/FormatManager.h
@@ -19,6 +19,7 @@
#include "lldb/lldb-enumerations.h"
#include "lldb/DataFormatters/FormatCache.h"
+#include "lldb/DataFormatters/FormatClasses.h"
#include "lldb/DataFormatters/FormatNavigator.h"
#include "lldb/DataFormatters/TypeCategory.h"
#include "lldb/DataFormatters/TypeCategoryMap.h"
@@ -213,7 +214,36 @@ public:
{
}
+ static FormattersMatchVector
+ GetPossibleMatches (ValueObject& valobj,
+ lldb::DynamicValueType use_dynamic)
+ {
+ FormattersMatchVector matches;
+ GetPossibleMatches (valobj,
+ valobj.GetClangType(),
+ lldb_private::eFormatterChoiceCriterionDirectChoice,
+ use_dynamic,
+ matches,
+ false,
+ false,
+ false,
+ true);
+ return matches;
+ }
+
private:
+
+ static void
+ GetPossibleMatches (ValueObject& valobj,
+ ClangASTType clang_type,
+ uint32_t reason,
+ lldb::DynamicValueType use_dynamic,
+ FormattersMatchVector& entries,
+ bool did_strip_ptr,
+ bool did_strip_ref,
+ bool did_strip_typedef,
+ bool root_level = false);
+
FormatCache m_format_cache;
NamedSummariesMap m_named_summaries_map;
std::atomic<uint32_t> m_last_revision;
diff --git a/include/lldb/DataFormatters/FormatNavigator.h b/include/lldb/DataFormatters/FormatNavigator.h
index cd5f6824e199..1b82776fb28c 100644
--- a/include/lldb/DataFormatters/FormatNavigator.h
+++ b/include/lldb/DataFormatters/FormatNavigator.h
@@ -26,6 +26,9 @@
#include "lldb/Core/ValueObject.h"
#include "lldb/DataFormatters/FormatClasses.h"
+#include "lldb/DataFormatters/TypeFormat.h"
+#include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ClangASTType.h"
@@ -459,228 +462,29 @@ protected:
}
return false;
}
-
- bool
- Get_BitfieldMatch (ValueObject& valobj,
- ConstString typeName,
- MapValueType& entry,
- uint32_t& reason)
- {
- Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
- // for bitfields, append size to the typename so one can custom format them
- StreamString sstring;
- sstring.Printf("%s:%d",typeName.AsCString(),valobj.GetBitfieldBitSize());
- ConstString bitfieldname = ConstString(sstring.GetData());
- if (log)
- log->Printf("[Get_BitfieldMatch] appended bitfield info, final result is %s", bitfieldname.GetCString());
- if (Get(bitfieldname, entry))
- {
- if (log)
- log->Printf("[Get_BitfieldMatch] bitfield direct match found, returning");
- return true;
- }
- else
- {
- reason |= lldb_private::eFormatterChoiceCriterionStrippedBitField;
- if (log)
- log->Printf("[Get_BitfieldMatch] no bitfield direct match");
- return false;
- }
- }
-
- bool Get_ObjC (ValueObject& valobj,
- MapValueType& entry)
- {
- Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
- lldb::ProcessSP process_sp = valobj.GetProcessSP();
- ObjCLanguageRuntime* runtime = process_sp->GetObjCLanguageRuntime();
- if (runtime == NULL)
- {
- if (log)
- log->Printf("[Get_ObjC] no valid ObjC runtime, skipping dynamic");
- return false;
- }
- ObjCLanguageRuntime::ClassDescriptorSP objc_class_sp (runtime->GetClassDescriptor(valobj));
- if (!objc_class_sp)
- {
- if (log)
- log->Printf("[Get_ObjC] invalid ISA, skipping dynamic");
- return false;
- }
- ConstString name (objc_class_sp->GetClassName());
- if (log)
- log->Printf("[Get_ObjC] dynamic type inferred is %s - looking for direct dynamic match", name.GetCString());
- if (Get(name, entry))
- {
- if (log)
- log->Printf("[Get_ObjC] direct dynamic match found, returning");
- return true;
- }
- if (log)
- log->Printf("[Get_ObjC] no dynamic match");
- return false;
- }
-
+
bool
- Get_Impl (ValueObject& valobj,
- ClangASTType clang_type,
- MapValueType& entry,
- lldb::DynamicValueType use_dynamic,
- uint32_t& reason)
+ Get (const FormattersMatchVector& candidates,
+ MapValueType& entry,
+ uint32_t *reason)
{
- Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
-
- if (!clang_type.IsValid())
- {
- if (log)
- log->Printf("[Get_Impl] type is invalid, returning");
- return false;
- }
-
- clang_type = clang_type.RemoveFastQualifiers();
-
- ConstString typeName(clang_type.GetConstTypeName());
-
- if (valobj.GetBitfieldBitSize() > 0)
+ for (const FormattersMatchCandidate& candidate : candidates)
{
- if (Get_BitfieldMatch(valobj, typeName, entry, reason))
- return true;
- }
-
- if (log)
- log->Printf("[Get_Impl] trying to get %s for VO name %s of type %s",
- m_name.c_str(),
- valobj.GetName().AsCString(),
- typeName.AsCString());
-
- if (Get(typeName, entry))
- {
- if (log)
- log->Printf("[Get] direct match found, returning");
- return true;
- }
- if (log)
- log->Printf("[Get_Impl] no direct match");
-
- // strip pointers and references and see if that helps
- if (clang_type.IsReferenceType())
- {
- if (log)
- log->Printf("[Get_Impl] stripping reference");
- if (Get_Impl(valobj, clang_type.GetNonReferenceType(), entry, use_dynamic, reason) && !entry->SkipsReferences())
+ if (Get(candidate.GetTypeName(),entry))
{
- reason |= lldb_private::eFormatterChoiceCriterionStrippedPointerReference;
- return true;
- }
- }
- else if (clang_type.IsPointerType())
- {
- if (log)
- log->Printf("[Get_Impl] stripping pointer");
- if (Get_Impl(valobj, clang_type.GetPointeeType(), entry, use_dynamic, reason) && !entry->SkipsPointers())
- {
- reason |= lldb_private::eFormatterChoiceCriterionStrippedPointerReference;
- return true;
- }
- }
-
- bool canBeObjCDynamic = valobj.GetClangType().IsPossibleDynamicType (NULL,
- false, // no C++
- true); // yes ObjC
-
- if (canBeObjCDynamic)
- {
- if (use_dynamic != lldb::eNoDynamicValues)
- {
- if (log)
- log->Printf("[Get_Impl] allowed to figure out dynamic ObjC type");
- if (Get_ObjC(valobj,entry))
+ if (candidate.IsMatch(entry) == false)
{
- reason |= lldb_private::eFormatterChoiceCriterionDynamicObjCDiscovery;
- return true;
+ entry.reset();
+ continue;
}
- }
- if (log)
- log->Printf("[Get_Impl] dynamic disabled or failed - stripping ObjC pointer");
- if (Get_Impl(valobj, clang_type.GetPointeeType(), entry, use_dynamic, reason) && !entry->SkipsPointers())
- {
- reason |= lldb_private::eFormatterChoiceCriterionStrippedPointerReference;
- return true;
- }
- }
-
- // try to strip typedef chains
- if (clang_type.IsTypedefType())
- {
- if (log)
- log->Printf("[Get_Impl] stripping typedef");
- if ((Get_Impl(valobj, clang_type.GetTypedefedType(), entry, use_dynamic, reason)) && entry->Cascades())
- {
- reason |= lldb_private::eFormatterChoiceCriterionNavigatedTypedefs;
- return true;
- }
- }
-
- // out of luck here
- return false;
- }
-
- // we are separately passing in valobj and type because the valobj is fixed (and is used for ObjC discovery and bitfield size)
- // but the type can change (e.g. stripping pointers, ...)
- bool Get (ValueObject& valobj,
- ClangASTType clang_type,
- MapValueType& entry,
- lldb::DynamicValueType use_dynamic,
- uint32_t& reason)
- {
- Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
-
- if (Get_Impl (valobj, clang_type, entry, use_dynamic, reason))
- return true;
-
- // try going to the unqualified type
- do {
- if (log)
- log->Printf("[Get] trying the unqualified type");
- if (!clang_type.IsValid())
- break;
-
- ClangASTType unqual_clang_ast_type = clang_type.GetFullyUnqualifiedType();
- if (!unqual_clang_ast_type.IsValid())
- {
- if (log)
- log->Printf("[Get] could not get the unqual_clang_ast_type");
- break;
- }
- if (unqual_clang_ast_type.GetOpaqueQualType() != clang_type.GetOpaqueQualType())
- {
- if (log)
- log->Printf("[Get] unqualified type is there and is not the same, let's try");
- if (Get_Impl (valobj, unqual_clang_ast_type,entry, use_dynamic, reason))
- return true;
- }
- else if (log)
- log->Printf("[Get] unqualified type same as original type");
- } while(false);
-
- // if all else fails, go to static type
- if (valobj.IsDynamic())
- {
- if (log)
- log->Printf("[Get] going to static value");
- lldb::ValueObjectSP static_value_sp(valobj.GetStaticValue());
- if (static_value_sp)
- {
- if (log)
- log->Printf("[Get] has a static value - actually use it");
- if (Get(*static_value_sp.get(), static_value_sp->GetClangType(), entry, use_dynamic, reason))
+ else
{
- reason |= lldb_private::eFormatterChoiceCriterionWentToStaticValue;
+ if(reason)
+ *reason = candidate.GetReason();
return true;
}
}
}
-
return false;
}
};
diff --git a/include/lldb/DataFormatters/TypeCategory.h b/include/lldb/DataFormatters/TypeCategory.h
index 6461c4e97e4e..082395a04616 100644
--- a/include/lldb/DataFormatters/TypeCategory.h
+++ b/include/lldb/DataFormatters/TypeCategory.h
@@ -18,6 +18,7 @@
#include "lldb/lldb-public.h"
#include "lldb/lldb-enumerations.h"
+#include "lldb/DataFormatters/FormatClasses.h"
#include "lldb/DataFormatters/FormatNavigator.h"
namespace lldb_private {
@@ -177,23 +178,22 @@ namespace lldb_private {
return m_enabled_position;
}
-
bool
Get (ValueObject& valobj,
+ const FormattersMatchVector& candidates,
lldb::TypeFormatImplSP& entry,
- lldb::DynamicValueType use_dynamic,
uint32_t* reason = NULL);
bool
Get (ValueObject& valobj,
+ const FormattersMatchVector& candidates,
lldb::TypeSummaryImplSP& entry,
- lldb::DynamicValueType use_dynamic,
uint32_t* reason = NULL);
bool
Get (ValueObject& valobj,
+ const FormattersMatchVector& candidates,
lldb::SyntheticChildrenSP& entry,
- lldb::DynamicValueType use_dynamic,
uint32_t* reason = NULL);
void
diff --git a/include/lldb/Expression/ClangFunction.h b/include/lldb/Expression/ClangFunction.h
index 9cb22ed15cb5..9c14ddb53230 100644
--- a/include/lldb/Expression/ClangFunction.h
+++ b/include/lldb/Expression/ClangFunction.h
@@ -227,143 +227,6 @@ public:
Stream &errors);
//------------------------------------------------------------------
- /// [Static] Execute a function, passing it a single void* parameter.
- /// ClangFunction uses this to call the wrapper function.
- ///
- /// @param[in] exe_ctx
- /// The execution context to insert the function and its arguments
- /// into.
- ///
- /// @param[in] function_address
- /// The address of the function in the target process.
- ///
- /// @param[in] void_arg
- /// The value of the void* parameter.
- ///
- /// @param[in] stop_others
- /// True if other threads should pause during execution.
- ///
- /// @param[in] try_all_threads
- /// If the timeout expires, true if other threads should run. If
- /// the function may try to take locks, this is useful.
- ///
- /// @param[in] unwind_on_error
- /// If true, and the execution stops before completion, we unwind the
- /// function call, and return the program state to what it was before the
- /// execution. If false, we leave the program in the stopped state.
- ///
- /// @param[in] timeout_usec
- /// Timeout value (0 for no timeout). If try_all_threads is true, then we
- /// will try on one thread for the lesser of .25 sec and half the total timeout.
- /// then switch to running all threads, otherwise this will be the total timeout.
- ///
- /// @param[in] errors
- /// The stream to write errors to.
- ///
- /// @param[in] this_arg
- /// If non-NULL, the function is invoked like a C++ method, with the
- /// value pointed to by the pointer as its 'this' argument.
- ///
- /// @return
- /// Returns one of the ExecutionResults enum indicating function call status.
- //------------------------------------------------------------------
- static ExecutionResults
- ExecuteFunction (ExecutionContext &exe_ctx,
- lldb::addr_t function_address,
- lldb::addr_t &void_arg,
- bool stop_others,
- bool try_all_threads,
- bool unwind_on_error,
- bool ignore_breakpoints,
- uint32_t timeout_usec,
- Stream &errors,
- lldb::addr_t* this_arg = 0);
-
- //------------------------------------------------------------------
- /// Run the function this ClangFunction was created with.
- ///
- /// This simple version will run the function stopping other threads
- /// for a fixed timeout period (1000 usec) and if it does not complete,
- /// we halt the process and try with all threads running.
- ///
- /// @param[in] exe_ctx
- /// The thread & process in which this function will run.
- ///
- /// @param[in] errors
- /// Errors will be written here if there are any.
- ///
- /// @param[out] results
- /// The result value will be put here after running the function.
- ///
- /// @return
- /// Returns one of the ExecutionResults enum indicating function call status.
- //------------------------------------------------------------------
- ExecutionResults
- ExecuteFunction(ExecutionContext &exe_ctx,
- Stream &errors,
- Value &results);
-
- //------------------------------------------------------------------
- /// Run the function this ClangFunction was created with.
- ///
- /// This simple version will run the function obeying the stop_others
- /// argument. There is no timeout.
- ///
- /// @param[in] exe_ctx
- /// The thread & process in which this function will run.
- ///
- /// @param[in] errors
- /// Errors will be written here if there are any.
- ///
- /// @param[in] stop_others
- /// If \b true, run only this thread, if \b false let all threads run.
- ///
- /// @param[out] results
- /// The result value will be put here after running the function.
- ///
- /// @return
- /// Returns one of the ExecutionResults enum indicating function call status.
- //------------------------------------------------------------------
- ExecutionResults
- ExecuteFunction(ExecutionContext &exe_ctx,
- Stream &errors, bool stop_others,
- Value &results);
-
- //------------------------------------------------------------------
- /// Run the function this ClangFunction was created with.
- ///
- /// This simple version will run the function on one thread. If \a timeout_usec
- /// is not zero, we time out after that timeout. If \a try_all_threads is true, then we will
- /// resume with all threads on, otherwise we halt the process, and eExecutionInterrupted will be returned.
- ///
- /// @param[in] exe_ctx
- /// The thread & process in which this function will run.
- ///
- /// @param[in] errors
- /// Errors will be written here if there are any.
- ///
- /// @param[in] timeout_usec
- /// Timeout value (0 for no timeout). If try_all_threads is true, then we
- /// will try on one thread for the lesser of .25 sec and half the total timeout.
- /// then switch to running all threads, otherwise this will be the total timeout.
- ///
- /// @param[in] try_all_threads
- /// If \b true, run only this thread, if \b false let all threads run.
- ///
- /// @param[out] results
- /// The result value will be put here after running the function.
- ///
- /// @return
- /// Returns one of the ExecutionResults enum indicating function call status.
- //------------------------------------------------------------------
- ExecutionResults
- ExecuteFunction(ExecutionContext &exe_ctx,
- Stream &errors,
- uint32_t single_thread_timeout_usec,
- bool try_all_threads,
- Value &results);
-
- //------------------------------------------------------------------
/// Run the function this ClangFunction was created with.
///
/// This is the full version.
@@ -381,17 +244,8 @@ public:
/// @param[in] errors
/// Errors will be written here if there are any.
///
- /// @param[in] stop_others
- /// If \b true, run only this thread, if \b false let all threads run.
- ///
- /// @param[in] timeout_usec
- /// Timeout value (0 for no timeout). If try_all_threads is true, then we
- /// will try on one thread for the lesser of .25 sec and half the total timeout.
- /// then switch to running all threads, otherwise this will be the total timeout.
- ///
- ///
- /// @param[in] try_all_threads
- /// If \b true, run only this thread, if \b false let all threads run.
+ /// @param[in] options
+ /// The options for this expression execution.
///
/// @param[out] results
/// The result value will be put here after running the function.
@@ -402,63 +256,11 @@ public:
ExecutionResults
ExecuteFunction(ExecutionContext &exe_ctx,
lldb::addr_t *args_addr_ptr,
- Stream &errors,
- bool stop_others,
- uint32_t timeout_usec,
- bool try_all_threads,
- bool unwind_on_error,
- bool ignore_breakpoints,
+ const EvaluateExpressionOptions &options,
+ Stream &errors,
Value &results);
//------------------------------------------------------------------
- /// [static] Get a thread plan to run a function.
- ///
- /// @param[in] exe_ctx
- /// The execution context to insert the function and its arguments
- /// into.
- ///
- /// @param[in] func_addr
- /// The address of the function in the target process.
- ///
- /// @param[in] args_addr_ref
- /// The value of the void* parameter.
- ///
- /// @param[in] errors
- /// The stream to write errors to.
- ///
- /// @param[in] stop_others
- /// True if other threads should pause during execution.
- ///
- /// @param[in] unwind_on_error
- /// True if the thread plan may simply be discarded if an error occurs.
- ///
- /// @param[in] ignore_breakpoints
- /// True if the expression execution will ignore breakpoint hits and continue executing.
- ///
- /// @param[in] this_arg
- /// If non-NULL (and cmd_arg is NULL), the function is invoked like a C++
- /// method, with the value pointed to by the pointer as its 'this'
- /// argument.
- ///
- /// @param[in] cmd_arg
- /// If non-NULL, the function is invoked like an Objective-C method, with
- /// this_arg in the 'self' slot and cmd_arg in the '_cmd' slot
- ///
- /// @return
- /// A ThreadPlan for executing the function.
- //------------------------------------------------------------------
- static ThreadPlan *
- GetThreadPlanToCallFunction (ExecutionContext &exe_ctx,
- lldb::addr_t func_addr,
- lldb::addr_t &args_addr_ref,
- Stream &errors,
- bool stop_others,
- bool unwind_on_error,
- bool ignore_breakpoints,
- lldb::addr_t *this_arg = 0,
- lldb::addr_t *cmd_arg = 0);
-
- //------------------------------------------------------------------
/// Get a thread plan to run the function this ClangFunction was created with.
///
/// @param[in] exe_ctx
@@ -468,8 +270,8 @@ public:
/// @param[in] func_addr
/// The address of the function in the target process.
///
- /// @param[in] args_addr_ref
- /// The value of the void* parameter.
+ /// @param[in] args_addr
+ /// The address of the argument struct.
///
/// @param[in] errors
/// The stream to write errors to.
@@ -485,20 +287,9 @@ public:
//------------------------------------------------------------------
ThreadPlan *
GetThreadPlanToCallFunction (ExecutionContext &exe_ctx,
- lldb::addr_t &args_addr_ref,
- Stream &errors,
- bool stop_others,
- bool unwind_on_error = true,
- bool ignore_breakpoints = true)
- {
- return ClangFunction::GetThreadPlanToCallFunction (exe_ctx,
- m_jit_start_addr,
- args_addr_ref,
- errors,
- stop_others,
- unwind_on_error,
- ignore_breakpoints);
- }
+ lldb::addr_t args_addr,
+ const EvaluateExpressionOptions &options,
+ Stream &errors);
//------------------------------------------------------------------
/// Get the result of the function from its struct
diff --git a/include/lldb/Expression/ClangUserExpression.h b/include/lldb/Expression/ClangUserExpression.h
index b8c3c128acf4..83fdf1c21955 100644
--- a/include/lldb/Expression/ClangUserExpression.h
+++ b/include/lldb/Expression/ClangUserExpression.h
@@ -150,10 +150,6 @@ public:
ClangUserExpressionSP &shared_ptr_to_me,
lldb::ClangExpressionVariableSP &result);
- ThreadPlan *
- GetThreadPlanToExecuteJITExpression (Stream &error_stream,
- ExecutionContext &exe_ctx);
-
//------------------------------------------------------------------
/// Apply the side effects of the function to program state.
///
diff --git a/include/lldb/Host/Debug.h b/include/lldb/Host/Debug.h
new file mode 100644
index 000000000000..2cb758e1b733
--- /dev/null
+++ b/include/lldb/Host/Debug.h
@@ -0,0 +1,406 @@
+//===-- Debug.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_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>
+
+namespace lldb_private {
+
+ //------------------------------------------------------------------
+ // Tells a thread what it needs to do when the process is resumed.
+ //------------------------------------------------------------------
+ struct ResumeAction
+ {
+ lldb::tid_t tid; // The thread ID that this action applies to, LLDB_INVALID_THREAD_ID for the default thread action
+ 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
+ // suspended, or step when the process is resumed. We optionally
+ // have the ability to also send a signal to the thread when the
+ // action is run or step.
+ //------------------------------------------------------------------
+ class ResumeActionList
+ {
+ public:
+ ResumeActionList () :
+ m_actions (),
+ 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 ()
+ {
+ if (actions && num_actions)
+ {
+ m_actions.assign (actions, actions + num_actions);
+ m_signal_handled.assign (num_actions, false);
+ }
+ }
+
+ ~ResumeActionList()
+ {
+ }
+
+ bool
+ IsEmpty() const
+ {
+ 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,
+ int signal = 0)
+ {
+ 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
+ {
+ const size_t num_actions = m_actions.size();
+ for (size_t i=0; i<num_actions; ++i)
+ {
+ if (m_actions[i].tid == tid)
+ return &m_actions[i];
+ }
+ if (default_ok && tid != LLDB_INVALID_THREAD_ID)
+ return GetActionForThread (LLDB_INVALID_THREAD_ID, false);
+ return NULL;
+ }
+
+ size_t
+ NumActionsWithState (lldb::StateType state) const
+ {
+ size_t count = 0;
+ const size_t num_actions = m_actions.size();
+ for (size_t i=0; i<num_actions; ++i)
+ {
+ if (m_actions[i].state == state)
+ ++count;
+ }
+ return count;
+ }
+
+ bool
+ SetDefaultThreadActionIfNeeded (lldb::StateType action, int signal)
+ {
+ if (GetActionForThread (LLDB_INVALID_THREAD_ID, true) == NULL)
+ {
+ // There isn't a default action so we do need to set it.
+ ResumeAction default_action = {LLDB_INVALID_THREAD_ID, action, signal };
+ m_actions.push_back (default_action);
+ m_signal_handled.push_back (false);
+ return true; // Return true as we did add the default action
+ }
+ return false;
+ }
+
+ void
+ SetSignalHandledForThread (lldb::tid_t tid) const
+ {
+ if (tid != LLDB_INVALID_THREAD_ID)
+ {
+ const size_t num_actions = m_actions.size();
+ for (size_t i=0; i<num_actions; ++i)
+ {
+ if (m_actions[i].tid == tid)
+ m_signal_handled[i] = true;
+ }
+ }
+ }
+
+ 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;
+ };
+
+ struct ThreadStopInfo
+ {
+ lldb::StopReason reason;
+ union
+ {
+ // eStopTypeSignal
+ struct
+ {
+ uint32_t signo;
+ } signal;
+
+ // eStopTypeException
+ struct
+ {
+ uint64_t type;
+ uint32_t data_count;
+ lldb::addr_t data[2];
+ } 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/File.h b/include/lldb/Host/File.h
index 7ca582402b32..607efa029c09 100644
--- a/include/lldb/Host/File.h
+++ b/include/lldb/Host/File.h
@@ -40,46 +40,13 @@ public:
eOpenOptionTruncate = (1u << 3), // Truncate file when opening
eOpenOptionNonBlocking = (1u << 4), // File reads
eOpenOptionCanCreate = (1u << 5), // Create file if doesn't already exist
- eOpenOptionCanCreateNewOnly = (1u << 6) // Can create file only if it doesn't already exist
+ eOpenOptionCanCreateNewOnly = (1u << 6), // Can create file only if it doesn't already exist
+ eOpenoptionDontFollowSymlinks = (1u << 7)
};
static mode_t
ConvertOpenOptionsForPOSIXOpen (uint32_t open_options);
- enum Permissions
- {
- ePermissionsUserRead = (1u << 8),
- ePermissionsUserWrite = (1u << 7),
- ePermissionsUserExecute = (1u << 6),
- ePermissionsGroupRead = (1u << 5),
- ePermissionsGroupWrite = (1u << 4),
- ePermissionsGroupExecute = (1u << 3),
- ePermissionsWorldRead = (1u << 2),
- ePermissionsWorldWrite = (1u << 1),
- ePermissionsWorldExecute = (1u << 0),
-
- ePermissionsUserRW = (ePermissionsUserRead | ePermissionsUserWrite | 0 ),
- ePermissionsUserRX = (ePermissionsUserRead | 0 | ePermissionsUserExecute ),
- ePermissionsUserRWX = (ePermissionsUserRead | ePermissionsUserWrite | ePermissionsUserExecute ),
-
- ePermissionsGroupRW = (ePermissionsGroupRead | ePermissionsGroupWrite | 0 ),
- ePermissionsGroupRX = (ePermissionsGroupRead | 0 | ePermissionsGroupExecute ),
- ePermissionsGroupRWX = (ePermissionsGroupRead | ePermissionsGroupWrite | ePermissionsGroupExecute ),
-
- ePermissionsWorldRW = (ePermissionsWorldRead | ePermissionsWorldWrite | 0 ),
- ePermissionsWorldRX = (ePermissionsWorldRead | 0 | ePermissionsWorldExecute ),
- ePermissionsWorldRWX = (ePermissionsWorldRead | ePermissionsWorldWrite | ePermissionsWorldExecute ),
-
- ePermissionsEveryoneR = (ePermissionsUserRead | ePermissionsGroupRead | ePermissionsWorldRead ),
- ePermissionsEveryoneW = (ePermissionsUserWrite | ePermissionsGroupWrite | ePermissionsWorldWrite ),
- ePermissionsEveryoneX = (ePermissionsUserExecute | ePermissionsGroupExecute | ePermissionsWorldExecute ),
-
- ePermissionsEveryoneRW = (ePermissionsEveryoneR | ePermissionsEveryoneW | 0 ),
- ePermissionsEveryoneRX = (ePermissionsEveryoneR | 0 | ePermissionsEveryoneX ),
- ePermissionsEveryoneRWX = (ePermissionsEveryoneR | ePermissionsEveryoneW | ePermissionsEveryoneX ),
- ePermissionsDefault = (ePermissionsUserRW | ePermissionsGroupRead)
- };
-
File() :
m_descriptor (kInvalidDescriptor),
m_stream (kInvalidStream),
@@ -120,7 +87,7 @@ public:
//------------------------------------------------------------------
File (const char *path,
uint32_t options,
- uint32_t permissions = ePermissionsDefault);
+ uint32_t permissions = lldb::eFilePermissionsFileDefault);
//------------------------------------------------------------------
/// Constructor with FileSpec.
@@ -142,7 +109,7 @@ public:
//------------------------------------------------------------------
File (const FileSpec& filespec,
uint32_t options,
- uint32_t permissions = ePermissionsDefault);
+ uint32_t permissions = lldb::eFilePermissionsFileDefault);
File (int fd, bool tranfer_ownership) :
m_descriptor (fd),
@@ -236,7 +203,7 @@ public:
Error
Open (const char *path,
uint32_t options,
- uint32_t permissions = ePermissionsDefault);
+ uint32_t permissions = lldb::eFilePermissionsFileDefault);
Error
Close ();
diff --git a/include/lldb/Host/FileSpec.h b/include/lldb/Host/FileSpec.h
index dfc6b711ae4a..086c8f200567 100644
--- a/include/lldb/Host/FileSpec.h
+++ b/include/lldb/Host/FileSpec.h
@@ -420,6 +420,21 @@ public:
FileType
GetFileType () const;
+ //------------------------------------------------------------------
+ /// Return the current permissions of the path.
+ ///
+ /// Returns a bitmask for the current permissions of the file
+ /// ( zero or more of the permission bits defined in
+ /// File::Permissions).
+ ///
+ /// @return
+ /// Zero if the file doesn't exist or we are unable to get
+ /// information for the file, otherwise one or more permission
+ /// bits from the File::Permissions enumeration.
+ //------------------------------------------------------------------
+ uint32_t
+ GetPermissions () const;
+
bool
IsDirectory () const
{
@@ -636,7 +651,7 @@ public:
void
RemoveLastPathComponent ();
- const char*
+ ConstString
GetLastPathComponent () const;
//------------------------------------------------------------------
diff --git a/include/lldb/Host/Host.h b/include/lldb/Host/Host.h
index 1d667dee5a20..fe0f6f62b3bc 100644
--- a/include/lldb/Host/Host.h
+++ b/include/lldb/Host/Host.h
@@ -510,13 +510,28 @@ public:
const char *symbol_name,
Error &error);
- static uint32_t
- MakeDirectory (const char* path, mode_t mode);
+ 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,
- mode_t mode,
+ uint32_t mode,
Error &error);
static bool
diff --git a/include/lldb/Host/OptionParser.h b/include/lldb/Host/OptionParser.h
index 410e4d9f9468..ca83eeb1ed77 100644
--- a/include/lldb/Host/OptionParser.h
+++ b/include/lldb/Host/OptionParser.h
@@ -10,6 +10,10 @@
#ifndef liblldb_OptionParser_h_
#define liblldb_OptionParser_h_
+#include <string>
+
+struct option;
+
namespace lldb_private {
typedef struct Option
@@ -46,6 +50,7 @@ public:
static char* GetOptionArgument();
static int GetOptionIndex();
static int GetOptionErrorCause();
+ static std::string GetShortOptionString(struct option *long_options);
};
}
diff --git a/include/lldb/Interpreter/PythonDataObjects.h b/include/lldb/Interpreter/PythonDataObjects.h
index a54318159d14..2762d452c0c8 100644
--- a/include/lldb/Interpreter/PythonDataObjects.h
+++ b/include/lldb/Interpreter/PythonDataObjects.h
@@ -19,11 +19,7 @@
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Flags.h"
#include "lldb/Interpreter/OptionValue.h"
-#if defined (__APPLE__)
-#include <Python/Python.h>
-#else
-#include <Python.h>
-#endif
+#include "lldb/lldb-python.h"
namespace lldb_private {
diff --git a/include/lldb/Interpreter/ScriptInterpreterPython.h b/include/lldb/Interpreter/ScriptInterpreterPython.h
index 4b3dc61f3ee8..b729cb628007 100644
--- a/include/lldb/Interpreter/ScriptInterpreterPython.h
+++ b/include/lldb/Interpreter/ScriptInterpreterPython.h
@@ -17,12 +17,7 @@
#else
-#if defined (__APPLE__)
-#include <Python/Python.h>
-#else
-#include <Python.h>
-#endif
-
+#include "lldb/lldb-python.h"
#include "lldb/lldb-private.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
#include "lldb/Core/InputReader.h"
diff --git a/include/lldb/Symbol/TypeList.h b/include/lldb/Symbol/TypeList.h
index be7d35482da0..4f3f2c9bdbeb 100644
--- a/include/lldb/Symbol/TypeList.h
+++ b/include/lldb/Symbol/TypeList.h
@@ -12,6 +12,7 @@
#include "lldb/lldb-private.h"
#include "lldb/Symbol/Type.h"
+#include "lldb/Utility/Iterable.h"
#include <map>
#include <functional>
@@ -51,6 +52,15 @@ public:
lldb::TypeSP
GetTypeAtIndex(uint32_t idx);
+
+ typedef std::multimap<lldb::user_id_t, lldb::TypeSP> collection;
+ typedef AdaptedIterable<collection, lldb::TypeSP, map_adapter> TypeIterable;
+
+ TypeIterable
+ Types ()
+ {
+ return TypeIterable(m_types);
+ }
void
ForEach (std::function <bool(const lldb::TypeSP &type_sp)> const &callback) const;
@@ -75,7 +85,6 @@ public:
RemoveMismatchedTypes (lldb::TypeClass type_class);
private:
- typedef std::multimap<lldb::user_id_t, lldb::TypeSP> collection;
typedef collection::iterator iterator;
typedef collection::const_iterator const_iterator;
diff --git a/include/lldb/Target/ABI.h b/include/lldb/Target/ABI.h
index 16f8ee7fc7d7..cc6c46cf0ec9 100644
--- a/include/lldb/Target/ABI.h
+++ b/include/lldb/Target/ABI.h
@@ -18,6 +18,8 @@
#include "lldb/Core/PluginInterface.h"
#include "lldb/lldb-private.h"
+#include "llvm/ADT/ArrayRef.h"
+
namespace lldb_private {
class ABI :
@@ -35,12 +37,7 @@ public:
lldb::addr_t sp,
lldb::addr_t functionAddress,
lldb::addr_t returnAddress,
- lldb::addr_t *arg1_ptr = NULL,
- lldb::addr_t *arg2_ptr = NULL,
- lldb::addr_t *arg3_ptr = NULL,
- lldb::addr_t *arg4_ptr = NULL,
- lldb::addr_t *arg5_ptr = NULL,
- lldb::addr_t *arg6_ptr = NULL) const = 0;
+ llvm::ArrayRef<lldb::addr_t> args) const = 0;
virtual bool
GetArgumentValues (Thread &thread,
diff --git a/include/lldb/Target/LanguageRuntime.h b/include/lldb/Target/LanguageRuntime.h
index 93c0437da75d..0aaa67c2382c 100644
--- a/include/lldb/Target/LanguageRuntime.h
+++ b/include/lldb/Target/LanguageRuntime.h
@@ -67,6 +67,12 @@ public:
}
virtual bool
+ ExceptionBreakpointsAreSet ()
+ {
+ return false;
+ }
+
+ virtual bool
ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason)
{
return false;
diff --git a/include/lldb/Target/Platform.h b/include/lldb/Target/Platform.h
index 93cd67d66659..355c0528bed8 100644
--- a/include/lldb/Target/Platform.h
+++ b/include/lldb/Target/Platform.h
@@ -40,7 +40,8 @@ namespace lldb_private {
/// @li listing and getting info for existing processes
/// @li attaching and possibly debugging the platform's kernel
//----------------------------------------------------------------------
- class Platform : public PluginInterface
+ class Platform :
+ public PluginInterface
{
public:
@@ -214,8 +215,7 @@ namespace lldb_private {
bool
GetOSKernelDescription (std::string &s);
- // Returns the the hostname if we are connected, else the short plugin
- // name.
+ // Returns the the name of the platform
ConstString
GetName ();
@@ -269,6 +269,15 @@ namespace lldb_private {
{
return ArchSpec(); // Return an invalid architecture
}
+
+ virtual ConstString
+ GetRemoteWorkingDirectory()
+ {
+ return m_working_dir;
+ }
+
+ virtual bool
+ SetRemoteWorkingDirectory(const ConstString &path);
virtual const char *
GetUserName (uint32_t uid);
@@ -384,10 +393,13 @@ namespace lldb_private {
}
//------------------------------------------------------------------
- /// Subclasses should NOT need to implement this function as it uses
- /// the Platform::LaunchProcess() followed by Platform::Attach ()
+ /// Subclasses do not need to implement this function as it uses
+ /// the Platform::LaunchProcess() followed by Platform::Attach ().
+ /// Remote platforms will want to subclass this function in order
+ /// to be able to intercept STDIO and possibly launch a separate
+ /// process that will debug the debuggee.
//------------------------------------------------------------------
- lldb::ProcessSP
+ virtual lldb::ProcessSP
DebugProcess (ProcessLaunchInfo &launch_info,
Debugger &debugger,
Target *target, // Can be NULL, if NULL create a new target, else use existing one
@@ -542,6 +554,12 @@ namespace lldb_private {
{
m_sdk_build = sdk_build;
}
+
+ ConstString
+ GetWorkingDirectory ();
+
+ bool
+ SetWorkingDirectory (const ConstString &path);
// There may be modules that we don't want to find by default for operations like "setting breakpoint by name".
// The platform will return "true" from this call if the passed in module happens to be one of these.
@@ -552,23 +570,19 @@ namespace lldb_private {
return false;
}
- virtual uint32_t
- MakeDirectory (const std::string &path,
- mode_t mode)
- {
- return UINT32_MAX;
- }
-
- // this need not be virtual: the core behavior is in
- // MakeDirectory(std::string,mode_t)
- uint32_t
- MakeDirectory (const FileSpec &spec,
- mode_t mode);
+ virtual Error
+ MakeDirectory (const char *path, uint32_t permissions);
+ virtual Error
+ GetFilePermissions (const char *path, uint32_t &file_permissions);
+
+ virtual Error
+ SetFilePermissions (const char *path, uint32_t file_permissions);
+
virtual lldb::user_id_t
OpenFile (const FileSpec& file_spec,
uint32_t flags,
- mode_t mode,
+ uint32_t mode,
Error &error)
{
return UINT64_MAX;
@@ -610,28 +624,54 @@ namespace lldb_private {
}
virtual Error
+ GetFile (const FileSpec& source,
+ const FileSpec& destination);
+
+ virtual Error
PutFile (const FileSpec& source,
const FileSpec& destination,
uint32_t uid = UINT32_MAX,
uint32_t gid = UINT32_MAX);
-
+
+ virtual Error
+ CreateSymlink (const char *src, // The name of the link is in src
+ const char *dst);// The symlink points to dst
+
+ //----------------------------------------------------------------------
+ /// Install a file or directory to the remote system.
+ ///
+ /// Install is similar to Platform::PutFile(), but it differs in that if
+ /// an application/framework/shared library is installed on a remote
+ /// platform and the remote platform requires something to be done to
+ /// register the application/framework/shared library, then this extra
+ /// registration can be done.
+ ///
+ /// @param[in] src
+ /// The source file/directory to install on the remote system.
+ ///
+ /// @param[in] dst
+ /// The destination file/directory where \a src will be installed.
+ /// If \a dst has no filename specified, then its filename will
+ /// be set from \a src. It \a dst has no directory specified, it
+ /// will use the platform working directory. If \a dst has a
+ /// directory specified, but the directory path is relative, the
+ /// platform working directory will be prepended to the relative
+ /// directory.
+ ///
+ /// @return
+ /// An error object that describes anything that went wrong.
+ //----------------------------------------------------------------------
+ virtual Error
+ Install (const FileSpec& src, const FileSpec& dst);
+
virtual size_t
GetEnvironment (StringList &environment);
- virtual Error
- GetFile (const FileSpec& source,
- const FileSpec& destination);
-
virtual bool
GetFileExists (const lldb_private::FileSpec& file_spec);
- virtual uint32_t
- GetFilePermissions (const lldb_private::FileSpec &file_spec,
- Error &error)
- {
- error.SetErrorStringWithFormat ("Platform::GetFilePermissions() is not supported in the %s platform", GetName().GetCString());
- return 0;
- }
+ virtual Error
+ Unlink (const char *path);
virtual bool
GetSupportsRSync ()
@@ -806,6 +846,7 @@ namespace lldb_private {
bool m_system_arch_set_while_connected;
ConstString m_sdk_sysroot; // the root location of where the SDK files are all located
ConstString m_sdk_build;
+ ConstString m_working_dir; // The working directory which is used when installing modules that have no install path set
std::string m_remote_url;
std::string m_name;
uint32_t m_major_os_version;
diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h
index aa7b5edc5af1..cda9b4f57118 100644
--- a/include/lldb/Target/Process.h
+++ b/include/lldb/Target/Process.h
@@ -1745,7 +1745,7 @@ public:
/// the error object is success.
//------------------------------------------------------------------
virtual Error
- Launch (const ProcessLaunchInfo &launch_info);
+ Launch (ProcessLaunchInfo &launch_info);
virtual Error
LoadCore ();
@@ -2502,11 +2502,7 @@ public:
ExecutionResults
RunThreadPlan (ExecutionContext &exe_ctx,
lldb::ThreadPlanSP &thread_plan_sp,
- bool stop_others,
- bool run_others,
- bool unwind_on_error,
- bool ignore_breakpoints,
- uint32_t timeout_usec,
+ const EvaluateExpressionOptions &options,
Stream &errors);
static const char *
@@ -3304,6 +3300,23 @@ public:
{
return m_thread_list;
}
+
+ // When ExtendedBacktraces are requested, the HistoryThreads that are
+ // created need an owner -- they're saved here in the Process. The
+ // threads in this list are not iterated over - driver programs need to
+ // request the extended backtrace calls starting from a root concrete
+ // thread one by one.
+ ThreadList &
+ GetExtendedThreadList ()
+ {
+ return m_extended_thread_list;
+ }
+
+ ThreadList::ThreadIterable
+ Threads ()
+ {
+ return m_thread_list.Threads();
+ }
uint32_t
GetNextThreadIndexID (uint64_t thread_id);
@@ -3670,6 +3683,8 @@ protected:
ThreadList m_thread_list_real; ///< The threads for this process as are known to the protocol we are debugging with
ThreadList m_thread_list; ///< The threads for this process as the user will see them. This is usually the same as
///< m_thread_list_real, but might be different if there is an OS plug-in creating memory threads
+ ThreadList m_extended_thread_list; ///< Owner for extended threads that may be generated, cleared on natural stops
+ uint32_t m_extended_thread_stop_id; ///< The natural stop id when extended_thread_list was last updated
std::vector<Notifications> m_notifications; ///< The list of notifications that this process can deliver.
std::vector<lldb::addr_t> m_image_tokens;
Listener &m_listener;
diff --git a/include/lldb/Target/RegisterCheckpoint.h b/include/lldb/Target/RegisterCheckpoint.h
new file mode 100644
index 000000000000..3e61e1490d4b
--- /dev/null
+++ b/include/lldb/Target/RegisterCheckpoint.h
@@ -0,0 +1,71 @@
+//===-- RegisterCheckpoint.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_RegisterCheckpoint_h_
+#define liblldb_RegisterCheckpoint_h_
+
+#include "lldb/lldb-private.h"
+#include "lldb/Core/UserID.h"
+#include "lldb/Target/StackID.h"
+
+namespace lldb_private {
+
+ // Inherit from UserID in case pushing/popping all register values can be
+ // done using a 64 bit integer that holds a baton/cookie instead of actually
+ // having to read all register values into a buffer
+ class RegisterCheckpoint : public UserID
+ {
+ public:
+
+ enum class Reason {
+ // An expression is about to be run on the thread if the protocol that
+ // talks to the debuggee supports checkpointing the registers using a
+ // push/pop then the UserID base class in the RegisterCheckpoint can
+ // be used to store the baton/cookie that refers to the remote saved
+ // state.
+ eExpression,
+ // The register checkpoint wants the raw register bytes, so they must
+ // be read into m_data_sp, or the save/restore checkpoint should fail.
+ eDataBackup
+ };
+
+ RegisterCheckpoint(Reason reason) :
+ UserID(0),
+ m_data_sp (),
+ m_reason(reason)
+ {
+ }
+
+ ~RegisterCheckpoint()
+ {
+ }
+
+ lldb::DataBufferSP &
+ GetData()
+ {
+ return m_data_sp;
+ }
+
+ const lldb::DataBufferSP &
+ GetData() const
+ {
+ return m_data_sp;
+ }
+
+ protected:
+ lldb::DataBufferSP m_data_sp;
+ Reason m_reason;
+
+ // Make RegisterCheckpointSP if you wish to share the data in this class.
+ DISALLOW_COPY_AND_ASSIGN(RegisterCheckpoint);
+ };
+
+} // namespace lldb_private
+
+#endif // liblldb_RegisterCheckpoint_h_
diff --git a/include/lldb/Target/RegisterContext.h b/include/lldb/Target/RegisterContext.h
index 7da462700110..421acc03cb22 100644
--- a/include/lldb/Target/RegisterContext.h
+++ b/include/lldb/Target/RegisterContext.h
@@ -59,6 +59,18 @@ public:
virtual bool
WriteRegister (const RegisterInfo *reg_info, const RegisterValue &reg_value) = 0;
+ virtual bool
+ ReadAllRegisterValues (lldb::DataBufferSP &data_sp)
+ {
+ return false;
+ }
+
+ virtual bool
+ WriteAllRegisterValues (const lldb::DataBufferSP &data_sp)
+ {
+ return false;
+ }
+
// These two functions are used to implement "push" and "pop" of register states. They are used primarily
// for expression evaluation, where we need to push a new state (storing the old one in data_sp) and then
// restoring the original state by passing the data_sp we got from ReadAllRegisters to WriteAllRegisterValues.
@@ -67,10 +79,10 @@ public:
// so these API's should only be used when this behavior is needed.
virtual bool
- ReadAllRegisterValues (lldb::DataBufferSP &data_sp) = 0;
-
+ ReadAllRegisterValues (lldb_private::RegisterCheckpoint &reg_checkpoint);
+
virtual bool
- WriteAllRegisterValues (const lldb::DataBufferSP &data_sp) = 0;
+ WriteAllRegisterValues (const lldb_private::RegisterCheckpoint &reg_checkpoint);
bool
CopyFromRegisterContext (lldb::RegisterContextSP context);
diff --git a/include/lldb/Target/SystemRuntime.h b/include/lldb/Target/SystemRuntime.h
index 6c0a4205d5f2..7a0703e6cc34 100644
--- a/include/lldb/Target/SystemRuntime.h
+++ b/include/lldb/Target/SystemRuntime.h
@@ -127,7 +127,7 @@ public:
/// An empty vector may be returned if no thread origin extended
/// backtrace capabilities are available.
//------------------------------------------------------------------
- virtual std::vector<ConstString>
+ virtual const std::vector<ConstString> &
GetExtendedBacktraceTypes ();
//------------------------------------------------------------------
@@ -158,13 +158,16 @@ public:
/// An empty ThreadSP will be returned if no thread origin is available.
//------------------------------------------------------------------
virtual lldb::ThreadSP
- GetExtendedBacktrace (lldb::ThreadSP thread, ConstString type);
+ GetExtendedBacktraceThread (lldb::ThreadSP thread, ConstString type);
protected:
//------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
Process *m_process;
+
+ std::vector<ConstString> m_types;
+
private:
DISALLOW_COPY_AND_ASSIGN (SystemRuntime);
};
diff --git a/include/lldb/Target/Target.h b/include/lldb/Target/Target.h
index 1c90ea6f15eb..d874891a6aff 100644
--- a/include/lldb/Target/Target.h
+++ b/include/lldb/Target/Target.h
@@ -189,8 +189,10 @@ public:
m_unwind_on_error(true),
m_ignore_breakpoints (false),
m_keep_in_memory(false),
- m_run_others(true),
+ m_try_others(true),
+ m_stop_others(true),
m_debug(false),
+ m_trap_exceptions(true),
m_use_dynamic(lldb::eNoDynamicValues),
m_timeout_usec(default_timeout)
{}
@@ -201,11 +203,10 @@ public:
return m_execution_policy;
}
- EvaluateExpressionOptions&
+ void
SetExecutionPolicy (ExecutionPolicy policy = eExecutionPolicyAlways)
{
m_execution_policy = policy;
- return *this;
}
lldb::LanguageType
@@ -214,11 +215,10 @@ public:
return m_language;
}
- EvaluateExpressionOptions&
+ void
SetLanguage(lldb::LanguageType language)
{
m_language = language;
- return *this;
}
bool
@@ -227,11 +227,10 @@ public:
return m_coerce_to_id;
}
- EvaluateExpressionOptions&
+ void
SetCoerceToId (bool coerce = true)
{
m_coerce_to_id = coerce;
- return *this;
}
bool
@@ -240,11 +239,10 @@ public:
return m_unwind_on_error;
}
- EvaluateExpressionOptions&
+ void
SetUnwindOnError (bool unwind = false)
{
m_unwind_on_error = unwind;
- return *this;
}
bool
@@ -253,11 +251,10 @@ public:
return m_ignore_breakpoints;
}
- EvaluateExpressionOptions&
+ void
SetIgnoreBreakpoints (bool ignore = false)
{
m_ignore_breakpoints = ignore;
- return *this;
}
bool
@@ -266,11 +263,10 @@ public:
return m_keep_in_memory;
}
- EvaluateExpressionOptions&
+ void
SetKeepInMemory (bool keep = true)
{
m_keep_in_memory = keep;
- return *this;
}
lldb::DynamicValueType
@@ -279,11 +275,10 @@ public:
return m_use_dynamic;
}
- EvaluateExpressionOptions&
+ void
SetUseDynamic (lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget)
{
m_use_dynamic = dynamic;
- return *this;
}
uint32_t
@@ -292,24 +287,34 @@ public:
return m_timeout_usec;
}
- EvaluateExpressionOptions&
+ void
SetTimeoutUsec (uint32_t timeout = 0)
{
m_timeout_usec = timeout;
- return *this;
}
bool
- GetRunOthers () const
+ GetTryAllThreads () const
{
- return m_run_others;
+ return m_try_others;
}
- EvaluateExpressionOptions&
- SetRunOthers (bool run_others = true)
+ void
+ SetTryAllThreads (bool try_others = true)
+ {
+ m_try_others = try_others;
+ }
+
+ bool
+ GetStopOthers () const
+ {
+ return m_stop_others;
+ }
+
+ void
+ SetStopOthers (bool stop_others = true)
{
- m_run_others = run_others;
- return *this;
+ m_stop_others = stop_others;
}
bool
@@ -318,11 +323,22 @@ public:
return m_debug;
}
- EvaluateExpressionOptions&
+ void
SetDebug(bool b)
{
m_debug = b;
- return *this;
+ }
+
+ bool
+ GetTrapExceptions() const
+ {
+ return m_trap_exceptions;
+ }
+
+ void
+ SetTrapExceptions (bool b)
+ {
+ m_trap_exceptions = b;
}
private:
@@ -332,8 +348,10 @@ private:
bool m_unwind_on_error;
bool m_ignore_breakpoints;
bool m_keep_in_memory;
- bool m_run_others;
+ bool m_try_others;
+ bool m_stop_others;
bool m_debug;
+ bool m_trap_exceptions;
lldb::DynamicValueType m_use_dynamic;
uint32_t m_timeout_usec;
};
@@ -741,9 +759,23 @@ public:
SymbolsDidLoad (ModuleList &module_list);
void
- ClearModules();
+ ClearModules(bool delete_locations);
//------------------------------------------------------------------
+ /// Called as the last function in Process::DidExec().
+ ///
+ /// Process::DidExec() will clear a lot of state in the process,
+ /// then try to reload a dynamic loader plugin to discover what
+ /// binaries are currently available and then this function should
+ /// be called to allow the target to do any cleanup after everything
+ /// has been figured out. It can remove breakpoints that no longer
+ /// make sense as the exec might have changed the target
+ /// architecture, and unloaded some modules that might get deleted.
+ //------------------------------------------------------------------
+ void
+ DidExec ();
+
+ //------------------------------------------------------------------
/// Gets the module for the main executable.
///
/// Each process has a notion of a main executable that is the file
@@ -1009,6 +1041,12 @@ public:
ClangASTImporter *
GetClangASTImporter();
+ //----------------------------------------------------------------------
+ // Install any files through the platform that need be to installed
+ // prior to launching or attaching.
+ //----------------------------------------------------------------------
+ Error
+ Install(ProcessLaunchInfo *launch_info);
// Since expressions results can persist beyond the lifetime of a process,
// and the const expression results are available after a process is gone,
diff --git a/include/lldb/Target/Thread.h b/include/lldb/Target/Thread.h
index 7dac37caa200..4f78b0fe6998 100644
--- a/include/lldb/Target/Thread.h
+++ b/include/lldb/Target/Thread.h
@@ -17,6 +17,7 @@
#include "lldb/Core/UserID.h"
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Target/ExecutionContextScope.h"
+#include "lldb/Target/RegisterCheckpoint.h"
#include "lldb/Target/StackFrameList.h"
#define LLDB_THREAD_MAX_STOP_EXC_DATA 8
@@ -130,79 +131,12 @@ public:
DISALLOW_COPY_AND_ASSIGN (ThreadEventData);
};
- // TODO: You shouldn't just checkpoint the register state alone, so this should get
- // moved to protected. To do that ThreadStateCheckpoint needs to be returned as a token...
- class RegisterCheckpoint
- {
- public:
-
- RegisterCheckpoint() :
- m_stack_id (),
- m_data_sp ()
- {
- }
-
- RegisterCheckpoint (const StackID &stack_id) :
- m_stack_id (stack_id),
- m_data_sp ()
- {
- }
-
- ~RegisterCheckpoint()
- {
- }
-
- const RegisterCheckpoint&
- operator= (const RegisterCheckpoint &rhs)
- {
- if (this != &rhs)
- {
- this->m_stack_id = rhs.m_stack_id;
- this->m_data_sp = rhs.m_data_sp;
- }
- return *this;
- }
-
- RegisterCheckpoint (const RegisterCheckpoint &rhs) :
- m_stack_id (rhs.m_stack_id),
- m_data_sp (rhs.m_data_sp)
- {
- }
-
- const StackID &
- GetStackID()
- {
- return m_stack_id;
- }
-
- void
- SetStackID (const StackID &stack_id)
- {
- m_stack_id = stack_id;
- }
-
- lldb::DataBufferSP &
- GetData()
- {
- return m_data_sp;
- }
-
- const lldb::DataBufferSP &
- GetData() const
- {
- return m_data_sp;
- }
-
- protected:
- StackID m_stack_id;
- lldb::DataBufferSP m_data_sp;
- };
struct ThreadStateCheckpoint
{
uint32_t orig_stop_id; // Dunno if I need this yet but it is an interesting bit of data.
lldb::StopInfoSP stop_info_sp; // You have to restore the stop info or you might continue with the wrong signals.
- RegisterCheckpoint register_backup; // You need to restore the registers, of course...
+ lldb::RegisterCheckpointSP register_backup_sp; // You need to restore the registers, of course...
uint32_t current_inlined_depth;
lldb::addr_t current_inlined_pc;
};
@@ -339,18 +273,33 @@ public:
return NULL;
}
+ virtual void
+ SetName (const char *name)
+ {
+ }
+
virtual lldb::queue_id_t
GetQueueID ()
{
return LLDB_INVALID_QUEUE_ID;
}
+ virtual void
+ SetQueueID (lldb::queue_id_t new_val)
+ {
+ }
+
virtual const char *
GetQueueName ()
{
return NULL;
}
+ virtual void
+ SetQueueName (const char *name)
+ {
+ }
+
virtual uint32_t
GetStackFrameCount()
{
@@ -529,21 +478,6 @@ public:
QueueFundamentalPlan (bool abort_other_plans);
//------------------------------------------------------------------
- /// Queues the plan used to step over a breakpoint at the current PC of \a thread.
- /// The default version returned by Process handles trap based breakpoints, and
- /// will disable the breakpoint, single step over it, then re-enable it.
- ///
- /// @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.
- ///
- /// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
- //------------------------------------------------------------------
- virtual lldb::ThreadPlanSP
- QueueThreadPlanForStepOverBreakpointPlan (bool abort_other_plans);
-
- //------------------------------------------------------------------
/// Queues the plan used to step one instruction from the current PC of \a thread.
///
/// @param[in] step_over
@@ -728,14 +662,6 @@ public:
bool stop_others,
uint32_t frame_idx);
- virtual lldb::ThreadPlanSP
- QueueThreadPlanForCallFunction (bool abort_other_plans,
- Address& function,
- lldb::addr_t arg,
- bool stop_other_threads,
- bool unwind_on_error = false,
- bool ignore_breakpoints = true);
-
//------------------------------------------------------------------
// Thread Plan accessors:
//------------------------------------------------------------------
@@ -879,7 +805,7 @@ public:
void
SetTracer (lldb::ThreadPlanTracerSP &tracer_sp);
-
+
//------------------------------------------------------------------
// Get the thread index ID. The index ID that is guaranteed to not
// be re-used by a process. They start at 1 and increase with each
@@ -888,8 +814,25 @@ public:
//------------------------------------------------------------------
uint32_t
GetIndexID () const;
-
-
+
+ //------------------------------------------------------------------
+ // Get the originating thread's index ID.
+ // In the case of an "extended" thread -- a thread which represents
+ // the stack that enqueued/spawned work that is currently executing --
+ // we need to provide the IndexID of the thread that actually did
+ // this work. We don't want to just masquerade as that thread's IndexID
+ // by using it in our own IndexID because that way leads to madness -
+ // but the driver program which is iterating over extended threads
+ // may ask for the OriginatingThreadID to display that information
+ // to the user.
+ // Normal threads will return the same thing as GetIndexID();
+ //------------------------------------------------------------------
+ virtual uint32_t
+ GetExtendedBacktraceOriginatingIndexID ()
+ {
+ return GetIndexID ();
+ }
+
//------------------------------------------------------------------
// The API ID is often the same as the Thread::GetID(), but not in
// all cases. Thread::GetID() is the user visible thread ID that
@@ -1001,6 +944,33 @@ public:
void
SetShouldReportStop (Vote vote);
+ //----------------------------------------------------------------------
+ /// Sets the extended backtrace token for this thread
+ ///
+ /// Some Thread subclasses may maintain a token to help with providing
+ /// an extended backtrace. The SystemRuntime plugin will set/request this.
+ ///
+ /// @param [in] token
+ //----------------------------------------------------------------------
+ virtual void
+ SetExtendedBacktraceToken (uint64_t token) { }
+
+ //----------------------------------------------------------------------
+ /// Gets the extended backtrace token for this thread
+ ///
+ /// Some Thread subclasses may maintain a token to help with providing
+ /// an extended backtrace. The SystemRuntime plugin will set/request this.
+ ///
+ /// @return
+ /// The token needed by the SystemRuntime to create an extended backtrace.
+ /// LLDB_INVALID_ADDRESS is returned if no token is available.
+ //----------------------------------------------------------------------
+ virtual uint64_t
+ GetExtendedBacktraceToken ()
+ {
+ return LLDB_INVALID_ADDRESS;
+ }
+
protected:
friend class ThreadPlan;
@@ -1027,16 +997,6 @@ protected:
typedef std::vector<lldb::ThreadPlanSP> plan_stack;
- virtual bool
- SaveFrameZeroState (RegisterCheckpoint &checkpoint);
-
- virtual bool
- RestoreSaveFrameZero (const RegisterCheckpoint &checkpoint);
-
- // register_data_sp must be a DataSP passed to ReadAllRegisterValues.
- bool
- ResetFrameZeroRegisters (lldb::DataBufferSP register_data_sp);
-
virtual lldb_private::Unwind *
GetUnwinder ();
@@ -1058,12 +1018,6 @@ protected:
lldb::StackFrameListSP
GetStackFrameList ();
- struct ThreadState
- {
- uint32_t orig_stop_id;
- lldb::StopInfoSP stop_info_sp;
- RegisterCheckpoint register_backup;
- };
//------------------------------------------------------------------
// Classes that inherit from Process can see and modify these
diff --git a/include/lldb/Target/ThreadList.h b/include/lldb/Target/ThreadList.h
index ddf49b002ecf..f4dfdb23ec0f 100644
--- a/include/lldb/Target/ThreadList.h
+++ b/include/lldb/Target/ThreadList.h
@@ -14,6 +14,7 @@
#include "lldb/lldb-private.h"
#include "lldb/Core/UserID.h"
+#include "lldb/Utility/Iterable.h"
// FIXME: Currently this is a thread list with lots of functionality for use only by
@@ -69,6 +70,15 @@ public:
// is a unique index assigned
lldb::ThreadSP
GetThreadAtIndex (uint32_t idx, bool can_update = true);
+
+ typedef std::vector<lldb::ThreadSP> collection;
+ typedef LockingAdaptedIterable<collection, lldb::ThreadSP, vector_adapter> ThreadIterable;
+
+ ThreadIterable
+ Threads ()
+ {
+ return ThreadIterable(m_threads, GetMutex());
+ }
lldb::ThreadSP
FindThreadByID (lldb::tid_t tid, bool can_update = true);
@@ -145,7 +155,6 @@ protected:
void
NotifySelectedThreadChanged (lldb::tid_t tid);
- typedef std::vector<lldb::ThreadSP> collection;
//------------------------------------------------------------------
// Classes that inherit from Process can see and modify these
//------------------------------------------------------------------
diff --git a/include/lldb/Target/ThreadPlanCallFunction.h b/include/lldb/Target/ThreadPlanCallFunction.h
index 7b8efb60b880..18f1d0facbf6 100644
--- a/include/lldb/Target/ThreadPlanCallFunction.h
+++ b/include/lldb/Target/ThreadPlanCallFunction.h
@@ -18,6 +18,8 @@
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlan.h"
+#include "llvm/ADT/ArrayRef.h"
+
namespace lldb_private {
class ThreadPlanCallFunction : public ThreadPlan
@@ -29,25 +31,8 @@ public:
ThreadPlanCallFunction (Thread &thread,
const Address &function,
const ClangASTType &return_type,
- lldb::addr_t arg,
- bool stop_other_threads,
- bool unwind_on_error = true,
- bool ignore_breakpoints = false,
- lldb::addr_t *this_arg = 0,
- lldb::addr_t *cmd_arg = 0);
-
- ThreadPlanCallFunction (Thread &thread,
- const Address &function,
- const ClangASTType &return_type,
- bool stop_other_threads,
- bool unwind_on_error,
- bool ignore_breakpoints,
- lldb::addr_t *arg1_ptr = NULL,
- lldb::addr_t *arg2_ptr = NULL,
- lldb::addr_t *arg3_ptr = NULL,
- lldb::addr_t *arg4_ptr = NULL,
- lldb::addr_t *arg5_ptr = NULL,
- lldb::addr_t *arg6_ptr = NULL);
+ llvm::ArrayRef<lldb::addr_t> args,
+ const EvaluateExpressionOptions &options);
virtual
~ThreadPlanCallFunction ();
@@ -171,10 +156,13 @@ private:
bool m_valid;
bool m_stop_other_threads;
+ bool m_unwind_on_error;
+ bool m_ignore_breakpoints;
+ bool m_debug_execution;
+ bool m_trap_exceptions;
Address m_function_addr;
Address m_start_addr;
lldb::addr_t m_function_sp;
- Thread::RegisterCheckpoint m_register_backup;
lldb::ThreadPlanSP m_subplan_sp;
LanguageRuntime *m_cxx_language_runtime;
LanguageRuntime *m_objc_language_runtime;
@@ -187,9 +175,9 @@ private:
ClangASTType m_return_type;
lldb::ValueObjectSP m_return_valobj_sp; // If this contains a valid pointer, use the ABI to extract values when complete
bool m_takedown_done; // We want to ensure we only do the takedown once. This ensures that.
+ bool m_should_clear_objc_exception_bp;
+ bool m_should_clear_cxx_exception_bp;
lldb::addr_t m_stop_address; // This is the address we stopped at. Also set in DoTakedown;
- bool m_unwind_on_error;
- bool m_ignore_breakpoints;
DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallFunction);
};
diff --git a/include/lldb/Target/ThreadPlanCallUserExpression.h b/include/lldb/Target/ThreadPlanCallUserExpression.h
index 7a7ec33049e0..5eb7cc1cd452 100644
--- a/include/lldb/Target/ThreadPlanCallUserExpression.h
+++ b/include/lldb/Target/ThreadPlanCallUserExpression.h
@@ -20,6 +20,8 @@
#include "lldb/Target/ThreadPlan.h"
#include "lldb/Target/ThreadPlanCallFunction.h"
+#include "llvm/ADT/ArrayRef.h"
+
namespace lldb_private {
class ThreadPlanCallUserExpression : public ThreadPlanCallFunction
@@ -27,12 +29,8 @@ class ThreadPlanCallUserExpression : public ThreadPlanCallFunction
public:
ThreadPlanCallUserExpression (Thread &thread,
Address &function,
- lldb::addr_t arg,
- bool stop_other_threads,
- bool unwind_on_error,
- bool ignore_breakpoints,
- lldb::addr_t *this_arg,
- lldb::addr_t *cmd_arg,
+ llvm::ArrayRef<lldb::addr_t> args,
+ const EvaluateExpressionOptions &options,
ClangUserExpression::ClangUserExpressionSP &user_expression_sp);
virtual
diff --git a/include/lldb/Utility/Iterable.h b/include/lldb/Utility/Iterable.h
new file mode 100644
index 000000000000..9b91cae37eef
--- /dev/null
+++ b/include/lldb/Utility/Iterable.h
@@ -0,0 +1,225 @@
+//===-- Iterable.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_Iterable_h_
+#define liblldb_Iterable_h_
+
+#include "lldb/Host/Mutex.h"
+
+namespace lldb_private
+{
+
+template <typename I, typename E> E map_adapter(I &iter)
+{
+ return iter->second;
+}
+
+template <typename I, typename E> E vector_adapter(I &iter)
+{
+ return *iter;
+}
+
+template <typename C, typename E, E (*A)(typename C::const_iterator &)> class AdaptedConstIterator
+{
+public:
+ typedef typename C::const_iterator BackingIterator;
+private:
+ BackingIterator m_iter;
+public:
+ // Wrapping constructor
+ AdaptedConstIterator (BackingIterator backing_iterator) :
+ m_iter(backing_iterator)
+ {
+ }
+
+ // Default-constructible
+ AdaptedConstIterator () :
+ m_iter()
+ {
+ }
+
+ // Copy-constructible
+ AdaptedConstIterator (const AdaptedConstIterator &rhs) :
+ m_iter(rhs.m_iter)
+ {
+ }
+
+ // Copy-assignable
+ AdaptedConstIterator &operator= (const AdaptedConstIterator &rhs)
+ {
+ m_iter = rhs.m_iter;
+ return *this;
+ }
+
+ // Destructible
+ ~AdaptedConstIterator () { }
+
+ // Comparable
+ bool operator== (const AdaptedConstIterator &rhs)
+ {
+ return m_iter == rhs.m_iter;
+ }
+
+ bool operator!= (const AdaptedConstIterator &rhs)
+ {
+ return m_iter != rhs.m_iter;
+ }
+
+ // Rvalue dereferenceable
+ E operator* ()
+ {
+ return (*A)(m_iter);
+ }
+
+ E operator-> ()
+ {
+ return (*A)(m_iter);
+ }
+
+ // Offset dereferenceable
+ E operator[] (typename BackingIterator::difference_type offset)
+ {
+ return AdaptedConstIterator(m_iter + offset);
+ }
+
+ // Incrementable
+ AdaptedConstIterator &operator++ ()
+ {
+ m_iter++;
+ return *this;
+ }
+
+ // Decrementable
+ AdaptedConstIterator &operator-- ()
+ {
+ m_iter--;
+ return *this;
+ }
+
+ // Compound assignment
+ AdaptedConstIterator &operator+= (typename BackingIterator::difference_type offset)
+ {
+ m_iter += offset;
+ return *this;
+ }
+
+ AdaptedConstIterator &operator-= (typename BackingIterator::difference_type offset)
+ {
+ m_iter -= offset;
+ return *this;
+ }
+
+ // Arithmetic
+ AdaptedConstIterator operator+ (typename BackingIterator::difference_type offset)
+ {
+ return AdaptedConstIterator(m_iter + offset);
+ }
+
+ AdaptedConstIterator operator- (typename BackingIterator::difference_type offset)
+ {
+ return AdaptedConstIterator(m_iter - offset);
+ }
+
+ // Comparable
+ bool operator< (AdaptedConstIterator &rhs)
+ {
+ return m_iter < rhs.m_iter;
+ }
+
+ bool operator<= (AdaptedConstIterator &rhs)
+ {
+ return m_iter <= rhs.m_iter;
+ }
+
+ bool operator> (AdaptedConstIterator &rhs)
+ {
+ return m_iter > rhs.m_iter;
+ }
+
+ bool operator>= (AdaptedConstIterator &rhs)
+ {
+ return m_iter >= rhs.m_iter;
+ }
+
+ friend AdaptedConstIterator operator+(typename BackingIterator::difference_type, AdaptedConstIterator &);
+ friend typename BackingIterator::difference_type operator-(AdaptedConstIterator &, AdaptedConstIterator &);
+ friend void swap(AdaptedConstIterator &, AdaptedConstIterator &);
+};
+
+template <typename C, typename E, E (*A)(typename C::const_iterator &)>
+AdaptedConstIterator<C, E, A> operator+ (typename AdaptedConstIterator<C, E, A>::BackingIterator::difference_type offset, AdaptedConstIterator<C, E, A> &rhs)
+{
+ return rhs.operator+(offset);
+}
+
+template <typename C, typename E, E (*A)(typename C::const_iterator &)>
+typename AdaptedConstIterator<C, E, A>::BackingIterator::difference_type operator- (AdaptedConstIterator<C, E, A> &lhs, AdaptedConstIterator<C, E, A> &rhs)
+{
+ return(lhs.m_iter - rhs.m_iter);
+}
+
+template <typename C, typename E, E (*A)(typename C::const_iterator &)>
+void swap (AdaptedConstIterator<C, E, A> &lhs, AdaptedConstIterator<C, E, A> &rhs)
+{
+ std::swap(lhs.m_iter, rhs.m_iter);
+}
+
+template <typename C, typename E, E (*A)(typename C::const_iterator &)> class AdaptedIterable
+{
+private:
+ const C &m_container;
+public:
+ AdaptedIterable (const C &container) :
+ m_container(container)
+ {
+ }
+
+ AdaptedConstIterator<C, E, A> begin ()
+ {
+ return AdaptedConstIterator<C, E, A>(m_container.begin());
+ }
+
+ AdaptedConstIterator<C, E, A> end ()
+ {
+ return AdaptedConstIterator<C, E, A>(m_container.end());
+ }
+};
+
+template <typename C, typename E, E (*A)(typename C::const_iterator &)> class LockingAdaptedIterable : public AdaptedIterable<C, E, A>
+{
+private:
+ Mutex *m_mutex = nullptr;
+public:
+ LockingAdaptedIterable (C &container, Mutex &mutex) :
+ AdaptedIterable<C,E,A>(container),
+ m_mutex(&mutex)
+ {
+ m_mutex->Lock();
+ }
+
+ LockingAdaptedIterable (LockingAdaptedIterable &&rhs) :
+ AdaptedIterable<C,E,A>(rhs),
+ m_mutex(rhs.m_mutex)
+ {
+ rhs.m_mutex = NULL;
+ }
+
+ ~LockingAdaptedIterable ()
+ {
+ if (m_mutex)
+ m_mutex->Unlock();
+ }
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(LockingAdaptedIterable);
+};
+
+}
+
+#endif
diff --git a/include/lldb/Utility/PythonPointer.h b/include/lldb/Utility/PythonPointer.h
index f782f7f1313c..fe90670fd2e1 100644
--- a/include/lldb/Utility/PythonPointer.h
+++ b/include/lldb/Utility/PythonPointer.h
@@ -12,11 +12,7 @@
#include <algorithm>
-#if defined (__APPLE__)
-#include <Python/Python.h>
-#else
-#include <Python.h>
-#endif
+#include "lldb/lldb-python.h"
namespace lldb_private {
diff --git a/include/lldb/lldb-enumerations.h b/include/lldb/lldb-enumerations.h
index ae8c92be900b..0b341575be46 100644
--- a/include/lldb/lldb-enumerations.h
+++ b/include/lldb/lldb-enumerations.h
@@ -684,6 +684,48 @@ namespace lldb {
eAddressClassRuntime
} AddressClass;
+ //----------------------------------------------------------------------
+ // File Permissions
+ //
+ // Designed to mimic the unix file permission bits so they can be
+ // used with functions that set 'mode_t' to certain values for
+ // permissions.
+ //----------------------------------------------------------------------
+ typedef enum FilePermissions
+ {
+ eFilePermissionsUserRead = (1u << 8),
+ eFilePermissionsUserWrite = (1u << 7),
+ eFilePermissionsUserExecute = (1u << 6),
+ eFilePermissionsGroupRead = (1u << 5),
+ eFilePermissionsGroupWrite = (1u << 4),
+ eFilePermissionsGroupExecute = (1u << 3),
+ eFilePermissionsWorldRead = (1u << 2),
+ eFilePermissionsWorldWrite = (1u << 1),
+ eFilePermissionsWorldExecute = (1u << 0),
+
+ eFilePermissionsUserRW = (eFilePermissionsUserRead | eFilePermissionsUserWrite | 0 ),
+ eFileFilePermissionsUserRX = (eFilePermissionsUserRead | 0 | eFilePermissionsUserExecute ),
+ eFilePermissionsUserRWX = (eFilePermissionsUserRead | eFilePermissionsUserWrite | eFilePermissionsUserExecute ),
+
+ eFilePermissionsGroupRW = (eFilePermissionsGroupRead | eFilePermissionsGroupWrite | 0 ),
+ eFilePermissionsGroupRX = (eFilePermissionsGroupRead | 0 | eFilePermissionsGroupExecute ),
+ eFilePermissionsGroupRWX = (eFilePermissionsGroupRead | eFilePermissionsGroupWrite | eFilePermissionsGroupExecute ),
+
+ eFilePermissionsWorldRW = (eFilePermissionsWorldRead | eFilePermissionsWorldWrite | 0 ),
+ eFilePermissionsWorldRX = (eFilePermissionsWorldRead | 0 | eFilePermissionsWorldExecute ),
+ eFilePermissionsWorldRWX = (eFilePermissionsWorldRead | eFilePermissionsWorldWrite | eFilePermissionsWorldExecute ),
+
+ eFilePermissionsEveryoneR = (eFilePermissionsUserRead | eFilePermissionsGroupRead | eFilePermissionsWorldRead ),
+ eFilePermissionsEveryoneW = (eFilePermissionsUserWrite | eFilePermissionsGroupWrite | eFilePermissionsWorldWrite ),
+ eFilePermissionsEveryoneX = (eFilePermissionsUserExecute | eFilePermissionsGroupExecute | eFilePermissionsWorldExecute ),
+
+ eFilePermissionsEveryoneRW = (eFilePermissionsEveryoneR | eFilePermissionsEveryoneW | 0 ),
+ eFilePermissionsEveryoneRX = (eFilePermissionsEveryoneR | 0 | eFilePermissionsEveryoneX ),
+ eFilePermissionsEveryoneRWX = (eFilePermissionsEveryoneR | eFilePermissionsEveryoneW | eFilePermissionsEveryoneX ),
+ eFilePermissionsFileDefault = eFilePermissionsUserRW,
+ eFilePermissionsDirectoryDefault = eFilePermissionsUserRWX,
+ } FilePermissions;
+
} // namespace lldb
diff --git a/include/lldb/lldb-forward.h b/include/lldb/lldb-forward.h
index cd8a5c2e8130..68d85f081e25 100644
--- a/include/lldb/lldb-forward.h
+++ b/include/lldb/lldb-forward.h
@@ -97,6 +97,7 @@ class FileSpecList;
class Flags;
class TypeCategoryImpl;
class FormatManager;
+class FormattersMatchCandidate;
class FuncUnwinders;
class Function;
class FunctionInfo;
@@ -162,6 +163,7 @@ class PythonDictionary;
class PythonInteger;
class PythonObject;
class PythonString;
+class RegisterCheckpoint;
class RegisterContext;
class RegisterLocation;
class RegisterLocationList;
@@ -329,6 +331,7 @@ namespace lldb {
typedef std::shared_ptr<lldb_private::ProcessLaunchInfo> ProcessLaunchInfoSP;
typedef std::weak_ptr<lldb_private::Process> ProcessWP;
typedef std::shared_ptr<lldb_private::Property> PropertySP;
+ typedef std::shared_ptr<lldb_private::RegisterCheckpoint> RegisterCheckpointSP;
typedef std::shared_ptr<lldb_private::RegisterContext> RegisterContextSP;
typedef std::shared_ptr<lldb_private::RegularExpression> RegularExpressionSP;
typedef std::shared_ptr<lldb_private::ScriptInterpreterObject> ScriptInterpreterObjectSP;
diff --git a/include/lldb/lldb-private-enumerations.h b/include/lldb/lldb-private-enumerations.h
index e523b912eac6..98919422be58 100644
--- a/include/lldb/lldb-private-enumerations.h
+++ b/include/lldb/lldb-private-enumerations.h
@@ -133,7 +133,8 @@ typedef enum ExecutionResults
eExecutionDiscarded,
eExecutionInterrupted,
eExecutionHitBreakpoint,
- eExecutionTimedOut
+ eExecutionTimedOut,
+ eExecutionStoppedForDebug
} ExecutionResults;
typedef enum ObjCRuntimeVersions {
diff --git a/include/lldb/lldb-python.h b/include/lldb/lldb-python.h
index 229e3967e4a5..ce5c8176a3c3 100644
--- a/include/lldb/lldb-python.h
+++ b/include/lldb/lldb-python.h
@@ -18,11 +18,7 @@
#else
-#if defined (__APPLE__)
-#include <Python/Python.h>
-#else
#include <Python.h>
-#endif
#endif // LLDB_DISABLE_PYTHON