[Lldb-commits] [lldb] r148445 - in /lldb/trunk: include/lldb/Target/ObjCLanguageRuntime.h source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Symbol/Symtab.cpp source/Target/ObjCLanguageRuntime.cpp
Greg Clayton
gclayton at apple.com
Wed Jan 18 16:52:59 PST 2012
Author: gclayton
Date: Wed Jan 18 18:52:59 2012
New Revision: 148445
URL: http://llvm.org/viewvc/llvm-project?rev=148445&view=rev
Log:
Added an extra way to chop up an objective C prototype and use it where necessary.
Modified:
lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Symbol/Symtab.cpp
lldb/trunk/source/Target/ObjCLanguageRuntime.cpp
Modified: lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h?rev=148445&r1=148444&r2=148445&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h Wed Jan 18 18:52:59 2012
@@ -103,7 +103,11 @@
// sub-parts that are passed in non-NULL. The base_name means the name stripped of
// category attributes.
static bool
- ParseMethodName (const char *name, ConstString *class_name, ConstString *method_name, ConstString *base_name);
+ ParseMethodName (const char *name,
+ ConstString *class_name, // Class name (with category if there is one)
+ ConstString *selector_name, // selector only
+ ConstString *name_sans_category, // full function name with no category
+ ConstString *class_name_sans_category);// Class name without category (empty if no category)
static bool
IsPossibleObjCMethodName (const char *name)
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=148445&r1=148444&r2=148445&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Wed Jan 18 18:52:59 2012
@@ -737,12 +737,16 @@
ConstString objc_class_name;
ConstString objc_selector_name;
ConstString objc_fullname_no_category_name;
+ ConstString objc_class_name_no_category;
if (ObjCLanguageRuntime::ParseMethodName (name,
&objc_class_name,
&objc_selector_name,
- &objc_fullname_no_category_name))
+ &objc_fullname_no_category_name,
+ &objc_class_name_no_category))
{
objc_class_selectors.Insert(objc_class_name, die.GetOffset());
+ if (objc_class_name_no_category)
+ objc_class_selectors.Insert(objc_class_name_no_category, die.GetOffset());
func_selectors.Insert (objc_selector_name, die.GetOffset());
func_fullnames.Insert (ConstString(name), die.GetOffset());
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=148445&r1=148444&r2=148445&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Jan 18 18:52:59 2012
@@ -4898,17 +4898,14 @@
if (tag == DW_TAG_subprogram)
{
ConstString class_name;
-
- if (ObjCLanguageRuntime::ParseMethodName (type_name_cstr, &class_name, NULL, NULL))
+ if (ObjCLanguageRuntime::ParseMethodName (type_name_cstr, NULL, NULL, NULL, &class_name))
{
SymbolContext empty_sc;
clang_type_t class_opaque_type = NULL;
if (class_name)
{
TypeList types;
- TypeSP complete_objc_class_type_sp (FindCompleteObjCDefinitionTypeForDIE (NULL, class_name, true));
- if (!complete_objc_class_type_sp)
- complete_objc_class_type_sp = FindCompleteObjCDefinitionTypeForDIE (NULL, class_name, false);
+ TypeSP complete_objc_class_type_sp (FindCompleteObjCDefinitionTypeForDIE (NULL, class_name, false));
if (complete_objc_class_type_sp)
{
Modified: lldb/trunk/source/Symbol/Symtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=148445&r1=148444&r2=148445&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Symtab.cpp (original)
+++ lldb/trunk/source/Symbol/Symtab.cpp Wed Jan 18 18:52:59 2012
@@ -313,7 +313,8 @@
if (ObjCLanguageRuntime::ParseMethodName (entry.cstring,
NULL,
NULL,
- &objc_base_name)
+ &objc_base_name,
+ NULL)
&& !objc_base_name.IsEmpty())
{
entry.cstring = objc_base_name.GetCString();
Modified: lldb/trunk/source/Target/ObjCLanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ObjCLanguageRuntime.cpp?rev=148445&r1=148444&r2=148445&view=diff
==============================================================================
--- lldb/trunk/source/Target/ObjCLanguageRuntime.cpp (original)
+++ lldb/trunk/source/Target/ObjCLanguageRuntime.cpp Wed Jan 18 18:52:59 2012
@@ -103,13 +103,19 @@
bool
ObjCLanguageRuntime::ParseMethodName (const char *name,
- ConstString *class_name,
- ConstString *selector_name,
- ConstString *name_sans_category)
+ ConstString *class_name, // Class name (with category if any)
+ ConstString *selector_name, // selector on its own
+ ConstString *name_sans_category, // Full function prototype with no category
+ ConstString *class_name_sans_category)// Class name with no category (or empty if no category as answer will be in "class_name"
{
- if (class_name) { class_name->Clear(); }
- if (selector_name) { selector_name->Clear(); }
- if (name_sans_category) { name_sans_category->Clear(); }
+ if (class_name)
+ class_name->Clear();
+ if (selector_name)
+ selector_name->Clear();
+ if (name_sans_category)
+ name_sans_category->Clear();
+ if (class_name_sans_category)
+ class_name_sans_category->Clear();
if (IsPossibleObjCMethodName (name))
{
@@ -122,8 +128,7 @@
// "]" suffix
if (name_len >= 6 && name[name_len - 1] == ']')
{
- const char *selector_name_ptr;
- selector_name_ptr = strchr (name, ' ');
+ const char *selector_name_ptr = strchr (name, ' ');
if (selector_name_ptr)
{
if (class_name)
@@ -140,18 +145,21 @@
// Also see if this is a "category" on our class. If so strip off the category name,
// and add the class name without it to the basename table.
- if (name_sans_category)
+ if (name_sans_category || class_name_sans_category)
{
- const char *first_paren = (char *) memchr (name, '(', selector_name_ptr - name);
- if (first_paren)
+ const char *open_paren = strchr (name, '(');
+ const char *close_paren = NULL;
+ if (open_paren)
{
- const char *second_paren = (char *) memchr (first_paren, ')', selector_name_ptr - first_paren);
- if (second_paren)
+ if (class_name_sans_category)
+ class_name_sans_category->SetCStringWithLength (name + 2, open_paren - name - 2);
+ close_paren = strchr (name, ')');
+ if (close_paren)
{
- std::string buffer (name, first_paren - name);
- buffer.append (second_paren + 1);
+ std::string buffer (name, open_paren - name);
+ buffer.append (close_paren + 1);
name_sans_category->SetCString (buffer.c_str());
-
+
}
}
}
@@ -160,6 +168,5 @@
}
return false;
}
- else
- return false;
+ return false;
}
More information about the lldb-commits
mailing list