I tried to replace
#define int BOOL
with
#define Uint8 BOOL
and got some ugly crash in interp.c when trying to start a skirmish game.



(gdb) break interp.c:330
Breakpoint 1 at 0x80908be: file ../lib/script/interp.c, line 330.
(gdb) break interp.c:372
Breakpoint 2 at 0x8090b41: file ../lib/script/interp.c, line 372.
(gdb) break interp.c:391
Breakpoint 3 at 0x8090c19: file ../lib/script/interp.c, line 391.
(gdb) break interp.c:732
Breakpoint 4 at 0x8091e0a: file ../lib/script/interp.c, line 732.
(gdb) run --datadir data/ --debug all
Starting 
program: /home/sevendays/Warzone/Gna/trunk/_build_/debug/warzone2100 --datadir 
data/ --debug all
[Thread debugging using libthread_db enabled]
[New Thread -1218775312 (LWP 2730)]
wz:         Warzone 2100 - Version TRUNK - Built Nov  6 2006 - DEBUG
<snip>
Breakpoint 1, interpRunScript (psContext=0xb41ad4fc, runType=IRT_EVENT, 
index=0, offset=0) at ../lib/script/interp.c:330
330             switch (runType)
(gdb) p aOpSize
$1 = {2, 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, -1 <repeats 15 times>, 
2, 1, 1, 2}
(gdb) p opcode
$2 = 134577913
(gdb) p InstrPointer
$3 = (UDWORD *) 0xbfbbf718
(gdb) c
Continuing.

Breakpoint 2, interpRunScript (psContext=0xb41ad4fc, runType=IRT_EVENT, 
index=0, offset=0) at ../lib/script/interp.c:374
374             while(!bStop)
(gdb) p opcode
$4 = 0
(gdb) p InstrPointer
$5 = (UDWORD *) 0xa858c10
(gdb) c
Continuing.

Breakpoint 3, interpRunScript (psContext=0xb41ad4fc, runType=IRT_EVENT, 
index=0, offset=0) at ../lib/script/interp.c:391
391                             switch (opcode)
(gdb) p opcode
$6 = 0
(gdb) p InstrPointer
$7 = (UDWORD *) 0xa858c10
(gdb) c
Continuing.

Breakpoint 3, interpRunScript (psContext=0xb41ad4fc, runType=IRT_EVENT, 
index=0, offset=0) at ../lib/script/interp.c:391
391                             switch (opcode)
(gdb) p opcode
$8 = 7
(gdb) p InstrPointer
$9 = (UDWORD *) 0xa858c18
(gdb) c
Continuing.

Breakpoint 4, interpRunScript (psContext=0xb41ad4fc, runType=IRT_EVENT, 
index=0, offset=0) at ../lib/script/interp.c:733
733                                     TRCPRINTFUNC( (SCRIPT_FUNC)
(*(InstrPointer+1)) );
(gdb) p opcode
$10 = 7
(gdb) p InstrPointer
$11 = (UDWORD *) 0xa858c18
(gdb) c
Continuing.

Breakpoint 3, interpRunScript (psContext=0xb41ad4fc, runType=IRT_EVENT, 
index=0, offset=0) at ../lib/script/interp.c:391
391                             switch (opcode)
(gdb) p opcode
$12 = 0
(gdb) p InstrPointer
$13 = (UDWORD *) 0xa858c20
(gdb) c
Continuing.

Breakpoint 3, interpRunScript (psContext=0xb41ad4fc, runType=IRT_EVENT, 
index=0, offset=0) at ../lib/script/interp.c:391
391                             switch (opcode)
(gdb) p opcode
$14 = 7
(gdb) p InstrPointer
$15 = (UDWORD *) 0xa858c28
(gdb) c
Continuing.

Breakpoint 4, interpRunScript (psContext=0xb41ad4fc, runType=IRT_EVENT, 
index=0, offset=0) at ../lib/script/interp.c:733
733                                     TRCPRINTFUNC( (SCRIPT_FUNC)
(*(InstrPointer+1)) );
(gdb) p opcode
$16 = 7
(gdb) p InstrPointer
$17 = (UDWORD *) 0xa858c28
(gdb) call cpPrintFunc(*(InstrPointer+1))
never:      setBackgroundFog
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
interpRunScript (psContext=Cannot access memory at address 0xbf000008
) at ../lib/script/interp.c:744
744                                     InstrPointer += aOpSize[opcode];
(gdb) p opcode
Cannot access memory at address 0xbeffffc4
(gdb) p InstrPointer
Cannot access memory at address 0xbeffffc0



Looks like heavy stack corruption...

Perhaps someone with more knowledge about interp.c can find out what's going 
on?

--Dennis
Index: lib/framework/types.h
===================================================================
--- lib/framework/types.h	(revision 465)
+++ lib/framework/types.h	(working copy)
@@ -41,7 +41,7 @@
 
 #ifndef WZ_OS_WIN
 
-typedef int BOOL;
+typedef Uint8 BOOL;
 
 typedef struct {
   UBYTE peRed;

Attachment: pgp24e5QnI7Mi.pgp
Description: PGP signature

_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev

Reply via email to