I have eliminated most of the Purify warnings that were fairly benign,
which leaves the ones that really matter. First order of business,
savegames:

All tests are done with KQ4 in the opening scene.

0. There are no Purify warnings whatsoever (now) when saving games. This
is because I make sure everything is initialized properly when allocated.
A patch is forthcoming.

1. vm.c, around line 1619. The call to free(s) causes an exception because
it appears to be an invalid pointer. Why, I have no idea. I will have to
step through the code to figure out when s gets changed/free'd before this
line.

2. The PUT_HEAP @ vm.c around line 526 causes an array bounds read of 2
bytes. The interesting things here are that s->execution_stack_pos is -1,
and execution_stack_base is 0. xs->argc is 721031, and the variables[] are
1793, 24, 44718, and 44718.

After that, there are bad pointer writes, etc. This is where the problem
appears to begin.

When I try to restore the game from within KQ4, I see:

Restarting with replay()
Send: No object at 1fe8!
Memtesting E:\src\freesci\src\engine\vm.c: line 1635
Memtest succeeded!
pc=0000 acc=0001 o=0000 fp=aeae sp=0000
prev=1 sbase=73ea globls=323c &restmod=0
Step #40022
0000: [W] bnot
>bt
Call stack (current base: 0):



When I specify the savegame at the commandline, I see:

Restoring savegame 'save_0'...
Send: No object at 59c0!
pc=5bd5 acc=59c0 o=1fe8 fp=73f4 sp=73f6
prev=1 sbase=73ea globls=323c &restmod=0
Step #45
5bd5: [W] send 04
  <invalid>::species[VAR]()
>bt
Call stack (current base: 0):
 0:[ffffffff]  ::play()
    obj@1fe8 pc=5a86 sp=73ec fp=73ec
 1:[0]  ::doit()
    obj@1fe8 pc=07c0 sp=73f0 fp=73f0
 2:[1]  ::doit()
    obj@1fe8 pc=5bd5 sp=73f6 fp=73f4


The commandline gets much farther -- it even displays the scene and ego
before breaking in the debugger!

I will be on IRC tomorrow afternoon if anyone would like to help me debug
this further.

Thanx



--
http://www.clock.org/~matt



Reply via email to