NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/51322: Prevent compiler optimizing out variables used in KASSERTs



>Number:         51322
>Category:       kern
>Synopsis:       Prevent compiler optimizing out variables used in KASSERTs
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 07 09:55:00 +0000 2016
>Originator:     coypu
>Release:        NetBSD-7.99.33
>Organization:
>Environment:
NetBSD net.Home 7.99.33 NetBSD 7.99.33 (GENERIC-USBDEBUG) #0: Thu Jul  7 11:46:54 IDT 2016  fly%net.Home@localhost:/obj/amd64/sys/arch/amd64/compile/GENERIC-USBDEBUG amd64
>Description:
Get some kernel panic, e.g.:
System panicked: kernel diagnostic assertion "err == USBD_NORMAL_COMPLETION" failed: file "/cvs/src/sys/dev/usb/xhci.c", line 2532

Try to look at the core dump with gdb, get:

(gdb) info locals
trb = {trb_0 = 4806750208, trb_2 = 0, trb_3 = 83899392}
err = <optimized out>

Makes it hard to know why the assert failed.
>How-To-Repeat:

>Fix:
It seems using asm may force gcc to not optimize things, but it's
probably not the right way.



Home | Main Index | Thread Index | Old Index