debugger 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +10 -0
- data/CHANGES +334 -0
- data/ChangeLog +5655 -0
- data/INSTALL.SVN +154 -0
- data/LICENSE +23 -0
- data/Makefile.am +14 -0
- data/OLD_README +122 -0
- data/README.md +10 -0
- data/Rakefile +266 -0
- data/autogen.sh +4 -0
- data/bin/rdebug +398 -0
- data/cli/ruby-debug.rb +173 -0
- data/cli/ruby-debug/command.rb +228 -0
- data/cli/ruby-debug/commands/breakpoints.rb +153 -0
- data/cli/ruby-debug/commands/catchpoint.rb +55 -0
- data/cli/ruby-debug/commands/condition.rb +49 -0
- data/cli/ruby-debug/commands/continue.rb +38 -0
- data/cli/ruby-debug/commands/control.rb +107 -0
- data/cli/ruby-debug/commands/display.rb +120 -0
- data/cli/ruby-debug/commands/edit.rb +48 -0
- data/cli/ruby-debug/commands/enable.rb +202 -0
- data/cli/ruby-debug/commands/eval.rb +176 -0
- data/cli/ruby-debug/commands/finish.rb +42 -0
- data/cli/ruby-debug/commands/frame.rb +301 -0
- data/cli/ruby-debug/commands/help.rb +56 -0
- data/cli/ruby-debug/commands/info.rb +467 -0
- data/cli/ruby-debug/commands/irb.rb +123 -0
- data/cli/ruby-debug/commands/jump.rb +66 -0
- data/cli/ruby-debug/commands/kill.rb +51 -0
- data/cli/ruby-debug/commands/list.rb +94 -0
- data/cli/ruby-debug/commands/method.rb +84 -0
- data/cli/ruby-debug/commands/quit.rb +39 -0
- data/cli/ruby-debug/commands/reload.rb +40 -0
- data/cli/ruby-debug/commands/save.rb +90 -0
- data/cli/ruby-debug/commands/set.rb +221 -0
- data/cli/ruby-debug/commands/show.rb +247 -0
- data/cli/ruby-debug/commands/skip.rb +35 -0
- data/cli/ruby-debug/commands/source.rb +36 -0
- data/cli/ruby-debug/commands/stepping.rb +81 -0
- data/cli/ruby-debug/commands/threads.rb +189 -0
- data/cli/ruby-debug/commands/tmate.rb +36 -0
- data/cli/ruby-debug/commands/trace.rb +57 -0
- data/cli/ruby-debug/commands/variables.rb +199 -0
- data/cli/ruby-debug/debugger.rb +5 -0
- data/cli/ruby-debug/helper.rb +69 -0
- data/cli/ruby-debug/interface.rb +232 -0
- data/cli/ruby-debug/processor.rb +474 -0
- data/configure.ac +12 -0
- data/debugger.gemspec +24 -0
- data/doc/.cvsignore +42 -0
- data/doc/Makefile.am +63 -0
- data/doc/emacs-notes.txt +38 -0
- data/doc/hanoi.rb +35 -0
- data/doc/primes.rb +28 -0
- data/doc/rdebug-emacs.texi +1030 -0
- data/doc/rdebug.1 +241 -0
- data/doc/ruby-debug.texi +3791 -0
- data/doc/test-tri2.rb +18 -0
- data/doc/tri3.rb +8 -0
- data/doc/triangle.rb +12 -0
- data/emacs/Makefile.am +130 -0
- data/emacs/rdebug-annotate.el +385 -0
- data/emacs/rdebug-breaks.el +407 -0
- data/emacs/rdebug-cmd.el +92 -0
- data/emacs/rdebug-core.el +502 -0
- data/emacs/rdebug-dbg.el +62 -0
- data/emacs/rdebug-error.el +79 -0
- data/emacs/rdebug-fns.el +111 -0
- data/emacs/rdebug-frames.el +230 -0
- data/emacs/rdebug-gud.el +242 -0
- data/emacs/rdebug-help.el +104 -0
- data/emacs/rdebug-info.el +83 -0
- data/emacs/rdebug-layouts.el +180 -0
- data/emacs/rdebug-locring.el +118 -0
- data/emacs/rdebug-output.el +106 -0
- data/emacs/rdebug-regexp.el +118 -0
- data/emacs/rdebug-secondary.el +260 -0
- data/emacs/rdebug-shortkey.el +175 -0
- data/emacs/rdebug-source.el +568 -0
- data/emacs/rdebug-track.el +392 -0
- data/emacs/rdebug-varbuf.el +150 -0
- data/emacs/rdebug-vars.el +125 -0
- data/emacs/rdebug-watch.el +132 -0
- data/emacs/rdebug.el +326 -0
- data/emacs/test/elk-test.el +242 -0
- data/emacs/test/test-annotate.el +103 -0
- data/emacs/test/test-cmd.el +116 -0
- data/emacs/test/test-core.el +104 -0
- data/emacs/test/test-fns.el +65 -0
- data/emacs/test/test-frames.el +62 -0
- data/emacs/test/test-gud.el +35 -0
- data/emacs/test/test-indent.el +58 -0
- data/emacs/test/test-regexp.el +144 -0
- data/emacs/test/test-shortkey.el +61 -0
- data/ext/ruby_debug/breakpoint.c +586 -0
- data/ext/ruby_debug/extconf.rb +49 -0
- data/ext/ruby_debug/ruby_debug.c +2624 -0
- data/ext/ruby_debug/ruby_debug.h +148 -0
- data/lib/ChangeLog +1065 -0
- data/lib/debugger.rb +7 -0
- data/lib/debugger/version.rb +3 -0
- data/lib/ruby-debug-base.rb +304 -0
- data/rdbg.rb +33 -0
- data/runner.sh +7 -0
- data/svn2cl_usermap +3 -0
- data/test/.cvsignore +1 -0
- data/test/base/base.rb +74 -0
- data/test/base/binding.rb +31 -0
- data/test/base/catchpoint.rb +26 -0
- data/test/base/load.rb +40 -0
- data/test/bp_loop_issue.rb +3 -0
- data/test/classes.rb +11 -0
- data/test/cli/commands/catchpoint_test.rb +36 -0
- data/test/cli/commands/unit/regexp.rb +42 -0
- data/test/config.yaml +8 -0
- data/test/data/annotate.cmd +29 -0
- data/test/data/annotate.right +139 -0
- data/test/data/break_bad.cmd +18 -0
- data/test/data/break_bad.right +28 -0
- data/test/data/break_loop_bug.cmd +5 -0
- data/test/data/break_loop_bug.right +15 -0
- data/test/data/breakpoints.cmd +38 -0
- data/test/data/breakpoints.right +98 -0
- data/test/data/catch.cmd +20 -0
- data/test/data/catch.right +49 -0
- data/test/data/catch2.cmd +19 -0
- data/test/data/catch2.right +65 -0
- data/test/data/catch3.cmd +11 -0
- data/test/data/catch3.right +37 -0
- data/test/data/condition.cmd +28 -0
- data/test/data/condition.right +65 -0
- data/test/data/ctrl.cmd +23 -0
- data/test/data/ctrl.right +70 -0
- data/test/data/display.cmd +24 -0
- data/test/data/display.right +44 -0
- data/test/data/dollar-0.right +2 -0
- data/test/data/dollar-0a.right +2 -0
- data/test/data/dollar-0b.right +2 -0
- data/test/data/edit.cmd +12 -0
- data/test/data/edit.right +19 -0
- data/test/data/emacs_basic.cmd +43 -0
- data/test/data/emacs_basic.right +106 -0
- data/test/data/enable.cmd +20 -0
- data/test/data/enable.right +36 -0
- data/test/data/finish.cmd +16 -0
- data/test/data/finish.right +31 -0
- data/test/data/frame.cmd +26 -0
- data/test/data/frame.right +55 -0
- data/test/data/help.cmd +20 -0
- data/test/data/help.right +21 -0
- data/test/data/history.right +7 -0
- data/test/data/info-thread.cmd +13 -0
- data/test/data/info-thread.right +37 -0
- data/test/data/info-var-bug2.cmd +5 -0
- data/test/data/info-var-bug2.right +10 -0
- data/test/data/info-var.cmd +23 -0
- data/test/data/info-var.right +52 -0
- data/test/data/info.cmd +21 -0
- data/test/data/info.right +65 -0
- data/test/data/jump.cmd +16 -0
- data/test/data/jump.right +56 -0
- data/test/data/jump2.cmd +16 -0
- data/test/data/jump2.right +44 -0
- data/test/data/linetrace.cmd +6 -0
- data/test/data/linetrace.right +23 -0
- data/test/data/list.cmd +19 -0
- data/test/data/list.right +127 -0
- data/test/data/method.cmd +10 -0
- data/test/data/method.right +21 -0
- data/test/data/methodsig.cmd +10 -0
- data/test/data/methodsig.right +20 -0
- data/test/data/next.cmd +22 -0
- data/test/data/next.right +61 -0
- data/test/data/noquit.right +1 -0
- data/test/data/output.cmd +6 -0
- data/test/data/output.right +31 -0
- data/test/data/pm-bug.cmd +7 -0
- data/test/data/pm-bug.right +12 -0
- data/test/data/post-mortem-next.cmd +8 -0
- data/test/data/post-mortem-next.right +14 -0
- data/test/data/post-mortem-osx.right +31 -0
- data/test/data/post-mortem.cmd +13 -0
- data/test/data/post-mortem.right +32 -0
- data/test/data/quit.cmd +6 -0
- data/test/data/quit.right +0 -0
- data/test/data/raise.cmd +11 -0
- data/test/data/raise.right +23 -0
- data/test/data/save.cmd +34 -0
- data/test/data/save.right +59 -0
- data/test/data/scope-var.cmd +42 -0
- data/test/data/scope-var.right +587 -0
- data/test/data/setshow.cmd +56 -0
- data/test/data/setshow.right +98 -0
- data/test/data/source.cmd +5 -0
- data/test/data/source.right +15 -0
- data/test/data/stepping.cmd +21 -0
- data/test/data/stepping.right +50 -0
- data/test/data/test-init-cygwin.right +7 -0
- data/test/data/test-init-osx.right +4 -0
- data/test/data/test-init.right +5 -0
- data/test/data/trace.right +14 -0
- data/test/dollar-0.rb +5 -0
- data/test/gcd-dbg-nox.rb +31 -0
- data/test/gcd-dbg.rb +30 -0
- data/test/gcd.rb +18 -0
- data/test/helper.rb +144 -0
- data/test/info-var-bug.rb +47 -0
- data/test/info-var-bug2.rb +2 -0
- data/test/jump.rb +14 -0
- data/test/jump2.rb +27 -0
- data/test/next.rb +18 -0
- data/test/null.rb +1 -0
- data/test/output.rb +2 -0
- data/test/pm-base.rb +22 -0
- data/test/pm-bug.rb +3 -0
- data/test/pm-catch.rb +12 -0
- data/test/pm-catch2.rb +27 -0
- data/test/pm-catch3.rb +47 -0
- data/test/pm.rb +11 -0
- data/test/raise.rb +3 -0
- data/test/rdebug-save.1 +7 -0
- data/test/runall +12 -0
- data/test/scope-var.rb +29 -0
- data/test/tdebug.rb +248 -0
- data/test/test-annotate.rb +25 -0
- data/test/test-break-bad.rb +37 -0
- data/test/test-breakpoints.rb +25 -0
- data/test/test-catch.rb +25 -0
- data/test/test-catch2.rb +25 -0
- data/test/test-catch3.rb +25 -0
- data/test/test-condition.rb +25 -0
- data/test/test-ctrl.rb +55 -0
- data/test/test-display.rb +26 -0
- data/test/test-dollar-0.rb +40 -0
- data/test/test-edit.rb +26 -0
- data/test/test-emacs-basic.rb +26 -0
- data/test/test-enable.rb +25 -0
- data/test/test-finish.rb +34 -0
- data/test/test-frame.rb +34 -0
- data/test/test-help.rb +60 -0
- data/test/test-hist.rb +68 -0
- data/test/test-info-thread.rb +32 -0
- data/test/test-info-var.rb +47 -0
- data/test/test-info.rb +26 -0
- data/test/test-init.rb +44 -0
- data/test/test-jump.rb +35 -0
- data/test/test-list.rb +25 -0
- data/test/test-method.rb +34 -0
- data/test/test-next.rb +25 -0
- data/test/test-output.rb +26 -0
- data/test/test-quit.rb +30 -0
- data/test/test-raise.rb +25 -0
- data/test/test-save.rb +31 -0
- data/test/test-scope-var.rb +25 -0
- data/test/test-setshow.rb +25 -0
- data/test/test-source.rb +25 -0
- data/test/test-stepping.rb +26 -0
- data/test/test-trace.rb +47 -0
- data/test/thread1.rb +26 -0
- data/test/trunc-call.rb +31 -0
- metadata +364 -0
data/emacs/rdebug-gud.el
ADDED
@@ -0,0 +1,242 @@
|
|
1
|
+
;;; rdebug-gud.el --- rdebug interface to gud.
|
2
|
+
|
3
|
+
;; Copyright (C) 2007, 2008 Rocky Bernstein (rocky@gnu.org)
|
4
|
+
;; Copyright (C) 2007, 2008 Anders Lindgren
|
5
|
+
|
6
|
+
;; $Id: rdebug-gud.el 821 2008-04-25 02:54:44Z rockyb $
|
7
|
+
|
8
|
+
;; This program is free software; you can redistribute it and/or modify
|
9
|
+
;; it under the terms of the GNU General Public License as published by
|
10
|
+
;; the Free Software Foundation; either version 2, or (at your option)
|
11
|
+
;; any later version.
|
12
|
+
|
13
|
+
;; This program is distributed in the hope that it will be useful,
|
14
|
+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
;; GNU General Public License for more details.
|
17
|
+
|
18
|
+
;; You should have received a copy of the GNU General Public License
|
19
|
+
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
20
|
+
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
21
|
+
;; Boston, MA 02111-1307, USA.
|
22
|
+
|
23
|
+
;;; Commentary:
|
24
|
+
|
25
|
+
;; See the manual and the file `rdebug.el' for more information.
|
26
|
+
|
27
|
+
;; This file contains rdebug Emacs routines which interface with gud.
|
28
|
+
|
29
|
+
;;; Code:
|
30
|
+
|
31
|
+
;; -------------------------------------------------------------------
|
32
|
+
;; Dependencies.
|
33
|
+
;;
|
34
|
+
|
35
|
+
(require 'gud)
|
36
|
+
(require 'rdebug-error)
|
37
|
+
(require 'rdebug-fns)
|
38
|
+
(require 'rdebug-regexp)
|
39
|
+
(require 'rdebug-vars)
|
40
|
+
|
41
|
+
|
42
|
+
(defun gud-rdebug-massage-args (file args)
|
43
|
+
"Change FILE and list ARGS before running the debugger.
|
44
|
+
|
45
|
+
gud requires this routine to be defined."
|
46
|
+
args)
|
47
|
+
|
48
|
+
|
49
|
+
(defun gud-rdebug-find-file (file)
|
50
|
+
"`rdebug' and `gud' call this with FILE when they encounter a Ruby program file."
|
51
|
+
|
52
|
+
(find-file-noselect file 'nowarn))
|
53
|
+
|
54
|
+
(defun rdebug-display-line (file line &optional move-arrow)
|
55
|
+
"Arrange for marker to appear in at FILE and LINE.
|
56
|
+
The line marker might appear in the Emacs fringe or as an overlay arroe.
|
57
|
+
Optional argument MOVE-ARROW indicates whether to move any previous indicator."
|
58
|
+
(if file
|
59
|
+
(let ((oldpos (and gud-overlay-arrow-position
|
60
|
+
(marker-position gud-overlay-arrow-position)))
|
61
|
+
(oldbuf (and gud-overlay-arrow-position
|
62
|
+
(marker-buffer gud-overlay-arrow-position))))
|
63
|
+
(gud-display-line file line)
|
64
|
+
(unless move-arrow
|
65
|
+
(when gud-overlay-arrow-position
|
66
|
+
(set-marker gud-overlay-arrow-position oldpos oldbuf))))))
|
67
|
+
|
68
|
+
(defun rdebug-stepping (step-or-next &optional arg)
|
69
|
+
(or arg (setq arg 1))
|
70
|
+
;;(if (not (member '('rdebug-next 'rdebug-step 'digit-argument) last-command))
|
71
|
+
;; (setq rdebug-stepping-prefix ""))
|
72
|
+
(unless (member rdebug-stepping-prefix '("" "+" "-"))
|
73
|
+
(setq rdebug-stepping-prefix ""))
|
74
|
+
(rdebug-call (format "%s%s %d" step-or-next rdebug-stepping-prefix arg)))
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
;; -------------------------------------------------------------------
|
79
|
+
;; Rdebug commands.
|
80
|
+
;;
|
81
|
+
|
82
|
+
(defun rdebug-call (cmd)
|
83
|
+
"Run a debugger command with some error checking."
|
84
|
+
(if (rdebug-dead-process-p)
|
85
|
+
(rdebug-errmsg
|
86
|
+
"Can't find a live debugger process buffer to feed the command to.")
|
87
|
+
(gud-call cmd)))
|
88
|
+
|
89
|
+
(defun rdebug-call-return (cmd &rest options)
|
90
|
+
"Register a debugger command whose output should be handled specially.
|
91
|
+
|
92
|
+
OPTIONS is zero or more indicators what should happen with the
|
93
|
+
output. The following are supported:
|
94
|
+
* :tooltip -- Show the result in a tool-tip.
|
95
|
+
* :info -- Show the result in the info secondary buffer."
|
96
|
+
(if (rdebug-dead-process-p)
|
97
|
+
(rdebug-errmsg
|
98
|
+
"Can't find a live debugger process buffer to feed the command to.")
|
99
|
+
(with-current-buffer gud-comint-buffer
|
100
|
+
(setq rdebug-call-queue
|
101
|
+
(append rdebug-call-queue (list (cons cmd options))))
|
102
|
+
(gud-call cmd))))
|
103
|
+
|
104
|
+
(defun rdebug-continue (&optional arg)
|
105
|
+
"Run a debugger \"continue\" command.
|
106
|
+
|
107
|
+
With a numeric ARG, continue to that line number of the current file."
|
108
|
+
(interactive "p")
|
109
|
+
(if arg
|
110
|
+
(rdebug-call (format "continue %d" arg))
|
111
|
+
(rdebug-call (format "continue"))))
|
112
|
+
|
113
|
+
|
114
|
+
(defun rdebug-next (&optional arg)
|
115
|
+
"Run a debugger \"next\" command, respecting `rdebug-stepping-prefix'.
|
116
|
+
|
117
|
+
With a numeric ARG, continue to that line number of the current file."
|
118
|
+
(interactive "p")
|
119
|
+
(rdebug-stepping "next" arg))
|
120
|
+
|
121
|
+
(defvar rdebug-stepping-prefix ""
|
122
|
+
"The kind of stepping modifier that is desired.
|
123
|
+
|
124
|
+
This variable will have a string value which is either \"\",
|
125
|
+
\"+\", or \"-\"; this string is be appended to the debugger
|
126
|
+
stepping commands (\"next\", or \"step\").")
|
127
|
+
|
128
|
+
(defun rdebug-print-cmd (expr &optional cmd)
|
129
|
+
"Run a debugger print (pl, ps, pp, p) command on `EXPR'; `CMD' is the command to run."
|
130
|
+
(interactive "s")
|
131
|
+
(unless cmd (setq cmd "pp"))
|
132
|
+
(rdebug-call-return (format "%s %s " cmd expr) :tooltip))
|
133
|
+
|
134
|
+
(defun rdebug-print-list-region (from to)
|
135
|
+
"Run a debugger \"pl\" command on the marked region."
|
136
|
+
(interactive "r")
|
137
|
+
(if (> from to)
|
138
|
+
(let ((tem to))
|
139
|
+
(setq to from from tem)))
|
140
|
+
(rdebug-print-cmd (buffer-substring from to) "pl"))
|
141
|
+
|
142
|
+
(defun rdebug-print-region (from to)
|
143
|
+
"Run a debugger \"p\" command on the marked region."
|
144
|
+
(interactive "r")
|
145
|
+
(if (> from to)
|
146
|
+
(let ((tem to))
|
147
|
+
(setq to from from tem)))
|
148
|
+
(rdebug-print-cmd (buffer-substring from to) "p"))
|
149
|
+
|
150
|
+
(defun rdebug-print-sorted-region (from to)
|
151
|
+
"Run a debugger \"ps\" command on the marked region."
|
152
|
+
(interactive "r")
|
153
|
+
(if (> from to)
|
154
|
+
(let ((tem to))
|
155
|
+
(setq to from from tem)))
|
156
|
+
(rdebug-print-cmd (buffer-substring from to) "ps"))
|
157
|
+
|
158
|
+
(defun rdebug-pretty-print-region (from to)
|
159
|
+
"Run a debugger \"pp\" command on the marked region."
|
160
|
+
(interactive "r")
|
161
|
+
(if (> from to)
|
162
|
+
(let ((tem to))
|
163
|
+
(setq to from from tem)))
|
164
|
+
(rdebug-print-cmd (buffer-substring from to) "pp"))
|
165
|
+
|
166
|
+
|
167
|
+
;;
|
168
|
+
;; The following two commands should be seen as proof-of-concept
|
169
|
+
;; functions for the info buffer.
|
170
|
+
;;
|
171
|
+
|
172
|
+
(defun rdebug-pretty-print-to-buffer (s)
|
173
|
+
"Pretty print expression to the info buffer."
|
174
|
+
(interactive "sPretty print: ")
|
175
|
+
(rdebug-call-return (format "pp %s" s) :info))
|
176
|
+
|
177
|
+
(defun rdebug-pretty-print-region-to-buffer (from to)
|
178
|
+
"Pretty print expression in region to the info buffer."
|
179
|
+
(interactive "r")
|
180
|
+
(rdebug-call-return (format "pp %s" (buffer-substring from to)) :info))
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
(defun rdebug-quit ()
|
185
|
+
"Kill the debugger process associated with the current buffer.
|
186
|
+
|
187
|
+
When `rdebug-many-windows' is active, the original window layout
|
188
|
+
is restored."
|
189
|
+
(interactive)
|
190
|
+
(if (yes-or-no-p "Really quit? ")
|
191
|
+
(rdebug-call "quit unconditionally")))
|
192
|
+
|
193
|
+
(defun rdebug-restart ()
|
194
|
+
"Restart the debugged Ruby script.
|
195
|
+
|
196
|
+
An exec restart is used."
|
197
|
+
(interactive)
|
198
|
+
(if (yes-or-no-p "Restart? ")
|
199
|
+
(rdebug-call "restart")))
|
200
|
+
|
201
|
+
(defun rdebug-set-stepping-prefix ()
|
202
|
+
"Set the granularity of stepping on the subsequent 'next' or 'step' command.
|
203
|
+
As long as repeated next or step commands are given, they inherit this setting."
|
204
|
+
(interactive)
|
205
|
+
(setq rdebug-stepping-prefix (this-command-keys)))
|
206
|
+
|
207
|
+
(defun rdebug-step (&optional arg)
|
208
|
+
"Run a debugger \"next\" command, respecting `rdebug-stepping-prefix'.
|
209
|
+
|
210
|
+
With a numeric ARG, continue to that line number of the current file."
|
211
|
+
(interactive "p")
|
212
|
+
(rdebug-stepping "step" arg))
|
213
|
+
|
214
|
+
(defun rdebug-newer-frame ()
|
215
|
+
"Run a debugger \"down\" command to an newer frame.
|
216
|
+
|
217
|
+
If we try to go down from frame 0, wrap to the end of the file"
|
218
|
+
(interactive)
|
219
|
+
(let* ((buf-name (rdebug-get-secondary-buffer-name "frame"))
|
220
|
+
(buf (or (get-buffer buf-name) (current-buffer))))
|
221
|
+
(with-current-buffer buf
|
222
|
+
;; Should we add a mode to disable wrapping?
|
223
|
+
(if (equal rdebug-frames-current-frame-number 0)
|
224
|
+
(rdebug-call "frame -1")
|
225
|
+
(rdebug-call "down 1")))))
|
226
|
+
|
227
|
+
(defun rdebug-older-frame ()
|
228
|
+
"Run a debugger \"up\" command to an older frame."
|
229
|
+
(interactive)
|
230
|
+
(let* ((buf-name (rdebug-get-secondary-buffer-name "frame"))
|
231
|
+
(buf (or (get-buffer buf-name) (current-buffer))))
|
232
|
+
(with-current-buffer buf
|
233
|
+
;; Should we add a mode to disable wrapping?
|
234
|
+
(rdebug-call "up 1"))))
|
235
|
+
|
236
|
+
(provide 'rdebug-gud)
|
237
|
+
|
238
|
+
;;; Local variables:
|
239
|
+
;;; eval:(put 'rdebug-debug-enter 'lisp-indent-hook 1)
|
240
|
+
;;; End:
|
241
|
+
|
242
|
+
;;; rdebug-gud.el ends here
|
@@ -0,0 +1,104 @@
|
|
1
|
+
;;; rdebug-help.el --- Ruby debugger help
|
2
|
+
|
3
|
+
;; Copyright (C) 2008 Rocky Bernstein (rocky@gnu.org)
|
4
|
+
;; Copyright (C) 2008 Anders Lindgren
|
5
|
+
|
6
|
+
;; $Id: rdebug-help.el 711 2008-02-20 07:09:17Z andersl $
|
7
|
+
|
8
|
+
;; This program is free software; you can redistribute it and/or modify
|
9
|
+
;; it under the terms of the GNU General Public License as published by
|
10
|
+
;; the Free Software Foundation; either version 2, or (at your option)
|
11
|
+
;; any later version.
|
12
|
+
|
13
|
+
;; This program is distributed in the hope that it will be useful,
|
14
|
+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
;; GNU General Public License for more details.
|
17
|
+
|
18
|
+
;; You should have received a copy of the GNU General Public License
|
19
|
+
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
20
|
+
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
21
|
+
;; Boston, MA 02111-1307, USA.
|
22
|
+
|
23
|
+
;;; Commentary:
|
24
|
+
|
25
|
+
;; See the manual and the file `rdebug.el' for more information.
|
26
|
+
|
27
|
+
;; This file contains code dealing with the help buffer.
|
28
|
+
|
29
|
+
;;; Code:
|
30
|
+
|
31
|
+
(defvar rdebug-secondary-window-help-mode-map
|
32
|
+
(let ((map (make-sparse-keymap)))
|
33
|
+
(suppress-keymap map)
|
34
|
+
(rdebug-populate-secondary-buffer-map map)
|
35
|
+
map)
|
36
|
+
"Keymap used in the help buffer in the `rdebug' Ruby debugger.")
|
37
|
+
|
38
|
+
(defun rdebug-secondary-window-help-mode ()
|
39
|
+
"Major mode for the secondary buffer help text in the `rdebug' Ruby debugger.
|
40
|
+
|
41
|
+
\\{rdebug-secondary-window-help-mode-map}"
|
42
|
+
(interactive)
|
43
|
+
(kill-all-local-variables)
|
44
|
+
(setq major-mode 'rdebug-secondary-window-help-mode)
|
45
|
+
(setq mode-name "RDEBUG Help")
|
46
|
+
(setq buffer-read-only t)
|
47
|
+
(set (make-local-variable 'rdebug-secondary-buffer) t)
|
48
|
+
(setq mode-line-process 'rdebug-mode-line-process)
|
49
|
+
(use-local-map rdebug-secondary-window-help-mode-map)
|
50
|
+
(run-mode-hooks 'rdebug-secondary-window-help-mode-hook))
|
51
|
+
|
52
|
+
(defun rdebug-display-secondary-window-help-buffer ()
|
53
|
+
"Display the rdebug help buffer."
|
54
|
+
(interactive)
|
55
|
+
(rdebug-display-secondary-buffer "help"))
|
56
|
+
|
57
|
+
(defun rdebug-setup-secondary-window-help-buffer (buf comint-buffer)
|
58
|
+
(rdebug-debug-enter "rdebug-setup-secondary-window-help-buffer"
|
59
|
+
(with-current-buffer buf
|
60
|
+
(rdebug-secondary-window-help-mode)
|
61
|
+
(set (make-local-variable 'gud-comint-buffer) comint-buffer)
|
62
|
+
(insert "\
|
63
|
+
|
64
|
+
This is a rdebug secondary window, you can use it to watch a
|
65
|
+
number of help buffers. Use capital letters to switch between the
|
66
|
+
available buffers. Lower case letters (and other key
|
67
|
+
combinations) are used to issue buffer-specific commands.
|
68
|
+
|
69
|
+
Press `C-h m' for more help, when the individual buffers are visible.
|
70
|
+
|
71
|
+
B - Breakpoints buffer.
|
72
|
+
C - Command buffer (the debugger shell)
|
73
|
+
O - Output window
|
74
|
+
S - go to source frame
|
75
|
+
T - Stack trace buffer
|
76
|
+
V - Variables buffer
|
77
|
+
W - Watch buffer
|
78
|
+
|
79
|
+
SPC - step (into)
|
80
|
+
+ - set for step+ and next+
|
81
|
+
- - set for step- and next-
|
82
|
+
_ - set to remove +/-
|
83
|
+
c - continue
|
84
|
+
f - finish (step out)
|
85
|
+
n - next (step over)
|
86
|
+
p - print
|
87
|
+
q - quit
|
88
|
+
r - run (restart)
|
89
|
+
R - run (restart)
|
90
|
+
s - step (into)
|
91
|
+
|
92
|
+
> - go down frame (with numeric argument goes down that many frames)
|
93
|
+
< - go up one frame (with numeric argument goes down that many frames)
|
94
|
+
|
95
|
+
? - This help text.
|
96
|
+
"))))
|
97
|
+
|
98
|
+
(provide 'rdebug-help)
|
99
|
+
|
100
|
+
;;; Local variables:
|
101
|
+
;;; eval:(put 'rdebug-debug-enter 'lisp-indent-hook 1)
|
102
|
+
;;; End:
|
103
|
+
|
104
|
+
;;; rdebug-help.el ends here
|
@@ -0,0 +1,83 @@
|
|
1
|
+
;;; rdebug-info.el --- This file contains code dealing with the Ruby
|
2
|
+
;;; debugger's info secondary buffer.
|
3
|
+
|
4
|
+
;; Copyright (C) 2008 Rocky Bernstein (rocky@gnu.org)
|
5
|
+
;; Copyright (C) 2008 Anders Lindgren
|
6
|
+
|
7
|
+
;; $Id: rdebug-breaks.el 670 2008-02-06 18:15:28Z rockyb $
|
8
|
+
|
9
|
+
;; This program is free software; you can redistribute it and/or modify
|
10
|
+
;; it under the terms of the GNU General Public License as published by
|
11
|
+
;; the Free Software Foundation; either version 2, or (at your option)
|
12
|
+
;; any later version.
|
13
|
+
|
14
|
+
;; This program is distributed in the hope that it will be useful,
|
15
|
+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17
|
+
;; GNU General Public License for more details.
|
18
|
+
|
19
|
+
;; You should have received a copy of the GNU General Public License
|
20
|
+
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
21
|
+
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
22
|
+
;; Boston, MA 02111-1307, USA.
|
23
|
+
|
24
|
+
;;; Commentary:
|
25
|
+
|
26
|
+
;; See the manual and the file `rdebug.el' for more information.
|
27
|
+
|
28
|
+
|
29
|
+
;;; Code:
|
30
|
+
|
31
|
+
(require 'rdebug-dbg)
|
32
|
+
(require 'rdebug-gud)
|
33
|
+
(require 'rdebug-regexp)
|
34
|
+
(require 'rdebug-secondary)
|
35
|
+
(require 'rdebug-source)
|
36
|
+
(require 'rdebug-vars)
|
37
|
+
|
38
|
+
(defun rdebug-display-info-buffer ()
|
39
|
+
"Display the rdebug breakpoints buffer."
|
40
|
+
(interactive)
|
41
|
+
(rdebug-display-secondary-buffer "info"))
|
42
|
+
|
43
|
+
(defvar rdebug-info-mode-map
|
44
|
+
(let ((map (make-sparse-keymap)))
|
45
|
+
(rdebug-populate-secondary-buffer-map map)
|
46
|
+
map)
|
47
|
+
"Keymap for the Rdebug info secondary buffer.")
|
48
|
+
|
49
|
+
(defun rdebug-info-mode ()
|
50
|
+
"Major mode for Ruby debugger info buffer.
|
51
|
+
|
52
|
+
\\{rdebug-info-mode-map}"
|
53
|
+
(kill-all-local-variables)
|
54
|
+
(setq major-mode 'rdebug-info-mode)
|
55
|
+
(setq mode-name "RDEBUG Info")
|
56
|
+
(use-local-map rdebug-info-mode-map)
|
57
|
+
(setq buffer-read-only t)
|
58
|
+
(set (make-local-variable 'rdebug-secondary-buffer) t)
|
59
|
+
(setq mode-line-process 'rdebug-mode-line-process)
|
60
|
+
(run-mode-hooks 'rdebug-info-mode-hook))
|
61
|
+
|
62
|
+
(defun rdebug-setup-info-buffer (buf comint-buffer)
|
63
|
+
"Setup the Rdebug debugger info buffer."
|
64
|
+
(rdebug-debug-enter "rdebug-setup-info-buffer"
|
65
|
+
(with-current-buffer buf
|
66
|
+
(let ((inhibit-read-only t)
|
67
|
+
(old-line-number (buffer-local-value 'rdebug-current-line-number
|
68
|
+
buf)))
|
69
|
+
(rdebug-info-mode)
|
70
|
+
(goto-line old-line-number)))))
|
71
|
+
|
72
|
+
|
73
|
+
;; -------------------------------------------------------------------
|
74
|
+
;; The end.
|
75
|
+
;;
|
76
|
+
|
77
|
+
(provide 'rdebug-info)
|
78
|
+
|
79
|
+
;;; Local variables:
|
80
|
+
;;; eval:(put 'rdebug-debug-enter 'lisp-indent-hook 1)
|
81
|
+
;;; End:
|
82
|
+
|
83
|
+
;;; rdebug-info.el ends here
|
@@ -0,0 +1,180 @@
|
|
1
|
+
;;; rdebug-layouts.el --- Ruby debugger window layouts.
|
2
|
+
|
3
|
+
;; Copyright (C) 2008 Rocky Bernstein (rocky@gnu.org)
|
4
|
+
;; Copyright (C) 2008 Anders Lindgren
|
5
|
+
|
6
|
+
;; $Id: rdebug-layouts.el 723 2008-02-24 04:51:39Z rockyb $
|
7
|
+
|
8
|
+
;; This program is free software; you can redistribute it and/or modify
|
9
|
+
;; it under the terms of the GNU General Public License as published by
|
10
|
+
;; the Free Software Foundation; either version 2, or (at your option)
|
11
|
+
;; any later version.
|
12
|
+
|
13
|
+
;; This program is distributed in the hope that it will be useful,
|
14
|
+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
;; GNU General Public License for more details.
|
17
|
+
|
18
|
+
;; You should have received a copy of the GNU General Public License
|
19
|
+
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
20
|
+
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
21
|
+
;; Boston, MA 02111-1307, USA.
|
22
|
+
|
23
|
+
;;; Commentary:
|
24
|
+
|
25
|
+
;; This is file contains the window layouts that come with rdebug; the
|
26
|
+
;; code where can be consulted as a guide for creating other window
|
27
|
+
;; layouts.
|
28
|
+
|
29
|
+
;; See the manual and the file `rdebug.el' for overall information on
|
30
|
+
;; the ruby debugger rdebug.
|
31
|
+
|
32
|
+
;;; Code:
|
33
|
+
|
34
|
+
(defun rdebug-get-buffer (name script-name)
|
35
|
+
"Return a rdebug buffer for displaying NAME when debugging SCRIPT-NAME.
|
36
|
+
If the buffer doesn't exists it is created."
|
37
|
+
(get-buffer-create (format "*rdebug-%s-%s*" name script-name)))
|
38
|
+
|
39
|
+
|
40
|
+
(defun rdebug-get-existing-buffer (name script-name)
|
41
|
+
"Return a rdebug buffer for displaying NAME when debugging SCRIPT-NAME.
|
42
|
+
Return nil if the buffer doesn't exists."
|
43
|
+
(get-buffer (format "*rdebug-%s-%s*" name script-name)))
|
44
|
+
|
45
|
+
|
46
|
+
(defun rdebug-window-layout-conservative (src-buf name)
|
47
|
+
"A conservative rdebug window layout with three windows.
|
48
|
+
|
49
|
+
This window layout mimics the traditional debugger shell and
|
50
|
+
source window layout, it only add one secondary window.
|
51
|
+
Initially, the secondary window displays output of the debugged
|
52
|
+
process, but any secondary buffer can be displayed, press `?' in
|
53
|
+
the window for more details.
|
54
|
+
Argument SRC-BUF the buffer containing the Ruby source program that was initially run. NAME is the name of that buffer."
|
55
|
+
(delete-other-windows)
|
56
|
+
(split-window-horizontally)
|
57
|
+
(other-window 1)
|
58
|
+
(switch-to-buffer src-buf)
|
59
|
+
(other-window 1)
|
60
|
+
(when rdebug-use-separate-io-buffer
|
61
|
+
(split-window nil 20)
|
62
|
+
(set-window-buffer
|
63
|
+
(selected-window) (rdebug-get-buffer "output" name)))
|
64
|
+
(other-window 1))
|
65
|
+
|
66
|
+
(defun rdebug-window-layout-rocky (src-buf name)
|
67
|
+
"Rocky's window layout.
|
68
|
+
|
69
|
+
3 windows. The source window is on top 4/5 of height. The
|
70
|
+
bottom is split between the command windows and a stack window.
|
71
|
+
|
72
|
+
See `rdebug' for more information.
|
73
|
+
Argument SRC-BUF the buffer containing the Ruby source program that was initially run. NAME is the name of that buffer."
|
74
|
+
(delete-other-windows)
|
75
|
+
(split-window nil ( / ( * (window-height) 4) 5))
|
76
|
+
(set-window-buffer
|
77
|
+
(selected-window) src-buf)
|
78
|
+
(other-window 1)
|
79
|
+
(set-window-buffer
|
80
|
+
(selected-window) (rdebug-get-buffer "frame" name))
|
81
|
+
(split-window-horizontally)
|
82
|
+
(set-window-buffer
|
83
|
+
(selected-window) (rdebug-get-buffer "cmd" name))
|
84
|
+
(goto-char (point-max)))
|
85
|
+
|
86
|
+
(defun rdebug-window-layout-rocky2 (src-buf name)
|
87
|
+
"This layout is standard window without the output window, see `rdebug'.
|
88
|
+
for more information.
|
89
|
+
Argument SRC-BUF is the NAME of the buffer containing the Ruby source program that was initially run."
|
90
|
+
(delete-other-windows)
|
91
|
+
(split-window nil ( / ( * (window-height) 3) 4))
|
92
|
+
(set-window-buffer
|
93
|
+
(selected-window) src-buf)
|
94
|
+
(split-window nil ( / (window-height) 3))
|
95
|
+
(split-window-horizontally)
|
96
|
+
(set-window-buffer
|
97
|
+
(selected-window) (rdebug-get-buffer "frame" name))
|
98
|
+
(other-window 1)
|
99
|
+
(set-window-buffer
|
100
|
+
(selected-window) (rdebug-get-buffer "variables" name))
|
101
|
+
(other-window 1)
|
102
|
+
(switch-to-buffer src-buf)
|
103
|
+
(other-window 1)
|
104
|
+
(set-window-buffer
|
105
|
+
(selected-window) (rdebug-get-buffer "cmd" name))
|
106
|
+
(goto-char (point-max)))
|
107
|
+
|
108
|
+
(defun rdebug-window-layout-stack-of-windows (src-buf name)
|
109
|
+
"A rdebug window layout with several secondary windows to the right.
|
110
|
+
The debugger shell and the source code window is to the left.
|
111
|
+
Argument SRC-BUF the buffer containing the Ruby source program that was initially run. NAME is the name of that buffer."
|
112
|
+
(delete-other-windows)
|
113
|
+
(split-window-horizontally)
|
114
|
+
(split-window nil 20)
|
115
|
+
(set-window-buffer
|
116
|
+
(selected-window) (rdebug-get-buffer "cmd" name))
|
117
|
+
(other-window 1)
|
118
|
+
(switch-to-buffer src-buf)
|
119
|
+
(other-window 1)
|
120
|
+
(split-window)
|
121
|
+
(split-window)
|
122
|
+
(set-window-buffer
|
123
|
+
(selected-window) (rdebug-get-buffer "variables" name))
|
124
|
+
(other-window 1)
|
125
|
+
(set-window-buffer
|
126
|
+
(selected-window) (rdebug-get-buffer "frame" name))
|
127
|
+
(when rdebug-use-separate-io-buffer
|
128
|
+
(other-window 1)
|
129
|
+
(split-window)
|
130
|
+
(set-window-buffer
|
131
|
+
(selected-window) (rdebug-get-buffer "output" name)))
|
132
|
+
(other-window 1)
|
133
|
+
(set-window-buffer
|
134
|
+
(selected-window) (rdebug-get-buffer "breakpoints" name))
|
135
|
+
(other-window 1))
|
136
|
+
|
137
|
+
;; The default layout
|
138
|
+
(defun rdebug-window-layout-standard (src-buf name)
|
139
|
+
"The default rdebug window layout, see `rdebug' for more information.
|
140
|
+
Argument SRC-BUF the buffer containing the Ruby source program that was initially run. NAME is the name of that buffer."
|
141
|
+
(delete-other-windows)
|
142
|
+
(split-window nil ( / ( * (window-height) 3) 4))
|
143
|
+
(split-window nil ( / (window-height) 3))
|
144
|
+
(split-window-horizontally)
|
145
|
+
(other-window 1)
|
146
|
+
(set-window-buffer
|
147
|
+
(selected-window) (rdebug-get-buffer "variables" name))
|
148
|
+
(other-window 1)
|
149
|
+
(switch-to-buffer src-buf)
|
150
|
+
(when rdebug-use-separate-io-buffer
|
151
|
+
(split-window-horizontally)
|
152
|
+
(other-window 1)
|
153
|
+
(set-window-buffer
|
154
|
+
(selected-window) (rdebug-get-buffer "output" name)))
|
155
|
+
(other-window 1)
|
156
|
+
(set-window-buffer
|
157
|
+
(selected-window) (rdebug-get-buffer "frame" name))
|
158
|
+
(split-window-horizontally)
|
159
|
+
(other-window 1)
|
160
|
+
(set-window-buffer
|
161
|
+
(selected-window) (rdebug-get-buffer "breakpoints" name))
|
162
|
+
(other-window 1)
|
163
|
+
(goto-char (point-max)))
|
164
|
+
|
165
|
+
|
166
|
+
(defun rdebug-window-layout-no-shell (src-buf name)
|
167
|
+
"A rdebug window layout without a shell window.
|
168
|
+
Argument SRC-BUF the buffer containing the Ruby source program that was initially run. NAME is the name of that buffer."
|
169
|
+
(delete-other-windows)
|
170
|
+
(set-window-buffer
|
171
|
+
(selected-window) (rdebug-get-buffer "watch" name))
|
172
|
+
(rdebug-window-layout-standard src-buf name))
|
173
|
+
|
174
|
+
(provide 'rdebug-layouts)
|
175
|
+
|
176
|
+
;;; Local variables:
|
177
|
+
;;; eval:(put 'rdebug-debug-enter 'lisp-indent-hook 1)
|
178
|
+
;;; End:
|
179
|
+
|
180
|
+
;;; rdebug-layouts.el ends here
|