summaryrefslogtreecommitdiffstats
path: root/lldb/include
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/include')
-rw-r--r--lldb/include/lldb/API/SBDefines.h1
-rw-r--r--lldb/include/lldb/API/SBExpressionOptions.h96
-rw-r--r--lldb/include/lldb/API/SBFrame.h3
-rw-r--r--lldb/include/lldb/API/SBValue.h3
-rw-r--r--lldb/include/lldb/Expression/ClangFunction.h26
-rw-r--r--lldb/include/lldb/Expression/ClangUserExpression.h34
-rw-r--r--lldb/include/lldb/Target/Process.h4
-rw-r--r--lldb/include/lldb/Target/Target.h213
-rw-r--r--lldb/include/lldb/lldb-forward.h1
9 files changed, 262 insertions, 119 deletions
diff --git a/lldb/include/lldb/API/SBDefines.h b/lldb/include/lldb/API/SBDefines.h
index 28b71b165d8..e8740a8d5e6 100644
--- a/lldb/include/lldb/API/SBDefines.h
+++ b/lldb/include/lldb/API/SBDefines.h
@@ -41,6 +41,7 @@ class SBDeclaration;
class SBError;
class SBEvent;
class SBEventList;
+class SBExpressionOptions;
class SBFileSpec;
class SBFileSpecList;
class SBFrame;
diff --git a/lldb/include/lldb/API/SBExpressionOptions.h b/lldb/include/lldb/API/SBExpressionOptions.h
new file mode 100644
index 00000000000..509ec052c91
--- /dev/null
+++ b/lldb/include/lldb/API/SBExpressionOptions.h
@@ -0,0 +1,96 @@
+//===-- SBEvent.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_SBExpressionOptions_h_
+#define LLDB_SBExpressionOptions_h_
+
+#include "lldb/API/SBDefines.h"
+
+#include <memory>
+#include <vector>
+
+namespace lldb {
+
+
+class SBExpressionOptions
+{
+friend class SBFrame;
+friend class SBValue;
+
+public:
+ SBExpressionOptions();
+
+ SBExpressionOptions (const lldb::SBExpressionOptions &rhs);
+
+ SBExpressionOptions (bool coerce_to_id,
+ bool unwind_on_error,
+ bool keep_in_memory,
+ bool run_others,
+ DynamicValueType use_dynamic,
+ uint32_t timeout_usec);
+
+ ~SBExpressionOptions();
+
+ const SBExpressionOptions &
+ operator = (const lldb::SBExpressionOptions &rhs);
+
+ bool
+ DoesCoerceToId () const;
+
+ void
+ SetCoerceToId (bool coerce = true);
+
+ bool
+ DoesUnwindOnError () const;
+
+ void
+ SetUnwindOnError (bool unwind = false);
+
+ bool
+ DoesKeepInMemory () const;
+
+ void
+ SetKeepInMemory (bool keep = true);
+
+ lldb::DynamicValueType
+ GetUseDynamic () const;
+
+ void
+ SetUseDynamic (lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget);
+
+ uint32_t
+ GetTimeoutUsec () const;
+
+ void
+ SetTimeoutUsec (uint32_t timeout = 0);
+
+ bool
+ GetRunOthers () const;
+
+ void
+ SetRunOthers (bool run_others = true);
+
+protected:
+
+ SBExpressionOptions (lldb_private::EvaluateExpressionOptions &expression_options);
+
+ lldb_private::EvaluateExpressionOptions *
+ get () const;
+
+ lldb_private::EvaluateExpressionOptions &
+ ref () const;
+
+private:
+ // This auto_pointer is made in the constructor and is always valid.
+ mutable std::auto_ptr<lldb_private::EvaluateExpressionOptions> m_opaque_ap;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBExpressionOptions_h_
diff --git a/lldb/include/lldb/API/SBFrame.h b/lldb/include/lldb/API/SBFrame.h
index 7d3d208a2b6..8af708b7e5e 100644
--- a/lldb/include/lldb/API/SBFrame.h
+++ b/lldb/include/lldb/API/SBFrame.h
@@ -105,6 +105,9 @@ public:
lldb::SBValue
EvaluateExpression (const char *expr, lldb::DynamicValueType use_dynamic, bool unwind_on_error);
+
+ lldb::SBValue
+ EvaluateExpression (const char *expr, const SBExpressionOptions &options);
/// Gets the lexical block that defines the stack frame. Another way to think
/// of this is it will return the block that contains all of the variables
diff --git a/lldb/include/lldb/API/SBValue.h b/lldb/include/lldb/API/SBValue.h
index 802a6e2b44f..0502074d42d 100644
--- a/lldb/include/lldb/API/SBValue.h
+++ b/lldb/include/lldb/API/SBValue.h
@@ -137,6 +137,9 @@ public:
CreateValueFromExpression (const char *name, const char* expression);
lldb::SBValue
+ CreateValueFromExpression (const char *name, const char* expression, SBExpressionOptions &options);
+
+ lldb::SBValue
CreateValueFromAddress (const char* name,
lldb::addr_t address,
lldb::SBType type);
diff --git a/lldb/include/lldb/Expression/ClangFunction.h b/lldb/include/lldb/Expression/ClangFunction.h
index 47784d3c495..68093eb759b 100644
--- a/lldb/include/lldb/Expression/ClangFunction.h
+++ b/lldb/include/lldb/Expression/ClangFunction.h
@@ -251,9 +251,10 @@ public:
/// 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] single_thread_timeout_usec
- /// If stop_others is true, the length of time to wait before
- /// concluding that the system is deadlocked.
+ /// @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.
@@ -272,7 +273,7 @@ public:
bool stop_others,
bool try_all_threads,
bool discard_on_error,
- uint32_t single_thread_timeout_usec,
+ uint32_t timeout_usec,
Stream &errors,
lldb::addr_t* this_arg = 0);
@@ -329,7 +330,7 @@ public:
//------------------------------------------------------------------
/// Run the function this ClangFunction was created with.
///
- /// This simple version will run the function on one thread. If \a single_thread_timeout_usec
+ /// 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.
///
@@ -339,8 +340,10 @@ public:
/// @param[in] errors
/// Errors will be written here if there are any.
///
- /// @param[in] single_thread_timeout_usec
- /// 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.
@@ -379,8 +382,11 @@ public:
/// @param[in] stop_others
/// If \b true, run only this thread, if \b false let all threads run.
///
- /// @param[in] single_thread_timeout_usec
- /// 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.
@@ -396,7 +402,7 @@ public:
lldb::addr_t *args_addr_ptr,
Stream &errors,
bool stop_others,
- uint32_t single_thread_timeout_usec,
+ uint32_t timeout_usec,
bool try_all_threads,
bool discard_on_error,
Value &results);
diff --git a/lldb/include/lldb/Expression/ClangUserExpression.h b/lldb/include/lldb/Expression/ClangUserExpression.h
index 772f7f6b5b7..dc46ebe34c2 100644
--- a/lldb/include/lldb/Expression/ClangUserExpression.h
+++ b/lldb/include/lldb/Expression/ClangUserExpression.h
@@ -132,9 +132,16 @@ public:
/// A pointer to direct at the persistent variable in which the
/// expression's result is stored.
///
- /// @param[in] single_thread_timeout_usec
- /// The amount of time (in usec) that we are willing to wait for this
- /// expression to complete, before assuming that we are blocked and giving up
+ /// @param[in] try_all_threads
+ /// If true, then we will try to run all threads if the function doesn't complete on
+ /// one thread. See timeout_usec for the interaction of this variable and
+ /// the timeout.
+ ///
+ /// @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.
+ ///
///
/// @return
/// A Process::Execution results value.
@@ -145,7 +152,8 @@ public:
bool discard_on_error,
ClangUserExpressionSP &shared_ptr_to_me,
lldb::ClangExpressionVariableSP &result,
- uint32_t single_thread_timeout_usec = 500000);
+ bool try_all_threads = true,
+ uint32_t timeout_usec = 500000);
ThreadPlan *
GetThreadPlanToExecuteJITExpression (Stream &error_stream,
@@ -314,9 +322,15 @@ public:
/// @param[in/out] result_valobj_sp
/// If execution is successful, the result valobj is placed here.
///
- /// @param[in] single_thread_timeout_usec
- /// The amount of time (in usec) that we are willing to wait for this
- /// expression to complete, before assuming that we are blocked and giving up
+ /// @param[in] try_all_threads
+ /// If true, then we will try to run all threads if the function doesn't complete on
+ /// one thread. See timeout_usec for the interaction of this variable and
+ /// the timeout.
+ ///
+ /// @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.
///
/// @result
/// A Process::ExecutionResults value. eExecutionCompleted for success.
@@ -330,7 +344,8 @@ public:
const char *expr_cstr,
const char *expr_prefix,
lldb::ValueObjectSP &result_valobj_sp,
- uint32_t single_thread_timeout_usec = 500000);
+ bool try_all_threads = true,
+ uint32_t timeout_usec = 500000);
static ExecutionResults
EvaluateWithError (ExecutionContext &exe_ctx,
@@ -342,7 +357,8 @@ public:
const char *expr_prefix,
lldb::ValueObjectSP &result_valobj_sp,
Error &error,
- uint32_t single_thread_timeout_usec = 500000);
+ bool try_all_threads = true,
+ uint32_t timeout_usec = 500000);
static const Error::ValueType kNoResult = 0x1001; ///< ValueObject::GetError() returns this if there is no result from the expression.
private:
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index e043190059d..1278a44dc78 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -2363,9 +2363,9 @@ public:
RunThreadPlan (ExecutionContext &exe_ctx,
lldb::ThreadPlanSP &thread_plan_sp,
bool stop_others,
- bool try_all_threads,
+ bool run_others,
bool discard_on_error,
- uint32_t single_thread_timeout_usec,
+ uint32_t timeout_usec,
Stream &errors);
static const char *
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index 15b87d7ce6b..8d68a490a2b 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -137,6 +137,121 @@ public:
typedef STD_SHARED_PTR(TargetProperties) TargetPropertiesSP;
+class EvaluateExpressionOptions
+{
+public:
+ static const uint32_t default_timeout = 500000;
+ EvaluateExpressionOptions() :
+ m_execution_policy(eExecutionPolicyOnlyWhenNeeded),
+ m_coerce_to_id(false),
+ m_unwind_on_error(true),
+ m_keep_in_memory(false),
+ m_run_others(true),
+ m_use_dynamic(lldb::eNoDynamicValues),
+ m_timeout_usec(default_timeout)
+ {}
+
+ ExecutionPolicy
+ GetExecutionPolicy () const
+ {
+ return m_execution_policy;
+ }
+
+ EvaluateExpressionOptions&
+ SetExecutionPolicy (ExecutionPolicy policy = eExecutionPolicyAlways)
+ {
+ m_execution_policy = policy;
+ return *this;
+ }
+
+ bool
+ DoesCoerceToId () const
+ {
+ return m_coerce_to_id;
+ }
+
+ EvaluateExpressionOptions&
+ SetCoerceToId (bool coerce = true)
+ {
+ m_coerce_to_id = coerce;
+ return *this;
+ }
+
+ bool
+ DoesUnwindOnError () const
+ {
+ return m_unwind_on_error;
+ }
+
+ EvaluateExpressionOptions&
+ SetUnwindOnError (bool unwind = false)
+ {
+ m_unwind_on_error = unwind;
+ return *this;
+ }
+
+ bool
+ DoesKeepInMemory () const
+ {
+ return m_keep_in_memory;
+ }
+
+ EvaluateExpressionOptions&
+ SetKeepInMemory (bool keep = true)
+ {
+ m_keep_in_memory = keep;
+ return *this;
+ }
+
+ lldb::DynamicValueType
+ GetUseDynamic () const
+ {
+ return m_use_dynamic;
+ }
+
+ EvaluateExpressionOptions&
+ SetUseDynamic (lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget)
+ {
+ m_use_dynamic = dynamic;
+ return *this;
+ }
+
+ uint32_t
+ GetTimeoutUsec () const
+ {
+ return m_timeout_usec;
+ }
+
+ EvaluateExpressionOptions&
+ SetTimeoutUsec (uint32_t timeout = 0)
+ {
+ m_timeout_usec = timeout;
+ return *this;
+ }
+
+ bool
+ GetRunOthers () const
+ {
+ return m_run_others;
+ }
+
+ EvaluateExpressionOptions&
+ SetRunOthers (bool run_others = true)
+ {
+ m_run_others = run_others;
+ return *this;
+ }
+
+private:
+ ExecutionPolicy m_execution_policy;
+ bool m_coerce_to_id;
+ bool m_unwind_on_error;
+ bool m_keep_in_memory;
+ bool m_run_others;
+ lldb::DynamicValueType m_use_dynamic;
+ uint32_t m_timeout_usec;
+};
+
//----------------------------------------------------------------------
// Target
//----------------------------------------------------------------------
@@ -760,104 +875,6 @@ public:
ClangASTImporter *
GetClangASTImporter();
- class EvaluateExpressionOptions
- {
- public:
- EvaluateExpressionOptions() :
- m_execution_policy(eExecutionPolicyOnlyWhenNeeded),
- m_coerce_to_id(false),
- m_unwind_on_error(true),
- m_keep_in_memory(false),
- m_use_dynamic(lldb::eNoDynamicValues),
- m_single_thread_timeout_usec(500000)
- {}
-
- ExecutionPolicy
- GetExecutionPolicy () const
- {
- return m_execution_policy;
- }
-
- EvaluateExpressionOptions&
- SetExecutionPolicy (ExecutionPolicy policy = eExecutionPolicyAlways)
- {
- m_execution_policy = policy;
- return *this;
- }
-
- bool
- DoesCoerceToId () const
- {
- return m_coerce_to_id;
- }
-
- EvaluateExpressionOptions&
- SetCoerceToId (bool coerce = true)
- {
- m_coerce_to_id = coerce;
- return *this;
- }
-
- bool
- DoesUnwindOnError () const
- {
- return m_unwind_on_error;
- }
-
- EvaluateExpressionOptions&
- SetUnwindOnError (bool unwind = false)
- {
- m_unwind_on_error = unwind;
- return *this;
- }
-
- bool
- DoesKeepInMemory () const
- {
- return m_keep_in_memory;
- }
-
- EvaluateExpressionOptions&
- SetKeepInMemory (bool keep = true)
- {
- m_keep_in_memory = keep;
- return *this;
- }
-
- lldb::DynamicValueType
- GetUseDynamic () const
- {
- return m_use_dynamic;
- }
-
- EvaluateExpressionOptions&
- SetUseDynamic (lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget)
- {
- m_use_dynamic = dynamic;
- return *this;
- }
-
- uint32_t
- GetSingleThreadTimeoutUsec () const
- {
- return m_single_thread_timeout_usec;
- }
-
- EvaluateExpressionOptions&
- SetSingleThreadTimeoutUsec (uint32_t timeout = 0)
- {
- m_single_thread_timeout_usec = timeout;
- return *this;
- }
-
- private:
- ExecutionPolicy m_execution_policy;
- bool m_coerce_to_id;
- bool m_unwind_on_error;
- bool m_keep_in_memory;
- lldb::DynamicValueType m_use_dynamic;
- uint32_t m_single_thread_timeout_usec;
- };
// 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/lldb/include/lldb/lldb-forward.h b/lldb/include/lldb/lldb-forward.h
index 84cecd184c5..c128de1dbca 100644
--- a/lldb/include/lldb/lldb-forward.h
+++ b/lldb/include/lldb/lldb-forward.h
@@ -98,6 +98,7 @@ class DynamicLibrary;
class DynamicLoader;
class EmulateInstruction;
class Error;
+class EvaluateExpressionOptions;
class Event;
class EventData;
class ExecutionContext;
OpenPOWER on IntegriCloud