diff options
author | Ilia K <ki.stfu@gmail.com> | 2015-04-28 12:45:57 +0000 |
---|---|---|
committer | Ilia K <ki.stfu@gmail.com> | 2015-04-28 12:45:57 +0000 |
commit | 6e46512ec3a7f0b6481346e1148100ab0515943a (patch) | |
tree | 803a22751881706dff5591b5052b9bb463c6601c | |
parent | d1c6916327d622f78d6dad123b1305b2b69d0551 (diff) | |
download | bcm5719-llvm-6e46512ec3a7f0b6481346e1148100ab0515943a.tar.gz bcm5719-llvm-6e46512ec3a7f0b6481346e1148100ab0515943a.zip |
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
-rw-r--r-- | lldb/source/Core/Address.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp index 3cc6c8a8bbb..6d4e2ff8982 100644 --- a/lldb/source/Core/Address.cpp +++ b/lldb/source/Core/Address.cpp @@ -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); |