Don't print a type of variable in Address::Dump if it's unknown (i.e. nullptr)

Summary: This patch fixes dereferencing of nullptr in case when GetType() returns that.

Reviewers: jingham, granata.enrico, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, granata.enrico, clayborg, jingham

Differential Revision: http://reviews.llvm.org/D9274

llvm-svn: 235982
This commit is contained in:
Ilia K 2015-04-28 12:45:57 +00:00
parent d1c6916327
commit 6e46512ec3
1 changed files with 8 additions and 3 deletions

View File

@ -745,10 +745,15 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
if (var && var->LocationIsValidForAddress (*this))
{
s->Indent();
s->Printf (" Variable: id = {0x%8.8" PRIx64 "}, name = \"%s\", type= \"%s\", location =",
s->Printf (" Variable: id = {0x%8.8" PRIx64 "}, name = \"%s\"",
var->GetID(),
var->GetName().GetCString(),
var->GetType()->GetName().GetCString());
var->GetName().GetCString());
Type *type = var->GetType();
if (type)
s->Printf(", type = \"%s\"", type->GetName().GetCString());
else
s->PutCString(", type = <unknown>");
s->PutCString(", location = ");
var->DumpLocationForAddress(s, *this);
s->PutCString(", decl = ");
var->GetDeclaration().DumpStopContext(s, false);