[Tip: debugging]More Debugging skills

Based on researching a issue met on work, I summarize several new points about debugging:

1. Process directory. As we know, GetCurrentDirectory will return current directory for current process, and SetCurrentDirectory can change the directory for current process. When calling LoadLibrary, it will search PATH + process current directory mainly to get the required dll loaded. Detail about dll search order, please refer to:

http://msdn.microsoft.com/en-us/library/ms682586%28VS.85%29.aspx

2. VS Debug => Exceptions. As we know, if there happened exceptions in program but there is no place to catch it, our program will crash. But by VS's "Exceptions" dialog, we can break when happening those checked exceptions to get better callstack for debugging. It's really useful.

3. Further understand pdb file. Once you can connect VS debugger.exe with the RELEASE application you intent to debug, and to replace the to-be-debugged modules with optimized dll + pdb files, and set proper breakpoints that are to be touched, you can debug your release application now! Key note: pdb file stores source file line, etc information.

 

posted @ 2009-11-25 13:11  能巴  阅读(180)  评论(0编辑  收藏  举报