needy_debugger 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (187) hide show
  1. data/.gitignore +14 -0
  2. data/.travis.yml +8 -0
  3. data/AUTHORS +10 -0
  4. data/CHANGELOG.md +68 -0
  5. data/CONTRIBUTING.md +1 -0
  6. data/Gemfile +3 -0
  7. data/LICENSE +23 -0
  8. data/OLDER_CHANGELOG +334 -0
  9. data/OLD_CHANGELOG +5655 -0
  10. data/OLD_README +122 -0
  11. data/README.md +141 -0
  12. data/Rakefile +78 -0
  13. data/bin/rdebug +397 -0
  14. data/doc/.cvsignore +42 -0
  15. data/doc/Makefile.am +63 -0
  16. data/doc/emacs-notes.txt +38 -0
  17. data/doc/hanoi.rb +35 -0
  18. data/doc/primes.rb +28 -0
  19. data/doc/rdebug-emacs.texi +1030 -0
  20. data/doc/ruby-debug.texi +3791 -0
  21. data/doc/test-tri2.rb +18 -0
  22. data/doc/tri3.rb +8 -0
  23. data/doc/triangle.rb +12 -0
  24. data/emacs/Makefile.am +130 -0
  25. data/emacs/rdebug-annotate.el +385 -0
  26. data/emacs/rdebug-breaks.el +407 -0
  27. data/emacs/rdebug-cmd.el +92 -0
  28. data/emacs/rdebug-core.el +502 -0
  29. data/emacs/rdebug-dbg.el +62 -0
  30. data/emacs/rdebug-error.el +79 -0
  31. data/emacs/rdebug-fns.el +111 -0
  32. data/emacs/rdebug-frames.el +230 -0
  33. data/emacs/rdebug-gud.el +242 -0
  34. data/emacs/rdebug-help.el +104 -0
  35. data/emacs/rdebug-info.el +83 -0
  36. data/emacs/rdebug-layouts.el +180 -0
  37. data/emacs/rdebug-locring.el +118 -0
  38. data/emacs/rdebug-output.el +106 -0
  39. data/emacs/rdebug-regexp.el +118 -0
  40. data/emacs/rdebug-secondary.el +260 -0
  41. data/emacs/rdebug-shortkey.el +175 -0
  42. data/emacs/rdebug-source.el +568 -0
  43. data/emacs/rdebug-track.el +392 -0
  44. data/emacs/rdebug-varbuf.el +150 -0
  45. data/emacs/rdebug-vars.el +125 -0
  46. data/emacs/rdebug-watch.el +132 -0
  47. data/emacs/rdebug.el +326 -0
  48. data/emacs/test/elk-test.el +242 -0
  49. data/emacs/test/test-annotate.el +103 -0
  50. data/emacs/test/test-cmd.el +116 -0
  51. data/emacs/test/test-core.el +104 -0
  52. data/emacs/test/test-fns.el +65 -0
  53. data/emacs/test/test-frames.el +62 -0
  54. data/emacs/test/test-gud.el +35 -0
  55. data/emacs/test/test-indent.el +58 -0
  56. data/emacs/test/test-regexp.el +144 -0
  57. data/emacs/test/test-shortkey.el +61 -0
  58. data/ext/ruby_debug/192/breakpoint.c +586 -0
  59. data/ext/ruby_debug/192/ruby_debug.c +2645 -0
  60. data/ext/ruby_debug/192/ruby_debug.h +148 -0
  61. data/ext/ruby_debug/193/breakpoint.c +586 -0
  62. data/ext/ruby_debug/193/ruby_debug.c +2626 -0
  63. data/ext/ruby_debug/193/ruby_debug.h +148 -0
  64. data/ext/ruby_debug/200/breakpoint.c +586 -0
  65. data/ext/ruby_debug/200/ruby_debug.c +2692 -0
  66. data/ext/ruby_debug/200/ruby_debug.h +148 -0
  67. data/ext/ruby_debug/extconf.rb +94 -0
  68. data/lib/debugger.rb +5 -0
  69. data/lib/debugger/version.rb +5 -0
  70. data/lib/ruby-debug-base.rb +305 -0
  71. data/lib/ruby-debug.rb +177 -0
  72. data/lib/ruby-debug/command.rb +227 -0
  73. data/lib/ruby-debug/commands/breakpoints.rb +153 -0
  74. data/lib/ruby-debug/commands/catchpoint.rb +55 -0
  75. data/lib/ruby-debug/commands/condition.rb +49 -0
  76. data/lib/ruby-debug/commands/continue.rb +38 -0
  77. data/lib/ruby-debug/commands/control.rb +107 -0
  78. data/lib/ruby-debug/commands/display.rb +120 -0
  79. data/lib/ruby-debug/commands/edit.rb +48 -0
  80. data/lib/ruby-debug/commands/enable.rb +202 -0
  81. data/lib/ruby-debug/commands/eval.rb +176 -0
  82. data/lib/ruby-debug/commands/finish.rb +42 -0
  83. data/lib/ruby-debug/commands/frame.rb +301 -0
  84. data/lib/ruby-debug/commands/help.rb +56 -0
  85. data/lib/ruby-debug/commands/info.rb +467 -0
  86. data/lib/ruby-debug/commands/irb.rb +123 -0
  87. data/lib/ruby-debug/commands/jump.rb +66 -0
  88. data/lib/ruby-debug/commands/kill.rb +51 -0
  89. data/lib/ruby-debug/commands/list.rb +94 -0
  90. data/lib/ruby-debug/commands/method.rb +84 -0
  91. data/lib/ruby-debug/commands/quit.rb +50 -0
  92. data/lib/ruby-debug/commands/reload.rb +40 -0
  93. data/lib/ruby-debug/commands/save.rb +90 -0
  94. data/lib/ruby-debug/commands/set.rb +223 -0
  95. data/lib/ruby-debug/commands/show.rb +247 -0
  96. data/lib/ruby-debug/commands/skip.rb +35 -0
  97. data/lib/ruby-debug/commands/source.rb +36 -0
  98. data/lib/ruby-debug/commands/stepping.rb +81 -0
  99. data/lib/ruby-debug/commands/threads.rb +189 -0
  100. data/lib/ruby-debug/commands/tmate.rb +36 -0
  101. data/lib/ruby-debug/commands/trace.rb +57 -0
  102. data/lib/ruby-debug/commands/variables.rb +199 -0
  103. data/lib/ruby-debug/debugger.rb +5 -0
  104. data/lib/ruby-debug/helper.rb +69 -0
  105. data/lib/ruby-debug/interface.rb +232 -0
  106. data/lib/ruby-debug/processor.rb +474 -0
  107. data/man/rdebug.1 +241 -0
  108. data/needy_debugger.gemspec +31 -0
  109. data/old_scripts/Makefile.am +14 -0
  110. data/old_scripts/README.md +2 -0
  111. data/old_scripts/autogen.sh +4 -0
  112. data/old_scripts/configure.ac +12 -0
  113. data/old_scripts/rdbg.rb +33 -0
  114. data/old_scripts/runner.sh +7 -0
  115. data/old_scripts/svn2cl_usermap +3 -0
  116. data/test/.cvsignore +1 -0
  117. data/test/breakpoints_test.rb +365 -0
  118. data/test/conditions_test.rb +76 -0
  119. data/test/continue_test.rb +28 -0
  120. data/test/display_test.rb +141 -0
  121. data/test/edit_test.rb +55 -0
  122. data/test/eval_test.rb +92 -0
  123. data/test/examples/breakpoint1.rb +15 -0
  124. data/test/examples/breakpoint2.rb +7 -0
  125. data/test/examples/conditions.rb +4 -0
  126. data/test/examples/continue.rb +4 -0
  127. data/test/examples/display.rb +5 -0
  128. data/test/examples/edit.rb +3 -0
  129. data/test/examples/edit2.rb +3 -0
  130. data/test/examples/eval.rb +4 -0
  131. data/test/examples/finish.rb +20 -0
  132. data/test/examples/frame.rb +31 -0
  133. data/test/examples/help.rb +2 -0
  134. data/test/examples/info.rb +48 -0
  135. data/test/examples/info2.rb +3 -0
  136. data/test/examples/irb.rb +6 -0
  137. data/test/examples/jump.rb +14 -0
  138. data/test/examples/kill.rb +2 -0
  139. data/test/examples/list.rb +12 -0
  140. data/test/examples/method.rb +15 -0
  141. data/test/examples/post_mortem.rb +19 -0
  142. data/test/examples/quit.rb +2 -0
  143. data/test/examples/reload.rb +6 -0
  144. data/test/examples/restart.rb +6 -0
  145. data/test/examples/save.rb +3 -0
  146. data/test/examples/set.rb +3 -0
  147. data/test/examples/set_annotate.rb +12 -0
  148. data/test/examples/settings.rb +1 -0
  149. data/test/examples/show.rb +2 -0
  150. data/test/examples/source.rb +3 -0
  151. data/test/examples/stepping.rb +21 -0
  152. data/test/examples/thread.rb +32 -0
  153. data/test/examples/tmate.rb +10 -0
  154. data/test/examples/trace.rb +7 -0
  155. data/test/examples/trace_threads.rb +20 -0
  156. data/test/examples/variables.rb +26 -0
  157. data/test/finish_test.rb +48 -0
  158. data/test/frame_test.rb +140 -0
  159. data/test/help_test.rb +50 -0
  160. data/test/info_test.rb +325 -0
  161. data/test/irb_test.rb +81 -0
  162. data/test/jump_test.rb +70 -0
  163. data/test/kill_test.rb +47 -0
  164. data/test/list_test.rb +145 -0
  165. data/test/method_test.rb +70 -0
  166. data/test/post_mortem_test.rb +25 -0
  167. data/test/quit_test.rb +55 -0
  168. data/test/reload_test.rb +43 -0
  169. data/test/restart_test.rb +143 -0
  170. data/test/save_test.rb +92 -0
  171. data/test/set_test.rb +177 -0
  172. data/test/show_test.rb +292 -0
  173. data/test/source_test.rb +44 -0
  174. data/test/stepping_test.rb +118 -0
  175. data/test/support/breakpoint.rb +12 -0
  176. data/test/support/context.rb +14 -0
  177. data/test/support/matchers.rb +67 -0
  178. data/test/support/mocha_extensions.rb +71 -0
  179. data/test/support/processor.rb +7 -0
  180. data/test/support/test_dsl.rb +205 -0
  181. data/test/support/test_interface.rb +66 -0
  182. data/test/test_helper.rb +8 -0
  183. data/test/thread_test.rb +122 -0
  184. data/test/tmate_test.rb +43 -0
  185. data/test/trace_test.rb +154 -0
  186. data/test/variables_test.rb +114 -0
  187. metadata +352 -0
@@ -0,0 +1,125 @@
1
+ ;;; rdebug-var.el --- Ruby debugger variables (other than regexps)
2
+
3
+ ;; Copyright (C) 2007 Rocky Bernstein (rocky@gnu.org)
4
+ ;; Copyright (C) 2007 Anders Lindgren
5
+
6
+ ;; $Id: rdebug-vars.el 769 2008-03-17 14:29:40Z 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
+ ;;
28
+ ;; Introduction:
29
+ ;;
30
+ ;; This is a full-blown debugger user interface to the Ruby rdebug
31
+ ;; debugger shell.
32
+ ;;
33
+ ;; Internal debug support. When `rdebug-debug-active' is non-nil,
34
+ ;; internal debug messages are placed in the buffer *Xrdebug*.
35
+ ;; Functions can be annotated with `rdebug-debug-enter' to display a
36
+ ;; call trace.
37
+ ;;
38
+
39
+ ;;; Code:
40
+
41
+ (defvar rdebug-current-line-number 1
42
+ "The line number in a secondary window that you were in. We need to save
43
+ this value because secondary windows get recreated a lot")
44
+
45
+ (defvar rdebug-debug-active nil
46
+ "Non-nil when rdebug should emit internal debug output to *Xrdebug*.")
47
+
48
+ ;; Indentation depth of `rdebug-debug-enter'.
49
+ (defvar rdebug-debug-depth 0)
50
+
51
+ (defvar rdebug-debugger-window-configuration nil
52
+ "The saved window layout of the debugger.")
53
+
54
+ (defvar rdebug-frames-current-frame-number nil
55
+ "The frame number of the selected frame.")
56
+
57
+ (defvar rdebug-goto-entry-acc "")
58
+
59
+ (defvar rdebug-output-marker-number 0
60
+ "Number to be used when `rdebug-output-add-divider' is next
61
+ called on the secondary output buffer.")
62
+
63
+ (defvar rdebug-original-window-configuration nil
64
+ "The window layout rdebug should restore when the debugger exits.")
65
+
66
+ ;; Terminology: a "secondary buffer" is the physical emacs buffer,
67
+ ;; which can be visible or invisible. A "secondary window", is a window
68
+ ;; that rdebug is reusing to display different secondary buffers.
69
+ ;;
70
+ ;; For example, the "secondary-window-help" buffer is named the way it
71
+ ;; is since it gives help on how the secondary window is used.
72
+ (defvar rdebug-secondary-buffer nil
73
+ "Non-nil for rdebug secondary buffers (e.g. the breakpoints buffer).")
74
+
75
+ ;; Currently, this is the "output" and "info" buffers.
76
+ (defvar rdebug-accumulative-buffer nil
77
+ "Non-nil for Rdebug secondary buffers that grow.")
78
+
79
+ ;; This is used to ensure that the original frame configuration is
80
+ ;; restored even when the user re-starts the debugger several times.
81
+ (defvar rdebug-window-configuration-state 'original
82
+ "Represent the window layout that currently is in use.
83
+ Can be `original' or `debugger'.")
84
+
85
+ ;; FIXME instead of just a list of commands it should a list of pairs
86
+ ;; command and lambda callback routine to call with the shell output.
87
+ (defvar rdebug-call-queue '()
88
+ "List of commands queued up for results of a `rdebug-call'.
89
+
90
+ Each entry is a list of the following form:
91
+
92
+ (name ... options ...)
93
+
94
+ Name is the actual command string. Options are zero or more tags
95
+ describing what should happen with the output.
96
+
97
+ This is buffer local variable to the rdebug shell buffer.")
98
+
99
+ ;; TODO: Make this buffer-local to the shell buffer.
100
+ (defvar rdebug-inferior-status nil
101
+ "The status of the Ruby program debugged under RDebug.")
102
+
103
+ ;; Unlike the gdb implementation, we don't have to actively update the
104
+ ;; mode line.
105
+ (defvar rdebug-mode-line-process
106
+ '(:eval
107
+ (and (fboundp 'rdebug-display-inferior-status)
108
+ (rdebug-display-inferior-status)))
109
+ "A string representing the current debugger state, or nil.
110
+ The mode line is displayed in all source and secondary buffers.")
111
+ ;; Needed to get :eval to work.
112
+ (put 'rdebug-mode-line-process 'risky-local-variable t)
113
+
114
+
115
+ ;; -------------------------------------------------------------------
116
+ ;; The end.
117
+ ;;
118
+
119
+ (provide 'rdebug-vars)
120
+
121
+ ;;; Local variables:
122
+ ;;; eval:(put 'rdebug-debug-enter 'lisp-indent-hook 1)
123
+ ;;; End:
124
+
125
+ ;;; rdebug-vars.el ends here
@@ -0,0 +1,132 @@
1
+ ;;; rdebug-watch.el --- This file contains code dealing with the Ruby
2
+ ;;; debugger's watch (AKA display) secondary buffer.
3
+
4
+ ;; Copyright (C) 2008 Rocky Bernstein (rocky@gnu.org)
5
+ ;; Copyright (C) 2008 Anders Lindgren
6
+
7
+ ;; $Id: rdebug-watch.el 711 2008-02-20 07:09:17Z andersl $
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
+ ;; See the manual and the file `rdebug.el' for more information.
26
+
27
+ ;;; Code:
28
+
29
+ (require 'rdebug-dbg)
30
+
31
+ (defvar rdebug-watch-mode-map
32
+ (let ((map (make-sparse-keymap)))
33
+ (suppress-keymap map)
34
+ (define-key map "a" 'rdebug-watch-add)
35
+ (define-key map "\C-d" 'rdebug-watch-delete)
36
+ (define-key map "d" 'rdebug-watch-delete)
37
+ (define-key map "e" 'rdebug-watch-edit)
38
+ (define-key map "\r" 'rdebug-watch-edit)
39
+ (rdebug-populate-digit-keys map)
40
+ (rdebug-populate-secondary-buffer-map map)
41
+
42
+ ;; --------------------
43
+ ;; The "Watch window" submenu.
44
+ (let ((submenu (make-sparse-keymap)))
45
+ (define-key-after map [menu-bar debugger watch]
46
+ (cons "Watch window" submenu)
47
+ 'placeholder))
48
+
49
+ (define-key map [menu-bar debugger watch delete]
50
+ '(menu-item "Delete" rdebug-watch-delete
51
+ :enable (eq major-mode 'rdebug-watch-mode)))
52
+ (define-key map [menu-bar debugger watch goto]
53
+ '(menu-item "Edit" rdebug-watch-edit
54
+ :enable (eq major-mode 'rdebug-watch-mode)))
55
+ (define-key map [menu-bar debugger watch add]
56
+ '(menu-item "Add" rdebug-watch-add))
57
+
58
+ map)
59
+ "Keymap used in the watch buffer in the `rdebug' Ruby debugger.")
60
+
61
+ (defun rdebug-display-watch-buffer ()
62
+ "Display the rdebug watch buffer."
63
+ (interactive)
64
+ (rdebug-display-secondary-buffer "watch"))
65
+
66
+ (defun rdebug-watch-mode ()
67
+ "Major mode for displaying watched expressions in the `rdebug' Ruby debugger.
68
+
69
+ \\{rdebug-watch-mode}"
70
+ (interactive)
71
+ (kill-all-local-variables)
72
+ (setq major-mode 'rdebug-watch-mode)
73
+ (setq mode-name "RDEBUG Watch")
74
+ (setq buffer-read-only t)
75
+ (setq truncate-lines t)
76
+ (set (make-local-variable 'rdebug-secondary-buffer) t)
77
+ (setq mode-line-process 'rdebug-mode-line-process)
78
+ (set (make-local-variable 'font-lock-defaults)
79
+ '(rdebug-variables-font-lock-keywords))
80
+ (use-local-map rdebug-watch-mode-map)
81
+ (run-mode-hooks 'rdebug-watch-mode-hook))
82
+
83
+ (defun rdebug-setup-watch-buffer (buf comint-buffer)
84
+ "Set up the rdebug debugger watch secondary buffer.
85
+
86
+ This buffer contains display expressions. BUF is the buffer to set up and COMINT-BUFFER be the assocated gud process buffer."
87
+ (rdebug-debug-enter "rdebug-setup-watch-buffer"
88
+ (with-current-buffer buf
89
+ (rdebug-watch-mode)
90
+ (set (make-local-variable 'gud-comint-buffer) comint-buffer))))
91
+
92
+ (defun rdebug-watch-add (expr)
93
+ "Add EXPR to watch in the `rdebug' Ruby debugger."
94
+ (interactive "sRuby expression: ")
95
+ (if (not (string= expr ""))
96
+ (gud-call (format "display %s" expr))))
97
+
98
+
99
+ (defun rdebug-watch-delete ()
100
+ "Delete a display expression in the `rdebug' Ruby debugger."
101
+ (interactive)
102
+ (save-excursion
103
+ (beginning-of-line)
104
+ (if (looking-at "^\\([0-9]+\\):")
105
+ (gud-call (format "undisplay %s" (match-string 1))))))
106
+
107
+ (defun rdebug-watch-edit (number expr)
108
+ "Edit a display expression in the `rdebug' Ruby debugger.
109
+ Argument NUMBER is the display expression number.
110
+ Argument EXPR is the expression for display number NUMBER."
111
+ (interactive
112
+ (let ((number nil)
113
+ (expr nil))
114
+ (save-excursion
115
+ (beginning-of-line)
116
+ (when (looking-at "^\\([0-9]+\\): *\\([^=]*[^= ]\\) *=")
117
+ (setq number (match-string 1))
118
+ (setq expr (match-string 2))
119
+ (setq expr (read-from-minibuffer "Ruby expression: " expr)))
120
+ (list number expr))))
121
+ (when expr
122
+ (gud-call (format "undisplay %s" number))
123
+ (gud-call (format "display %s" expr))))
124
+
125
+
126
+ (provide 'rdebug-watch)
127
+
128
+ ;;; Local variables:
129
+ ;;; eval:(put 'rdebug-debug-enter 'lisp-indent-hook 1)
130
+ ;;; End:
131
+
132
+ ;;; rdebug-watch.el ends here
@@ -0,0 +1,326 @@
1
+ ;;; rdebug.el --- Ruby debugger user interface, startup file.
2
+
3
+ ;; Copyright (C) 2006, 2007, 2008 Rocky Bernstein (rocky@gnu.org)
4
+ ;; Copyright (C) 2007, 2008 Anders Lindgren
5
+
6
+ ;; $Id: rdebug.el 409 2007-12-14 02:36:37Z 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
+ ;;
26
+ ;; Introduction:
27
+ ;;
28
+ ;; This is a full-blown debugger user interface to the Ruby rdebug
29
+ ;; debugger shell.
30
+ ;;
31
+ ;; The main features are:
32
+ ;;
33
+ ;; * Window layout with dedicated windows for:
34
+ ;; + Local and member variables
35
+ ;; + Stack trace
36
+ ;; + Display expressions
37
+ ;; + Breakpoints
38
+ ;; + Output
39
+ ;; + Debugger Shell
40
+ ;;
41
+ ;; * Source-level debugging:
42
+ ;; + The current source file is shown and current line is marked.
43
+ ;; + Function keys bindings for effective stepping in the source code.
44
+ ;; + A "Debugger" menu for easy access to all features.
45
+ ;;
46
+ ;; * A number of predefined window layouts and key bindings are
47
+ ;; supplied, including binding that emulate Eclipse and NetBeans.
48
+ ;; The user can easily provide their own window layout and
49
+ ;; settings.
50
+ ;;
51
+ ;; The default window layout looks like the following:
52
+ ;;
53
+ ;; +----------------------------------------------------------------------+
54
+ ;; | Toolbar |
55
+ ;; +-----------------------------------+----------------------------------+
56
+ ;; | Debugger shell | Variables buffer |
57
+ ;; +-----------------------------------+----------------------------------+
58
+ ;; | | |
59
+ ;; | Source buffer | Output buffer |
60
+ ;; | | |
61
+ ;; +-----------------------------------+----------------------------------+
62
+ ;; | Stack buffer | Breakpoints buffer |
63
+ ;; +-----------------------------------+----------------------------------+
64
+ ;;
65
+
66
+ ;;
67
+ ;; Installation:
68
+ ;;
69
+ ;; To use this package, place the following line in an appropriate
70
+ ;; init file (for example ~/.emacs):
71
+ ;;
72
+ ;; (require 'rdebug)
73
+ ;;
74
+
75
+ ;;
76
+ ;; History and Future:
77
+ ;;
78
+ ;; The design of this debugger user interface was inspired by
79
+ ;; `gdb-ui', a similar user interface to GDB.
80
+ ;;
81
+ ;; Hopefully, rdebug, gdb-ui, and other emacs user interfaces could
82
+ ;; join forces to create a common user-level look and feel, and a
83
+ ;; battery of underlying support functions.
84
+ ;;
85
+
86
+ ;;
87
+ ;; This file contains only user-customizable variables and code to
88
+ ;; load the other files when needed.
89
+ ;;
90
+
91
+ ;;; Code:
92
+
93
+ ;; -------------------------------------------------------------------
94
+ ;; Consistency checks.
95
+ ;;
96
+
97
+ (if (< emacs-major-version 22)
98
+ (error
99
+ "This version of rdebug.el needs at least Emacs 22 or greater - you have version %d."
100
+ emacs-major-version))
101
+
102
+
103
+ ;; -------------------------------------------------------------------
104
+ ;; Support functions.
105
+ ;;
106
+
107
+ (defun rdebug-directory ()
108
+ "The directory of this file, or nil."
109
+ (let ((file-name (or load-file-name
110
+ (symbol-file 'rdebug-directory))))
111
+ (if file-name
112
+ (file-name-directory file-name)
113
+ nil)))
114
+
115
+
116
+ (defun rdebug-compare-filenames (f1 f2)
117
+ "Canonicalize and compare file names."
118
+ ;; Canonicalize by:
119
+ ;; 1) file-truename ensures that the file has got the correct case,
120
+ ;; and that "..":s in the path are eliminated.
121
+ ;; 2) file-name-as-directory ensures "/foo" and "/foo/" becomes equal.
122
+
123
+ ;; Note: for some reason, when the `comp-elisp' external program is
124
+ ;; used, `nil' is part of `load-path'.
125
+ (if f1
126
+ (setq f1 (file-name-as-directory (file-truename f1))))
127
+ (if f2
128
+ (setq f2 (file-name-as-directory (file-truename f2))))
129
+ (equal f1 f2))
130
+
131
+
132
+ ;; Add the directory of `rdebug.el' to the load-path. This ensures
133
+ ;; that all the user have do to use this package is to load this file.
134
+ (let ((dir (rdebug-directory)))
135
+ (if dir
136
+ (add-to-list 'load-path dir nil 'rdebug-compare-filenames)))
137
+
138
+
139
+ ;; -------------------------------------------------------------------
140
+ ;; Autoloads.
141
+ ;;
142
+
143
+ (autoload 'rdebug "rdebug-core"
144
+ "Run the rdebug Ruby debugger and start the Emacs user interface.
145
+
146
+ By default, the \"standard\" user window layout looks like the following:
147
+
148
+ +----------------------------------------------------------------------+
149
+ | Toolbar |
150
+ +-----------------------------------+----------------------------------+
151
+ | Debugger shell | Variables buffer |
152
+ +-----------------------------------+----------------------------------+
153
+ | | |
154
+ | Source buffer | Output buffer |
155
+ | | |
156
+ +-----------------------------------+----------------------------------+
157
+ | Stack buffer | Breakpoints buffer |
158
+ +-----------------------------------+----------------------------------+
159
+
160
+ The variable `rdebug-many-windows-layout-function' can be
161
+ customized so that another layout is used. In addition to a
162
+ number of predefined layouts it's possible to define a function
163
+ to perform a custom layout.
164
+
165
+ If `rdebug-many-windows' is nil, only a traditional debugger
166
+ shell and source window is opened.
167
+
168
+ The directory containing the debugged script becomes the initial
169
+ working directory and source-file directory for your debugger.
170
+
171
+ The custom variable `gud-rdebug-command-name' sets the command
172
+ and options used to invoke rdebug." t)
173
+
174
+
175
+ (autoload 'rdebug-turn-on-debugger-support "rdebug-source"
176
+ "Enable extra source buffer support for the `rdebug' Ruby debugger.
177
+
178
+ This includes a 'Debugger' menu and special key bindings when the
179
+ debugger is active."
180
+ t)
181
+
182
+
183
+ (autoload 'rdebug-track-attach "rdebug-track"
184
+ "Do things to make the current process buffer work like a
185
+ rdebug command buffer." t)
186
+
187
+ (autoload 'turn-on-rdebug-track-mode "rdebug-track"
188
+ "Turn on rdebugtrack mode.
189
+
190
+ This function is designed to be added to hooks, for example:
191
+ (add-hook 'comint-mode-hook 'turn-on-rdebugtrack-mode)"
192
+ t)
193
+
194
+
195
+ (add-hook 'ruby-mode-hook 'rdebug-turn-on-debugger-support)
196
+
197
+ ;; This is needed, or at least the docstring part of it is needed to
198
+ ;; get the customization menu to work in Emacs 23.
199
+ (defgroup rdebug nil
200
+ "The Ruby debugger"
201
+ :group 'processes
202
+ :group 'tools)
203
+
204
+ ;; -------------------------------------------------------------------
205
+ ;; User definable variables
206
+ ;;
207
+
208
+ (defcustom gud-rdebug-command-name
209
+ "rdebug --emacs 3"
210
+ "File name for executing the Ruby debugger and command options.
211
+ This should be an executable on your path, or an absolute file name."
212
+ :type 'string
213
+ :group 'gud)
214
+
215
+ (defcustom rdebug-line-width 120
216
+ "Length of line before truncation occurs.
217
+ This value limits output in secondary buffers."
218
+ :type 'integer
219
+ :group 'rdebug)
220
+
221
+ (defcustom rdebug-many-windows t
222
+ "*If non-nil, use the full debugger user interface, see `rdebug'.
223
+
224
+ However only set to the multi-window display if the rdebug
225
+ command invocation has an annotate options (\"--annotate 3\")."
226
+ :type 'boolean
227
+ :group 'rdebug)
228
+
229
+ (defcustom rdebug-use-separate-io-buffer t
230
+ "*If non-nil, output goes to a dedicated windows.
231
+
232
+ This only applies when `rdebug-many-windows' is non-nil."
233
+ :type 'boolean
234
+ :group 'rdebug)
235
+
236
+ (defcustom rdebug-populate-common-keys-function
237
+ 'rdebug-populate-common-keys-standard
238
+ "The function to call to populate key bindings common to all rdebug windows.
239
+ This includes the secondary windows, the debugger shell, and all
240
+ Ruby source buffers when the debugger is active.
241
+
242
+ This variable can be bound to the following:
243
+
244
+ * nil -- Don't bind any keys.
245
+
246
+ * `rdebug-populate-common-keys-standard' -- Bind according to a widely used
247
+ debugger convention:
248
+
249
+ \\{rdebug-example-map-standard}
250
+
251
+ * `rdebug-populate-common-keys-eclipse' -- Bind according to Eclipse.
252
+
253
+ \\{rdebug-example-map-eclipse}
254
+
255
+ * `rdebug-populate-common-keys-netbeans' -- Bind according to NetBeans.
256
+
257
+ \\{rdebug-example-map-netbeans}
258
+
259
+ * Any other value is expected to be a callable function that takes one
260
+ argument, the keymap, and populates it with suitable keys."
261
+ :type 'function
262
+ :group 'rdebug)
263
+
264
+ (defcustom rdebug-restore-original-window-configuration :many
265
+ "*Control if the original window layout is restored when the debugger exits.
266
+ The value can be t, nil, or :many.
267
+
268
+ A value of t means that the original layout is always restored,
269
+ nil means that it's never restored.
270
+
271
+ :many means that the original layout is restored only when
272
+ `rdebug-many-windows' is used."
273
+ :type '(choice (const :tag "Always restore" t)
274
+ (const :tag "Never restore" nil)
275
+ (const :tag "Restore in many windows mode" :many))
276
+ :group 'rdebug)
277
+
278
+ (defcustom rdebug-use-separate-io-buffer t
279
+ "Non-nil means display output from the debugged program in a separate buffer."
280
+ :type 'boolean
281
+ :group 'gud)
282
+
283
+
284
+ (defcustom rdebug-window-layout-function
285
+ 'rdebug-window-layout-standard
286
+ "*A function that performs the window layout of `rdebug'.
287
+
288
+ This is only used in `rdebug-many-windows' mode. This should be
289
+ bound to a function that performs the actual window layout. The
290
+ function should takes two arguments, the first is the source
291
+ buffer and the second the name of the script to debug.
292
+
293
+ Rdebug provides the following predefined layout functions:
294
+
295
+ * `rdebug-window-layout-standard' -- See `rdebug'
296
+
297
+ * `rdebug-window-layout-no-shell' -- Standard + Display, no Shell
298
+
299
+ * `rdebug-window-layout-conservative' -- Source + Shell + Output
300
+
301
+ * `rdebug-window-layout-stack-of-windows' -- Extra windows to the right
302
+
303
+ * `rdebug-window-layout-rocky' -- Rocky's own layout"
304
+ :type
305
+ '(choice
306
+ (function :tag "Standard" rdebug-window-layout-standard)
307
+ (function :tag "Conservative" rdebug-window-layout-conservative)
308
+ (function :tag "Stack of windows" rdebug-window-layout-stack-of-windows)
309
+ (function :tag "Rocky's own" rdebug-window-layout-rocky)
310
+ (function :tag "Rocky's II" rdebug-window-layout-rocky2)
311
+ (function :tag "Other" function))
312
+ :group 'rdebug)
313
+
314
+ (defcustom rdebug-source-location-ring-size 150
315
+ "Size of rdebug position history ring."
316
+ :type 'integer
317
+ :group 'rdebug)
318
+
319
+
320
+ ;; -------------------------------------------------------------------
321
+ ;; The end.
322
+ ;;
323
+
324
+ (provide 'rdebug)
325
+
326
+ ;;; rdebug.el ends here