Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 2/2] Fix uninitialised fields in aix_thread_variables structure.
@ 2026-09-18 12:20 Aditya Vidyadhar Kamath
  2026-09-18 13:48 ` Ulrich Weigand
  0 siblings, 1 reply; 2+ messages in thread
From: Aditya Vidyadhar Kamath @ 2026-09-18 12:20 UTC (permalink / raw)
  To: ulrich.weigand, simon.marchi, tom
  Cc: gdb-patches, Aditya.Kamath1, sangamesh.swamy, Aditya Vidyadhar Kamath

From: Aditya Vidyadhar Kamath <aditya.kamath1@ibm.com>

The fields in aix_thread_variables structure were never initialised.

So we initialise them and also change to bool since they are
purely flags.

This patch updates all assignment sites to use true or false
accordingly.
---
 gdb/aix-thread.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index b4b9efca5d4..0602fc3a8f3 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -165,21 +165,21 @@ static pthdb_callbacks_t pd_callbacks = {
 struct aix_thread_variables
 {
   /* Whether the current application is debuggable by pthdb.  */
-  int pd_able;
+  bool pd_able = false;
 
   /* Whether a threaded application is being debugged.  */
-  int pd_active;
+  bool pd_active = false;
 
   /* Current pthdb session.  */
-  pthdb_session_t pd_session;
+  pthdb_session_t pd_session = 0;
 
   /* Address of the function that libpthread will call when libpthdebug
    is ready to be initialized.  */
-  CORE_ADDR pd_brk_addr;
+  CORE_ADDR pd_brk_addr = 0;
 
   /* Whether the current architecture is 64-bit.
    Only valid when pd_able is true.  */
-  int arch64;
+  bool arch64 = false;
 
   /* Describes the number of thread exit events reported.  */
   std::unordered_set<pthdb_pthread_t> exited_threads;
@@ -839,7 +839,7 @@ pd_activate (pid_t pid)
 			       PTHDB_FLAG_REGS, &pd_callbacks,
 			       &data->pd_session);
   if (status == PTHDB_SUCCESS)
-    data->pd_active = 1;
+    data->pd_active = true;
 }
 
 /* AIX implementation of update_thread_list.  */
@@ -904,7 +904,7 @@ pd_enable (inferior *inf)
 
   /* Prepare for thread debugging.  */
   current_inferior ()->push_target (&aix_thread_ops);
-  data->pd_able = 1;
+  data->pd_able = true;
 
   /* If we're debugging a core file or an attached inferior, the
      pthread library may already have been initialized, so try to
@@ -927,8 +927,8 @@ pd_disable (inferior *inf)
   pthdb_session_destroy (data->pd_session);
 
   pid_to_prc (&inferior_ptid);
-  data->pd_active = 0;
-  data->pd_able = 0;
+  data->pd_active = false;
+  data->pd_able = false;
   current_inferior ()->unpush_target (&aix_thread_ops);
 }
 
-- 
2.51.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-18 13:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-18 12:20 [PATCH 2/2] Fix uninitialised fields in aix_thread_variables structure Aditya Vidyadhar Kamath
2026-09-18 13:48 ` Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox