diff options
author | Jim Ingham <jingham@apple.com> | 2016-07-08 02:12:05 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2016-07-08 02:12:05 +0000 |
commit | 4ac8e93a4e45d89f8416d48d21712e6393b1093b (patch) | |
tree | 7e819cd5477c3a15f4c22f2d1c6cf3d6380162d1 /lldb/source/API/SBThread.cpp | |
parent | 0160063aeb3197be08b3e52a4adfb692ce6f3e57 (diff) | |
download | bcm5719-llvm-4ac8e93a4e45d89f8416d48d21712e6393b1093b.tar.gz bcm5719-llvm-4ac8e93a4e45d89f8416d48d21712e6393b1093b.zip |
Add an API to unwind from a hand-called expression.
This is just an SB API way of doing "thread return -x".
<rdar://problem/27110360>
llvm-svn: 274822
Diffstat (limited to 'lldb/source/API/SBThread.cpp')
-rw-r--r-- | lldb/source/API/SBThread.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
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() |