On Fri, 8 Nov 2024 14:03:17 +0100
Jeremie Courreges-Anglas <j...@wxcvbn.org> wrote:

> I can't infer from gkoehler's report and yours whether 32 bits powerpc
> support is fine.

It was fine until I tried switching threads.  gdb-13.2 on powerpc gets
registers from only the 1st thread, so thread switches have the wrong
registers and backtrace.  A fix might be to change
        regcache->ptid ().pid()
to
        get_ptrace_pid (regcache->ptid ())
to match other archs, which I will try later, when I have a few hours
to rebuild gdb.

On powerpc64, gdb-13.2 refusing to run programs or load core dumps was
a regression from 9.2.  I have edited my ppc64-obsd-*.c and my 13.2 now
works about as well as 9.2, so I will mail my patches later.

The attached thregv.c reads a NULL pointer in another thread.

$ cc -g -o thregv thregv.c -lpthread
$ egdb thregv
(gdb) run

It should switch to the thread that "received signal SIGSEGV".  The
thread should be "at thregv.c:11".  Commands like "info thr", "thr 1",
"thr 2" should show them in different functions.
#include <pthread.h>
#include <stdio.h>

/* Will be NULL. */
int *ip;

/* Will read NULL. */
void *
other(void *arg)
{
        printf("%d\n", *ip);
        return NULL;
}

/* Will read NULL in another thread. */
int
main(void)
{
        pthread_t t;

        pthread_create(&t, NULL, other, NULL);
        pthread_join(t, NULL);
}

Reply via email to