Crash in chkstk on startup

Hi once again,

Sorry for all the posts, but I believe that the reason nothing is printed to
the screen is because of a crash I am getting when linking against SDL as a
static library. There is very little information available, all I get is a
breakpoint firing inside chkstk. I am using Visual Studio 2010 Express. I am
not sure how to continue debugging this. The only thing I am doing now is to
initialize SDL with audio only, and then immediately quit it again using
SDL_Quit. The funny thing is that even though I print a message on the
screen and call getchar() to wait for an enter keypress before I initialize
SDL, I see nothing on the screen and I get this crash immediately.

I would be most greatful for any help on this, as well as on the stdio
redirection issue if it does turn out to be unrelated.

Kind regards,

Philip Bennefall

Have you tried debugging into it? What’s the last function call that was
executed before the chkstk error?On Thu, Aug 8, 2013 at 9:20 AM, Philip Bennefall wrote:

Hi once again,

Sorry for all the posts, but I believe that the reason nothing is printed
to the screen is because of a crash I am getting when linking against SDL
as a static library. There is very little information available, all I get
is a breakpoint firing inside chkstk. I am using Visual Studio 2010
Express. I am not sure how to continue debugging this. The only thing I am
doing now is to initialize SDL with audio only, and then immediately quit
it again using SDL_Quit. The funny thing is that even though I print a
message on the screen and call getchar() to wait for an enter keypress
before I initialize SDL, I see nothing on the screen and I get this crash
immediately.

I would be most greatful for any help on this, as well as on the stdio
redirection issue if it does turn out to be unrelated.

Kind regards,

Philip Bennefall
_____________**
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/**listinfo.cgi/sdl-libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hi Sam,

I followed some instructions in an old post on the same topic, and if I remove the chkstk function stub from SDL_stdlib.c then I no longer get the error. However, things such as listing audio devices for the various drivers do not work. In the case of XAudio2 which is my default I get garbage values for the names, and when I explicitly ask for DirectSound or MME then I am told that device names cannot be retrieved. I am on Windows XP service pack 3. I am not at all sure whether this is a separate issue, but I am having trouble getting anything to work (though it does not actually crash anymore).

Kind regards,

Philip Bennefall> ----- Original Message -----

From: Sam Lantinga
To: @Philip_Bennefall ; SDL Development List
Sent: Thursday, August 08, 2013 9:15 PM
Subject: Re: [SDL] Crash in chkstk on startup

Have you tried debugging into it? What’s the last function call that was executed before the chkstk error?

On Thu, Aug 8, 2013 at 9:20 AM, Philip Bennefall <@Philip_Bennefall> wrote:

Hi once again,

Sorry for all the posts, but I believe that the reason nothing is printed to the screen is because of a crash I am getting when linking against SDL as a static library. There is very little information available, all I get is a breakpoint firing inside chkstk. I am using Visual Studio 2010 Express. I am not sure how to continue debugging this. The only thing I am doing now is to initialize SDL with audio only, and then immediately quit it again using SDL_Quit. The funny thing is that even though I print a message on the screen and call getchar() to wait for an enter keypress before I initialize SDL, I see nothing on the screen and I get this crash immediately.

I would be most greatful for any help on this, as well as on the stdio redirection issue if it does turn out to be unrelated.

Kind regards,

Philip Bennefall 
_______________________________________________
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Uh. The current chkstk implementation in SDL_stdlib.c seems incomplete
and broken because it doesn’t even have a ret instruction causing it
to execute the next function in memory.

chkstk is supposed to probe pages so Windows can move the guard page.
Accessing the guard page causes an exception to signal overflow (or
something like that). This is not an issue when using SDL as a DLL
because the current SDL code doesn’t seem to generate chkstk calls.

Do you have a large static array in your code? Removing SDL’s chkstk
in the static library probably makes it fall back to the VC++ runtime
library one, if you’re linking against it. That should work correctly
now.

Can’t tell you anything about the audio issues though.

Hi there,

No, I have no large static arrays or any other arrays for that matter. My
program is a very simple one with no global variables. In fact, the issue
occurs even with a program that just calls SDL_Init and SDL_Quit. If I
remove the chkstk function from SDL, everything works. Except of course for
the audio but that’s a different story.

Kind regards,

Philip Bennefall> ----- Original Message -----

From: norfanin@gmail.com (Norfanin)
To: “SDL Development List”
Sent: Friday, August 09, 2013 12:26 PM
Subject: Re: [SDL] Crash in chkstk on startup

Uh. The current chkstk implementation in SDL_stdlib.c seems incomplete
and broken because it doesn’t even have a ret instruction causing it
to execute the next function in memory.

chkstk is supposed to probe pages so Windows can move the guard page.
Accessing the guard page causes an exception to signal overflow (or
something like that). This is not an issue when using SDL as a DLL
because the current SDL code doesn’t seem to generate chkstk calls.

Do you have a large static array in your code? Removing SDL’s chkstk
in the static library probably makes it fall back to the VC++ runtime
library one, if you’re linking against it. That should work correctly
now.

Can’t tell you anything about the audio issues though.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org