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 |
;; Known Bugs: Does not auto-display arrays of structures or structures |
;; Known Bugs: Does not auto-display arrays of structures or structures |
45 |
;; containing arrays. |
;; containing arrays. |
46 |
|
|
47 |
;;; Code: |
;;; Code: |
116 |
|
|
117 |
`gdb-many-windows' - Toggle the number of windows gdb uses. |
`gdb-many-windows' - Toggle the number of windows gdb uses. |
118 |
`gdb-restore-windows' - To restore the window layout. |
`gdb-restore-windows' - To restore the window layout. |
119 |
`gdb-quit' - To delete (most) of the buffers used by GDB-UI and |
`gdb-quit' - To delete (most) of the buffers used by GDB-UI and |
120 |
reset variables." |
reset variables." |
121 |
;; |
;; |
122 |
(interactive (list (gud-query-cmdline 'gdba))) |
(interactive (list (gud-query-cmdline 'gdba))) |
530 |
("display-end" gdb-display-end) |
("display-end" gdb-display-end) |
531 |
; GDB commands info stack, info locals and frame generate an error-begin |
; GDB commands info stack, info locals and frame generate an error-begin |
532 |
; annotation at start when there is no stack but this is a quirk/bug in |
; annotation at start when there is no stack but this is a quirk/bug in |
533 |
; annotations. |
; annotations. |
534 |
; ("error-begin" gdb-error-begin) |
; ("error-begin" gdb-error-begin) |
535 |
("display-number-end" gdb-display-number-end) |
("display-number-end" gdb-display-number-end) |
536 |
("array-section-begin" gdb-array-section-begin) |
("array-section-begin" gdb-array-section-begin) |
582 |
(let ((handler |
(let ((handler |
583 |
(car (cdr (gdb-get-current-item))))) |
(car (cdr (gdb-get-current-item))))) |
584 |
(save-excursion |
(save-excursion |
585 |
(set-buffer (gdb-get-create-buffer |
(set-buffer (gdb-get-create-buffer |
586 |
'gdb-partial-output-buffer)) |
'gdb-partial-output-buffer)) |
587 |
(funcall handler)))) |
(funcall handler)))) |
588 |
(t |
(t |
590 |
(error "Output sink phase error 1"))))) |
(error "Output sink phase error 1"))))) |
591 |
|
|
592 |
(defun gdb-prompt (ignored) |
(defun gdb-prompt (ignored) |
593 |
"An annotation handler for `prompt'. |
"An annotation handler for `prompt'. |
594 |
This sends the next command (if any) to gdb." |
This sends the next command (if any) to gdb." |
595 |
(let ((sink (gdb-get-output-sink))) |
(let ((sink (gdb-get-output-sink))) |
596 |
(cond |
(cond |
714 |
(if (string-equal (frame-parameter frame 'name) |
(if (string-equal (frame-parameter frame 'name) |
715 |
gdb-expression-buffer-name) |
gdb-expression-buffer-name) |
716 |
(throw 'frame-exists nil))) |
(throw 'frame-exists nil))) |
717 |
(make-frame `((height . ,gdb-window-height) |
(make-frame `((height . ,gdb-window-height) |
718 |
(width . ,gdb-window-width) |
(width . ,gdb-window-width) |
719 |
(tool-bar-lines . nil) |
(tool-bar-lines . nil) |
720 |
(menu-bar-lines . nil) |
(menu-bar-lines . nil) |
1082 |
;; It is either concatenated to OUTPUT or directed |
;; It is either concatenated to OUTPUT or directed |
1083 |
;; elsewhere. |
;; elsewhere. |
1084 |
(setq output |
(setq output |
1085 |
(gdb-concat-output |
(gdb-concat-output |
1086 |
output |
output |
1087 |
(substring burst 0 (match-beginning 0)))) |
(substring burst 0 (match-beginning 0)))) |
1088 |
|
|
1262 |
gdb-info-breakpoints-custom) |
gdb-info-breakpoints-custom) |
1263 |
|
|
1264 |
(defvar gdb-cdir nil "Compilation directory.") |
(defvar gdb-cdir nil "Compilation directory.") |
1265 |
(defvar breakpoint-enabled-icon) |
(defvar breakpoint-enabled-icon) |
1266 |
(defvar breakpoint-disabled-icon) |
(defvar breakpoint-disabled-icon) |
1267 |
|
|
1268 |
;;-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) |
1299 |
'mouse-face 'highlight) |
'mouse-face 'highlight) |
1300 |
(save-excursion |
(save-excursion |
1301 |
(set-buffer |
(set-buffer |
1302 |
(find-file-noselect |
(find-file-noselect |
1303 |
(if (file-exists-p file) file |
(if (file-exists-p file) file |
1304 |
(expand-file-name file gdb-cdir)))) |
(expand-file-name file gdb-cdir)))) |
1305 |
(save-current-buffer |
(save-current-buffer |
1315 |
;; only want one breakpoint icon at each location |
;; only want one breakpoint icon at each location |
1316 |
(save-excursion |
(save-excursion |
1317 |
(goto-line (string-to-number line)) |
(goto-line (string-to-number line)) |
1318 |
(let ((start (progn (beginning-of-line) |
(let ((start (progn (beginning-of-line) |
1319 |
(- (point) 1))) |
(- (point) 1))) |
1320 |
(end (progn (end-of-line) (+ (point) 1)))) |
(end (progn (end-of-line) (+ (point) 1)))) |
1321 |
(if (display-graphic-p) |
(if (display-graphic-p) |
1322 |
(progn |
(progn |
1323 |
(remove-images start end) |
(remove-images start end) |
1324 |
(if (eq ?y flag) |
(if (eq ?y flag) |
1325 |
(put-image breakpoint-enabled-icon |
(put-image breakpoint-enabled-icon |
1326 |
(point) |
(point) |
1327 |
"breakpoint icon enabled" |
"breakpoint icon enabled" |
1328 |
'left-margin) |
'left-margin) |
1387 |
(list |
(list |
1388 |
(concat |
(concat |
1389 |
(if (eq ?y (char-after (match-beginning 2))) |
(if (eq ?y (char-after (match-beginning 2))) |
1390 |
"server disable " |
"server disable " |
1391 |
"server enable ") |
"server enable ") |
1392 |
(match-string 1) "\n") |
(match-string 1) "\n") |
1393 |
'ignore))))) |
'ignore))))) |
1564 |
gdb-info-locals-handler |
gdb-info-locals-handler |
1565 |
gdb-info-locals-custom) |
gdb-info-locals-custom) |
1566 |
|
|
1567 |
;; Abbreviate for arrays and structures. |
;; Abbreviate for arrays and structures. |
1568 |
;; These can be expanded using gud-display. |
;; These can be expanded using gud-display. |
1569 |
(defun gdb-info-locals-handler nil |
(defun gdb-info-locals-handler nil |
1570 |
(gdb-set-pending-triggers (delq 'gdb-invalidate-locals |
(gdb-set-pending-triggers (delq 'gdb-invalidate-locals |
1646 |
(while (< (point) (- (point-max) 1)) |
(while (< (point) (- (point-max) 1)) |
1647 |
(forward-line 1) |
(forward-line 1) |
1648 |
(if (looking-at "\\([0-9]+\\): \\([ny]\\)") |
(if (looking-at "\\([0-9]+\\): \\([ny]\\)") |
1649 |
(setq display-list |
(setq display-list |
1650 |
(cons (string-to-int (match-string 1)) display-list))) |
(cons (string-to-int (match-string 1)) display-list))) |
1651 |
(end-of-line))) |
(end-of-line))) |
1652 |
(if (not (display-graphic-p)) |
(if (not (display-graphic-p)) |
1654 |
(dolist (buffer (buffer-list)) |
(dolist (buffer (buffer-list)) |
1655 |
(if (string-match "\\*display \\([0-9]+\\)\\*" (buffer-name buffer)) |
(if (string-match "\\*display \\([0-9]+\\)\\*" (buffer-name buffer)) |
1656 |
(progn |
(progn |
1657 |
(let ((number |
(let ((number |
1658 |
(match-string 1 (buffer-name buffer)))) |
(match-string 1 (buffer-name buffer)))) |
1659 |
(if (not (memq (string-to-int number) display-list)) |
(if (not (memq (string-to-int number) display-list)) |
1660 |
(kill-buffer |
(kill-buffer |
1661 |
(get-buffer (concat "*display " number "*"))))))))) |
(get-buffer (concat "*display " number "*"))))))))) |
1662 |
(gdb-delete-frames display-list)))) |
(gdb-delete-frames display-list)))) |
1663 |
|
|
2233 |
|
|
2234 |
(defun gdb-get-current-frame () |
(defun gdb-get-current-frame () |
2235 |
(if (not (member 'gdb-get-current-frame (gdb-get-pending-triggers))) |
(if (not (member 'gdb-get-current-frame (gdb-get-pending-triggers))) |
2236 |
(progn |
(progn |
2237 |
(gdb-enqueue-idle-input |
(gdb-enqueue-idle-input |
2238 |
(list (concat "server frame\n") 'gdb-frame-handler)) |
(list (concat "server frame\n") 'gdb-frame-handler)) |
2239 |
(gdb-set-pending-triggers |
(gdb-set-pending-triggers |
2240 |
(cons 'gdb-get-current-frame |
(cons 'gdb-get-current-frame |
2241 |
(gdb-get-pending-triggers)))))) |
(gdb-get-pending-triggers)))))) |
2242 |
|
|
2243 |
(defun gdb-frame-handler () |
(defun gdb-frame-handler () |
2244 |
(gdb-set-pending-triggers |
(gdb-set-pending-triggers |
2245 |
(delq 'gdb-get-current-frame (gdb-get-pending-triggers))) |
(delq 'gdb-get-current-frame (gdb-get-pending-triggers))) |
2246 |
(save-excursion |
(save-excursion |
2247 |
(set-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)) |
(set-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)) |
2248 |
(goto-char (point-min)) |
(goto-char (point-min)) |
2249 |
(if (looking-at "^#[0-9]*\\s-*0x\\S-* in \\(\\S-*\\)") |
(if (looking-at "^#[0-9]*\\s-*0x\\S-* in \\(\\S-*\\)") |