Recent

Author Topic: [Solved] Debugging DLL?  (Read 9826 times)

st

  • Newbie
  • Posts: 2
[Solved] Debugging DLL?
« on: November 20, 2010, 11:45:43 pm »
I have 2 simple projects: EXE and DLL both compiled in Lazarus with "-g -gl" options.
EXE is defined as "host application" in "Run parameters" of DLL project.
When I run DLL in Lazarus and try to stop it on any breakpoints nothing is happened (breakpoints are marked "?").

I tried Lazarus "snapshot" :
Lazarus-0.9.29-28296-fpc-2.4.2-20101118-win64.exe
Lazarus-0.9.29-28360-fpc-2.4.3-20101120-win32.exe

I tried both 32 and 64 Lazarus on Vista64 and 32 Lazarus on XP - no luck. :o

How can I debug DLL ?
What is a right way to debug a DLL in Lazarus ?

Thanks in advance

P.S. It works well on Delphi 2009 Win32...
« Last Edit: November 21, 2010, 05:09:32 pm by st »

ivan17

  • Full Member
  • ***
  • Posts: 173
Re: Debugging DLL?
« Reply #1 on: November 21, 2010, 09:43:42 am »
i don't think that works (yet), though i'd be happy if someone were to prove me wrong.

there is always the i'm-my-own-debugger way - at important points you display variables in a message box or dump them into a text file...

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7506
  • Debugger - SynEdit - and more
    • wiki
Re: Debugging DLL?
« Reply #2 on: November 21, 2010, 01:11:41 pm »
What version of GDB do you use?

I tested (on windows) with gdb 7.2-1 and I was able to step into a DLL

Having said that:

Steeping from the hos-app, into the dll with F7 does not seem to work reliable.

but stepping inside the dll (once in there) and breakpoints are fine.

--Edit:
Oh, and i do not have any custom library loading code, I let the Os load the lib, at application start.

If you have your own calls to load the library by hand, you may (don't know / maybe not, maybe it even work then) have to wait until the library is loaded, before you can insert the breakpoint.
« Last Edit: November 21, 2010, 01:26:53 pm by Martin_fr »

st

  • Newbie
  • Posts: 2
Re: Debugging DLL?
« Reply #3 on: November 21, 2010, 04:48:46 pm »
Yes, it works with Lazarus 0.9.29 r28360 FPC 2.4.3 i386-win32-win32/win64
I updated GBD from 7.0 (included in package) to 7.2 with libexpat-1.dll.

It works with Lazarus Win32 on Vista 64 for both of my DLLs (one is loaded at EXE's startup and others are dynamically loaded at runtime by name like plug-in).

So it may be a good idea to update the current snapshot package with new GBD.

ivan17

  • Full Member
  • ***
  • Posts: 173
Re: [Solved] Debugging DLL?
« Reply #4 on: November 21, 2010, 07:47:07 pm »
ok, i just downloaded new gdb.exe and libexpat-1.dll and everything works nicely. thanks martin!

Steeping from the hos-app, into the dll with F7 does not seem to work reliable.

but stepping inside the dll (once in there) and breakpoints are fine.
true. also, i noticed that stepping OUT works. groovy.

 

TinyPortal © 2005-2018