Re: [PATCH v2] Fix asertion failure while analysing core files in AIX with terminated threads.

Simon Marchi
2026-03-24T16:13:11Z

On 3/24/26 10:15 AM, Aditya Vidyadhar Kamath wrote:
> 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.

Looking at how it works on Linux, the threads are in state
THREAD_STOPPED when looking at a core dump. I think that THREAD_STOPPED
makes sense, because when looking at a core, you are looking at a
snapshot of the process state when it was still alive, with all threads
stopped.

Could the AIX target do the same? I think it would be nice for
consistency across targets.

Simon