Board index » cppbuilder » debugging a DLL not possible??

debugging a DLL not possible??

Hi,

I'm making a DLL, but when I want to debug the thing, it doesn't seem to
be possible? I filled in the host application in Run -> Parameters, and
I am 100% sure my dll gets loaded. But for some reason the de{*word*81}
doesn't work :( :( :(

For example when I add some messagebox somewhere, put a breakpoint on
it, and run, the message box shows up all right but the de{*word*81} doesn't
break.

This is driving me pretty nuts, I'd be very grateful if someone can
solve this mystery...

Rogier.

 

Re:debugging a DLL not possible??


Quote
"Rogier E." <rogie...@yahoo.com> wrote in message

news:MPG.16f562139444ea5a98968a@forums.inprise.com...

Quote

> Hi,

> I'm making a DLL, but when I want to debug the thing, it doesn't seem to
> be possible? I filled in the host application in Run -> Parameters, and
> I am 100% sure my dll gets loaded. But for some reason the de{*word*81}
> doesn't work :( :( :(

> For example when I add some messagebox somewhere, put a breakpoint on
> it, and run, the message box shows up all right but the de{*word*81} doesn't
> break.

> This is driving me pretty nuts, I'd be very grateful if someone can
> solve this mystery...

What is your operating system and version of C++Builder?  I ask this because
BCB5 has debugging issues on WinXP.  Also, please describe how you are
setting up your testing environment (application and DLL settings, how the
DLL is loaded, etc).

- Clayton

Re:debugging a DLL not possible??


Quote
Clayton Arends wrote:
> What is your operating system and version of C++Builder?  I ask this because
> BCB5 has debugging issues on WinXP.  

BCB5 with upgrade pack #1 installed. And uh oh.. yeah, I'm using XP :(

Quote
> Also, please describe how you are
> setting up your testing environment (application and DLL settings, how the
> DLL is loaded, etc).

I'm almost sure I set everything up just like previous projects which I
have been able to debug normally (also DLL's) - although I was still
using win2000 at that time.

The DLL is loaded normally, using LoadLibrary, GetProcAddress to get the
only function I'm exporting, and then calling the function (this all
works ok, since if I put a messagebox right at the beginning of that
function, I see the messagebox).

Rogier

Re:debugging a DLL not possible??


I have this same problem crop up intermittently, not always with dll's. (BCB
5 SP1 Win98). Sometimes I can fix it by just restarting BCB, or rebooting,
but sometimes I have to make a whole new project from scratch.

Re:debugging a DLL not possible??


Sorry, some other stuff I just thought of...you have to compile the dll with
the debug option on right? And the dll's tds file has to be in the same
place as the dll. And if the dll isnt part of the project group you have to
tell the IDE where to find the source files in
Project|Options|Directories/Conditional|Debug Source Path. (If the tds file
isnt with the dll youre supposed to be able to tell the IDE where to find it
in Tools|De{*word*81} Options|Debug Symbols Search Path, though Ive never tried
that)

Patrick

Re:debugging a DLL not possible??


Hi Patrick,

Yes, the dll has to be compiled using debug options, otherwise you won't
be able to debug anything at all.

But about the .tds, didn't know about that, I'm not sure if my tds is in
the same dir as the dll. Will try that!

Rogier

Quote
Patrick McConnell wrote:
> Sorry, some other stuff I just thought of...you have to compile the dll with
> the debug option on right? And the dll's tds file has to be in the same
> place as the dll. And if the dll isnt part of the project group you have to
> tell the IDE where to find the source files in
> Project|Options|Directories/Conditional|Debug Source Path. (If the tds file
> isnt with the dll youre supposed to be able to tell the IDE where to find it
> in Tools|De{*word*81} Options|Debug Symbols Search Path, though Ive never tried
> that)

Re:debugging a DLL not possible??


And the dll's tds file has to be in the same

Quote
>place as the dll.

Not so sure about that. All my dll are output in the "c:\windows\system" folder and the tds files in the folder where the source code files are: yet I'm still able to debug normally!

Alex

Re:debugging a DLL not possible??


Yes - I'm am using the same environment you are and am also experiencing the
same problem.  I've been coding and debugging DLL's for years and it is only
since I've moved to XP that the problem started.

For some reason under XP, Builder (or Windows?) loses the path when DLL's
are loaded and thus Builder can't find the TDS file.

A workaround is to do the following:

1) Step through your code until after the LoadLibrary.
2) Bring up the View | Debug Windows | Modules window.
3) You will notice there is no path on your dynamically loaded dll.  Click
on the DLL and select Reload Symbol Table and then browse to the dll.
Clicking ok will then load the symbol table from the TDS and all should be
well.

The above fix is very tedious if you load a lot of DLL's but at least it
keeps you moving forward.

Hope this works for you.
Dean.

Quote
> BCB5 with upgrade pack #1 installed. And uh oh.. yeah, I'm using XP :(

> The DLL is loaded normally, using LoadLibrary, GetProcAddress to get the
> only function I'm exporting, and then calling the function (this all
> works ok, since if I put a messagebox right at the beginning of that
> function, I see the messagebox).

Re:debugging a DLL not possible??


In the Tools|De{*word*81} Options|General help its says "Debug Symbols Search
Path     Specifies the path to your debug symbols including any TDS, RSM,
and DCP files. These files are normally stored with your PKG, EXE, or DLL
file." I took that to mean if the arent with the pkg... files then you need
to tell it where, but honestly ive never tried putting them in separate
places myself.

Other Threads