29 |
;; GDB through the GUD buffer in the usual way, but there are also further |
;; GDB through the GUD buffer in the usual way, but there are also further |
30 |
;; buffers which control the execution and describe the state of your program. |
;; buffers which control the execution and describe the state of your program. |
31 |
;; It separates the input/output of your program from that of GDB, if |
;; It separates the input/output of your program from that of GDB, if |
32 |
;; required, and displays expressions and their current values in their own |
;; required, and watches expressions in the speedbar. It also uses features of |
33 |
;; buffers. It also uses features of Emacs 21 such as the display margin for |
;; Emacs 21 such as the fringe/display margin for breakpoints, and the toolbar |
34 |
;; breakpoints, and the toolbar (see the GDB Graphical Interface section in |
;; (see the GDB Graphical Interface section in the Emacs info manual). |
|
;; the Emacs info manual). |
|
35 |
|
|
36 |
;; Start the debugger with M-x gdba. |
;; Start the debugger with M-x gdba. |
37 |
|
|
39 |
;; Kingdon and uses GDB's annotation interface. You don't need to know about |
;; Kingdon and uses GDB's annotation interface. You don't need to know about |
40 |
;; annotations to use this mode as a debugger, but if you are interested |
;; annotations to use this mode as a debugger, but if you are interested |
41 |
;; developing the mode itself, then see the Annotations section in the GDB |
;; developing the mode itself, then see the Annotations section in the GDB |
42 |
;; info manual. |
;; info manual. |
43 |
;; |
;; |
44 |
;; GDB developers plan to make the annotation interface obsolete. A new |
;; GDB developers plan to make the annotation interface obsolete. A new |
45 |
;; interface called GDB/MI (machine interface) has been designed to replace |
;; interface called GDB/MI (machine interface) has been designed to replace |
70 |
(defvar gdb-variables '() |
(defvar gdb-variables '() |
71 |
"A list of variables that are local to the GUD buffer.") |
"A list of variables that are local to the GUD buffer.") |
72 |
(defvar gdb-server-prefix nil) |
(defvar gdb-server-prefix nil) |
73 |
|
|
74 |
;;;###autoload |
;;;###autoload |
75 |
(defun gdba (command-line) |
(defun gdba (command-line) |
76 |
"Run gdb on program FILE in buffer *gud-FILE*. |
"Run gdb on program FILE in buffer *gud-FILE*. |
227 |
(if (string-equal expr (car var)) (throw 'already-watched nil))) |
(if (string-equal expr (car var)) (throw 'already-watched nil))) |
228 |
(set-text-properties 0 (length expr) nil expr) |
(set-text-properties 0 (length expr) nil expr) |
229 |
(gdb-enqueue-input |
(gdb-enqueue-input |
230 |
(list |
(list |
231 |
(if (eq gud-minor-mode 'gdba) |
(if (eq gud-minor-mode 'gdba) |
232 |
(concat "server interpreter mi \"-var-create - * " expr "\"\n") |
(concat "server interpreter mi \"-var-create - * " expr "\"\n") |
233 |
(concat"-var-create - * " expr "\n")) |
(concat"-var-create - * " expr "\n")) |
326 |
(if (not (member 'gdb-var-update gdb-pending-triggers)) |
(if (not (member 'gdb-var-update gdb-pending-triggers)) |
327 |
(progn |
(progn |
328 |
(gdb-enqueue-input |
(gdb-enqueue-input |
329 |
(list |
(list |
330 |
(if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) |
(if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) |
331 |
"server interpreter mi \"-var-update *\"\n" |
"server interpreter mi \"-var-update *\"\n" |
332 |
"-var-update *\n") |
"-var-update *\n") |
362 |
(varnum (cadr var))) |
(varnum (cadr var))) |
363 |
(unless (string-match "\\." varnum) |
(unless (string-match "\\." varnum) |
364 |
(gdb-enqueue-input |
(gdb-enqueue-input |
365 |
(list |
(list |
366 |
(if (with-current-buffer gud-comint-buffer |
(if (with-current-buffer gud-comint-buffer |
367 |
(eq gud-minor-mode 'gdba)) |
(eq gud-minor-mode 'gdba)) |
368 |
(concat "server interpreter mi \"-var-delete " varnum "\"\n") |
(concat "server interpreter mi \"-var-delete " varnum "\"\n") |
486 |
(set (make-local-variable 'gdb-buffer-type) key) |
(set (make-local-variable 'gdb-buffer-type) key) |
487 |
(if (cdr (cdr rules)) |
(if (cdr (cdr rules)) |
488 |
(funcall (car (cdr (cdr rules))))) |
(funcall (car (cdr (cdr rules))))) |
489 |
(set (make-local-variable 'gud-minor-mode) |
(set (make-local-variable 'gud-minor-mode) |
490 |
(with-current-buffer gud-comint-buffer gud-minor-mode)) |
(with-current-buffer gud-comint-buffer gud-minor-mode)) |
491 |
(set (make-local-variable 'tool-bar-map) gud-tool-bar-map) |
(set (make-local-variable 'tool-bar-map) gud-tool-bar-map) |
492 |
new)))) |
new)))) |
1076 |
'((t |
'((t |
1077 |
:inherit fringe |
:inherit fringe |
1078 |
:foreground "red")) |
:foreground "red")) |
1079 |
"Face for enabled breakpoint icon in fringe.") |
"Face for enabled breakpoint icon in fringe." |
1080 |
|
:group 'gud) |
1081 |
|
|
1082 |
(defface breakpoint-disabled-bitmap-face |
(defface breakpoint-disabled-bitmap-face |
1083 |
'((t |
'((t |
1084 |
:inherit fringe |
:inherit fringe |
1085 |
:foreground "grey60")) |
:foreground "grey60")) |
1086 |
"Face for disabled breakpoint icon in fringe.") |
"Face for disabled breakpoint icon in fringe." |
1087 |
|
:group 'gud) |
1088 |
|
|
1089 |
|
|
1090 |
;;-put breakpoint icons in relevant margins (even those set in the GUD buffer) |
;;-put breakpoint icons in relevant margins (even those set in the GUD buffer) |
1208 |
(list |
(list |
1209 |
(concat |
(concat |
1210 |
(if (eq ?y (char-after (match-beginning 2))) |
(if (eq ?y (char-after (match-beginning 2))) |
1211 |
gdb-server-prefix "disable " |
(concat gdb-server-prefix "disable ") |
1212 |
gdb-server-prefix "enable ") |
(concat gdb-server-prefix "enable ")) |
1213 |
(match-string 1) "\n") |
(match-string 1) "\n") |
1214 |
'ignore))))) |
'ignore))))) |
1215 |
|
|
1227 |
(interactive) |
(interactive) |
1228 |
(save-excursion |
(save-excursion |
1229 |
(beginning-of-line 1) |
(beginning-of-line 1) |
1230 |
(if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdbmi)) |
(if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) |
1231 |
(looking-at "[0-9]*\\s-*\\S-*\\s-*\\S-*\\s-*.\\s-*\\S-*\\s-*\\(\\S-*\\):\\([0-9]+\\)") |
(progn |
1232 |
(re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t) |
(re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t) |
1233 |
(looking-at "\\(\\S-*\\):\\([0-9]+\\)"))) |
(looking-at "\\(\\S-*\\):\\([0-9]+\\)")) |
1234 |
|
(looking-at |
1235 |
|
"[0-9]*\\s-*\\S-*\\s-*\\S-*\\s-*.\\s-*\\S-*\\s-*\\(\\S-*\\):\\([0-9]+\\)"))) |
1236 |
(if (match-string 2) |
(if (match-string 2) |
1237 |
(let ((line (match-string 2)) |
(let ((line (match-string 2)) |
1238 |
(file (match-string 1))) |
(file (match-string 1))) |
1839 |
(save-current-buffer |
(save-current-buffer |
1840 |
(setq left-margin-width 2) |
(setq left-margin-width 2) |
1841 |
(if (get-buffer-window (current-buffer) 'visible) |
(if (get-buffer-window (current-buffer) 'visible) |
1842 |
(set-window-margins |
(set-window-margins |
1843 |
(get-buffer-window (current-buffer) 'visible) |
(get-buffer-window (current-buffer) 'visible) |
1844 |
left-margin-width right-margin-width)))) |
left-margin-width right-margin-width)))) |
1845 |
(put-image |
(put-image |
1866 |
(save-current-buffer |
(save-current-buffer |
1867 |
(setq left-margin-width 2) |
(setq left-margin-width 2) |
1868 |
(if (get-buffer-window (current-buffer) 'visible) |
(if (get-buffer-window (current-buffer) 'visible) |
1869 |
(set-window-margins |
(set-window-margins |
1870 |
(get-buffer-window (current-buffer) 'visible) |
(get-buffer-window (current-buffer) 'visible) |
1871 |
left-margin-width right-margin-width)))) |
left-margin-width right-margin-width)))) |
1872 |
(gdb-put-string (if enabled "B" "b") (1+ start))))) |
(gdb-put-string (if enabled "B" "b") (1+ start))))) |
1878 |
(when remove-margin |
(when remove-margin |
1879 |
(setq left-margin-width 0) |
(setq left-margin-width 0) |
1880 |
(if (get-buffer-window (current-buffer) 'visible) |
(if (get-buffer-window (current-buffer) 'visible) |
1881 |
(set-window-margins |
(set-window-margins |
1882 |
(get-buffer-window (current-buffer) 'visible) |
(get-buffer-window (current-buffer) 'visible) |
1883 |
left-margin-width right-margin-width)))) |
left-margin-width right-margin-width)))) |
1884 |
|
|