annotate lisp/energize/energize-shell.el @ 149:538048ae2ab8 r20-3b1

Import from CVS: tag r20-3b1
author cvs
date Mon, 13 Aug 2007 09:36:16 +0200
parents 376386a54a3c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; -*- Mode:Emacs-Lisp -*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;; Copyright (C) 1992-1993 by Lucid, Inc. All Rights Reserved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 (require 'comint)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 (require 'shell)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 (require 'gdb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 (defun energize-comint-input-sender (energize-proc input)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 (energize-send-region (energize-user-input-buffer-mark) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 (defvar energize-shell-prompt-pattern "^(.*gdb) ?"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 "*A regexp to recognize the prompt for the Energize debugger.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 (defun energize-debugger-mode ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 "Major mode for the Energize Debugger buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 In addition to the normal cursor-motion commands, the following keys are bound:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 \\{energize-debugger-map}"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 (comint-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 (setq comint-prompt-regexp energize-shell-prompt-pattern
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 comint-input-sentinel 'shell-directory-tracker
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 comint-input-sender 'energize-comint-input-sender)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 (setq mode-line-process nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 (energize-mode-internal)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 (set-syntax-table c-mode-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 (setq major-mode 'energize-debugger-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 mode-name "Energize-Debugger")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 (use-local-map energize-debugger-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (set (make-local-variable 'shell-dirstack) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (set (make-local-variable 'shell-dirtrackp) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (set (make-local-variable 'gdb-last-frame) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (set (make-local-variable 'gdb-last-frame-displayed-p) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (set (make-local-variable 'gdb-delete-prompt-marker) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (set (make-local-variable 'comint-input-autoexpand) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (run-hooks 'energize-debugger-mode-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (if energize-debugger-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; (setq energize-debugger-map (make-sparse-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;; kludge!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (setq energize-debugger-map (copy-keymap energize-map))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (set-keymap-name energize-debugger-map 'energize-debugger-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (set-keymap-parent energize-debugger-map gdb-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (define-key energize-debugger-map "\M-\t" 'comint-dynamic-complete)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (define-key energize-debugger-map "\M-?" 'comint-dynamic-list-completions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (define-key energize-debugger-map "\C-c<" 'energize-debugger-up-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (define-key energize-debugger-map "\C-c>" 'energize-debugger-down-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (define-key energize-debugger-map "\C-c\C-f" 'energize-debugger-return)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (define-key energize-debugger-map "\C-c\C-c" 'energize-debugger-interrupt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;; should be quit-subjob
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (define-key energize-debugger-map "\C-c\C-\\" 'energize-debugger-interrupt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (define-key energize-debugger-map "\C-c\C-z"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 'energize-debugger-interrupt) ; should suspend
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (define-key energize-debugger-map "\C-c\C-d" 'energize-debugger-send-eof)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 ;;; Energize Debugger mode commands; it seems pointless to do this with advice.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (defun energize-debugger-step-line (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 "Step one source line in the Energize debugger."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (energize-execute-command "steponce"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (defun energize-debugger-step-instruction (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 "Step one machine instruction in the Energize debugger."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (energize-execute-command "stepinst"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (defun energize-debugger-next-line (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 "Step one source line skipping function calls in the Energize debugger."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (energize-execute-command "stepnext"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (defun energize-debugger-continue-program (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 "Continue running program being debugged in the Energize debugger."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (energize-execute-command "continueprogram"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (defun energize-debugger-up-frame (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 "Go up one stack frame in the Energize debugger."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (energize-execute-command "upframe"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (defun energize-debugger-down-frame (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 "Go up one stack frame in the Energize debugger."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (energize-execute-command "downframe"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (defun energize-debugger-return (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 "Finish executing current function in the Energize debugger."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (energize-execute-command "continueuntilreturn"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (defun energize-debugger-interrupt (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 "Interrupt program or debugger command in the Energize debugger."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (energize-execute-command "stopprogram"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (defun energize-debugger-send-eof ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 "Send an EOF to the Energize debugger."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (insert ?\C-d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (energize-send-region (1- (point)) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (delete-char -1)))