diff options
| author | Dmitry Dzhus | 2009-08-04 15:51:58 +0000 |
|---|---|---|
| committer | Dmitry Dzhus | 2009-08-04 15:51:58 +0000 |
| commit | 566f3909bd4b221d8303f37e6309656d6beb87ac (patch) | |
| tree | 49ee21db17c772744bbbb2091d012b939b4875e6 | |
| parent | 0d25e058137cfc8393320ed623e4ecc635b05945 (diff) | |
| download | emacs-566f3909bd4b221d8303f37e6309656d6beb87ac.tar.gz emacs-566f3909bd4b221d8303f37e6309656d6beb87ac.zip | |
* progmodes/gdb-mi.el (gdb-get-buffer, gdb-get-buffer-create):
Argument `key' renamed to `buffer-type'.
(gdb-current-context-buffer-name): Do not add thread info to
buffer name when no thread is selected.
(gdbmi-record-list, gdb-shell): Try to handle GDB `shell'
command (bug 3794).
(gdb-thread-selected): Handle `=thread-selected' notification.
(gdb-wait-for-pending): New macro to deal with congestion problems.
(gdb-breakpoints-list-handler-custom): Don't fail on pending
breakpoints.
(gdb-invalidate-disassembly): Use 'fullname instead of 'file. This
fixes problem similar to one described in bug 3947.
(gud-menu-map): More menu items.
(gdb-init-1): Reset `gdb-thread-number' to nil.
| -rw-r--r-- | lisp/ChangeLog | 15 | ||||
| -rw-r--r-- | lisp/progmodes/gdb-mi.el | 219 |
2 files changed, 148 insertions, 86 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f408f1b87dc..4ae2e395fc3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,20 @@ | |||
| 1 | 2009-08-04 Dmitry Dzhus <dima@sphinx.net.ru> | 1 | 2009-08-04 Dmitry Dzhus <dima@sphinx.net.ru> |
| 2 | 2 | ||
| 3 | * progmodes/gdb-mi.el (gdb-get-buffer, gdb-get-buffer-create): | ||
| 4 | Argument `key' renamed to `buffer-type'. | ||
| 5 | (gdb-current-context-buffer-name): Do not add thread info to | ||
| 6 | buffer name when no thread is selected. | ||
| 7 | (gdbmi-record-list, gdb-shell): Try to handle GDB `shell' | ||
| 8 | command (bug 3794). | ||
| 9 | (gdb-thread-selected): Handle `=thread-selected' notification. | ||
| 10 | (gdb-wait-for-pending): New macro to deal with congestion problems. | ||
| 11 | (gdb-breakpoints-list-handler-custom): Don't fail on pending | ||
| 12 | breakpoints. | ||
| 13 | (gdb-invalidate-disassembly): Use 'fullname instead of 'file. This | ||
| 14 | fixes problem similar to one described in bug 3947. | ||
| 15 | (gud-menu-map): More menu items. | ||
| 16 | (gdb-init-1): Reset `gdb-thread-number' to nil. | ||
| 17 | |||
| 3 | * progmodes/gud.el (gud-stop-subjob, gud-menu-map): Respect GDB | 18 | * progmodes/gud.el (gud-stop-subjob, gud-menu-map): Respect GDB |
| 4 | non-stop settings. | 19 | non-stop settings. |
| 5 | 20 | ||
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 4c3a8531a42..195788b907c 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el | |||
| @@ -233,6 +233,21 @@ Elements are either function names or pairs (buffer . function)") | |||
| 233 | `(setq gdb-pending-triggers | 233 | `(setq gdb-pending-triggers |
| 234 | (delete ,item gdb-pending-triggers))) | 234 | (delete ,item gdb-pending-triggers))) |
| 235 | 235 | ||
| 236 | (defvar gdb-wait-for-pending-timeout 0.5) | ||
| 237 | |||
| 238 | (defmacro gdb-wait-for-pending (&rest body) | ||
| 239 | "Wait until `gdb-pending-triggers' is empty and execute BODY. | ||
| 240 | |||
| 241 | This function checks `gdb-pending-triggers' value every | ||
| 242 | `gdb-wait-for-pending' seconds." | ||
| 243 | (run-with-timer | ||
| 244 | gdb-wait-for-pending-timeout nil | ||
| 245 | `(lambda () | ||
| 246 | (if (not gdb-pending-triggers) | ||
| 247 | (progn | ||
| 248 | ,@body) | ||
| 249 | (gdb-wait-for-pending ,@body))))) | ||
| 250 | |||
| 236 | (defcustom gdb-debug-log-max 128 | 251 | (defcustom gdb-debug-log-max 128 |
| 237 | "Maximum size of `gdb-debug-log'. If nil, size is unlimited." | 252 | "Maximum size of `gdb-debug-log'. If nil, size is unlimited." |
| 238 | :group 'gdb | 253 | :group 'gdb |
| @@ -619,6 +634,7 @@ detailed description of this mode. | |||
| 619 | ;; (re-)initialise | 634 | ;; (re-)initialise |
| 620 | (setq gdb-selected-frame nil | 635 | (setq gdb-selected-frame nil |
| 621 | gdb-frame-number nil | 636 | gdb-frame-number nil |
| 637 | gdb-thread-number nil | ||
| 622 | gdb-var-list nil | 638 | gdb-var-list nil |
| 623 | gdb-pending-triggers nil | 639 | gdb-pending-triggers nil |
| 624 | gdb-output-sink 'user | 640 | gdb-output-sink 'user |
| @@ -1088,35 +1104,35 @@ thread." | |||
| 1088 | "Get current stack frame object for thread of current buffer." | 1104 | "Get current stack frame object for thread of current buffer." |
| 1089 | (gdb-get-field (gdb-current-buffer-thread) 'frame)) | 1105 | (gdb-get-field (gdb-current-buffer-thread) 'frame)) |
| 1090 | 1106 | ||
| 1091 | (defun gdb-get-buffer (key &optional thread) | 1107 | (defun gdb-get-buffer (buffer-type &optional thread) |
| 1092 | "Get a specific GDB buffer. | 1108 | "Get a specific GDB buffer. |
| 1093 | 1109 | ||
| 1094 | In that buffer, `gdb-buffer-type' must be equal to KEY and | 1110 | In that buffer, `gdb-buffer-type' must be equal to BUFFER-TYPE |
| 1095 | `gdb-thread-number' (if provided) must be equal to THREAD." | 1111 | and `gdb-thread-number' (if provided) must be equal to THREAD." |
| 1096 | (catch 'found | 1112 | (catch 'found |
| 1097 | (dolist (buffer (buffer-list) nil) | 1113 | (dolist (buffer (buffer-list) nil) |
| 1098 | (with-current-buffer buffer | 1114 | (with-current-buffer buffer |
| 1099 | (when (and (eq gdb-buffer-type key) | 1115 | (when (and (eq gdb-buffer-type buffer-type) |
| 1100 | (or (not thread) | 1116 | (or (not thread) |
| 1101 | (equal gdb-thread-number thread))) | 1117 | (equal gdb-thread-number thread))) |
| 1102 | (throw 'found buffer)))))) | 1118 | (throw 'found buffer)))))) |
| 1103 | 1119 | ||
| 1104 | (defun gdb-get-buffer-create (key &optional thread) | 1120 | (defun gdb-get-buffer-create (buffer-type &optional thread) |
| 1105 | "Create a new GDB buffer of the type specified by KEY. | 1121 | "Create a new GDB buffer of the type specified by BUFFER-TYPE. |
| 1106 | The key should be one of the cars in `gdb-buffer-rules'. | 1122 | The buffer-type should be one of the cars in `gdb-buffer-rules'. |
| 1107 | 1123 | ||
| 1108 | If THREAD is non-nil, it is assigned to `gdb-thread-number' | 1124 | If THREAD is non-nil, it is assigned to `gdb-thread-number' |
| 1109 | buffer-local variable of the new buffer. | 1125 | buffer-local variable of the new buffer. |
| 1110 | 1126 | ||
| 1111 | If buffer's mode returns a symbol, it's used to register " | 1127 | If buffer's mode returns a symbol, it's used to register " |
| 1112 | (or (gdb-get-buffer key thread) | 1128 | (or (gdb-get-buffer buffer-type thread) |
| 1113 | (let ((rules (assoc key gdb-buffer-rules)) | 1129 | (let ((rules (assoc buffer-type gdb-buffer-rules)) |
| 1114 | (new (generate-new-buffer "limbo"))) | 1130 | (new (generate-new-buffer "limbo"))) |
| 1115 | (with-current-buffer new | 1131 | (with-current-buffer new |
| 1116 | (let ((mode (gdb-rules-buffer-mode rules)) | 1132 | (let ((mode (gdb-rules-buffer-mode rules)) |
| 1117 | (trigger (gdb-rules-update-trigger rules))) | 1133 | (trigger (gdb-rules-update-trigger rules))) |
| 1118 | (when mode (funcall mode)) | 1134 | (when mode (funcall mode)) |
| 1119 | (setq gdb-buffer-type key) | 1135 | (setq gdb-buffer-type buffer-type) |
| 1120 | (when thread | 1136 | (when thread |
| 1121 | (set (make-local-variable 'gdb-thread-number) thread)) | 1137 | (set (make-local-variable 'gdb-thread-number) thread)) |
| 1122 | (set (make-local-variable 'gud-minor-mode) | 1138 | (set (make-local-variable 'gud-minor-mode) |
| @@ -1430,12 +1446,16 @@ Option value is taken from `gdb-thread-number'. If | |||
| 1430 | command)) | 1446 | command)) |
| 1431 | 1447 | ||
| 1432 | (defun gdb-current-context-buffer-name (name) | 1448 | (defun gdb-current-context-buffer-name (name) |
| 1433 | "Add thread information and asterisks to string NAME." | 1449 | "Add thread information and asterisks to string NAME. |
| 1450 | |||
| 1451 | If `gdb-thread-number' is nil, just wrap NAME in asterisks." | ||
| 1434 | (concat "*" name | 1452 | (concat "*" name |
| 1435 | (if (local-variable-p 'gdb-thread-number) | 1453 | (format |
| 1436 | " (bound to thread " | 1454 | (cond ((local-variable-p 'gdb-thread-number) " (bound to thread %s)") |
| 1437 | " (current thread ") | 1455 | (gdb-thread-number " (current thread %s)") |
| 1438 | gdb-thread-number ")*")) | 1456 | (t "")) |
| 1457 | gdb-thread-number) | ||
| 1458 | "*")) | ||
| 1439 | 1459 | ||
| 1440 | 1460 | ||
| 1441 | (defcustom gud-gdb-command-name "gdb -i=mi" | 1461 | (defcustom gud-gdb-command-name "gdb -i=mi" |
| @@ -1517,7 +1537,8 @@ control buttons should be shown in menu or toolbar. Use | |||
| 1517 | `gdb-running-threads-count' and `gdb-stopped-threads-count' | 1537 | `gdb-running-threads-count' and `gdb-stopped-threads-count' |
| 1518 | instead. | 1538 | instead. |
| 1519 | 1539 | ||
| 1520 | For all-stop mode, thread information is unavailable while target is running" | 1540 | For all-stop mode, thread information is unavailable while target |
| 1541 | is running." | ||
| 1521 | (setq gud-running | 1542 | (setq gud-running |
| 1522 | (string= (gdb-get-field (gdb-current-buffer-thread) 'state) | 1543 | (string= (gdb-get-field (gdb-current-buffer-thread) 'state) |
| 1523 | "running"))) | 1544 | "running"))) |
| @@ -1551,7 +1572,10 @@ For all-stop mode, thread information is unavailable while target is running" | |||
| 1551 | (gdb-stopped . "\\*stopped,?\\(.*?\\)\n") | 1572 | (gdb-stopped . "\\*stopped,?\\(.*?\\)\n") |
| 1552 | (gdb-running . "\\*running,\\(.*?\n\\)") | 1573 | (gdb-running . "\\*running,\\(.*?\n\\)") |
| 1553 | (gdb-thread-created . "=thread-created,\\(.*?\n\\)") | 1574 | (gdb-thread-created . "=thread-created,\\(.*?\n\\)") |
| 1554 | (gdb-thread-exited . "=thread-exited,\\(.*?\n\\)"))) | 1575 | (gdb-thread-selected . "=thread-selected,\\(.*?\\)\n") |
| 1576 | (gdb-thread-exited . "=thread-exited,\\(.*?\n\\)") | ||
| 1577 | (gdb-ignored-notification . "=[-[:alpha:]]+,?\\(.*?\\)\n") | ||
| 1578 | (gdb-shell . "\\(\\(?:^.+\n\\)+\\)"))) | ||
| 1555 | 1579 | ||
| 1556 | (defun gud-gdbmi-marker-filter (string) | 1580 | (defun gud-gdbmi-marker-filter (string) |
| 1557 | "Filter GDB/MI output." | 1581 | "Filter GDB/MI output." |
| @@ -1610,11 +1634,28 @@ For all-stop mode, thread information is unavailable while target is running" | |||
| 1610 | 1634 | ||
| 1611 | (defun gdb-gdb (output-field)) | 1635 | (defun gdb-gdb (output-field)) |
| 1612 | 1636 | ||
| 1637 | (defun gdb-shell (output-field) | ||
| 1638 | (let ((gdb-output-sink gdb-output-sink)) | ||
| 1639 | (setq gdb-filter-output | ||
| 1640 | (concat output-field gdb-filter-output)))) | ||
| 1641 | |||
| 1642 | (defun gdb-ignored-notification (output-field)) | ||
| 1643 | |||
| 1613 | ;; gdb-invalidate-threads is defined to accept 'update-threads signal | 1644 | ;; gdb-invalidate-threads is defined to accept 'update-threads signal |
| 1614 | (defun gdb-thread-created (output-field)) | 1645 | (defun gdb-thread-created (output-field)) |
| 1615 | (defun gdb-thread-exited (output-field) | 1646 | (defun gdb-thread-exited (output-field) |
| 1616 | (gdb-emit-signal gdb-buf-publisher 'update-threads)) | 1647 | (gdb-emit-signal gdb-buf-publisher 'update-threads)) |
| 1617 | 1648 | ||
| 1649 | (defun gdb-thread-selected (output-field) | ||
| 1650 | "Handler for =thread-selected MI output record. | ||
| 1651 | |||
| 1652 | Sets `gdb-thread-number' to new id." | ||
| 1653 | (let* ((result (gdb-json-string output-field)) | ||
| 1654 | (thread-id (gdb-get-field result 'id))) | ||
| 1655 | (gdb-setq-thread-number thread-id) | ||
| 1656 | (gdb-wait-for-pending | ||
| 1657 | (gdb-update)))) | ||
| 1658 | |||
| 1618 | (defun gdb-running (output-field) | 1659 | (defun gdb-running (output-field) |
| 1619 | (setq gdb-inferior-status "running") | 1660 | (setq gdb-inferior-status "running") |
| 1620 | (gdb-force-mode-line-update | 1661 | (gdb-force-mode-line-update |
| @@ -1955,8 +1996,11 @@ HANDLER-NAME handler uses customization of CUSTOM-DEFUN. See | |||
| 1955 | (propertize "n" 'face font-lock-comment-face))) "\t" | 1996 | (propertize "n" 'face font-lock-comment-face))) "\t" |
| 1956 | (gdb-get-field breakpoint 'times) "\t" | 1997 | (gdb-get-field breakpoint 'times) "\t" |
| 1957 | (gdb-get-field breakpoint 'addr))) | 1998 | (gdb-get-field breakpoint 'addr))) |
| 1958 | (let ((at (gdb-get-field breakpoint 'at))) | 1999 | (let ((at (gdb-get-field breakpoint 'at)) |
| 1959 | (cond ((not at) | 2000 | (pending (gdb-get-field breakpoint 'pending))) |
| 2001 | (cond (pending (insert " " pending)) | ||
| 2002 | (at (insert " " at)) | ||
| 2003 | (t | ||
| 1960 | (progn | 2004 | (progn |
| 1961 | (insert | 2005 | (insert |
| 1962 | (concat " in " | 2006 | (concat " in " |
| @@ -1966,14 +2010,12 @@ HANDLER-NAME handler uses customization of CUSTOM-DEFUN. See | |||
| 1966 | (add-text-properties (line-beginning-position) | 2010 | (add-text-properties (line-beginning-position) |
| 1967 | (line-end-position) | 2011 | (line-end-position) |
| 1968 | '(mouse-face highlight | 2012 | '(mouse-face highlight |
| 1969 | help-echo "mouse-2, RET: visit breakpoint")))) | 2013 | help-echo "mouse-2, RET: visit breakpoint"))))) |
| 1970 | (at (insert (concat " " at))) | ||
| 1971 | (t (insert (gdb-get-field breakpoint 'original-location))))) | ||
| 1972 | (add-text-properties (line-beginning-position) | 2014 | (add-text-properties (line-beginning-position) |
| 1973 | (line-end-position) | 2015 | (line-end-position) |
| 1974 | `(gdb-breakpoint ,breakpoint)) | 2016 | `(gdb-breakpoint ,breakpoint)) |
| 1975 | (newline)) | 2017 | (newline)) |
| 1976 | (gdb-place-breakpoints))) | 2018 | (gdb-place-breakpoints)))) |
| 1977 | 2019 | ||
| 1978 | ;; Put breakpoint icons in relevant margins (even those set in the GUD buffer). | 2020 | ;; Put breakpoint icons in relevant margins (even those set in the GUD buffer). |
| 1979 | (defun gdb-place-breakpoints () | 2021 | (defun gdb-place-breakpoints () |
| @@ -2160,53 +2202,6 @@ corresponding to the mode line clicked." | |||
| 2160 | (define-key map (vector 'header-line 'down-mouse-1) 'ignore) | 2202 | (define-key map (vector 'header-line 'down-mouse-1) 'ignore) |
| 2161 | map)) | 2203 | map)) |
| 2162 | 2204 | ||
| 2163 | (defmacro gdb-propertize-header (name buffer help-echo mouse-face face) | ||
| 2164 | `(propertize ,name | ||
| 2165 | 'help-echo ,help-echo | ||
| 2166 | 'mouse-face ',mouse-face | ||
| 2167 | 'face ',face | ||
| 2168 | 'local-map | ||
| 2169 | (gdb-make-header-line-mouse-map | ||
| 2170 | 'mouse-1 | ||
| 2171 | (lambda (event) (interactive "e") | ||
| 2172 | (save-selected-window | ||
| 2173 | (select-window (posn-window (event-start event))) | ||
| 2174 | (set-window-dedicated-p (selected-window) nil) | ||
| 2175 | (switch-to-buffer | ||
| 2176 | (gdb-get-buffer-create ',buffer)) | ||
| 2177 | (setq header-line-format(gdb-set-header ',buffer)) | ||
| 2178 | (set-window-dedicated-p (selected-window) t)))))) | ||
| 2179 | |||
| 2180 | (defun gdb-set-header (buffer) | ||
| 2181 | (cond ((eq buffer 'gdb-locals-buffer) | ||
| 2182 | (list | ||
| 2183 | (gdb-propertize-header "Locals" gdb-locals-buffer | ||
| 2184 | nil nil mode-line) | ||
| 2185 | " " | ||
| 2186 | (gdb-propertize-header "Registers" gdb-registers-buffer | ||
| 2187 | "mouse-1: select" mode-line-highlight mode-line-inactive))) | ||
| 2188 | ((eq buffer 'gdb-registers-buffer) | ||
| 2189 | (list | ||
| 2190 | (gdb-propertize-header "Locals" gdb-locals-buffer | ||
| 2191 | "mouse-1: select" mode-line-highlight mode-line-inactive) | ||
| 2192 | " " | ||
| 2193 | (gdb-propertize-header "Registers" gdb-registers-buffer | ||
| 2194 | nil nil mode-line))) | ||
| 2195 | ((eq buffer 'gdb-breakpoints-buffer) | ||
| 2196 | (list | ||
| 2197 | (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer | ||
| 2198 | nil nil mode-line) | ||
| 2199 | " " | ||
| 2200 | (gdb-propertize-header "Threads" gdb-threads-buffer | ||
| 2201 | "mouse-1: select" mode-line-highlight mode-line-inactive))) | ||
| 2202 | ((eq buffer 'gdb-threads-buffer) | ||
| 2203 | (list | ||
| 2204 | (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer | ||
| 2205 | "mouse-1: select" mode-line-highlight mode-line-inactive) | ||
| 2206 | " " | ||
| 2207 | (gdb-propertize-header "Threads" gdb-threads-buffer | ||
| 2208 | nil nil mode-line))))) | ||
| 2209 | |||
| 2210 | 2205 | ||
| 2211 | ;; uses "-thread-info". Needs GDB 7.0 onwards. | 2206 | ;; uses "-thread-info". Needs GDB 7.0 onwards. |
| 2212 | ;;; Threads view | 2207 | ;;; Threads view |
| @@ -2280,6 +2275,23 @@ FILE is a full path." | |||
| 2280 | (define-key map "s" 'gdb-step-thread) | 2275 | (define-key map "s" 'gdb-step-thread) |
| 2281 | map)) | 2276 | map)) |
| 2282 | 2277 | ||
| 2278 | (defmacro gdb-propertize-header (name buffer help-echo mouse-face face) | ||
| 2279 | `(propertize ,name | ||
| 2280 | 'help-echo ,help-echo | ||
| 2281 | 'mouse-face ',mouse-face | ||
| 2282 | 'face ',face | ||
| 2283 | 'local-map | ||
| 2284 | (gdb-make-header-line-mouse-map | ||
| 2285 | 'mouse-1 | ||
| 2286 | (lambda (event) (interactive "e") | ||
| 2287 | (save-selected-window | ||
| 2288 | (select-window (posn-window (event-start event))) | ||
| 2289 | (set-window-dedicated-p (selected-window) nil) | ||
| 2290 | (switch-to-buffer | ||
| 2291 | (gdb-get-buffer-create ',buffer)) | ||
| 2292 | (setq header-line-format(gdb-set-header ',buffer)) | ||
| 2293 | (set-window-dedicated-p (selected-window) t)))))) | ||
| 2294 | |||
| 2283 | (defvar gdb-breakpoints-header | 2295 | (defvar gdb-breakpoints-header |
| 2284 | (list | 2296 | (list |
| 2285 | (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer | 2297 | (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer |
| @@ -2443,6 +2455,36 @@ line." | |||
| 2443 | "-exec-step" | 2455 | "-exec-step" |
| 2444 | "Step thread at current line.") | 2456 | "Step thread at current line.") |
| 2445 | 2457 | ||
| 2458 | (defun gdb-set-header (buffer) | ||
| 2459 | (cond ((eq buffer 'gdb-locals-buffer) | ||
| 2460 | (list | ||
| 2461 | (gdb-propertize-header "Locals" gdb-locals-buffer | ||
| 2462 | nil nil mode-line) | ||
| 2463 | " " | ||
| 2464 | (gdb-propertize-header "Registers" gdb-registers-buffer | ||
| 2465 | "mouse-1: select" mode-line-highlight mode-line-inactive))) | ||
| 2466 | ((eq buffer 'gdb-registers-buffer) | ||
| 2467 | (list | ||
| 2468 | (gdb-propertize-header "Locals" gdb-locals-buffer | ||
| 2469 | "mouse-1: select" mode-line-highlight mode-line-inactive) | ||
| 2470 | " " | ||
| 2471 | (gdb-propertize-header "Registers" gdb-registers-buffer | ||
| 2472 | nil nil mode-line))) | ||
| 2473 | ((eq buffer 'gdb-breakpoints-buffer) | ||
| 2474 | (list | ||
| 2475 | (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer | ||
| 2476 | nil nil mode-line) | ||
| 2477 | " " | ||
| 2478 | (gdb-propertize-header "Threads" gdb-threads-buffer | ||
| 2479 | "mouse-1: select" mode-line-highlight mode-line-inactive))) | ||
| 2480 | ((eq buffer 'gdb-threads-buffer) | ||
| 2481 | (list | ||
| 2482 | (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer | ||
| 2483 | "mouse-1: select" mode-line-highlight mode-line-inactive) | ||
| 2484 | " " | ||
| 2485 | (gdb-propertize-header "Threads" gdb-threads-buffer | ||
| 2486 | nil nil mode-line))))) | ||
| 2487 | |||
| 2446 | 2488 | ||
| 2447 | ;;; Memory view | 2489 | ;;; Memory view |
| 2448 | 2490 | ||
| @@ -2851,7 +2893,7 @@ DOC is an optional documentation string." | |||
| 2851 | 2893 | ||
| 2852 | (def-gdb-auto-update-trigger gdb-invalidate-disassembly | 2894 | (def-gdb-auto-update-trigger gdb-invalidate-disassembly |
| 2853 | (let* ((frame (gdb-current-buffer-frame)) | 2895 | (let* ((frame (gdb-current-buffer-frame)) |
| 2854 | (file (gdb-get-field frame 'file)) | 2896 | (file (gdb-get-field frame 'fullname)) |
| 2855 | (line (gdb-get-field frame 'line))) | 2897 | (line (gdb-get-field frame 'line))) |
| 2856 | (when file | 2898 | (when file |
| 2857 | (format "-data-disassemble -f %s -l %s -n -1 -- 0" file line))) | 2899 | (format "-data-disassemble -f %s -l %s -n -1 -- 0" file line))) |
| @@ -3375,6 +3417,12 @@ thread. Called from `gdb-update'." | |||
| 3375 | 3417 | ||
| 3376 | ;;;; Window management | 3418 | ;;;; Window management |
| 3377 | (defun gdb-display-buffer (buf dedicated &optional frame) | 3419 | (defun gdb-display-buffer (buf dedicated &optional frame) |
| 3420 | "Show buffer BUF. | ||
| 3421 | |||
| 3422 | If BUF is already displayed in some window, show it, deiconifying | ||
| 3423 | the frame if necessary. Otherwise, find least recently used | ||
| 3424 | window and show BUF there, if the window is not used for GDB | ||
| 3425 | already, in which case that window is splitted first." | ||
| 3378 | (let ((answer (get-buffer-window buf (or frame 0)))) | 3426 | (let ((answer (get-buffer-window buf (or frame 0)))) |
| 3379 | (if answer | 3427 | (if answer |
| 3380 | (display-buffer buf nil (or frame 0)) ;Deiconify the frame if necessary. | 3428 | (display-buffer buf nil (or frame 0)) ;Deiconify the frame if necessary. |
| @@ -3426,8 +3474,7 @@ thread. Called from `gdb-update'." | |||
| 3426 | (define-key menu [breakpoints] | 3474 | (define-key menu [breakpoints] |
| 3427 | '("Breakpoints" . gdb-frame-breakpoints-buffer))) | 3475 | '("Breakpoints" . gdb-frame-breakpoints-buffer))) |
| 3428 | 3476 | ||
| 3429 | (let ((menu (make-sparse-keymap "GDB-MI")) | 3477 | (let ((menu (make-sparse-keymap "GDB-MI"))) |
| 3430 | (submenu (make-sparse-keymap "GUD thread control mode"))) | ||
| 3431 | (define-key menu [gdb-customize] | 3478 | (define-key menu [gdb-customize] |
| 3432 | '(menu-item "Customize" (lambda () (interactive) (customize-group 'gdb)) | 3479 | '(menu-item "Customize" (lambda () (interactive) (customize-group 'gdb)) |
| 3433 | :help "Customize Gdb Graphical Mode options.")) | 3480 | :help "Customize Gdb Graphical Mode options.")) |
| @@ -3440,34 +3487,34 @@ thread. Called from `gdb-update'." | |||
| 3440 | :help "Restore standard layout for debug session.")) | 3487 | :help "Restore standard layout for debug session.")) |
| 3441 | (define-key menu [sep1] | 3488 | (define-key menu [sep1] |
| 3442 | '(menu-item "--")) | 3489 | '(menu-item "--")) |
| 3443 | (define-key submenu [all-threads] | 3490 | (define-key menu [all-threads] |
| 3444 | '(menu-item "All threads" | 3491 | '(menu-item "GUD controls all threads" |
| 3445 | (lambda () | 3492 | (lambda () |
| 3446 | (interactive) | 3493 | (interactive) |
| 3447 | (setq gdb-gud-control-all-threads t)) | 3494 | (setq gdb-gud-control-all-threads t)) |
| 3448 | :help "GUD start/stop commands apply to all threads" | 3495 | :help "GUD start/stop commands apply to all threads" |
| 3449 | :button (:radio . gdb-gud-control-all-threads))) | 3496 | :button (:radio . gdb-gud-control-all-threads))) |
| 3450 | (define-key submenu [current-thread] | 3497 | (define-key menu [current-thread] |
| 3451 | '(menu-item "Current thread" | 3498 | '(menu-item "GUD controls current thread" |
| 3452 | (lambda () | 3499 | (lambda () |
| 3453 | (interactive) | 3500 | (interactive) |
| 3454 | (setq gdb-gud-control-all-threads nil)) | 3501 | (setq gdb-gud-control-all-threads nil)) |
| 3455 | :help "GUD start/stop commands apply to current thread only" | 3502 | :help "GUD start/stop commands apply to current thread only" |
| 3456 | :button (:radio . (not gdb-gud-control-all-threads)))) | 3503 | :button (:radio . (not gdb-gud-control-all-threads)))) |
| 3457 | (define-key menu [thread-control] | 3504 | (define-key menu [sep2] |
| 3458 | `("GUD thread control mode" . ,submenu)) | 3505 | '(menu-item "--")) |
| 3459 | (define-key gud-menu-map [mi] | 3506 | (define-key menu [gdb-customize-reasons] |
| 3460 | `(menu-item "GDB-MI" ,menu :visible (eq gud-minor-mode 'gdbmi))) | 3507 | '(menu-item "Customize switching..." |
| 3508 | (lambda () | ||
| 3509 | (interactive) | ||
| 3510 | (customize-option 'gdb-switch-reasons)))) | ||
| 3461 | (define-key menu [gdb-switch-when-another-stopped] | 3511 | (define-key menu [gdb-switch-when-another-stopped] |
| 3462 | (menu-bar-make-toggle gdb-toggle-switch-when-another-stopped gdb-switch-when-another-stopped | 3512 | (menu-bar-make-toggle gdb-toggle-switch-when-another-stopped gdb-switch-when-another-stopped |
| 3463 | "Automatically switch to stopped thread" | 3513 | "Automatically switch to stopped thread" |
| 3464 | "GDB thread switching %s" | 3514 | "GDB thread switching %s" |
| 3465 | "Switch to stopped thread")) | 3515 | "Switch to stopped thread")) |
| 3466 | (define-key menu [gdb-non-stop] | 3516 | (define-key gud-menu-map [mi] |
| 3467 | (menu-bar-make-toggle gdb-toggle-non-stop gdb-non-stop | 3517 | `(menu-item "GDB-MI" ,menu :visible (eq gud-minor-mode 'gdbmi)))) |
| 3468 | "Non-stop mode" | ||
| 3469 | "GDB non-stop mode %s" | ||
| 3470 | "Allow examining stopped threads while others continue to execute"))) | ||
| 3471 | 3518 | ||
| 3472 | (defun gdb-frame-gdb-buffer () | 3519 | (defun gdb-frame-gdb-buffer () |
| 3473 | "Display GUD buffer in a new frame." | 3520 | "Display GUD buffer in a new frame." |