Help! SDL & Borland & Debugger = no worky!

Hi all,

I’m running into a strange problem and not sure what the cause could be.
I notice on projects where I use SDL, I can’t seem to use the turbo
debugger for source debugging. When I try to do it all I get is a cpu
assembly window when the debugger starts up. Console applications seem to
debug fine though.

I am doing this through the free turbo debugger and compiling my projects
using the free borland 5.5 compiler. Full debugging info is turned on for
my projects through use of the -v switch on the bcc32 compiler and the
ilink32 linker as well.

I want to mention that I’m kind of new to using the SDL library but I was
able to set it up properly. I’m able to compile projects using this
library successfully. Right now I’m just trying to find a way to debug
projects that makes use of this api but this stupid debugger doesn’t
wanna work.

I’m also unsure of whether the issue is related specifically to the
debugger itself or just the way the api is set up. I’ve also posted a
help msg on the Borland newsgroup inquiring about this problem but
haven’t gotten any response that’ll help me with this problem.

Any ideas what could be wrong that’s preventing me from doing source
debugging on projects using SDL? I’d really hate to go back to my old way
of fixing bugs before I learned how to use a debugger;sticking cout’s and
file output everywhere. Any solutions, suggestions, and comments on this
problem are welcomed. Once this gets sorted out, everything’s golden to
me :slight_smile:

Thanks

Vivi Orunitia wrote:

I’m running into a strange problem and not sure what the cause could be.
I notice on projects where I use SDL, I can’t seem to use the turbo
debugger for source debugging. When I try to do it all I get is a cpu
assembly window when the debugger starts up. Console applications seem to
debug fine though.

Do you use debug version SDL libary? AFAIK, debug information is
stripped from libs that can be found precomiled. I might me wrong, but
even then MSVC debug info is useless with Borland compiler…

I am doing this through the free turbo debugger and compiling my projects
using the free borland 5.5 compiler. Full debugging info is turned on for
my projects through use of the -v switch on the bcc32 compiler and the
ilink32 linker as well.

I’m using the same compiler on Windows and I’ve had similar problems. I
was able to build debug version of SDL from source, but couldn’t get
other (SDL_image, SDL_mixer, SDL_net) libraries to work with it, so I
just imported VC’s libaries and forgot about debugging. (I just put a
lot of logging in the program, and I monitor the .txt file).

Well, I know I’m not much help with getting it to work, but you probably
now know why it doesn’t work.–
Milan Babuskov
http://njam.sourceforge.net

I’m running into a strange problem and not sure what the cause could be.
I notice on projects where I use SDL, I can’t seem to use the turbo
debugger for source debugging. When I try to do it all I get is a cpu
assembly window when the debugger starts up. Console applications seem to
debug fine though.

Does TD32 show the message “Not enough memory to load symbol table” when you
load your executable? If so, you are failing to enable debug info on either
the compiler or linker or both. You said that you had debug info enabled
with “-v”, but if you see this message you should check your makefiles
again.

If you don’t get any error message inside TD32 then what’s probably
hapenning is that TD32 can’t find your source code files, so it shows only
what it can: the assembly window. Is this case you’d be able to watch
variables and see symbols in the assembly window though. To make TD32 find
your source code files, go to “Options” and “Path for source…”. Enter the
directories where your source code files are located separeted by a
semicolon. Don’t use Windows’ long file names, TD32 uses spaces to separate
different paths, just like the semicolon.

If what you want is to debug into SDL calls, then it’s a whole different
problem. I can’t help you with this, I just debug my code and hope that SDL
works as documented (and it does!). But here’s a hint: compile SDL from the
source code with debug info enabled and make the path for source files in
TD32 to point to SDL source code files besides your own files.

Regards,

Andre de Leiradella

Thanks for those of you who have replied to my problem. :slight_smile:

Andre de Leiradella wrote in
news:000501c3829d$cbcea620$dd70e40d at bra.xerox.com:

Does TD32 show the message "Not enough memory to load symbol table"
when you load your executable? If so, you are failing to enable debug
info on either the compiler or linker or both. You said that you had
debug info enabled with “-v”, but if you see this message you should
check your makefiles again.

no I don’t get that error though on occasion I do get the “debug info is
old, do I wish to use it” msg but that’s understandable when I recompile a
project.

If you don’t get any error message inside TD32 then what’s probably
hapenning is that TD32 can’t find your source code files, so it shows
only what it can: the assembly window. Is this case you’d be able to
watch variables and see symbols in the assembly window though. To make
TD32 find your source code files, go to “Options” and “Path for
source…”. Enter the directories where your source code files are
located separeted by a semicolon. Don’t use Windows’ long file names,
TD32 uses spaces to separate different paths, just like the semicolon.

hmm, setting the path source explicitly still doesn’t help :frowning: I tried it
using both the traditional 8.3 naming format and the normal windows naming
format. I don’t think not being able to find source directory is the
problem.

Like I also mentioned before though, debugging projects that don’t use sdl
I’m able to do source debugging on them fine.

Well, here’s how my makefile for the project looks like:

Borland C++ tools

IMPLIB= Implib
ILINK32= ILink32
BRC32= Brc32
TLIB= TLib
TASM32= Tasm32
CC= BCC32

Compiler and Linker flags

LD_FLAGS=-v
C_FLAGS=-y -v

BCC32 RT lib: cw32.lib static

BCC32RTLIB=cw32.lib SDL.lib SDLmain.lib SDL_image.lib

BCC32 Startup: c0x32.obj-console, c0w32.obj-winapi

BCC32STARTUP=c0w32.obj

SRCS=
E:\Borland\myworkspace\Test.cpp

OBJS=
Test.obj

oDir=E:\Borland\myworkspace\

Dependency Rules

ProjectExecutable :$(OBJS)
cd $(oDir)
$(ILINK32) @&&|-c +
$(LD_FLAGS) +
$(BCC32STARTUP) +
$(OBJS), +
“E:\Borland\myworkspace\test.exe”, , +
import32.lib $(BCC32RTLIB)
|

Test.obj :"E:\Borland\myworkspace\Test.cpp"
cd $(oDir)
$(CC) -c $(C_FLAGS) -o$@ “E:\Borland\myworkspace\Test.cpp”

If what you want is to debug into SDL calls, then it’s a whole
different problem. I can’t help you with this, I just debug my code
and hope that SDL works as documented (and it does!). But here’s a
hint: compile SDL from the source code with debug info enabled and
make the path for source files in TD32 to point to SDL source code
files besides your own files.

yes yes, you just hit the nail on the head. :slight_smile: that’s all I really wanna
do. I just want to do debugging on my code only and have no intention of
tracing into SDL calls. I’m just going to assume that SDL itself is bugfree
and the calls to it does what it’s suppose to. Afterall, it’s my code that
needs debugging. :stuck_out_tongue:

Like the poster before you suggested, I might need to compile the SDL
source with debuggy info on. I’ll do that if that’s what it’ll take to
allow me to do debugging on my projects but would like to know first if
that’s really the problem; there’s no guarantee that even this will allow
me to do what I want. If there’s a way to get this to work without having
to do SDL source recompiling w/ debugging on then that’s all the better.

Thanks again guys

Vivi Orunitia wrote:

yes yes, you just hit the nail on the head. :slight_smile: that’s all I really wanna
do. I just want to do debugging on my code only and have no intention of
tracing into SDL calls. I’m just going to assume that SDL itself is bugfree
and the calls to it does what it’s suppose to. Afterall, it’s my code that
needs debugging. :stuck_out_tongue:

Then you better forget about my post.

Like the poster before you suggested, I might need to compile the SDL
source with debuggy info on. I’ll do that if that’s what it’ll take to
allow me to do debugging on my projects but would like to know first if
that’s really the problem; there’s no guarantee that even this will allow
me to do what I want.

I’m not 100% sure but I think it probably will not, so I suggest you
don’t waste time on it.

Good luck.–
Milan Babuskov
http://fbexport.sourceforge.net