comparison lisp/progmodes/gud.el @ 55750:3a482d346abb

(gud-menu-map, gud-speedbar-menu-items) (gud-speedbar-buttons, gud-sentinel, gud-display-line) (gud-basic-call): Handle new value for gud-minor-mode (gdbmi) for a new mode. The file (gdb-mi.el) for this mode will be included with the GDB distribution (6.2 onwards) and will use GDB/MI as its primary interface.
author Nick Roberts <nickrob@snap.net.nz>
date Sun, 23 May 2004 20:29:44 +0000
parents 83b3b9e4e001
children 6205fd61e464 4c90ffeb71c5
comparison
equal deleted inserted replaced
55749:230865f1c59d 55750:3a482d346abb
91 "Non-nil if debuggee is running. 91 "Non-nil if debuggee is running.
92 Used to grey out relevant toolbar icons.") 92 Used to grey out relevant toolbar icons.")
93 93
94 (easy-mmode-defmap gud-menu-map 94 (easy-mmode-defmap gud-menu-map
95 '(([help] menu-item "Help" gdb-goto-info 95 '(([help] menu-item "Help" gdb-goto-info
96 :enable (eq gud-minor-mode 'gdba)) 96 :enable (memq gud-minor-mode '(gdbmi gdba)))
97 ([refresh] "Refresh" . gud-refresh) 97 ([refresh] "Refresh" . gud-refresh)
98 ([run] menu-item "Run" gud-run 98 ([run] menu-item "Run" gud-run
99 :enable (and (not gud-running) 99 :enable (and (not gud-running)
100 (memq gud-minor-mode '(gdba gdb dbx jdb)))) 100 (memq gud-minor-mode '(gdbmi gdba gdb dbx jdb))))
101 ([until] menu-item "Continue to selection" gud-until 101 ([until] menu-item "Continue to selection" gud-until
102 :enable (and (not gud-running) 102 :enable (and (not gud-running)
103 (memq gud-minor-mode '(gdba gdb perldb)))) 103 (memq gud-minor-mode '(gdbmi gdba gdb perldb))))
104 ([remove] menu-item "Remove Breakpoint" gud-remove 104 ([remove] menu-item "Remove Breakpoint" gud-remove
105 :enable (not gud-running)) 105 :enable (not gud-running))
106 ([tbreak] menu-item "Temporary Breakpoint" gud-tbreak 106 ([tbreak] menu-item "Temporary Breakpoint" gud-tbreak
107 :enable (memq gud-minor-mode '(gdba gdb sdb xdb bashdb))) 107 :enable (memq gud-minor-mode '(gdbmi gdba gdb sdb xdb bashdb)))
108 ([break] menu-item "Set Breakpoint" gud-break 108 ([break] menu-item "Set Breakpoint" gud-break
109 :enable (not gud-running)) 109 :enable (not gud-running))
110 ([up] menu-item "Up Stack" gud-up 110 ([up] menu-item "Up Stack" gud-up
111 :enable (and (not gud-running) 111 :enable (and (not gud-running)
112 (memq gud-minor-mode 112 (memq gud-minor-mode
113 '(gdba gdb dbx xdb jdb pdb bashdb)))) 113 '(gdbmi gdba gdb dbx xdb jdb pdb bashdb))))
114 ([down] menu-item "Down Stack" gud-down 114 ([down] menu-item "Down Stack" gud-down
115 :enable (and (not gud-running) 115 :enable (and (not gud-running)
116 (memq gud-minor-mode 116 (memq gud-minor-mode
117 '(gdba gdb dbx xdb jdb pdb bashdb)))) 117 '(gdbmi gdba gdb dbx xdb jdb pdb bashdb))))
118 ([print] menu-item "Print Expression" gud-print 118 ([print] menu-item "Print Expression" gud-print
119 :enable (not gud-running)) 119 :enable (not gud-running))
120 ([watch] menu-item "Watch Expression" gud-watch 120 ([watch] menu-item "Watch Expression" gud-watch
121 :enable (and (not gud-running) (eq gud-minor-mode 'gdba))) 121 :enable (and (not gud-running)
122 (memq gud-minor-mode '(gdbmi gdba))))
122 ([finish] menu-item "Finish Function" gud-finish 123 ([finish] menu-item "Finish Function" gud-finish
123 :enable (and (not gud-running) 124 :enable (and (not gud-running)
124 (memq gud-minor-mode 125 (memq gud-minor-mode
125 '(gdba gdb xdb jdb pdb bashdb)))) 126 '(gdbmi gdba gdb xdb jdb pdb bashdb))))
126 ([stepi] menu-item "Step Instruction" gud-stepi 127 ([stepi] menu-item "Step Instruction" gud-stepi
127 :enable (and (not gud-running) 128 :enable (and (not gud-running)
128 (memq gud-minor-mode '(gdba gdb dbx)))) 129 (memq gud-minor-mode '(gdbmi gdba gdb dbx))))
129 ([nexti] menu-item "Next Instruction" gud-nexti 130 ([nexti] menu-item "Next Instruction" gud-nexti
130 :enable (and (not gud-running) 131 :enable (and (not gud-running)
131 (memq gud-minor-mode '(gdba gdb dbx)))) 132 (memq gud-minor-mode '(gdbmi gdba gdb dbx))))
132 ([step] menu-item "Step Line" gud-step 133 ([step] menu-item "Step Line" gud-step
133 :enable (not gud-running)) 134 :enable (not gud-running))
134 ([next] menu-item "Next Line" gud-next 135 ([next] menu-item "Next Line" gud-next
135 :enable (not gud-running)) 136 :enable (not gud-running))
136 ([cont] menu-item "Continue" gud-cont 137 ([cont] menu-item "Continue" gud-cont
310 311
311 312
312 (defvar gud-speedbar-menu-items 313 (defvar gud-speedbar-menu-items
313 ;; Note to self. Add expand, and turn off items when not available. 314 ;; Note to self. Add expand, and turn off items when not available.
314 '(["Jump to stack frame" speedbar-edit-line 315 '(["Jump to stack frame" speedbar-edit-line
315 (with-current-buffer gud-comint-buffer (not (eq gud-minor-mode 'gdba)))] 316 (with-current-buffer gud-comint-buffer
317 (not (memq gud-minor-mode '(gdbmi gdba))))]
316 ["Edit value" speedbar-edit-line 318 ["Edit value" speedbar-edit-line
317 (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))] 319 (with-current-buffer gud-comint-buffer
320 (not (memq gud-minor-mode '(gdbmi gdba))))]
318 ["Delete expression" gdb-var-delete 321 ["Delete expression" gdb-var-delete
319 (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))]) 322 (with-current-buffer gud-comint-buffer
323 (not (memq gud-minor-mode '(gdbmi gdba))))])
320 "Additional menu items to add to the speedbar frame.") 324 "Additional menu items to add to the speedbar frame.")
321 325
322 ;; Make sure our special speedbar mode is loaded 326 ;; Make sure our special speedbar mode is loaded
323 (if (featurep 'speedbar) 327 (if (featurep 'speedbar)
324 (gud-install-speedbar-variables) 328 (gud-install-speedbar-variables)
328 "Create a speedbar display based on the current state of GUD. 332 "Create a speedbar display based on the current state of GUD.
329 If the GUD BUFFER is not running a supported debugger, then turn 333 If the GUD BUFFER is not running a supported debugger, then turn
330 off the specialized speedbar mode." 334 off the specialized speedbar mode."
331 (let ((minor-mode (with-current-buffer buffer gud-minor-mode))) 335 (let ((minor-mode (with-current-buffer buffer gud-minor-mode)))
332 (cond 336 (cond
333 ((eq minor-mode 'gdba) 337 ((memq minor-mode '(gdbmi gdba))
334 (when (or gdb-var-changed 338 (when (or gdb-var-changed
335 (not (save-excursion 339 (not (save-excursion
336 (goto-char (point-min)) 340 (goto-char (point-min))
337 (let ((case-fold-search t)) 341 (let ((case-fold-search t))
338 (looking-at "Watch Expressions:"))))) 342 (looking-at "Watch Expressions:")))))
395 ; 'gud-gdb-get-scope-data 399 ; 'gud-gdb-get-scope-data
396 ; frame t) 400 ; frame t)
397 (speedbar-insert-button (car frame) 401 (speedbar-insert-button (car frame)
398 'speedbar-file-face 402 'speedbar-file-face
399 'speedbar-highlight-face 403 'speedbar-highlight-face
400 (cond ((memq minor-mode '(gdba gdb)) 404 (cond ((memq minor-mode '(gdbmi gdba gdb))
401 'gud-gdb-goto-stackframe) 405 'gud-gdb-goto-stackframe)
402 (t (error "Should never be here"))) 406 (t (error "Should never be here")))
403 frame t))) 407 frame t)))
404 ; (let ((selected-frame 408 ; (let ((selected-frame
405 ; (cond ((eq ff 'gud-gdb-find-file) 409 ; (cond ((eq ff 'gud-gdb-find-file)
2509 (cond ((null (buffer-name (process-buffer proc))) 2513 (cond ((null (buffer-name (process-buffer proc)))
2510 ;; buffer killed 2514 ;; buffer killed
2511 ;; Stop displaying an arrow in a source file. 2515 ;; Stop displaying an arrow in a source file.
2512 (setq overlay-arrow-position nil) 2516 (setq overlay-arrow-position nil)
2513 (set-process-buffer proc nil) 2517 (set-process-buffer proc nil)
2514 (if (eq gud-minor-mode-type 'gdba) 2518 (if (memq gud-minor-mode-type '(gdbmi gdba))
2515 (gdb-reset) 2519 (gdb-reset)
2516 (gud-reset))) 2520 (gud-reset)))
2517 ((memq (process-status proc) '(signal exit)) 2521 ((memq (process-status proc) '(signal exit))
2518 ;; Stop displaying an arrow in a source file. 2522 ;; Stop displaying an arrow in a source file.
2519 (setq overlay-arrow-position nil) 2523 (setq overlay-arrow-position nil)
2520 (with-current-buffer gud-comint-buffer 2524 (with-current-buffer gud-comint-buffer
2521 (if (eq gud-minor-mode 'gdba) 2525 (if (memq gud-minor-mode-type '(gdbmi gdba))
2522 (gdb-reset) 2526 (gdb-reset)
2523 (gud-reset))) 2527 (gud-reset)))
2524 (let* ((obuf (current-buffer))) 2528 (let* ((obuf (current-buffer)))
2525 ;; save-excursion isn't the right thing if 2529 ;; save-excursion isn't the right thing if
2526 ;; process-buffer is current-buffer 2530 ;; process-buffer is current-buffer
2581 (let* ((last-nonmenu-event t) ; Prevent use of dialog box for questions. 2585 (let* ((last-nonmenu-event t) ; Prevent use of dialog box for questions.
2582 (buffer 2586 (buffer
2583 (with-current-buffer gud-comint-buffer 2587 (with-current-buffer gud-comint-buffer
2584 (gud-find-file true-file))) 2588 (gud-find-file true-file)))
2585 (window (and buffer (or (get-buffer-window buffer) 2589 (window (and buffer (or (get-buffer-window buffer)
2586 (if (eq gud-minor-mode 'gdba) 2590 (if (memq gud-minor-mode '(gdbmi gdba))
2587 (gdb-display-source-buffer buffer) 2591 (gdb-display-source-buffer buffer)
2588 (display-buffer buffer))))) 2592 (display-buffer buffer)))))
2589 (pos)) 2593 (pos))
2590 (if buffer 2594 (if buffer
2591 (progn 2595 (progn
2705 (widen) 2709 (widen)
2706 (goto-char (process-mark proc)) 2710 (goto-char (process-mark proc))
2707 (forward-line 0) 2711 (forward-line 0)
2708 (if (looking-at comint-prompt-regexp) 2712 (if (looking-at comint-prompt-regexp)
2709 (set-marker gud-delete-prompt-marker (point))) 2713 (set-marker gud-delete-prompt-marker (point)))
2710 (if (eq gud-minor-mode 'gdba) 2714 (if (memq gud-minor-mode '(gdbmi gdba))
2711 (apply comint-input-sender (list proc command)) 2715 (apply comint-input-sender (list proc command))
2712 (process-send-string proc (concat command "\n"))))))) 2716 (process-send-string proc (concat command "\n")))))))
2713 2717
2714 (defun gud-refresh (&optional arg) 2718 (defun gud-refresh (&optional arg)
2715 "Fix up a possibly garbled display, and redraw the arrow." 2719 "Fix up a possibly garbled display, and redraw the arrow."