diff options
| author | Nick Roberts | 2006-05-31 13:21:39 +0000 |
|---|---|---|
| committer | Nick Roberts | 2006-05-31 13:21:39 +0000 |
| commit | c1719ebfb33dab1b850d109cd989fa8c78b4ce87 (patch) | |
| tree | 22e5c7ebcc0def3b9d48f72fe51fd7bd7cca0dc9 | |
| parent | e223ede91633099df2cf0d8853d8de7e191def6e (diff) | |
| download | emacs-c1719ebfb33dab1b850d109cd989fa8c78b4ce87.tar.gz emacs-c1719ebfb33dab1b850d109cd989fa8c78b4ce87.zip | |
(gdb-look-up-stack): New variable.
(gdb-stopped, gdb-info-stack-custom): If there is no source info
look up the stack and pop up GUD buffer if necessary.
(gdb-frames-select): Remove redundant call to gud-display-frame.
(gdb-info-threads-custom): Keep point at start of buffer.
(gdb-find-file-hook): Make it work for pre-GDB 6.4.
| -rw-r--r-- | lisp/progmodes/gdb-ui.el | 116 |
1 files changed, 77 insertions, 39 deletions
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index 3e21c5b3341..0f92523e306 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el | |||
| @@ -125,6 +125,7 @@ and #define directives otherwise.") | |||
| 125 | (defvar gdb-source-window nil) | 125 | (defvar gdb-source-window nil) |
| 126 | (defvar gdb-inferior-status nil) | 126 | (defvar gdb-inferior-status nil) |
| 127 | (defvar gdb-continuation nil) | 127 | (defvar gdb-continuation nil) |
| 128 | (defvar gdb-look-up-stack nil) | ||
| 128 | 129 | ||
| 129 | (defvar gdb-buffer-type nil | 130 | (defvar gdb-buffer-type nil |
| 130 | "One of the symbols bound in `gdb-buffer-rules'.") | 131 | "One of the symbols bound in `gdb-buffer-rules'.") |
| @@ -540,7 +541,8 @@ With arg, use separate IO iff arg is positive." | |||
| 540 | gdb-signalled nil | 541 | gdb-signalled nil |
| 541 | gdb-source-window nil | 542 | gdb-source-window nil |
| 542 | gdb-inferior-status nil | 543 | gdb-inferior-status nil |
| 543 | gdb-continuation nil) | 544 | gdb-continuation nil |
| 545 | gdb-look-up-stack nil) | ||
| 544 | 546 | ||
| 545 | (setq gdb-buffer-type 'gdba) | 547 | (setq gdb-buffer-type 'gdba) |
| 546 | 548 | ||
| @@ -1332,9 +1334,20 @@ directives." | |||
| 1332 | It is just like `gdb-stopping', except that if we already set the output | 1334 | It is just like `gdb-stopping', except that if we already set the output |
| 1333 | sink to `user' in `gdb-stopping', that is fine." | 1335 | sink to `user' in `gdb-stopping', that is fine." |
| 1334 | (setq gud-running nil) | 1336 | (setq gud-running nil) |
| 1335 | (unless (or gud-overlay-arrow-position gud-last-frame | 1337 | (unless (or gud-overlay-arrow-position gud-last-frame) |
| 1336 | (not gud-last-last-frame)) | 1338 | ;;Pop up GUD buffer to display current frame when it doesn't have source |
| 1337 | (gud-display-line (car gud-last-last-frame) (cdr gud-last-last-frame))) | 1339 | ;;information i.e id not compiled with -g as with libc routines generally. |
| 1340 | (let ((special-display-regexps (append special-display-regexps '(".*"))) | ||
| 1341 | (special-display-frame-alist gdb-frame-parameters) | ||
| 1342 | (same-window-regexps nil)) | ||
| 1343 | (display-buffer gud-comint-buffer)) | ||
| 1344 | ;;Try to find source further up stack e.g after signal. | ||
| 1345 | (setq gdb-look-up-stack | ||
| 1346 | (if (gdb-get-buffer 'gdb-stack-buffer) 'keep | ||
| 1347 | (progn | ||
| 1348 | (gdb-get-buffer-create 'gdb-stack-buffer) | ||
| 1349 | (gdb-invalidate-frames) | ||
| 1350 | 'delete)))) | ||
| 1338 | (unless (member gdb-inferior-status '("exited" "signal")) | 1351 | (unless (member gdb-inferior-status '("exited" "signal")) |
| 1339 | (setq gdb-inferior-status "stopped") | 1352 | (setq gdb-inferior-status "stopped") |
| 1340 | (gdb-force-mode-line-update gdb-inferior-status)) | 1353 | (gdb-force-mode-line-update gdb-inferior-status)) |
| @@ -1943,36 +1956,57 @@ static char *magick[] = { | |||
| 1943 | (defun gdb-info-stack-custom () | 1956 | (defun gdb-info-stack-custom () |
| 1944 | (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer) | 1957 | (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer) |
| 1945 | (save-excursion | 1958 | (save-excursion |
| 1946 | (let ((buffer-read-only nil) | 1959 | (unless (eq gdb-look-up-stack 'delete) |
| 1947 | bl el) | 1960 | (let ((buffer-read-only nil) |
| 1948 | (goto-char (point-min)) | 1961 | bl el) |
| 1949 | (while (< (point) (point-max)) | 1962 | (goto-char (point-min)) |
| 1950 | (setq bl (line-beginning-position) | 1963 | (while (< (point) (point-max)) |
| 1951 | el (line-end-position)) | 1964 | (setq bl (line-beginning-position) |
| 1952 | (when (looking-at "#") | 1965 | el (line-end-position)) |
| 1953 | (add-text-properties bl el | 1966 | (when (looking-at "#") |
| 1954 | '(mouse-face highlight | 1967 | (add-text-properties bl el |
| 1955 | help-echo "mouse-2, RET: Select frame"))) | 1968 | '(mouse-face highlight |
| 1956 | (goto-char bl) | 1969 | help-echo "mouse-2, RET: Select frame"))) |
| 1957 | (when (looking-at "^#\\([0-9]+\\)") | 1970 | (goto-char bl) |
| 1958 | (when (string-equal (match-string 1) gdb-frame-number) | 1971 | (when (looking-at "^#\\([0-9]+\\)") |
| 1972 | (when (string-equal (match-string 1) gdb-frame-number) | ||
| 1959 | (put-text-property bl (+ bl 4) | 1973 | (put-text-property bl (+ bl 4) |
| 1960 | 'face '(:inverse-video t))) | 1974 | 'face '(:inverse-video t))) |
| 1961 | (when (re-search-forward | 1975 | (when (re-search-forward |
| 1962 | (concat | 1976 | (concat |
| 1963 | (if (string-equal (match-string 1) "0") "" " in ") | 1977 | (if (string-equal (match-string 1) "0") "" " in ") |
| 1964 | "\\([^ ]+\\) (") el t) | 1978 | "\\([^ ]+\\) (") el t) |
| 1965 | (put-text-property (match-beginning 1) (match-end 1) | ||
| 1966 | 'face font-lock-function-name-face) | ||
| 1967 | (setq bl (match-end 0)) | ||
| 1968 | (while (re-search-forward "<\\([^>]+\\)>" el t) | ||
| 1969 | (put-text-property (match-beginning 1) (match-end 1) | 1979 | (put-text-property (match-beginning 1) (match-end 1) |
| 1980 | 'face font-lock-function-name-face) | ||
| 1981 | (setq bl (match-end 0)) | ||
| 1982 | (while (re-search-forward "<\\([^>]+\\)>" el t) | ||
| 1983 | (put-text-property (match-beginning 1) (match-end 1) | ||
| 1970 | 'face font-lock-function-name-face)) | 1984 | 'face font-lock-function-name-face)) |
| 1971 | (goto-char bl) | 1985 | (goto-char bl) |
| 1972 | (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t) | 1986 | (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t) |
| 1973 | (put-text-property (match-beginning 1) (match-end 1) | 1987 | (put-text-property (match-beginning 1) (match-end 1) |
| 1974 | 'face font-lock-variable-name-face)))) | 1988 | 'face font-lock-variable-name-face)))) |
| 1975 | (forward-line 1)))))) | 1989 | (forward-line 1)))) |
| 1990 | (when gdb-look-up-stack | ||
| 1991 | (goto-char (point-min)) | ||
| 1992 | (when (re-search-forward "\\(\\S-+?\\):\\([0-9]+\\)" nil t) | ||
| 1993 | (let ((start (line-beginning-position)) | ||
| 1994 | (file (match-string 1)) | ||
| 1995 | (line (match-string 2))) | ||
| 1996 | (re-search-backward "^#*\\([0-9]+\\)" start t) | ||
| 1997 | (gdb-enqueue-input | ||
| 1998 | (list (concat gdb-server-prefix "frame " | ||
| 1999 | (match-string 1) "\n") 'gdb-set-hollow)) | ||
| 2000 | (gdb-enqueue-input | ||
| 2001 | (list (concat gdb-server-prefix "frame 0\n") 'ignore))))))) | ||
| 2002 | (if (eq gdb-look-up-stack 'delete) | ||
| 2003 | (kill-buffer (gdb-get-buffer 'gdb-stack-buffer))) | ||
| 2004 | (setq gdb-look-up-stack nil)) | ||
| 2005 | |||
| 2006 | (defun gdb-set-hollow () | ||
| 2007 | (with-current-buffer (gud-find-file (car gud-last-last-frame)) | ||
| 2008 | (setq fringe-indicator-alist | ||
| 2009 | '((overlay-arrow . hollow-right-triangle))))) | ||
| 1976 | 2010 | ||
| 1977 | (defun gdb-stack-buffer-name () | 2011 | (defun gdb-stack-buffer-name () |
| 1978 | (with-current-buffer gud-comint-buffer | 2012 | (with-current-buffer gud-comint-buffer |
| @@ -2028,8 +2062,7 @@ static char *magick[] = { | |||
| 2028 | (if event (posn-set-point (event-end event))) | 2062 | (if event (posn-set-point (event-end event))) |
| 2029 | (gdb-enqueue-input | 2063 | (gdb-enqueue-input |
| 2030 | (list (concat gdb-server-prefix "frame " | 2064 | (list (concat gdb-server-prefix "frame " |
| 2031 | (gdb-get-frame-number) "\n") 'ignore)) | 2065 | (gdb-get-frame-number) "\n") 'ignore))) |
| 2032 | (gud-display-frame)) | ||
| 2033 | 2066 | ||
| 2034 | 2067 | ||
| 2035 | ;; Threads buffer. This displays a selectable thread list. | 2068 | ;; Threads buffer. This displays a selectable thread list. |
| @@ -2047,13 +2080,14 @@ static char *magick[] = { | |||
| 2047 | (defun gdb-info-threads-custom () | 2080 | (defun gdb-info-threads-custom () |
| 2048 | (with-current-buffer (gdb-get-buffer 'gdb-threads-buffer) | 2081 | (with-current-buffer (gdb-get-buffer 'gdb-threads-buffer) |
| 2049 | (let ((buffer-read-only nil)) | 2082 | (let ((buffer-read-only nil)) |
| 2050 | (goto-char (point-min)) | 2083 | (save-excursion |
| 2051 | (while (< (point) (point-max)) | 2084 | (goto-char (point-min)) |
| 2052 | (unless (looking-at "No ") | 2085 | (while (< (point) (point-max)) |
| 2053 | (add-text-properties (line-beginning-position) (line-end-position) | 2086 | (unless (looking-at "No ") |
| 2054 | '(mouse-face highlight | 2087 | (add-text-properties (line-beginning-position) (line-end-position) |
| 2088 | '(mouse-face highlight | ||
| 2055 | help-echo "mouse-2, RET: select thread"))) | 2089 | help-echo "mouse-2, RET: select thread"))) |
| 2056 | (forward-line 1))))) | 2090 | (forward-line 1)))))) |
| 2057 | 2091 | ||
| 2058 | (defun gdb-threads-buffer-name () | 2092 | (defun gdb-threads-buffer-name () |
| 2059 | (with-current-buffer gud-comint-buffer | 2093 | (with-current-buffer gud-comint-buffer |
| @@ -2866,7 +2900,11 @@ of the current session." | |||
| 2866 | gud-comint-buffer | 2900 | gud-comint-buffer |
| 2867 | (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer) | 2901 | (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer) |
| 2868 | '(gdba gdbmi))) | 2902 | '(gdba gdbmi))) |
| 2869 | (if (member buffer-file-name gdb-source-file-list) | 2903 | ;;Pre GDB 6.3 "info sources" doesn't give absolute file name. |
| 2904 | (if (member (if (string-equal gdb-version "pre-6.4") | ||
| 2905 | (file-name-nondirectory buffer-file-name) | ||
| 2906 | buffer-file-name) | ||
| 2907 | gdb-source-file-list) | ||
| 2870 | (with-current-buffer (find-buffer-visiting buffer-file-name) | 2908 | (with-current-buffer (find-buffer-visiting buffer-file-name) |
| 2871 | (set (make-local-variable 'gud-minor-mode) | 2909 | (set (make-local-variable 'gud-minor-mode) |
| 2872 | (buffer-local-value 'gud-minor-mode gud-comint-buffer)) | 2910 | (buffer-local-value 'gud-minor-mode gud-comint-buffer)) |