comparison lisp/progmodes/gdb-ui.el @ 68941:b41d1af1839d

(gdba, gdb-var-list): Improve doc strings. (menu): Re-order menu items. (gdb-var-update-regexp, gdb-var-update-regexp-1): Match "in_scope" field. (gdb-var-update-handler-1): Use it for GDB 6.4+. (gdb-post-prompt): Speed things by not forcing update.
author Nick Roberts <nickrob@snap.net.nz>
date Fri, 17 Feb 2006 00:25:16 +0000
parents 32eebeb631d6
children 87bf1f965a0f 9e490faa9f6b
comparison
equal deleted inserted replaced
68940:808f636eb13e 68941:b41d1af1839d
70 70
71 ;;; Known Bugs: 71 ;;; Known Bugs:
72 72
73 ;; 1) Strings that are watched don't update in the speedbar when their 73 ;; 1) Strings that are watched don't update in the speedbar when their
74 ;; contents change. 74 ;; contents change.
75 ;; 2) Watch expressions go out of scope when the inferior is re-run. 75 ;; 2) Cannot handle multiple debug sessions.
76 ;; 3) Cannot handle multiple debug sessions. 76
77 ;;; Problems with watch expressions:
78
79 ;; 1) They go out of scope when the inferior is re-run.
80 ;; 2) -var-update reports that an out of scope variable has changed:
81 ;; changelist=[{name="var1",in_scope="false"}], but the value can't be accessed.
82 ;; (-var-list-children, in contrast allows you to create variable objects of
83 ;; the children when they are out of scope and get their values).
84 ;; 3) VARNUM increments even when vaiable object is not created (maybe trivial).
77 85
78 ;;; TODO: 86 ;;; TODO:
79 87
80 ;; 1) Use MI command -data-read-memory for memory window. 88 ;; 1) Use MI command -data-read-memory for memory window.
81 ;; 2) Use tree-widget.el instead of the speedbar for watch-expressions? 89 ;; 2) Use tree-widget.el instead of the speedbar for watch-expressions?
95 (defvar gdb-memory-address "main") 103 (defvar gdb-memory-address "main")
96 (defvar gdb-previous-frame nil) 104 (defvar gdb-previous-frame nil)
97 (defvar gdb-selected-frame nil) 105 (defvar gdb-selected-frame nil)
98 (defvar gdb-frame-number nil) 106 (defvar gdb-frame-number nil)
99 (defvar gdb-current-language nil) 107 (defvar gdb-current-language nil)
100 (defvar gdb-var-list nil "List of variables in watch window.") 108 (defvar gdb-var-list nil
109 "List of variables in watch window.
110 Each element has the form (EXPRESSION VARNUM NUMCHILD TYPE VALUE CHANGED-P).")
101 (defvar gdb-var-changed nil "Non-nil means that `gdb-var-list' has changed.") 111 (defvar gdb-var-changed nil "Non-nil means that `gdb-var-list' has changed.")
102 (defvar gdb-main-file nil "Source file from which program execution begins.") 112 (defvar gdb-main-file nil "Source file from which program execution begins.")
103 (defvar gdb-overlay-arrow-position nil) 113 (defvar gdb-overlay-arrow-position nil)
104 (defvar gdb-server-prefix nil) 114 (defvar gdb-server-prefix nil)
105 (defvar gdb-flush-pending-output nil) 115 (defvar gdb-flush-pending-output nil)
661 (gdb-enqueue-input 671 (gdb-enqueue-input
662 (list "server interpreter mi \"-var-update *\"\n" 672 (list "server interpreter mi \"-var-update *\"\n"
663 'gdb-var-update-handler)) 673 'gdb-var-update-handler))
664 (push 'gdb-var-update gdb-pending-triggers))) 674 (push 'gdb-var-update gdb-pending-triggers)))
665 675
666 (defconst gdb-var-update-regexp "name=\"\\(.*?\\)\"") 676 (defconst gdb-var-update-regexp "name=\"\\(.*?\\)\",in_scope=\"\\(.*?\\)\"")
667 677
668 (defun gdb-var-update-handler () 678 (defun gdb-var-update-handler ()
669 (goto-char (point-min)) 679 (goto-char (point-min))
670 (while (re-search-forward gdb-var-update-regexp nil t) 680 (while (re-search-forward gdb-var-update-regexp nil t)
671 (catch 'var-found-1 681 (catch 'var-found-1
1202 (gdb-invalidate-threads) 1212 (gdb-invalidate-threads)
1203 (unless (eq system-type 'darwin) ;Breaks on Darwin's GDB-5.3. 1213 (unless (eq system-type 'darwin) ;Breaks on Darwin's GDB-5.3.
1204 ;; FIXME: with GDB-6 on Darwin, this might very well work. 1214 ;; FIXME: with GDB-6 on Darwin, this might very well work.
1205 ;; Only needed/used with speedbar/watch expressions. 1215 ;; Only needed/used with speedbar/watch expressions.
1206 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame)) 1216 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
1207 (setq gdb-var-changed t) ; force update
1208 (dolist (var gdb-var-list) 1217 (dolist (var gdb-var-list)
1209 (setcar (nthcdr 5 var) nil)) 1218 (setcar (nthcdr 5 var) nil))
1210 (if (string-equal gdb-version "pre-6.4") 1219 (if (string-equal gdb-version "pre-6.4")
1211 (gdb-var-update) 1220 (gdb-var-update)
1212 (gdb-var-update-1))))) 1221 (gdb-var-update-1)))))
3026 "server interpreter mi \"-var-update --all-values *\"\n" 3035 "server interpreter mi \"-var-update --all-values *\"\n"
3027 "-var-update --all-values *\n") 3036 "-var-update --all-values *\n")
3028 'gdb-var-update-handler-1)) 3037 'gdb-var-update-handler-1))
3029 (push 'gdb-var-update gdb-pending-triggers)))) 3038 (push 'gdb-var-update gdb-pending-triggers))))
3030 3039
3031 (defconst gdb-var-update-regexp-1 "name=\"\\(.*?\\)\",value=\\(\".*?\"\\),") 3040 (defconst gdb-var-update-regexp-1
3041 "name=\"\\(.*?\\)\",\\(?:value=\\(\".*?\"\\),\\)?in_scope=\"\\(.*?\\)\"")
3032 3042
3033 (defun gdb-var-update-handler-1 () 3043 (defun gdb-var-update-handler-1 ()
3034 (goto-char (point-min)) 3044 (goto-char (point-min))
3035 (while (re-search-forward gdb-var-update-regexp-1 nil t) 3045 (while (re-search-forward gdb-var-update-regexp-1 nil t)
3036 (let ((varnum (match-string 1))) 3046 (let ((varnum (match-string 1)))
3038 (let ((num 0)) 3048 (let ((num 0))
3039 (dolist (var gdb-var-list) 3049 (dolist (var gdb-var-list)
3040 (if (string-equal varnum (cadr var)) 3050 (if (string-equal varnum (cadr var))
3041 (progn 3051 (progn
3042 (setcar (nthcdr 5 var) t) 3052 (setcar (nthcdr 5 var) t)
3043 (setcar (nthcdr 4 var) (read (match-string 2))) 3053 (setcar (nthcdr 4 var)
3054 (if (string-equal (match-string 3) "true")
3055 (read (match-string 2))
3056 "*changed*"))
3044 (setcar (nthcdr num gdb-var-list) var) 3057 (setcar (nthcdr num gdb-var-list) var)
3045 (throw 'var-found1 nil))) 3058 (throw 'var-found1 nil)))
3046 (setq num (+ num 1)))))) 3059 (setq num (+ num 1))))))
3047 (setq gdb-var-changed t)) 3060 (setq gdb-var-changed t))
3048 (setq gdb-pending-triggers 3061 (setq gdb-pending-triggers