Rework breakpoint language filtering to use the symbol context's language.
This patch reworks the breakpoint filter-by-language patch to use the
symbol context instead of trying to guess the language solely from the
symbol's name. This has the advantage that symbols compiled with debug
info will have their actual language known. Symbols without debug info
will still do the same "guess"ing because Symbol::GetLanguage() is
implemented using Mangled::GuessLanguage(). The recognition of ObjC
names was merged into Mangled::GuessLanguage.
Reviewed by: jingham, clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D15326
llvm-svn: 255808
diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp
index 271732d..cf351ba 100644
--- a/lldb/source/Core/Mangled.cpp
+++ b/lldb/source/Core/Mangled.cpp
@@ -39,6 +39,7 @@
#include "lldb/Core/Stream.h"
#include "lldb/Core/Timer.h"
#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
+#include "Plugins/Language/ObjC/ObjCLanguage.h"
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
@@ -426,6 +427,14 @@
return m_mangled.MemorySize() + m_demangled.MemorySize();
}
+//----------------------------------------------------------------------
+// We "guess" the language because we can't determine a symbol's language
+// from it's name. For example, a Pascal symbol can be mangled using the
+// C++ Itanium scheme, and defined in a compilation unit within the same
+// module as other C++ units. In addition, different targets could have
+// different ways of mangling names from a given language, likewise the
+// compilation units within those targets.
+//----------------------------------------------------------------------
lldb::LanguageType
Mangled::GuessLanguage () const
{
@@ -434,11 +443,14 @@
{
if (GetDemangledName(lldb::eLanguageTypeUnknown))
{
- if (cstring_is_mangled(mangled.GetCString()))
+ const char *mangled_name = mangled.GetCString();
+ if (CPlusPlusLanguage::IsCPPMangledName(mangled_name))
return lldb::eLanguageTypeC_plus_plus;
+ else if (ObjCLanguage::IsPossibleObjCMethodName(mangled_name))
+ return lldb::eLanguageTypeObjC;
}
}
- return lldb::eLanguageTypeUnknown;
+ return lldb::eLanguageTypeUnknown;
}
//----------------------------------------------------------------------