Cleaned up the output of "image lookup --address <ADDR>" which involved
cleaning up the output of many GetDescription objects that are part of a
symbol context. This fixes an issue where no ranges were being printed out
for functions, blocks and symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113571 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Symbol/Block.cpp b/source/Symbol/Block.cpp
index a1de78a..a6e7f8f 100644
--- a/source/Symbol/Block.cpp
+++ b/source/Symbol/Block.cpp
@@ -38,6 +38,8 @@
void
Block::GetDescription(Stream *s, Function *function, lldb::DescriptionLevel level, Process *process) const
{
+ *s << "id = " << ((const UserID&)*this);
+
size_t num_ranges = m_ranges.size();
if (num_ranges)
{
@@ -48,12 +50,11 @@
if (base_addr == LLDB_INVALID_ADDRESS)
base_addr = function->GetAddressRange().GetBaseAddress().GetFileAddress();
- s->Printf("range%s = ", num_ranges > 1 ? "s" : "");
+ s->Printf(", range%s = ", num_ranges > 1 ? "s" : "");
std::vector<VMRange>::const_iterator pos, end = m_ranges.end();
for (pos = m_ranges.begin(); pos != end; ++pos)
pos->Dump(s, base_addr, 4);
}
- *s << ", id = " << ((const UserID&)*this);
if (m_inlineInfoSP.get() != NULL)
m_inlineInfoSP->Dump(s);
diff --git a/source/Symbol/CompileUnit.cpp b/source/Symbol/CompileUnit.cpp
index eaf1211..3665f5b 100644
--- a/source/Symbol/CompileUnit.cpp
+++ b/source/Symbol/CompileUnit.cpp
@@ -68,8 +68,7 @@
void
CompileUnit::GetDescription(Stream *s, lldb::DescriptionLevel level) const
{
- *s << '"' << (const FileSpec&)*this << "\", id = " << (const UserID&)*this
- << ", language = " << (const Language&)*this;
+ *s << "id = " << (const UserID&)*this << ", file = \"" << (const FileSpec&)*this << "\", language = \"" << (const Language&)*this << '"';
}
@@ -85,8 +84,8 @@
s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
s->Indent();
*s << "CompileUnit" << (const UserID&)*this
- << ", language = " << (const Language&)*this
- << ", file='" << (const FileSpec&)*this << "'\n";
+ << ", language = \"" << (const Language&)*this
+ << "\", file = '" << (const FileSpec&)*this << "'\n";
// m_types.Dump(s);
diff --git a/source/Symbol/Function.cpp b/source/Symbol/Function.cpp
index 5f9adbb..43a668f 100644
--- a/source/Symbol/Function.cpp
+++ b/source/Symbol/Function.cpp
@@ -18,6 +18,7 @@
#include "clang/AST/Type.h"
#include "clang/AST/CanonicalType.h"
+using namespace lldb;
using namespace lldb_private;
//----------------------------------------------------------------------
@@ -328,9 +329,14 @@
Function::GetDescription(Stream *s, lldb::DescriptionLevel level, Process *process)
{
Type* func_type = GetType();
- *s << '"' << func_type->GetName() << "\", id = " << (const UserID&)*this;
- *s << ", range = ";
- GetAddressRange().Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress);
+ *s << "id = " << (const UserID&)*this << ", name = \"" << func_type->GetName() << "\", range = ";
+
+ Address::DumpStyle fallback_style;
+ if (level == eDescriptionLevelVerbose)
+ fallback_style = Address::DumpStyleModuleWithFileAddress;
+ else
+ fallback_style = Address::DumpStyleFileAddress;
+ GetAddressRange().Dump(s, process, Address::DumpStyleLoadAddress, fallback_style);
}
void
diff --git a/source/Symbol/LineEntry.cpp b/source/Symbol/LineEntry.cpp
index 5d9b27e..8880592 100644
--- a/source/Symbol/LineEntry.cpp
+++ b/source/Symbol/LineEntry.cpp
@@ -151,20 +151,16 @@
if (level == lldb::eDescriptionLevelBrief || level == lldb::eDescriptionLevelFull)
{
- // Show address only
if (show_address_only)
{
- s->PutCString ("address = ");
range.GetBaseAddress().Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
}
else
{
- s->PutCString ("range = ");
range.Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
}
- if (file)
- *s << ' ' << file;
+ *s << ": " << file;
if (line)
{
@@ -173,6 +169,7 @@
s->Printf(":%u", column);
}
+
if (level == lldb::eDescriptionLevelFull)
{
if (is_start_of_statement)
diff --git a/source/Symbol/Symbol.cpp b/source/Symbol/Symbol.cpp
index 7ea7193..8b15536 100644
--- a/source/Symbol/Symbol.cpp
+++ b/source/Symbol/Symbol.cpp
@@ -175,19 +175,29 @@
void
Symbol::GetDescription (Stream *s, lldb::DescriptionLevel level, Process *process) const
{
- *s << '"' << m_mangled.GetName() << "\", id = " << (const UserID&)*this;
+ *s << "id = " << (const UserID&)*this << ", name = \"" << m_mangled.GetName() << '"';
const Section *section = m_addr_range.GetBaseAddress().GetSection();
if (section != NULL)
{
- if (m_addr_range.GetByteSize() > 0)
+ if (m_addr_range.GetBaseAddress().IsSectionOffset())
{
- s->PutCString(", range = ");
- m_addr_range.Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress);
+ if (m_addr_range.GetByteSize() > 0)
+ {
+ s->PutCString (", range = ");
+ m_addr_range.Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
+ }
+ else
+ {
+ s->PutCString (", address = ");
+ m_addr_range.GetBaseAddress().Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
+ }
}
else
{
- s->PutCString(", address = ");
- m_addr_range.GetBaseAddress().Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress);
+ if (m_size_is_sibling)
+ s->Printf (", sibling = %5llu", m_addr_range.GetBaseAddress().GetOffset());
+ else
+ s->Printf (", value = 0x%16.16llx", m_addr_range.GetBaseAddress().GetOffset());
}
}
}
diff --git a/source/Symbol/SymbolContext.cpp b/source/Symbol/SymbolContext.cpp
index 51178fc..d70976c 100644
--- a/source/Symbol/SymbolContext.cpp
+++ b/source/Symbol/SymbolContext.cpp
@@ -198,9 +198,11 @@
{
if (module_sp)
{
- s->Indent(" Module: \"");
+ s->Indent(" Module: file = \"");
module_sp->GetFileSpec().Dump(s);
- s->PutChar('"');
+ *s << '"';
+ if (module_sp->GetArchitecture().IsValid())
+ s->Printf (", arch = \"%s\"", module_sp->GetArchitecture().AsCString());
s->EOL();
}
diff --git a/source/Symbol/Type.cpp b/source/Symbol/Type.cpp
index 7791a96..886367f 100644
--- a/source/Symbol/Type.cpp
+++ b/source/Symbol/Type.cpp
@@ -85,14 +85,11 @@
void
lldb_private::Type::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_name)
{
- if (show_name)
- {
- if (m_name)
- *s << '\"' << m_name << "\", ";
- }
-
*s << "id = " << (const UserID&)*this;
+ if (show_name && m_name)
+ *s << ", name = \"" << m_name << '"';
+
if (m_byte_size != 0)
s->Printf(", byte-size = %zu", m_byte_size);
@@ -100,9 +97,9 @@
if (m_clang_qual_type)
{
- *s << ", clang_type = " << m_clang_qual_type << ' ';
-
+ *s << ", clang_type = \"";
ClangASTType::DumpTypeDescription (GetClangAST(), m_clang_qual_type, s);
+ *s << '"';
}
else if (m_encoding_uid != LLDB_INVALID_UID)
{
@@ -118,7 +115,7 @@
case eLValueReferenceToTypeWithUID: s->PutCString(" (unresolved L value reference)"); break;
case eRValueReferenceToTypeWithUID: s->PutCString(" (unresolved R value reference)"); break;
}
- }
+ }
}