summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Thread.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2012-09-27 01:15:29 +0000
committerJim Ingham <jingham@apple.com>2012-09-27 01:15:29 +0000
commit1f51e60b743fe3abadc79b280937554f90a1aadc (patch)
treec80070376163b486313847554c46050b0f334e2a /lldb/source/Target/Thread.cpp
parent5c8b1cd220ab92350de8245d75373a0e785a42fc (diff)
downloadbcm5719-llvm-1f51e60b743fe3abadc79b280937554f90a1aadc.tar.gz
bcm5719-llvm-1f51e60b743fe3abadc79b280937554f90a1aadc.zip
Implement returning integer values in "thread return" for arm, x86_64 and i386. Also returns
floats & doubles on x86_64. <rdar://problem/8356523> llvm-svn: 164741
Diffstat (limited to 'lldb/source/Target/Thread.cpp')
-rw-r--r--lldb/source/Target/Thread.cpp30
1 files changed, 27 insertions, 3 deletions
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 5cffe2d2624..ee3a8554da7 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -15,6 +15,7 @@
#include "lldb/Core/StreamString.h"
#include "lldb/Core/RegularExpression.h"
#include "lldb/Host/Host.h"
+#include "lldb/Symbol/Function.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
@@ -1313,14 +1314,37 @@ Thread::ReturnFromFrame (lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return
StackFrameSP older_frame_sp = thread->GetStackFrameAtIndex(older_frame_idx);
if (return_value_sp)
- {
- // TODO: coerce the return_value_sp to the type of the function in frame_sp.
-
+ {
lldb::ABISP abi = thread->GetProcess()->GetABI();
if (!abi)
{
return_error.SetErrorString("Could not find ABI to set return value.");
}
+ SymbolContext sc = frame_sp->GetSymbolContext(eSymbolContextFunction);
+
+ // FIXME: ValueObject::Cast doesn't currently work correctly, at least not for scalars.
+ // Turn that back on when that works.
+ if (0 && sc.function != NULL)
+ {
+ Type *function_type = sc.function->GetType();
+ if (function_type)
+ {
+ clang_type_t return_type = sc.function->GetReturnClangType();
+ if (return_type)
+ {
+ ClangASTType ast_type (function_type->GetClangAST(), return_type);
+ StreamString s;
+ ast_type.DumpTypeDescription(&s);
+ ValueObjectSP cast_value_sp = return_value_sp->Cast(ast_type);
+ if (cast_value_sp)
+ {
+ cast_value_sp->SetFormat(eFormatHex);
+ return_value_sp = cast_value_sp;
+ }
+ }
+ }
+ }
+
return_error = abi->SetReturnValueObject(older_frame_sp, return_value_sp);
if (!return_error.Success())
return return_error;
OpenPOWER on IntegriCloud