[Lldb-commits] [PATCH] Fix segfault when doing `thread info` on a thread without stop info.

Chaoren Lin chaorenl at google.com
Wed Apr 8 14:12:21 PDT 2015


Hi kubabrecka, clayborg,

E.g., if thread 1 hits a breakpoint, then a `thread info` on thread 2 will cause
a segfault, since thread 2 will have no stop info (intended behavior?).

http://reviews.llvm.org/D8905

Files:
  source/Target/Thread.cpp

Index: source/Target/Thread.cpp
===================================================================
--- source/Target/Thread.cpp
+++ source/Target/Thread.cpp
@@ -2209,22 +2209,25 @@
     strm.Printf("\n");
 
     StructuredData::ObjectSP thread_info = GetExtendedInfo();
-    StructuredData::ObjectSP stop_info = m_stop_info_sp->GetExtendedInfo();
-    
+
     if (print_json_thread || print_json_stopinfo)
     {
         if (thread_info && print_json_thread)
         {
             thread_info->Dump (strm);
             strm.Printf("\n");
         }
-        
-        if (stop_info && print_json_stopinfo)
+
+        if (print_json_stopinfo && m_stop_info_sp)
         {
-            stop_info->Dump (strm);
-            strm.Printf("\n");
+            StructuredData::ObjectSP stop_info = m_stop_info_sp->GetExtendedInfo();
+            if (stop_info)
+            {
+                stop_info->Dump (strm);
+                strm.Printf("\n");
+            }
         }
-        
+
         return true;
     }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8905.23441.patch
Type: text/x-patch
Size: 1019 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150408/a2df60d6/attachment.bin>


More information about the lldb-commits mailing list