Allow the built in ValueObject summary providers for C strings
use lldb_private::Target::ReadMemory(...) to allow constant strings
to be displayed in global variables prior on in between process
execution.
Centralized the variable declaration dumping into:
bool
Variable::DumpDeclaration (Stream *s, bool show_fullpaths, bool show_module);
Fixed an issue if you used "target variable --regex <regex>" where the
variable name would not be displayed, but the regular expression would.
Fixed an issue when viewing global variables through "target variable"
might not display correctly when doing DWARF in object files.
llvm-svn: 134878
diff --git a/lldb/source/Symbol/Declaration.cpp b/lldb/source/Symbol/Declaration.cpp
index 2b20a24..3943f02 100644
--- a/lldb/source/Symbol/Declaration.cpp
+++ b/lldb/source/Symbol/Declaration.cpp
@@ -46,7 +46,7 @@
}
}
-void
+bool
Declaration::DumpStopContext (Stream *s, bool show_fullpaths) const
{
if (m_file)
@@ -62,15 +62,18 @@
if (m_column > 0)
s->Printf(":%u", m_column);
#endif
+ return true;
}
- else
+ else if (m_line > 0)
{
s->Printf(" line %u", m_line);
#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
if (m_column > 0)
s->Printf(":%u", m_column);
#endif
+ return true;
}
+ return false;
}
size_t
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index 2a56c34..1f24f13 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -110,7 +110,7 @@
symbol = NULL;
}
-void
+bool
SymbolContext::DumpStopContext
(
Stream *s,
@@ -121,6 +121,7 @@
bool show_inlined_frames
) const
{
+ bool dumped_something = false;
if (show_module && module_sp)
{
if (show_fullpaths)
@@ -128,18 +129,25 @@
else
*s << module_sp->GetFileSpec().GetFilename();
s->PutChar('`');
+ dumped_something = true;
}
if (function != NULL)
{
if (function->GetMangled().GetName())
+ {
+ dumped_something = true;
function->GetMangled().GetName().Dump(s);
+ }
if (addr.IsValid())
{
const addr_t function_offset = addr.GetOffset() - function->GetAddressRange().GetBaseAddress().GetOffset();
if (function_offset)
- s->Printf(" + %llu", function_offset);
+ {
+ dumped_something = true;
+ s->Printf(" + %llu", function_offset);
+ }
}
if (block != NULL)
@@ -147,11 +155,13 @@
s->IndentMore();
block->DumpStopContext (s, this, NULL, show_fullpaths, show_inlined_frames);
s->IndentLess();
+ dumped_something = true;
}
else
{
if (line_entry.IsValid())
{
+ dumped_something = true;
s->PutCString(" at ");
if (line_entry.DumpStopContext(s, show_fullpaths))
return;
@@ -160,19 +170,28 @@
}
else if (symbol != NULL)
{
- symbol->GetMangled().GetName().Dump(s);
+ if (symbol->GetMangled().GetName())
+ {
+ dumped_something = true;
+ symbol->GetMangled().GetName().Dump(s);
+ }
if (addr.IsValid() && symbol->GetAddressRangePtr())
{
const addr_t symbol_offset = addr.GetOffset() - symbol->GetAddressRangePtr()->GetBaseAddress().GetOffset();
if (symbol_offset)
- s->Printf(" + %llu", symbol_offset);
+ {
+ dumped_something = true;
+ s->Printf(" + %llu", symbol_offset);
+ }
}
}
else if (addr.IsValid())
{
addr.Dump(s, exe_scope, Address::DumpStyleModuleWithFileAddress);
+ dumped_something = true;
}
+ return dumped_something;
}
void
diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp
index a8ebe85..6401869 100644
--- a/lldb/source/Symbol/Variable.cpp
+++ b/lldb/source/Symbol/Variable.cpp
@@ -142,6 +142,32 @@
s->EOL();
}
+bool
+Variable::DumpDeclaration (Stream *s, bool show_fullpaths, bool show_module)
+{
+ bool dumped_declaration_info = false;
+ if (m_owner_scope)
+ {
+ SymbolContext sc;
+ m_owner_scope->CalculateSymbolContext(&sc);
+ sc.block = NULL;
+ sc.line_entry.Clear();
+ bool show_inlined_frames = false;
+
+ dumped_declaration_info = sc.DumpStopContext (s,
+ NULL,
+ Address(),
+ show_fullpaths,
+ show_module,
+ show_inlined_frames);
+
+ if (sc.function)
+ s->PutChar(':');
+ }
+ if (m_declaration.DumpStopContext (s, false))
+ dumped_declaration_info = true;
+ return dumped_declaration_info;
+}
size_t
Variable::MemorySize() const