Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging cross-compiled code: Linux->Windows

I'm cross-compiling a project from Linux to target Windows (using mingw). The output is a DLL and p-invoking into it from C# works, but debugging is very difficult. The build outputs a .o file, which can provide symbols to gdb, but basically all I can do there is break on exceptions and find the name of the function that was executing when the exception happened; not even the full stack trace. I can't debug with WinDbg because I don't have .pdb files.

This is an open source project set up to build on Linux; I believe their build process relies on several installed Linux packages to work.

Do I have any options here? Is there a utility that can convert .o files into .pdb? Or some program that can give me more information than gdb when debugging?

like image 372
RandomEngy Avatar asked May 31 '11 19:05

RandomEngy


2 Answers

Try a IDE that support mingw. For example the open source Code::blocks.

like image 193
xpol Avatar answered Oct 18 '22 09:10

xpol


Another possibility is to do it manually: compile it with debug symbols, start you application and attach the GDB debugger to it. It is also part of the MingW32 distribution. Then you can set your breakpoints and debug your application

But I guess using Code::Block is more comfortable

By the way, the GCC compiler does not generate pdb files because it is a propietary format

like image 28
jpmuc Avatar answered Oct 18 '22 11:10

jpmuc