diff options
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/Breakpoint/BreakpointResolverName.cpp | 23 | ||||
-rw-r--r-- | lldb/source/Core/RegularExpression.cpp | 69 | ||||
-rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp | 36 | ||||
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 26 | ||||
-rw-r--r-- | lldb/source/Symbol/Symtab.cpp | 20 | ||||
-rw-r--r-- | lldb/source/Target/ObjCLanguageRuntime.cpp | 425 |
7 files changed, 478 insertions, 123 deletions
diff --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp b/lldb/source/Breakpoint/BreakpointResolverName.cpp index cb5e4ee7da9..b20913ecc45 100644 --- a/lldb/source/Breakpoint/BreakpointResolverName.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp @@ -22,6 +22,7 @@ #include "lldb/Symbol/Function.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Target/ObjCLanguageRuntime.h" using namespace lldb; using namespace lldb_private; @@ -54,7 +55,12 @@ BreakpointResolverName::BreakpointResolverName } else { - m_func_names.push_back(ConstString(func_name)); + const bool append = true; + ObjCLanguageRuntime::MethodName objc_name(func_name, false); + if (objc_name.IsValid(false)) + objc_name.GetFullNames(m_func_names, append); + else + m_func_names.push_back(ConstString(func_name)); } } @@ -68,9 +74,14 @@ BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt, m_match_type (Breakpoint::Exact), m_skip_prologue (skip_prologue) { + const bool append = true; for (size_t i = 0; i < num_names; i++) { - m_func_names.push_back (ConstString (names[i])); + ObjCLanguageRuntime::MethodName objc_name(names[i], false); + if (objc_name.IsValid(false)) + objc_name.GetFullNames(m_func_names, append); + else + m_func_names.push_back (ConstString (names[i])); } } @@ -84,10 +95,14 @@ BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt, m_skip_prologue (skip_prologue) { size_t num_names = names.size(); - + const bool append = true; for (size_t i = 0; i < num_names; i++) { - m_func_names.push_back (ConstString (names[i].c_str())); + ObjCLanguageRuntime::MethodName objc_name(names[i].c_str(), false); + if (objc_name.IsValid(false)) + objc_name.GetFullNames(m_func_names, append); + else + m_func_names.push_back (ConstString (names[i].c_str())); } } diff --git a/lldb/source/Core/RegularExpression.cpp b/lldb/source/Core/RegularExpression.cpp index d98bf484abf..1f99bc745f8 100644 --- a/lldb/source/Core/RegularExpression.cpp +++ b/lldb/source/Core/RegularExpression.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "lldb/Core/RegularExpression.h" +#include "llvm/ADT/StringRef.h" #include <string.h> using namespace lldb_private; @@ -146,6 +147,34 @@ RegularExpression::Execute(const char* s, size_t num_matches, int execute_flags) } bool +RegularExpression::ExecuteThreadSafe (const char* s, llvm::StringRef *match_srefs, size_t count, int execute_flags) const +{ + bool success = false; + if (m_comp_err == 0) + { + std::vector<regmatch_t> matches; + + if (match_srefs && count > 0) + matches.resize(count + 1); + + success = ::regexec (&m_preg, + s, + matches.size(), + matches.data(), + execute_flags) == 0; + for (size_t i=0; i<count; ++i) + { + size_t match_idx = i+1; + if (success && matches[match_idx].rm_so < matches[match_idx].rm_eo) + match_srefs[i] = llvm::StringRef(s + matches[match_idx].rm_so, matches[match_idx].rm_eo - matches[match_idx].rm_so); + else + match_srefs[i] = llvm::StringRef(); + } + } + return success; +} + +bool RegularExpression::GetMatchAtIndex (const char* s, uint32_t idx, std::string& match_str) const { if (idx <= m_preg.re_nsub && idx < m_matches.size()) @@ -166,6 +195,46 @@ RegularExpression::GetMatchAtIndex (const char* s, uint32_t idx, std::string& ma return false; } +bool +RegularExpression::GetMatchAtIndex (const char* s, uint32_t idx, llvm::StringRef& match_str) const +{ + if (idx <= m_preg.re_nsub && idx < m_matches.size()) + { + if (m_matches[idx].rm_eo == m_matches[idx].rm_so) + { + // Matched the empty string... + match_str = llvm::StringRef(); + return true; + } + else if (m_matches[idx].rm_eo > m_matches[idx].rm_so) + { + match_str = llvm::StringRef (s + m_matches[idx].rm_so, m_matches[idx].rm_eo - m_matches[idx].rm_so); + return true; + } + } + return false; +} + +bool +RegularExpression::GetMatchSpanningIndices (const char* s, uint32_t idx1, uint32_t idx2, llvm::StringRef& match_str) const +{ + if (idx1 <= m_preg.re_nsub && idx1 < m_matches.size() && idx2 <= m_preg.re_nsub && idx2 < m_matches.size()) + { + if (m_matches[idx1].rm_so == m_matches[idx2].rm_eo) + { + // Matched the empty string... + match_str = llvm::StringRef(); + return true; + } + else if (m_matches[idx1].rm_so < m_matches[idx2].rm_eo) + { + match_str = llvm::StringRef (s + m_matches[idx1].rm_so, m_matches[idx2].rm_eo - m_matches[idx1].rm_so); + return true; + } + } + return false; +} + //---------------------------------------------------------------------- // Returns true if the regular expression compiled and is ready diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index e3da3a5526b..62c11974d9c 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -396,7 +396,7 @@ CommandInterpreter::LoadCommandDictionary () const char *break_regexes[][2] = {{"^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$", "breakpoint set --file '%1' --line %2"}, {"^([[:digit:]]+)[[:space:]]*$", "breakpoint set --line %1"}, {"^(0x[[:xdigit:]]+)[[:space:]]*$", "breakpoint set --address %1"}, - {"^[\"']?([-+]\\[.*\\])[\"']?[[:space:]]*$", "breakpoint set --name '%1'"}, + {"^[\"']?([-+]?\\[.*\\])[\"']?[[:space:]]*$", "breakpoint set --name '%1'"}, {"^(-.*)$", "breakpoint set %1"}, {"^(.*[^[:space:]])`(.*[^[:space:]])[[:space:]]*$", "breakpoint set --name '%2' --shlib '%1'"}, {"^(.*[^[:space:]])[[:space:]]*$", "breakpoint set --name '%1'"}}; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp index 5d93d194056..c4f87d98e74 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp @@ -764,28 +764,22 @@ DWARFCompileUnit::Index (const uint32_t cu_idx, { // Note, this check is also done in ParseMethodName, but since this is a hot loop, we do the // simple inlined check outside the call. - if (ObjCLanguageRuntime::IsPossibleObjCMethodName(name)) + ObjCLanguageRuntime::MethodName objc_method(name, true); + if (objc_method.IsValid(true)) { - 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_class_name_no_category)) - { - func_fullnames.Insert (ConstString(name), die.GetOffset()); - if (objc_class_name) - 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()); - if (objc_selector_name) - func_selectors.Insert (objc_selector_name, die.GetOffset()); - if (objc_fullname_no_category_name) - func_fullnames.Insert (objc_fullname_no_category_name, die.GetOffset()); - } + ConstString objc_class_name_with_category (objc_method.GetClassNameWithCategory()); + ConstString objc_selector_name (objc_method.GetSelector()); + ConstString objc_fullname_no_category_name (objc_method.GetFullNameWithoutCategory(true)); + ConstString objc_class_name_no_category (objc_method.GetClassName()); + func_fullnames.Insert (ConstString(name), die.GetOffset()); + if (objc_class_name_with_category) + objc_class_selectors.Insert(objc_class_name_with_category, die.GetOffset()); + if (objc_class_name_no_category && objc_class_name_no_category != objc_class_name_with_category) + objc_class_selectors.Insert(objc_class_name_no_category, die.GetOffset()); + if (objc_selector_name) + func_selectors.Insert (objc_selector_name, die.GetOffset()); + if (objc_fullname_no_category_name) + func_fullnames.Insert (objc_fullname_no_category_name, die.GetOffset()); } // If we have a mangled name, then the DW_AT_name attribute // is usually the method name without the class or any parameters diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 32a98cc185b..a2863a9cab6 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1715,22 +1715,14 @@ SymbolFileDWARF::ParseChildMembers if (prop_getter_name && prop_getter_name[0] == '-') { - ObjCLanguageRuntime::ParseMethodName (prop_getter_name, - NULL, - &fixed_getter, - NULL, - NULL); - prop_getter_name = fixed_getter.GetCString(); + ObjCLanguageRuntime::MethodName prop_getter_method(prop_getter_name, true); + prop_getter_name = prop_getter_method.GetSelector().GetCString(); } if (prop_setter_name && prop_setter_name[0] == '-') { - ObjCLanguageRuntime::ParseMethodName (prop_setter_name, - NULL, - &fixed_setter, - NULL, - NULL); - prop_setter_name = fixed_setter.GetCString(); + ObjCLanguageRuntime::MethodName prop_setter_method(prop_setter_name, true); + prop_setter_name = prop_setter_method.GetSelector().GetCString(); } // If the names haven't been provided, they need to be @@ -6281,16 +6273,12 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, bool type_handled = false; if (tag == DW_TAG_subprogram) { - ConstString class_name; - ConstString class_name_no_category; - if (ObjCLanguageRuntime::ParseMethodName (type_name_cstr, &class_name, NULL, NULL, &class_name_no_category)) + ObjCLanguageRuntime::MethodName objc_method (type_name_cstr, true); + if (objc_method.IsValid(true)) { - // Use the class name with no category if there is one - if (class_name_no_category) - class_name = class_name_no_category; - SymbolContext empty_sc; clang_type_t class_opaque_type = NULL; + ConstString class_name(objc_method.GetClassName()); if (class_name) { TypeList types; diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp index 737527d9a07..ee660fb733d 100644 --- a/lldb/source/Symbol/Symtab.cpp +++ b/lldb/source/Symbol/Symtab.cpp @@ -310,18 +310,18 @@ Symtab::InitNameIndexes() // If the demangled name turns out to be an ObjC name, and // is a category name, add the version without categories to the index too. - ConstString objc_selector_name; - ConstString objc_base_name; - if (ObjCLanguageRuntime::ParseMethodName (entry.cstring, - NULL, - &objc_selector_name, - &objc_base_name, - NULL)) + ObjCLanguageRuntime::MethodName objc_method (entry.cstring, true); + if (objc_method.IsValid(true)) { - entry.cstring = objc_base_name.GetCString(); - m_name_to_index.Append (entry); - entry.cstring = objc_selector_name.GetCString(); + entry.cstring = objc_method.GetSelector().GetCString(); m_selector_to_index.Append (entry); + + ConstString objc_method_no_category (objc_method.GetFullNameWithoutCategory(true)); + if (objc_method_no_category) + { + entry.cstring = objc_method_no_category.GetCString(); + m_name_to_index.Append (entry); + } } } diff --git a/lldb/source/Target/ObjCLanguageRuntime.cpp b/lldb/source/Target/ObjCLanguageRuntime.cpp index fa80e0951e9..a567a8802af 100644 --- a/lldb/source/Target/ObjCLanguageRuntime.cpp +++ b/lldb/source/Target/ObjCLanguageRuntime.cpp @@ -11,6 +11,7 @@ #include "lldb/Core/Log.h" #include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" +#include "lldb/Core/Timer.h" #include "lldb/Core/ValueObject.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/Type.h" @@ -18,6 +19,8 @@ #include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Target.h" +#include "llvm/ADT/StringRef.h" + using namespace lldb; using namespace lldb_private; @@ -131,89 +134,375 @@ ObjCLanguageRuntime::GetByteOffsetForIvar (ClangASTType &parent_qual_type, const return LLDB_INVALID_IVAR_OFFSET; } +void +ObjCLanguageRuntime::MethodName::Clear() +{ + m_full.Clear(); + m_class.Clear(); + m_category.Clear(); + m_selector.Clear(); + m_type = eTypeUnspecified; + m_category_is_valid = false; +} + +//bool +//ObjCLanguageRuntime::MethodName::SetName (const char *name, bool strict) +//{ +// Clear(); +// if (name && name[0]) +// { +// // If "strict" is true. then the method must be specified with a +// // '+' or '-' at the beginning. If "strict" is false, then the '+' +// // or '-' can be omitted +// bool valid_prefix = false; +// +// if (name[0] == '+' || name[0] == '-') +// { +// valid_prefix = name[1] == '['; +// } +// else if (!strict) +// { +// // "strict" is false, the name just needs to start with '[' +// valid_prefix = name[0] == '['; +// } +// +// if (valid_prefix) +// { +// static RegularExpression g_regex("^([-+]?)\\[([A-Za-z_][A-Za-z_0-9]*)(\\([A-Za-z_][A-Za-z_0-9]*\\))? ([A-Za-z_][A-Za-z_0-9:]*)\\]$"); +// llvm::StringRef matches[4]; +// // Since we are using a global regular expression, we must use the threadsafe version of execute +// if (g_regex.ExecuteThreadSafe(name, matches, 4)) +// { +// m_full.SetCString(name); +// if (matches[0].empty()) +// m_type = eTypeUnspecified; +// else if (matches[0][0] == '+') +// m_type = eTypeClassMethod; +// else +// m_type = eTypeInstanceMethod; +// m_class.SetString(matches[1]); +// m_selector.SetString(matches[3]); +// if (!matches[2].empty()) +// m_category.SetString(matches[2]); +// } +// } +// } +// return IsValid(strict); +//} -uint32_t -ObjCLanguageRuntime::ParseMethodName (const char *name, - 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" +bool +ObjCLanguageRuntime::MethodName::SetName (const char *name, bool strict) { - 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(); - - uint32_t result = 0; + Clear(); + if (name && name[0]) + { + // If "strict" is true. then the method must be specified with a + // '+' or '-' at the beginning. If "strict" is false, then the '+' + // or '-' can be omitted + bool valid_prefix = false; + + if (name[0] == '+' || name[0] == '-') + { + valid_prefix = name[1] == '['; + if (name[0] == '+') + m_type = eTypeClassMethod; + else + m_type = eTypeInstanceMethod; + } + else if (!strict) + { + // "strict" is false, the name just needs to start with '[' + valid_prefix = name[0] == '['; + } + + if (valid_prefix) + { + int name_len = strlen (name); + // Objective C methods must have at least: + // "-[" or "+[" prefix + // One character for a class name + // One character for the space between the class name + // One character for the method name + // "]" suffix + if (name_len >= (5 + (strict ? 1 : 0)) && name[name_len - 1] == ']') + { + m_full.SetCStringWithLength(name, name_len); + } + } + } + return IsValid(strict); +} - if (IsPossibleObjCMethodName (name)) +const ConstString & +ObjCLanguageRuntime::MethodName::GetClassName () +{ + if (!m_class) { - int name_len = strlen (name); - // Objective C methods must have at least: - // "-[" or "+[" prefix - // One character for a class name - // One character for the space between the class name - // One character for the method name - // "]" suffix - if (name_len >= 6 && name[name_len - 1] == ']') + if (IsValid(false)) { - const char *selector_name_ptr = strchr (name, ' '); - if (selector_name_ptr) + const char *full = m_full.GetCString(); + const char *class_start = (full[0] == '[' ? full + 1 : full + 2); + const char *paren_pos = strchr (class_start, '('); + if (paren_pos) { - if (class_name) - { - class_name->SetCStringWithLength (name + 2, selector_name_ptr - name - 2); - ++result; - } - - // Skip the space - ++selector_name_ptr; - // Extract the objective C basename and add it to the - // accelerator tables - size_t selector_name_len = name_len - (selector_name_ptr - name) - 1; - if (selector_name) - { - selector_name->SetCStringWithLength (selector_name_ptr, selector_name_len); - ++result; - } - - // 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 || class_name_sans_category) + m_class.SetCStringWithLength (class_start, paren_pos - class_start); + } + else + { + // No '(' was found in the full name, we can definitively say + // that our category was valid (and empty). + m_category_is_valid = true; + const char *space_pos = strchr (full, ' '); + if (space_pos) { - const char *open_paren = strchr (name, '('); - if (open_paren) + m_class.SetCStringWithLength (class_start, space_pos - class_start); + if (!m_class_category) { - if (class_name_sans_category) - { - class_name_sans_category->SetCStringWithLength (name + 2, open_paren - name - 2); - ++result; - } - - if (name_sans_category) - { - const char *close_paren = strchr (open_paren, ')'); - if (open_paren < close_paren) - { - std::string buffer (name, open_paren - name); - buffer.append (close_paren + 1); - name_sans_category->SetCString (buffer.c_str()); - ++result; - } - } + // No category in name, so we can also fill in the m_class_category + m_class_category = m_class; } } } } } - return result; + return m_class; +} + +const ConstString & +ObjCLanguageRuntime::MethodName::GetClassNameWithCategory () +{ + if (!m_class_category) + { + if (IsValid(false)) + { + const char *full = m_full.GetCString(); + const char *class_start = (full[0] == '[' ? full + 1 : full + 2); + const char *space_pos = strchr (full, ' '); + if (space_pos) + { + m_class_category.SetCStringWithLength (class_start, space_pos - class_start); + // If m_class hasn't been filled in and the class with category doesn't + // contain a '(', then we can also fill in the m_class + if (!m_class && strchr (m_class_category.GetCString(), '(') == NULL) + { + m_class = m_class_category; + // No '(' was found in the full name, we can definitively say + // that our category was valid (and empty). + m_category_is_valid = true; + + } + } + } + } + return m_class_category; +} + +const ConstString & +ObjCLanguageRuntime::MethodName::GetSelector () +{ + if (!m_selector) + { + if (IsValid(false)) + { + const char *full = m_full.GetCString(); + const char *space_pos = strchr (full, ' '); + if (space_pos) + { + ++space_pos; // skip the space + m_selector.SetCStringWithLength (space_pos, m_full.GetLength() - (space_pos - full) - 1); + } + } + } + return m_selector; } +const ConstString & +ObjCLanguageRuntime::MethodName::GetCategory () +{ + if (!m_category_is_valid && !m_category) + { + if (IsValid(false)) + { + m_category_is_valid = true; + const char *full = m_full.GetCString(); + const char *class_start = (full[0] == '[' ? full + 1 : full + 2); + const char *open_paren_pos = strchr (class_start, '('); + if (open_paren_pos) + { + ++open_paren_pos; // Skip the open paren + const char *close_paren_pos = strchr (open_paren_pos, ')'); + if (close_paren_pos) + m_category.SetCStringWithLength (open_paren_pos, close_paren_pos - open_paren_pos); + } + } + } + return m_category; +} + +ConstString +ObjCLanguageRuntime::MethodName::GetFullNameWithoutCategory (bool empty_if_no_category) +{ + if (IsValid(false)) + { + if (HasCategory()) + { + StreamString strm; + if (m_type == eTypeClassMethod) + strm.PutChar('+'); + else if (m_type == eTypeInstanceMethod) + strm.PutChar('-'); + strm.Printf("[%s %s]", GetClassName().GetCString(), GetSelector().GetCString()); + return ConstString(strm.GetString().c_str()); + } + + if (!empty_if_no_category) + { + // Just return the full name since it doesn't have a category + return GetFullName(); + } + } + return ConstString(); +} + +size_t +ObjCLanguageRuntime::MethodName::GetFullNames (std::vector<ConstString> &names, bool append) +{ + if (!append) + names.clear(); + if (IsValid(false)) + { + StreamString strm; + const bool is_class_method = m_type == eTypeClassMethod; + const bool is_instance_method = m_type == eTypeInstanceMethod; + const ConstString &category = GetCategory(); + if (is_class_method || is_instance_method) + { + names.push_back (m_full); + if (category) + { + strm.Printf("%c[%s %s]", + is_class_method ? '+' : '-', + GetClassName().GetCString(), + GetSelector().GetCString()); + names.push_back(ConstString(strm.GetString().c_str())); + } + } + else + { + const ConstString &class_name = GetClassName(); + const ConstString &selector = GetSelector(); + strm.Printf("+[%s %s]", class_name.GetCString(), selector.GetCString()); + names.push_back(ConstString(strm.GetString().c_str())); + strm.Clear(); + strm.Printf("-[%s %s]", class_name.GetCString(), selector.GetCString()); + names.push_back(ConstString(strm.GetString().c_str())); + strm.Clear(); + if (category) + { + strm.Printf("+[%s(%s) %s]", class_name.GetCString(), category.GetCString(), selector.GetCString()); + names.push_back(ConstString(strm.GetString().c_str())); + strm.Clear(); + strm.Printf("-[%s(%s) %s]", class_name.GetCString(), category.GetCString(), selector.GetCString()); + names.push_back(ConstString(strm.GetString().c_str())); + } + } + } + return names.size(); +} + + +//uint32_t +//ObjCLanguageRuntime::ParseMethodName (const char *name, +// 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" +//{ +// static ScopedTimerAggregator g_scoped_timer_aggregator ("ObjCLanguageRuntime::ParseMethodName"); +// ScopedTimer scoped_timer; +// uint32_t result = 0; +// 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)) +// { +// int name_len = strlen (name); +// // Objective C methods must have at least: +// // "-[" or "+[" prefix +// // One character for a class name +// // One character for the space between the class name +// // One character for the method name +// // "]" suffix +// if (name_len >= 6 && name[name_len - 1] == ']') +// { +// const char *selector_name_ptr = strchr (name, ' '); +// if (selector_name_ptr) +// { +// if (class_name) +// { +// class_name->SetCStringWithLength (name + 2, selector_name_ptr - name - 2); +// ++result; +// } +// +// // Skip the space +// ++selector_name_ptr; +// // Extract the objective C basename and add it to the +// // accelerator tables +// size_t selector_name_len = name_len - (selector_name_ptr - name) - 1; +// if (selector_name) +// { +// selector_name->SetCStringWithLength (selector_name_ptr, selector_name_len); +// ++result; +// } +// +// // 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 || class_name_sans_category) +// { +// const char *open_paren = strchr (name, '('); +// if (open_paren) +// { +// if (class_name_sans_category) +// { +// class_name_sans_category->SetCStringWithLength (name + 2, open_paren - name - 2); +// ++result; +// } +// +// if (name_sans_category) +// { +// const char *close_paren = strchr (open_paren, ')'); +// if (open_paren < close_paren) +// { +// std::string buffer (name, open_paren - name); +// buffer.append (close_paren + 1); +// name_sans_category->SetCString (buffer.c_str()); +// ++result; +// } +// } +// } +// } +// } +// } +// } +// ObjCLanguageRuntime::MethodName method_name(name, true); +// if (class_name) +// assert (*class_name == method_name.GetClassNameWithCategory()); +// if (selector_name) +// assert (*selector_name == method_name.GetSelector()); +// if (class_name_sans_category) +// assert (*class_name_sans_category == method_name.GetClassName()); +// g_scoped_timer_aggregator.Aggregate (scoped_timer); +// return result; +//} + bool ObjCLanguageRuntime::ClassDescriptor::IsPointerValid (lldb::addr_t value, uint32_t ptr_size, |