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.
Approved-By: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
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. */