[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/progmodes/gdb-ui.el
From: |
Nick Roberts |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/progmodes/gdb-ui.el |
Date: |
Wed, 07 Dec 2005 18:05:47 -0500 |
Index: emacs/lisp/progmodes/gdb-ui.el
diff -c emacs/lisp/progmodes/gdb-ui.el:1.125
emacs/lisp/progmodes/gdb-ui.el:1.126
*** emacs/lisp/progmodes/gdb-ui.el:1.125 Tue Dec 6 21:42:54 2005
--- emacs/lisp/progmodes/gdb-ui.el Wed Dec 7 23:05:47 2005
***************
*** 110,116 ****
(defvar gdb-flush-pending-output nil)
(defvar gdb-location-alist nil
"Alist of breakpoint numbers and full filenames.")
- (defvar gdb-find-file-unhook nil)
(defvar gdb-active-process nil "GUD tooltips display variable values when t, \
and #define directives otherwise.")
(defvar gdb-error "Non-nil when GDB is reporting an error.")
--- 110,115 ----
***************
*** 160,165 ****
--- 159,166 ----
(defvar gdb-first-post-prompt nil)
(defvar gdb-version nil)
(defvar gdb-locals-font-lock-keywords nil)
+ (defvar gdb-source-file-list nil
+ "List of source files for the current executable")
(defconst gdb-error-regexp "\\^error,msg=\"\\(.+\\)\"")
(defvar gdb-locals-font-lock-keywords-1
***************
*** 190,197 ****
;; Variables for GDB 6.4+
- (defvar gdb-source-file-list nil
- "List of source files for the current executable")
(defvar gdb-register-names nil "List of register names.")
(defvar gdb-changed-registers nil
"List of changed register numbers (strings).")
--- 191,196 ----
***************
*** 351,389 ****
(list (concat gdb-server-prefix "print " expr "\n")
'gdb-tooltip-print))))))
! (defun gdb-set-gud-minor-mode (buffer)
! "Set `gud-minor-mode' from find-file if appropriate."
! (goto-char (point-min))
! (unless (search-forward "No source file named " nil t)
! (condition-case nil
! (gdb-enqueue-input
! (list (concat gdb-server-prefix "info source\n")
! `(lambda () (gdb-set-gud-minor-mode-1 ,buffer))))
! (error (setq gdb-find-file-unhook t)))))
!
! (defun gdb-set-gud-minor-mode-1 (buffer)
! (goto-char (point-min))
! (when (and (search-forward "Located in " nil t)
! (looking-at "\\S-+")
! (string-equal (buffer-file-name buffer)
! (match-string 0)))
! (with-current-buffer buffer
! (set (make-local-variable 'gud-minor-mode) 'gdba)
! (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)
! (when gud-tooltip-mode
! (make-local-variable 'gdb-define-alist)
! (gdb-create-define-alist)
! (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))))
(defun gdb-set-gud-minor-mode-existing-buffers ()
! (dolist (buffer (buffer-list))
! (let ((file (buffer-file-name buffer)))
! (if file
! (progn
! (gdb-enqueue-input
! (list (concat gdb-server-prefix "list "
! (file-name-nondirectory file) ":1\n")
! `(lambda () (gdb-set-gud-minor-mode ,buffer)))))))))
(defun gdb-find-watch-expression ()
(let* ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list))
--- 350,374 ----
(list (concat gdb-server-prefix "print " expr "\n")
'gdb-tooltip-print))))))
! (defconst gdb-source-file-regexp "\\(.+?\\), \\|\\([^, \n].*$\\)")
(defun gdb-set-gud-minor-mode-existing-buffers ()
! "Create list of source files for current GDB session."
! (goto-char (point-min))
! (when (search-forward "read in on demand:" nil t)
! (while (re-search-forward gdb-source-file-regexp nil t)
! (push (or (match-string 1) (match-string 2)) gdb-source-file-list))
! (dolist (buffer (buffer-list))
! (with-current-buffer buffer
! (when (and buffer-file-name
! (member (file-name-nondirectory buffer-file-name)
! gdb-source-file-list))
! (set (make-local-variable 'gud-minor-mode) 'gdba)
! (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)
! (when gud-tooltip-mode
! (make-local-variable 'gdb-define-alist)
! (gdb-create-define-alist)
! (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))))))
(defun gdb-find-watch-expression ()
(let* ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list))
***************
*** 471,477 ****
gdb-server-prefix "server "
gdb-flush-pending-output nil
gdb-location-alist nil
- gdb-find-file-unhook nil
gdb-source-file-list nil
gdb-error nil
gdb-macro-info nil
--- 456,461 ----
***************
*** 491,504 ****
(gdb-enqueue-input (list "set new-console off\n" 'ignore)))
(gdb-enqueue-input (list "set height 0\n" 'ignore))
(gdb-enqueue-input (list "set width 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))
(if (string-equal gdb-version "pre-6.4")
(progn
! (gdb-set-gud-minor-mode-existing-buffers)
(setq gdb-locals-font-lock-keywords gdb-locals-font-lock-keywords-1))
(gdb-enqueue-input
(list "server interpreter mi -data-list-register-names\n"
--- 475,485 ----
(gdb-enqueue-input (list "set new-console off\n" 'ignore)))
(gdb-enqueue-input (list "set height 0\n" 'ignore))
(gdb-enqueue-input (list "set width 0\n" 'ignore))
(if (string-equal gdb-version "pre-6.4")
(progn
! (gdb-enqueue-input (list (concat gdb-server-prefix "info sources\n")
! 'gdb-set-gud-minor-mode-existing-buffers))
(setq gdb-locals-font-lock-keywords gdb-locals-font-lock-keywords-1))
(gdb-enqueue-input
(list "server interpreter mi -data-list-register-names\n"
***************
*** 509,514 ****
--- 490,500 ----
'gdb-set-gud-minor-mode-existing-buffers-1))
(setq gdb-locals-font-lock-keywords gdb-locals-font-lock-keywords-2))
+ ;; 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))
(defun gdb-get-version ()
***************
*** 2689,2706 ****
gud-comint-buffer
(eq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
'gdba))
! (if (string-equal gdb-version "pre-6.4")
! (condition-case nil
! (gdb-enqueue-input
! (list (concat gdb-server-prefix "list "
! (file-name-nondirectory buffer-file-name)
! ":1\n")
! `(lambda () (gdb-set-gud-minor-mode ,(current-buffer)))))
! (error (setq gdb-find-file-unhook t)))
! (if (member buffer-file-name gdb-source-file-list)
! (with-current-buffer (find-buffer-visiting buffer-file-name)
! (set (make-local-variable 'gud-minor-mode) 'gdba)
! (set (make-local-variable 'tool-bar-map) gud-tool-bar-map))))))
;;from put-image
(defun gdb-put-string (putstring pos &optional dprop &rest sprops)
--- 2675,2684 ----
gud-comint-buffer
(eq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
'gdba))
! (if (member buffer-file-name gdb-source-file-list)
! (with-current-buffer (find-buffer-visiting buffer-file-name)
! (set (make-local-variable 'gud-minor-mode) 'gdba)
! (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)))))
;;from put-image
(defun gdb-put-string (putstring pos &optional dprop &rest sprops)
***************
*** 2978,2992 ****
(if (re-search-forward " source language \\(\\S-*\\)\." nil t)
(setq gdb-current-language (match-string 1)))
(gdb-invalidate-assembler))
;; Code specific to GDB 6.4
!
! (defconst gdb-source-file-regexp "fullname=\"\\(.*?\\)\"")
(defun gdb-set-gud-minor-mode-existing-buffers-1 ()
"Create list of source files for current GDB session."
(goto-char (point-min))
! (while (re-search-forward gdb-source-file-regexp nil t)
(push (match-string 1) gdb-source-file-list))
(dolist (buffer (buffer-list))
(with-current-buffer buffer
--- 2956,2970 ----
(if (re-search-forward " source language \\(\\S-*\\)\." nil t)
(setq gdb-current-language (match-string 1)))
(gdb-invalidate-assembler))
+
;; Code specific to GDB 6.4
! (defconst gdb-source-file-regexp-1 "fullname=\"\\(.*?\\)\"")
(defun gdb-set-gud-minor-mode-existing-buffers-1 ()
"Create list of source files for current GDB session."
(goto-char (point-min))
! (while (re-search-forward gdb-source-file-regexp-1 nil t)
(push (match-string 1) gdb-source-file-list))
(dolist (buffer (buffer-list))
(with-current-buffer buffer
***************
*** 3089,3095 ****
"number=\"\\(.*?\\)\",value=\"\\(.*?\\)\"")
(defun gdb-data-list-register-values-handler ()
! (setq gdb-pending-triggers (delq 'gdb-invalidate-registers
gdb-pending-triggers))
(goto-char (point-min))
(if (re-search-forward gdb-error-regexp nil t)
--- 3067,3073 ----
"number=\"\\(.*?\\)\",value=\"\\(.*?\\)\"")
(defun gdb-data-list-register-values-handler ()
! (setq gdb-pending-triggers (delq 'gdb-invalidate-registers-1
gdb-pending-triggers))
(goto-char (point-min))
(if (re-search-forward gdb-error-regexp nil t)