summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-05-05 23:32:56 +0000
committerGreg Clayton <gclayton@apple.com>2011-05-05 23:32:56 +0000
commitb2dcc36c051daf1f2fbc39068ca3593849e845e8 (patch)
tree459d2e465400902388f32f456a5cc999b9ed3b07
parent3f620ed8abd5d90916a7247caa1d5507dcfab15f (diff)
downloadbcm5719-llvm-b2dcc36c051daf1f2fbc39068ca3593849e845e8.tar.gz
bcm5719-llvm-b2dcc36c051daf1f2fbc39068ca3593849e845e8.zip
Added the ability to cast pointer types to another type, no matter what the
ValueObject is, as long as the ValueObject that is being asked to be casted is a pointer itself. llvm-svn: 130966
-rw-r--r--lldb/include/lldb/Core/ValueObject.h8
-rw-r--r--lldb/source/Core/ValueObject.cpp43
2 files changed, 51 insertions, 0 deletions
diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h
index a40069d3d9b..a5d7a5c5f40 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -377,6 +377,14 @@ public:
virtual lldb::ValueObjectSP
AddressOf (Error &error);
+ virtual lldb::ValueObjectSP
+ CastPointerType (const char *name,
+ ClangASTType &ast_type);
+
+ virtual lldb::ValueObjectSP
+ CastPointerType (const char *name,
+ lldb::TypeSP &type_sp);
+
// The backing bits of this value object were updated, clear any value
// values, summaries or descriptions so we refetch them.
virtual void
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 819e67a1e9c..fd4f428ff2c 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -24,6 +24,7 @@
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Core/ValueObjectDynamicValue.h"
#include "lldb/Core/ValueObjectList.h"
+#include "lldb/Core/ValueObjectMemory.h"
#include "lldb/Host/Endian.h"
@@ -1498,6 +1499,48 @@ ValueObject::AddressOf (Error &error)
return m_addr_of_valobj_sp;
}
+
+lldb::ValueObjectSP
+ValueObject::CastPointerType (const char *name, ClangASTType &clang_ast_type)
+{
+ lldb::ValueObjectSP valobj_sp;
+ AddressType address_type;
+ const bool scalar_is_load_address = true;
+ lldb::addr_t ptr_value = GetPointerValue (address_type, scalar_is_load_address);
+
+ if (ptr_value != LLDB_INVALID_ADDRESS)
+ {
+ Address ptr_addr (NULL, ptr_value);
+
+ valobj_sp = ValueObjectMemory::Create (GetExecutionContextScope(),
+ name,
+ ptr_addr,
+ clang_ast_type);
+ }
+ return valobj_sp;
+}
+
+lldb::ValueObjectSP
+ValueObject::CastPointerType (const char *name, TypeSP &type_sp)
+{
+ lldb::ValueObjectSP valobj_sp;
+ AddressType address_type;
+ const bool scalar_is_load_address = true;
+ lldb::addr_t ptr_value = GetPointerValue (address_type, scalar_is_load_address);
+
+ if (ptr_value != LLDB_INVALID_ADDRESS)
+ {
+ Address ptr_addr (NULL, ptr_value);
+
+ valobj_sp = ValueObjectMemory::Create (GetExecutionContextScope(),
+ name,
+ ptr_addr,
+ type_sp);
+ }
+ return valobj_sp;
+}
+
+
ValueObject::EvaluationPoint::EvaluationPoint () :
m_thread_id (LLDB_INVALID_UID),
m_stop_id (0)
OpenPOWER on IntegriCloud