xboard git move crash

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

JonasThiem
Posts: 36
Joined: Sun Sep 02, 2012 5:23 pm

xboard git move crash

Post by JonasThiem »

Hi,

after HGMs remark that my xboard version (4.5) is rather old, I tried to use xboard git and ran into this crash when attempting to make a move in a normal "engine black" game:

bash-4.2$ gdb ./xboard
GNU gdb (GDB) Fedora (7.4.50.20120120-50.fc17)
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/jonas/xboardgit/xboard...done.
(gdb) run -fcp Ildtiadar2
Starting program: /home/jonas/xboardgit/xboard -fcp Ildtiadar2
Detaching after fork from child process 13163.

Program received signal SIGSEGV, Segmentation fault.
_XInternAtom (dpy=dpy@entry=0x9ad5b0,
name=name@entry=0x3 <Address 0x3 out of bounds>, onlyIfExists=0,
psig=psig@entry=0x7fffffffd568, pidx=pidx@entry=0x7fffffffd560,
pn=pn@entry=0x7fffffffd564) at IntAtom.c:79
79 for (s1 = (char *)name; (c = *s1++); )
(gdb) backtrace
#0 _XInternAtom (dpy=dpy@entry=0x9ad5b0,
name=name@entry=0x3 <Address 0x3 out of bounds>, onlyIfExists=0,
psig=psig@entry=0x7fffffffd568, pidx=pidx@entry=0x7fffffffd560,
pn=pn@entry=0x7fffffffd564) at IntAtom.c:79
#1 0x0000003fd362dfba in XInternAtom (dpy=dpy@entry=0x9ad5b0,
name=0x3 <Address 0x3 out of bounds>, onlyIfExists=onlyIfExists@entry=0)
at IntAtom.c:175
#2 0x0000003fd163520f in _XawTextSelectionList (ctx=ctx@entry=0xa03a30,
list=<optimized out>, list@entry=0x7fffffffd608, nelems=1) at Text.c:3119
#3 0x0000003fd1636baa in _XawTextSetSelection (ctx=ctx@entry=0xa03a30, l=3,
r=6, list=0x7fffffffd608, list@entry=0x0, nelems=<optimized out>,
nelems@entry=0) at Text.c:3154
#4 0x0000003fd1637576 in XawTextSetSelection (w=0xa03a30, left=3, right=6)
at Text.c:4004
#5 0x00000000004652fb in HighlightMove (from=3, to=6, highlight=1 '\001')
at xhistory.c:78
#6 0x00000000004650c3 in DoHighlight (index=0, onoff=1) at history.c:175
#7 0x00000000004651b7 in MemoContentUpdated () at history.c:207
#8 0x0000000000465260 in UpdateMoveHistory () at history.c:240
#9 0x00000000004652bf in MoveHistorySet (movelist=0x81cba0, first=0, last=1,
current=0, pvInfo=0x9836c0) at history.c:256
#10 0x00000000004087d0 in HistorySet (movelist=0x81cba0, first=0, last=1,
current=0) at backend.c:1704
---Type <return> to continue, or q <return> to quit---
#11 0x0000000000426ce6 in ShowMove (fromX=1, fromY=0, toX=2, toY=2)
at backend.c:9723
#12 0x000000000041b6f5 in FinishMove (moveType=NormalMove, fromX=1, fromY=0,
toX=2, toY=2, promoChar=0) at backend.c:6903
#13 0x000000000041afc7 in UserMoveEvent (fromX=1, fromY=0, toX=2, toY=2,
promoChar=0) at backend.c:6755
#14 0x000000000041d356 in LeftClick (clickType=Release, xPix=273, yPix=586)
at backend.c:7319
#15 0x000000000046fb37 in Exp (n=-1, x=273, y=586) at dialogs.c:2067
#16 0x0000000000466d46 in GraphEventProc (widget=0x9d25c0,
client_data=0x46f9d1 "UH\211\345H\203\354 \211}\354\211u\350\211U\344\307E\374\375\377\377\377\203", <incomplete sequence \354>, event=0x7fffffffe0c0)
at xoptions.c:568
#17 0x0000003fedc2296e in XtDispatchEventToWidget (
widget=widget@entry=0x9d25c0, event=event@entry=0x7fffffffe0c0)
at Event.c:901
#18 0x0000003fedc22f6e in _XtDefaultDispatcher (event=0x7fffffffe0c0)
at Event.c:1367
#19 0x0000003fedc23034 in XtDispatchEvent (event=event@entry=0x7fffffffe0c0)
at Event.c:1423
#20 0x0000003fedc2ed59 in XtAppProcessEvent (app=app@entry=0x9ac2e0,
mask=mask@entry=15) at NextEvent.c:1400
#21 0x0000003fedc234ad in XtAppMainLoop (app=0x9ac2e0) at Event.c:1554
---Type <return> to continue, or q <return> to quit---
#22 0x000000000045513c in main (argc=3, argv=0x7fffffffe6c8) at xboard.c:1581
(gdb)

My old xboard 4.5.2a doesn't run into this crash.

By the way, you should probably add an --enable-debug option to the ./configure script or something (and enable it by default), I had to hack around with CC="gcc -g" to get debug symbols and a meaningful traceback.
User avatar
hgm
Posts: 27701
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: xboard git move crash

Post by hgm »

Which version exactly is this?
JonasThiem
Posts: 36
Joined: Sun Sep 02, 2012 5:23 pm

Re: xboard git move crash

Post by JonasThiem »

bash-4.2$ ./xboard --version
xboard version master-20120930
bash-4.2$
User avatar
hgm
Posts: 27701
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: xboard git move crash

Post by hgm »

This was the master-20120930 tar ball from the GNU repository? (Unfortunately the number from the help-about does not mean very much, as we only update it on releases...)

From the stack trace you posted, it seems that the crash happens in libXaw, while XBoard tries to 'highlight' the current move in the Move List window. (It does this by selecting the move text, as selected text is displayed in reverse video in asciiTextWidgets.) The parameters to the Xaw call for selecting are quite normal: it selects from 3 to 6. This is what you expect for the first move., a characters 0-2 will be the move number (1 + . + space). The move was most likely something like Nf3.

So it does seem that XBoard makes a valid XawTextSetSelection request to the X-server. I cannot check if the pointer to the widget (w) is valid, but at least it is not 0. So it seems this is a libXaw problem, not an XBoard problem.