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