diff options
author | Jim Ingham <jingham@apple.com> | 2012-10-16 21:41:58 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2012-10-16 21:41:58 +0000 |
commit | 35e1bda6957bb7e5d26f6a50e473ca3aa22a1386 (patch) | |
tree | 8ae0c9392cf55fc5c112148231d78729935de8e9 /lldb/scripts/Python | |
parent | 02a1141e5a36928f7a0ac9d2e0ee44dca3be3a01 (diff) | |
download | bcm5719-llvm-35e1bda6957bb7e5d26f6a50e473ca3aa22a1386.tar.gz bcm5719-llvm-35e1bda6957bb7e5d26f6a50e473ca3aa22a1386.zip |
Add the ability to set timeout & "run all threads" options both from the "expr" command and from
the SB API's that evaluate expressions.
<rdar://problem/12457211>
llvm-svn: 166062
Diffstat (limited to 'lldb/scripts/Python')
-rwxr-xr-x | lldb/scripts/Python/build-swig-Python.sh | 2 | ||||
-rw-r--r-- | lldb/scripts/Python/interface/SBExpressionOptions.i | 104 | ||||
-rw-r--r-- | lldb/scripts/Python/interface/SBFrame.i | 3 | ||||
-rw-r--r-- | lldb/scripts/Python/interface/SBValue.i | 3 |
4 files changed, 112 insertions, 0 deletions
diff --git a/lldb/scripts/Python/build-swig-Python.sh b/lldb/scripts/Python/build-swig-Python.sh index a38d2ff91f4..59394f9cc0e 100755 --- a/lldb/scripts/Python/build-swig-Python.sh +++ b/lldb/scripts/Python/build-swig-Python.sh @@ -76,6 +76,7 @@ HEADER_FILES="${SRC_ROOT}/include/lldb/lldb.h"\ " ${SRC_ROOT}/include/lldb/API/SBDebugger.h"\ " ${SRC_ROOT}/include/lldb/API/SBError.h"\ " ${SRC_ROOT}/include/lldb/API/SBEvent.h"\ +" ${SRC_ROOT}/include/lldb/API/SBExpressionOptions.h"\ " ${SRC_ROOT}/include/lldb/API/SBFileSpec.h"\ " ${SRC_ROOT}/include/lldb/API/SBFrame.h"\ " ${SRC_ROOT}/include/lldb/API/SBFunction.h"\ @@ -120,6 +121,7 @@ INTERFACE_FILES="${SRC_ROOT}/scripts/Python/interface/SBAddress.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBDeclaration.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBError.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBEvent.i"\ +" ${SRC_ROOT}/scripts/Python/interface/SBExpressionOptions.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBFileSpec.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBFrame.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBFunction.i"\ diff --git a/lldb/scripts/Python/interface/SBExpressionOptions.i b/lldb/scripts/Python/interface/SBExpressionOptions.i new file mode 100644 index 00000000000..fa58fe36896 --- /dev/null +++ b/lldb/scripts/Python/interface/SBExpressionOptions.i @@ -0,0 +1,104 @@ +//===-- SWIG interface for SBExpressionOptions -----------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +namespace lldb { + +%feature("docstring", +"A container for options to use when evaluating expressions." +) SBExpressionOptions; + +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(); + + bool + DoesCoerceToId () const; + + %feature("docstring", + "Sets whether to coerce the expression result to ObjC id type after evaluation." + ) SetCoerceToId; + void + SetCoerceToId (bool coerce = true); + + bool + DoesUnwindOnError () const; + + %feature("docstring", + "Sets whether to unwind the expression stack on error." + ) SetUnwindOnError; + void + SetUnwindOnError (bool unwind = false); + + bool + DoesKeepInMemory () const; + + %feature("docstring", + "Sets whether to keep the expression result in the target program's memory - forced to true when creating SBValues." + ) SetKeepInMemory; + void + SetKeepInMemory (bool keep = true); + + lldb::DynamicValueType + GetUseDynamic () const; + + %feature("docstring", + "Sets whether to cast the expression result to its dynamic type." + ) SetUseDynamic; + void + SetUseDynamic (lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget); + + uint32_t + GetTimeoutUsec () const; + + %feature("docstring", + "Sets the duration we will wait before cancelling expression evaluation. 0 means wait forever." + ) SetTimeoutUsec; + void + SetTimeoutUsec (uint32_t timeout = 0); + + bool + GetRunOthers () const; + + %feature("docstring", + "Sets whether to run all threads if the expression does not complete on one thread." + ) SetRunOthers; + 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 diff --git a/lldb/scripts/Python/interface/SBFrame.i b/lldb/scripts/Python/interface/SBFrame.i index 7d025644288..1735dd99472 100644 --- a/lldb/scripts/Python/interface/SBFrame.i +++ b/lldb/scripts/Python/interface/SBFrame.i @@ -139,6 +139,9 @@ public: lldb::SBValue EvaluateExpression (const char *expr, lldb::DynamicValueType use_dynamic, bool unwind_on_error); + + lldb::SBValue + EvaluateExpression (const char *expr, SBExpressionOptions &options); %feature("docstring", " /// Gets the lexical block that defines the stack frame. Another way to think diff --git a/lldb/scripts/Python/interface/SBValue.i b/lldb/scripts/Python/interface/SBValue.i index e316637f9e6..70c3d807453 100644 --- a/lldb/scripts/Python/interface/SBValue.i +++ b/lldb/scripts/Python/interface/SBValue.i @@ -222,6 +222,9 @@ public: lldb::SBValue 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); |