Mercurial > emacs
comparison lisp/gdb-ui.el @ 49147:8a40184e2f0e
(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.
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Sat, 11 Jan 2003 16:47:33 +0000 |
parents | 6c5f45b01d2e |
children | 7c4bc41333d1 |
comparison
equal
deleted
inserted
replaced
49146:8e748161e8cf | 49147:8a40184e2f0e |
---|---|
153 "Auto-display (possibly dereferenced) C expression at point." | 153 "Auto-display (possibly dereferenced) C expression at point." |
154 (interactive) | 154 (interactive) |
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 ;; ====================================================================== |
179 ;; | 181 ;; |
180 ;; In this world, there are gdb variables (of unspecified | 182 ;; In this world, there are gdb variables (of unspecified |
509 ("watchpoint" gdb-stopping) | 511 ("watchpoint" gdb-stopping) |
510 ("frame-begin" gdb-frame-begin) | 512 ("frame-begin" gdb-frame-begin) |
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) |
517 ;; ("elt" gdb-elt) | 523 ;; ("elt" gdb-elt) |
518 ("field-begin" gdb-field-begin) | 524 ("field-begin" gdb-field-begin) |
1716 | 1722 |
1717 (defvar gdb-expressions-mode-map | 1723 (defvar gdb-expressions-mode-map |
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 |
1725 (defvar gdb-expressions-mode-menu | 1731 (defvar gdb-expressions-mode-menu |
1726 '("GDB Expressions Commands" | 1732 '("GDB Expressions Commands" |
1921 (defvar breakpoint-disabled-icon | 1927 (defvar breakpoint-disabled-icon |
1922 (find-image `((:type xpm :data ,breakpoint-xpm-data | 1928 (find-image `((:type xpm :data ,breakpoint-xpm-data |
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 |
1928 Use this command to exit a debugging session cleanly and reset | 1934 the source buffers." |
1929 things 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 |
1956 buffers." | 1958 buffers." |
1957 (goto-char (point-min)) | 1959 (goto-char (point-min)) |