Re: [PATCH RFC 0/2] Add basic tracing support for m68k
From: Steven Rostedt
Date: Wed Nov 20 2024 - 10:31:39 EST
On Wed, 20 Nov 2024 12:47:19 +0100
Jean-Michel Hautbois <jeanmichel.hautbois@xxxxxxxxxx> wrote:
> Long story short: it fails at kbuffer_load_subbuffer() call in
> read_cpu_pages().
>
> I added printf in the kbuffer helpers in libevent, and it finishes at:
> __read_long_4: call read_4 at 0x600230c2
> __read_4_sw: ptr=0x8044e2ac
>
> static unsigned int __read_4_sw(void *ptr)
> {
> printf("%s: ptr=%p, value: %08x\n", __func__, ptr, *(unsigned int *)ptr);
> unsigned int data = *(unsigned int *)ptr;
> printf("%s: data=%08x\n", __func__, data);
>
> return swap_4(data);
> }
>
> As soon as ptr is dereferenced, the segfault appears.
> ptr should be ok though, as the address is valid afaik...
But you don't know what ptr it failed on, right?
If dereferencing a pointer will crash, the below line:
printf("%s: ptr=%p, value: %08x\n", __func__, ptr, *(unsigned int *)ptr);
Will crash before printing, because you are dereferencing ptr. Perhaps you
should change this to:
printf("%s: ptr=%p\n" value: %08x\n", __func__, ptr);
printf(" value: %08x\n", *(unsigned int *)ptr);
And that way you will see what 'ptr' is before the crash. Or did you do
that already?
-- Steve
>
> I must say that now I am stuck :-(.