[Lldb-commits] [lldb] r118488 - in /lldb/trunk/source: Expression/ClangExpressionDeclMap.cpp Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Greg Clayton
gclayton at apple.com
Mon Nov 8 20:42:43 PST 2010
Author: gclayton
Date: Mon Nov 8 22:42:43 2010
New Revision: 118488
URL: http://llvm.org/viewvc/llvm-project?rev=118488&view=rev
Log:
Fixed an issue in the DWARF parser that was causing forward declarations
to not get resolved.
Fixed the "void **isa_ptr" variable inside the objective C verifier to start
with a '$' character so we don't go looking for it in our program.
Moved the lookup for "$__lldb_class" into the part that knows we are looking
for internal types that start with a '$'.
Modified:
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=118488&r1=118487&r2=118488&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Mon Nov 8 22:42:43 2010
@@ -970,45 +970,6 @@
if (m_exe_ctx.frame == NULL)
return;
- static ConstString g_lldb_class_name ("$__lldb_class");
- if (name == g_lldb_class_name)
- {
- // Clang is looking for the type of "this"
-
- VariableList *vars = m_exe_ctx.frame->GetVariableList(false);
-
- if (!vars)
- return;
-
- lldb::VariableSP this_var = vars->FindVariable(ConstString("this"));
-
- if (!this_var)
- return;
-
- Type *this_type = this_var->GetType();
-
- if (!this_type)
- return;
-
- TypeFromUser this_user_type(this_type->GetClangType(),
- this_type->GetClangAST());
-
- m_object_pointer_type = this_user_type;
-
- void *pointer_target_type;
-
- if (!ClangASTContext::IsPointerType(this_user_type.GetOpaqueQualType(),
- &pointer_target_type))
- return;
-
- TypeFromUser class_user_type(pointer_target_type,
- this_type->GetClangAST());
-
- AddOneType(context, class_user_type, true);
-
- return;
- }
-
SymbolContextList sym_ctxs;
// Only look for functions by name out in our symbols if the function
@@ -1066,6 +1027,45 @@
}
else
{
+ static ConstString g_lldb_class_name ("$__lldb_class");
+ if (name == g_lldb_class_name)
+ {
+ // Clang is looking for the type of "this"
+
+ VariableList *vars = m_exe_ctx.frame->GetVariableList(false);
+
+ if (!vars)
+ return;
+
+ lldb::VariableSP this_var = vars->FindVariable(ConstString("this"));
+
+ if (!this_var)
+ return;
+
+ Type *this_type = this_var->GetType();
+
+ if (!this_type)
+ return;
+
+ TypeFromUser this_user_type(this_type->GetClangType(),
+ this_type->GetClangAST());
+
+ m_object_pointer_type = this_user_type;
+
+ void *pointer_target_type;
+
+ if (!ClangASTContext::IsPointerType(this_user_type.GetOpaqueQualType(),
+ &pointer_target_type))
+ return;
+
+ TypeFromUser class_user_type(pointer_target_type,
+ this_type->GetClangAST());
+
+ AddOneType(context, class_user_type, true);
+
+ return;
+ }
+
ClangExpressionVariable *pvar(m_persistent_vars->GetVariable(name));
if (pvar)
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=118488&r1=118487&r2=118488&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Mon Nov 8 22:42:43 2010
@@ -268,14 +268,14 @@
else
{
assert(snprintf(&buf->contents[0], sizeof(buf->contents),
- "extern \"C\" int gdb_class_getClass(void *); \n"
- "extern \"C\" void \n"
- "%s(void *$__lldb_arg_obj) \n"
- "{ \n"
- " void **isa_ptr = (void **)$__lldb_arg_obj; \n"
- " if (!isa_ptr || !gdb_class_getClass(*isa_ptr)) \n"
- " abort(); \n"
- "} \n",
+ "extern \"C\" int gdb_class_getClass(void *); \n"
+ "extern \"C\" void \n"
+ "%s(void *$__lldb_arg_obj) \n"
+ "{ \n"
+ " void **$isa_ptr = (void **)$__lldb_arg_obj; \n"
+ " if (!$isa_ptr || !gdb_class_getClass(*$isa_ptr)) \n"
+ " abort(); \n"
+ "} \n",
name) < sizeof(buf->contents));
}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=118488&r1=118487&r2=118488&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon Nov 8 22:42:43 2010
@@ -2857,27 +2857,27 @@
}
-// if (is_forward_declaration)
-// {
-// // We have a forward declaration to a type and we need
-// // to try and find a full declaration. We look in the
-// // current type index just in case we have a forward
-// // declaration followed by an actual declarations in the
-// // DWARF. If this fails, we need to look elsewhere...
-//
-// type_sp = FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str);
-//
-// if (!type_sp)
-// {
-// // We weren't able to find a full declaration in
-// // this DWARF, see if we have a declaration anywhere
-// // else...
-// if (m_debug_map_symfile)
-// type_sp = m_debug_map_symfile->FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str);
-// }
-// if (type_sp)
-// return type_sp;
-// }
+ if (is_forward_declaration)
+ {
+ // We have a forward declaration to a type and we need
+ // to try and find a full declaration. We look in the
+ // current type index just in case we have a forward
+ // declaration followed by an actual declarations in the
+ // DWARF. If this fails, we need to look elsewhere...
+
+ type_sp = FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str);
+
+ if (!type_sp)
+ {
+ // We weren't able to find a full declaration in
+ // this DWARF, see if we have a declaration anywhere
+ // else...
+ if (m_debug_map_symfile)
+ type_sp = m_debug_map_symfile->FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str);
+ }
+ if (type_sp)
+ return type_sp;
+ }
assert (tag_decl_kind != -1);
bool clang_type_was_created = false;
clang_type = m_forward_decl_die_to_clang_type.lookup (die);
More information about the lldb-commits
mailing list