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

Simon Marchi
2026-03-25T15:18:18Z

On 2026-03-25 07:56, Ulrich Weigand wrote:
> Simon Marchi <simon.marchi@polymtl.ca> wrote:
>> 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.
>
> Isn't this actually what happens with Aditya's latest patch?
> Given that sync_threadlists is no longer called, all threads
> should remain in the state common code set up for them initially,
> which I think would be THREAD_STOPPED?
>
> Bye,
> Ulrich

Ah ok, I didn't catch that, but now that I re-read the commit message it
indeed sounds like it, thanks.

Simon