I have two small patches that solve two problems I had when using the
Ruby debugger (debug.rb) from XEmacs. I use Ruby 1.8.3 (2005-06-23)
[i486-linux] and rubydb3x.el on XEmacs 21.4.
The first problem was that setting breakpoints from within a Ruby file
buffer (using C-x C-a C-b, i.e. gud-break) didn't work. The patch is
against rubydb3x.el:
--- rubydb3x.el.orig 2005-10-05 13:04:23.000000000 +0200
+++ rubydb3x.el 2005-10-05 13:04:33.000000000 +0200
@@ -97,7 +97,7 @@
(gud-find-file . gud-rubydb-find-file)))
(gud-common-init command-line rubydb-command-name))
- (gud-def gud-break "b %l" "\C-b" "Set breakpoint at current line.")
+ (gud-def gud-break "b %d%f:%l" "\C-b" "Set breakpoint at current line.")
; (gud-def gud-remove "clear %l" "\C-d" "Remove breakpoint at current line")
(gud-def gud-step "s" "\C-s" "Step one source line with display.")
(gud-def gud-next "n" "\C-n" "Step one line (skip functions).")
The second problem was that using the "up" and "down" debugger
commands to move up and down the callstack from a breakpoint did not
make XEmacs jump to the corresponding line in the Ruby editor
buffer. The patch is against the debug.rb file:
--- debug.rb.orig 2005-10-05 13:04:47.000000000 +0200
+++ debug.rb 2005-10-05 13:04:58.000000000 +0200
@@ -457,7 +457,7 @@
stdout.print "At toplevel\n"
end
binding, binding_file, binding_line = @frames[frame_pos]
- stdout.print format_frame(frame_pos)
+ stdout.print format_frame_emacs(frame_pos)
when /^\s*down(?:\s+(\d+))?$/
previous_line = nil
@@ -472,7 +472,7 @@
stdout.print "At stack bottom\n"
end
binding, binding_file, binding_line = @frames[frame_pos]
- stdout.print format_frame(frame_pos)
+ stdout.print format_frame_emacs(frame_pos)
when /^\s*fin(?:ish)?$/
if frame_pos == @frames.size
@@ -620,6 +620,16 @@
(id ? ":in `#{id.id2name}'" : "")
end
+ def format_frame_emacs(pos)
+ bind, file, line, id = @frames[pos]
+ if ENV['EMACS']
+ stdout.printf "\032\032%s:%d:\n", file, line
+ else
+ sprintf "#%d %s:%s%s\n", pos + 1, file, line,
+ (id ? ":in `#{id.id2name}'" : "")
+ end
+ end
···
+
def display_list(b, e, file, line)
stdout.printf "[%d, %d] in %s\n", b, e, file
if lines = SCRIPT_LINES__[file] and lines != true
Olaf