diff options
| author | Tamas Berghammer <tberghammer@google.com> | 2015-07-24 08:54:22 +0000 |
|---|---|---|
| committer | Tamas Berghammer <tberghammer@google.com> | 2015-07-24 08:54:22 +0000 |
| commit | 5aa27e1acca98e3f8f1cf2da47dc4b05297786c5 (patch) | |
| tree | faa29b128e2ec264942313fba1b9cd856b103c60 /lldb/source | |
| parent | 327675baa9bf1cd015c67f58dc52354dbe865529 (diff) | |
| download | bcm5719-llvm-5aa27e1acca98e3f8f1cf2da47dc4b05297786c5.tar.gz bcm5719-llvm-5aa27e1acca98e3f8f1cf2da47dc4b05297786c5.zip | |
Improve C++ function name handling and step-in avoid regerxp handling
If the function is a template then the return type is part of the
function name. This CL fixes the parsing of these function names in
the case when the return type contains ':'.
The name of free functions in C++ don't have context part. Fix the
logic geting the function name without arguments out from a full
function name to handle this case.
Change the handling of step-in-avoid-regexp to match the value against
the function name without it's arguments and return value. This is
required because the default regex ("^std::") would match any template
function returning an std object.
Fifferential revision: http://reviews.llvm.org/D11461
llvm-svn: 243099
Diffstat (limited to 'lldb/source')
| -rw-r--r-- | lldb/source/Core/Mangled.cpp | 7 | ||||
| -rw-r--r-- | lldb/source/Target/CPPLanguageRuntime.cpp | 17 | ||||
| -rw-r--r-- | lldb/source/Target/ThreadPlanStepInRange.cpp | 2 |
3 files changed, 12 insertions, 14 deletions
diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp index a1916fe913c..e1b0738ce4d 100644 --- a/lldb/source/Core/Mangled.cpp +++ b/lldb/source/Core/Mangled.cpp @@ -95,10 +95,11 @@ get_demangled_name_without_arguments (ConstString mangled, ConstString demangled mangled_name_cstr[2] != 'Z')) // named local entities (if we eventually handle eSymbolTypeData, we will want this back) { CPPLanguageRuntime::MethodName cxx_method (demangled); - if (!cxx_method.GetBasename().empty() && !cxx_method.GetContext().empty()) + if (!cxx_method.GetBasename().empty()) { - std::string shortname = cxx_method.GetContext().str(); - shortname += "::"; + std::string shortname; + if (!cxx_method.GetContext().empty()) + shortname = cxx_method.GetContext().str() + "::"; shortname += cxx_method.GetBasename().str(); ConstString result(shortname.c_str()); g_most_recent_mangled_to_name_sans_args.first = mangled; diff --git a/lldb/source/Target/CPPLanguageRuntime.cpp b/lldb/source/Target/CPPLanguageRuntime.cpp index f048c6706a9..98442c7ba80 100644 --- a/lldb/source/Target/CPPLanguageRuntime.cpp +++ b/lldb/source/Target/CPPLanguageRuntime.cpp @@ -306,17 +306,14 @@ CPPLanguageRuntime::MethodName::Parse() llvm::StringRef lt_gt("<>", 2); if (ReverseFindMatchingChars (full, lt_gt, template_start, template_end, basename_end)) { + // Check for templated functions that include return type like: 'void foo<Int>()' + context_start = full.rfind(' ', template_start); + if (context_start == llvm::StringRef::npos) + context_start = 0; + context_end = full.rfind(':', template_start); - if (context_end == llvm::StringRef::npos) - { - // Check for templated functions that include return type like: - // 'void foo<Int>()' - context_end = full.rfind(' ', template_start); - if (context_end != llvm::StringRef::npos) - { - context_start = context_end; - } - } + if (context_end == llvm::StringRef::npos || context_end < context_start) + context_end = context_start; } else { diff --git a/lldb/source/Target/ThreadPlanStepInRange.cpp b/lldb/source/Target/ThreadPlanStepInRange.cpp index b3c82499e5b..a7f5d6746be 100644 --- a/lldb/source/Target/ThreadPlanStepInRange.cpp +++ b/lldb/source/Target/ThreadPlanStepInRange.cpp @@ -375,7 +375,7 @@ ThreadPlanStepInRange::FrameMatchesAvoidCriteria () SymbolContext sc = frame->GetSymbolContext(eSymbolContextFunction|eSymbolContextBlock|eSymbolContextSymbol); if (sc.symbol != NULL) { - const char *frame_function_name = sc.GetFunctionName().GetCString(); + const char *frame_function_name = sc.GetFunctionName(Mangled::ePreferDemangledWithoutArguments).GetCString(); if (frame_function_name) { size_t num_matches = 0; |

