diff lisp/progmodes/gdb-ui.el @ 83531:a387c138b28e

Merged from emacs@sv.gnu.org Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-305 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-306 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-307 Update from CVS: lispref/display.texi (Forcing Redisplay): Fix typo. * emacs@sv.gnu.org/emacs--devo--0--patch-308 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-309 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-310 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-311 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-312 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-313 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-314 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-315 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-316 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-317 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-318 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-319 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-320 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-321 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-322 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-323 lisp/play/cookie1.el (cookie): Work properly when there's only one entry * emacs@sv.gnu.org/emacs--devo--0--patch-324 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-325 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-326 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-327 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-328 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-329 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-330 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-105 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-106 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-107 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-108 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-109 Clean up merge mistakes * emacs@sv.gnu.org/gnus--rel--5.10--patch-110 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-571
author Karoly Lorentey <lorentey@elte.hu>
date Tue, 27 Jun 2006 15:06:36 +0000
parents 46b1096093f5 f723aa5cf2de
children b19aaf4ab0ee
line wrap: on
line diff
--- a/lisp/progmodes/gdb-ui.el	Mon Jun 12 07:27:12 2006 +0000
+++ b/lisp/progmodes/gdb-ui.el	Tue Jun 27 15:06:36 2006 +0000
@@ -76,6 +76,9 @@
 ;; 3) M-x gdb doesn't work with "run" command in .gdbinit, use M-x gdba instead.
 ;; 4) M-x gdb doesn't work if the corefile is specified in the command in the
 ;;    minibuffer, use M-x gdba instead (or specify the core in the GUD buffer).
+;; 5) If you wish to call procedures from your program in GDB
+;;    e.g "call myproc ()", "p mysquare (5)" then use level 2 annotations
+;;    "gdb --annotate=2 myprog" to keep source buffer/selected frame fixed.
 
 ;;; Problems with watch expressions, GDB/MI:
 ;; 1) They go out of scope when the inferior is re-run.
@@ -110,6 +113,7 @@
 where STATUS is nil (unchanged), `changed' or `out-of-scope', FP the frame
 address for root variables.")
 (defvar gdb-main-file nil "Source file from which program execution begins.")
+(defvar gud-old-arrow nil)
 (defvar gdb-overlay-arrow-position nil)
 (defvar gdb-server-prefix nil)
 (defvar gdb-flush-pending-output nil)
@@ -126,6 +130,9 @@
 (defvar gdb-inferior-status nil)
 (defvar gdb-continuation nil)
 (defvar gdb-look-up-stack nil)
+(defvar gdb-frame-begin nil
+  "Non-nil when GDB generates frame-begin annotation.")
+(defvar gdb-printing t)
 
 (defvar gdb-buffer-type nil
   "One of the symbols bound in `gdb-buffer-rules'.")
@@ -543,7 +550,10 @@
 	gdb-source-window nil
 	gdb-inferior-status nil
 	gdb-continuation nil
-	gdb-look-up-stack nil)
+	gdb-look-up-stack nil
+        gdb-frame-begin nil
+	gdb-printing t
+	gud-old-arrow nil)
 
   (setq gdb-buffer-type 'gdba)
 
@@ -1270,6 +1280,7 @@
 This says that I/O for the subprocess is now the program being debugged,
 not GDB."
   (setq gdb-active-process t)
+  (setq gdb-printing t)
   (let ((sink gdb-output-sink))
     (cond
      ((eq sink 'user)
@@ -1278,6 +1289,7 @@
 	(setq gdb-inferior-status "running")
 	(gdb-force-mode-line-update gdb-inferior-status)
 	(gdb-remove-text-properties)
+	(setq gud-old-arrow gud-overlay-arrow-position)
 	(setq gud-overlay-arrow-position nil)
 	(setq gdb-overlay-arrow-position nil)
 	(if gdb-use-separate-io-buffer
@@ -1313,6 +1325,7 @@
   (setq gdb-active-process nil)
   (setq gud-overlay-arrow-position nil)
   (setq gdb-overlay-arrow-position nil)
+  (setq gud-old-arrow nil)
   (setq gdb-inferior-status "exited")
   (gdb-force-mode-line-update gdb-inferior-status)
   (gdb-stopping ignored))
@@ -1321,6 +1334,8 @@
   (setq gdb-signalled t))
 
 (defun gdb-frame-begin (ignored)
+  (setq gdb-frame-begin t)
+  (setq gdb-printing nil)
   (let ((sink gdb-output-sink))
     (cond
      ((eq sink 'inferior)
@@ -1331,25 +1346,33 @@
       (gdb-resync)
       (error "Unexpected frame-begin annotation (%S)" sink)))))
 
+(defcustom gdb-same-frame focus-follows-mouse
+  "Non-nil means pop up GUD buffer in same frame."
+  :group 'gud
+  :type 'boolean
+  :version "22.1")
+
 (defun gdb-stopped (ignored)
   "An annotation handler for `stopped'.
 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)
+    (if (and gdb-frame-begin gdb-printing)
+	(setq gud-overlay-arrow-position gud-old-arrow)
     ;;Pop up GUD buffer to display current frame when it doesn't have source
     ;;information i.e id not compiled with -g as with libc routines generally.
-    (let ((special-display-regexps (append special-display-regexps '(".*")))
-	  (special-display-frame-alist gdb-frame-parameters)
-	  (same-window-regexps nil))
-      (display-buffer gud-comint-buffer))
+    (if gdb-same-frame
+	(gdb-display-gdb-buffer)
+      (gdb-frame-gdb-buffer))
     ;;Try to find source further up stack e.g after signal.
     (setq gdb-look-up-stack
-	  (if (gdb-get-buffer 'gdb-stack-buffer) 'keep
+	  (if (gdb-get-buffer 'gdb-stack-buffer)
+	      'keep
 	    (progn
 	      (gdb-get-buffer-create 'gdb-stack-buffer)
 	      (gdb-invalidate-frames)
-	      'delete))))
+	      'delete)))))
   (unless (member gdb-inferior-status '("exited" "signal"))
     (setq gdb-inferior-status "stopped")
     (gdb-force-mode-line-update gdb-inferior-status))
@@ -2757,7 +2780,9 @@
   "Display GUD buffer in a new frame."
   (interactive)
   (let ((special-display-regexps (append special-display-regexps '(".*")))
-	(special-display-frame-alist gdb-frame-parameters)
+	(special-display-frame-alist
+	 (remove '(menu-bar-lines) (remove '(tool-bar-lines)
+					   gdb-frame-parameters)))
 	(same-window-regexps nil))
     (display-buffer gud-comint-buffer)))
 
@@ -3193,8 +3218,8 @@
     (setq gdb-frame-number (match-string 1))
     (setq gdb-frame-address (match-string 2)))
   (goto-char (point-min))
-  (when (re-search-forward ".*=\\s-+0x0*\\(\\S-*\\)\\s-+in\\s-+\\(\\S-+?\\)\
-\\(?: (\\(\\S-+?\\):[0-9]+?)\\)*;? "
+  (when (re-search-forward ".*=\\s-+0x0*\\(\\S-*\\)\\s-+in\\s-+\\(.*?\\)\
+\\(?: (\\(\\S-+?\\):[0-9]+?)\\)*; "
      nil t)
     (setq gdb-selected-frame (match-string 2))
     (if (gdb-get-buffer 'gdb-locals-buffer)