aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/gdb-ui.el96
1 files changed, 45 insertions, 51 deletions
diff --git a/lisp/gdb-ui.el b/lisp/gdb-ui.el
index 6cbbec1d19d..e16c6521c40 100644
--- a/lisp/gdb-ui.el
+++ b/lisp/gdb-ui.el
@@ -123,7 +123,7 @@ The following interactive lisp functions help control operation :
123 (setq comint-prompt-regexp "^(.*gdb[+]?) *") 123 (setq comint-prompt-regexp "^(.*gdb[+]?) *")
124 (setq comint-input-sender 'gdb-send) 124 (setq comint-input-sender 'gdb-send)
125 125
126; (re-)initialise 126 ;; (re-)initialise
127 (setq gdb-main-or-pc "main") 127 (setq gdb-main-or-pc "main")
128 (setq gdb-current-address nil) 128 (setq gdb-current-address nil)
129 (setq gdb-display-in-progress nil) 129 (setq gdb-display-in-progress nil)
@@ -136,7 +136,7 @@ The following interactive lisp functions help control operation :
136 (gdb-make-instance) 136 (gdb-make-instance)
137 (if gdb-first-time (gdb-clear-inferior-io)) 137 (if gdb-first-time (gdb-clear-inferior-io))
138 138
139; find source file and compilation directory here 139 ;; find source file and compilation directory here
140 (gdb-instance-enqueue-idle-input (list "server list\n" 'ignore)) 140 (gdb-instance-enqueue-idle-input (list "server list\n" 'ignore))
141 (gdb-instance-enqueue-idle-input (list "server info source\n" 141 (gdb-instance-enqueue-idle-input (list "server info source\n"
142 'gdb-source-info))) 142 'gdb-source-info)))
@@ -146,7 +146,6 @@ The following interactive lisp functions help control operation :
146 (interactive "p") 146 (interactive "p")
147 (if (not (string-equal mode-name "Assembler")) 147 (if (not (string-equal mode-name "Assembler"))
148 (gud-call "break %f:%l" arg) 148 (gud-call "break %f:%l" arg)
149;else
150 (save-excursion 149 (save-excursion
151 (beginning-of-line) 150 (beginning-of-line)
152 (forward-char 2) 151 (forward-char 2)
@@ -156,8 +155,7 @@ The following interactive lisp functions help control operation :
156 "Remove breakpoint at current line or address." 155 "Remove breakpoint at current line or address."
157 (interactive "p") 156 (interactive "p")
158 (if (not (string-equal mode-name "Assembler")) 157 (if (not (string-equal mode-name "Assembler"))
159 (gud-call "clear %f:%l" arg) 158 (gud-call "clear %f:%l" arg)
160;else
161 (save-excursion 159 (save-excursion
162 (beginning-of-line) 160 (beginning-of-line)
163 (forward-char 2) 161 (forward-char 2)
@@ -177,7 +175,6 @@ The following interactive lisp functions help control operation :
177 (if (re-search-forward "\*" nil t) 175 (if (re-search-forward "\*" nil t)
178 (gdb-instance-enqueue-idle-input 176 (gdb-instance-enqueue-idle-input
179 (list (concat "server display* " expr "\n") 'ignore)) 177 (list (concat "server display* " expr "\n") 'ignore))
180;else
181 (gdb-instance-enqueue-idle-input 178 (gdb-instance-enqueue-idle-input
182 (list (concat "server display " expr "\n") 'ignore)))) 179 (list (concat "server display " expr "\n") 'ignore))))
183 180
@@ -444,7 +441,7 @@ The key should be one of the cars in `gdb-instance-buffer-rules-assoc'."
444 (cons (cons buffer-type rules) 441 (cons (cons buffer-type rules)
445 gdb-instance-buffer-rules-assoc))))) 442 gdb-instance-buffer-rules-assoc)))))
446 443
447; GUD buffers are an exception to the rules 444;; GUD buffers are an exception to the rules
448(gdb-set-instance-buffer-rules 'gdba 'error) 445(gdb-set-instance-buffer-rules 'gdba 'error)
449 446
450;; 447;;
@@ -598,7 +595,7 @@ This filter may simply queue output for a later time."
598 answer) 595 answer)
599 (gdb-take-last-elt queue))))) 596 (gdb-take-last-elt queue)))))
600 597
601; Don't use this in general. 598;; Don't use this in general.
602(defun gdb-take-last-elt (l) 599(defun gdb-take-last-elt (l)
603 (if (cdr (cdr l)) 600 (if (cdr (cdr l))
604 (gdb-take-last-elt (cdr l)) 601 (gdb-take-last-elt (cdr l))
@@ -657,7 +654,7 @@ This filter may simply queue output for a later time."
657 ("display-number-end" gdb-display-number-end) 654 ("display-number-end" gdb-display-number-end)
658 ("array-section-begin" gdb-array-section-begin) 655 ("array-section-begin" gdb-array-section-begin)
659 ("array-section-end" gdb-array-section-end) 656 ("array-section-end" gdb-array-section-end)
660; ("elt" gdb-elt) 657 ;; ("elt" gdb-elt)
661 ("field-begin" gdb-field-begin) 658 ("field-begin" gdb-field-begin)
662 ("field-end" gdb-field-end) 659 ("field-end" gdb-field-end)
663 ) "An assoc mapping annotation tags to functions which process them.") 660 ) "An assoc mapping annotation tags to functions which process them.")
@@ -678,7 +675,7 @@ This filter may simply queue output for a later time."
678 (string-to-int (match-string 2 args)))) 675 (string-to-int (match-string 2 args))))
679 (setq gdb-current-address (match-string 3 args)) 676 (setq gdb-current-address (match-string 3 args))
680 (setq gdb-main-or-pc gdb-current-address) 677 (setq gdb-main-or-pc gdb-current-address)
681;update with new frame for machine code if necessary 678 ;;update with new frame for machine code if necessary
682 (gdb-invalidate-assembler)) 679 (gdb-invalidate-assembler))
683 680
684(defun gdb-prompt (ignored) 681(defun gdb-prompt (ignored)
@@ -860,7 +857,7 @@ output from the current command if that happens to be appropriate."
860 (looking-at "\\(.*?\\) =") 857 (looking-at "\\(.*?\\) =")
861 (let ((char "") 858 (let ((char "")
862 (gdb-temp-value (match-string 1))) 859 (gdb-temp-value (match-string 1)))
863;move * to front of expression if necessary 860 ;;move * to front of expression if necessary
864 (if (looking-at ".*\\*") 861 (if (looking-at ".*\\*")
865 (progn 862 (progn
866 (setq char "*") 863 (setq char "*")
@@ -871,11 +868,11 @@ output from the current command if that happens to be appropriate."
871 (if (not (string-match "::" gdb-expression)) 868 (if (not (string-match "::" gdb-expression))
872 (setq gdb-expression (concat char gdb-current-frame 869 (setq gdb-expression (concat char gdb-current-frame
873 "::" gdb-expression)) 870 "::" gdb-expression))
874;else put * back on if necessary 871 ;;else put * back on if necessary
875 (setq gdb-expression (concat char gdb-expression))) 872 (setq gdb-expression (concat char gdb-expression)))
876 (setq header-line-format (concat "-- " gdb-expression " %-")))) 873 (setq header-line-format (concat "-- " gdb-expression " %-"))))
877 874
878;-if scalar/string 875 ;;-if scalar/string
879 (if (not (re-search-forward "##" nil t)) 876 (if (not (re-search-forward "##" nil t))
880 (progn 877 (progn
881 (save-excursion 878 (save-excursion
@@ -884,8 +881,7 @@ output from the current command if that happens to be appropriate."
884 (delete-region (point-min) (point-max)) 881 (delete-region (point-min) (point-max))
885 (insert-buffer (gdb-get-instance-buffer 'gdb-partial-output-buffer)) 882 (insert-buffer (gdb-get-instance-buffer 'gdb-partial-output-buffer))
886 (setq buffer-read-only t))) 883 (setq buffer-read-only t)))
887; else 884 ;; display expression name...
888; display expression name...
889 (goto-char (point-min)) 885 (goto-char (point-min))
890 (let ((start (progn (point))) 886 (let ((start (progn (point)))
891 (end (progn (end-of-line) (point)))) 887 (end (progn (end-of-line) (point))))
@@ -927,18 +923,18 @@ output from the current command if that happens to be appropriate."
927 'action (lambda (button) (gdb-display-go-back))) 923 'action (lambda (button) (gdb-display-go-back)))
928 924
929(defun gdb-display-go-back () 925(defun gdb-display-go-back ()
930 ; delete display so they don't accumulate and delete buffer 926 ;; delete display so they don't accumulate and delete buffer
931 (let ((number gdb-display-number)) 927 (let ((number gdb-display-number))
932 (gdb-instance-enqueue-idle-input 928 (gdb-instance-enqueue-idle-input
933 (list (concat "server delete display " number "\n") 'ignore)) 929 (list (concat "server delete display " number "\n") 'ignore))
934 (switch-to-buffer (concat "*display " gdb-dive-display-number "*")) 930 (switch-to-buffer (concat "*display " gdb-dive-display-number "*"))
935 (kill-buffer (get-buffer (concat "*display " number "*"))))) 931 (kill-buffer (get-buffer (concat "*display " number "*")))))
936 932
937; prefix annotations with ## and process whole output in one chunk 933;; prefix annotations with ## and process whole output in one chunk
938; in gdb-partial-output-buffer (to allow recursion). 934;; in gdb-partial-output-buffer (to allow recursion).
939 935
940; array-section flags are just removed again but after counting. They 936;; array-section flags are just removed again but after counting. They
941; might also be useful for arrays of structures and structures with arrays. 937;; might also be useful for arrays of structures and structures with arrays.
942(defun gdb-array-section-begin (args) 938(defun gdb-array-section-begin (args)
943 (if gdb-display-in-progress 939 (if gdb-display-in-progress
944 (progn 940 (progn
@@ -978,21 +974,21 @@ output from the current command if that happens to be appropriate."
978 (insert "\n##elt\n")))) 974 (insert "\n##elt\n"))))
979 975
980(defun gdb-field-format-begin () 976(defun gdb-field-format-begin ()
981; get rid of ##field-begin 977 ;; get rid of ##field-begin
982 (gdb-delete-line) 978 (gdb-delete-line)
983 (gdb-insert-field) 979 (gdb-insert-field)
984 (setq gdb-nesting-level (+ gdb-nesting-level 1)) 980 (setq gdb-nesting-level (+ gdb-nesting-level 1))
985 (while (re-search-forward "##" nil t) 981 (while (re-search-forward "##" nil t)
986; keep making recursive calls... 982 ;; keep making recursive calls...
987 (if (looking-at "field-begin \\(.\\)") 983 (if (looking-at "field-begin \\(.\\)")
988 (progn 984 (progn
989 (setq gdb-annotation-arg (match-string 1)) 985 (setq gdb-annotation-arg (match-string 1))
990 (gdb-field-format-begin))) 986 (gdb-field-format-begin)))
991; until field-end. 987 ;; until field-end.
992 (if (looking-at "field-end") (gdb-field-format-end)))) 988 (if (looking-at "field-end") (gdb-field-format-end))))
993 989
994(defun gdb-field-format-end () 990(defun gdb-field-format-end ()
995; get rid of ##field-end and `,' or `}' 991 ;; get rid of ##field-end and `,' or `}'
996 (gdb-delete-line) 992 (gdb-delete-line)
997 (gdb-delete-line) 993 (gdb-delete-line)
998 (setq gdb-nesting-level (- gdb-nesting-level 1))) 994 (setq gdb-nesting-level (- gdb-nesting-level 1)))
@@ -1067,14 +1063,14 @@ output from the current command if that happens to be appropriate."
1067 1063
1068(defun gdb-array-format () 1064(defun gdb-array-format ()
1069 (while (re-search-forward "##" nil t) 1065 (while (re-search-forward "##" nil t)
1070; keep making recursive calls... 1066 ;; keep making recursive calls...
1071 (if (looking-at "array-section-begin") 1067 (if (looking-at "array-section-begin")
1072 (progn 1068 (progn
1073;get rid of ##array-section-begin 1069 ;;get rid of ##array-section-begin
1074 (gdb-delete-line) 1070 (gdb-delete-line)
1075 (setq gdb-nesting-level (+ gdb-nesting-level 1)) 1071 (setq gdb-nesting-level (+ gdb-nesting-level 1))
1076 (gdb-array-format))) 1072 (gdb-array-format)))
1077;until *matching* array-section-end is found 1073 ;;until *matching* array-section-end is found
1078 (if (looking-at "array-section-end") 1074 (if (looking-at "array-section-end")
1079 (if (eq gdb-nesting-level 0) 1075 (if (eq gdb-nesting-level 0)
1080 (progn 1076 (progn
@@ -1085,7 +1081,7 @@ output from the current command if that happens to be appropriate."
1085 (concat "{" (replace-regexp-in-string "\n" "" values) 1081 (concat "{" (replace-regexp-in-string "\n" "" values)
1086 "}")) 1082 "}"))
1087 (gdb-array-format1)))) 1083 (gdb-array-format1))))
1088;else get rid of ##array-section-end etc 1084 ;;else get rid of ##array-section-end etc
1089 (gdb-delete-line) 1085 (gdb-delete-line)
1090 (setq gdb-nesting-level (- gdb-nesting-level 1)) 1086 (setq gdb-nesting-level (- gdb-nesting-level 1))
1091 (gdb-array-format))))) 1087 (gdb-array-format)))))
@@ -1400,7 +1396,7 @@ buffer."
1400(defvar breakpoint-enabled-icon) 1396(defvar breakpoint-enabled-icon)
1401(defvar breakpoint-disabled-icon) 1397(defvar breakpoint-disabled-icon)
1402 1398
1403;-put breakpoint icons in relevant margins (even those set in the GUD buffer) 1399;;-put breakpoint icons in relevant margins (even those set in the GUD buffer)
1404(defun gdb-info-breakpoints-custom () 1400(defun gdb-info-breakpoints-custom ()
1405 (let ((flag)(address)) 1401 (let ((flag)(address))
1406 1402
@@ -1706,7 +1702,7 @@ buffer."
1706 gdb-info-locals-custom) 1702 gdb-info-locals-custom)
1707 1703
1708 1704
1709;Abbreviate for arrays and structures. These can be expanded using gud-display 1705;;Abbreviate for arrays and structures. These can be expanded using gud-display
1710(defun gdb-info-locals-handler nil 1706(defun gdb-info-locals-handler nil
1711 (set-gdb-instance-pending-triggers (delq 'gdb-invalidate-locals 1707 (set-gdb-instance-pending-triggers (delq 'gdb-invalidate-locals
1712 (gdb-instance-pending-triggers))) 1708 (gdb-instance-pending-triggers)))
@@ -1783,10 +1779,10 @@ buffer."
1783 gdb-info-display-custom) 1779 gdb-info-display-custom)
1784 1780
1785(defun gdb-info-display-custom () 1781(defun gdb-info-display-custom ()
1786; TODO: ensure frames of expressions that have been deleted are also deleted 1782 ;; TODO: ensure frames of expressions that have been deleted are also deleted
1787; these can be missed currently eg through GUD buffer, restarting a 1783 ;; these can be missed currently eg through GUD buffer, restarting a
1788; recompiled program. 1784 ;; recompiled program.
1789) 1785 )
1790 1786
1791(defvar gdb-display-mode-map 1787(defvar gdb-display-mode-map
1792 (let ((map (make-sparse-keymap)) 1788 (let ((map (make-sparse-keymap))
@@ -1859,7 +1855,6 @@ buffer."
1859 'ignore)) 1855 'ignore))
1860 (if (not (display-graphic-p)) 1856 (if (not (display-graphic-p))
1861 (kill-buffer (get-buffer (concat "*display " number "*"))) 1857 (kill-buffer (get-buffer (concat "*display " number "*")))
1862 ;else
1863 (catch 'frame-found 1858 (catch 'frame-found
1864 (let ((frames (frame-list))) 1859 (let ((frames (frame-list)))
1865 (while frames 1860 (while frames
@@ -2044,7 +2039,6 @@ This arrangement depends on the value of `gdb-many-windows'."
2044 (switch-to-buffer gud-comint-buffer) 2039 (switch-to-buffer gud-comint-buffer)
2045 (delete-other-windows) 2040 (delete-other-windows)
2046 (gdb-setup-windows)) 2041 (gdb-setup-windows))
2047;else
2048 (switch-to-buffer gud-comint-buffer) 2042 (switch-to-buffer gud-comint-buffer)
2049 (delete-other-windows) 2043 (delete-other-windows)
2050 (split-window) 2044 (split-window)
@@ -2140,7 +2134,7 @@ buffers."
2140 (other-window 1) 2134 (other-window 1)
2141 (setq gdb-source-window (get-buffer-window (current-buffer)))))) 2135 (setq gdb-source-window (get-buffer-window (current-buffer))))))
2142 2136
2143;from put-image 2137;;from put-image
2144(defun put-string (putstring pos &optional string area) 2138(defun put-string (putstring pos &optional string area)
2145 "Put string PUTSTRING in front of POS in the current buffer. 2139 "Put string PUTSTRING in front of POS in the current buffer.
2146PUTSTRING is displayed by putting an overlay into the current buffer with a 2140PUTSTRING is displayed by putting an overlay into the current buffer with a
@@ -2162,7 +2156,7 @@ means display it in the right marginal area."
2162 (overlay-put overlay 'put-text t) 2156 (overlay-put overlay 'put-text t)
2163 (overlay-put overlay 'before-string string)))) 2157 (overlay-put overlay 'before-string string))))
2164 2158
2165;from remove-images 2159;;from remove-images
2166(defun remove-strings (start end &optional buffer) 2160(defun remove-strings (start end &optional buffer)
2167 "Remove strings between START and END in BUFFER. 2161 "Remove strings between START and END in BUFFER.
2168Remove only images that were put in BUFFER with calls to `put-string'. 2162Remove only images that were put in BUFFER with calls to `put-string'.
@@ -2268,7 +2262,7 @@ BUFFER nil or omitted means use the current buffer."
2268 (setq gdb-arrow-position (point)) 2262 (setq gdb-arrow-position (point))
2269 (put-arrow "=>" gdb-arrow-position nil 'left-margin)))) 2263 (put-arrow "=>" gdb-arrow-position nil 'left-margin))))
2270 2264
2271; remove all breakpoint-icons in assembler buffer before updating. 2265 ;; remove all breakpoint-icons in assembler buffer before updating.
2272 (save-excursion 2266 (save-excursion
2273 (set-buffer buffer) 2267 (set-buffer buffer)
2274 (if (display-graphic-p) 2268 (if (display-graphic-p)
@@ -2283,7 +2277,7 @@ BUFFER nil or omitted means use the current buffer."
2283 (progn 2277 (progn
2284 (looking-at 2278 (looking-at
2285 "\\([0-9]*\\)\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)\\s-*0x0\\(\\S-*\\)") 2279 "\\([0-9]*\\)\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)\\s-*0x0\\(\\S-*\\)")
2286 ; info break gives '0x0' (8 digit) while dump gives '0x' (7 digit) 2280 ;; info break gives '0x0' (8 digit) while dump gives '0x' (7 digit)
2287 (setq address (concat "0x" (match-string 3))) 2281 (setq address (concat "0x" (match-string 3)))
2288 (setq flag (char-after (match-beginning 2))) 2282 (setq flag (char-after (match-beginning 2)))
2289 (save-excursion 2283 (save-excursion
@@ -2358,8 +2352,8 @@ BUFFER nil or omitted means use the current buffer."
2358 2352
2359(defvar gdb-prev-main-or-pc nil) 2353(defvar gdb-prev-main-or-pc nil)
2360 2354
2361; modified because if gdb-main-or-pc has changed value a new command 2355;; modified because if gdb-main-or-pc has changed value a new command
2362; must be enqueued to update the buffer with the new output 2356;; must be enqueued to update the buffer with the new output
2363(defun gdb-invalidate-assembler (&optional ignored) 2357(defun gdb-invalidate-assembler (&optional ignored)
2364 (if (and (gdb-get-instance-buffer 'gdb-assembler-buffer) 2358 (if (and (gdb-get-instance-buffer 'gdb-assembler-buffer)
2365 (or (not (member 'gdb-invalidate-assembler 2359 (or (not (member 'gdb-invalidate-assembler