emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/gdb-ui.el


From: Nick Roberts
Subject: [Emacs-diffs] Changes to emacs/lisp/gdb-ui.el
Date: Tue, 20 May 2003 20:49:46 -0400

Index: emacs/lisp/gdb-ui.el
diff -c emacs/lisp/gdb-ui.el:1.30 emacs/lisp/gdb-ui.el:1.31
*** emacs/lisp/gdb-ui.el:1.30   Sun May 18 18:19:17 2003
--- emacs/lisp/gdb-ui.el        Tue May 20 20:49:46 2003
***************
*** 41,48 ****
  ;; developing the mode itself, then see the Annotations section in the GDB
  ;; info manual.
  ;;
! ;;  Known Bugs: Does not auto-display arrays of structures or structures
! ;;  containing arrays.
  
  ;;; Code:
  
--- 41,49 ----
  ;; developing the mode itself, then see the Annotations section in the GDB
  ;; info manual.
  ;;
! ;;  Known Bugs: 
! ;;  Does not auto-display arrays of structures or structures containing 
arrays. 
! ;;  On MS Windows, GDB from MINGW does not flush the output from the inferior.
  
  ;;; Code:
  
***************
*** 62,67 ****
--- 63,70 ----
  (defvar gdb-previous-address nil)
  (defvar gdb-display-in-progress nil)
  (defvar gdb-dive nil)
+ (defvar gdb-view-source t "Non-nil means that source code can be viewed")
+ (defvar gdb-selected-view 'source "Code type that user wishes to view")
  (defvar gdb-buffer-type nil)
  (defvar gdb-variables '()
    "A list of variables that are local to the GUD buffer.")
***************
*** 158,169 ****
--- 161,176 ----
    (setq gdb-previous-address nil)
    (setq gdb-display-in-progress nil)
    (setq gdb-dive nil)
+   (setq gdb-view-source t)
+   (setq gdb-selected-view 'source)
    ;;
    (mapc 'make-local-variable gdb-variables)
    (setq gdb-buffer-type 'gdba)
    ;;
    (gdb-clear-inferior-io)
    ;;
+   (if (eq window-system 'w32)
+       (gdb-enqueue-input (list "set set new-console off\n" 'ignore)))
    (gdb-enqueue-input (list "set height 0\n" 'ignore))
    ;; find source file and compilation directory here
    (gdb-enqueue-input (list "server list\n" 'ignore))
***************
*** 381,387 ****
    ;; a dummy one.
    (make-comint-in-buffer
     (substring (buffer-name) 1 (- (length (buffer-name)) 1))
!    (current-buffer) "cat")
    (setq comint-input-sender 'gdb-inferior-io-sender))
  
  (defun gdb-inferior-io-sender (proc string)
--- 388,394 ----
    ;; a dummy one.
    (make-comint-in-buffer
     (substring (buffer-name) 1 (- (length (buffer-name)) 1))
!    (current-buffer) "hexl")
    (setq comint-input-sender 'gdb-inferior-io-sender))
  
  (defun gdb-inferior-io-sender (proc string)
***************
*** 561,566 ****
--- 568,574 ----
         (match-string 1 args)
         (string-to-int (match-string 2 args))))
    (setq gdb-current-address (match-string 3 args))
+   (setq gdb-view-source t)
    ;;update with new frame for machine code if necessary
    (gdb-invalidate-assembler))
  
***************
*** 1328,1334 ****
        (with-current-buffer buffer
        (if (and (eq gud-minor-mode 'gdba)
                 (not (string-match "^\*" (buffer-name))))
!           (if (display-graphic-p)
                (remove-images (point-min) (point-max))
              (gdb-remove-strings (point-min) (point-max))))))
      (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)
--- 1336,1342 ----
        (with-current-buffer buffer
        (if (and (eq gud-minor-mode 'gdba)
                 (not (string-match "^\*" (buffer-name))))
!           (if (eq window-system 'x)
                (remove-images (point-min) (point-max))
              (gdb-remove-strings (point-min) (point-max))))))
      (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)
***************
*** 1369,1375 ****
                            (let ((start (progn (beginning-of-line)
                                                (- (point) 1)))
                                  (end (progn (end-of-line) (+ (point) 1))))
!                             (if (display-graphic-p)
                                  (progn
                                    (remove-images start end)
                                    (if (eq ?y flag)
--- 1377,1383 ----
                            (let ((start (progn (beginning-of-line)
                                                (- (point) 1)))
                                  (end (progn (end-of-line) (+ (point) 1))))
!                             (if (eq window-system 'x)
                                  (progn
                                    (remove-images start end)
                                    (if (eq ?y flag)
***************
*** 1382,1389 ****
                                                 'left-margin)))
                                (gdb-remove-strings start end)
                                (if (eq ?y flag)
!                                   (put-string "B" (point))
!                                 (put-string "b" (point))))))))))))
          (end-of-line))))))
  
  (defun gdb-breakpoints-buffer-name ()
--- 1390,1397 ----
                                                 'left-margin)))
                                (gdb-remove-strings start end)
                                (if (eq ?y flag)
!                                   (gdb-put-string "B" (point))
!                                 (gdb-put-string "b" (point))))))))))))
          (end-of-line))))))
  
  (defun gdb-breakpoints-buffer-name ()
***************
*** 1973,1979 ****
    (switch-to-buffer-other-frame
     (gdb-get-create-buffer 'gdba)))
  
! (let ((menu (make-sparse-keymap "GDB-Frames")))
    (define-key gud-menu-map [frames]
      `(menu-item "GDB-Frames" ,menu :visible (eq gud-minor-mode 'gdba)))
    (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer))
--- 1981,1988 ----
    (switch-to-buffer-other-frame
     (gdb-get-create-buffer 'gdba)))
  
! (let ((menu (make-sparse-keymap "GDB-Frames"))
!       (submenu (make-sparse-keymap "View")))
    (define-key gud-menu-map [frames]
      `(menu-item "GDB-Frames" ,menu :visible (eq gud-minor-mode 'gdba)))
    (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer))
***************
*** 1983,1989 ****
    (define-key menu [breakpoints] '("Breakpoints" . 
gdb-frame-breakpoints-buffer))
    (define-key menu [display] '("Display" . gdb-frame-display-buffer))
    (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer))
!   (define-key menu [assembler] '("Assembler" . gdb-frame-assembler-buffer)))
  
  (defvar gdb-main-file nil "Source file from which program execution begins.")
  
--- 1992,2030 ----
    (define-key menu [breakpoints] '("Breakpoints" . 
gdb-frame-breakpoints-buffer))
    (define-key menu [display] '("Display" . gdb-frame-display-buffer))
    (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer))
!   (define-key menu [view] `(menu-item "View" ,submenu))
!   (define-key submenu [source] 
!     '(menu-item "Source" gdb-view-source
!               :help "Display source only"
!               :button (:radio . (eq gdb-selected-view 'source))))
!   (define-key submenu [assembler] 
!     '(menu-item "Assembler" gdb-view-assembler
!               :help "Display assembler only"
!               :button (:radio . (eq gdb-selected-view 'assembler))))
! ;  (define-key submenu [both] 
! ;    '(menu-item "Both" gdb-view-both
! ;             :help "Display both source and assembler"
! ;             :button (:radio . (eq gdb-selected-view 'both))))
! )
! 
! (defun gdb-view-source()
! (interactive)
! (if gdb-view-source
!   (if gud-last-last-frame
!       (set-window-buffer gdb-source-window
!                        (gud-find-file (car gud-last-last-frame)))
!     (set-window-buffer gdb-source-window (gud-find-file gdb-main-file))))
! (setq gdb-selected-view 'source))
! 
! (defun gdb-view-assembler()
! (interactive)
! (set-window-buffer gdb-source-window
!                  (gdb-get-create-buffer 'gdb-assembler-buffer))
! (setq gdb-selected-view 'assembler))
! 
! ;(defun gdb-view-both()
! ;(interactive)
! ;(setq gdb-selected-view 'both))
  
  (defvar gdb-main-file nil "Source file from which program execution begins.")
  
***************
*** 2001,2010 ****
    (other-window 1)
    (switch-to-buffer (gdb-locals-buffer-name))
    (other-window 1)
!   (switch-to-buffer
!    (if gud-last-last-frame
!        (gud-find-file (car gud-last-last-frame))
!      (gud-find-file gdb-main-file)))
    (setq gdb-source-window (get-buffer-window (current-buffer)))
    (split-window-horizontally)
    (other-window 1)
--- 2042,2053 ----
    (other-window 1)
    (switch-to-buffer (gdb-locals-buffer-name))
    (other-window 1)
!   (if gdb-view-source
!       (switch-to-buffer
!        (if gud-last-last-frame
!          (gud-find-file (car gud-last-last-frame))
!        (gud-find-file gdb-main-file)))
!     (switch-to-buffer (gdb-get-create-buffer 'gdb-assembler-buffer)))
    (setq gdb-source-window (get-buffer-window (current-buffer)))
    (split-window-horizontally)
    (other-window 1)
***************
*** 2035,2044 ****
      (delete-other-windows)
      (split-window)
      (other-window 1)
!     (switch-to-buffer
!      (if gud-last-last-frame
!        (gud-find-file (car gud-last-last-frame))
!        (gud-find-file gdb-main-file)))
      (other-window 1)))
  
  (defun gdb-reset ()
--- 2078,2089 ----
      (delete-other-windows)
      (split-window)
      (other-window 1)
!     (if gdb-view-source
!       (switch-to-buffer
!        (if gud-last-last-frame
!            (gud-find-file (car gud-last-last-frame))
!          (gud-find-file gdb-main-file)))
!       (switch-to-buffer (gdb-get-create-buffer 'gdb-assembler-buffer)))
      (other-window 1)))
  
  (defun gdb-reset ()
***************
*** 2051,2057 ****
          (if (eq gud-minor-mode 'gdba)
              (if (string-match "^\*.+*$" (buffer-name))
                  (kill-buffer nil)
!               (if (display-graphic-p)
                    (remove-images (point-min) (point-max))
                  (gdb-remove-strings (point-min) (point-max)))
                (setq left-margin-width 0)
--- 2096,2102 ----
          (if (eq gud-minor-mode 'gdba)
              (if (string-match "^\*.+*$" (buffer-name))
                  (kill-buffer nil)
!               (if (eq window-system 'x)
                    (remove-images (point-min) (point-max))
                  (gdb-remove-strings (point-min) (point-max)))
                (setq left-margin-width 0)
***************
*** 2201,2217 ****
        (if (not (equal gdb-current-address "main"))
          (progn
            (gdb-remove-arrow)
!           (save-selected-window
!             (select-window gdb-source-window)
!             (goto-char (point-min))
!             (if (re-search-forward gdb-current-address nil t)
!                 (gdb-put-arrow "=>" (point))))))
        ;; remove all breakpoint-icons in assembler buffer before updating.
!       (save-excursion
!       (if (display-graphic-p)
!           (remove-images (point-min) (point-max))
!         (gdb-remove-strings (point-min) (point-max))))
!       (set-buffer (gdb-get-buffer 'gdb-breakpoints-buffer))
        (goto-char (point-min))
        (while (< (point) (- (point-max) 1))
        (forward-line 1)
--- 2246,2259 ----
        (if (not (equal gdb-current-address "main"))
          (progn
            (gdb-remove-arrow)
!           (goto-char (point-min))
!           (if (re-search-forward gdb-current-address nil t)
!               (gdb-put-arrow "=>" (point)))))
        ;; remove all breakpoint-icons in assembler buffer before updating.
!       (if (eq window-system 'x)
!         (remove-images (point-min) (point-max))
!       (gdb-remove-strings (point-min) (point-max))))
!     (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)
        (goto-char (point-min))
        (while (< (point) (- (point-max) 1))
        (forward-line 1)
***************
*** 2220,2237 ****
              (looking-at
               "[0-9]*\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)\\s-*0x\\(\\S-*\\)")
              (setq flag (char-after (match-beginning 1)))
!             (let ((number (match-string 2)))
!               ;; remove leading 0s from output of info break.
!               (if (string-match "0x0+\\(.*\\)" number)
!                   (setq address (concat "0x" (match-string 1 address)))
!                 (setq address number)))
              (with-current-buffer buffer
-               (save-excursion
                  (goto-char (point-min))
                  (if (re-search-forward address nil t)
                      (let ((start (progn (beginning-of-line) (- (point) 1)))
                            (end (progn (end-of-line) (+ (point) 1))))
!                       (if (display-graphic-p)
                            (progn
                              (remove-images start end)
                              (if (eq ?y flag)
--- 2262,2277 ----
              (looking-at
               "[0-9]*\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)\\s-*0x\\(\\S-*\\)")
              (setq flag (char-after (match-beginning 1)))
!             (setq address (match-string 2))
!             ;; remove leading 0s from output of info break.
!             (if (string-match "0+\\(.*\\)" address)
!                 (setq address (match-string 1 address)))
              (with-current-buffer buffer
                  (goto-char (point-min))
                  (if (re-search-forward address nil t)
                      (let ((start (progn (beginning-of-line) (- (point) 1)))
                            (end (progn (end-of-line) (+ (point) 1))))
!                       (if (eq window-system 'x)
                            (progn
                              (remove-images start end)
                              (if (eq ?y flag)
***************
*** 2243,2250 ****
                                           'left-margin)))
                          (gdb-remove-strings start end)
                          (if (eq ?y flag)
!                             (put-string "B" (point))
!                           (put-string "b" (point))))))))))))))
  
  (defvar gdb-assembler-mode-map
    (let ((map (make-sparse-keymap)))
--- 2283,2290 ----
                                           'left-margin)))
                          (gdb-remove-strings start end)
                          (if (eq ?y flag)
!                             (gdb-put-string "B" (point))
!                           (gdb-put-string "b" (point)))))))))))))
  
  (defvar gdb-assembler-mode-map
    (let ((map (make-sparse-keymap)))
***************
*** 2320,2333 ****
          (let ((address (match-string 1)))
            ;; remove leading 0s from output of frame command.
            (if (string-match "0x0+\\(.*\\)" address)
!               (setq gdb-current-address (concat "0x" (match-string 1 
address)))
              (setq gdb-current-address address)))
!         (if (not (looking-at ".*) at "))
              (progn
!               (set-window-buffer gdb-source-window
!                                  (gdb-get-create-buffer 
'gdb-assembler-buffer))
                (gdb-invalidate-assembler))))
!       (if (looking-at "^#[0-9]*\\s-*\\(\\S-*\\)")
          (setq gdb-current-frame (match-string 1))))))
  
  (provide 'gdb-ui)
--- 2360,2377 ----
          (let ((address (match-string 1)))
            ;; remove leading 0s from output of frame command.
            (if (string-match "0x0+\\(.*\\)" address)
!               (setq gdb-current-address 
!                     (concat "0x" (match-string 1 address)))
              (setq gdb-current-address address)))
!         (if (or (if (not (looking-at ".*) at "))
!                     (progn (setq gdb-view-source nil) t))
!                 (eq gdb-selected-view 'assembler))
              (progn
!               (set-window-buffer 
!                gdb-source-window
!                (gdb-get-create-buffer 'gdb-assembler-buffer))
                (gdb-invalidate-assembler))))
!       (if (looking-at "^#0\\s-*\\(\\S-*\\)")
          (setq gdb-current-frame (match-string 1))))))
  
  (provide 'gdb-ui)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]