diff options
author | emaste <emaste@FreeBSD.org> | 2015-02-09 01:44:09 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2015-02-09 01:44:09 +0000 |
commit | d61b076ede88b56f3372a55e7d1eac6a9d717120 (patch) | |
tree | a8f4b3abea3e6937e60728991c736e6e3d322fc1 /source/Symbol/SymbolContext.cpp | |
parent | 0c2019f4ca6b2dc6d710f6bb16a0e3ed10271531 (diff) | |
download | FreeBSD-src-d61b076ede88b56f3372a55e7d1eac6a9d717120.zip FreeBSD-src-d61b076ede88b56f3372a55e7d1eac6a9d717120.tar.gz |
Import LLDB as of upstream SVN 228549 (git 39760838)
Diffstat (limited to 'source/Symbol/SymbolContext.cpp')
-rw-r--r-- | source/Symbol/SymbolContext.cpp | 68 |
1 files changed, 58 insertions, 10 deletions
diff --git a/source/Symbol/SymbolContext.cpp b/source/Symbol/SymbolContext.cpp index 129f4de..62ae6ac 100644 --- a/source/Symbol/SymbolContext.cpp +++ b/source/Symbol/SymbolContext.cpp @@ -13,7 +13,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/ModuleSpec.h" #include "lldb/Host/Host.h" -#include "lldb/Interpreter/Args.h" +#include "lldb/Host/StringConvert.h" #include "lldb/Symbol/Block.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/CompileUnit.h" @@ -21,6 +21,7 @@ #include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/SymbolVendor.h" +#include "lldb/Symbol/Variable.h" #include "lldb/Target/Target.h" using namespace lldb; @@ -33,7 +34,8 @@ SymbolContext::SymbolContext() : function (nullptr), block (nullptr), line_entry (), - symbol (nullptr) + symbol (nullptr), + variable (nullptr) { } @@ -44,7 +46,8 @@ SymbolContext::SymbolContext(const ModuleSP& m, CompileUnit *cu, Function *f, Bl function (f), block (b), line_entry (), - symbol (s) + symbol (s), + variable (nullptr) { if (le) line_entry = *le; @@ -57,7 +60,8 @@ SymbolContext::SymbolContext(const TargetSP &t, const ModuleSP& m, CompileUnit * function (f), block (b), line_entry (), - symbol (s) + symbol (s), + variable (nullptr) { if (le) line_entry = *le; @@ -70,7 +74,8 @@ SymbolContext::SymbolContext(const SymbolContext& rhs) : function (rhs.function), block (rhs.block), line_entry (rhs.line_entry), - symbol (rhs.symbol) + symbol (rhs.symbol), + variable (rhs.variable) { } @@ -82,7 +87,8 @@ SymbolContext::SymbolContext (SymbolContextScope *sc_scope) : function (nullptr), block (nullptr), line_entry (), - symbol (nullptr) + symbol (nullptr), + variable (nullptr) { sc_scope->CalculateSymbolContext (this); } @@ -103,6 +109,7 @@ SymbolContext::operator= (const SymbolContext& rhs) block = rhs.block; line_entry = rhs.line_entry; symbol = rhs.symbol; + variable = rhs.variable; } return *this; } @@ -118,6 +125,7 @@ SymbolContext::Clear(bool clear_target) block = nullptr; line_entry.Clear(); symbol = nullptr; + variable = nullptr; } bool @@ -309,6 +317,37 @@ SymbolContext::GetDescription(Stream *s, lldb::DescriptionLevel level, Target *t symbol->GetDescription(s, level, target); s->EOL(); } + + if (variable != nullptr) + { + s->Indent(" Variable: "); + + s->Printf("id = {0x%8.8" PRIx64 "}, ", variable->GetID()); + + switch (variable->GetScope()) + { + case eValueTypeVariableGlobal: + s->PutCString("kind = global, "); + break; + + case eValueTypeVariableStatic: + s->PutCString("kind = static, "); + break; + + case eValueTypeVariableArgument: + s->PutCString("kind = argument, "); + break; + + case eValueTypeVariableLocal: + s->PutCString("kind = local, "); + break; + + default: + break; + } + + s->Printf ("name = \"%s\"\n", variable->GetName().GetCString()); + } } uint32_t @@ -322,6 +361,7 @@ SymbolContext::GetResolvedMask () const if (block) resolved_mask |= eSymbolContextBlock; if (line_entry.IsValid()) resolved_mask |= eSymbolContextLineEntry; if (symbol) resolved_mask |= eSymbolContextSymbol; + if (variable) resolved_mask |= eSymbolContextVariable; return resolved_mask; } @@ -377,6 +417,12 @@ SymbolContext::Dump(Stream *s, Target *target) const if (symbol != nullptr && symbol->GetMangled()) *s << ' ' << symbol->GetMangled().GetName().AsCString(); s->EOL(); + *s << "Variable = " << (void *)variable; + if (variable != nullptr) + { + *s << " {0x" << variable->GetID() << "} " << variable->GetType()->GetName(); + s->EOL(); + } s->IndentLess(); s->IndentLess(); } @@ -389,7 +435,8 @@ lldb_private::operator== (const SymbolContext& lhs, const SymbolContext& rhs) && lhs.module_sp.get() == rhs.module_sp.get() && lhs.comp_unit == rhs.comp_unit && lhs.target_sp.get() == rhs.target_sp.get() - && LineEntry::Compare(lhs.line_entry, rhs.line_entry) == 0; + && LineEntry::Compare(lhs.line_entry, rhs.line_entry) == 0 + && lhs.variable == rhs.variable; } bool @@ -400,7 +447,8 @@ lldb_private::operator!= (const SymbolContext& lhs, const SymbolContext& rhs) || lhs.module_sp.get() != rhs.module_sp.get() || lhs.comp_unit != rhs.comp_unit || lhs.target_sp.get() != rhs.target_sp.get() - || LineEntry::Compare(lhs.line_entry, rhs.line_entry) != 0; + || LineEntry::Compare(lhs.line_entry, rhs.line_entry) != 0 + || lhs.variable != rhs.variable; } bool @@ -730,12 +778,12 @@ SymbolContextSpecifier::AddSpecification (const char *spec_string, Specification m_type |= eFileSpecified; break; case eLineStartSpecified: - m_start_line = Args::StringToSInt32(spec_string, 0, 0, &return_value); + m_start_line = StringConvert::ToSInt32(spec_string, 0, 0, &return_value); if (return_value) m_type |= eLineStartSpecified; break; case eLineEndSpecified: - m_end_line = Args::StringToSInt32(spec_string, 0, 0, &return_value); + m_end_line = StringConvert::ToSInt32(spec_string, 0, 0, &return_value); if (return_value) m_type |= eLineEndSpecified; break; |