aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/gdb-ui.el
diff options
context:
space:
mode:
authorKaroly Lorentey <[email protected]>2006-04-01 13:24:42 +0000
committerKaroly Lorentey <[email protected]>2006-04-01 13:24:42 +0000
commit10a0e6fe87378d0dafb5ce257aa60c8a1b25c708 (patch)
treedb6f6272d381d3ca09c783cea7f5f3aaf8fafc99 /lisp/progmodes/gdb-ui.el
parent6bcc8ec7eb185314e1b24f285fdcc1e7093c1bc1 (diff)
parentafc749959d78f5b48b92de877067828d46c915ce (diff)
Merged from [email protected]
Patches applied: * [email protected]/emacs--devo--0--patch-173 Update from CVS * [email protected]/emacs--devo--0--patch-174 Merge from gnus--rel--5.10 * [email protected]/emacs--devo--0--patch-175 Update from CVS * [email protected]/emacs--devo--0--patch-176 Merge from gnus--rel--5.10 * [email protected]/emacs--devo--0--patch-177 Update from CVS * [email protected]/emacs--devo--0--patch-178 Update from CVS * [email protected]/emacs--devo--0--patch-179 Update from erc--emacs--0 * [email protected]/emacs--devo--0--patch-180 Update from CVS * [email protected]/emacs--devo--0--patch-181 Update from CVS * [email protected]/emacs--devo--0--patch-182 Merge from gnus--rel--5.10 * [email protected]/emacs--devo--0--patch-183 Update from CVS * [email protected]/emacs--devo--0--patch-184 Merge from gnus--rel--5.10 * [email protected]/emacs--devo--0--patch-185 Update from CVS * [email protected]/emacs--devo--0--patch-186 Update from CVS * [email protected]/emacs--devo--0--patch-187 Merge from gnus--rel--5.10 * [email protected]/gnus--rel--5.10--patch-65 Update from CVS * [email protected]/gnus--rel--5.10--patch-66 Update from CVS * [email protected]/gnus--rel--5.10--patch-67 Update from CVS * [email protected]/gnus--rel--5.10--patch-68 Update from CVS * [email protected]/gnus--rel--5.10--patch-69 Update from CVS * [email protected]/gnus--rel--5.10--patch-70 Update from CVS * [email protected]/gnus--rel--5.10--patch-71 Update from CVS * [email protected]/gnus--rel--5.10--patch-72 Update from CVS git-archimport-id: [email protected]/emacs--multi-tty--0--patch-542
Diffstat (limited to 'lisp/progmodes/gdb-ui.el')
-rw-r--r--lisp/progmodes/gdb-ui.el109
1 files changed, 67 insertions, 42 deletions
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index 5b657b1555..b969515e2f 100644
--- a/lisp/progmodes/gdb-ui.el
+++ b/lisp/progmodes/gdb-ui.el
@@ -78,13 +78,15 @@
;; gdb-assembler-custom with a lisp debugger it does!).
;;; Problems with watch expressions, GDB/MI:
-
;; 1) They go out of scope when the inferior is re-run.
;; 2) -stack-list-locals has a type field but also prints type in values field.
-;; 3) VARNUM increments even when variable object is not created (maybe trivial).
+;; 3) VARNUM increments even when variable object is not created
+;; (maybe trivial).
-;;; TODO:
+;; Known Bugs:
+;; 1) M-x gdb doesn't work with "run" command in .gdbinit, use M-x gdba instead.
+;;; TODO:
;; 1) Use MI command -data-read-memory for memory window.
;; 2) Use tree-widget.el instead of the speedbar for watch-expressions?
;; 3) Mark breakpoint locations on scroll-bar of source buffer?
@@ -126,6 +128,7 @@ and #define directives otherwise.")
(defvar gdb-signalled nil)
(defvar gdb-source-window nil)
(defvar gdb-inferior-status nil)
+(defvar gdb-continuation nil)
(defvar gdb-buffer-type nil
"One of the symbols bound in `gdb-buffer-rules'.")
@@ -258,7 +261,8 @@ detailed description of this mode.
(interactive (list (gud-query-cmdline 'gdba)))
;;
;; Let's start with a basic gud-gdb buffer and then modify it a bit.
- (gdb command-line))
+ (gdb command-line)
+ (gdb-init-1))
(defcustom gdb-debug-ring-max 128
"Maximum size of `gdb-debug-ring'."
@@ -702,7 +706,7 @@ With arg, enter name of variable to be watched in the minibuffer."
(message "gud-watch is a no-op in this mode."))))
(defconst gdb-var-create-regexp
- "name=\"\\(.*?\\)\",numchild=\"\\(.*?\\)\",type=\"\\(.*?\\)\"")
+ "name=\"\\(.*?\\)\",.*numchild=\"\\(.*?\\)\",.*type=\"\\(.*?\\)\"")
(defun gdb-var-create-handler (expr)
(goto-char (point-min))
@@ -747,8 +751,8 @@ With arg, enter name of variable to be watched in the minibuffer."
`(lambda () (gdb-var-list-children-handler ,varnum)))))
(defconst gdb-var-list-children-regexp
- "name=\"\\(.*?\\)\",exp=\"\\(.*?\\)\",numchild=\"\\(.*?\\)\",\
-type=\"\\(.*?\\)\"")
+ "child={.*?name=\"\\(.*?\\)\",.*?exp=\"\\(.*?\\)\",.*?\
+numchild=\"\\(.*?\\)\",.*?type=\"\\(.*?\\)\".*?}")
(defun gdb-var-list-children-handler (varnum)
(goto-char (point-min))
@@ -784,7 +788,9 @@ type=\"\\(.*?\\)\"")
'gdb-var-update-handler))
(push 'gdb-var-update gdb-pending-triggers)))
-(defconst gdb-var-update-regexp "name=\"\\(.*?\\)\",in_scope=\"\\(.*?\\)\"")
+(defconst gdb-var-update-regexp
+ "{.*?name=\"\\(.*?\\)\",.*?in_scope=\"\\(.*?\\)\",.*?\
+type_changed=\".*?\".*?}")
(defun gdb-var-update-handler ()
(dolist (var gdb-var-list)
@@ -1078,7 +1084,6 @@ The key should be one of the cars in `gdb-buffer-rules-assoc'."
;;
;; These lists are consumed tail first.
;;
-(defvar gdb-continuation nil)
(defun gdb-send (proc string)
"A comint send filter for gdb.
@@ -1086,15 +1091,16 @@ This filter may simply queue input for a later time."
(with-current-buffer gud-comint-buffer
(let ((inhibit-read-only t))
(remove-text-properties (point-min) (point-max) '(face))))
- (if (string-match "\\\\$" string)
- (setq gdb-continuation (concat gdb-continuation string "\n"))
- (let ((item (concat gdb-continuation string "\n")))
- (if gud-running
- (progn
+ (if gud-running
+ (progn
+ (let ((item (concat string "\n")))
(if gdb-enable-debug (push (cons 'send item) gdb-debug-ring))
- (process-send-string proc item))
- (gdb-enqueue-input item)))
- (setq gdb-continuation nil)))
+ (process-send-string proc item)))
+ (if (string-match "\\\\$" string)
+ (setq gdb-continuation (concat gdb-continuation string "\n"))
+ (let ((item (concat gdb-continuation string "\n")))
+ (gdb-enqueue-input item)
+ (setq gdb-continuation nil)))))
;; Note: Stuff enqueued here will be sent to the next prompt, even if it
;; is a query, or other non-top-level prompt.
@@ -1318,7 +1324,8 @@ directives."
It is just like `gdb-stopping', except that if we already set the output
sink to `user' in `gdb-stopping', that is fine."
(setq gud-running nil)
- (unless (or gud-overlay-arrow-position gud-last-frame)
+ (unless (or gud-overlay-arrow-position gud-last-frame
+ (not gud-last-last-frame))
(gud-display-line (car gud-last-last-frame) (cdr gud-last-last-frame)))
(unless (member gdb-inferior-status '("exited" "signal"))
(setq gdb-inferior-status "stopped")
@@ -1680,8 +1687,7 @@ static char *magick[] = {
;; We use different values of grey for different background types,
;; so that on low-color displays it will end up as something visible
;; if it has to be approximated.
- '((((background dark)) :foreground "grey60")
- (((background light)) :foreground "grey40"))
+ '((t :foreground "grey70"))
"Face for disabled breakpoint icon in fringe."
:group 'gud)
@@ -2969,10 +2975,24 @@ BUFFER nil or omitted means use the current buffer."
'gdb-assembler-buffer-name
'gdb-assembler-mode)
-(def-gdb-auto-update-handler gdb-assembler-handler
- gdb-invalidate-assembler
- gdb-assembler-buffer
- gdb-assembler-custom)
+;; We can't use def-gdb-auto-update-handler because we don't want to use
+;; window-start but keep the overlay arrow/current line visible.
+(defun gdb-assembler-handler ()
+ (setq gdb-pending-triggers
+ (delq 'gdb-invalidate-assembler
+ gdb-pending-triggers))
+ (let ((buf (gdb-get-buffer 'gdb-assembler-buffer)))
+ (and buf
+ (with-current-buffer buf
+ (let* ((window (get-buffer-window buf 0))
+ (p (window-point window))
+ (buffer-read-only nil))
+ (erase-buffer)
+ (insert-buffer-substring (gdb-get-buffer-create
+ 'gdb-partial-output-buffer))
+ (set-window-point window p)))))
+ ;; put customisation here
+ (gdb-assembler-custom))
(defun gdb-assembler-custom ()
(let ((buffer (gdb-get-buffer 'gdb-assembler-buffer))
@@ -2987,6 +3007,10 @@ BUFFER nil or omitted means use the current buffer."
(progn
(setq pos (point))
(beginning-of-line)
+ (setq fringe-indicator-alist
+ (if (string-equal gdb-frame-number "0")
+ nil
+ '((overlay-arrow . hollow-right-triangle))))
(or gdb-overlay-arrow-position
(setq gdb-overlay-arrow-position (make-marker)))
(set-marker gdb-overlay-arrow-position
@@ -3114,20 +3138,10 @@ BUFFER nil or omitted means use the current buffer."
(goto-char (point-min))
(if (re-search-forward "Stack level \\([0-9]+\\)" nil t)
(setq gdb-frame-number (match-string 1)))
- (if gud-overlay-arrow-position
- (let ((buffer (marker-buffer gud-overlay-arrow-position))
- (position (marker-position gud-overlay-arrow-position)))
- (when buffer
- (with-current-buffer buffer
- (setq fringe-indicator-alist
- (if (string-equal gdb-frame-number "0")
- nil
- '((overlay-arrow . hollow-right-triangle))))
- (setq gud-overlay-arrow-position (make-marker))
- (set-marker gud-overlay-arrow-position position)))))
(goto-char (point-min))
(if (re-search-forward
- ".*=\\s-+0x0*\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\);? " nil t)
+ ".*=\\s-+0x0*\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\) (\\(\\S-*?\\):[0-9]+?);? "
+ nil t)
(progn
(setq gdb-selected-frame (match-string 2))
(if (gdb-get-buffer 'gdb-locals-buffer)
@@ -3137,6 +3151,16 @@ BUFFER nil or omitted means use the current buffer."
(with-current-buffer (gdb-get-buffer 'gdb-assembler-buffer)
(setq mode-name (concat "Machine:" gdb-selected-frame))))
(setq gdb-frame-address (match-string 1))))
+ (if gud-overlay-arrow-position
+ (let ((buffer (marker-buffer gud-overlay-arrow-position))
+ (position (marker-position gud-overlay-arrow-position)))
+ (when (and buffer (string-equal (buffer-name buffer) (match-string 3)))
+ (with-current-buffer buffer
+ (setq fringe-indicator-alist
+ (if (string-equal gdb-frame-number "0")
+ nil
+ '((overlay-arrow . hollow-right-triangle))))
+ (set-marker gud-overlay-arrow-position position)))))
(goto-char (point-min))
(if (re-search-forward " source language \\(\\S-*\\)\." nil t)
(setq gdb-current-language (match-string 1)))
@@ -3175,8 +3199,8 @@ is set in them."
`(lambda () (gdb-var-list-children-handler-1 ,varnum)))))
(defconst gdb-var-list-children-regexp-1
- "name=\"\\(.+?\\)\",exp=\"\\(.+?\\)\",numchild=\"\\(.+?\\)\",\
-value=\\(\".*?\"\\),type=\"\\(.+?\\)\"}")
+ "child={.*?name=\"\\(.+?\\)\",.*?exp=\"\\(.+?\\)\",.*?\
+numchild=\"\\(.+?\\)\",.*?value=\\(\".*?\"\\),.*?type=\"\\(.+?\\)\".*?}")
(defun gdb-var-list-children-handler-1 (varnum)
(goto-char (point-min))
@@ -3212,7 +3236,8 @@ value=\\(\".*?\"\\),type=\"\\(.+?\\)\"}")
(push 'gdb-var-update gdb-pending-triggers))))
(defconst gdb-var-update-regexp-1
- "name=\"\\(.*?\\)\",\\(?:value=\\(\".*?\"\\),\\)?in_scope=\"\\(.*?\\)\"")
+ "{.*?name=\"\\(.*?\\)\",.*?\\(?:value=\\(\".*?\"\\),\\)?.*?\
+in_scope=\"\\(.*?\\)\".*?}")
(defun gdb-var-update-handler-1 ()
(dolist (var gdb-var-list)
@@ -3249,7 +3274,7 @@ value=\\(\".*?\"\\),type=\"\\(.+?\\)\"}")
gdb-data-list-register-values-handler)
(defconst gdb-data-list-register-values-regexp
- "number=\"\\(.*?\\)\",value=\"\\(.*?\\)\"")
+ "{.*?number=\"\\(.*?\\)\",.*?value=\"\\(.*?\\)\".*?}")
(defun gdb-data-list-register-values-handler ()
(setq gdb-pending-triggers (delq 'gdb-invalidate-registers-1
@@ -3342,7 +3367,7 @@ value=\\(\".*?\"\\),type=\"\\(.+?\\)\"}")
gdb-stack-list-locals-handler)
(defconst gdb-stack-list-locals-regexp
- "name=\"\\(.*?\\)\",type=\"\\(.*?\\)\"")
+ "{.*?name=\"\\(.*?\\)\",.*?type=\"\\(.*?\\)\"")
(defvar gdb-locals-watch-map-1
(let ((map (make-sparse-keymap)))
@@ -3361,7 +3386,7 @@ value=\\(\".*?\"\\),type=\"\\(.+?\\)\"}")
(let ((local (list (match-string 1)
(match-string 2)
nil)))
- (if (looking-at ",value=\\(\".*\"\\)}")
+ (if (looking-at ",value=\\(\".*\"\\).*?}")
(setcar (nthcdr 2 local) (read (match-string 1))))
(push local locals-list)))
(let ((buf (gdb-get-buffer 'gdb-locals-buffer)))