Re: [PATCH RFC 0/2] Add basic tracing support for m68k
From: Jean-Michel Hautbois <hidden>
Date: 2024-11-20 15:59:58
Also in:
linux-m68k, lkml
Hi Steve, On 20/11/2024 16:31, Steven Rostedt wrote:
On Wed, 20 Nov 2024 12:47:19 +0100 Jean-Michel Hautbois [off-list ref] wrote:quoted
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?
Yes, I did, sorry I thought it was in the previous dump :-(. kbuffer_load_subbuffer: kbuf 0x8001d520, ptr 0x8025e2a0, call read_8 read_8 swap_8 kbuffer_load_subbuffer: kbuf 0x8001d520, ptr 0x8025e2a8, read_long read_long: call read_long at 0x60022ef4 with 0x8025e2a8 __read_long_4: call read_4 at 0x600230de with 0x8025e2a8 __read_4_sw with 0x8025e2a8 __read_4_sw: ptr=0x8025e2a8, value: 00001ff0 __read_4_sw: data=00001ff0 swap_4 for 00001ff0 __read_long_4: --> read_4 at 0x600230de: f01f0000 __read_4_sw with 0x8025e2a8 __read_4_sw: ptr=0x8025e2a8, value: 00001ff0 __read_4_sw: data=00001ff0 swap_4 for 00001ff0 read_long: --> read_long at 0x60022ef4: f01f0000 __read_long_4: call read_4 at 0x600230de with 0x8025e2a8 __read_4_sw with 0x8025e2a8 __read_4_sw: ptr=0x8025e2a8, value: 00001ff0 __read_4_sw: data=00001ff0 swap_4 for 00001ff0 __read_long_4: --> read_4 at 0x600230de: f01f0000 __read_4_sw with 0x8025e2a8 __read_4_sw: ptr=0x8025e2a8, value: 00001ff0 __read_4_sw: data=00001ff0 swap_4 for 00001ff0 kbuffer_load_subbuffer: --> read_long, flags=f01f0000 kbuffer_load_subbuffer: --> size=1f0000 kbuffer_load_subbuffer: kbuf->data=0x8025e2ac, kbuf->size=1f0000 kbuffer_load_subbuffer: kbuf 0x8001d520, ptr 0x8044e2ac, read_long lost_events read_long: call read_long at 0x60022ef4 with 0x8044e2ac __read_long_4: call read_4 at 0x600230de with 0x8044e2ac __read_4_sw with 0x8044e2ac Segmentation fault JM