]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Use thread_info_ref in enable_thread_stack_temporaries
authorTom Tromey <tom@tromey.com>
Fri, 11 Dec 2020 16:21:53 +0000 (09:21 -0700)
committerTom Tromey <tom@tromey.com>
Fri, 11 Dec 2020 16:21:53 +0000 (09:21 -0700)
This changes enable_thread_stack_temporaries to use a thread_info_ref,
removing some manual reference counting.

gdb/ChangeLog
2020-12-11  Tom Tromey  <tom@tromey.com>

* gdbthread.h (class enable_thread_stack_temporaries) <m_thr>:
Change type.

gdb/ChangeLog
gdb/gdbthread.h

index 4533a6a7b8b9f215d25cdd07f0ea345848fc443c..732a1cf0956a2c4692f5ccc4a0440a83c905d1e5 100644 (file)
@@ -1,3 +1,8 @@
+2020-12-11  Tom Tromey  <tom@tromey.com>
+
+       * gdbthread.h (class enable_thread_stack_temporaries) <m_thr>:
+       Change type.
+
 2020-12-11  Tom Tromey  <tromey@adacore.com>
 
        * ada-tasks.c (struct ada_tasks_pspace_data) <cpu_id_offset>: New
index e5484ac54ca44a800aa37a8919b0c6e5eae8ccf4..386b50a7e77e65efd5941203b2b21ee3cbb9e4f9 100644 (file)
@@ -711,12 +711,8 @@ class enable_thread_stack_temporaries
 public:
 
   explicit enable_thread_stack_temporaries (struct thread_info *thr)
-    : m_thr (thr)
+    : m_thr (thread_info_ref::new_reference (thr))
   {
-    gdb_assert (m_thr != NULL);
-
-    m_thr->incref ();
-
     m_thr->stack_temporaries_enabled = true;
     m_thr->stack_temporaries.clear ();
   }
@@ -725,15 +721,13 @@ public:
   {
     m_thr->stack_temporaries_enabled = false;
     m_thr->stack_temporaries.clear ();
-
-    m_thr->decref ();
   }
 
   DISABLE_COPY_AND_ASSIGN (enable_thread_stack_temporaries);
 
 private:
 
-  struct thread_info *m_thr;
+  thread_info_ref m_thr;
 };
 
 extern bool thread_stack_temporaries_enabled_p (struct thread_info *tp);