[Lldb-commits] [lldb] r118872 - in /lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime: AppleObjCRuntimeV1.cpp AppleObjCRuntimeV1.h AppleObjCRuntimeV2.cpp AppleObjCRuntimeV2.h
Sean Callanan
scallanan at apple.com
Thu Nov 11 17:41:35 PST 2010
Author: spyffe
Date: Thu Nov 11 19:41:35 2010
New Revision: 118872
URL: http://llvm.org/viewvc/llvm-project?rev=118872&view=rev
Log:
Removed redundant code for object introspection.
Modified:
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp?rev=118872&r1=118871&r2=118872&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp Thu Nov 11 19:41:35 2010
@@ -40,125 +40,6 @@
static const char *pluginDesc = "Apple Objective C Language Runtime - Version 1";
static const char *pluginShort = "language.apple.objc.v1";
-bool
-AppleObjCRuntimeV1::GetObjectDescription (Stream &str, ValueObject &object, ExecutionContextScope *exe_scope)
-{
-
- // ObjC objects can only be pointers:
- if (!object.IsPointerType())
- return NULL;
-
- // Make the argument list: we pass one arg, the address of our pointer, to the print function.
- Scalar scalar;
-
- if (!ClangASTType::GetValueAsScalar (object.GetClangAST(),
- object.GetClangType(),
- object.GetDataExtractor(),
- 0,
- object.GetByteSize(),
- scalar))
- return NULL;
-
- Value val(scalar);
- return GetObjectDescription(str, val, exe_scope);
-
-}
-bool
-AppleObjCRuntimeV1::GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope)
-{
- if (!m_read_objc_library)
- return false;
-
- ExecutionContext exe_ctx;
- exe_scope->CalculateExecutionContext(exe_ctx);
-
- if (!exe_ctx.process)
- return false;
-
- // We need other parts of the exe_ctx, but the processes have to match.
- assert (m_process == exe_ctx.process);
-
- // Get the function address for the print function.
- const Address *function_address = GetPrintForDebuggerAddr();
- if (!function_address)
- return false;
-
- if (value.GetClangType())
- {
- clang::QualType value_type = clang::QualType::getFromOpaquePtr (value.GetClangType());
- if (!value_type->isObjCObjectPointerType())
- {
- str.Printf ("Value doesn't point to an ObjC object.\n");
- return false;
- }
- }
- else
- {
- // If it is not a pointer, see if we can make it into a pointer.
- ClangASTContext *ast_context = exe_ctx.target->GetScratchClangASTContext();
- void *opaque_type_ptr = ast_context->GetBuiltInType_objc_id();
- if (opaque_type_ptr == NULL)
- opaque_type_ptr = ast_context->GetVoidPtrType(false);
- value.SetContext(Value::eContextTypeOpaqueClangQualType, opaque_type_ptr);
- }
-
- ValueList arg_value_list;
- arg_value_list.PushValue(value);
-
- // This is the return value:
- const char *target_triple = exe_ctx.process->GetTargetTriple().GetCString();
- ClangASTContext *ast_context = exe_ctx.target->GetScratchClangASTContext();
-
- void *return_qualtype = ast_context->GetCStringType(true);
- Value ret;
- ret.SetContext(Value::eContextTypeOpaqueClangQualType, return_qualtype);
-
- // Now we're ready to call the function:
- ClangFunction func(target_triple, ast_context, return_qualtype, *function_address, arg_value_list);
- StreamString error_stream;
-
- lldb::addr_t wrapper_struct_addr = LLDB_INVALID_ADDRESS;
- func.InsertFunction(exe_ctx, wrapper_struct_addr, error_stream);
-
- bool unwind_on_error = true;
- bool try_all_threads = true;
- bool stop_others = true;
-
- ClangFunction::ExecutionResults results
- = func.ExecuteFunction(exe_ctx, &wrapper_struct_addr, error_stream, stop_others, 1000, try_all_threads, unwind_on_error, ret);
- if (results != ClangFunction::eExecutionCompleted)
- {
- str.Printf("Error evaluating Print Object function: %d.\n", results);
- return false;
- }
-
- addr_t result_ptr = ret.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
-
- // FIXME: poor man's strcpy - we should have a "read memory as string interface...
-
- Error error;
- std::vector<char> desc;
- while (1)
- {
- char byte = '\0';
- if (exe_ctx.process->ReadMemory(result_ptr + desc.size(), &byte, 1, error) != 1)
- break;
-
- desc.push_back(byte);
-
- if (byte == '\0')
- break;
- }
-
- if (!desc.empty())
- {
- str.PutCString(&desc.front());
- return true;
- }
- return false;
-
-}
-
lldb::ValueObjectSP
AppleObjCRuntimeV1::GetDynamicValue (lldb::ValueObjectSP in_value, ExecutionContextScope *exe_scope)
{
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h?rev=118872&r1=118871&r2=118872&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h Thu Nov 11 19:41:35 2010
@@ -31,12 +31,6 @@
~AppleObjCRuntimeV1() { }
// These are generic runtime functions:
- virtual bool
- GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope);
-
- virtual bool
- GetObjectDescription (Stream &str, ValueObject &object, ExecutionContextScope *exe_scope);
-
virtual lldb::ValueObjectSP
GetDynamicValue (lldb::ValueObjectSP in_value, ExecutionContextScope *exe_scope);
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=118872&r1=118871&r2=118872&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Thu Nov 11 19:41:35 2010
@@ -46,126 +46,6 @@
m_has_object_getClass = (objc_module_sp->FindFirstSymbolWithNameAndType(ConstString("gdb_object_getClass")) != NULL);
}
-bool
-AppleObjCRuntimeV2::GetObjectDescription (Stream &str, ValueObject &object, ExecutionContextScope *exe_scope)
-{
-
- // ObjC objects can only be pointers:
- if (!object.IsPointerType())
- return NULL;
-
- // Make the argument list: we pass one arg, the address of our pointer, to the print function.
- Scalar scalar;
-
- if (!ClangASTType::GetValueAsScalar (object.GetClangAST(),
- object.GetClangType(),
- object.GetDataExtractor(),
- 0,
- object.GetByteSize(),
- scalar))
- return NULL;
-
- Value val(scalar);
- return GetObjectDescription(str, val, exe_scope);
-
-}
-bool
-AppleObjCRuntimeV2::GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope)
-{
- if (!m_read_objc_library)
- return false;
-
- ExecutionContext exe_ctx;
- exe_scope->CalculateExecutionContext(exe_ctx);
-
- if (!exe_ctx.process)
- return false;
-
- // We need other parts of the exe_ctx, but the processes have to match.
- assert (m_process == exe_ctx.process);
-
- // Get the function address for the print function.
- const Address *function_address = GetPrintForDebuggerAddr();
- if (!function_address)
- return false;
-
- if (value.GetClangType())
- {
- clang::QualType value_type = clang::QualType::getFromOpaquePtr (value.GetClangType());
- if (!value_type->isObjCObjectPointerType())
- {
- str.Printf ("Value doesn't point to an ObjC object.\n");
- return false;
- }
- }
- else
- {
- // If it is not a pointer, see if we can make it into a pointer.
- ClangASTContext *ast_context = exe_ctx.target->GetScratchClangASTContext();
- void *opaque_type_ptr = ast_context->GetBuiltInType_objc_id();
- if (opaque_type_ptr == NULL)
- opaque_type_ptr = ast_context->GetVoidPtrType(false);
- value.SetContext(Value::eContextTypeOpaqueClangQualType, opaque_type_ptr);
- }
-
- ValueList arg_value_list;
- arg_value_list.PushValue(value);
-
- // This is the return value:
- const char *target_triple = exe_ctx.process->GetTargetTriple().GetCString();
- ClangASTContext *ast_context = exe_ctx.target->GetScratchClangASTContext();
-
- void *return_qualtype = ast_context->GetCStringType(true);
- Value ret;
- ret.SetContext(Value::eContextTypeOpaqueClangQualType, return_qualtype);
-
- // Now we're ready to call the function:
- ClangFunction func(target_triple, ast_context, return_qualtype, *function_address, arg_value_list);
- StreamString error_stream;
-
- lldb::addr_t wrapper_struct_addr = LLDB_INVALID_ADDRESS;
- func.InsertFunction(exe_ctx, wrapper_struct_addr, error_stream);
-
- const bool stop_others = true;
- const bool try_all_threads = true;
- const bool discard_on_error = true;
-
- ClangFunction::ExecutionResults results
- = func.ExecuteFunction(exe_ctx, &wrapper_struct_addr, error_stream, stop_others, 1000,
- try_all_threads, discard_on_error, ret);
- if (results != ClangFunction::eExecutionCompleted)
- {
- str.Printf("Error evaluating Print Object function: %d.\n", results);
- return false;
- }
-
- addr_t result_ptr = ret.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
-
- // FIXME: poor man's strcpy - we should have a "read memory as string interface...
-
- Error error;
- std::vector<char> desc;
- while (1)
- {
- char byte = '\0';
- if (exe_ctx.process->ReadMemory(result_ptr + desc.size(), &byte, 1, error) != 1)
- break;
-
- desc.push_back(byte);
-
- if (byte == '\0')
- break;
- }
-
- if (!desc.empty())
- {
- str.PutCString(&desc.front());
- return true;
- }
- return false;
-
-}
-
lldb::ValueObjectSP
AppleObjCRuntimeV2::GetDynamicValue (lldb::ValueObjectSP in_value, ExecutionContextScope *exe_scope)
{
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h?rev=118872&r1=118871&r2=118872&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Thu Nov 11 19:41:35 2010
@@ -31,12 +31,6 @@
~AppleObjCRuntimeV2() { }
// These are generic runtime functions:
- virtual bool
- GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope);
-
- virtual bool
- GetObjectDescription (Stream &str, ValueObject &object, ExecutionContextScope *exe_scope);
-
virtual lldb::ValueObjectSP
GetDynamicValue (lldb::ValueObjectSP in_value, ExecutionContextScope *exe_scope);
More information about the lldb-commits
mailing list