[Lldb-commits] [PATCH] D79174: [LLDB] Initialize "ThreadPlanTracer::m_thread" to avoid undefined behavior

Vangelis Tsiatsianas via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 30 07:21:25 PDT 2020


vangelists created this revision.
vangelists added a reviewer: jingham.
vangelists added a project: LLDB.
Herald added a subscriber: lldb-commits.

The `m_thread` field of `ThreadPlanTracer` is not initialized by the constructor leading to undefined behavior in `ThreadPlanTracer::GetThread()`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79174

Files:
  lldb/source/Target/ThreadPlanTracer.cpp


Index: lldb/source/Target/ThreadPlanTracer.cpp
===================================================================
--- lldb/source/Target/ThreadPlanTracer.cpp
+++ lldb/source/Target/ThreadPlanTracer.cpp
@@ -35,11 +35,12 @@
 
 ThreadPlanTracer::ThreadPlanTracer(Thread &thread, lldb::StreamSP &stream_sp)
     : m_process(*thread.GetProcess().get()), m_tid(thread.GetID()),
-      m_single_step(true), m_enabled(false), m_stream_sp(stream_sp) {}
+      m_single_step(true), m_enabled(false), m_stream_sp(stream_sp),
+      m_thread(nullptr) {}
 
 ThreadPlanTracer::ThreadPlanTracer(Thread &thread)
     : m_process(*thread.GetProcess().get()), m_tid(thread.GetID()),
-      m_single_step(true), m_enabled(false), m_stream_sp() {}
+      m_single_step(true), m_enabled(false), m_stream_sp(), m_thread(nullptr) {}
 
 Stream *ThreadPlanTracer::GetLogStream() {
   if (m_stream_sp)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79174.261216.patch
Type: text/x-patch
Size: 877 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200430/6d8a7159/attachment.bin>


More information about the lldb-commits mailing list