[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: M-x gdb troubles
From: |
Nick Roberts |
Subject: |
RE: M-x gdb troubles |
Date: |
Wed, 21 Apr 2004 20:16:37 +0100 |
> If I have a running gdb process (M-x gdb ... run), and accidentally do
> M-x gdb again (instead of switching to the gdb buffer), things get
> really messy...
> Maybe the second M-x gdb should just switch to the current gdb buffer
> if I enter the same command line as a previous gdb run.
How about this patch. The catch form would have to be added to the other
debugger functions (dbx, pdb, perldb etc) to be consistent.
*** gud.el.~1.19.~ 2004-04-15 20:39:43.000000000 +0100
--- gud.el 2004-04-21 19:27:43.000000000 +0100
***************
*** 526,556 ****
and source-file directory for your debugger."
(interactive (list (gud-query-cmdline 'gdb)))
! (gud-common-init command-line nil 'gud-gdb-marker-filter)
! (set (make-local-variable 'gud-minor-mode) 'gdb)
!
! (gud-def gud-break "break %f:%l" "\C-b" "Set breakpoint at current line.")
! (gud-def gud-tbreak "tbreak %f:%l" "\C-t" "Set temporary breakpoint at
current line.")
! (gud-def gud-remove "clear %f:%l" "\C-d" "Remove breakpoint at current
line")
! (gud-def gud-step "step %p" "\C-s" "Step one source line with
display.")
! (gud-def gud-stepi "stepi %p" "\C-i" "Step one instruction with
display.")
! (gud-def gud-next "next %p" "\C-n" "Step one line (skip functions).")
! (gud-def gud-nexti "nexti %p" nil "Step one instruction (skip
functions).")
! (gud-def gud-cont "cont" "\C-r" "Continue with display.")
! (gud-def gud-finish "finish" "\C-f" "Finish executing current
function.")
! (gud-def gud-jump "tbreak %f:%l\njump %f:%l" "\C-j" "Relocate execution
address to line at point in source buffer.")
!
! (gud-def gud-up "up %p" "<" "Up N stack frames (numeric arg).")
! (gud-def gud-down "down %p" ">" "Down N stack frames (numeric arg).")
! (gud-def gud-print "print %e" "\C-p" "Evaluate C expression at point.")
! (gud-def gud-until "until %l" "\C-u" "Continue to current line.")
! (gud-def gud-run "run" nil "Run the program.")
!
! (local-set-key "\C-i" 'gud-gdb-complete-command)
! (setq comint-prompt-regexp "^(.*gdb[+]?) *")
! (setq paragraph-start comint-prompt-regexp)
! (setq gdb-first-prompt t)
! (run-hooks 'gdb-mode-hook))
;; One of the nice features of GDB is its impressive support for
;; context-sensitive command completion. We preserve that feature
--- 526,557 ----
and source-file directory for your debugger."
(interactive (list (gud-query-cmdline 'gdb)))
! (catch 'existing
! (gud-common-init command-line nil 'gud-gdb-marker-filter)
! (set (make-local-variable 'gud-minor-mode) 'gdb)
!
! (gud-def gud-break "break %f:%l" "\C-b" "Set breakpoint at current
line.")
! (gud-def gud-tbreak "tbreak %f:%l" "\C-t" "Set temporary breakpoint at
current line.")
! (gud-def gud-remove "clear %f:%l" "\C-d" "Remove breakpoint at current
line")
! (gud-def gud-step "step %p" "\C-s" "Step one source line with
display.")
! (gud-def gud-stepi "stepi %p" "\C-i" "Step one instruction with
display.")
! (gud-def gud-next "next %p" "\C-n" "Step one line (skip
functions).")
! (gud-def gud-nexti "nexti %p" nil "Step one instruction (skip
functions).")
! (gud-def gud-cont "cont" "\C-r" "Continue with display.")
! (gud-def gud-finish "finish" "\C-f" "Finish executing current
function.")
! (gud-def gud-jump "tbreak %f:%l\njump %f:%l" "\C-j" "Relocate execution
address to line at point in source buffer.")
!
! (gud-def gud-up "up %p" "<" "Up N stack frames (numeric arg).")
! (gud-def gud-down "down %p" ">" "Down N stack frames (numeric
arg).")
! (gud-def gud-print "print %e" "\C-p" "Evaluate C expression at
point.")
! (gud-def gud-until "until %l" "\C-u" "Continue to current line.")
! (gud-def gud-run "run" nil "Run the program.")
!
! (local-set-key "\C-i" 'gud-gdb-complete-command)
! (setq comint-prompt-regexp "^(.*gdb[+]?) *")
! (setq paragraph-start comint-prompt-regexp)
! (setq gdb-first-prompt t)
! (run-hooks 'gdb-mode-hook)))
;; One of the nice features of GDB is its impressive support for
;; context-sensitive command completion. We preserve that feature
***************
*** 2384,2391 ****
(if (file-name-directory file-subst)
(expand-file-name file-subst)
file-subst)))
! (filepart (and file-word (concat "-" (file-name-nondirectory file)))))
(pop-to-buffer (concat "*gud" filepart "*"))
;; Set the dir, in case the buffer already existed with a different dir.
(setq default-directory dir)
;; Set default-directory to the file's directory.
--- 2385,2394 ----
(if (file-name-directory file-subst)
(expand-file-name file-subst)
file-subst)))
! (filepart (and file-word (concat "-" (file-name-nondirectory file))))
! (existing-buffer (get-buffer (concat "*gud" filepart "*"))))
(pop-to-buffer (concat "*gud" filepart "*"))
+ (if existing-buffer (throw 'existing 'existing))
;; Set the dir, in case the buffer already existed with a different dir.
(setq default-directory dir)
;; Set default-directory to the file's directory.
*** gdb-ui.el.~1.9.~ 2004-04-20 00:21:06.000000000 +0100
--- gdb-ui.el 2004-04-21 19:20:40.000000000 +0100
***************
*** 119,126 ****
(interactive (list (gud-query-cmdline 'gdba)))
;;
;; Let's start with a basic gud-gdb buffer and then modify it a bit.
! (gdb command-line)
! (gdb-ann3))
(defvar gdb-debug-log nil)
--- 119,125 ----
(interactive (list (gud-query-cmdline 'gdba)))
;;
;; Let's start with a basic gud-gdb buffer and then modify it a bit.
! (gdb-ann3 (gdb command-line)))
(defvar gdb-debug-log nil)
***************
*** 134,200 ****
:type 'boolean
:group 'gud)
! (defun gdb-ann3 ()
! (setq gdb-debug-log nil)
! (set (make-local-variable 'gud-minor-mode) 'gdba)
! (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter)
! ;;
! (gud-def gud-break (if (not (string-equal mode-name "Machine"))
! (gud-call "break %f:%l" arg)
! (save-excursion
! (beginning-of-line)
! (forward-char 2)
! (gud-call "break *%a" arg)))
! "\C-b" "Set breakpoint at current line or address.")
! ;;
! (gud-def gud-remove (if (not (string-equal mode-name "Machine"))
! (gud-call "clear %f:%l" arg)
! (save-excursion
! (beginning-of-line)
! (forward-char 2)
! (gud-call "clear *%a" arg)))
! "\C-d" "Remove breakpoint at current line or address.")
! ;;
! (gud-def gud-until (if (not (string-equal mode-name "Machine"))
! (gud-call "until %f:%l" arg)
! (save-excursion
! (beginning-of-line)
! (forward-char 2)
! (gud-call "until *%a" arg)))
! "\C-u" "Continue to current line or address.")
!
! (define-key gud-minor-mode-map [left-margin mouse-1]
! 'gdb-mouse-toggle-breakpoint)
! (define-key gud-minor-mode-map [left-fringe mouse-1]
! 'gdb-mouse-toggle-breakpoint)
! (setq comint-input-sender 'gdb-send)
! ;;
! ;; (re-)initialise
! (setq gdb-current-address "main")
! (setq gdb-previous-address nil)
! (setq gdb-previous-frame nil)
! (setq gdb-current-frame "main")
! (setq gdb-view-source t)
! (setq gdb-selected-view 'source)
! (setq gdb-var-list nil)
! (setq gdb-var-changed nil)
! (setq gdb-first-prompt nil)
! ;;
! (mapc 'make-local-variable gdb-variables)
! (setq gdb-buffer-type 'gdba)
! ;;
! (if gdb-use-inferior-io-buffer (gdb-clear-inferior-io))
! ;;
! (if (eq window-system 'w32)
! (gdb-enqueue-input (list "set new-console off\n" 'ignore)))
! (gdb-enqueue-input (list "set height 0\n" 'ignore))
! ;; find source file and compilation directory here
! (gdb-enqueue-input (list "server list main\n" 'ignore)) ; C program
! (gdb-enqueue-input (list "server list MAIN__\n" 'ignore)) ; Fortran
program
! (gdb-enqueue-input (list "server info source\n" 'gdb-source-info))
! ;;
! (run-hooks 'gdba-mode-hook))
(defcustom gdb-use-colon-colon-notation nil
"Non-nil means use FUNCTION::VARIABLE format to display variables in the
--- 133,200 ----
:type 'boolean
:group 'gud)
! (defun gdb-ann3 (arg)
! (unless (eq arg 'existing)
! (setq gdb-debug-log nil)
! (set (make-local-variable 'gud-minor-mode) 'gdba)
! (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter)
! ;;
! (gud-def gud-break (if (not (string-equal mode-name "Machine"))
! (gud-call "break %f:%l" arg)
! (save-excursion
! (beginning-of-line)
! (forward-char 2)
! (gud-call "break *%a" arg)))
! "\C-b" "Set breakpoint at current line or address.")
! ;;
! (gud-def gud-remove (if (not (string-equal mode-name "Machine"))
! (gud-call "clear %f:%l" arg)
! (save-excursion
! (beginning-of-line)
! (forward-char 2)
! (gud-call "clear *%a" arg)))
! "\C-d" "Remove breakpoint at current line or address.")
! ;;
! (gud-def gud-until (if (not (string-equal mode-name "Machine"))
! (gud-call "until %f:%l" arg)
! (save-excursion
! (beginning-of-line)
! (forward-char 2)
! (gud-call "until *%a" arg)))
! "\C-u" "Continue to current line or address.")
!
! (define-key gud-minor-mode-map [left-margin mouse-1]
! 'gdb-mouse-toggle-breakpoint)
! (define-key gud-minor-mode-map [left-fringe mouse-1]
! 'gdb-mouse-toggle-breakpoint)
! (setq comint-input-sender 'gdb-send)
! ;;
! ;; (re-)initialise
! (setq gdb-current-address "main")
! (setq gdb-previous-address nil)
! (setq gdb-previous-frame nil)
! (setq gdb-current-frame "main")
! (setq gdb-view-source t)
! (setq gdb-selected-view 'source)
! (setq gdb-var-list nil)
! (setq gdb-var-changed nil)
! (setq gdb-first-prompt nil)
! ;;
! (mapc 'make-local-variable gdb-variables)
! (setq gdb-buffer-type 'gdba)
! ;;
! (if gdb-use-inferior-io-buffer (gdb-clear-inferior-io))
! ;;
! (if (eq window-system 'w32)
! (gdb-enqueue-input (list "set new-console off\n" 'ignore)))
! (gdb-enqueue-input (list "set height 0\n" 'ignore))
! ;; find source file and compilation directory here
! (gdb-enqueue-input (list "server list main\n" 'ignore)) ; C program
! (gdb-enqueue-input (list "server list MAIN__\n" 'ignore)) ; Fortran
program
! (gdb-enqueue-input (list "server info source\n" 'gdb-source-info))
! ;;
! (run-hooks 'gdba-mode-hook)))
(defcustom gdb-use-colon-colon-notation nil
"Non-nil means use FUNCTION::VARIABLE format to display variables in the
***************
*** 721,727 ****
(defun gdb-prompt (ignored)
"An annotation handler for `prompt'.
This sends the next command (if any) to gdb."
! (when gdb-first-prompt (gdb-ann3))
(let ((sink (gdb-get-output-sink)))
(cond
((eq sink 'user) t)
--- 721,727 ----
(defun gdb-prompt (ignored)
"An annotation handler for `prompt'.
This sends the next command (if any) to gdb."
! (when gdb-first-prompt (gdb-ann3 nil))
(let ((sink (gdb-get-output-sink)))
(cond
((eq sink 'user) t)
- M-x gdb troubles, Kim F. Storm, 2004/04/20
- RE: M-x gdb troubles,
Nick Roberts <=
- Re: M-x gdb troubles, Stefan Monnier, 2004/04/21
- Re: M-x gdb troubles, Kim F. Storm, 2004/04/21
- Re: M-x gdb troubles, Nick Roberts, 2004/04/21
- Re: M-x gdb troubles, Kim F. Storm, 2004/04/21
- Re: M-x gdb troubles, Miles Bader, 2004/04/21
- Re: M-x gdb troubles, Nick Roberts, 2004/04/22
- Re: M-x gdb troubles, Stefan Monnier, 2004/04/23
- Re: M-x gdb troubles, Nick Roberts, 2004/04/28
- Re: M-x gdb troubles, Stefan Monnier, 2004/04/28