One of the new features in the upcoming Xorg 6.9 release is logging a stack trace to the Xorg log when the X server coredumps. I wrote the code to implement this on Solaris using walkcontext() and dladdr1(). (Very similar to printstack() but I had to call the Xorg logging routines instead of printf to output the data.) You can see it at:
http://cvs.freedesktop.org/xorg/xc/programs/Xserver/hw/xfree86/common/xf86Events.c?r1=1.15&r2=1.16&diff_format=u Unfortunately, it seems this code is running afoul of one of the other Xorg 6.9 improvements - marking symbols with local scope when they don't need to be exported. For instance, I just got this stack trace from a server crash, which couldn't find names for most of the functions: 1: 0xbfb2f8ef: /lib/libc.so.1:<section start>+0x9f8ef 2: 0xbfb25f6c: /lib/libc.so.1:<section start>+0x95f6c ** Signal 11 (SEGV) 3: 0x80ff900: /usr/X11R6/bin/Xorg:xf86memcpy+0x18 4: 0xbf8722f1: /usr/X11R6/lib/xorg/modules/libvbe.so:VBESetGetPaletteData+0xa5 5: 0xbf90346c: /usr/X11R6/lib/xorg/modules/drivers/vesa_drv.so:<section start>+0x346c 6: 0x80ca355: /usr/X11R6/bin/Xorg:<section start>+0x7a355 7: 0x816bcf3: /usr/X11R6/bin/Xorg:<section start>+0x11bcf3 8: 0x80ec180: /usr/X11R6/bin/Xorg:<section start>+0x9c180 9: 0x80cf62c: /usr/X11R6/bin/Xorg:<section start>+0x7f62c 10: 0x814375e: /usr/X11R6/bin/Xorg:<section start>+0xf375e 11: 0x8169c61: /usr/X11R6/bin/Xorg:<section start>+0x119c61 12: 0x80741ac: /usr/X11R6/bin/Xorg:main+0x7d4 13: 0x80738fa: /usr/X11R6/bin/Xorg:_start+0x7a But pstack on the core dump generated found many more symbols: core '/var/core/core.Xorg.19530' of 19530: /usr/X11/bin/Xorg :0 bfb30517 _lwp_kill (1, 6) + 7 bfadcee7 raise (6) + 1f bfac0979 abort (8222340, 8209794, 81e06d4, 1, 804765c, 804765c) + cd 080b1408 AbortDDX (80478e0, bffb2000, 1, 80478e0, bffb2000, 1) + 114 081e07e3 FatalError (81eb87c, b) + 1b7 080cb99a xf86SigHandler (b, 0, 8047938) + ba bfb2f8ef __sighndlr (b, 0, 8047938, 80cb8e0) + f bfb25f6c call_user_handler (b, 0, 8047938) + 22b bfb260ec sigacthandler (b, 0, 8047938) + bb --- called from signal handler with signal 11 (SIGSEGV) --- 080ff900 xf86memcpy (8339fb8, 0, 400) + 18 bf8722f1 VBESetGetPaletteData (82270a8, 1, 0, 100, 0, 0) + a5 bf90346c VESACloseScreen (0, 8246b98) + 84 080ca355 DPMSClose (0, 8246b98) + 8d 0816bcf3 RRCloseScreen (0, 8246b98) + 5f 080ec180 xf86RandRCloseScreen (0, 8246b98) + 78 080cf62c VidModeClose (0, 8246b98) + 74 0814375e CursorCloseScreen (0, 8246b98) + 42 08169c61 AnimCurCloseScreen (0, 8246b98) + 8d 080741ac main (2, 8047dd4, 8047de0) + 7d4 080738fa _start (2, 8047ea0, 8047eb2, 0, 8047eb5, 8047ebc) + 7a elfdump shows the ones I missed are LOCL symbols - is there any good way to get those using dladdr1() or something similar without having to replicate all of pstack's elf file loading? (I note the printstack() man page warns it has this same limitation.) -- -Alan Coopersmith- alan.coopersmith at sun.com Sun Microsystems, Inc. - X Window System Engineering
