开发者

Tips for debugging a made-for-linux application on windows?

开发者 https://www.devze.com 2022-12-11 21:23 出处:网络
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

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 开发者_JAVA技巧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...


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


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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消