summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2015-07-08 22:32:23 +0000
committerGreg Clayton <gclayton@apple.com>2015-07-08 22:32:23 +0000
commit10b2ee9dff75c62fb4b3abf59a0f2bf7b855afdb (patch)
treed341b0b4f551f36556204065a87736411dfc6d5d
parent459f92e4686fad5aadd916b4debbb6a7d8d4d0df (diff)
Make many mangled functions that might demangle a name be allowed to specify a language to use in order to soon support Pascal and Java demangling. Dawn Perchik will take care of making this so.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@241751 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/lldb/Core/Mangled.h14
-rw-r--r--include/lldb/Symbol/Function.h22
-rw-r--r--include/lldb/Symbol/Symbol.h17
-rw-r--r--include/lldb/Symbol/Variable.h12
-rw-r--r--source/API/SBBlock.cpp10
-rw-r--r--source/API/SBFrame.cpp4
-rw-r--r--source/API/SBFunction.cpp4
-rw-r--r--source/API/SBSymbol.cpp4
-rw-r--r--source/Breakpoint/BreakpointLocation.cpp4
-rw-r--r--source/Core/FormatEntity.cpp8
-rw-r--r--source/Core/Mangled.cpp42
-rw-r--r--source/Expression/IRExecutionUnit.cpp2
-rw-r--r--source/Expression/IRForTarget.cpp4
-rw-r--r--source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp2
-rw-r--r--source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp4
-rw-r--r--source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp2
-rw-r--r--source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp2
-rw-r--r--source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp5
-rw-r--r--source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp10
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp16
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp5
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp4
-rw-r--r--source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp2
-rw-r--r--source/Symbol/Function.cpp45
-rw-r--r--source/Symbol/Symbol.cpp28
-rw-r--r--source/Symbol/SymbolContext.cpp36
-rw-r--r--source/Symbol/Symtab.cpp12
-rw-r--r--source/Symbol/Variable.cpp40
-rw-r--r--source/Target/ThreadPlanStepOverRange.cpp2
29 files changed, 225 insertions, 137 deletions
diff --git a/include/lldb/Core/Mangled.h b/include/lldb/Core/Mangled.h
index 53645bc8d..6d8d8c4a0 100644
--- a/include/lldb/Core/Mangled.h
+++ b/include/lldb/Core/Mangled.h
@@ -182,7 +182,7 @@ public:
/// A const reference to the demangled name string object.
//----------------------------------------------------------------------
const ConstString&
- GetDemangledName () const;
+ GetDemangledName (lldb::LanguageType language) const;
//----------------------------------------------------------------------
/// Display demangled name get accessor.
@@ -191,7 +191,7 @@ public:
/// A const reference to the display demangled name string object.
//----------------------------------------------------------------------
ConstString
- GetDisplayDemangledName () const;
+ GetDisplayDemangledName (lldb::LanguageType language) const;
void
SetDemangledName (const ConstString &name)
@@ -240,8 +240,8 @@ public:
/// object has a valid name of that kind, else a const reference to the
/// other name is returned.
//----------------------------------------------------------------------
- const ConstString&
- GetName (NamePreference preference = ePreferDemangled) const;
+ ConstString
+ GetName (lldb::LanguageType language, NamePreference preference = ePreferDemangled) const;
//----------------------------------------------------------------------
/// Check if "name" matches either the mangled or demangled name.
@@ -253,15 +253,15 @@ public:
/// \b True if \a name matches either name, \b false otherwise.
//----------------------------------------------------------------------
bool
- NameMatches (const ConstString &name) const
+ NameMatches (const ConstString &name, lldb::LanguageType language) const
{
if (m_mangled == name)
return true;
- return GetDemangledName () == name;
+ return GetDemangledName (language) == name;
}
bool
- NameMatches (const RegularExpression& regex) const;
+ NameMatches (const RegularExpression& regex, lldb::LanguageType language) const;
//----------------------------------------------------------------------
/// Get the memory cost of this object.
diff --git a/include/lldb/Symbol/Function.h b/include/lldb/Symbol/Function.h
index 602982838..30c8f168e 100644
--- a/include/lldb/Symbol/Function.h
+++ b/include/lldb/Symbol/Function.h
@@ -123,7 +123,7 @@ public:
/// @return
/// A const reference to the method name object.
//------------------------------------------------------------------
- const ConstString&
+ ConstString
GetName () const;
//------------------------------------------------------------------
@@ -240,13 +240,13 @@ public:
Dump(Stream *s, bool show_fullpaths) const;
void
- DumpStopContext (Stream *s) const;
+ DumpStopContext (Stream *s, lldb::LanguageType language) const;
- const ConstString &
- GetName () const;
+ ConstString
+ GetName (lldb::LanguageType language) const;
ConstString
- GetDisplayName () const;
+ GetDisplayName (lldb::LanguageType language) const;
//------------------------------------------------------------------
/// Get accessor for the call site declaration information.
@@ -440,6 +440,8 @@ public:
return m_range;
}
+ lldb::LanguageType
+ GetLanguage() const;
//------------------------------------------------------------------
/// Find the file and line number of the source location of the start
/// of the function. This will use the declaration if present and fall
@@ -527,11 +529,11 @@ public:
return m_frame_base;
}
- const ConstString &
- GetName() const
- {
- return m_mangled.GetName();
- }
+ ConstString
+ GetName() const;
+
+ ConstString
+ GetNameNoArguments () const;
ConstString
GetDisplayName () const;
diff --git a/include/lldb/Symbol/Symbol.h b/include/lldb/Symbol/Symbol.h
index 8b9811bce..f9438b006 100644
--- a/include/lldb/Symbol/Symbol.h
+++ b/include/lldb/Symbol/Symbol.h
@@ -152,11 +152,11 @@ public:
lldb::addr_t
ResolveCallableAddress(Target &target) const;
- const ConstString &
- GetName () const
- {
- return m_mangled.GetName();
- }
+ ConstString
+ GetName () const;
+
+ ConstString
+ GetNameNoArguments () const;
ConstString
GetDisplayName () const;
@@ -167,6 +167,13 @@ public:
return m_uid;
}
+ lldb::LanguageType
+ GetLanguage() const
+ {
+ // TODO: See if there is a way to determine the language for a symbol somehow, for now just return our best guess
+ return m_mangled.GuessLanguage();
+ }
+
void
SetID(uint32_t uid)
{
diff --git a/include/lldb/Symbol/Variable.h b/include/lldb/Symbol/Variable.h
index a345bcb8c..8d413cac3 100644
--- a/include/lldb/Symbol/Variable.h
+++ b/include/lldb/Symbol/Variable.h
@@ -55,7 +55,7 @@ public:
return m_declaration;
}
- const ConstString&
+ ConstString
GetName() const;
SymbolContextScope *
@@ -70,12 +70,7 @@ public:
// function that can be called by commands and expression parsers to make
// sure we match anything we come across.
bool
- NameMatches (const ConstString &name) const
- {
- if (m_name == name)
- return true;
- return m_mangled.NameMatches (name);
- }
+ NameMatches (const ConstString &name) const;
bool
NameMatches (const RegularExpression& regex) const;
@@ -83,6 +78,9 @@ public:
Type *
GetType();
+ lldb::LanguageType
+ GetLanguage () const;
+
lldb::ValueType
GetScope() const
{
diff --git a/source/API/SBBlock.cpp b/source/API/SBBlock.cpp
index c8a665f7d..fdbbbc045 100644
--- a/source/API/SBBlock.cpp
+++ b/source/API/SBBlock.cpp
@@ -75,7 +75,15 @@ SBBlock::GetInlinedName () const
{
const InlineFunctionInfo* inlined_info = m_opaque_ptr->GetInlinedFunctionInfo ();
if (inlined_info)
- return inlined_info->GetName().AsCString (NULL);
+ {
+ Function *function = m_opaque_ptr->CalculateSymbolContextFunction();
+ LanguageType language;
+ if (function)
+ language = function->GetLanguage();
+ else
+ language = lldb::eLanguageTypeUnknown;
+ return inlined_info->GetName(language).AsCString (NULL);
+ }
}
return NULL;
}
diff --git a/source/API/SBFrame.cpp b/source/API/SBFrame.cpp
index 70ee4d44c..08a5822cb 100644
--- a/source/API/SBFrame.cpp
+++ b/source/API/SBFrame.cpp
@@ -1571,7 +1571,7 @@ SBFrame::GetFunctionName() const
if (inlined_block)
{
const InlineFunctionInfo* inlined_info = inlined_block->GetInlinedFunctionInfo();
- name = inlined_info->GetName().AsCString();
+ name = inlined_info->GetName(sc.function->GetLanguage()).AsCString();
}
}
@@ -1627,7 +1627,7 @@ SBFrame::GetDisplayFunctionName()
if (inlined_block)
{
const InlineFunctionInfo* inlined_info = inlined_block->GetInlinedFunctionInfo();
- name = inlined_info->GetDisplayName().AsCString();
+ name = inlined_info->GetDisplayName(sc.function->GetLanguage()).AsCString();
}
}
diff --git a/source/API/SBFunction.cpp b/source/API/SBFunction.cpp
index d57307add..2ec6072b5 100644
--- a/source/API/SBFunction.cpp
+++ b/source/API/SBFunction.cpp
@@ -60,7 +60,7 @@ SBFunction::GetName() const
{
const char *cstr = NULL;
if (m_opaque_ptr)
- cstr = m_opaque_ptr->GetMangled().GetName().AsCString();
+ cstr = m_opaque_ptr->GetName().AsCString();
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
@@ -80,7 +80,7 @@ SBFunction::GetDisplayName() const
{
const char *cstr = NULL;
if (m_opaque_ptr)
- cstr = m_opaque_ptr->GetMangled().GetDisplayDemangledName().AsCString();
+ cstr = m_opaque_ptr->GetMangled().GetDisplayDemangledName(m_opaque_ptr->GetLanguage()).AsCString();
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
diff --git a/source/API/SBSymbol.cpp b/source/API/SBSymbol.cpp
index 171bfd84d..22d1e546b 100644
--- a/source/API/SBSymbol.cpp
+++ b/source/API/SBSymbol.cpp
@@ -63,7 +63,7 @@ SBSymbol::GetName() const
{
const char *name = NULL;
if (m_opaque_ptr)
- name = m_opaque_ptr->GetMangled().GetName().AsCString();
+ name = m_opaque_ptr->GetName().AsCString();
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
@@ -77,7 +77,7 @@ SBSymbol::GetDisplayName() const
{
const char *name = NULL;
if (m_opaque_ptr)
- name = m_opaque_ptr->GetMangled().GetDisplayDemangledName().AsCString();
+ name = m_opaque_ptr->GetMangled().GetDisplayDemangledName(m_opaque_ptr->GetLanguage()).AsCString();
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
diff --git a/source/Breakpoint/BreakpointLocation.cpp b/source/Breakpoint/BreakpointLocation.cpp
index ef9144778..a199d3908 100644
--- a/source/Breakpoint/BreakpointLocation.cpp
+++ b/source/Breakpoint/BreakpointLocation.cpp
@@ -611,7 +611,7 @@ BreakpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level)
{
s->EOL();
s->Indent("function = ");
- s->PutCString (sc.function->GetMangled().GetName().AsCString("<unknown>"));
+ s->PutCString (sc.function->GetName().AsCString("<unknown>"));
}
if (sc.line_entry.line > 0)
@@ -632,7 +632,7 @@ BreakpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level)
s->Indent ("re-exported target = ");
else
s->Indent("symbol = ");
- s->PutCString(sc.symbol->GetMangled().GetName().AsCString("<unknown>"));
+ s->PutCString(sc.symbol->GetName().AsCString("<unknown>"));
}
}
}
diff --git a/source/Core/FormatEntity.cpp b/source/Core/FormatEntity.cpp
index 2ebe95747..e89d6c9cb 100644
--- a/source/Core/FormatEntity.cpp
+++ b/source/Core/FormatEntity.cpp
@@ -1666,7 +1666,7 @@ FormatEntity::Format (const Entry &entry,
if (inline_info)
{
s.PutCString(" [inlined] ");
- inline_info->GetName().Dump(&s);
+ inline_info->GetName(sc->function->GetLanguage()).Dump(&s);
}
}
}
@@ -1679,9 +1679,9 @@ FormatEntity::Format (const Entry &entry,
{
ConstString name;
if (sc->function)
- name = sc->function->GetMangled().GetName (Mangled::ePreferDemangledWithoutArguments);
+ name = sc->function->GetNameNoArguments();
else if (sc->symbol)
- name = sc->symbol->GetMangled().GetName (Mangled::ePreferDemangledWithoutArguments);
+ name = sc->symbol->GetNameNoArguments();
if (name)
{
s.PutCString(name.GetCString());
@@ -1724,7 +1724,7 @@ FormatEntity::Format (const Entry &entry,
{
s.PutCString (cstr);
s.PutCString (" [inlined] ");
- cstr = inline_info->GetName().GetCString();
+ cstr = inline_info->GetName(sc->function->GetLanguage()).GetCString();
}
VariableList args;
diff --git a/source/Core/Mangled.cpp b/source/Core/Mangled.cpp
index 094710633..a1916fe91 100644
--- a/source/Core/Mangled.cpp
+++ b/source/Core/Mangled.cpp
@@ -66,7 +66,7 @@ cstring_is_mangled(const char *s)
}
static const ConstString &
-get_demangled_name_without_arguments (const Mangled *obj)
+get_demangled_name_without_arguments (ConstString mangled, ConstString demangled)
{
// This pair is <mangled name, demangled name without function arguments>
static std::pair<ConstString, ConstString> g_most_recent_mangled_to_name_sans_args;
@@ -77,9 +77,6 @@ get_demangled_name_without_arguments (const Mangled *obj)
static ConstString g_last_mangled;
static ConstString g_last_demangled;
- ConstString mangled = obj->GetMangledName ();
- ConstString demangled = obj->GetDemangledName ();
-
if (mangled && g_most_recent_mangled_to_name_sans_args.first == mangled)
{
return g_most_recent_mangled_to_name_sans_args.second;
@@ -197,7 +194,7 @@ Mangled::Clear ()
int
Mangled::Compare (const Mangled& a, const Mangled& b)
{
- return ConstString::Compare(a.GetName(ePreferMangled), a.GetName(ePreferMangled));
+ return ConstString::Compare(a.GetName(lldb::eLanguageTypeUnknown, ePreferMangled), a.GetName(lldb::eLanguageTypeUnknown, ePreferMangled));
}
@@ -261,7 +258,7 @@ Mangled::SetValue (const ConstString &name)
// object's lifetime.
//----------------------------------------------------------------------
const ConstString&
-Mangled::GetDemangledName () const
+Mangled::GetDemangledName (lldb::LanguageType language) const
{
// Check to make sure we have a valid mangled name and that we
// haven't already decoded our mangled name.
@@ -340,18 +337,19 @@ Mangled::GetDemangledName () const
ConstString
-Mangled::GetDisplayDemangledName () const
+Mangled::GetDisplayDemangledName (lldb::LanguageType language) const
{
- return GetDemangledName();
+ return GetDemangledName(language);
}
bool
-Mangled::NameMatches (const RegularExpression& regex) const
+Mangled::NameMatches (const RegularExpression& regex, lldb::LanguageType language) const
{
if (m_mangled && regex.Execute (m_mangled.AsCString()))
return true;
-
- if (GetDemangledName() && regex.Execute (m_demangled.AsCString()))
+
+ ConstString demangled = GetDemangledName(language);
+ if (demangled && regex.Execute (demangled.AsCString()))
return true;
return false;
}
@@ -359,30 +357,28 @@ Mangled::NameMatches (const RegularExpression& regex) const
//----------------------------------------------------------------------
// Get the demangled name if there is one, else return the mangled name.
//----------------------------------------------------------------------
-const ConstString&
-Mangled::GetName (Mangled::NamePreference preference) const
+ConstString
+Mangled::GetName (lldb::LanguageType language, Mangled::NamePreference preference) const
{
+ ConstString demangled = GetDemangledName(language);
+
if (preference == ePreferDemangledWithoutArguments)
{
- // Call the accessor to make sure we get a demangled name in case
- // it hasn't been demangled yet...
- GetDemangledName();
-
- return get_demangled_name_without_arguments (this);
+ return get_demangled_name_without_arguments (m_mangled, demangled);
}
if (preference == ePreferDemangled)
{
// Call the accessor to make sure we get a demangled name in case
// it hasn't been demangled yet...
- if (GetDemangledName())
- return m_demangled;
+ if (demangled)
+ return demangled;
return m_mangled;
}
else
{
if (m_mangled)
return m_mangled;
- return GetDemangledName();
+ return demangled;
}
}
@@ -435,7 +431,7 @@ Mangled::GuessLanguage () const
ConstString mangled = GetMangledName();
if (mangled)
{
- if (GetDemangledName())
+ if (GetDemangledName(lldb::eLanguageTypeUnknown))
{
if (cstring_is_mangled(mangled.GetCString()))
return lldb::eLanguageTypeC_plus_plus;
@@ -453,7 +449,7 @@ operator << (Stream& s, const Mangled& obj)
if (obj.GetMangledName())
s << "mangled = '" << obj.GetMangledName() << "'";
- const ConstString& demangled = obj.GetDemangledName();
+ const ConstString& demangled = obj.GetDemangledName(lldb::eLanguageTypeUnknown);
if (demangled)
s << ", demangled = '" << demangled << '\'';
else
diff --git a/source/Expression/IRExecutionUnit.cpp b/source/Expression/IRExecutionUnit.cpp
index 7232685e4..59c7fb6f7 100644
--- a/source/Expression/IRExecutionUnit.cpp
+++ b/source/Expression/IRExecutionUnit.cpp
@@ -373,7 +373,7 @@ IRExecutionUnit::GetRunnableInfo(Error &error,
ss.PutCString("\n");
emitNewLine = true;
ss.PutCString(" ");
- ss.PutCString(Mangled(failed_lookup).GetDemangledName().AsCString());
+ ss.PutCString(Mangled(failed_lookup).GetDemangledName(lldb::eLanguageTypeObjC_plus_plus).AsCString());
}
m_failed_lookups.clear();
diff --git a/source/Expression/IRForTarget.cpp b/source/Expression/IRForTarget.cpp
index 11bc011d6..cf2a93b3e 100644
--- a/source/Expression/IRForTarget.cpp
+++ b/source/Expression/IRForTarget.cpp
@@ -267,11 +267,11 @@ IRForTarget::GetFunctionAddress (llvm::Function *fun,
{
if (mangled_name.GetMangledName())
m_error_stream->Printf("error: call to a function '%s' ('%s') that is not present in the target\n",
- mangled_name.GetName().GetCString(),
+ mangled_name.GetName(lldb::eLanguageTypeObjC_plus_plus).GetCString(),
mangled_name.GetMangledName().GetCString());
else
m_error_stream->Printf("error: call to a function '%s' that is not present in the target\n",
- mangled_name.GetName().GetCString());
+ mangled_name.GetName(lldb::eLanguageTypeObjC_plus_plus).GetCString());
}
return LookupResult::Fail;
}
diff --git a/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
index bbafcf73f..a4cdc615e 100644
--- a/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
+++ b/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
@@ -500,7 +500,7 @@ DynamicLoaderHexagonDYLD::GetStepThroughTrampolinePlan(Thread &thread, bool stop
if (sym == NULL || !sym->IsTrampoline())
return thread_plan_sp;
- const ConstString &sym_name = sym->GetMangled().GetName(Mangled::ePreferMangled);
+ const ConstString sym_name = sym->GetMangled().GetName(lldb::eLanguageTypeUnknown, Mangled::ePreferMangled);
if (!sym_name)
return thread_plan_sp;
diff --git a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
index 33a375f9a..a5e89327a 100644
--- a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -1604,7 +1604,7 @@ DynamicLoaderMacOSXDYLD::GetStepThroughTrampolinePlan (Thread &thread, bool stop
if (current_symbol->IsTrampoline())
{
- const ConstString &trampoline_name = current_symbol->GetMangled().GetName(Mangled::ePreferMangled);
+ const ConstString &trampoline_name = current_symbol->GetMangled().GetName(current_symbol->GetLanguage(), Mangled::ePreferMangled);
if (trampoline_name)
{
@@ -1754,7 +1754,7 @@ DynamicLoaderMacOSXDYLD::FindEquivalentSymbols (lldb_private::Symbol *original_s
lldb_private::ModuleList &images,
lldb_private::SymbolContextList &equivalent_symbols)
{
- const ConstString &trampoline_name = original_symbol->GetMangled().GetName(Mangled::ePreferMangled);
+ const ConstString &trampoline_name = original_symbol->GetMangled().GetName(original_symbol->GetLanguage(), Mangled::ePreferMangled);
if (!trampoline_name)
return 0;
diff --git a/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
index 6330b42ca..d9829a58d 100644
--- a/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ b/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -458,7 +458,7 @@ DynamicLoaderPOSIXDYLD::GetStepThroughTrampolinePlan(Thread &thread, bool stop)
if (sym == NULL || !sym->IsTrampoline())
return thread_plan_sp;
- const ConstString &sym_name = sym->GetMangled().GetName(Mangled::ePreferMangled);
+ ConstString sym_name = sym->GetName();
if (!sym_name)
return thread_plan_sp;
diff --git a/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
index 7d21b779e..3a3878ef0 100644
--- a/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
+++ b/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
@@ -106,7 +106,7 @@ ItaniumABILanguageRuntime::GetDynamicTypeAndAddress (ValueObject &in_value,
Symbol *symbol = sc.symbol;
if (symbol != NULL)
{
- const char *name = symbol->GetMangled().GetDemangledName().AsCString();
+ const char *name = symbol->GetMangled().GetDemangledName(lldb::eLanguageTypeC_plus_plus).AsCString();
if (name && strstr(name, vtable_demangled_prefix) == name)
{
Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
diff --git a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index fd388026d..aaa4379b8 100644
--- a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -2031,8 +2031,9 @@ ObjectFileELF::ParseSymbols (Symtab *symtab,
if (! mangled_name.empty())
mangled.SetMangledName( ConstString((mangled_name + suffix).str()) );
- llvm::StringRef demangled_name = mangled.GetDemangledName().GetStringRef();
- if (! demangled_name.empty())
+ ConstString demangled = mangled.GetDemangledName(lldb::eLanguageTypeUnknown);
+ llvm::StringRef demangled_name = demangled.GetStringRef();
+ if (!demangled_name.empty())
mangled.SetDemangledName( ConstString((demangled_name + suffix).str()) );
}
diff --git a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 4c4fb3def..ef0c5aa96 100644
--- a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -3853,7 +3853,7 @@ ObjectFileMachO::ParseSymtab ()
{
// This is usually the second N_SO entry that contains just the filename,
// so here we combine it with the first one if we are minimizing the symbol table
- const char *so_path = sym[sym_idx - 1].GetMangled().GetDemangledName().AsCString();
+ const char *so_path = sym[sym_idx - 1].GetMangled().GetDemangledName(lldb::eLanguageTypeUnknown).AsCString();
if (so_path && so_path[0])
{
std::string full_so_path (so_path);
@@ -4244,7 +4244,7 @@ ObjectFileMachO::ParseSymtab ()
if (is_gsym)
{
- const char *gsym_name = sym[sym_idx].GetMangled().GetName(Mangled::ePreferMangled).GetCString();
+ const char *gsym_name = sym[sym_idx].GetMangled().GetName(lldb::eLanguageTypeUnknown, Mangled::ePreferMangled).GetCString();
if (gsym_name)
N_GSYM_name_to_sym_idx[gsym_name] = sym_idx;
}
@@ -4312,7 +4312,7 @@ ObjectFileMachO::ParseSymtab ()
bool found_it = false;
for (ValueToSymbolIndexMap::const_iterator pos = range.first; pos != range.second; ++pos)
{
- if (sym[sym_idx].GetMangled().GetName(Mangled::ePreferMangled) == sym[pos->second].GetMangled().GetName(Mangled::ePreferMangled))
+ if (sym[sym_idx].GetMangled().GetName(lldb::eLanguageTypeUnknown, Mangled::ePreferMangled) == sym[pos->second].GetMangled().GetName(lldb::eLanguageTypeUnknown, Mangled::ePreferMangled))
{
m_nlist_idx_to_sym_idx[nlist_idx] = pos->second;
// We just need the flags from the linker symbol, so put these flags
@@ -4351,7 +4351,7 @@ ObjectFileMachO::ParseSymtab ()
bool found_it = false;
for (ValueToSymbolIndexMap::const_iterator pos = range.first; pos != range.second; ++pos)
{
- if (sym[sym_idx].GetMangled().GetName(Mangled::ePreferMangled) == sym[pos->second].GetMangled().GetName(Mangled::ePreferMangled))
+ if (sym[sym_idx].GetMangled().GetName(lldb::eLanguageTypeUnknown, Mangled::ePreferMangled) == sym[pos->second].GetMangled().GetName(lldb::eLanguageTypeUnknown, Mangled::ePreferMangled))
{
m_nlist_idx_to_sym_idx[nlist_idx] = pos->second;
// We just need the flags from the linker symbol, so put these flags
@@ -4369,7 +4369,7 @@ ObjectFileMachO::ParseSymtab ()
else
{
// Combine N_GSYM stab entries with the non stab symbol
- const char *gsym_name = sym[sym_idx].GetMangled().GetName(Mangled::ePreferMangled).GetCString();
+ const char *gsym_name = sym[sym_idx].GetMangled().GetName(lldb::eLanguageTypeUnknown, Mangled::ePreferMangled).GetCString();
if (gsym_name)
{
ConstNameToSymbolIndexMap::const_iterator pos = N_GSYM_name_to_sym_idx.find(gsym_name);
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
index 75934f966..60933108c 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -669,6 +669,7 @@ DWARFCompileUnit::Index (const uint32_t cu_idx,
GetOffset());
}
+ const LanguageType cu_language = GetLanguageType();
DWARFDebugInfoEntry::const_iterator pos;
DWARFDebugInfoEntry::const_iterator begin = m_die_array.begin();
DWARFDebugInfoEntry::const_iterator end = m_die_array.end();
@@ -882,8 +883,9 @@ DWARFCompileUnit::Index (const uint32_t cu_idx,
{
Mangled mangled (ConstString(mangled_cstr), true);
func_fullnames.Insert (mangled.GetMangledName(), die.GetOffset());
- if (mangled.GetDemangledName())
- func_fullnames.Insert (mangled.GetDemangledName(), die.GetOffset());
+ ConstString demangled = mangled.GetDemangledName(cu_language);
+ if (demangled)
+ func_fullnames.Insert (demangled, die.GetOffset());
}
}
}
@@ -904,8 +906,9 @@ DWARFCompileUnit::Index (const uint32_t cu_idx,
{
Mangled mangled (ConstString(mangled_cstr), true);
func_fullnames.Insert (mangled.GetMangledName(), die.GetOffset());
- if (mangled.GetDemangledName())
- func_fullnames.Insert (mangled.GetDemangledName(), die.GetOffset());
+ ConstString demangled = mangled.GetDemangledName(cu_language);
+ if (demangled)
+ func_fullnames.Insert (demangled, die.GetOffset());
}
}
else
@@ -951,8 +954,9 @@ DWARFCompileUnit::Index (const uint32_t cu_idx,
{
Mangled mangled (ConstString(mangled_cstr), true);
globals.Insert (mangled.GetMangledName(), die.GetOffset());
- if (mangled.GetDemangledName())
- globals.Insert (mangled.GetDemangledName(), die.GetOffset());
+ ConstString demangled = mangled.GetDemangledName(cu_language);
+ if (demangled)
+ globals.Insert (demangled, die.GetOffset());
}
}
break;
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index e1e463ad7..28f6049f3 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -3775,9 +3775,10 @@ SymbolFileDWARF::FunctionDieMatchesPartialName (const DWARFDebugInfoEntry* die,
}
}
- if (best_name.GetDemangledName())
+ const LanguageType cu_language = const_cast<DWARFCompileUnit *>(dwarf_cu)->GetLanguageType();
+ if (best_name.GetDemangledName(cu_language))
{
- const char *demangled = best_name.GetDemangledName().GetCString();
+ const char *demangled = best_name.GetDemangledName(cu_language).GetCString();
if (demangled)
{
std::string name_no_parens(partial_name, base_name_end - partial_name);
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 5579a23ce..de972acd7 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -113,7 +113,7 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(SymbolFileDWARFDebugMa
// correctly to the new addresses in the main executable.
// First we find the original symbol in the .o file's symbol table
- Symbol *oso_fun_symbol = oso_symtab->FindFirstSymbolWithNameAndType (exe_symbol->GetMangled().GetName(Mangled::ePreferMangled),
+ Symbol *oso_fun_symbol = oso_symtab->FindFirstSymbolWithNameAndType (exe_symbol->GetMangled().GetName(lldb::eLanguageTypeUnknown, Mangled::ePreferMangled),
eSymbolTypeCode,
Symtab::eDebugNo,
Symtab::eVisibilityAny);
@@ -145,7 +145,7 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(SymbolFileDWARFDebugMa
// sizes from the DWARF info as we are parsing.
// Next we find the non-stab entry that corresponds to the N_GSYM in the .o file
- Symbol *oso_gsym_symbol = oso_symtab->FindFirstSymbolWithNameAndType (exe_symbol->GetMangled().GetName(Mangled::ePreferMangled),
+ Symbol *oso_gsym_symbol = oso_symtab->FindFirstSymbolWithNameAndType (exe_symbol->GetMangled().GetName(lldb::eLanguageTypeUnknown, Mangled::ePreferMangled),
eSymbolTypeData,
Symtab::eDebugNo,
Symtab::eVisibilityAny);
diff --git a/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
index 64c88ab71..09b919782 100644
--- a/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ b/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -161,7 +161,7 @@ SymbolFileSymtab::ParseCompileUnitAtIndex(uint32_t idx)
{
const Symbol *cu_symbol = m_obj_file->GetSymtab()->SymbolAtIndex(m_source_indexes[idx]);
if (cu_symbol)
- cu_sp.reset(new CompileUnit (m_obj_file->GetModule(), NULL, cu_symbol->GetMangled().GetName().AsCString(), 0, eLanguageTypeUnknown));
+ cu_sp.reset(new CompileUnit (m_obj_file->GetModule(), NULL, cu_symbol->GetName().AsCString(), 0, eLanguageTypeUnknown));
}
return cu_sp;
}
diff --git a/source/Symbol/Function.cpp b/source/Symbol/Function.cpp
index 61b48eda8..77448d4f2 100644
--- a/source/Symbol/Function.cpp
+++ b/source/Symbol/Function.cpp
@@ -77,7 +77,7 @@ FunctionInfo::GetDeclaration() const
return m_declaration;
}
-const ConstString&
+ConstString
FunctionInfo::GetName() const
{
return m_name;
@@ -140,30 +140,30 @@ InlineFunctionInfo::Dump(Stream *s, bool show_fullpaths) const
}
void
-InlineFunctionInfo::DumpStopContext (Stream *s) const
+InlineFunctionInfo::DumpStopContext (Stream *s, LanguageType language) const
{
// s->Indent("[inlined] ");
s->Indent();
if (m_mangled)
- s->PutCString (m_mangled.GetName().AsCString());
+ s->PutCString (m_mangled.GetName(language).AsCString());
else
s->PutCString (m_name.AsCString());
}
-const ConstString &
-InlineFunctionInfo::GetName () const
+ConstString
+InlineFunctionInfo::GetName (LanguageType language) const
{
if (m_mangled)
- return m_mangled.GetName();
+ return m_mangled.GetName(language);
return m_name;
}
ConstString
-InlineFunctionInfo::GetDisplayName () const
+InlineFunctionInfo::GetDisplayName (LanguageType language) const
{
if (m_mangled)
- return m_mangled.GetDisplayDemangledName();
+ return m_mangled.GetDisplayDemangledName(language);
return m_name;
}
@@ -471,7 +471,7 @@ Function::GetDisplayName () const
{
if (!m_mangled)
return ConstString();
- return m_mangled.GetDisplayDemangledName();
+ return m_mangled.GetDisplayDemangledName(GetLanguage());
}
clang::DeclContext *
@@ -617,5 +617,32 @@ Function::GetPrologueByteSize ()
return m_prologue_byte_size;
}
+lldb::LanguageType
+Function::GetLanguage() const
+{
+ if (m_comp_unit)
+ return m_comp_unit->GetLanguage();
+ else
+ return lldb::eLanguageTypeUnknown;
+}
+
+ConstString
+Function::GetName() const
+{
+ LanguageType language = lldb::eLanguageTypeUnknown;
+ if (m_comp_unit)
+ language = m_comp_unit->GetLanguage();
+ return m_mangled.GetName(language);
+}
+
+ConstString
+Function::GetNameNoArguments() const
+{
+ LanguageType language = lldb::eLanguageTypeUnknown;
+ if (m_comp_unit)
+ language = m_comp_unit->GetLanguage();
+ return m_mangled.GetName(language, Mangled::ePreferDemangledWithoutArguments);
+}
+
diff --git a/source/Symbol/Symbol.cpp b/source/Symbol/Symbol.cpp
index 3e8af2f0c..5884fcaa5 100644
--- a/source/Symbol/Symbol.cpp
+++ b/source/Symbol/Symbol.cpp
@@ -189,7 +189,7 @@ Symbol::GetDisplayName () const
{
if (!m_mangled)
return ConstString();
- return m_mangled.GetDisplayDemangledName();
+ return m_mangled.GetDisplayDemangledName(GetLanguage());
}
ConstString
@@ -296,8 +296,9 @@ Symbol::GetDescription (Stream *s, lldb::DescriptionLevel level, Target *target)
else
s->Printf (", value = 0x%16.16" PRIx64, m_addr_range.GetBaseAddress().GetOffset());
}
- if (m_mangled.GetDemangledName())
- s->Printf(", name=\"%s\"", m_mangled.GetDemangledName().AsCString());
+ ConstString demangled = m_mangled.GetDemangledName(GetLanguage());
+ if (demangled)
+ s->Printf(", name=\"%s\"", demangled.AsCString());
if (m_mangled.GetMangledName())
s->Printf(", mangled=\"%s\"", m_mangled.GetMangledName().AsCString());
@@ -317,6 +318,7 @@ Symbol::Dump(Stream *s, Target *target, uint32_t index) const
// Make sure the size of the symbol is up to date before dumping
GetByteSize();
+ ConstString name = m_mangled.GetName(GetLanguage());
if (ValueIsAddress())
{
if (!m_addr_range.GetBaseAddress().Dump(s, nullptr, Address::DumpStyleFileAddress))
@@ -333,13 +335,13 @@ Symbol::Dump(Stream *s, Target *target, uint32_t index) const
s->Printf( format,
GetByteSize(),
m_flags,
- m_mangled.GetName().AsCString(""));
+ name.AsCString(""));
}
else if (m_type == eSymbolTypeReExported)
{
s->Printf (" 0x%8.8x %s",
m_flags,
- m_mangled.GetName().AsCString(""));
+ name.AsCString(""));
ConstString reexport_name = GetReExportedSymbolName();
intptr_t shlib = m_addr_range.GetByteSize();
@@ -357,7 +359,7 @@ Symbol::Dump(Stream *s, Target *target, uint32_t index) const
m_addr_range.GetBaseAddress().GetOffset(),
GetByteSize(),
m_flags,
- m_mangled.GetName().AsCString(""));
+ name.AsCString(""));
}
}
@@ -447,7 +449,7 @@ bool
Symbol::Compare(const ConstString& name, SymbolType type) const
{
if (type == eSymbolTypeAny || m_type == type)
- return m_mangled.GetMangledName() == name || m_mangled.GetDemangledName() == name;
+ return m_mangled.GetMangledName() == name || m_mangled.GetDemangledName(GetLanguage()) == name;
return false;
}
@@ -643,6 +645,18 @@ Symbol::GetLoadAddress (Target *target) const
return LLDB_INVALID_ADDRESS;
}
+ConstString
+Symbol::GetName () const
+{
+ return m_mangled.GetName(GetLanguage());
+}
+
+ConstString
+Symbol::GetNameNoArguments () const
+{
+ return m_mangled.GetName(GetLanguage(), Mangled::ePreferDemangledWithoutArguments);
+}
+
lldb::addr_t
Symbol::ResolveCallableAddress(Target &target) const
diff --git a/source/Symbol/SymbolContext.cpp b/source/Symbol/SymbolContext.cpp
index 8e4240a45..4fb0dbc23 100644
--- a/source/Symbol/SymbolContext.cpp
+++ b/source/Symbol/SymbolContext.cpp
@@ -160,15 +160,15 @@ SymbolContext::DumpStopContext (
s->Printf("<");
dumped_something = true;
}
- else if (show_function_arguments == false && function->GetMangled().GetName(Mangled::ePreferDemangledWithoutArguments))
- {
- dumped_something = true;
- function->GetMangled().GetName(Mangled::ePreferDemangledWithoutArguments).Dump(s);
- }
- else if (function->GetMangled().GetName())
+ else
{
- dumped_something = true;
- function->GetMangled().GetName().Dump(s);
+ ConstString name;
+ if (show_function_arguments == false)
+ name = function->GetNameNoArguments();
+ if (!name)
+ name = function->GetName();
+ if (name)
+ name.Dump(s);
}
if (addr.IsValid())
@@ -192,7 +192,7 @@ SymbolContext::DumpStopContext (
dumped_something = true;
Block *inlined_block = block->GetContainingInlinedBlock();
const InlineFunctionInfo* inlined_block_info = inlined_block->GetInlinedFunctionInfo();
- s->Printf (" [inlined] %s", inlined_block_info->GetName().GetCString());
+ s->Printf (" [inlined] %s", inlined_block_info->GetName(function->GetLanguage()).GetCString());
lldb_private::AddressRange block_range;
if (inlined_block->GetRangeContainingAddress(addr, block_range))
@@ -235,12 +235,12 @@ SymbolContext::DumpStopContext (
s->Printf("<");
dumped_something = true;
}
- else if (symbol->GetMangled().GetName())
+ else if (symbol->GetName())
{
dumped_something = true;
if (symbol->GetType() == eSymbolTypeTrampoline)
s->PutCString("symbol stub for: ");
- symbol->GetMangled().GetName().Dump(s);
+ symbol->GetName().Dump(s);
}
if (addr.IsValid() && symbol->ValueIsAddress())
@@ -438,7 +438,7 @@ SymbolContext::Dump(Stream *s, Target *target) const
s->Indent();
*s << "Symbol = " << (void *)symbol;
if (symbol != nullptr && symbol->GetMangled())
- *s << ' ' << symbol->GetMangled().GetName().AsCString();
+ *s << ' ' << symbol->GetName().AsCString();
s->EOL();
*s << "Variable = " << (void *)variable;
if (variable != nullptr)
@@ -681,14 +681,14 @@ SymbolContext::GetFunctionName (Mangled::NamePreference preference) const
{
const InlineFunctionInfo *inline_info = inlined_block->GetInlinedFunctionInfo();
if (inline_info)
- return inline_info->GetName();
+ return inline_info->GetName(function->GetLanguage());
}
}
- return function->GetMangled().GetName(preference);
+ return function->GetMangled().GetName(function->GetLanguage(), preference);
}
else if (symbol && symbol->ValueIsAddress())
{
- return symbol->GetMangled().GetName(preference);
+ return symbol->GetMangled().GetName(symbol->GetLanguage(), preference);
}
else
{
@@ -916,7 +916,7 @@ SymbolContextSpecifier::SymbolContextMatches(SymbolContext &sc)
{
was_inlined = true;
const Mangled &name = inline_info->GetMangled();
- if (!name.NameMatches (func_name))
+ if (!name.NameMatches (func_name, sc.function->GetLanguage()))
return false;
}
}
@@ -925,12 +925,12 @@ SymbolContextSpecifier::SymbolContextMatches(SymbolContext &sc)
{
if (sc.function != nullptr)
{
- if (!sc.function->GetMangled().NameMatches(func_name))
+ if (!sc.function->GetMangled().NameMatches(func_name, sc.function->GetLanguage()))
return false;
}
else if (sc.symbol != nullptr)
{
- if (!sc.symbol->GetMangled().NameMatches(func_name))
+ if (!sc.symbol->GetMangled().NameMatches(func_name, sc.function->GetLanguage()))
return false;
}
}
diff --git a/source/Symbol/Symtab.cpp b/source/Symbol/Symtab.cpp
index 4cc03345d..c11efc0d9 100644
--- a/source/Symbol/Symtab.cpp
+++ b/source/Symbol/Symtab.cpp
@@ -136,7 +136,7 @@ Symtab::Dump (Stream *s, Target *target, SortOrder sort_order)
CStringToSymbol name_map;
for (const_iterator pos = m_symbols.begin(), end = m_symbols.end(); pos != end; ++pos)
{
- const char *name = pos->GetMangled().GetName(Mangled::ePreferDemangled).AsCString();
+ const char *name = pos->GetName().AsCString();
if (name && name[0])
name_map.insert (std::make_pair(name, &(*pos)));
}
@@ -329,7 +329,7 @@ Symtab::InitNameIndexes()
entry.cstring[2] != 'G' && // avoid guard variables
entry.cstring[2] != 'Z')) // named local entities (if we eventually handle eSymbolTypeData, we will want this back)
{
- CPPLanguageRuntime::MethodName cxx_method (mangled.GetDemangledName());
+ CPPLanguageRuntime::MethodName cxx_method (mangled.GetDemangledName(lldb::eLanguageTypeC_plus_plus));
entry.cstring = ConstString(cxx_method.GetBasename()).GetCString();
if (entry.cstring && entry.cstring[0])
{
@@ -378,7 +378,7 @@ Symtab::InitNameIndexes()
}
}
- entry.cstring = mangled.GetDemangledName().GetCString();
+ entry.cstring = mangled.GetDemangledName(symbol->GetLanguage()).GetCString();
if (entry.cstring && entry.cstring[0]) {
m_name_to_index.Append (entry);
@@ -486,7 +486,7 @@ Symtab::AppendSymbolNamesToMap (const IndexCollection &indexes,
const Mangled &mangled = symbol->GetMangled();
if (add_demangled)
{
- entry.cstring = mangled.GetDemangledName().GetCString();
+ entry.cstring = mangled.GetDemangledName(symbol->GetLanguage()).GetCString();
if (entry.cstring && entry.cstring[0])
name_to_index_map.Append (entry);
}
@@ -746,7 +746,7 @@ Symtab::AppendSymbolIndexesMatchingRegExAndType (const RegularExpression &regexp
{
if (symbol_type == eSymbolTypeAny || m_symbols[i].GetType() == symbol_type)
{
- const char *name = m_symbols[i].GetMangled().GetName().AsCString();
+ const char *name = m_symbols[i].GetName().AsCString();
if (name)
{
if (regexp.Execute (name))
@@ -773,7 +773,7 @@ Symtab::AppendSymbolIndexesMatchingRegExAndType (const RegularExpression &regexp
if (CheckSymbolAtIndex(i, symbol_debug_type, symbol_visibility) == false)
continue;
- const char *name = m_symbols[i].GetMangled().GetName().AsCString();
+ const char *name = m_symbols[i].GetName().AsCString();
if (name)
{
if (regexp.Execute (name))
diff --git a/source/Symbol/Variable.cpp b/source/Symbol/Variable.cpp
index 5665e4702..5e7827737 100644
--- a/source/Symbol/Variable.cpp
+++ b/source/Symbol/Variable.cpp
@@ -15,6 +15,7 @@
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/Symbol/Block.h"
+#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/Type.h"
@@ -65,22 +66,51 @@ Variable::~Variable()
{
}
+lldb::LanguageType
+Variable::GetLanguage () const
+{
+ SymbolContext variable_sc;
+ m_owner_scope->CalculateSymbolContext(&variable_sc);
+ if (variable_sc.comp_unit)
+ return variable_sc.comp_unit->GetLanguage();
+ return lldb::eLanguageTypeUnknown;
+}
+
-const ConstString&
+
+ConstString
Variable::GetName() const
{
- const ConstString &name = m_mangled.GetName();
- if (name)
- return name;
+ if (m_mangled)
+ {
+ ConstString name = m_mangled.GetName(GetLanguage());
+ if (name)
+ return name;
+ }
return m_name;
}
bool
+Variable::NameMatches (const ConstString &name) const
+{
+ if (m_name == name)
+ return true;
+ SymbolContext variable_sc;
+ m_owner_scope->CalculateSymbolContext(&variable_sc);
+
+ LanguageType language = eLanguageTypeUnknown;
+ if (variable_sc.comp_unit)
+ language = variable_sc.comp_unit->GetLanguage();
+ return m_mangled.NameMatches (name, language);
+}
+bool
Variable::NameMatches (const RegularExpression& regex) const
{
if (regex.Execute (m_name.AsCString()))
return true;
- return m_mangled.NameMatches (regex);
+ if (m_mangled)
+ return m_mangled.NameMatches (regex, GetLanguage());
+ return false;
}
Type *
diff --git a/source/Target/ThreadPlanStepOverRange.cpp b/source/Target/ThreadPlanStepOverRange.cpp
index 701e93d3c..aba892242 100644
--- a/source/Target/ThreadPlanStepOverRange.cpp
+++ b/source/Target/ThreadPlanStepOverRange.cpp
@@ -430,7 +430,7 @@ ThreadPlanStepOverRange::DoWillResume (lldb::StateType resume_state, bool curren
const InlineFunctionInfo *inline_info = frame_block->GetInlinedFunctionInfo();
const char *name;
if (inline_info)
- name = inline_info->GetName().AsCString();
+ name = inline_info->GetName(frame_block->CalculateSymbolContextFunction()->GetLanguage()).AsCString();
else
name = "<unknown-notinlined>";