Wook's persistent Therion bug
Wookey
wookey at aleph1.co.uk
Sun Jun 20 14:14:33 CEST 2004
I spent some hours last week (whilst in a cottage in wales), trying to track
down the problem I have with Therion not liking my data any more. Here is
what I discovered, which I hope will give you a clue, or suggest some more
tests for me to do because I am out of ideas.
In summary the problem exists in 0.2.19 and 0.3.1 so it's not a feature of
the new version as I first thought. And as 0.2.19 _used_ to work then
ewither it's a bug in underlying libraries or my data/environment has
changed in some way.
All the gdb testing has been done in 0.3.1. There are two bugs: 'invalid
command context' on the first 'end*' command and a segfault if I use 'end
centreline' instead of 'endcentreline'.
I have found the function the segfault occurs in but no more. And the
'invalid command context' thing has been tracked down to the 'wrong' context
value (NONE, SURVEY, SCRAP) being set when the endcommand happens, but I
don't understand what this context is or enough about C++ to know how it
might go wrong. The reading of the data seems to be OK so far as I can tell
from using GDB.
Here are my notes giving the details of what I did:
debugging therion soundriver problem 2004.06.17
soundriver.th gives 'invalid command context' with v0.2.19 and 0.3.1 at
first 'end' command (endmap, endcenterline). If I change endcenterline to
'end centerline' then I get a segfault instead.
The top of the file looks like:
encoding utf-8
# map elevator -title "Terikan River Cave: Elevator Entrance"
# farside at river
# farside2 at river
# endmap
#connections
# join farside at river farside2 at river
join farsidewest1 at river farsidewest2 at river
join fsceil1 at river:0 farsidewest3 at river:7
centerline
equate 17 at evening 53 at river
equate 24 at evening 1 at river
#*equate 4 at river2 6 at evening ; was it stn 6 cairn? closure suggests not
equate 1 at rifticious 2 at evening
equate 5 at rifticious 12 at evening
equate 1 at pooh 50 at river
equate 22 at rifticious 1 at rifticious2
equate 10 at penthouse 27 at river
end centerline
Backtracing with gdb produces:
reading input -- soundriver.th
open file -- soundriver.th
Program received signal SIGSEGV, Segmentation fault.
0x0806fe92 in thsurvey::get_decdef (this=0x0) at thsurvey.h:239
239 bool get_decdef() { return this->decdef; }
the backtrace looks like this:
(gdb) bt
#0 0x0806fe92 in thsurvey::get_decdef (this=0x0) at thsurvey.h:239
#1 0x0806f5a2 in thdata::set_survey_declination (this=0x819da20) at
thdata.cxx:1996
#2 0x0806c605 in thdata::insert_data_leg (this=0x819da20, nargs=2,
args=0x8195798) at thdata.cxx:1370
#3 0x080676d6 in thdata::set (this=0x819da20, cod={id = 0, nargs = 1},
args=0xbffffa60, argenc=6, indataline=1) at thdata.cxx:223
#4 0x08063c16 in thdatareader::read (this=0x818b420, ifname=0x8197b70
"soundriver.th",
spath=0x819b6a0
"/home/wookey/.therion:/usr/share/therion:/usr/local/share/therion",
dbptr=0x818b200) at thdatareader.cxx:119
#5 0x0810c1ef in main (argc=1, argv=0xbffffb34) at therion.cxx:254
(gdb)
Now I changed the file to this:
encoding utf-8
map elevator -title "Terikan River Cave: Elevator Entrance"
farside at river
farside2 at river
endmap
#connections
# join farside at river farside2 at river
join farsidewest1 at river farsidewest2 at river
join fsceil1 at river:0 farsidewest3 at river:7
centerline
equate 17 at evening 53 at river
equate 24 at evening 1 at river
#*equate 4 at river2 6 at evening ; was it stn 6 cairn? closure suggests not
equate 1 at rifticious 2 at evening
equate 5 at rifticious 12 at evening
equate 1 at pooh 50 at river
equate 22 at rifticious 1 at rifticious2
equate 10 at penthouse 27 at river
endcenterline
stepping through to find out why 'invalid command context occurs on 'endmap'
we find that 'endmap' matches at thdatareader::read line 87 and then barf
happens at line 91
dbptr->insert(objptr);
because in thdatabase::insert, line 159
if ((optr->get_context() & this->ccontext) == 0)
(gdb) print optr->get_context()
$2 = 2 -i.e THCTX_SURVEY
(gdb) print this->ccontext
$3 = 1 i.e THCTX_NONE
(gdb) print (optr->get_context() & this->ccontext)
$4 = 0
so we get "invalid command context".
I don't really understand what this context stuff is about but maybe this
will be a clue.
Wookey
--
Aleph One Ltd, Bottisham, CAMBRIDGE, CB5 9BA, UK Tel +44 (0) 1223 811679
work: http://www.aleph1.co.uk/ play: http://www.chaos.org.uk/~wookey/
More information about the Therion
mailing list