/[emacs]/emacs/lisp/gdb-ui.el
ViewVC logotype

Diff of /emacs/lisp/gdb-ui.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.34 by nickrob, Sun May 25 16:51:34 2003 UTC revision 1.35 by nickrob, Sun Jun 8 01:20:51 2003 UTC
# Line 31  Line 31 
31  ;; It separates the input/output of your program from that of GDB and displays  ;; It separates the input/output of your program from that of GDB and displays
32  ;; expressions and their current values in their own buffers. It also uses  ;; expressions and their current values in their own buffers. It also uses
33  ;; features of Emacs 21 such as the display margin for breakpoints, and the  ;; features of Emacs 21 such as the display margin for breakpoints, and the
34  ;; toolbar (see the GDB User Interface section in the Emacs info manual).  ;; toolbar (see the GDB Graphical Interface section in the Emacs info manual).
35    
36  ;; Start the debugger with M-x gdba.  ;; Start the debugger with M-x gdba.
37    
# Line 62  Line 62 
62    
63  (defvar gdb-current-address nil "Initialisation for Assembler buffer.")  (defvar gdb-current-address nil "Initialisation for Assembler buffer.")
64  (defvar gdb-previous-address nil)  (defvar gdb-previous-address nil)
65    (defvar gdb-previous-frame nil)
66  (defvar gdb-display-in-progress nil)  (defvar gdb-display-in-progress nil)
67  (defvar gdb-dive nil)  (defvar gdb-dive nil)
68  (defvar gdb-view-source t "Non-nil means that source code can be viewed")  (defvar gdb-view-source t "Non-nil means that source code can be viewed")
# Line 160  The following interactive lisp functions Line 161  The following interactive lisp functions
161    ;; (re-)initialise    ;; (re-)initialise
162    (setq gdb-current-address "main")    (setq gdb-current-address "main")
163    (setq gdb-previous-address nil)    (setq gdb-previous-address nil)
164      (setq gdb-previous-frame nil)
165    (setq gdb-display-in-progress nil)    (setq gdb-display-in-progress nil)
166    (setq gdb-dive nil)    (setq gdb-dive nil)
167    (setq gdb-view-source t)    (setq gdb-view-source t)
# Line 1162  output from the current command if that Line 1164  output from the current command if that
1164      (goto-char (point-max))      (goto-char (point-max))
1165      (insert-before-markers string))      (insert-before-markers string))
1166    (if (not (string-equal string ""))    (if (not (string-equal string ""))
1167        (select-window        (gdb-display-buffer (gdb-get-create-buffer 'gdb-inferior-io))))
         (gdb-display-buffer (gdb-get-create-buffer 'gdb-inferior-io)))))  
1168    
1169  (defun gdb-clear-inferior-io ()  (defun gdb-clear-inferior-io ()
1170    (with-current-buffer (gdb-get-create-buffer 'gdb-inferior-io)    (with-current-buffer (gdb-get-create-buffer 'gdb-inferior-io)
# Line 2316  BUFFER nil or omitted means use the curr Line 2317  BUFFER nil or omitted means use the curr
2317                (setq flag (char-after (match-beginning 1)))                (setq flag (char-after (match-beginning 1)))
2318                (setq address (match-string 2))                (setq address (match-string 2))
2319                ;; remove leading 0s from output of info break.                ;; remove leading 0s from output of info break.
2320                (if (string-match "0+\\(.*\\)" address)                (if (string-match "^0+\\(.*\\)" address)
2321                    (setq address (match-string 1 address)))                    (setq address (match-string 1 address)))
2322                (with-current-buffer buffer                (with-current-buffer buffer
2323                    (goto-char (point-min))                    (goto-char (point-min))
# Line 2375  BUFFER nil or omitted means use the curr Line 2376  BUFFER nil or omitted means use the curr
2376  ;; modified because if gdb-current-address has changed value a new command  ;; modified because if gdb-current-address has changed value a new command
2377  ;; must be enqueued to update the buffer with the new output  ;; must be enqueued to update the buffer with the new output
2378  (defun gdb-invalidate-assembler (&optional ignored)  (defun gdb-invalidate-assembler (&optional ignored)
2379    (if (and (gdb-get-buffer 'gdb-assembler-buffer)    (if (gdb-get-buffer 'gdb-assembler-buffer)
            (or (not (member 'gdb-invalidate-assembler  
                             (gdb-get-pending-triggers)))  
                (not (string-equal gdb-current-address gdb-previous-address))))  
2380        (progn        (progn
2381          ;; take previous disassemble command off the queue          (if (string-equal gdb-current-frame gdb-previous-frame)
2382          (with-current-buffer gud-comint-buffer              (gdb-assembler-custom)
2383            (let ((queue (gdb-get-idle-input-queue)) (item))            (if (or (not (member 'gdb-invalidate-assembler
2384              (dolist (item queue)                                 (gdb-get-pending-triggers)))
2385                (if (equal (cdr item) '(gdb-assembler-handler))                    (not (string-equal gdb-current-address
2386                    (gdb-set-idle-input-queue                                       gdb-previous-address)))
2387                     (delete item (gdb-get-idle-input-queue)))))))            (progn
2388          (gdb-enqueue-idle-input              ;; take previous disassemble command off the queue
2389           (list (concat "server disassemble " gdb-current-address "\n")              (with-current-buffer gud-comint-buffer
2390                 'gdb-assembler-handler))                (let ((queue (gdb-get-idle-input-queue)) (item))
2391          (gdb-set-pending-triggers                  (dolist (item queue)
2392           (cons 'gdb-invalidate-assembler                    (if (equal (cdr item) '(gdb-assembler-handler))
2393                 (gdb-get-pending-triggers)))                        (gdb-set-idle-input-queue
2394          (setq gdb-previous-address gdb-current-address))))                         (delete item (gdb-get-idle-input-queue)))))))
2395                (gdb-enqueue-idle-input
2396                 (list (concat "server disassemble " gdb-current-address "\n")
2397                       'gdb-assembler-handler))
2398                (gdb-set-pending-triggers
2399                 (cons 'gdb-invalidate-assembler
2400                       (gdb-get-pending-triggers)))
2401                (setq gdb-previous-address gdb-current-address)
2402                (setq gdb-previous-frame gdb-current-frame)))))))
2403    
2404  (defun gdb-get-current-frame ()  (defun gdb-get-current-frame ()
2405    (if (not (member 'gdb-get-current-frame (gdb-get-pending-triggers)))    (if (not (member 'gdb-get-current-frame (gdb-get-pending-triggers)))
2406        (progn        (progn
2407          (gdb-enqueue-idle-input          (gdb-enqueue-idle-input
2408           (list (concat "server frame\n") 'gdb-frame-handler))           (list (concat "server info frame\n") 'gdb-frame-handler))
2409          (gdb-set-pending-triggers          (gdb-set-pending-triggers
2410           (cons 'gdb-get-current-frame           (cons 'gdb-get-current-frame
2411                 (gdb-get-pending-triggers))))))                 (gdb-get-pending-triggers))))))
# Line 2409  BUFFER nil or omitted means use the curr Line 2415  BUFFER nil or omitted means use the curr
2415     (delq 'gdb-get-current-frame (gdb-get-pending-triggers)))     (delq 'gdb-get-current-frame (gdb-get-pending-triggers)))
2416    (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)    (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
2417      (goto-char (point-min))      (goto-char (point-min))
2418      (if (looking-at "^#[0-9]*\\s-*\\(\\S-*\\) in \\(\\S-*\\)")      (forward-line)
2419        (if (looking-at ".*= 0x\\(\\S-*\\) in \\(\\S-*\\)")
2420          (progn          (progn
2421            (setq gdb-current-frame (match-string 2))            (setq gdb-current-frame (match-string 2))
2422            (let ((address (match-string 1)))            (let ((address (match-string 1)))
2423              ;; remove leading 0s from output of frame command.              ;; remove leading 0s from output of info frame command.
2424              (if (string-match "0x0+\\(.*\\)" address)              (if (string-match "^0+\\(.*\\)" address)
2425                  (setq gdb-current-address                  (setq gdb-current-address
2426                        (concat "0x" (match-string 1 address)))                        (concat "0x" (match-string 1 address)))
2427                (setq gdb-current-address address)))                (setq gdb-current-address (concat "0x" address))))
2428            (if (or (if (not (looking-at ".*) at "))            (if (or (if (not (looking-at ".*(\\S-*:[0-9]*)"))
2429                        (progn (setq gdb-view-source nil) t))                        (progn (setq gdb-view-source nil) t))
2430                    (eq gdb-selected-view 'assembler))                    (eq gdb-selected-view 'assembler))
2431                (progn                (progn
2432                  (set-window-buffer                  (set-window-buffer
2433                   gdb-source-window                   gdb-source-window
2434                   (gdb-get-create-buffer 'gdb-assembler-buffer))                   (gdb-get-create-buffer 'gdb-assembler-buffer))
2435                  (gdb-invalidate-assembler))))                  (gdb-invalidate-assembler)))))))
       (if (looking-at "^#0\\s-*\\(\\S-*\\)")  
           (setq gdb-current-frame (match-string 1))))))  
2436    
2437  (provide 'gdb-ui)  (provide 'gdb-ui)
2438    

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.35

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26