summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
Diffstat (limited to 'lldb')
-rw-r--r--lldb/include/lldb/API/SBThread.h3
-rw-r--r--lldb/scripts/interface/SBThread.i8
-rw-r--r--lldb/source/API/SBThread.cpp25
3 files changed, 36 insertions, 0 deletions
diff --git a/lldb/include/lldb/API/SBThread.h b/lldb/include/lldb/API/SBThread.h
index 37e60b007bd..c1ce216f9be 100644
--- a/lldb/include/lldb/API/SBThread.h
+++ b/lldb/include/lldb/API/SBThread.h
@@ -150,6 +150,9 @@ public:
SBError
ReturnFromFrame (SBFrame &frame, SBValue &return_value);
+ SBError
+ UnwindInnermostExpression();
+
//--------------------------------------------------------------------------
/// LLDB currently supports process centric debugging which means when any
/// thread in a process stops, all other threads are stopped. The Suspend()
diff --git a/lldb/scripts/interface/SBThread.i b/lldb/scripts/interface/SBThread.i
index 3dcb8484f02..082805f42fd 100644
--- a/lldb/scripts/interface/SBThread.i
+++ b/lldb/scripts/interface/SBThread.i
@@ -259,6 +259,14 @@ public:
SBError
ReturnFromFrame (SBFrame &frame, SBValue &return_value);
+ %feature("autodoc", "
+ Unwind the stack frames from the innermost expression evaluation.
+ This API is equivalent to 'thread return -x'.
+ ") UnwindInnermostExpression;
+
+ SBError
+ UnwindInnermostExpression();
+
%feature("docstring", "
//--------------------------------------------------------------------------
/// LLDB currently supports process centric debugging which means when any
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index 2b36e4dfae9..47cf80ef29c 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -1249,6 +1249,31 @@ SBThread::ReturnFromFrame (SBFrame &frame, SBValue &return_value)
return sb_error;
}
+SBError
+SBThread::UnwindInnermostExpression()
+{
+ SBError sb_error;
+
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
+ if (log)
+ log->Printf ("SBThread(%p)::UnwindExpressionEvaluation",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
+
+ if (exe_ctx.HasThreadScope())
+ {
+ Thread *thread = exe_ctx.GetThreadPtr();
+ sb_error.SetError (thread->UnwindInnermostExpression());
+ if (sb_error.Success())
+ thread->SetSelectedFrameByIndex(0, false);
+ }
+
+ return sb_error;
+
+}
bool
SBThread::Suspend()
OpenPOWER on IntegriCloud