aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Roberts2003-01-11 16:47:33 +0000
committerNick Roberts2003-01-11 16:47:33 +0000
commit94b83c85404a011f6dcd858e0740ec347faad10f (patch)
tree4e7f6a44ceae47fcbd3a2b5dd779ad0a2263e8fd
parent703ce2c3f983cef71943077707085bac8be749f9 (diff)
downloademacs-94b83c85404a011f6dcd858e0740ec347faad10f.tar.gz
emacs-94b83c85404a011f6dcd858e0740ec347faad10f.zip
(gud-display): Use GDB command ptype instead of whatis
to find out if variable shuld be dereferenced. (gud-display1): Exit if there is `No symbol'. (gdb-expressions-mode-map): Correction to key-binding. (gdb-reset): New function. Reset environment at end of debugging. (gdb-quit): Remove.
-rw-r--r--lisp/gdb-ui.el70
1 files changed, 36 insertions, 34 deletions
diff --git a/lisp/gdb-ui.el b/lisp/gdb-ui.el
index f61a5a30338..72d30d3e226 100644
--- a/lisp/gdb-ui.el
+++ b/lisp/gdb-ui.el
@@ -155,24 +155,26 @@ The following interactive lisp functions help control operation :
155 (save-excursion 155 (save-excursion
156 (let ((expr (gud-find-c-expr))) 156 (let ((expr (gud-find-c-expr)))
157 (gdb-enqueue-input 157 (gdb-enqueue-input
158 (list (concat "server whatis " expr "\n") 158 (list (concat "server ptype " expr "\n")
159 `(lambda () (gud-display1 ,expr))))))) 159 `(lambda () (gud-display1 ,expr)))))))
160 160
161(defun gud-display1 (expr) 161(defun gud-display1 (expr)
162 (goto-char (point-min)) 162 (goto-char (point-min))
163 (if (re-search-forward "\*" nil t) 163 (if (looking-at "No symbol")
164 (progn
165 (gdb-set-output-sink 'user)
166 (gud-call (concat "server ptype " expr)))
167 (goto-char (- (point-max) 1))
168 (if (equal (char-before) (string-to-char "\*"))
169 (gdb-enqueue-input
170 (list (concat "server display* " expr "\n") 'ignore))
164 (gdb-enqueue-input 171 (gdb-enqueue-input
165 (list (concat "server display* " expr "\n") 'ignore)) 172 (list (concat "server display " expr "\n") 'ignore)))))
166 (gdb-enqueue-input
167 (list (concat "server display " expr "\n") 'ignore))))
168 173
169; this would messy because these bindings don't work with M-x gdb 174; this would messy because these bindings don't work with M-x gdb
170; (define-key global-map "\C-x\C-a\C-a" 'gud-display) 175; (define-key global-map "\C-x\C-a\C-a" 'gud-display)
171; (define-key gud-minor-mode-map "\C-c\C-a" 'gud-display) 176; (define-key gud-minor-mode-map "\C-c\C-a" 'gud-display)
172 177
173;; The completion process filter is installed temporarily to slurp the
174;; output of GDB up to the next prompt and build the completion list.
175;; It must also handle annotations.
176 178
177 179
178;; ====================================================================== 180;; ======================================================================
@@ -511,6 +513,10 @@ This filter may simply queue output for a later time."
511 ("stopped" gdb-stopped) 513 ("stopped" gdb-stopped)
512 ("display-begin" gdb-display-begin) 514 ("display-begin" gdb-display-begin)
513 ("display-end" gdb-display-end) 515 ("display-end" gdb-display-end)
516; GDB commands info stack, info locals and frame generate an error-begin
517; annotation at start when there is no stack but this is a quirk/bug in
518; annotations.
519; ("error-begin" gdb-error-begin)
514 ("display-number-end" gdb-display-number-end) 520 ("display-number-end" gdb-display-number-end)
515 ("array-section-begin" gdb-array-section-begin) 521 ("array-section-begin" gdb-array-section-begin)
516 ("array-section-end" gdb-array-section-end) 522 ("array-section-end" gdb-array-section-end)
@@ -1718,7 +1724,7 @@ the source buffer."
1718 (let ((map (make-sparse-keymap))) 1724 (let ((map (make-sparse-keymap)))
1719 (suppress-keymap map) 1725 (suppress-keymap map)
1720 (define-key map "v" 'gdb-array-visualise) 1726 (define-key map "v" 'gdb-array-visualise)
1721 (define-key map "q" 'gdb-delete-display) 1727 (define-key map "q" 'gdb-delete-expression)
1722 (define-key map [mouse-3] 'gdb-expressions-popup-menu) 1728 (define-key map [mouse-3] 'gdb-expressions-popup-menu)
1723 map)) 1729 map))
1724 1730
@@ -1923,33 +1929,29 @@ static char *magick[] = {
1923 :conversion laplace))) 1929 :conversion laplace)))
1924 "Icon for disabled breakpoint in display margin") 1930 "Icon for disabled breakpoint in display margin")
1925 1931
1926(defun gdb-quit () 1932(defun gdb-reset ()
1927 "Kill the GUD interaction and gdb buffers and reset variables. 1933 "Exit a debugging session cleanly by killing the gdb buffers and resetting
1928Use this command to exit a debugging session cleanly and reset 1934 the source buffers."
1929things like the toolbar and margin in the source buffers."
1930 (interactive)
1931 (gdb-delete-frames '()) 1935 (gdb-delete-frames '())
1932 (dolist (buffer (buffer-list)) 1936 (dolist (buffer (buffer-list))
1933 (save-excursion 1937 (if (not (eq buffer gud-comint-buffer))
1934 (set-buffer buffer) 1938 (save-excursion
1935 (if (eq gud-minor-mode 'gdba) 1939 (set-buffer buffer)
1936 (if (string-match "^\*" (buffer-name)) 1940 (if (eq gud-minor-mode 'gdba)
1937 (kill-buffer nil) 1941 (if (string-match "^\*.+*$" (buffer-name))
1938 (if (display-graphic-p) 1942 (kill-buffer nil)
1939 (remove-images (point-min) (point-max)) 1943 (if (display-graphic-p)
1940 (remove-strings (point-min) (point-max))) 1944 (remove-images (point-min) (point-max))
1941 (setq left-margin-width 0) 1945 (remove-strings (point-min) (point-max)))
1942 (setq gud-minor-mode nil) 1946 (setq left-margin-width 0)
1943 (kill-local-variable 'tool-bar-map) 1947 (setq gud-minor-mode nil)
1944 (setq gud-running nil) 1948 (kill-local-variable 'tool-bar-map)
1945 (if (get-buffer-window (current-buffer)) 1949 (setq gud-running nil)
1946 (set-window-margins (get-buffer-window 1950 (if (get-buffer-window (current-buffer))
1947 (current-buffer)) 1951 (set-window-margins (get-buffer-window
1948 left-margin-width 1952 (current-buffer))
1949 right-margin-width)))))) 1953 left-margin-width
1950 (if (eq (selected-window) (minibuffer-window)) 1954 right-margin-width))))))))
1951 (other-window 1))
1952 (delete-other-windows))
1953 1955
1954(defun gdb-source-info () 1956(defun gdb-source-info ()
1955 "Find the source file where the program starts and displays it with related 1957 "Find the source file where the program starts and displays it with related