[Scummvm-devel] Fwd: PS2 : stack madness

Willem Jan Palenstijn wjp at usecode.org
Wed Apr 8 10:22:31 CEST 2009


On Wed, Apr 08, 2009 at 05:59:09AM +0200, sunmax at libero.it wrote:
> Is there any way you can start your GUI 320x200 and then let
> the Scumm engine to crank it up to 640x480 before starting
> COMI and see if this makes a difference?

Running scummvm with '-g 1x' (so that it runs in 320x200) and then
starting COMI from the launcher shows nothing strange, and no large
stack increase either.


> given a certain code base and compiler settings it will always
> crash at the same point. On the other hand when we keep adding
> new variables on the stack and more printf, we "lose" it:
> it starts crashing somewhere else :-(

That itself might also give a clue. This is a bit of a longshot, but it
might work:


Take the function where adding printfs makes you "lose" the crash.

At the very beginning of that function, add some code:

int canary[64];
for (int ci=0; ci<64; ++ci) canary[i] = 0x12345678;

Then after every function call in that function (and maybe in other
places too), put a check:

for (int ci=0; ci<64; ++ci) assert(canary[i] == 0x12345678);


If it shows that a specific function call corrupted the canary-variable,
you can then repeat this procedure inside that function. That _might_
give enough info to find the guilty code.



One other option: does your gcc support the option -fstack-protector-all ?



-Willem Jan




More information about the Scummvm-devel mailing list