views:

59

answers:

4

I'm trying to find the source of a bug I have found in an open-source application.

I have managed to get a build up and running on my Windows machine, but I'm having trouble finding the spot in the disassembly where the issue is.

I have tried three different debuggers (WinDbg, OllyDbg, and VisualStudio) and each pretty much gives me the same information.

So, given that I have the source code, what can I do to debug a live application? If the application was written in C, how can I inspect the data structures?

Do any of the debuggers listed above support loading of gcc's debugging symbols?

It feels to me like I'm doing something way-wrong. I really don't want to try to debug this app in optimized assembly...

+1  A: 

there is some port of GDB from cygwin or MinGW why don't your try with gdb directly?

RageZ
Oh, well I have tried that too... Not really sure what I am doing though. I guess the real problem here is that I lack a lot of understanding.
John Gietzen
I am pretty sure if you compile under GCC (windows) and debug under GDB the symbol would load properly
RageZ
And the Eclipse CDT ( http://eclipse.org/cdt/ ) provides a pretty comfortable frontend for GDB on windows.
Suppressingfire
+1  A: 

The simple answer is: if you can't run it, the best any tool will be able to do is debug compile-time errors. That's even if you have the source.

From you description, it is evident that the bug you're trying to root out is a run-time bug (not compile time), so you will have be able to actually run it. If your application cannot run in Windows, than you shoudln't be attempting to debug it from windows.

That being said, using something like cygwin, as RageZ has suggested, is probably your best bet. Then just debug the program like you would in linux.

HTH

bguiz
Oh, it's running. The bug is non-catastrophic. It is a rendering bug.
John Gietzen
A: 

How did you build it on Windows?

Could you perhaps try building with MSVC itself? Then, you can build a debug version and debug it easily - the graphical debugger of MSVC is pretty good.

Eli Bendersky
There was a script provided that downloaded all of the dependencies and did a full build.
John Gietzen
A: 

If everything else fails you still can put lots of logging in the code around where you have identified the bug, and the best in this is that this works even in release mode. Just don't forget to remove the logging lines when you've fixed the bug.

fritzone