diff options
| author | Nick Roberts | 2008-02-16 06:45:07 +0000 |
|---|---|---|
| committer | Nick Roberts | 2008-02-16 06:45:07 +0000 |
| commit | ef6cb9e834cdc7ebd987bfa407aac556eda1b11e (patch) | |
| tree | 2887acfddb78adeff199df874801723ebf0eaebe | |
| parent | bdd9e9c04b163686d3f6b398e3acf9b030be7e59 (diff) | |
| download | emacs-ef6cb9e834cdc7ebd987bfa407aac556eda1b11e.tar.gz emacs-ef6cb9e834cdc7ebd987bfa407aac556eda1b11e.zip | |
(gdb-ready): Move declaration from gud.el to here.
(gdb-early-user-input): New variable.
(gdb): Reset gdb-flush-pending-output to nil and set
comint-input-sender here (before gdb-prompt), instead of...
(gdb-init-1): ...here.
(gdb-send): If Emacs is not ready, defer user input to...
(gdb-prompt): ...here.
| -rw-r--r-- | lisp/progmodes/gdb-ui.el | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index 21525891d37..0d3f364ff39 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el | |||
| @@ -137,6 +137,8 @@ Emacs can't find.") | |||
| 137 | "Non-nil when GDB generates frame-begin annotation.") | 137 | "Non-nil when GDB generates frame-begin annotation.") |
| 138 | (defvar gdb-printing t) | 138 | (defvar gdb-printing t) |
| 139 | (defvar gdb-parent-bptno-enabled nil) | 139 | (defvar gdb-parent-bptno-enabled nil) |
| 140 | (defvar gdb-ready nil) | ||
| 141 | (defvar gdb-early-user-input nil) | ||
| 140 | 142 | ||
| 141 | (defvar gdb-buffer-type nil | 143 | (defvar gdb-buffer-type nil |
| 142 | "One of the symbols bound in `gdb-buffer-rules'.") | 144 | "One of the symbols bound in `gdb-buffer-rules'.") |
| @@ -284,6 +286,7 @@ session." | |||
| 284 | 286 | ||
| 285 | (gud-common-init command-line nil 'gud-gdba-marker-filter) | 287 | (gud-common-init command-line nil 'gud-gdba-marker-filter) |
| 286 | (set (make-local-variable 'gud-minor-mode) 'gdba) | 288 | (set (make-local-variable 'gud-minor-mode) 'gdba) |
| 289 | (setq comint-input-sender 'gdb-send) | ||
| 287 | 290 | ||
| 288 | (gud-def gud-break "break %f:%l" "\C-b" "Set breakpoint at current line.") | 291 | (gud-def gud-break "break %f:%l" "\C-b" "Set breakpoint at current line.") |
| 289 | (gud-def gud-tbreak "tbreak %f:%l" "\C-t" | 292 | (gud-def gud-tbreak "tbreak %f:%l" "\C-t" |
| @@ -317,6 +320,8 @@ session." | |||
| 317 | (setq gdb-first-prompt t) | 320 | (setq gdb-first-prompt t) |
| 318 | (setq gud-running nil) | 321 | (setq gud-running nil) |
| 319 | (setq gdb-ready nil) | 322 | (setq gdb-ready nil) |
| 323 | (setq gdb-flush-pending-output nil) | ||
| 324 | (setq gdb-early-user-input nil) | ||
| 320 | (setq gud-filter-pending-text nil) | 325 | (setq gud-filter-pending-text nil) |
| 321 | (run-hooks 'gdb-mode-hook)) | 326 | (run-hooks 'gdb-mode-hook)) |
| 322 | 327 | ||
| @@ -574,8 +579,6 @@ otherwise do not." | |||
| 574 | (define-key gud-minor-mode-map [left-margin C-mouse-3] | 579 | (define-key gud-minor-mode-map [left-margin C-mouse-3] |
| 575 | 'gdb-mouse-jump) | 580 | 'gdb-mouse-jump) |
| 576 | 581 | ||
| 577 | (setq comint-input-sender 'gdb-send) | ||
| 578 | |||
| 579 | ;; (re-)initialize | 582 | ;; (re-)initialize |
| 580 | (setq gdb-pc-address (if gdb-show-main "main" nil)) | 583 | (setq gdb-pc-address (if gdb-show-main "main" nil)) |
| 581 | (setq gdb-previous-frame-address nil | 584 | (setq gdb-previous-frame-address nil |
| @@ -593,7 +596,6 @@ otherwise do not." | |||
| 593 | gdb-pending-triggers nil | 596 | gdb-pending-triggers nil |
| 594 | gdb-output-sink 'user | 597 | gdb-output-sink 'user |
| 595 | gdb-server-prefix "server " | 598 | gdb-server-prefix "server " |
| 596 | gdb-flush-pending-output nil | ||
| 597 | gdb-location-alist nil | 599 | gdb-location-alist nil |
| 598 | gdb-source-file-list nil | 600 | gdb-source-file-list nil |
| 599 | gdb-error nil | 601 | gdb-error nil |
| @@ -1194,21 +1196,24 @@ The key should be one of the cars in `gdb-buffer-rules-assoc'." | |||
| 1194 | (defun gdb-send (proc string) | 1196 | (defun gdb-send (proc string) |
| 1195 | "A comint send filter for gdb. | 1197 | "A comint send filter for gdb. |
| 1196 | This filter may simply queue input for a later time." | 1198 | This filter may simply queue input for a later time." |
| 1197 | (when gdb-ready | 1199 | (if gdb-ready |
| 1198 | (with-current-buffer gud-comint-buffer | 1200 | (progn |
| 1199 | (let ((inhibit-read-only t)) | 1201 | (with-current-buffer gud-comint-buffer |
| 1200 | (remove-text-properties (point-min) (point-max) '(face)))) | 1202 | (let ((inhibit-read-only t)) |
| 1201 | (if gud-running | 1203 | (remove-text-properties (point-min) (point-max) '(face)))) |
| 1202 | (progn | 1204 | (if gud-running |
| 1203 | (let ((item (concat string "\n"))) | 1205 | (progn |
| 1204 | (if gdb-enable-debug (push (cons 'send item) gdb-debug-log)) | 1206 | (let ((item (concat string "\n"))) |
| 1205 | (process-send-string proc item))) | 1207 | (if gdb-enable-debug (push (cons 'send item) gdb-debug-log)) |
| 1206 | (if (string-match "\\\\\\'" string) | 1208 | (process-send-string proc item))) |
| 1207 | (setq gdb-continuation (concat gdb-continuation string "\n")) | 1209 | (if (string-match "\\\\\\'" string) |
| 1208 | (let ((item (concat gdb-continuation string | 1210 | (setq gdb-continuation (concat gdb-continuation string "\n")) |
| 1209 | (if (not comint-input-sender-no-newline) "\n")))) | 1211 | (let ((item (concat |
| 1210 | (gdb-enqueue-input item) | 1212 | gdb-continuation string |
| 1211 | (setq gdb-continuation nil)))))) | 1213 | (if (not comint-input-sender-no-newline) "\n")))) |
| 1214 | (gdb-enqueue-input item) | ||
| 1215 | (setq gdb-continuation nil))))) | ||
| 1216 | (push (concat string "\n") gdb-early-user-input))) | ||
| 1212 | 1217 | ||
| 1213 | ;; Note: Stuff enqueued here will be sent to the next prompt, even if it | 1218 | ;; Note: Stuff enqueued here will be sent to the next prompt, even if it |
| 1214 | ;; is a query, or other non-top-level prompt. | 1219 | ;; is a query, or other non-top-level prompt. |
| @@ -1362,7 +1367,11 @@ This sends the next command (if any) to gdb." | |||
| 1362 | (gdb-send-item input) | 1367 | (gdb-send-item input) |
| 1363 | (progn | 1368 | (progn |
| 1364 | (setq gdb-prompting t) | 1369 | (setq gdb-prompting t) |
| 1365 | (gud-display-frame))))) | 1370 | (gud-display-frame) |
| 1371 | (setq gdb-early-user-input (nreverse gdb-early-user-input)) | ||
| 1372 | (while gdb-early-user-input | ||
| 1373 | (gdb-enqueue-input (car gdb-early-user-input)) | ||
| 1374 | (setq gdb-early-user-input (cdr gdb-early-user-input))))))) | ||
| 1366 | 1375 | ||
| 1367 | (defun gdb-subprompt (ignored) | 1376 | (defun gdb-subprompt (ignored) |
| 1368 | "An annotation handler for non-top-level prompts." | 1377 | "An annotation handler for non-top-level prompts." |