Page MenuHomeFreeBSD

[PowerPC] print debugging information on trap signal
ClosedPublic

Authored by alfredo on Aug 7 2020, 10:55 PM.

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
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; 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.