Mercurial > emacs
comparison lisp/progmodes/gdb-ui.el @ 80510:f3ac5401fa8e
(gdb-init-buffer): New function.
(gdb-set-gud-minor-mode-existing-buffers)
(gdb-info-breakpoints-custom, gdb-get-location)
(gdb-set-gud-minor-mode-existing-buffers-1): Use it.
Previously gdb-create-define-alist wasn't always run and added to
after-save-hook.
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Sat, 12 Apr 2008 13:13:32 +0000 |
parents | 0a96ecdd8f7a |
children | 106730cfdf95 ca9efc5939fc |
comparison
equal
deleted
inserted
replaced
80509:4bf438f2be05 | 80510:f3ac5401fa8e |
---|---|
481 (list (concat gdb-server-prefix "print " expr "\n") | 481 (list (concat gdb-server-prefix "print " expr "\n") |
482 `(lambda () (gdb-tooltip-print ,expr)))))))) | 482 `(lambda () (gdb-tooltip-print ,expr)))))))) |
483 | 483 |
484 (defconst gdb-source-file-regexp "\\(.+?\\), \\|\\([^, \n].*$\\)") | 484 (defconst gdb-source-file-regexp "\\(.+?\\), \\|\\([^, \n].*$\\)") |
485 | 485 |
486 (defun gdb-init-buffer () | |
487 (set (make-local-variable 'gud-minor-mode) | |
488 (buffer-local-value 'gud-minor-mode gud-comint-buffer)) | |
489 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) | |
490 (when gud-tooltip-mode | |
491 (make-local-variable 'gdb-define-alist) | |
492 (gdb-create-define-alist) | |
493 (add-hook 'after-save-hook 'gdb-create-define-alist nil t))) | |
494 | |
486 (defun gdb-set-gud-minor-mode-existing-buffers () | 495 (defun gdb-set-gud-minor-mode-existing-buffers () |
487 "Create list of source files for current GDB session." | 496 "Create list of source files for current GDB session." |
488 (goto-char (point-min)) | 497 (goto-char (point-min)) |
489 (when (search-forward "read in on demand:" nil t) | 498 (when (search-forward "read in on demand:" nil t) |
490 (while (re-search-forward gdb-source-file-regexp nil t) | 499 (while (re-search-forward gdb-source-file-regexp nil t) |
493 (dolist (buffer (buffer-list)) | 502 (dolist (buffer (buffer-list)) |
494 (with-current-buffer buffer | 503 (with-current-buffer buffer |
495 (when (and buffer-file-name | 504 (when (and buffer-file-name |
496 (member (file-name-nondirectory buffer-file-name) | 505 (member (file-name-nondirectory buffer-file-name) |
497 gdb-source-file-list)) | 506 gdb-source-file-list)) |
498 (set (make-local-variable 'gud-minor-mode) 'gdba) | 507 (gdb-init-buffer))))) |
499 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) | |
500 (when gud-tooltip-mode | |
501 (make-local-variable 'gdb-define-alist) | |
502 (gdb-create-define-alist) | |
503 (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))))) | |
504 (gdb-force-mode-line-update | 508 (gdb-force-mode-line-update |
505 (propertize "ready" 'face font-lock-variable-name-face))) | 509 (propertize "ready" 'face font-lock-variable-name-face))) |
506 | 510 |
507 (defun gdb-find-watch-expression () | 511 (defun gdb-find-watch-expression () |
508 (let* ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list)) | 512 (let* ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list)) |
1938 (setq file (cdr (assoc bptno gdb-location-alist)))) | 1942 (setq file (cdr (assoc bptno gdb-location-alist)))) |
1939 (if (and file | 1943 (if (and file |
1940 (not (string-equal file "File not found"))) | 1944 (not (string-equal file "File not found"))) |
1941 (with-current-buffer | 1945 (with-current-buffer |
1942 (find-file-noselect file 'nowarn) | 1946 (find-file-noselect file 'nowarn) |
1943 (set (make-local-variable 'gud-minor-mode) | 1947 (gdb-init-buffer) |
1944 'gdba) | |
1945 (set (make-local-variable 'tool-bar-map) | |
1946 gud-tool-bar-map) | |
1947 ;; Only want one breakpoint icon at each | 1948 ;; Only want one breakpoint icon at each |
1948 ;; location. | 1949 ;; location. |
1949 (save-excursion | 1950 (save-excursion |
1950 (goto-line (string-to-number line)) | 1951 (goto-line (string-to-number line)) |
1951 (gdb-put-breakpoint-icon (eq flag ?y) bptno))) | 1952 (gdb-put-breakpoint-icon (eq flag ?y) bptno))) |
3140 (message-box "Cannot find source file for breakpoint location.\n\ | 3141 (message-box "Cannot find source file for breakpoint location.\n\ |
3141 Add directory to search path for source files using the GDB command, dir.")) | 3142 Add directory to search path for source files using the GDB command, dir.")) |
3142 (throw 'file-not-found nil)) | 3143 (throw 'file-not-found nil)) |
3143 (with-current-buffer | 3144 (with-current-buffer |
3144 (find-file-noselect (match-string 0)) | 3145 (find-file-noselect (match-string 0)) |
3145 (save-current-buffer | 3146 (gdb-init-buffer) |
3146 (set (make-local-variable 'gud-minor-mode) 'gdba) | |
3147 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)) | |
3148 ;; only want one breakpoint icon at each location | 3147 ;; only want one breakpoint icon at each location |
3149 (save-excursion | 3148 (save-excursion |
3150 (goto-line (string-to-number line)) | 3149 (goto-line (string-to-number line)) |
3151 (gdb-put-breakpoint-icon (eq flag ?y) bptno))))) | 3150 (gdb-put-breakpoint-icon (eq flag ?y) bptno))))) |
3152 | 3151 |
3164 (if (member (if (string-equal gdb-version "pre-6.4") | 3163 (if (member (if (string-equal gdb-version "pre-6.4") |
3165 (file-name-nondirectory buffer-file-name) | 3164 (file-name-nondirectory buffer-file-name) |
3166 buffer-file-name) | 3165 buffer-file-name) |
3167 gdb-source-file-list) | 3166 gdb-source-file-list) |
3168 (with-current-buffer (find-buffer-visiting buffer-file-name) | 3167 (with-current-buffer (find-buffer-visiting buffer-file-name) |
3169 (set (make-local-variable 'gud-minor-mode) | 3168 (gdb-init-buffer))))) |
3170 (buffer-local-value 'gud-minor-mode gud-comint-buffer)) | |
3171 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map))))) | |
3172 | 3169 |
3173 ;;from put-image | 3170 ;;from put-image |
3174 (defun gdb-put-string (putstring pos &optional dprop &rest sprops) | 3171 (defun gdb-put-string (putstring pos &optional dprop &rest sprops) |
3175 "Put string PUTSTRING in front of POS in the current buffer. | 3172 "Put string PUTSTRING in front of POS in the current buffer. |
3176 PUTSTRING is displayed by putting an overlay into the current buffer with a | 3173 PUTSTRING is displayed by putting an overlay into the current buffer with a |
3491 (while (re-search-forward gdb-source-file-regexp-1 nil t) | 3488 (while (re-search-forward gdb-source-file-regexp-1 nil t) |
3492 (push (match-string 1) gdb-source-file-list)) | 3489 (push (match-string 1) gdb-source-file-list)) |
3493 (dolist (buffer (buffer-list)) | 3490 (dolist (buffer (buffer-list)) |
3494 (with-current-buffer buffer | 3491 (with-current-buffer buffer |
3495 (when (member buffer-file-name gdb-source-file-list) | 3492 (when (member buffer-file-name gdb-source-file-list) |
3496 (set (make-local-variable 'gud-minor-mode) | 3493 (gdb-init-buffer)))) |
3497 (buffer-local-value 'gud-minor-mode gud-comint-buffer)) | |
3498 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) | |
3499 (when gud-tooltip-mode | |
3500 (make-local-variable 'gdb-define-alist) | |
3501 (gdb-create-define-alist) | |
3502 (add-hook 'after-save-hook 'gdb-create-define-alist nil t))))) | |
3503 (gdb-force-mode-line-update | 3494 (gdb-force-mode-line-update |
3504 (propertize "ready" 'face font-lock-variable-name-face))) | 3495 (propertize "ready" 'face font-lock-variable-name-face))) |
3505 | 3496 |
3506 ; Uses "-var-list-children --all-values". Needs GDB 6.4 onwards. | 3497 ; Uses "-var-list-children --all-values". Needs GDB 6.4 onwards. |
3507 (defun gdb-var-list-children-1 (varnum) | 3498 (defun gdb-var-list-children-1 (varnum) |