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

llvm-svn: 234437
This commit is contained in:
Chaoren Lin
2015-04-08 21:19:12 +00:00
parent 5d6ff3d2ee
commit 7c4f6c4116

View File

@@ -2209,8 +2209,7 @@ Thread::GetDescription (Stream &strm, lldb::DescriptionLevel level, bool print_j
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, lldb::DescriptionLevel level, bool print_j
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;
}