Author: chaoren Date: Wed Apr 8 16:19:12 2015 New Revision: 234437 URL: http://llvm.org/viewvc/llvm-project?rev=234437&view=rev Log: Fix segfault when doing `thread info` on a thread without stop info.
Summary: 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?). Reviewers: kubabrecka, clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D8905 Modified: lldb/trunk/source/Target/Thread.cpp Modified: lldb/trunk/source/Target/Thread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=234437&r1=234436&r2=234437&view=diff ============================================================================== --- lldb/trunk/source/Target/Thread.cpp (original) +++ lldb/trunk/source/Target/Thread.cpp Wed Apr 8 16:19:12 2015 @@ -2209,8 +2209,7 @@ Thread::GetDescription (Stream &strm, ll 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) @@ -2218,13 +2217,17 @@ Thread::GetDescription (Stream &strm, ll 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; } _______________________________________________ lldb-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
