Hello
I have a question.
What is the best way to debug SDL functions.
I did see a function called SDL_SetError, but what happens when I call this
function?
Is the error written to a file?
Thanx
Joep Admiraal
Hello
I have a question.
What is the best way to debug SDL functions.
I did see a function called SDL_SetError, but what happens when I call this
function?
Is the error written to a file?
Thanx
Joep Admiraal
Hi,
You can test the error code returned by each function you want to
test, then if an error occured you can call SDL_GetError() to get a
string who describe the error.
Hope this help,–
Thomas Lecomte
@Thomas_Lecomte
On 6/16/05, admiraal wrote:
Hello
I have a question.
What is the best way to debug SDL functions.
I did see a function called SDL_SetError, but what happens when I call this
function?
Is the error written to a file?Thanx
Joep Admiraal
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
Thanx for your reply.
This is not what I try to accomplish.
I am making some adjustments to a SDL function.
Now while using my modified version of SDL I want to know what some of the
variables from my function look like.
Do I have to write them to a file?
Thanks,
Joep Admiraal
“Thomas Lecomte” <deather.dede at gmail.com> schreef in bericht
news:8df0bfa00506160626531db921 at mail.gmail.com…
Hi,
You can test the error code returned by each function you want to
test, then if an error occured you can call SDL_GetError() to get a
string who describe the error.
Hope this help,–
Thomas Lecomte
deather.dede at gmail.com
On 6/16/05, admiraal <@admiraal> wrote:
Hello
I have a question.
What is the best way to debug SDL functions.
I did see a function called SDL_SetError, but what happens when I call
this
function?
Is the error written to a file?Thanx
Joep Admiraal
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
my favorite and most successful way to debug is use the following functions:
#include <stdarg.h>
void ClearLog(void)
{
FILE *File;
if(File=fopen(“log.txt”,“wb”))
fclose(File);
}
void Log(char *Message,…)
{
FILE *File;
va_list Params;
if(File=fopen(“log.txt”,“at”))
{
va_start(Params,Message);
vfprintf(File,Message,Params);
va_end(Params);
fclose(File);
}
va_start(Params,Message);
vprintf(Message,Params);
va_end(Params);
}
call ClearLog at the begining of your program, then use Log() like you would
printf() and you get a file output of log.txt as well as debug to stdout.
if i have a crash for instance, i put a couple Log() functions around and
see which message(s) didn’t get printed out (ie in a function i suspect of
crasing i make it output 1) 2) 3) 4) 5) in diff places so if it only gets to
3 i know the problem is between 3 and 4).
if some logic is bad and im not getting the results i want from something or
am confused, i make log() print out values of variables in different places
then i can look at the log.txt and see for myself what is going on.
PS Log() takes the exact same parameters as printf.
hope this helps,
Alan> ----- Original Message -----
From: joep@mercash.nl (admiraal)
To:
Sent: Thursday, June 16, 2005 6:11 AM
Subject: [SDL] Debugging SDLHello
I have a question.
What is the best way to debug SDL functions.
I did see a function called SDL_SetError, but what happens when I call
this
function?
Is the error written to a file?Thanx
Joep Admiraal
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
Now while using my modified version of SDL I want to know what some of the
variables from my function look like.Do I have to write them to a file?
Traditionally, people use a debugger for that.
–ryan.
I was hoping something like this was already in the library.
I had my own functions to write some info to a file while debugging but I
think I’ll replace/merge them with the one you just gave me.
Mine didn’t take the same parameters as printf.
Thanks for explanation.
Joep
“Alan Wolfe” schreef in bericht
news:014a01c57289$6a76be20$0a00000a at atrix…> my favorite and most successful way to debug is use the following
functions:
#include <stdarg.h>
void ClearLog(void)
{FILE *File;
if(File=fopen(“log.txt”,“wb”))
fclose(File);}
void Log(char *Message,…)
{FILE *File;
va_list Params;if(File=fopen(“log.txt”,“at”))
{
va_start(Params,Message);
vfprintf(File,Message,Params);
va_end(Params);
fclose(File);
}va_start(Params,Message);
vprintf(Message,Params);
va_end(Params);}
call ClearLog at the begining of your program, then use Log() like you
would
printf() and you get a file output of log.txt as well as debug to stdout.if i have a crash for instance, i put a couple Log() functions around and
see which message(s) didn’t get printed out (ie in a function i suspect of
crasing i make it output 1) 2) 3) 4) 5) in diff places so if it only gets
to
3 i know the problem is between 3 and 4).if some logic is bad and im not getting the results i want from something
or
am confused, i make log() print out values of variables in different
places
then i can look at the log.txt and see for myself what is going on.PS Log() takes the exact same parameters as printf.
hope this helps,
Alan----- Original Message -----
From: “admiraal” <@admiraal>
To:
Sent: Thursday, June 16, 2005 6:11 AM
Subject: [SDL] Debugging SDLHello
I have a question.
What is the best way to debug SDL functions.
I did see a function called SDL_SetError, but what happens when I call
this
function?
Is the error written to a file?Thanx
Joep Admiraal
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl