]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/gdb-ui.el
(flymake-find-possible-master-files, flymake-master-file-compare,
[gnu-emacs] / lisp / progmodes / gdb-ui.el
index 7e2022cc11cd98b9839a3e45426affc0c0ac8b56..7653ff90a2f89fc194ede7ba1d1341edba0f1191 100644 (file)
@@ -85,6 +85,7 @@
 (defvar gdb-find-file-unhook nil)
 (defvar gdb-active-process nil "GUD tooltips display variable values when t, \
 and #define directives otherwise.")
+(defvar gdb-error "Non-nil when GDB is reporting an error.")
 (defvar gdb-macro-info nil
   "Non-nil if GDB knows that the inferior includes preprocessor macro info.")
 
@@ -250,7 +251,7 @@ Also display the main routine in the disassembly buffer if present."
      (let ((string (buffer-string)))
        ;; remove newline for gud-tooltip-echo-area
        (substring string 0 (- (length string) 1))))
-   gud-tooltip-echo-area))
+   (or gud-tooltip-echo-area tooltip-use-echo-area)))
 
 ;; If expr is a macro for a function don't print because of possible dangerous
 ;; side-effects. Also printing a function within a tooltip generates an
@@ -359,6 +360,7 @@ Also display the main routine in the disassembly buffer if present."
        gdb-flush-pending-output nil
        gdb-location-alist nil
        gdb-find-file-unhook nil
+       gdb-error nil
        gdb-macro-info nil)
   ;;
   (setq gdb-buffer-type 'gdba)
@@ -430,7 +432,7 @@ Also display the main routine in the disassembly buffer if present."
            (setq gdb-var-changed t)))
       (if (re-search-forward "Undefined command" nil t)
          (message-box "Watching expressions requires gdb 6.0 onwards")
-       (message "No symbol %s in current context." expr)))))
+       (message "No symbol \"%s\" in current context." expr)))))
 
 (defun gdb-var-evaluate-expression-handler (varnum changed)
   (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
@@ -774,6 +776,8 @@ The key should be one of the cars in `gdb-buffer-rules-assoc'."
 (defun gdb-send (proc string)
   "A comint send filter for gdb.
 This filter may simply queue input for a later time."
+  (with-current-buffer gud-comint-buffer
+    (remove-text-properties (point-min) (point-max) '(face)))
   (let ((item (concat string "\n")))
     (if gud-running
       (progn
@@ -860,6 +864,8 @@ This filter may simply queue input for a later time."
     ("watchpoint" gdb-stopping)
     ("frame-begin" gdb-frame-begin)
     ("stopped" gdb-stopped)
+    ("error-begin" gdb-error)
+    ("error" gdb-error)
     ) "An assoc mapping annotation tags to functions which process them.")
 
 (defun gdb-resync()
@@ -989,29 +995,32 @@ sink to `user' in `gdb-stopping', that is fine."
       (gdb-resync)
       (error "Unexpected stopped annotation")))))
 
+(defun gdb-error (ignored)
+  (setq gdb-error (not gdb-error)))
+
 (defun gdb-post-prompt (ignored)
   "An annotation handler for `post-prompt'.
 This begins the collection of output from the current command if that
 happens to be appropriate."
   (unless gdb-pending-triggers
-       (gdb-get-selected-frame)
-       (gdb-invalidate-frames)
-       (gdb-invalidate-breakpoints)
-       ;; Do this through gdb-get-selected-frame -> gdb-frame-handler
-       ;; so gdb-frame-address is updated.
-       ;; (gdb-invalidate-assembler)
-       (gdb-invalidate-registers)
-       (gdb-invalidate-memory)
-       (gdb-invalidate-locals)
-       (gdb-invalidate-threads)
-       (unless (eq system-type 'darwin) ;Breaks on Darwin's GDB-5.3.
-         ;; FIXME: with GDB-6 on Darwin, this might very well work.
-         ;; only needed/used with speedbar/watch expressions
-         (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
-           (setq gdb-var-changed t)    ; force update
-           (dolist (var gdb-var-list)
-             (setcar (nthcdr 5 var) nil))
-           (gdb-var-update))))
+    (gdb-get-selected-frame)
+    (gdb-invalidate-frames)
+    (gdb-invalidate-breakpoints)
+    ;; Do this through gdb-get-selected-frame -> gdb-frame-handler
+    ;; so gdb-frame-address is updated.
+    ;; (gdb-invalidate-assembler)
+    (gdb-invalidate-registers)
+    (gdb-invalidate-memory)
+    (gdb-invalidate-locals)
+    (gdb-invalidate-threads)
+    (unless (eq system-type 'darwin) ;Breaks on Darwin's GDB-5.3.
+      ;; FIXME: with GDB-6 on Darwin, this might very well work.
+      ;; only needed/used with speedbar/watch expressions
+      (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
+       (setq gdb-var-changed t)    ; force update
+       (dolist (var gdb-var-list)
+         (setcar (nthcdr 5 var) nil))
+       (gdb-var-update))))
   (let ((sink gdb-output-sink))
     (cond
      ((eq sink 'user) t)
@@ -1083,6 +1092,8 @@ happens to be appropriate."
       output)))
 
 (defun gdb-concat-output (so-far new)
+  (if gdb-error
+      (put-text-property 0 (length new) 'face font-lock-warning-face new))
   (let ((sink gdb-output-sink))
     (cond
      ((eq sink 'user) (concat so-far new))
@@ -1695,7 +1706,9 @@ static char *magick[] = {
   (setq buffer-read-only t)
   (use-local-map gdb-registers-mode-map)
   (run-mode-hooks 'gdb-registers-mode-hook)
-  'gdb-invalidate-registers)
+  (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))
+      'gdb-invalidate-registers
+    'gdbmi-invalidate-registers))
 
 (defun gdb-registers-buffer-name ()
   (with-current-buffer gud-comint-buffer
@@ -2172,18 +2185,18 @@ corresponding to the mode line clicked."
 (let ((menu (make-sparse-keymap "GDB-UI")))
   (define-key gud-menu-map [ui]
     `(menu-item "GDB-UI" ,menu :visible (eq gud-minor-mode 'gdba)))
-  (define-key menu [gdb-restore-windows]
-  '(menu-item "Restore Window Layout" gdb-restore-windows
-             :help "Restore standard layout for debug session."))
-  (define-key menu [gdb-many-windows]
-  '(menu-item "Display Other Windows" gdb-many-windows
-             :help "Toggle display of locals, stack and breakpoint information"
-             :button (:toggle . gdb-many-windows)))
   (define-key menu [gdb-use-inferior-io]
     (menu-bar-make-toggle toggle-gdb-use-inferior-io-buffer
                          gdb-use-inferior-io-buffer
      "Separate inferior IO" "Use separate IO %s"
-     "Toggle separate IO for inferior.")))
+     "Toggle separate IO for inferior."))
+  (define-key menu [gdb-many-windows]
+  '(menu-item "Display Other Windows" gdb-many-windows
+             :help "Toggle display of locals, stack and breakpoint information"
+             :button (:toggle . gdb-many-windows)))
+  (define-key menu [gdb-restore-windows]
+  '(menu-item "Restore Window Layout" gdb-restore-windows
+             :help "Restore standard layout for debug session.")))
 
 (defadvice toggle-gdb-use-inferior-io-buffer (after gdb-kill-io-buffer activate)
   (unless gdb-use-inferior-io-buffer