[AD] Strange crash with recent WIP

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hi.

I have some strange problems with the latest WIPs, all Allegro examples
and test programs crash under framebuffer, they run fine under X. This is
the gdb session of exhello compiled against a static debug version of
Allegro:

 Starting program: /mnt/g/cvs/libs/allegro/examples/exhello
 [New Thread 8156 (manager thread)]
 [New Thread 8155 (initial thread)]
 [New Thread 8157]
 
 Program received signal SIGSEGV, Segmentation fault.
 0x80701a7 in need_uconvert (s=0x1031 <Address 0x1031 out of bounds>, type=1095975736, newtype=1431586360) at ./src/unicode.c:603
 603              c = *((unsigned char *)(s++));
 (gdb) SysRq: Keyboard mode set to XLATE
 (gdb) bt
 #0  0x80701a7 in need_uconvert (s=0x1031 <Address 0x1031 out of bounds>, type=1095975736, newtype=1431586360) at ./src/unicode.c:603
 #1  0x80703be in uconvert (s=0x1031 <Address 0x1031 out of bounds>, type=1095975736,
     buf=0xbffff4b4 "äôÿ¿uA\a\bìôÿ¿Dü\006\b\237õÿ¿\200õÿ¿4ÿ\006\bð·\016\bj", newtype=1668641326, size=256) at ./src/unicode.c:690
 #2  0x805e894 in get_config_text (msg=0x1031 <Address 0x1031 out of bounds>) at ./src/config.c:1119
 #3  0x8068123 in set_gfx_mode (card=0, w=320, h=200, v_w=0, v_h=0) at ./src/graphics.c:591
 #4  0x80678ef in set_gfx_mode (card=1396786757, w=320, h=200, v_w=0, v_h=0) at ./src/graphics.c:403
 #5  0x80578f2 in _mangled_main () at exhello.c:22
 #6  0x807660f in main (argc=1, argv=0xbffffcac) at ./src/unix/umain.c:39
 (gdb) f 3
 #3  0x8068123 in set_gfx_mode (card=0, w=320, h=200, v_w=0, v_h=0) at ./src/graphics.c:591
 591                    gfx_driver->name = gfx_driver->desc = get_config_text(gfx_driver->ascii_name);
 (gdb) print c
 $1 = 0
 (gdb) print driver_list[c]
 $2 = {id = 134660904, driver = 0x80e3418, autodetect = 16}
 (gdb) The program is running.  Exit anyway? (y or n) y
 
 [gregorio:26] [~/cvs/libs/allegro/examples]$ python
 
 Python 1.5.2 (#0, Dec 27 2000, 13:59:38)  [GCC 2.95.2 20000220 (Debian GNU/Linux)] on linux2
 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
 >>> chr (134660904 & 0xff)
 '('
 >>> chr ((134660904 & 0xff00) >> 8)
 '\303'
 >>> chr ((134660904 & 0xff0000) >> 16)
 '\006'
 >>> chr ((134660904 & 0xff000000) >> 24)
 '\010'
 >>> print chr ((134660904 & 0xff00) >> 8)
 Ã

As you see from the above output, set_gfx_mode crashes trying to use a
strange nonexistant driver (according to that id, and unless I am doing
something really stupid to decompose the ASCII sequence), and uconvert
crashes with a wrong char pointer.

The same happens with a shared release version, only that I can't debug
it, it doesn't core (presumably because of the threads), and the keyboard
isn't restored after the crash, so I am forced to use alt+sys+r too.

I tried linking against electric fence (the static debug version), and the
strangest thing is that it doesn't core immediately: it tries to exit as
if I didn't have any graphic driver and then fails at some free call in
the drvlist.c code. 

 ...
 Fatal error: unable to set GFX_SAFE
 Unable to set any graphic mode
 Unable to find a suitable graphics driver
 
 ElectricFence Aborting: free(4093bff4): address not from malloc().
 
 Program received signal SIGILL, Illegal instruction.
 0x40120921 in kill () from /lib/libc.so.6
 (gdb) SysRq: Keyboard mode set to XLATE
 
 (gdb) bt
 #0  0x40120921 in kill () from /lib/libc.so.6
 #1  0x400ffc56 in EF_Abort () from /usr/lib/libefence.so.0
 #2  0x400ff5e1 in free () from /usr/lib/libefence.so.0
 #3  0x808ccca in _destroy_driver_list (drvlist=0x4093bff4) at ./src/drvlist.c:60
 #4  0x8087f54 in sys_linux_exit () at ./src/linux/lsystem.c:266
 #5  0x8057e73 in allegro_exit () at ./src/allegro.c:379
 #6  0x40122da5 in exit () from /lib/libc.so.6
 #7  0x4011aa48 in __libc_start_main () from /lib/libc.so.6

Also, while debugging I found out that removing the install_keyboard from
the example makes the program run until line 592 from graphics.c, which is
one line after the uconvert call:

 Starting program: /mnt/g/cvs/libs/allegro/examples/exhello
 [New Thread 8367 (manager thread)]
 [New Thread 8366 (initial thread)]
 [New Thread 8368]
 
 Program received signal SIGSEGV, Segmentation fault.
 0x401d488c in __morecore () from /lib/libc.so.6
 (gdb) SysRq: Keyboard mode set to XLATE
 
 (gdb) bt
 #0  0x401d488c in __morecore () from /lib/libc.so.6
 #1  0x806815f in set_gfx_mode (card=0, w=4718912, h=200, v_w=0, v_h=0) at ./src/graphics.c:592
 #2  0x80678ef in set_gfx_mode (card=1396786757, w=320, h=200, v_w=0, v_h=0) at ./src/graphics.c:403
 #3  0x80578ed in _mangled_main () at exhello.c:22 
 #4  0x807660f in main (argc=1, argv=0xbffffcac) at ./src/unix/umain.c:39 
 (gdb) f 1
 #1  0x806815f in set_gfx_mode (card=0, w=4718912, h=200, v_w=0, v_h=0) at ./src/graphics.c:592
 592                    screen = gfx_driver->init(w, h, v_w, v_h, _color_depth);
 
I tried returning back in time with cvs to "10 days ago" (this cvs thing
is really wonderful), which is "Sticky Date: 2001.06.15.21.42.28", and
everything works correctly, both under fb and X. Since the only recent
changes were made to the unicode API and the dynamic modules system, I
think the latter is the culprit, especially since X works correctly under
every situation with the latest WIP, but it may be another thing, of
course.

Any suggestions on what should I do next to find where's the problem?

PD: While testing I "lost" two consoles (tty2 and 3). They don't answer
even to alt+sys+r/k. Relaunching getty manually doesn't help either, they
simply don't work. Does somebody know how to regain its control?

--
 Grzegorz Adam Hankiewicz   gradha@xxxxxxxxxx   http://gradha.infierno.org



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/