views:

958

answers:

7

I am attempting to use WinDBG or another debugger to debug a CodeGear Delphi 2007 Windows application on a remote machine. I have been unable to produce symbol files for WinDBG.

Is there a way to use WinDBG or another debugger to debug Delphi applications on a system that doesn't include the IDE?

Edit1

The remote debugger is not an option here. I am able to remote in to the end user PC, but I am unable to use the remote debugger due to firewall restrictions.

Edit2

I am able to remote in to the machine, but can not connect the CodeGear remote debugger due to firewall restrictions.

+5  A: 

How about the remote debugger? Build your app with remote debug symbols and debug from your development machine across the network.

Bruce McGee
I would love to be able to do this, but regretfully the other machine is on a completely different network with firewall restrictions.
Dustin Venegas
But if the machine is on a completely different network behind a firewall, you'll never be able to debug it with a debugger. Your question doesn't make sense, I'm afraid. "How can I use a debugger on an app on a machine I can't get access to with a debugger?" +1 to X-Ray.
Ken White
I have been able to remote in to the PC, but I am unable to connect the Remote Debugger through TCP\IP. I was looking at something similar to WinDBG to troubleshoot the application through the GUI since I can't directly connect the debugger.
Dustin Venegas
If you can't connect remotely, then I like X-Ray's idea. madExcept rocks.
Bruce McGee
A: 

In Delphi you could use Run -> Attach to Process, select the remote machine and select the process you'd like to debug.

Lieven
... asuming the target machine is running the remote debugger.
dummzeuch
I've never used this "procedure" so I didn't think of it. Thx for setting it straight, at least "I"'ve learned something.
Lieven
+5  A: 

instead, i rely on MadExcept stack tracing and some logging features. my application is distributed worldwide & this has been sufficient.

X-Ray
I looked in to this product a little more and I'm pretty impressed with what it can do! Regretfully, the application isn't crashing. I'm needing a way to dump the memory or walk the application to catch a more logical error occurring. Thank you for the interesting product though!
Dustin Venegas
+3  A: 

You can try generating a map file and then convert it to a dbg file using map2dbg from http://code.google.com/p/map2dbg/

Then you can load the dbg file in WinDbg.

Disclaimer: I had faced a similar issue but I managed to do remote debugging and didn't have to do all this. So I am not sure this will work. But if you try it then do let us know if it works.

I looked in to this quite a bit yesterday and discovered that it isn't compatible with Delphi yet. If you've got any more information on it, this would be perfect.
Dustin Venegas
+2  A: 

I'm afraid this is one more of those "I don't have an actual answer" answers, but it might just help...

Have you considered adding logging to your application? I've heard great things about SmartInspect. With it, you can log all sorts of information, including stack traces and "watches" (variables).

Another logging product for Delphi is EurekaLog.

onnodb
I can confirm that SmartInspect is a very reliable solution. Ok, you cannot singlestep debug with it the logging is very good and advanced.
Roland Bengtsson
A: 

I used OllyDbg to debug Delphi applications in the past. It's much less painful than WinDBG since it gets to startup code directly. And Delphi's assembly output was pretty clean from what I recall. As a bonus keyboard shortcuts are the same as Delphi.

If you don't have symbols you'll have to stick to machine code debugging though.

ssg
A: 

Thank you all for the great suggestions and interesting products.

To solve this specific issue, the "best" way I found uses the OutputDebugString located in the Windows namespace. This, along with Debug View from Sysinternals, will allow me to gather debug information and sort through it pretty quickly.

If you decide to use this method, make sure everything is wrapped in ANSI formatting. IE:

OutputDebugString(PAnsiChar(string1 + string2));

This makes sure that string1 and string2 are combined and then converted in to ANSI Characters.

I probably should have just started dumping text to a file for something quick and dirty, but this will allow a non-debugging version to emit debugging messages.

Dustin Venegas
I want to leave this question open for a few more days to see if we can't get a better answer than this to actually connect the debugger.
Dustin Venegas