I'm playing with X-development. I've got a basic proto-WM going that works for a while and then produces these errors after a fairly random time.
[edit]
Locking assertion failure. Backtrace:
#0 /usr/lib/libxcb-xlib.so.0 [0x7f71dcf9a9ac]
#1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_unlock+0x24) [0x7f71dcf9aa54]
#2 /usr/lib/libX11.so.6 [0x7f71ddefe340]
#3 /usr/lib/libX11.so.6(XAllocColor+0xc1) [0x7f71ddedada1]
#4 /home/mais/code/simplewin/bin/Debug/simplewin [0x408e0b]
#5 /home/mais/code/simplewin/bin/Debug/simplewin [0x409062]
#6 /home/mais/code/simplewin/bin/Debug/simplewin [0x407a9d]
#7 /home/mais/code/simplewin/bin/Debug/simplewin [0x406c6d]
#8 /home/mais/code/simplewin/bin/Debug/simplewin [0x402734]
#9 /home/mais/code/simplewin/bin/Debug/simplewin [0x407e37]
#10 /home/mais/code/simplewin/bin/Debug/simplewin [0x407304]
#11 /home/mais/code/simplewin/bin/Debug/simplewin [0x407335]
#12 /lib/libpthread.so.0 [0x7f71ddc9afc7]
#13 /lib/libc.so.6(clone+0x6d) [0x7f71dd26a59d]
Locking assertion failure. Backtrace:
#0 /usr/lib/libxcb-xlib.so.0 [0x7f71dcf9a9ac]
#1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_lock+0x17) [0x7f71dcf9ab17]
#2 /usr/lib/libX11.so.6 [0x7f71ddefe420]
#3 /usr/lib/libX11.so.6 [0x7f71ddefeb5b]
#4 /usr/lib/libX11.so.6 [0x7f71dde开发者_如何转开发feeb5]
#5 /usr/lib/libX11.so.6(XNextEvent+0x68) [0x7f71ddee5898]
#6 /home/mais/code/simplewin/bin/Debug/simplewin [0x404bc2]
#7 /lib/libpthread.so.0 [0x7f71ddc9afc7]
#8 /lib/libc.so.6(clone+0x6d) [0x7f71dd26a59d]
It looks like some kind of synchronization bug in my app; that much of the time the resources used are released in the correct sequence, but at some stage this get mixed-up and then the error(s) occur.
How do I interpret the above to find the location/cause of the errors?1) build your program with debug symbold (on gcc, pass -g
option)
2) enable core files, and once your application crashes, open it in gdb with core file, and check the backtrace
3) is your application multithreaded and using xlib? If so, you need to enable multi-threading access to the xlib functions.
4) install ddd, and run your application using that (ddd is a gui frontend for the linux debuger gdb)
精彩评论