Jump to content


Dosbox Crash


  • Please log in to reply
3 replies to this topic

#1 Guest_Curt Hester_*

Guest_Curt Hester_*
  • Guests

Posted 19 December 2005 - 12:17 AM

I would like an explanation of the following problem, if at all possible.
For the last month, I have had each version of DOSBox (0.63+ cvs + special builds)
crash upon startup. At first, I believed that it was because of the SDL library,
but I rebuilt SDL.dll and tested it with several demo programs and they worked fine.
I built the debug version of DOSBox, but the program exited right after the curses
window appeared. I then decided to sprinkle sdlmain.cpp with MessageBox()
statements to trace each function call made during main(). The program was crashing
right after a call to control->ParseEnv(environ). Commenting the line out,
I recompiled and DOSBox started up immediately with no problems at all. Does anyone
have an explanation as to why that particular function call would cause a crash?

#2 Qbix

Qbix

    AR-coholic

  • Members
  • PipPipPipPipPipPip
  • 605 posts

Posted 19 December 2005 - 07:29 AM

I wouldn't mind knowing which operating sytem this is on.

Try determining the value of envirion (for example add this to
src/misc/setup.cpp (at line 337/338)
LOG_MSG("val of env pointer %X",envp);return; (or a message box)

(you might want to build dosbox without curses)
and if it works try
LOG_MSG("val of env pointer %X %X",envp,*envp); return;

And note down the values reported.

I notice that dosbox doesn't check for an empty/broken enverionment. (not sure if that is possible(the check is possible, but the empty env)). But maybe there is a linker error somewhere

#3 Guest_Curt Hester_*

Guest_Curt Hester_*
  • Guests

Posted 20 December 2005 - 11:50 AM

OS: Windows XP Pro with Service Pack 2

Value of environ:   3AE2D58
Value of *environ: 3AE2E30

#4 Qbix

Qbix

    AR-coholic

  • Members
  • PipPipPipPipPipPip
  • 605 posts

Posted 20 December 2005 - 07:59 PM

well try finding out your environment.
(in a cmd.exe type "set")

and compare it with the results dosbox posts when you use this patch in the cvs.
(remove that former LOG_MSG)

Index: src/gui/sdlmain.cpp
===================================================================
RCS file: /cvsroot/dosbox/dosbox/src/gui/sdlmain.cpp,v
retrieving revision 1.94
diff -u -r1.94 sdlmain.cpp
--- src/gui/sdlmain.cpp 2 Dec 2005 10:02:03 -0000       1.94
+++ src/gui/sdlmain.cpp 20 Dec 2005 19:54:59 -0000
@@ -1056,7 +1056,7 @@
 static bool no_stdout = false;

 void GFX_ShowMsg(char * format,...) {
-       char buf[512];
+       char buf[2048];
        va_list msg;
        va_start(msg,format);
        vsprintf(buf,format,msg);
Index: src/misc/setup.cpp
===================================================================
RCS file: /cvsroot/dosbox/dosbox/src/misc/setup.cpp,v
retrieving revision 1.31
diff -u -r1.31 setup.cpp
--- src/misc/setup.cpp  24 Jul 2005 19:04:11 -0000      1.31
+++ src/misc/setup.cpp  20 Dec 2005 19:55:13 -0000
@@ -338,6 +338,7 @@
        for(char** env=envp; *env;env++) {
                char copy[1024];
                safe_strncpy(copy,*env,1024);
+LOG_MSG("env value %s",copy);
                if(strncasecmp(copy,"DOSBOX_",7))
                        continue;
                char* sec_name = &copy[7];

It seems dosbox chokes on your environment.
The values you posted showed that it existed. (else they would be null)