Unable to debug SDL applications on X11

Is it possible to debug an SDL fullscreen application that runs on X11 ?
I’ve readed that it’s possible passing SDL_INIT_NOPARACHUTE to SDL_Init but I
didn’t get any results: when a breakpoint is hit, graph freezes and the only
way to return to X is to reset it via Ctrl+Alt+BrkSpace; the same happens if
application crashes. I’m using KDevelop on Ubuntu, can be a development
environment problem ? Can I hope to resolve the problem passing to Anjuta or
any other IDE or using different distributions ?

Thank you.
Simone Navari.

El Jueves 06 Noviembre 2008ES 18:04:29 Simone Navari escribi?:

Is it possible to debug an SDL fullscreen application that runs on X11 ?
I’ve readed that it’s possible passing SDL_INIT_NOPARACHUTE to SDL_Init but
I didn’t get any results: when a breakpoint is hit, graph freezes and the
only way to return to X is to reset it via Ctrl+Alt+BrkSpace; the same
happens if application crashes. I’m using KDevelop on Ubuntu, can be a
development environment problem ? Can I hope to resolve the problem passing
to Anjuta or any other IDE or using different distributions ?

Did you try to get back to the debugger with ALT+TAB? I usually debug
fullscreen X11 programs without problem, although not on KDEvelop.
Nevertheless, it uses GDB, so it shouldn’t matter.

Alberto Luaces <aluaces udc.es> writes:

El Jueves 06 Noviembre 2008ES 18:04:29 Simone Navari escribi?:

Is it possible to debug an SDL fullscreen application that runs on X11 ?
I’ve readed that it’s possible passing SDL_INIT_NOPARACHUTE to SDL_Init but
I didn’t get any results: when a breakpoint is hit, graph freezes and the
only way to return to X is to reset it via Ctrl+Alt+BrkSpace; the same
happens if application crashes. I’m using KDevelop on Ubuntu, can be a
development environment problem ? Can I hope to resolve the problem passing
to Anjuta or any other IDE or using different distributions ?

Did you try to get back to the debugger with ALT+TAB? I usually debug
fullscreen X11 programs without problem, although not on KDEvelop.
Nevertheless, it uses GDB, so it shouldn’t matter.

Yes I tried without results. Here is a simple application I’ve used to test it

#include
#include <stdlib.h>
#include <SDL/SDL.h>

using namespace std;

int main(int argc, char argv[])
{
cout <<“Initializing SDL.” << endl;
/
Initializes Audio and the CDROM, add SDL_INIT_VIDEO for Video /
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE)< 0)
{
cout <<“Could not initialize SDL:” << SDL_GetError() << endl;
SDL_Quit();
}
else
{
SDL_Surface
screen = SDL_SetVideoMode(1280,1024,32,SDL_HWSURFACE |
SDL_FULLSCREEN);
char* p=NULL;
*p=123;
}
SDL_Quit();
}

El Lunes 10 Noviembre 2008ES 10:09:45 Simone Navari escribi?:

Alberto Luaces <aluaces udc.es> writes:

El Jueves 06 Noviembre 2008ES 18:04:29 Simone Navari escribi?:

Is it possible to debug an SDL fullscreen application that runs on X11
? I’ve readed that it’s possible passing SDL_INIT_NOPARACHUTE to
SDL_Init but I didn’t get any results: when a breakpoint is hit, graph
freezes and the only way to return to X is to reset it via
Ctrl+Alt+BrkSpace; the same happens if application crashes. I’m using
KDevelop on Ubuntu, can be a development environment problem ? Can I
hope to resolve the problem passing to Anjuta or any other IDE or using
different distributions ?

Did you try to get back to the debugger with ALT+TAB? I usually debug
fullscreen X11 programs without problem, although not on KDEvelop.
Nevertheless, it uses GDB, so it shouldn’t matter.

Yes I tried without results. Here is a simple application I’ve used to test
it

#include
#include <stdlib.h>
#include <SDL/SDL.h>

using namespace std;

int main(int argc, char argv[])
{
cout <<“Initializing SDL.” << endl;
/
Initializes Audio and the CDROM, add SDL_INIT_VIDEO for Video /
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE)< 0)
{
cout <<“Could not initialize SDL:” << SDL_GetError() << endl;
SDL_Quit();
}
else
{
SDL_Surface
screen = SDL_SetVideoMode(1280,1024,32,SDL_HWSURFACE |
SDL_FULLSCREEN);
char* p=NULL;
*p=123;
}
SDL_Quit();
}

Then another way could be pressing CTRL+ALT+F1 to get a text mode console,
login and inspect with ‘top’ what is happening. You could also attach the
debugger to your already run program by executing “gdb executable PID”.

Alberto Luaces wrote:

Then another way could be pressing CTRL+ALT+F1 to get a text mode console,
login and inspect with ‘top’ what is happening. You could also attach the
debugger to your already run program by executing “gdb executable PID”.

Switching to/from text mode consoles will lock up the machine on official ATI drivers, works on all other drivers though.

The fundamental basis of alt-tab not working is that SDL is not asking the window manager to make it a fullscreen window, rather it’s opening its own unmanaged window which can not receive input from
the window manager at all, so it has to grab all input (it has no choice - otherwise input is passed on to windows underneath it).

I assume that SDL attempts to negotiate a fullscreen request with the window manager but not sure which window managers it is compatible with, if it fails to negotiate a fullscreen request, then it
has no choice but to open an unmanaged window and grab everything.–
Forest ‘LordHavoc’ Hale
Author of DarkPlaces Quake1 engine and mod
http://icculus.org/twilight/darkplaces/
Address: 94340 Horton Road Blachly OR 97412
Phone/Fax: 541-925-4130

Forest Hale <havoc ghdigital.com> writes:

Alberto Luaces wrote:

Then another way could be pressing CTRL+ALT+F1 to get a text mode console,
login and inspect with ‘top’ what is happening. You could also attach the
debugger to your already run program by executing “gdb executable PID”.

Switching to/from text mode consoles will lock up the machine on official ATI
drivers, works on all other
drivers though.

I’m using ATI open source driver provided with Ubuntu 8.04 but pressing
CTRL+ALT+F1 machine doesn’t look up but my example application black screen
remains. If I change video adapter brand fullscreen debugging will work ?

I assume that SDL attempts to negotiate a fullscreen request with the window
manager but not sure which
window managers it is compatible with, if it fails to negotiate a fullscreen
request, then it
has no choice but to open an unmanaged window and grab everything.

So an attempt can be use another windows manager instead of gnome ? Can you tell
me which windows manager did you used that permits fullscreen debugging ?

Thnak you again.
Simone Navari.

El Mi?rcoles 12 Noviembre 2008ES 10:04:27 Simone Navari escribi?:

I’m using ATI open source driver provided with Ubuntu 8.04 but pressing
CTRL+ALT+F1 machine doesn’t look up but my example application black screen
remains. If I change video adapter brand fullscreen debugging will work ?

What is happening after pressing CTRL+ALT+F1? Do you see a text login screen?

Alberto Luaces <aluaces udc.es> writes:

El Mi?rcoles 12 Noviembre 2008ES 10:04:27 Simone Navari escribi?:

I’m using ATI open source driver provided with Ubuntu 8.04 but pressing
CTRL+ALT+F1 machine doesn’t look up but my example application black screen
remains. If I change video adapter brand fullscreen debugging will work ?

What is happening after pressing CTRL+ALT+F1? Do you see a text login screen?

Thank you for your rapid response. No: as you can see the simple application
I’ve posted init sdl in 1280x1024 full screen mode switching so to a black
screen with the mouse pointer shown, but after the forced segmentation fault
pressing CTRL+ALT+F1 keep graph mode and mouse pointer active, no login screen
in text mode is shown.

Simone Navari.