From 73ca05a2a0c6ce957f9679e76b35ee06dc1559d4 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Sat, 17 Dec 2011 01:35:57 +0000 Subject: Add the ability to capture the return value in a thread's stop info, and print it as part of the thread format output. Currently this is only done for the ThreadPlanStepOut. Add a convenience API ABI::GetReturnValueObject. Change the ValueObject::EvaluationPoint to BE an ExecutionContextScope, rather than trying to hand out one of its subsidiary object's pointers. That way this will always be good. llvm-svn: 146806 --- lldb/source/Core/Debugger.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lldb/source/Core/Debugger.cpp') diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index cd86698661a..e33e9412c91 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -1701,6 +1701,23 @@ Debugger::FormatPrompt } } } + else if (::strncmp (var_name_begin, "return-value}", strlen("return-value}")) == 0) + { + StopInfoSP stop_info_sp = thread->GetStopInfo (); + if (stop_info_sp) + { + ValueObjectSP return_valobj_sp = StopInfo::GetReturnValueObject (stop_info_sp); + if (return_valobj_sp) + { + cstr = return_valobj_sp->GetValueAsCString (); + if (cstr && cstr[0]) + { + s.PutCString(cstr); + var_success = true; + } + } + } + } } } } @@ -2562,6 +2579,7 @@ Debugger::SettingsController::global_settings_table[] = MODULE_WITH_FUNC\ FILE_AND_LINE\ "{, stop reason = ${thread.stop-reason}}"\ + "{, return value = ${thread.return-value}}"\ "\\n" //#define DEFAULT_THREAD_FORMAT "thread #${thread.index}: tid = ${thread.id}"\ -- cgit v1.2.3