[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [h-e-w] ANN: Grand Unified Debugger mode for running CDB
From: |
Stephan Doll |
Subject: |
Re: [h-e-w] ANN: Grand Unified Debugger mode for running CDB |
Date: |
Fri, 1 Feb 2002 10:22:59 -0800 |
>>>>> "Syver" == Syver Enstad <address@hidden> writes:
Syver> Way cool Stephan, I was actually thinking about writing a
Syver> console debugger for windows myself.
Syver> A request, do you have a cookbook recipe for say debugging
Syver> an .exe compiled in debug mode. I have never used GUD
Syver> because I only work with MSDEV (VC++), so I am sort of in
Syver> the dark on what is expected behaviour, how to get started.
Here is a simple tutorial:
In Emacs, run
M-x cdb
"Run cdb (like this):" cdb <name of your exe>
This will open a new Emacs buffer "*gud-xxx*". In it you will get a
CDB command prompt '0:000> '. (CDB commands are documented in the
'Debugging tools for Windows' online help). To get to the begin of
your code, type:
'g main' <Enter> (or 'g WinMain' if you have a GUI application).
CDB will load the application and break at your main() function.
Emacs should open another window with your main() source file and show
a little '>' were the debugger stopped. You now can set more
breakpoints in your sources, single-step, etc. To use the common VC++
keys for this purpose, put the following lines in your .emacs:
(global-set-key [f5] 'gud-cont)
(global-set-key [f7] 'gud-tbreak)
(global-set-key [f8] 'gud-step)
(global-set-key [f9] 'gud-break)
(global-set-key [f10] 'gud-next)
(global-set-key [f11] 'gud-finish)
You can also issue additional commands from the CDB command prompt --
e.g.:
- 'dv' Displays local variables
- 'dt' or '??' shows the content of a single variable.
To get the current stack trace, either use the 'k' command or execute
"M-x speedbar". The later will display the calling stack in a
additional Emacs frame and you can use the mouse to switch between
stack frames.
If the little GUD source line marker '>' is hard to follow, add the
following to your .emacs:
;;-------------------------------------------------------------
;; Add color to the current GUD line
;;
(defvar gud-overlay
(let* ((ov (make-overlay (point-min) (point-min))))
(overlay-put ov 'face 'secondary-selection)
ov)
"Overlay variable for GUD highlighting.")
(defadvice gud-display-line (after my-gud-highlight act)
"Highlight current line."
(let* ((ov gud-overlay)
(bf (gud-find-file true-file)))
(save-excursion
(set-buffer bf)
(move-overlay ov (line-beginning-position) (line-end-position)
(current-buffer)))))
(defun gud-kill-buffer ()
(if (eq major-mode 'gud-mode)
(delete-overlay gud-overlay)))
(add-hook 'kill-buffer-hook 'gud-kill-buffer)
;;-------------------------------------------------------------
Have fun,
-Stephan
--
Stephan Doll
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [h-e-w] ANN: Grand Unified Debugger mode for running CDB,
Stephan Doll <=