[Lldb-commits] Proposed fix for LLDB GUI segfault when continuing with the thread list expanded (bug 26842)

Mark Grimes via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 4 10:18:29 PST 2016


Hi,
I also filed bug 26842 <https://llvm.org/bugs/show_bug.cgi?id=26842>, I
wasn't sure if both a bug report and mail here were required?

As described there, there's a segfault if the list of frames in the
"Threads" GUI window is open and a "continue" is made to somewhere where
the frame list is different.  After filing the bug report it occurred to me
that the segfault might only be triggered if the list of threads also
changes.  I'm not sure but I can provide an example program if required but
I still think it's very easy to reproduce.

The reason the crash occurs is described on the bug report, and a patch of
a proposed fix is attached here.  It's literally two lines - I haven't
added any tests because it's the GUI and requires human interaction, and I
have no idea how to automate that.

Thanks,

Mark.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160304/98c1c816/attachment.html>
-------------- next part --------------
===================================================================
--- source/Core/IOHandler.cpp	(revision 262725)
+++ source/Core/IOHandler.cpp	(working copy)
@@ -3309,6 +3309,7 @@
                     
                     TreeItem t (&item, *m_frame_delegate_sp, false);
                     size_t num_frames = thread_sp->GetStackFrameCount();
+                    item.ClearChildren(); // Clear first so that "t" is applied to all elements in the Resize
                     item.Resize (num_frames, t);
                     for (size_t i=0; i<num_frames; ++i)
                     {
@@ -3419,6 +3420,7 @@
                 ThreadList &threads = process_sp->GetThreadList();
                 Mutex::Locker locker (threads.GetMutex());
                 size_t num_threads = threads.GetSize();
+                item.ClearChildren(); // Clear first so that "t" is applied to all elements in the Resize
                 item.Resize (num_threads, t);
                 for (size_t i=0; i<num_threads; ++i)



More information about the lldb-commits mailing list