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)
Fri, May 3, 10:26 AM
Unknown Object (File)
Tue, Apr 30, 11:17 PM
Unknown Object (File)
Sun, Apr 28, 6:51 AM
Unknown Object (File)
Thu, Apr 25, 2:45 AM
Unknown Object (File)
Apr 12 2024, 5:41 AM
Unknown Object (File)
Mar 3 2024, 12:49 PM
Unknown Object (File)
Feb 4 2024, 1:23 PM
Unknown Object (File)
Jan 13 2024, 2:41 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.