Advertisement
dcandygmailcom

Brief introduction to Windows' debugger.

Feb 16th, 2019
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. You can also start in a debugger.
  2.  
  3. windbg or ntsd (ntsd is a console program and maybe installed). Both are also from Debugging Tools For Windows.
  4.  
  5. Download and install Debugging Tools for Windows
  6.  
  7. http://msdn.microsoft.com/en-us/windows/hardware/hh852363
  8.  
  9. Install the Windows SDK but just choose the debugging tools.
  10.  
  11. Create a folder called Symbols in C:\
  12.  
  13. Start Windbg. File menu - Symbol File Path and enter
  14.  
  15. srv*C:\symbols*http://msdl.microsoft.com/download/symbols
  16.  
  17. then
  18.  
  19. windbg -o -g -G c:\windows\system32\cmd.exe /k batfile.bat
  20.  
  21. You can press F12 to stop it and kb will show the call stack (g continues the program). If there's errors it will also stop and show them.
  22.  
  23.  
  24.  
  25. Type lm to list loaded modules, x *!* to list the symbols and bp symbolname to set a breakpoint
  26.  
  27. F12 - break into program
  28. g - continue
  29. p - Step
  30. kb - list call stack
  31. lm - list loaded modules
  32. x *!* - list all symbols
  33. ln <address> - lists the nearest symbols to that address - used when you have a crash address
  34. bp symbolname - sets a breakpoint
  35. da <address> - displays the ascii data found at that address
  36. dda <address> - displays the value of the pointer
  37. dv - display local variables
  38. kv 10 - displays last 10 stack frames
  39.  
  40.  
  41.  
  42. If programming in VB6 then this environmental variable link=/pdb:none stores the symbols in the dll rather than seperate files. Make sure you compile the program with No Optimisations and tick the box for Create Symbolic Debug Info. Both on the Compile tab in the Project's Properties.
  43.  
  44. Also CoClassSyms (microsoft.com/msj/0399/hood/hood0399.aspx) can make symbols from type libraries.
  45. .
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement