Author: ki.stfu
Date: Tue Apr 28 07:45:57 2015
New Revision: 235982

URL: http://llvm.org/viewvc/llvm-project?rev=235982&view=rev
Log:
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

Modified:
    lldb/trunk/source/Core/Address.cpp

Modified: lldb/trunk/source/Core/Address.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=235982&r1=235981&r2=235982&view=diff
==============================================================================
--- lldb/trunk/source/Core/Address.cpp (original)
+++ lldb/trunk/source/Core/Address.cpp Tue Apr 28 07:45:57 2015
@@ -745,10 +745,15 @@ Address::Dump (Stream *s, ExecutionConte
                         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);


_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to