]> code.delx.au - gnu-emacs/commitdiff
(gdb-ann3): Move definition of gud-pp to here.
authorNick Roberts <nickrob@snap.net.nz>
Fri, 18 Nov 2005 02:47:21 +0000 (02:47 +0000)
committerNick Roberts <nickrob@snap.net.nz>
Fri, 18 Nov 2005 02:47:21 +0000 (02:47 +0000)
Make it work in the speedbar.
(gdb-find-watch-expression): New function.

lisp/progmodes/gdb-ui.el

index f8f80ce6f661a6e836782e2daeaeadd6ec234873..92265dd46da833b1d30f65ed59b416f6146020bf 100644 (file)
@@ -337,6 +337,15 @@ With arg, use separate IO iff arg is positive."
                         (file-name-nondirectory file) ":1\n")
                 `(lambda () (gdb-set-gud-minor-mode ,buffer)))))))))
 
+(defun gdb-find-watch-expression ()
+  (let* ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list))
+        (varno (nth 1 var)) (expr))
+    (string-match "\\(var[0-9]+\\)\\.\\(.*\\)" varno)
+    (dolist (var1 gdb-var-list)
+      (if (string-equal (nth 1 var1) (match-string 1 varno))
+         (setq expr (concat (car var1) "." (match-string 2 varno)))))
+    expr))
+
 (defun gdb-ann3 ()
   (setq gdb-debug-log nil)
   (set (make-local-variable 'gud-minor-mode) 'gdba)
@@ -369,6 +378,15 @@ With arg, use separate IO iff arg is positive."
   (gud-def gud-go (gud-call (if gdb-active-process "continue" "run") arg)
           nil "Start or continue execution.")
 
+  ;; For debugging Emacs only.
+  (gud-def gud-pp
+          (gud-call
+           (concat
+            "pp1 " (if (eq (buffer-local-value
+                            'major-mode (window-buffer)) 'speedbar-mode)
+                       (gdb-find-watch-expression) "%e")) arg)
+          nil   "Print the emacs s-expression.")
+
   (define-key gud-minor-mode-map [left-margin mouse-1]
     'gdb-mouse-set-clear-breakpoint)
   (define-key gud-minor-mode-map [left-fringe mouse-1]