summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Langford <apl@fb.com>2019-07-01 20:36:33 +0000
committerAlex Langford <apl@fb.com>2019-07-01 20:36:33 +0000
commitd7fcee62f114c5f96bc0d8430af40ce198231daa (patch)
tree6bb67a6dc4685ba36a5e0c89b24f78af3be8be9e
parent975120a21b43a192e9475de4af7dcd6565b37224 (diff)
downloadbcm5719-llvm-d7fcee62f114c5f96bc0d8430af40ce198231daa.tar.gz
bcm5719-llvm-d7fcee62f114c5f96bc0d8430af40ce198231daa.zip
[Core] Generalize ValueObject::IsRuntimeSupportValue
Summary: Instead of falling back to ObjCLanguageRuntime, we should be falling back to every loaded language runtime. This makes ValueObject more language agnostic. Reviewers: labath, compnerd, JDevlieghere, davide Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D63240 llvm-svn: 364845
-rw-r--r--lldb/include/lldb/Target/CPPLanguageRuntime.h2
-rw-r--r--lldb/include/lldb/Target/LanguageRuntime.h6
-rw-r--r--lldb/include/lldb/Target/ObjCLanguageRuntime.h3
-rw-r--r--lldb/source/Core/ValueObject.cpp32
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp3
-rw-r--r--lldb/source/Symbol/Function.cpp8
-rw-r--r--lldb/source/Target/CPPLanguageRuntime.cpp16
-rw-r--r--lldb/source/Target/ObjCLanguageRuntime.cpp13
8 files changed, 36 insertions, 47 deletions
diff --git a/lldb/include/lldb/Target/CPPLanguageRuntime.h b/lldb/include/lldb/Target/CPPLanguageRuntime.h
index 7d15acefc5b..7b7d8acc9af 100644
--- a/lldb/include/lldb/Target/CPPLanguageRuntime.h
+++ b/lldb/include/lldb/Target/CPPLanguageRuntime.h
@@ -78,7 +78,7 @@ public:
lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
bool stop_others) override;
- bool IsRuntimeSupportValue(ValueObject &valobj) override;
+ bool IsWhitelistedRuntimeValue(ConstString name) override;
protected:
// Classes that inherit from CPPLanguageRuntime can see and modify these
CPPLanguageRuntime(Process *process);
diff --git a/lldb/include/lldb/Target/LanguageRuntime.h b/lldb/include/lldb/Target/LanguageRuntime.h
index 54be5a75e98..3521f464287 100644
--- a/lldb/include/lldb/Target/LanguageRuntime.h
+++ b/lldb/include/lldb/Target/LanguageRuntime.h
@@ -152,9 +152,9 @@ public:
virtual lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
bool stop_others) = 0;
- /// Identify whether a value is a language implementation detaul
- /// that should be hidden from the user interface by default.
- virtual bool IsRuntimeSupportValue(ValueObject &valobj) { return false; }
+ /// Identify whether a name is a runtime value that should not be hidden by
+ /// from the user interface.
+ virtual bool IsWhitelistedRuntimeValue(ConstString name) { return false; }
virtual void ModulesDidLoad(const ModuleList &module_list) {}
diff --git a/lldb/include/lldb/Target/ObjCLanguageRuntime.h b/lldb/include/lldb/Target/ObjCLanguageRuntime.h
index 79737c925b7..1fc8744407a 100644
--- a/lldb/include/lldb/Target/ObjCLanguageRuntime.h
+++ b/lldb/include/lldb/Target/ObjCLanguageRuntime.h
@@ -301,8 +301,7 @@ public:
/// Check whether the name is "self" or "_cmd" and should show up in
/// "frame variable".
- static bool IsWhitelistedRuntimeValue(ConstString name);
- bool IsRuntimeSupportValue(ValueObject &valobj) override;
+ bool IsWhitelistedRuntimeValue(ConstString name) override;
protected:
// Classes that inherit from ObjCLanguageRuntime can see and modify these
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 409f3d6b13f..73cd1339433 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -1695,18 +1695,28 @@ bool ValueObject::IsPossibleDynamicType() {
bool ValueObject::IsRuntimeSupportValue() {
Process *process(GetProcessSP().get());
- if (process) {
- LanguageRuntime *runtime =
- process->GetLanguageRuntime(GetObjectRuntimeLanguage());
- if (!runtime)
- runtime = ObjCLanguageRuntime::Get(*process);
- if (runtime)
- return runtime->IsRuntimeSupportValue(*this);
- // If there is no language runtime, trust the compiler to mark all
- // runtime support variables as artificial.
- return GetVariable() && GetVariable()->IsArtificial();
+ if (!process)
+ return false;
+
+ // We trust the the compiler did the right thing and marked runtime support
+ // values as artificial.
+ if (!GetVariable() || !GetVariable()->IsArtificial())
+ return false;
+
+ LanguageType lang = eLanguageTypeUnknown;
+ if (auto *sym_ctx_scope = GetSymbolContextScope()) {
+ if (auto *func = sym_ctx_scope->CalculateSymbolContextFunction())
+ lang = func->GetLanguage();
+ else if (auto *comp_unit =
+ sym_ctx_scope->CalculateSymbolContextCompileUnit())
+ lang = comp_unit->GetLanguage();
}
- return false;
+
+ if (auto *runtime = process->GetLanguageRuntime(lang))
+ if (runtime->IsWhitelistedRuntimeValue(GetName()))
+ return false;
+
+ return true;
}
bool ValueObject::IsNilReference() {
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 5a2de4865b4..b85ab54a10d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2371,7 +2371,8 @@ Function *DWARFASTParserClang::ParseFunctionFromDWARF(CompileUnit &comp_unit,
func_name.SetValue(ConstString(mangled), true);
else if ((die.GetParent().Tag() == DW_TAG_compile_unit ||
die.GetParent().Tag() == DW_TAG_partial_unit) &&
- Language::LanguageIsCPlusPlus(die.GetLanguage()) && name &&
+ Language::LanguageIsCPlusPlus(die.GetLanguage()) &&
+ !Language::LanguageIsObjC(die.GetLanguage()) && name &&
strcmp(name, "main") != 0) {
// If the mangled name is not present in the DWARF, generate the
// demangled name using the decl context. We skip if the function is
diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp
index 83350e7123f..951392c1f1b 100644
--- a/lldb/source/Symbol/Function.cpp
+++ b/lldb/source/Symbol/Function.cpp
@@ -589,10 +589,14 @@ uint32_t Function::GetPrologueByteSize() {
}
lldb::LanguageType Function::GetLanguage() const {
+ lldb::LanguageType lang = m_mangled.GuessLanguage();
+ if (lang != lldb::eLanguageTypeUnknown)
+ return lang;
+
if (m_comp_unit)
return m_comp_unit->GetLanguage();
- else
- return lldb::eLanguageTypeUnknown;
+
+ return lldb::eLanguageTypeUnknown;
}
ConstString Function::GetName() const {
diff --git a/lldb/source/Target/CPPLanguageRuntime.cpp b/lldb/source/Target/CPPLanguageRuntime.cpp
index 8e503bd4932..e10a117acbb 100644
--- a/lldb/source/Target/CPPLanguageRuntime.cpp
+++ b/lldb/source/Target/CPPLanguageRuntime.cpp
@@ -43,20 +43,8 @@ CPPLanguageRuntime::~CPPLanguageRuntime() {}
CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
: LanguageRuntime(process) {}
-bool CPPLanguageRuntime::IsRuntimeSupportValue(ValueObject &valobj) {
- // All runtime support values have to be marked as artificial by the
- // compiler. But not all artificial variables should be hidden from
- // the user.
- if (!valobj.GetVariable())
- return false;
- if (!valobj.GetVariable()->IsArtificial())
- return false;
-
- // Whitelist "this" and since there is no ObjC++ runtime, any ObjC names.
- ConstString name = valobj.GetName();
- if (name == g_this)
- return false;
- return !ObjCLanguageRuntime::IsWhitelistedRuntimeValue(name);
+bool CPPLanguageRuntime::IsWhitelistedRuntimeValue(ConstString name) {
+ return name == g_this;
}
bool CPPLanguageRuntime::GetObjectDescription(Stream &str,
diff --git a/lldb/source/Target/ObjCLanguageRuntime.cpp b/lldb/source/Target/ObjCLanguageRuntime.cpp
index ef059a84b19..5e800981740 100644
--- a/lldb/source/Target/ObjCLanguageRuntime.cpp
+++ b/lldb/source/Target/ObjCLanguageRuntime.cpp
@@ -46,19 +46,6 @@ bool ObjCLanguageRuntime::IsWhitelistedRuntimeValue(ConstString name) {
return name == g_self || name == g_cmd;
}
-bool ObjCLanguageRuntime::IsRuntimeSupportValue(ValueObject &valobj) {
- // All runtime support values have to be marked as artificial by the
- // compiler. But not all artificial variables should be hidden from
- // the user.
- if (!valobj.GetVariable())
- return false;
- if (!valobj.GetVariable()->IsArtificial())
- return false;
-
- // Whitelist "self" and "_cmd".
- return !IsWhitelistedRuntimeValue(valobj.GetName());
-}
-
bool ObjCLanguageRuntime::AddClass(ObjCISA isa,
const ClassDescriptorSP &descriptor_sp,
const char *class_name) {
OpenPOWER on IntegriCloud