Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phantasmagoria-demo fails in release builds #2

Open
bebbo opened this issue Feb 15, 2022 · 4 comments
Open

phantasmagoria-demo fails in release builds #2

bebbo opened this issue Feb 15, 2022 · 4 comments

Comments

@bebbo
Copy link

bebbo commented Feb 15, 2022

in seq_manager.cpp:

offending code:

				if (isReleaseBuild || (offset <= scr->getBufSize() && offset >= (uint)-SCRIPT_OBJECT_MAGIC_OFFSET &&
								   scr->offsetIsObject(offset))) {

if you'd add an else with some warning, you'll note that it attempts to use several invalid offsets for SEG_TYPE_SCRIPT.
if isReleaseBuild is set to true (via -DNDEBUG) it simply crashes.

=> keep that sanity check even if isReleaseBuild is set to true:

				if (offset <= scr->getBufSize() && offset >= (uint)-SCRIPT_OBJECT_MAGIC_OFFSET &&
								   scr->offsetIsObject(offset)) {

@mheyer32
Copy link

I wrote the offending code, but you're in the wrong repository :-D

I'll fix it in https://github.com/mheyer32/scummvm-amigaos3

I introduced isReleaseBuild to short-circuit some runtime checks I thought were not needed. But I guess some of them are...

@mheyer32
Copy link

I'm curious how you found this bug. I'm always struggling debugging scummvm, even with bgdbserver...

@bebbo
Copy link
Author

bebbo commented Feb 21, 2022

I wrote the offending code, but you're in the wrong repository :-D

I'll fix it in https://github.com/mheyer32/scummvm-amigaos3

I introduced isReleaseBuild to short-circuit some runtime checks I thought were not needed. But I guess some of them are...

Your repo has issues disabled... ^^

@bebbo
Copy link
Author

bebbo commented Feb 21, 2022

I'm curious how you found this bug. I'm always struggling debugging scummvm, even with bgdbserver...

it's all done via bisection. You need a working version, build it and

find -name '*.o' -exec cp --parents {} ../ok \;

and a bad version. Build that too and

find -name '*.o' -exec cp --parents {} ../bad \;

depending of the current state, copy good files to fix it or bad files to kill it and run

find -name '*.a' -delete; make -j12; cp scummvm /mnt/f/amiga/test/svm

once you hunted down a single file, compare the asm of these versions, try building a bad and a good file with as less option differences as possible.
If necessary bisect these asms into a new asm file manually and apply it until you find the function...
... debug it.
I'm using my bgdbserver and DBug from O.M.A. 2.0

and then the fun starts: why does it go wrong in gcc... debug gcc... FIX IT. YEAH!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants