Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH v2] Fix asertion failure while analysing core files in AIX with terminated threads.
@ 2026-03-24 14:15 Aditya Vidyadhar Kamath
  2026-03-24 16:12 ` Simon Marchi
  2026-03-25 16:06 ` Ulrich Weigand
  0 siblings, 2 replies; 6+ messages in thread
From: Aditya Vidyadhar Kamath @ 2026-03-24 14:15 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>

If we analyse core files today in AIX ( few of them ) we get,
  regcache.c:432: internal-error: get_thread_regcache:
  Assertion `thread->state != THREAD_EXITED' failed.

The reason being the aix-thread.c file where root cause is the sync_threadlists()
function. When reading an AIX core file, threads are reported by
libpthread library as being in PST_TERM (terminated) state, which
is correct since process crashed. However, sync_threadlists() was
calling delete_thread() for these terminated threads, marking them
as THREAD_EXITED in GDBs internal state.

Later, when GDB tried to fetchregisters or access frame information
for these threads during core file analysis, it would hit an
assertion in get_thread_regcache() that prevents accessing exited threads.

In AIX we see this in 7.3 from any python3 core file dumps.

The fix is to call sync_threadlists () only for a program in execution and
not for core files.
---
 gdb/aix-thread.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index c2e6b6d2bd6..5469ddca4f7 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -884,7 +884,11 @@ pd_update (pid_t pid)
   if (status != PTHDB_SUCCESS)
     return ptid_t (pid);
 
-  sync_threadlists (pid);
+  /* Attempt to sync_threadlists () only when debugging object files
+     and not core files since list of threads never change for core
+     files.  */
+  if (target_has_execution ())
+    sync_threadlists (pid);
 
   /* Define "current thread" as one that just received a trap signal.  */
 
-- 
2.41.0


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

end of thread, other threads:[~2026-03-26 10:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-24 14:15 [PATCH v2] Fix asertion failure while analysing core files in AIX with terminated threads Aditya Vidyadhar Kamath
2026-03-24 16:12 ` Simon Marchi
2026-03-25 11:56   ` Ulrich Weigand
2026-03-25 15:17     ` Simon Marchi
2026-03-25 16:06 ` Ulrich Weigand
2026-03-26 10:10   ` Aditya Kamath

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