Mercurial > emacs
comparison lisp/progmodes/gdb-mi.el @ 104697:89cb3b38143d
Nuke trailing whitespace.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 29 Aug 2009 02:23:18 +0000 |
parents | 2e2a12f25cd1 |
children | d2e8b86ba828 |
comparison
equal
deleted
inserted
replaced
104696:03d26796e3bb | 104697:89cb3b38143d |
---|---|
101 | 101 |
102 (require 'gud) | 102 (require 'gud) |
103 (require 'json) | 103 (require 'json) |
104 (require 'bindat) | 104 (require 'bindat) |
105 (require 'speedbar) | 105 (require 'speedbar) |
106 (eval-when-compile | 106 (eval-when-compile |
107 (require 'cl)) | 107 (require 'cl)) |
108 | 108 |
109 (defvar tool-bar-map) | 109 (defvar tool-bar-map) |
110 (defvar speedbar-initial-expansion-list-name) | 110 (defvar speedbar-initial-expansion-list-name) |
111 (defvar speedbar-frame) | 111 (defvar speedbar-frame) |
262 (defmacro gdb-wait-for-pending (&rest body) | 262 (defmacro gdb-wait-for-pending (&rest body) |
263 "Wait until `gdb-pending-triggers' is empty and evaluate FORM. | 263 "Wait until `gdb-pending-triggers' is empty and evaluate FORM. |
264 | 264 |
265 This function checks `gdb-pending-triggers' value every | 265 This function checks `gdb-pending-triggers' value every |
266 `gdb-wait-for-pending' seconds." | 266 `gdb-wait-for-pending' seconds." |
267 (run-with-timer | 267 (run-with-timer |
268 0.5 nil | 268 0.5 nil |
269 `(lambda () | 269 `(lambda () |
270 (if (not gdb-pending-triggers) | 270 (if (not gdb-pending-triggers) |
271 (progn ,@body) | 271 (progn ,@body) |
272 (gdb-wait-for-pending ,@body))))) | 272 (gdb-wait-for-pending ,@body))))) |
291 (defun gdb-emit-signal (publisher &optional signal) | 291 (defun gdb-emit-signal (publisher &optional signal) |
292 "Call cdr for each subscriber of PUBLISHER with SIGNAL as argument." | 292 "Call cdr for each subscriber of PUBLISHER with SIGNAL as argument." |
293 (dolist (subscriber (gdb-get-subscribers publisher)) | 293 (dolist (subscriber (gdb-get-subscribers publisher)) |
294 (funcall (cdr subscriber) signal))) | 294 (funcall (cdr subscriber) signal))) |
295 | 295 |
296 (defvar gdb-buf-publisher '() | 296 (defvar gdb-buf-publisher '() |
297 "Used to invalidate GDB buffers by emitting a signal in | 297 "Used to invalidate GDB buffers by emitting a signal in |
298 `gdb-update'. | 298 `gdb-update'. |
299 | 299 |
300 Must be a list of pairs with cars being buffers and cdr's being | 300 Must be a list of pairs with cars being buffers and cdr's being |
301 valid signal handlers.") | 301 valid signal handlers.") |
313 | 313 |
314 (defgroup gdb-buffers nil | 314 (defgroup gdb-buffers nil |
315 "GDB buffers" | 315 "GDB buffers" |
316 :group 'gdb | 316 :group 'gdb |
317 :version "23.2") | 317 :version "23.2") |
318 | 318 |
319 (defcustom gdb-debug-log-max 128 | 319 (defcustom gdb-debug-log-max 128 |
320 "Maximum size of `gdb-debug-log'. If nil, size is unlimited." | 320 "Maximum size of `gdb-debug-log'. If nil, size is unlimited." |
321 :group 'gdb | 321 :group 'gdb |
322 :type '(choice (integer :tag "Number of elements") | 322 :type '(choice (integer :tag "Number of elements") |
323 (const :tag "Unlimited" nil)) | 323 (const :tag "Unlimited" nil)) |
755 (lambda () | 755 (lambda () |
756 (gdb-input (list "-target-detach" 'ignore)))) | 756 (gdb-input (list "-target-detach" 'ignore)))) |
757 nil t) | 757 nil t) |
758 | 758 |
759 (run-hooks 'gdb-mode-hook)) | 759 (run-hooks 'gdb-mode-hook)) |
760 | 760 |
761 (defun gdb-init-1 () | 761 (defun gdb-init-1 () |
762 ;; (re-)initialise | 762 ;; (re-)initialise |
763 (setq gdb-selected-frame nil | 763 (setq gdb-selected-frame nil |
764 gdb-frame-number nil | 764 gdb-frame-number nil |
765 gdb-thread-number nil | 765 gdb-thread-number nil |
853 (buffer-string)))) | 853 (buffer-string)))) |
854 ;; remove newline for gud-tooltip-echo-area | 854 ;; remove newline for gud-tooltip-echo-area |
855 (substring string 0 (- (length string) 1)))) | 855 (substring string 0 (- (length string) 1)))) |
856 (or gud-tooltip-echo-area tooltip-use-echo-area | 856 (or gud-tooltip-echo-area tooltip-use-echo-area |
857 (not (display-graphic-p))))) | 857 (not (display-graphic-p))))) |
858 | 858 |
859 ;; If expr is a macro for a function don't print because of possible dangerous | 859 ;; If expr is a macro for a function don't print because of possible dangerous |
860 ;; side-effects. Also printing a function within a tooltip generates an | 860 ;; side-effects. Also printing a function within a tooltip generates an |
861 ;; unexpected starting annotation (phase error). | 861 ;; unexpected starting annotation (phase error). |
862 (defun gdb-tooltip-print-1 (expr) | 862 (defun gdb-tooltip-print-1 (expr) |
863 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) | 863 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) |
1355 (kill-all-local-variables) | 1355 (kill-all-local-variables) |
1356 (setq buffer-read-only t) | 1356 (setq buffer-read-only t) |
1357 (buffer-disable-undo) | 1357 (buffer-disable-undo) |
1358 ;; Delete buffer from gdb-buf-publisher when it's killed | 1358 ;; Delete buffer from gdb-buf-publisher when it's killed |
1359 ;; (if it has an associated update trigger) | 1359 ;; (if it has an associated update trigger) |
1360 (add-hook | 1360 (add-hook |
1361 'kill-buffer-hook | 1361 'kill-buffer-hook |
1362 (function | 1362 (function |
1363 (lambda () | 1363 (lambda () |
1364 (let ((trigger (gdb-rules-update-trigger | 1364 (let ((trigger (gdb-rules-update-trigger |
1365 (gdb-current-buffer-rules)))) | 1365 (gdb-current-buffer-rules)))) |
1366 (when trigger | 1366 (when trigger |
1367 (gdb-delete-subscriber | 1367 (gdb-delete-subscriber |
1368 gdb-buf-publisher | 1368 gdb-buf-publisher |
1369 ;; This should match gdb-add-subscriber done in | 1369 ;; This should match gdb-add-subscriber done in |
1370 ;; gdb-get-buffer-create | 1370 ;; gdb-get-buffer-create |
1371 (cons (current-buffer) | 1371 (cons (current-buffer) |
1372 (gdb-bind-function-to-buffer trigger (current-buffer)))))))) | 1372 (gdb-bind-function-to-buffer trigger (current-buffer)))))))) |
1612 (defun gdb-current-context-buffer-name (name) | 1612 (defun gdb-current-context-buffer-name (name) |
1613 "Add thread information and asterisks to string NAME. | 1613 "Add thread information and asterisks to string NAME. |
1614 | 1614 |
1615 If `gdb-thread-number' is nil, just wrap NAME in asterisks." | 1615 If `gdb-thread-number' is nil, just wrap NAME in asterisks." |
1616 (concat "*" name | 1616 (concat "*" name |
1617 (if (local-variable-p 'gdb-thread-number) | 1617 (if (local-variable-p 'gdb-thread-number) |
1618 (format " (bound to thread %s)" gdb-thread-number) | 1618 (format " (bound to thread %s)" gdb-thread-number) |
1619 "") | 1619 "") |
1620 "*")) | 1620 "*")) |
1621 | 1621 |
1622 (defun gdb-current-context-mode-name (mode) | 1622 (defun gdb-current-context-mode-name (mode) |
1646 (gdb-init-1) | 1646 (gdb-init-1) |
1647 (setq gdb-first-prompt nil)) | 1647 (setq gdb-first-prompt nil)) |
1648 ;; We may need to update gdb-threads-list so we can use | 1648 ;; We may need to update gdb-threads-list so we can use |
1649 (gdb-get-buffer-create 'gdb-threads-buffer) | 1649 (gdb-get-buffer-create 'gdb-threads-buffer) |
1650 ;; gdb-break-list is maintained in breakpoints handler | 1650 ;; gdb-break-list is maintained in breakpoints handler |
1651 (gdb-get-buffer-create 'gdb-breakpoints-buffer) | 1651 (gdb-get-buffer-create 'gdb-breakpoints-buffer) |
1652 | 1652 |
1653 (gdb-emit-signal gdb-buf-publisher 'update) | 1653 (gdb-emit-signal gdb-buf-publisher 'update) |
1654 | 1654 |
1655 (gdb-get-main-selected-frame) | 1655 (gdb-get-main-selected-frame) |
1656 | 1656 |
1657 (gdb-get-changed-registers) | 1657 (gdb-get-changed-registers) |
1919 (member reason gdb-switch-reasons)) | 1919 (member reason gdb-switch-reasons)) |
1920 (progn | 1920 (progn |
1921 (gdb-setq-thread-number thread-id) | 1921 (gdb-setq-thread-number thread-id) |
1922 (message (concat "Switched to thread " thread-id))) | 1922 (message (concat "Switched to thread " thread-id))) |
1923 (message (format "Thread %s stopped" thread-id))))) | 1923 (message (format "Thread %s stopped" thread-id))))) |
1924 | 1924 |
1925 ;; Print "(gdb)" to GUD console | 1925 ;; Print "(gdb)" to GUD console |
1926 (when gdb-first-done-or-error | 1926 (when gdb-first-done-or-error |
1927 (setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name))) | 1927 (setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name))) |
1928 | 1928 |
1929 ;; In non-stop, we update information as soon as another thread gets | 1929 ;; In non-stop, we update information as soon as another thread gets |
2084 (defun gdb-line-posns (line) | 2084 (defun gdb-line-posns (line) |
2085 "Return a pair of LINE beginning and end positions." | 2085 "Return a pair of LINE beginning and end positions." |
2086 (let ((offset (1+ (- line (line-number-at-pos))))) | 2086 (let ((offset (1+ (- line (line-number-at-pos))))) |
2087 (cons | 2087 (cons |
2088 (line-beginning-position offset) | 2088 (line-beginning-position offset) |
2089 (line-end-position offset)))) | 2089 (line-end-position offset)))) |
2090 | 2090 |
2091 (defmacro gdb-mark-line (line variable) | 2091 (defmacro gdb-mark-line (line variable) |
2092 "Set VARIABLE marker to point at beginning of LINE. | 2092 "Set VARIABLE marker to point at beginning of LINE. |
2093 | 2093 |
2094 If current window has no fringes, inverse colors on LINE. | 2094 If current window has no fringes, inverse colors on LINE. |
2107 (defun gdb-pad-string (string padding) | 2107 (defun gdb-pad-string (string padding) |
2108 (format (concat "%" (number-to-string padding) "s") string)) | 2108 (format (concat "%" (number-to-string padding) "s") string)) |
2109 | 2109 |
2110 ;; gdb-table struct is a way to programmatically construct simple | 2110 ;; gdb-table struct is a way to programmatically construct simple |
2111 ;; tables. It help to reliably align columns of data in GDB buffers | 2111 ;; tables. It help to reliably align columns of data in GDB buffers |
2112 ;; and provides | 2112 ;; and provides |
2113 (defstruct | 2113 (defstruct |
2114 gdb-table | 2114 gdb-table |
2115 (column-sizes nil) | 2115 (column-sizes nil) |
2116 (rows nil) | 2116 (rows nil) |
2117 (row-properties nil) | 2117 (row-properties nil) |
2118 (right-align nil)) | 2118 (right-align nil)) |
2267 (def-gdb-trigger-and-handler | 2267 (def-gdb-trigger-and-handler |
2268 gdb-invalidate-breakpoints "-break-list" | 2268 gdb-invalidate-breakpoints "-break-list" |
2269 gdb-breakpoints-list-handler gdb-breakpoints-list-handler-custom | 2269 gdb-breakpoints-list-handler gdb-breakpoints-list-handler-custom |
2270 '(start update)) | 2270 '(start update)) |
2271 | 2271 |
2272 (gdb-set-buffer-rules | 2272 (gdb-set-buffer-rules |
2273 'gdb-breakpoints-buffer | 2273 'gdb-breakpoints-buffer |
2274 'gdb-breakpoints-buffer-name | 2274 'gdb-breakpoints-buffer-name |
2275 'gdb-breakpoints-mode | 2275 'gdb-breakpoints-mode |
2276 'gdb-invalidate-breakpoints) | 2276 'gdb-invalidate-breakpoints) |
2277 | 2277 |
2278 (defun gdb-breakpoints-list-handler-custom () | 2278 (defun gdb-breakpoints-list-handler-custom () |
2279 (let ((breakpoints-list (gdb-get-field | 2279 (let ((breakpoints-list (gdb-get-field |
2280 (gdb-json-partial-output "bkpt" "script") | 2280 (gdb-json-partial-output "bkpt" "script") |
2281 'BreakpointTable 'body)) | 2281 'BreakpointTable 'body)) |
2282 (table (make-gdb-table))) | 2282 (table (make-gdb-table))) |
2283 (setq gdb-breakpoints-list nil) | 2283 (setq gdb-breakpoints-list nil) |
2284 (gdb-table-add-row table '("Num" "Type" "Disp" "Enb" "Hits" "Addr" "What")) | 2284 (gdb-table-add-row table '("Num" "Type" "Disp" "Enb" "Hits" "Addr" "What")) |
2285 (dolist (breakpoint breakpoints-list) | 2285 (dolist (breakpoint breakpoints-list) |
2286 (add-to-list 'gdb-breakpoints-list | 2286 (add-to-list 'gdb-breakpoints-list |
2287 (cons (gdb-get-field breakpoint 'number) | 2287 (cons (gdb-get-field breakpoint 'number) |
2288 breakpoint)) | 2288 breakpoint)) |
2289 (let ((at (gdb-get-field breakpoint 'at)) | 2289 (let ((at (gdb-get-field breakpoint 'at)) |
2290 (pending (gdb-get-field breakpoint 'pending)) | 2290 (pending (gdb-get-field breakpoint 'pending)) |
2291 (func (gdb-get-field breakpoint 'func))) | 2291 (func (gdb-get-field breakpoint 'func))) |
2472 (define-key map " " 'gdb-toggle-breakpoint) | 2472 (define-key map " " 'gdb-toggle-breakpoint) |
2473 (define-key map "D" 'gdb-delete-breakpoint) | 2473 (define-key map "D" 'gdb-delete-breakpoint) |
2474 ;; Don't bind "q" to kill-this-buffer as we need it for breakpoint icons. | 2474 ;; Don't bind "q" to kill-this-buffer as we need it for breakpoint icons. |
2475 (define-key map "q" 'gdb-delete-frame-or-window) | 2475 (define-key map "q" 'gdb-delete-frame-or-window) |
2476 (define-key map "\r" 'gdb-goto-breakpoint) | 2476 (define-key map "\r" 'gdb-goto-breakpoint) |
2477 (define-key map "\t" '(lambda () | 2477 (define-key map "\t" '(lambda () |
2478 (interactive) | 2478 (interactive) |
2479 (gdb-set-window-buffer | 2479 (gdb-set-window-buffer |
2480 (gdb-get-buffer-create 'gdb-threads-buffer) t))) | 2480 (gdb-get-buffer-create 'gdb-threads-buffer) t))) |
2481 (define-key map [mouse-2] 'gdb-goto-breakpoint) | 2481 (define-key map [mouse-2] 'gdb-goto-breakpoint) |
2482 (define-key map [follow-link] 'mouse-face) | 2482 (define-key map [follow-link] 'mouse-face) |
2483 map)) | 2483 map)) |
2498 (define-key map (vector 'header-line 'down-mouse-1) 'ignore) | 2498 (define-key map (vector 'header-line 'down-mouse-1) 'ignore) |
2499 map)) | 2499 map)) |
2500 | 2500 |
2501 (defmacro gdb-propertize-header (name buffer help-echo mouse-face face) | 2501 (defmacro gdb-propertize-header (name buffer help-echo mouse-face face) |
2502 `(propertize ,name | 2502 `(propertize ,name |
2503 'help-echo ,help-echo | 2503 'help-echo ,help-echo |
2504 'mouse-face ',mouse-face | 2504 'mouse-face ',mouse-face |
2505 'face ',face | 2505 'face ',face |
2506 'local-map | 2506 'local-map |
2507 (gdb-make-header-line-mouse-map | 2507 (gdb-make-header-line-mouse-map |
2508 'mouse-1 | 2508 'mouse-1 |
2509 (lambda (event) (interactive "e") | 2509 (lambda (event) (interactive "e") |
2510 (save-selected-window | 2510 (save-selected-window |
2511 (select-window (posn-window (event-start event))) | 2511 (select-window (posn-window (event-start event))) |
2512 (gdb-set-window-buffer | 2512 (gdb-set-window-buffer |
2513 (gdb-get-buffer-create ',buffer) t) ))))) | 2513 (gdb-get-buffer-create ',buffer) t) ))))) |
2514 | 2514 |
2515 | 2515 |
2516 ;; uses "-thread-info". Needs GDB 7.0 onwards. | 2516 ;; uses "-thread-info". Needs GDB 7.0 onwards. |
2517 ;;; Threads view | 2517 ;;; Threads view |
2533 gdb-invalidate-threads (gdb-current-context-command "-thread-info" gud-running) | 2533 gdb-invalidate-threads (gdb-current-context-command "-thread-info" gud-running) |
2534 gdb-thread-list-handler gdb-thread-list-handler-custom | 2534 gdb-thread-list-handler gdb-thread-list-handler-custom |
2535 '(start update update-threads)) | 2535 '(start update update-threads)) |
2536 | 2536 |
2537 (gdb-set-buffer-rules | 2537 (gdb-set-buffer-rules |
2538 'gdb-threads-buffer | 2538 'gdb-threads-buffer |
2539 'gdb-threads-buffer-name | 2539 'gdb-threads-buffer-name |
2540 'gdb-threads-mode | 2540 'gdb-threads-mode |
2541 'gdb-invalidate-threads) | 2541 'gdb-invalidate-threads) |
2542 | 2542 |
2543 (defvar gdb-threads-font-lock-keywords | 2543 (defvar gdb-threads-font-lock-keywords |
2559 (define-key map "d" 'gdb-display-disassembly-for-thread) | 2559 (define-key map "d" 'gdb-display-disassembly-for-thread) |
2560 (define-key map "D" 'gdb-frame-disassembly-for-thread) | 2560 (define-key map "D" 'gdb-frame-disassembly-for-thread) |
2561 (define-key map "i" 'gdb-interrupt-thread) | 2561 (define-key map "i" 'gdb-interrupt-thread) |
2562 (define-key map "c" 'gdb-continue-thread) | 2562 (define-key map "c" 'gdb-continue-thread) |
2563 (define-key map "s" 'gdb-step-thread) | 2563 (define-key map "s" 'gdb-step-thread) |
2564 (define-key map "\t" '(lambda () | 2564 (define-key map "\t" '(lambda () |
2565 (interactive) | 2565 (interactive) |
2566 (gdb-set-window-buffer | 2566 (gdb-set-window-buffer |
2567 (gdb-get-buffer-create 'gdb-breakpoints-buffer) t))) | 2567 (gdb-get-buffer-create 'gdb-breakpoints-buffer) t))) |
2568 (define-key map [mouse-2] 'gdb-select-thread) | 2568 (define-key map [mouse-2] 'gdb-select-thread) |
2569 (define-key map [follow-link] 'mouse-face) | 2569 (define-key map [follow-link] 'mouse-face) |
2570 map)) | 2570 map)) |
2571 | 2571 |
2623 " (" | 2623 " (" |
2624 (let ((args (gdb-get-field thread 'frame 'args))) | 2624 (let ((args (gdb-get-field thread 'frame 'args))) |
2625 (mapconcat | 2625 (mapconcat |
2626 (lambda (arg) | 2626 (lambda (arg) |
2627 (apply 'format `("%s=%s" ,@(gdb-get-many-fields arg 'name 'value)))) | 2627 (apply 'format `("%s=%s" ,@(gdb-get-many-fields arg 'name 'value)))) |
2628 args ",")) | 2628 args ",")) |
2629 ")") | 2629 ")") |
2630 "") | 2630 "") |
2631 (if gdb-thread-buffer-locations | 2631 (if gdb-thread-buffer-locations |
2632 (gdb-frame-location (gdb-get-field thread 'frame)) "") | 2632 (gdb-frame-location (gdb-get-field thread 'frame)) "") |
2633 (if gdb-thread-buffer-addresses | 2633 (if gdb-thread-buffer-addresses |
2784 :group 'gud | 2784 :group 'gud |
2785 :version "23.2") | 2785 :version "23.2") |
2786 | 2786 |
2787 (def-gdb-trigger-and-handler | 2787 (def-gdb-trigger-and-handler |
2788 gdb-invalidate-memory | 2788 gdb-invalidate-memory |
2789 (format "-data-read-memory %s %s %d %d %d" | 2789 (format "-data-read-memory %s %s %d %d %d" |
2790 gdb-memory-address | 2790 gdb-memory-address |
2791 gdb-memory-format | 2791 gdb-memory-format |
2792 gdb-memory-unit | 2792 gdb-memory-unit |
2793 gdb-memory-rows | 2793 gdb-memory-rows |
2794 gdb-memory-columns) | 2794 gdb-memory-columns) |
3134 (interactive) | 3134 (interactive) |
3135 (let* ((special-display-regexps (append special-display-regexps '(".*"))) | 3135 (let* ((special-display-regexps (append special-display-regexps '(".*"))) |
3136 (special-display-frame-alist | 3136 (special-display-frame-alist |
3137 `((left-fringe . 0) | 3137 `((left-fringe . 0) |
3138 (right-fringe . 0) | 3138 (right-fringe . 0) |
3139 (width . 83) | 3139 (width . 83) |
3140 ,@gdb-frame-parameters))) | 3140 ,@gdb-frame-parameters))) |
3141 (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer)))) | 3141 (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer)))) |
3142 | 3142 |
3143 | 3143 |
3144 ;;; Disassembly view | 3144 ;;; Disassembly view |
3246 (when marked-line | 3246 (when marked-line |
3247 (let ((window (get-buffer-window (current-buffer) 0))) | 3247 (let ((window (get-buffer-window (current-buffer) 0))) |
3248 (set-window-point window (gdb-mark-line marked-line gdb-disassembly-position)))) | 3248 (set-window-point window (gdb-mark-line marked-line gdb-disassembly-position)))) |
3249 (setq mode-name | 3249 (setq mode-name |
3250 (gdb-current-context-mode-name | 3250 (gdb-current-context-mode-name |
3251 (concat "Disassembly: " | 3251 (concat "Disassembly: " |
3252 (gdb-get-field (gdb-current-buffer-frame) 'func)))))) | 3252 (gdb-get-field (gdb-current-buffer-frame) 'func)))))) |
3253 | 3253 |
3254 (defun gdb-disassembly-place-breakpoints () | 3254 (defun gdb-disassembly-place-breakpoints () |
3255 (gdb-remove-breakpoint-icons (point-min) (point-max)) | 3255 (gdb-remove-breakpoint-icons (point-min) (point-max)) |
3256 (dolist (breakpoint gdb-breakpoints-list) | 3256 (dolist (breakpoint gdb-breakpoints-list) |
3302 (beginning-of-line) | 3302 (beginning-of-line) |
3303 (let ((breakpoint (get-text-property (point) 'gdb-breakpoint))) | 3303 (let ((breakpoint (get-text-property (point) 'gdb-breakpoint))) |
3304 (if breakpoint | 3304 (if breakpoint |
3305 (gud-basic-call (concat "-break-delete " (gdb-get-field breakpoint 'number))) | 3305 (gud-basic-call (concat "-break-delete " (gdb-get-field breakpoint 'number))) |
3306 (error "Not recognized as break/watchpoint line"))))) | 3306 (error "Not recognized as break/watchpoint line"))))) |
3307 | 3307 |
3308 (defun gdb-goto-breakpoint (&optional event) | 3308 (defun gdb-goto-breakpoint (&optional event) |
3309 "Go to the location of breakpoint at current line of | 3309 "Go to the location of breakpoint at current line of |
3310 breakpoints buffer." | 3310 breakpoints buffer." |
3311 (interactive (list last-input-event)) | 3311 (interactive (list last-input-event)) |
3312 (if event (posn-set-point (event-end event))) | 3312 (if event (posn-set-point (event-end event))) |
3367 (list | 3367 (list |
3368 (gdb-get-field frame 'level) | 3368 (gdb-get-field frame 'level) |
3369 "in" | 3369 "in" |
3370 (concat | 3370 (concat |
3371 (gdb-get-field frame 'func) | 3371 (gdb-get-field frame 'func) |
3372 (if gdb-stack-buffer-locations | 3372 (if gdb-stack-buffer-locations |
3373 (gdb-frame-location frame) "") | 3373 (gdb-frame-location frame) "") |
3374 (if gdb-stack-buffer-addresses | 3374 (if gdb-stack-buffer-addresses |
3375 (concat " at " (gdb-get-field frame 'addr)) ""))) | 3375 (concat " at " (gdb-get-field frame 'addr)) ""))) |
3376 `(mouse-face highlight | 3376 `(mouse-face highlight |
3377 help-echo "mouse-2, RET: Select frame" | 3377 help-echo "mouse-2, RET: Select frame" |
3378 gdb-frame ,frame))) | 3378 gdb-frame ,frame))) |
3379 (insert (gdb-table-string table " "))) | 3379 (insert (gdb-table-string table " "))) |
3503 (add-text-properties 0 (length value) | 3503 (add-text-properties 0 (length value) |
3504 `(mouse-face highlight | 3504 `(mouse-face highlight |
3505 help-echo "mouse-2: edit value" | 3505 help-echo "mouse-2: edit value" |
3506 local-map ,gdb-edit-locals-map-1) | 3506 local-map ,gdb-edit-locals-map-1) |
3507 value)) | 3507 value)) |
3508 (gdb-table-add-row | 3508 (gdb-table-add-row |
3509 table | 3509 table |
3510 (list | 3510 (list |
3511 (propertize type 'font-lock-face font-lock-type-face) | 3511 (propertize type 'font-lock-face font-lock-type-face) |
3512 (propertize name 'font-lock-face font-lock-variable-name-face) | 3512 (propertize name 'font-lock-face font-lock-variable-name-face) |
3513 value) | 3513 value) |
3514 `(gdb-local-variable ,local)))) | 3514 `(gdb-local-variable ,local)))) |
3527 | 3527 |
3528 (defvar gdb-locals-mode-map | 3528 (defvar gdb-locals-mode-map |
3529 (let ((map (make-sparse-keymap))) | 3529 (let ((map (make-sparse-keymap))) |
3530 (suppress-keymap map) | 3530 (suppress-keymap map) |
3531 (define-key map "q" 'kill-this-buffer) | 3531 (define-key map "q" 'kill-this-buffer) |
3532 (define-key map "\t" '(lambda () | 3532 (define-key map "\t" '(lambda () |
3533 (interactive) | 3533 (interactive) |
3534 (gdb-set-window-buffer | 3534 (gdb-set-window-buffer |
3535 (gdb-get-buffer-create | 3535 (gdb-get-buffer-create |
3536 'gdb-registers-buffer | 3536 'gdb-registers-buffer |
3537 gdb-thread-number) t))) | 3537 gdb-thread-number) t))) |
3538 map)) | 3538 map)) |
3584 (let ((register-values (gdb-get-field (gdb-json-partial-output) 'register-values)) | 3584 (let ((register-values (gdb-get-field (gdb-json-partial-output) 'register-values)) |
3585 (table (make-gdb-table))) | 3585 (table (make-gdb-table))) |
3586 (dolist (register register-values) | 3586 (dolist (register register-values) |
3587 (let* ((register-number (gdb-get-field register 'number)) | 3587 (let* ((register-number (gdb-get-field register 'number)) |
3588 (value (gdb-get-field register 'value)) | 3588 (value (gdb-get-field register 'value)) |
3589 (register-name (nth (string-to-number register-number) | 3589 (register-name (nth (string-to-number register-number) |
3590 gdb-register-names))) | 3590 gdb-register-names))) |
3591 (gdb-table-add-row | 3591 (gdb-table-add-row |
3592 table | 3592 table |
3593 (list | 3593 (list |
3594 (propertize register-name 'font-lock-face font-lock-variable-name-face) | 3594 (propertize register-name 'font-lock-face font-lock-variable-name-face) |
3618 (let ((map (make-sparse-keymap))) | 3618 (let ((map (make-sparse-keymap))) |
3619 (suppress-keymap map) | 3619 (suppress-keymap map) |
3620 (define-key map "\r" 'gdb-edit-register-value) | 3620 (define-key map "\r" 'gdb-edit-register-value) |
3621 (define-key map [mouse-2] 'gdb-edit-register-value) | 3621 (define-key map [mouse-2] 'gdb-edit-register-value) |
3622 (define-key map "q" 'kill-this-buffer) | 3622 (define-key map "q" 'kill-this-buffer) |
3623 (define-key map "\t" '(lambda () | 3623 (define-key map "\t" '(lambda () |
3624 (interactive) | 3624 (interactive) |
3625 (gdb-set-window-buffer | 3625 (gdb-set-window-buffer |
3626 (gdb-get-buffer-create | 3626 (gdb-get-buffer-create |
3627 'gdb-locals-buffer | 3627 'gdb-locals-buffer |
3628 gdb-thread-number) t))) | 3628 gdb-thread-number) t))) |
3629 map)) | 3629 map)) |
3734 (if (string-equal gdb-frame-number "0") | 3734 (if (string-equal gdb-frame-number "0") |
3735 nil | 3735 nil |
3736 '((overlay-arrow . hollow-right-triangle)))) | 3736 '((overlay-arrow . hollow-right-triangle)))) |
3737 (setq gud-overlay-arrow-position (make-marker)) | 3737 (setq gud-overlay-arrow-position (make-marker)) |
3738 (set-marker gud-overlay-arrow-position position)))))))) | 3738 (set-marker gud-overlay-arrow-position position)))))))) |
3739 | 3739 |
3740 (defvar gdb-prompt-name-regexp "value=\"\\(.*?\\)\"") | 3740 (defvar gdb-prompt-name-regexp "value=\"\\(.*?\\)\"") |
3741 | 3741 |
3742 (defun gdb-get-prompt () | 3742 (defun gdb-get-prompt () |
3743 "Find prompt for GDB session." | 3743 "Find prompt for GDB session." |
3744 (goto-char (point-min)) | 3744 (goto-char (point-min)) |
3792 (get-window-with-predicate | 3792 (get-window-with-predicate |
3793 #'(lambda (w) | 3793 #'(lambda (w) |
3794 (eq buf-type | 3794 (eq buf-type |
3795 (gdb-buffer-type (window-buffer w))))))) | 3795 (gdb-buffer-type (window-buffer w))))))) |
3796 (if dedicated-window | 3796 (if dedicated-window |
3797 (set-window-buffer | 3797 (set-window-buffer |
3798 (split-window dedicated-window nil split-horizontal) buf) | 3798 (split-window dedicated-window nil split-horizontal) buf) |
3799 (gdb-display-buffer buf t)))))) | 3799 (gdb-display-buffer buf t)))))) |
3800 (error "Null buffer"))) | 3800 (error "Null buffer"))) |
3801 | 3801 |
3802 ;;; Shared keymap initialization: | 3802 ;;; Shared keymap initialization: |