changeset 69910:e6d430f1cde3

(gdb-init-1): Re-initialise gdb-main-file to nil. (gdb-get-version): Make it work for pre "interpreter mi" (GDB 5.3?). (gdb-setup-windows): Put something in source window if we can't find the source file. (gdb-frame-handler): Make it work again with just assembly. (gdb-data-list-register-values-handler): Make it work when there is no stack.
author Nick Roberts <nickrob@snap.net.nz>
date Mon, 10 Apr 2006 09:18:11 +0000
parents 2ce7c1a8454c
children d7af35bb9874
files lisp/progmodes/gdb-ui.el
diffstat 1 files changed, 27 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/gdb-ui.el	Mon Apr 10 09:16:42 2006 +0000
+++ b/lisp/progmodes/gdb-ui.el	Mon Apr 10 09:18:11 2006 +0000
@@ -524,6 +524,7 @@
 	gdb-frame-number nil
 	gdb-var-list nil
 	gdb-force-update t
+	gdb-main-file nil
 	gdb-first-post-prompt t
 	gdb-prompting nil
 	gdb-input-queue nil
@@ -580,8 +581,7 @@
 
 (defun gdb-get-version ()
   (goto-char (point-min))
-  (if (and (re-search-forward gdb-error-regexp nil t)
-	   (string-match ".*(missing implementation)" (match-string 1)))
+  (if (re-search-forward "Undefined\\( mi\\)* command:" nil t)
       (setq gdb-version "pre-6.4")
     (setq gdb-version "6.4+"))
   (gdb-init-2))
@@ -2746,7 +2746,11 @@
   (switch-to-buffer
        (if gud-last-last-frame
 	   (gud-find-file (car gud-last-last-frame))
-	 (gud-find-file gdb-main-file)))
+	 (if gdb-main-file
+	     (gud-find-file gdb-main-file)
+	   ;; Put buffer list in window if we
+	   ;; can't find a source file.
+	   (list-buffers-noselect))))
   (when gdb-use-separate-io-buffer
     (split-window-horizontally)
     (other-window 1)
@@ -3139,19 +3143,18 @@
   (if (re-search-forward  "Stack level \\([0-9]+\\)" nil t)
       (setq gdb-frame-number (match-string 1)))
   (goto-char (point-min))
-  (if (re-search-forward
-    ".*=\\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)
-	    (with-current-buffer (gdb-get-buffer 'gdb-locals-buffer)
-	      (setq mode-name (concat "Locals:" gdb-selected-frame))))
-	(if (gdb-get-buffer 'gdb-assembler-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
+  (when (re-search-forward ".*=\\s-+0x0*\\(\\S-*\\)\\s-+in\\s-+\\(\\S-+?\\)\
+\\(?: (\\(\\S-+?\\):[0-9]+?)\\)*;? "
+     nil t)
+    (setq gdb-selected-frame (match-string 2))
+    (if (gdb-get-buffer 'gdb-locals-buffer)
+	(with-current-buffer (gdb-get-buffer 'gdb-locals-buffer)
+	  (setq mode-name (concat "Locals:" gdb-selected-frame))))
+    (if (gdb-get-buffer 'gdb-assembler-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 (and (match-string 3) 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)))
@@ -3160,9 +3163,9 @@
 		  (if (string-equal gdb-frame-number "0")
 		      nil
 		    '((overlay-arrow . hollow-right-triangle))))
-	    (set-marker gud-overlay-arrow-position position)))))
+	    (set-marker gud-overlay-arrow-position position))))))
   (goto-char (point-min))
-  (if (re-search-forward " source language \\(\\S-*\\)\." nil t)
+  (if (re-search-forward " source language \\(\\S-+\\)\." nil t)
       (setq gdb-current-language (match-string 1)))
   (gdb-invalidate-assembler))
 
@@ -3281,11 +3284,12 @@
 				   gdb-pending-triggers))
   (goto-char (point-min))
   (if (re-search-forward gdb-error-regexp nil t)
-      (with-current-buffer (gdb-get-buffer 'gdb-registers-buffer)
-	(let ((buffer-read-only nil))
-	  (erase-buffer)
-	  (insert (match-string 1))
-	  (goto-char (point-min))))
+      (let ((err (match-string 1)))
+	(with-current-buffer (gdb-get-buffer 'gdb-registers-buffer)
+	  (let ((buffer-read-only nil))
+	    (erase-buffer)
+	    (insert err)
+	    (goto-char (point-min)))))
     (let ((register-list (reverse gdb-register-names))
 	  (register nil) (register-string nil) (register-values nil))
       (goto-char (point-min))