Author Topic: WinDbg  (Read 13588 times)

Offline etko

  • Multiple posting newcomer
  • *
  • Posts: 10
    • Homepage
WinDbg
« on: December 02, 2005, 09:42:38 am »
Is Microsoft' windows debugger supported?

takeshimiya

  • Guest
Re: WinDbg
« Reply #1 on: December 02, 2005, 09:57:41 am »
I think you can actually use WinDbg, but don't expect integration of it with C::B.

But, it'll be supported in future versions (probably will make it in RC3)

Now what you want to know, the changes in SVN HEAD regarding this:

Debugger plugin
This plugin has been redesigned, almost completely. Prepare yourself for what you 're gonna read in the next paragraphs :)

Added "Attach to process" and "Detach" debugger commands.
The format (dec, hex, etc) used for each debugger watched variable can now be specified.
Improved watches support with dialogs to add/edit watches.
Dialogs were also added to edit breakpoints.

On the subject of breakpoints, if you set a breakpoint and right-click on its red-dot in the editor's margin, you can click "Edit breakpoint". What you can set there is:
  • Enable/disable that breakpoint :).
  • Set the ignore-count. This tells the debugger that it should be ignored for X passes before breaking (useful in loops) :).
  • Make it conditional by setting a condition, e.g. x>8 (this would make the breakpoint hit only if x was greater than 8 ) :).

But these wouldn't be possible without the present redesign.
A base DebuggerDriver (debuggerdriver.h) class has been created and GDB_driver derives from it. A base DebuggerCommand (debugger_defs.h) class has also been added, which just sends the passed command to the driver and (optionally) displays its output in the debug log. Every debugger input/output goes to the debugger debug-log.
Already implemented GDB commands can be found in gdb_commands.h. Each command is a small class deriving from DebuggerCommand and, by convenience, their names start with GdbCmd_ (for GDB_driver).

Now for the most important part (for many users): I have already implemented (rudimentary) support for cdb.exe/ntsd.exe. This means C::B can now debug MSVC generated programs :D.
As far as I know, C::B is the very first open source IDE with this very feature ;)
What I mean by "rudimentary support" is it can start the debugging process, set/unset breakpoints, break on set breakpoints and stop the debugging process. It still lacks support for watches, backtrace, disassembly and tooltip evaluation. But all that is needed is to write the relevant commands (driver in cdb_driver.h and commands in cdb_commands.h) :).
But don't try debugging MSVC programs just now. I haven't yet added a way to recognize which debugger to use ;).

After such a rewrite, testing is badly needed. It works fine even for debugging C::B itself but certainly some bugs have creeped in. Those should be identified and fixed. With the new design, it should be easier for people to understand what's going on and help with those bugs. But things are already looking good :)

As a last note, GDB breakpoints are now explicitely pending meaning that you can set a breakpoint on a DLL and it will be set when that DLL is loaded. Also means you can just put breakpoints anywhere in C::B source code and press "Debug->Start" (yes, I renamed it). No more wizard skills are needed to debug C::B :)

Finally, debugging is now much more responsive (aka faster).
« Last Edit: December 02, 2005, 09:59:52 am by Takeshi Miya »

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: WinDbg
« Reply #2 on: December 02, 2005, 11:02:03 am »
Debugger plugin
...
Now for the most important part (for many users): I have already implemented (rudimentary) support for cdb.exe/ntsd.exe. This means C::B can now debug MSVC generated programs :D.
As far as I know, C::B is the very first open source IDE with this very feature ;)
What I mean by "rudimentary support" is it can start the debugging process, set/unset breakpoints, break on set breakpoints and stop the debugging process. It still lacks support for watches, backtrace, disassembly and tooltip evaluation. But all that is needed is to write the relevant commands (driver in cdb_driver.h and commands in cdb_commands.h) :).
But don't try debugging MSVC programs just now. I haven't yet added a way to recognize which debugger to use ;).

As a matter of fact, only the disassembly listing does not yet work with cdb. And the debugger is chosen automatically based on the compiler. Still needs improvement because this auto-selection works only for builtin-compilers, but we 'll get there...
Be patient!
This bug will be fixed soon...

tlukanov

  • Guest
Re: WinDbg
« Reply #3 on: December 09, 2005, 12:08:05 pm »
Hi !
Can I debug Digital Mars compiled executables using Code::Blocks IDE ?
If Yes how to do this ?

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: WinDbg
« Reply #4 on: December 09, 2005, 01:17:31 pm »
Just implemented disassembly for cdb. So, no TODOs anymore ;)

Quote from: tlukanov
Hi !
Can I debug Digital Mars compiled executables using Code::Blocks IDE ?
If Yes how to do this ?

Please don't hijack topics like this. The topic's title is "WinDbg", not "General info on debugging with C::B".
Anyway, I don't use DM so I can't tell what's needed to debug DM programs...
Be patient!
This bug will be fixed soon...

takeshimiya

  • Guest
Re: WinDbg
« Reply #5 on: December 09, 2005, 02:02:36 pm »
WinDbg or any Microsoft/Symantec debugger...

Specifically it works with:
Microsoft free debuggers: WinDbg, Codeview, symdeb, and VC++ debugger
Others: Symantec, Zortech, Rational Systems, Multiscope.

General instructions for WinGdb.
« Last Edit: December 09, 2005, 02:24:51 pm by Takeshi Miya »

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: WinDbg
« Reply #6 on: December 09, 2005, 03:47:00 pm »
WinDbg or any Microsoft/Symantec debugger...

So this means cdb too?
Be patient!
This bug will be fixed soon...

takeshimiya

  • Guest
Re: WinDbg
« Reply #7 on: December 09, 2005, 04:26:08 pm »
I think so, because DMars uses the MS Codeview format. It is stated that it should work on any MS debugger.


dmc.exe
-g4 Generate Codeview 4 format debug info. This is the default.


Offline etko

  • Multiple posting newcomer
  • *
  • Posts: 10
    • Homepage
Re: WinDbg
« Reply #8 on: December 09, 2005, 05:31:12 pm »
So if i got it right it is possible to debug vc toolkit generated programs? Which version of c::b I must use to debug vctk2003 with windbg?

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: WinDbg
« Reply #9 on: December 09, 2005, 06:46:22 pm »
So if i got it right it is possible to debug vc toolkit generated programs? Which version of c::b I must use to debug vctk2003 with windbg?

These updates are in SVN HEAD.
And you don't need WinDbg but CDB, which is also a part of "Microsoft Debugging Tools for Windows".
Be patient!
This bug will be fixed soon...

ref

  • Guest
Re: WinDbg
« Reply #10 on: April 04, 2006, 02:46:49 pm »
I use WinDbd , wenn i run it and load a code file.exe , the results is displayed, only the black command window is without results, why??, how can I fix it and let the results appear in it?? , I use codeblocks as compiler , must I change some settings there in order to solve this probleme with WinDbg?