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)


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)
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to