Page MenuHomeFreeBSD

[PowerPC] print debugging information on trap signal
ClosedPublic

Authored by alfredo on Aug 7 2020, 10:55 PM.
Referenced Files
Unknown Object (File)
Nov 22 2024, 8:18 PM
Unknown Object (File)
Nov 22 2024, 8:17 PM
Unknown Object (File)
Nov 6 2024, 4:29 PM
Unknown Object (File)
Nov 3 2024, 2:39 PM
Unknown Object (File)
Oct 23 2024, 9:23 AM
Unknown Object (File)
Oct 4 2024, 11:25 PM
Unknown Object (File)
Oct 4 2024, 6:54 PM
Unknown Object (File)
Oct 2 2024, 7:18 AM
Subscribers

Details

Summary

Add support for sysctl 'machdep.uprintf_signal' that prints debugging information on trap signal, as used in other platforms.

User can enable it with "sysctl -w machdep.uprintf_signal=1"

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

alfredo created this revision.

Looks good, very similar to amd64 code.
But if you want to make it equivalent to amd64 code, you could also print SP, PC (that would be frame->fixreg[1] and frame->srr0, I think) and the word (or maybe the first 2 words) at frame->srr0.

This revision is now accepted and ready to land.Aug 11 2020, 11:36 AM

added frame->srr0, frame->srr1 and frame->fixreg[1] to output

This revision now requires review to proceed.Sep 4 2020, 11:18 AM
sys/powerpc/powerpc/trap.c
501 ↗(On Diff #76642)

This will fail to build on ppc32.

Building /usr/obj/usr/src/powerpc.powerpc/sys/GENERIC/modules/usr/src/sys/modules/usb/urndis/if_urndis.ko.full
--- trap.o ---
/usr/src/sys/powerpc/powerpc/trap.c:501:43: error: format specifies type 'unsigned long' but the argument has type 'register_t' (aka 'int') [-Werror,-Wformat]
                        p->p_pid, p->p_comm, sig, ucode, type, addr,
                                                               ^~~~
/usr/src/sys/powerpc/powerpc/trap.c:502:4: error: format specifies type 'unsigned long' but the argument has type 'register_t' (aka 'int') [-Werror,-Wformat]
                        frame->fixreg[1], frame->srr0, frame->srr1);
                        ^~~~~~~~~~~~~~~~
/usr/src/sys/powerpc/powerpc/trap.c:502:22: error: format specifies type 'unsigned long' but the argument has type 'register_t' (aka 'int') [-Werror,-Wformat]
                        frame->fixreg[1], frame->srr0, frame->srr1);
                                          ^~~~~~~~~~~
/usr/src/sys/powerpc/powerpc/trap.c:502:35: error: format specifies type 'unsigned long' but the argument has type 'register_t' (aka 'int') [-Werror,-Wformat]
                        frame->fixreg[1], frame->srr0, frame->srr1);
                                                       ^~~~~~~~~~~

Need to cast the registers to unsigned long.

506 ↗(On Diff #76642)

Extra newline.

cast to u_long fixing build on 32 bit

alfredo marked an inline comment as done.

remove extra new line

@bdragon thank you for pointing out the 32 bit build issue!

This revision is now accepted and ready to land.Oct 7 2020, 2:50 PM
This revision was automatically updated to reflect the committed changes.