8

I have a Delphi Windows app that dies horribly under Wine - doesn't even get to creating the main form. Porting to Free Pascal is not an option for various reasons.

Can I debug under Wine using Delphi's native means? If not, can I debug under Wine using gdb, and if so, how do I feed the debug info in Delphi format (Turbo Debugger probably) to gdb?

Finally, how can I detect Wine from a program? The Wine FAQ says I should not, but I don't think that fixing my app is high on the Wine guys' priority list, so I'd rather take the matters in my own hands.

I did not write the app, but I have the sources and a copy of Delphi.

Seva Alekseyev
  • 59,826
  • 25
  • 160
  • 281

3 Answers3

2

I do believe you should be able to debug with gdb, but I don't know how you would feed all the Delphi sources to it. You would need to include all debug information in your EXE (including External debugger) to get started though.

I would recommend you get a logging utility that supports logging over TCP/IP. Two good ones are SmartInspect and CodeSite. Combine those with a stack tracing utility like the JCL provides and you might find it is a better solution then attaching the debugger anyway.

Good luck on detecting Wine though. I would be curious to see what you come up with. Seems like it should be possible though.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Jim McKeeth
  • 38,225
  • 23
  • 120
  • 194
1

You might be able to get the remote debugger to connect to the Wine app (never tried it), but that's asking a lot of Wine.

The first thing I'd try is using a stack tracing utility like the JCL debugging extensions. A stack trace may give you enough information to fix the issue without having to get debugging working under Linux.

Craig Stuntz
  • 125,891
  • 12
  • 252
  • 273
  • That's not unlike the printf()-based debugging of ages past :) Which is an option, I admit. Just not a pleasant one. – Seva Alekseyev Jan 06 '10 at 21:35
  • As a debugging tool, yes. As a way of getting postmortems from customers or other cases which can be difficult to reproduce, it's priceless. – Craig Stuntz Jan 06 '10 at 22:32
  • Right now my ambition is more humble - getting the damn thing to start and show the main window would be good enough. :) And the app is freeware, so rigorous customer support is not on my agenda. Thanks for the link though. – Seva Alekseyev Jan 06 '10 at 23:27
0

If you've got the source code, then recompile with a bunch of debug messages in and try running it like you'd do on windows.

Wine has a lot of API's that are left unimplemented and you may have some luck installing extra packages at random with winetricks.

I had a similar problem using wine with our Delphi App, I needed to install the ODBC manager, which doesn't come in by default before I could get the thing to work.

Peter Turner
  • 11,199
  • 10
  • 68
  • 109
  • Oh, I read your comment and you're not too keen on printf debugging, oh well. It's probably only 1 or 2 things preventing your software from initializing so it's probably worth it. – Peter Turner Jan 08 '10 at 16:45
  • Well, if there's no better option, then printf() is is. I was just hoping that the collective wizdom of StackOverflow had a better solution. – Seva Alekseyev Jan 08 '10 at 17:14