aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Roberts2002-11-28 21:24:19 +0000
committerNick Roberts2002-11-28 21:24:19 +0000
commite6e1f54fa52851312f0fc3c8e884838ade9323cf (patch)
tree6b77fedb43b222aeeb96e1ca2bac29d50f72d70d
parent6424c3d5c1b2e603bbb4c0fecc0614513641c8fc (diff)
downloademacs-e6e1f54fa52851312f0fc3c8e884838ade9323cf.tar.gz
emacs-e6e1f54fa52851312f0fc3c8e884838ade9323cf.zip
(gdb-starting): Set gdb-running to t.
(gdb-stopped): Set gdb-running to nil. (gdb-quit): Reset some variables including tool-bar-map.
-rw-r--r--lisp/gdb-ui.el81
1 files changed, 37 insertions, 44 deletions
diff --git a/lisp/gdb-ui.el b/lisp/gdb-ui.el
index 336c9d94826..e5f7dc6eb2b 100644
--- a/lisp/gdb-ui.el
+++ b/lisp/gdb-ui.el
@@ -130,6 +130,7 @@ The following interactive lisp functions help control operation :
130 (setq gdb-display-in-progress nil) 130 (setq gdb-display-in-progress nil)
131 (setq gdb-dive nil) 131 (setq gdb-dive nil)
132 (setq gud-last-last-frame nil) 132 (setq gud-last-last-frame nil)
133 (setq gdb-running nil)
133 134
134 (run-hooks 'gdb-mode-hook) 135 (run-hooks 'gdb-mode-hook)
135 (setq gdb-proc (get-buffer-process (current-buffer))) 136 (setq gdb-proc (get-buffer-process (current-buffer)))
@@ -679,7 +680,7 @@ This filter may simply queue output for a later time."
679(defconst gdb-source-spec-regexp 680(defconst gdb-source-spec-regexp
680 "\\(.*\\):\\([0-9]*\\):[0-9]*:[a-z]*:\\(0x[a-f0-9]*\\)") 681 "\\(.*\\):\\([0-9]*\\):[0-9]*:[a-z]*:\\(0x[a-f0-9]*\\)")
681 682
682;; Do not use this except as an annotation handler." 683;; Do not use this except as an annotation handler.
683(defun gdb-source (args) 684(defun gdb-source (args)
684 (string-match gdb-source-spec-regexp args) 685 (string-match gdb-source-spec-regexp args)
685 ;; Extract the frame position from the marker. 686 ;; Extract the frame position from the marker.
@@ -695,9 +696,9 @@ This filter may simply queue output for a later time."
695;update with new frame for machine code if necessary 696;update with new frame for machine code if necessary
696 (gdb-invalidate-assembler)) 697 (gdb-invalidate-assembler))
697 698
698;; An annotation handler for `prompt'.
699;; This sends the next command (if any) to gdb.
700(defun gdb-prompt (ignored) 699(defun gdb-prompt (ignored)
700 "An annotation handler for `prompt'.
701This sends the next command (if any) to gdb."
701 (let ((sink (gdb-instance-output-sink))) 702 (let ((sink (gdb-instance-output-sink)))
702 (cond 703 (cond
703 ((eq sink 'user) t) 704 ((eq sink 'user) t)
@@ -716,8 +717,8 @@ This filter may simply queue output for a later time."
716 (set-gdb-instance-prompting t) 717 (set-gdb-instance-prompting t)
717 (gud-display-frame))))))) 718 (gud-display-frame)))))))
718 719
719;; An annotation handler for non-top-level prompts.
720(defun gdb-subprompt (ignored) 720(defun gdb-subprompt (ignored)
721 "An annotation handler for non-top-level prompts."
721 (let ((highest (gdb-instance-dequeue-input))) 722 (let ((highest (gdb-instance-dequeue-input)))
722 (if highest 723 (if highest
723 (gdb-send-item highest) 724 (gdb-send-item highest)
@@ -734,10 +735,9 @@ This filter may simply queue output for a later time."
734 (set-gdb-instance-output-sink 'pre-emacs) 735 (set-gdb-instance-output-sink 'pre-emacs)
735 (process-send-string gdb-proc (car item))))) 736 (process-send-string gdb-proc (car item)))))
736 737
737;; An annotation handler for `pre-prompt'.
738;; This terminates the collection of output from a previous
739;; command if that happens to be in effect.
740(defun gdb-pre-prompt (ignored) 738(defun gdb-pre-prompt (ignored)
739 "An annotation handler for `pre-prompt'. This terminates the collection of
740output from a previous command if that happens to be in effect."
741 (let ((sink (gdb-instance-output-sink))) 741 (let ((sink (gdb-instance-output-sink)))
742 (cond 742 (cond
743 ((eq sink 'user) t) 743 ((eq sink 'user) t)
@@ -753,28 +753,30 @@ This filter may simply queue output for a later time."
753 (set-gdb-instance-output-sink 'user) 753 (set-gdb-instance-output-sink 'user)
754 (error "Output sink phase error 1"))))) 754 (error "Output sink phase error 1")))))
755 755
756;; An annotation handler for `starting'. This says that I/O for the subprocess
757;; is now the program being debugged, not GDB.
758(defun gdb-starting (ignored) 756(defun gdb-starting (ignored)
757 "An annotation handler for `starting'. This says that I/O for the
758subprocess is now the program being debugged, not GDB."
759 (let ((sink (gdb-instance-output-sink))) 759 (let ((sink (gdb-instance-output-sink)))
760 (cond 760 (cond
761 ((eq sink 'user) 761 ((eq sink 'user)
762 (set-gdb-instance-output-sink 'inferior)) 762 (progn
763 (setq gdb-running t)
764 (set-gdb-instance-output-sink 'inferior)))
763 (t (error "Unexpected `starting' annotation"))))) 765 (t (error "Unexpected `starting' annotation")))))
764 766
765;; An annotation handler for `exited' and other annotations which say that
766;; I/O for the subprocess is now GDB, not the program being debugged.
767(defun gdb-stopping (ignored) 767(defun gdb-stopping (ignored)
768 "An annotation handler for `exited' and other annotations which say that I/O
769for the subprocess is now GDB, not the program being debugged."
768 (let ((sink (gdb-instance-output-sink))) 770 (let ((sink (gdb-instance-output-sink)))
769 (cond 771 (cond
770 ((eq sink 'inferior) 772 ((eq sink 'inferior)
771 (set-gdb-instance-output-sink 'user)) 773 (set-gdb-instance-output-sink 'user))
772 (t (error "Unexpected stopping annotation"))))) 774 (t (error "Unexpected stopping annotation")))))
773 775
774;; An annotation handler for `stopped'. It is just like gdb-stopping, except
775;; that if we already set the output sink to 'user in gdb-stopping, that is
776;; fine.
777(defun gdb-stopped (ignored) 776(defun gdb-stopped (ignored)
777 "An annotation handler for `stopped'. It is just like gdb-stopping, except
778that if we already set the output sink to 'user in gdb-stopping, that is fine."
779 (setq gdb-running nil)
778 (let ((sink (gdb-instance-output-sink))) 780 (let ((sink (gdb-instance-output-sink)))
779 (cond 781 (cond
780 ((eq sink 'inferior) 782 ((eq sink 'inferior)
@@ -791,10 +793,9 @@ This filter may simply queue output for a later time."
791 ((eq sink 'emacs) t) 793 ((eq sink 'emacs) t)
792 (t (error "Unexpected frame-begin annotation (%S)" sink))))) 794 (t (error "Unexpected frame-begin annotation (%S)" sink)))))
793 795
794;; An annotation handler for `post-prompt'.
795;; This begins the collection of output from the current
796;; command if that happens to be appropriate."
797(defun gdb-post-prompt (ignored) 796(defun gdb-post-prompt (ignored)
797 "An annotation handler for `post-prompt'. This begins the collection of
798output from the current command if that happens to be appropriate."
798 (if (not (gdb-instance-pending-triggers)) 799 (if (not (gdb-instance-pending-triggers))
799 (progn 800 (progn
800 (gdb-invalidate-registers ignored) 801 (gdb-invalidate-registers ignored)
@@ -805,7 +806,6 @@ This filter may simply queue output for a later time."
805 ((eq sink 'user) t) 806 ((eq sink 'user) t)
806 ((eq sink 'pre-emacs) 807 ((eq sink 'pre-emacs)
807 (set-gdb-instance-output-sink 'emacs)) 808 (set-gdb-instance-output-sink 'emacs))
808
809 (t 809 (t
810 (set-gdb-instance-output-sink 'user) 810 (set-gdb-instance-output-sink 'user)
811 (error "Output sink phase error 3"))))) 811 (error "Output sink phase error 3")))))
@@ -813,7 +813,6 @@ This filter may simply queue output for a later time."
813;; If we get an error whilst evaluating one of the expressions 813;; If we get an error whilst evaluating one of the expressions
814;; we won't get the display-end annotation. Set the sink back to 814;; we won't get the display-end annotation. Set the sink back to
815;; user to make sure that the error message is seen 815;; user to make sure that the error message is seen
816
817(defun gdb-error-begin (ignored) 816(defun gdb-error-begin (ignored)
818 (set-gdb-instance-output-sink 'user)) 817 (set-gdb-instance-output-sink 'user))
819 818
@@ -915,7 +914,6 @@ This filter may simply queue output for a later time."
915 'gdb-partial-output-buffer) 914 'gdb-partial-output-buffer)
916 start end) 915 start end)
917 (insert "\n"))) 916 (insert "\n")))
918
919 (goto-char (point-min)) 917 (goto-char (point-min))
920 (re-search-forward "##" nil t) 918 (re-search-forward "##" nil t)
921 (setq gdb-nesting-level 0) 919 (setq gdb-nesting-level 0)
@@ -1175,7 +1173,7 @@ This filter may simply queue output for a later time."
1175 (concat indices-string "\t" gdb-display-value "\n")))) 1173 (concat indices-string "\t" gdb-display-value "\n"))))
1176 (setq indices-string "") 1174 (setq indices-string "")
1177 (setq flag t) 1175 (setq flag t)
1178 ; 0<= index < depth, start at right : (- depth 1) 1176 ; 0<= index < depth, start at right : (- depth 1)
1179 (setq index (- (- depth 1) 1177 (setq index (- (- depth 1)
1180 (- (match-end 2) (match-beginning 2)))) 1178 (- (match-end 2) (match-beginning 2))))
1181 ;don't set for very last brackets 1179 ;don't set for very last brackets
@@ -1220,7 +1218,7 @@ This filter may simply queue output for a later time."
1220 1218
1221;; Handle a burst of output from a gdb instance. 1219;; Handle a burst of output from a gdb instance.
1222;; This function is (indirectly) used as a gud-marker-filter. 1220;; This function is (indirectly) used as a gud-marker-filter.
1223;; It must return output (if any) to be insterted in the gdb 1221;; It must return output (if any) to be inserted in the gdb
1224;; buffer. 1222;; buffer.
1225 1223
1226(defun gdb-output-burst (string) 1224(defun gdb-output-burst (string)
@@ -1228,7 +1226,6 @@ This filter may simply queue output for a later time."
1228This function is (indirectly) used as a gud-marker-filter. 1226This function is (indirectly) used as a gud-marker-filter.
1229It must return output (if any) to be insterted in the gdb 1227It must return output (if any) to be insterted in the gdb
1230buffer." 1228buffer."
1231
1232 (save-match-data 1229 (save-match-data
1233 (let ( 1230 (let (
1234 ;; Recall the left over burst from last time 1231 ;; Recall the left over burst from last time
@@ -1237,7 +1234,6 @@ buffer."
1237 (output "")) 1234 (output ""))
1238 1235
1239 ;; Process all the complete markers in this chunk. 1236 ;; Process all the complete markers in this chunk.
1240
1241 (while (string-match "\n\032\032\\(.*\\)\n" burst) 1237 (while (string-match "\n\032\032\\(.*\\)\n" burst)
1242 (let ((annotation (substring burst 1238 (let ((annotation (substring burst
1243 (match-beginning 1) 1239 (match-beginning 1)
@@ -1247,7 +1243,8 @@ buffer."
1247 ;; It is either concatenated to OUTPUT or directed 1243 ;; It is either concatenated to OUTPUT or directed
1248 ;; elsewhere. 1244 ;; elsewhere.
1249 (setq output 1245 (setq output
1250 (gdb-concat-output output 1246 (gdb-concat-output
1247 output
1251 (substring burst 0 (match-beginning 0)))) 1248 (substring burst 0 (match-beginning 0))))
1252 1249
1253 ;; Take that stuff off the burst. 1250 ;; Take that stuff off the burst.
@@ -1272,7 +1269,6 @@ buffer."
1272 ;; us to blow up. 1269 ;; us to blow up.
1273 )))) 1270 ))))
1274 1271
1275
1276 ;; Does the remaining text end in a partial line? 1272 ;; Does the remaining text end in a partial line?
1277 ;; If it does, then keep part of the burst until we get more. 1273 ;; If it does, then keep part of the burst until we get more.
1278 (if (string-match "\n\\'\\|\n\032\\'\\|\n\032\032.*\\'" 1274 (if (string-match "\n\\'\\|\n\032\\'\\|\n\032\032.*\\'"
@@ -1337,7 +1333,6 @@ buffer."
1337 (delete-region (point-min) (point-max)))) 1333 (delete-region (point-min) (point-max))))
1338 1334
1339 1335
1340
1341;; One trick is to have a command who's output is always available in 1336;; One trick is to have a command who's output is always available in
1342;; a buffer of it's own, and is always up to date. We build several 1337;; a buffer of it's own, and is always up to date. We build several
1343;; buffers of this type. 1338;; buffers of this type.
@@ -1354,7 +1349,6 @@ buffer."
1354;; command. 1349;; command.
1355;; 1350;;
1356 1351
1357
1358;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES 1352;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES
1359;; It adds an idle input for the command we are tracking. It should be the 1353;; It adds an idle input for the command we are tracking. It should be the
1360;; annotation rule binding of whatever gdb sends to tell us this command 1354;; annotation rule binding of whatever gdb sends to tell us this command
@@ -1363,7 +1357,9 @@ buffer."
1363;; NAME is the function name. DEMAND-PREDICATE tests if output is really needed. 1357;; NAME is the function name. DEMAND-PREDICATE tests if output is really needed.
1364;; GDB-COMMAND is a string of such. OUTPUT-HANDLER is the function bound to the 1358;; GDB-COMMAND is a string of such. OUTPUT-HANDLER is the function bound to the
1365;; input in the input queue (see comment about ``gdb communications'' above). 1359;; input in the input queue (see comment about ``gdb communications'' above).
1366(defmacro def-gdb-auto-update-trigger (name demand-predicate gdb-command output-handler) 1360
1361(defmacro def-gdb-auto-update-trigger (name demand-predicate gdb-command
1362 output-handler)
1367 `(defun ,name (&optional ignored) 1363 `(defun ,name (&optional ignored)
1368 (if (and (,demand-predicate) 1364 (if (and (,demand-predicate)
1369 (not (member ',name 1365 (not (member ',name
@@ -1412,7 +1408,6 @@ buffer."
1412;; These display the output of `info breakpoints'. 1408;; These display the output of `info breakpoints'.
1413;; 1409;;
1414 1410
1415
1416(gdb-set-instance-buffer-rules 'gdb-breakpoints-buffer 1411(gdb-set-instance-buffer-rules 'gdb-breakpoints-buffer
1417 'gdb-breakpoints-buffer-name 1412 'gdb-breakpoints-buffer-name
1418 'gdb-breakpoints-mode) 1413 'gdb-breakpoints-mode)
@@ -1559,6 +1554,7 @@ buffer."
1559 (gdb-invalidate-breakpoints)) 1554 (gdb-invalidate-breakpoints))
1560 1555
1561(defun gdb-toggle-bp-this-line () 1556(defun gdb-toggle-bp-this-line ()
1557"Enable/disable the breakpoint on this line."
1562 (interactive) 1558 (interactive)
1563 (save-excursion 1559 (save-excursion
1564 (beginning-of-line 1) 1560 (beginning-of-line 1)
@@ -1576,6 +1572,7 @@ buffer."
1576 '(lambda () nil)))))) 1572 '(lambda () nil))))))
1577 1573
1578(defun gdb-delete-bp-this-line () 1574(defun gdb-delete-bp-this-line ()
1575"Delete the breakpoint on this line."
1579 (interactive) 1576 (interactive)
1580 (beginning-of-line 1) 1577 (beginning-of-line 1)
1581 (if (not (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)")) 1578 (if (not (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)"))
@@ -1592,7 +1589,7 @@ buffer."
1592(defvar gdb-source-window nil) 1589(defvar gdb-source-window nil)
1593 1590
1594(defun gdb-goto-bp-this-line () 1591(defun gdb-goto-bp-this-line ()
1595"Display the file at the breakpoint specified." 1592"Display the file at the specified breakpoint."
1596 (interactive) 1593 (interactive)
1597 (save-excursion 1594 (save-excursion
1598 (beginning-of-line 1) 1595 (beginning-of-line 1)
@@ -1830,21 +1827,10 @@ buffer."
1830 'gdb-display-mode) 1827 'gdb-display-mode)
1831 1828
1832(def-gdb-auto-updated-buffer gdb-display-buffer 1829(def-gdb-auto-updated-buffer gdb-display-buffer
1833 ;; This defines the auto update rule for buffers of type
1834 ;; `gdb-display-buffer'. 1830 ;; `gdb-display-buffer'.
1835 ;;
1836 ;; It defines a function to serve as the annotation handler that
1837 ;; handles the `foo-invalidated' message. That function is called:
1838 gdb-invalidate-display 1831 gdb-invalidate-display
1839
1840 ;; To update the buffer, this command is sent to gdb.
1841 "server info display\n" 1832 "server info display\n"
1842
1843 ;; This also defines a function to be the handler for the output
1844 ;; from the command above. That function will copy the output into
1845 ;; the appropriately typed buffer. That function will be called:
1846 gdb-info-display-handler 1833 gdb-info-display-handler
1847; buffer specific functions
1848 gdb-info-display-custom) 1834 gdb-info-display-custom)
1849 1835
1850(defun gdb-info-display-custom () 1836(defun gdb-info-display-custom ()
@@ -1895,6 +1881,7 @@ buffer."
1895 (gdb-get-create-instance-buffer 'gdb-display-buffer))) 1881 (gdb-get-create-instance-buffer 'gdb-display-buffer)))
1896 1882
1897(defun gdb-toggle-disp-this-line () 1883(defun gdb-toggle-disp-this-line ()
1884"Enable/disable the displayed expression on this line."
1898 (interactive) 1885 (interactive)
1899 (save-excursion 1886 (save-excursion
1900 (beginning-of-line 1) 1887 (beginning-of-line 1)
@@ -1912,6 +1899,7 @@ buffer."
1912 '(lambda () nil)))))) 1899 '(lambda () nil))))))
1913 1900
1914(defun gdb-delete-disp-this-line () 1901(defun gdb-delete-disp-this-line ()
1902"Delete the displayed expression on this line."
1915 (interactive) 1903 (interactive)
1916 (save-excursion 1904 (save-excursion
1917 (set-buffer 1905 (set-buffer
@@ -2205,6 +2193,9 @@ Just the partial-output buffer is left."
2205 (remove-images (point-min) (point-max)) 2193 (remove-images (point-min) (point-max))
2206 (remove-strings (point-min) (point-max))) 2194 (remove-strings (point-min) (point-max)))
2207 (setq left-margin-width 0) 2195 (setq left-margin-width 0)
2196 (setq gud-minor-mode nil)
2197 (kill-local-variable 'tool-bar-map)
2198 (setq gdb-running nil)
2208 (if (get-buffer-window (current-buffer)) 2199 (if (get-buffer-window (current-buffer))
2209 (set-window-margins (get-buffer-window 2200 (set-window-margins (get-buffer-window
2210 (current-buffer)) 2201 (current-buffer))
@@ -2216,6 +2207,8 @@ Just the partial-output buffer is left."
2216 (delete-other-windows)) 2207 (delete-other-windows))
2217 2208
2218(defun gdb-source-info () 2209(defun gdb-source-info ()
2210"Finds the source file where the program starts and displays it with related
2211buffers."
2219 (goto-char (point-min)) 2212 (goto-char (point-min))
2220 (re-search-forward "directory is ") 2213 (re-search-forward "directory is ")
2221 (looking-at "\\(\\S-*\\)") 2214 (looking-at "\\(\\S-*\\)")
@@ -2488,7 +2481,7 @@ BUFFER nil or omitted means use the current buffer."
2488 (setq gdb-prev-main-or-pc gdb-main-or-pc)))) 2481 (setq gdb-prev-main-or-pc gdb-main-or-pc))))
2489 2482
2490(defun gdb-delete-line () 2483(defun gdb-delete-line ()
2491"Delete current line." 2484 "Delete the current line."
2492(interactive) 2485(interactive)
2493 (let ((start (progn (beginning-of-line) (point))) 2486 (let ((start (progn (beginning-of-line) (point)))
2494 (end (progn (end-of-line) (+ (point) 1)))) 2487 (end (progn (end-of-line) (+ (point) 1))))