Can I use FPC to compile and debug windows dlls? 
Author Message
 Can I use FPC to compile and debug windows dlls?

I have a large app with lots of plugins (dlls) made in delphi 5 + 6.
However, in "such" scale, Delphi can't handle debugging dlls (IMHO).

And if you don't believe / agree with me, here is a link that contains lots
of other links:
http://www.*-*-*.com/ +Schulz+Delphi+DLL+debugging&...
r=&ie=UTF-8&selm=3d17a00d_2%40dnews&rnum=2

Suffice to say I am tired of using 1 hour to just get lucky to get one clean
stepping through a dll function.
My dlls aren't using dialogs, forms etc. I have written much of my source
with compability in mind (only using D5 TRL functions).

Do you think I can use FPC or Lazarus for this?

best regards
Thomas



Tue, 14 Dec 2004 20:17:48 GMT  
 Can I use FPC to compile and debug windows dlls?

Quote:

> I have a large app with lots of plugins (dlls) made in Delphi 5 + 6.
> However, in "such" scale, Delphi can't handle debugging dlls (IMHO).

FPC uses GDB, but the textmode IDE (and this is also starting to work in
Lazarus too) is the actual de{*filter*}. Both IDEs are a tool for it.

FPC and GDB are separate in principle. GDB has a terse console though, and
the FPC ide could somewhat ease that. It maybe might not even matter if the
FPC compiled the original code.

Since it requires a (probably) different debugging metadata. (stabs or dwarf
instead of TD32), you would need to either get Delphi to generate GDB readable
metadata (don't know if Delphi supports more kinds),

Or compile the program or a crucial part using FPC, but that effectively means
no threading and no GUI (and no a lot of other things).

Quote:
> Suffice to say I am tired of using 1 hour to just get lucky to get one clean
> stepping through a dll function.
> My dlls aren't using dialogs, forms etc. I have written much of my source
> with compability in mind (only using D5 TRL functions).

> Do you think I can use FPC or Lazarus for this?

I think you need a different de{*filter*} more than a different compiler.

If you can reproduce the problematic behaviour  with a different de{*filter*},
you can be certain that there are no processor, compiler or language
specific problems, or language related problems.

(like
- optimizers and other stuff. IIRC calls can be optimized away, and won't
trigger the de{*filter*} correctly on Delphi. Turn optimizations off, also when
building the DLLs)
-  Automation/dynamic type problems.
- odd interface behaviour.
- mem/VMT corruption.
- relocation problems of windows itself. Just like Delphi, Win2000 is far
  from bulletproof. Maybe the loading of the DLL is a problem (did you check
  base addrs of both. Try also on Win98, since w9x handling of DLLs is
  different from NTs.
)

If the mail references you give are true, and you verified it with very
minimal code, you could rule it out much easier. It is simply experience
that 90-99% of all reported compiler bugs are faults in programs, or
misunderstanding of some specification.

First I would contact GDB (maillists), to see if it is possible, and/or try
to find any other de{*filter*}s directly.

Maybe Delphi has some option to specify a certain debugging format (like
e.g. some M$ format) that is supported by more Windows-de{*filter*}s.

This will be less comfy than Delphi though.

FPC can generate GDB debugging info, but I don't know how GDB handles DLLs,
and the FPC compilability of the program depends heavily on the code.
If it uses Visual VCL classes are not possible, if it is nearly pure business
logic, or can e.g. be compiled to a server only version, it might be possible.



Sat, 18 Dec 2004 04:44:45 GMT  
 Can I use FPC to compile and debug windows dlls?

Quote:
> Since it requires a (probably) different debugging metadata. (stabs or
dwarf
> instead of TD32), you would need to either get Delphi to generate GDB
readable
> metadata (don't know if Delphi supports more kinds),

I don't believe it does.

Quote:
> Or compile the program or a crucial part using FPC, but that effectively
means
> no threading and no GUI (and no a lot of other things).

The no threading is probably my biggest concerning.
Since the app using the dlls will do it in a multithreadet manner,
the plugins need to do that as well. I have no GUI.

Quote:
> - optimizers and other stuff. IIRC calls can be optimized away, and won't
> trigger the de{*filter*} correctly on Delphi. Turn optimizations off, also
when
> building the DLLs)
> -  Automation/dynamic type problems.
> - odd interface behaviour.
> - mem/VMT corruption.
> - relocation problems of windows itself. Just like Delphi, Win2000 is far
>   from bulletproof. Maybe the loading of the DLL is a problem (did you
check
>   base addrs of both. Try also on Win98, since w9x handling of DLLs is
>   different from NTs.

I always turn optimizing off for debug.
But good list of suggestions.

Quote:
> If the mail references you give are true, and you verified it with very
> minimal code, you could rule it out much easier. It is simply experience
> that 90-99% of all reported compiler bugs are faults in programs, or
> misunderstanding of some specification.

I am pretty sure that many of my DLL problems fall into the 1-10% :-(.

Quote:
> and the FPC compilability of the program depends heavily on the code.
> If it uses Visual VCL classes are not possible, if it is nearly pure
business
> logic, or can e.g. be compiled to a server only version, it might be

possible.

As of now I only use Delph5 RTL (and non-visual classes) - no VCL.

Thanks for your response Marco, I will look more into FPC+GDB stuff.

best regards
Thomas Schulz



Tue, 21 Dec 2004 05:14:59 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. DLL Compiling Question [FPC]

2. DLL Compiling Question [FPC}

3. BDE ERROR WHEN DEBUGGING AN ISAPI DLL WITH IIS5 / WINDOWS 2000

4. BDE PROBLEM WHEN DEBUGGING AN ISAPI DLL WITH IIS5 / WINDOWS 2000

5. Using winsock.dll outside of Windows?

6. Window creation in generic windows app compiled in Delphi (without forms etc)

7. TDX unfriendly for debugging multiple dlls

8. Debugging a C++ DLL accessed from a Delphi program

9. It's not bad canned meat...

10. compile to .dll ?

11. I need to compile a 16 bit dll

12. DLL ACCESS WORKS IN IDE NOT COMPILED

 

 
Powered by phpBB® Forum Software