aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Roberts2003-09-04 22:34:47 +0000
committerNick Roberts2003-09-04 22:34:47 +0000
commitd947239b9d2e3f092491236aeabaf185f446c470 (patch)
treec230cac8c5556f445af98641ffbd4de21b6524b3
parentd5b235a12e2374faedea9b81976a8933eefbd1e9 (diff)
downloademacs-d947239b9d2e3f092491236aeabaf185f446c470.tar.gz
emacs-d947239b9d2e3f092491236aeabaf185f446c470.zip
(gud-display1): Use gud-call to prevent extra prompt
being displayed in GUD buffer. (gdb-idle-input-queue): Remove var. Use just one queue. (gdb-enqueue-idle-input,gdb-dequeue-idle-input): Remove functions. Use just one queue. (gdb-prompt, gdb-subprompt, def-gdb-auto-update-trigger) (gdb-invalidate-assembler, gdb-get-current-frame): Modify functions. Use just one queue.
-rw-r--r--lisp/gdb-ui.el77
1 files changed, 20 insertions, 57 deletions
diff --git a/lisp/gdb-ui.el b/lisp/gdb-ui.el
index be7348aa650..1ae70eb6f8b 100644
--- a/lisp/gdb-ui.el
+++ b/lisp/gdb-ui.el
@@ -199,10 +199,8 @@ The following interactive lisp functions help control operation :
199 (gud-call (concat "server ptype " expr))) 199 (gud-call (concat "server ptype " expr)))
200 (goto-char (- (point-max) 1)) 200 (goto-char (- (point-max) 1))
201 (if (equal (char-before) (string-to-char "\*")) 201 (if (equal (char-before) (string-to-char "\*"))
202 (gdb-enqueue-input 202 (gud-call (concat "display* " expr))
203 (list (concat "display* " expr "\n") 'ignore)) 203 (gud-call (concat "display " expr)))))
204 (gdb-enqueue-input
205 (list (concat "display " expr "\n") 'ignore)))))
206 204
207; this would messy because these bindings don't work with M-x gdb 205; this would messy because these bindings don't work with M-x gdb
208; (define-key global-map "\C-x\C-a\C-a" 'gud-display) 206; (define-key global-map "\C-x\C-a\C-a" 'gud-display)
@@ -239,10 +237,7 @@ The following interactive lisp functions help control operation :
239 "A string of characters from gdb that have not yet been processed.") 237 "A string of characters from gdb that have not yet been processed.")
240 238
241(def-gdb-var input-queue () 239(def-gdb-var input-queue ()
242 "A list of high priority gdb command objects.") 240 "A list of gdb command objects.")
243
244(def-gdb-var idle-input-queue ()
245 "A list of low priority gdb command objects.")
246 241
247(def-gdb-var prompting nil 242(def-gdb-var prompting nil
248 "True when gdb is idle with no pending input.") 243 "True when gdb is idle with no pending input.")
@@ -432,9 +427,6 @@ The key should be one of the cars in `gdb-buffer-rules-assoc'."
432 427
433;; INPUT: things sent to gdb 428;; INPUT: things sent to gdb
434;; 429;;
435;; There is a high and low priority input queue. Low priority input is sent
436;; only when the high priority queue is idle.
437;;
438;; The queues are lists. Each element is either a string (indicating user or 430;; The queues are lists. Each element is either a string (indicating user or
439;; user-like input) or a list of the form: 431;; user-like input) or a list of the form:
440;; 432;;
@@ -453,12 +445,7 @@ This filter may simply queue output for a later time."
453 (gdb-enqueue-input (concat string "\n"))) 445 (gdb-enqueue-input (concat string "\n")))
454 446
455;; Note: Stuff enqueued here will be sent to the next prompt, even if it 447;; Note: Stuff enqueued here will be sent to the next prompt, even if it
456;; is a query, or other non-top-level prompt. To guarantee stuff will get 448;; is a query, or other non-top-level prompt.
457;; sent to the top-level prompt, currently it must be put in the idle queue.
458;; ^^^^^^^^^
459;; [This should encourage gdb extensions that invoke gdb commands to let
460;; the user go first; it is not a bug. -t]
461;;
462 449
463(defun gdb-enqueue-input (item) 450(defun gdb-enqueue-input (item)
464 (if (gdb-get-prompting) 451 (if (gdb-get-prompting)
@@ -477,24 +464,6 @@ This filter may simply queue output for a later time."
477 answer) 464 answer)
478 (gdb-take-last-elt queue))))) 465 (gdb-take-last-elt queue)))))
479 466
480(defun gdb-enqueue-idle-input (item)
481 (if (and (gdb-get-prompting)
482 (not (gdb-get-input-queue)))
483 (progn
484 (gdb-send-item item)
485 (gdb-set-prompting nil))
486 (gdb-set-idle-input-queue
487 (cons item (gdb-get-idle-input-queue)))))
488
489(defun gdb-dequeue-idle-input ()
490 (let ((queue (gdb-get-idle-input-queue)))
491 (and queue
492 (if (not (cdr queue))
493 (let ((answer (car queue)))
494 (gdb-set-idle-input-queue '())
495 answer)
496 (gdb-take-last-elt queue)))))
497
498;; Don't use this in general. 467;; Don't use this in general.
499(defun gdb-take-last-elt (l) 468(defun gdb-take-last-elt (l)
500 (if (cdr (cdr l)) 469 (if (cdr (cdr l))
@@ -609,22 +578,16 @@ This sends the next command (if any) to gdb."
609 (t 578 (t
610 (gdb-set-output-sink 'user) 579 (gdb-set-output-sink 'user)
611 (error "Phase error in gdb-prompt (got %s)" sink)))) 580 (error "Phase error in gdb-prompt (got %s)" sink))))
612 (let ((highest (gdb-dequeue-input))) 581 (let ((input (gdb-dequeue-input)))
613 (if highest 582 (if input
614 (gdb-send-item highest) 583 (gdb-send-item input)
615 (let ((lowest (gdb-dequeue-idle-input))) 584 (progn
616 (if lowest 585 (gdb-set-prompting t)
617 (gdb-send-item lowest) 586 (gud-display-frame)))))
618 (progn
619 (gdb-set-prompting t)
620 (gud-display-frame)))))))
621 587
622(defun gdb-subprompt (ignored) 588(defun gdb-subprompt (ignored)
623 "An annotation handler for non-top-level prompts." 589 "An annotation handler for non-top-level prompts."
624 (let ((highest (gdb-dequeue-input))) 590 (gdb-set-prompting t))
625 (if highest
626 (gdb-send-item highest)
627 (gdb-set-prompting t))))
628 591
629(defun gdb-starting (ignored) 592(defun gdb-starting (ignored)
630 "An annotation handler for `starting'. This says that I/O for the 593 "An annotation handler for `starting'. This says that I/O for the
@@ -1176,15 +1139,15 @@ output from the current command if that happens to be appropriate."
1176;; command might have changed, and we have to be able to run the command 1139;; command might have changed, and we have to be able to run the command
1177;; behind the user's back. 1140;; behind the user's back.
1178;; 1141;;
1179;; The idle input queue and the output phasing associated with the variable 1142;; The output phasing associated with the variable gdb-output-sink
1180;; gdb-output-sink help us to run commands behind the user's back. 1143;; help us to run commands behind the user's back.
1181;; 1144;;
1182;; Below is the code for specificly managing buffers of output from one 1145;; Below is the code for specificly managing buffers of output from one
1183;; command. 1146;; command.
1184;; 1147;;
1185 1148
1186;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES 1149;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES
1187;; It adds an idle input for the command we are tracking. It should be the 1150;; It adds an input for the command we are tracking. It should be the
1188;; annotation rule binding of whatever gdb sends to tell us this command 1151;; annotation rule binding of whatever gdb sends to tell us this command
1189;; might have changed it's output. 1152;; might have changed it's output.
1190;; 1153;;
@@ -1199,7 +1162,7 @@ output from the current command if that happens to be appropriate."
1199 (not (member ',name 1162 (not (member ',name
1200 (gdb-get-pending-triggers)))) 1163 (gdb-get-pending-triggers))))
1201 (progn 1164 (progn
1202 (gdb-enqueue-idle-input 1165 (gdb-enqueue-input
1203 (list ,gdb-command ',output-handler)) 1166 (list ,gdb-command ',output-handler))
1204 (gdb-set-pending-triggers 1167 (gdb-set-pending-triggers
1205 (cons ',name 1168 (cons ',name
@@ -2376,12 +2339,12 @@ BUFFER nil or omitted means use the current buffer."
2376 (progn 2339 (progn
2377 ;; take previous disassemble command off the queue 2340 ;; take previous disassemble command off the queue
2378 (with-current-buffer gud-comint-buffer 2341 (with-current-buffer gud-comint-buffer
2379 (let ((queue (gdb-get-idle-input-queue)) (item)) 2342 (let ((queue (gdb-get-input-queue)) (item))
2380 (dolist (item queue) 2343 (dolist (item queue)
2381 (if (equal (cdr item) '(gdb-assembler-handler)) 2344 (if (equal (cdr item) '(gdb-assembler-handler))
2382 (gdb-set-idle-input-queue 2345 (gdb-set-input-queue
2383 (delete item (gdb-get-idle-input-queue))))))) 2346 (delete item (gdb-get-input-queue)))))))
2384 (gdb-enqueue-idle-input 2347 (gdb-enqueue-input
2385 (list (concat "server disassemble " gdb-current-address "\n") 2348 (list (concat "server disassemble " gdb-current-address "\n")
2386 'gdb-assembler-handler)) 2349 'gdb-assembler-handler))
2387 (gdb-set-pending-triggers 2350 (gdb-set-pending-triggers
@@ -2393,7 +2356,7 @@ BUFFER nil or omitted means use the current buffer."
2393(defun gdb-get-current-frame () 2356(defun gdb-get-current-frame ()
2394 (if (not (member 'gdb-get-current-frame (gdb-get-pending-triggers))) 2357 (if (not (member 'gdb-get-current-frame (gdb-get-pending-triggers)))
2395 (progn 2358 (progn
2396 (gdb-enqueue-idle-input 2359 (gdb-enqueue-input
2397 (list (concat "server info frame\n") 'gdb-frame-handler)) 2360 (list (concat "server info frame\n") 'gdb-frame-handler))
2398 (gdb-set-pending-triggers 2361 (gdb-set-pending-triggers
2399 (cons 'gdb-get-current-frame 2362 (cons 'gdb-get-current-frame