# Rdebug / emacs / gud

**URL:** <https://www.ruby-forum.com/t/rdebug-emacs-gud/116122>\
**Category:** Ruby\
**Created:** [October 2, 2007, 5:00pm UTC](https://www.ruby-forum.com/t/rdebug-emacs-gud/116122 "2007-10-02T17:00:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimweirich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ce73a5/32.png) [@jimweirich](https://www.ruby-forum.com/u/jimweirich)\
**Post date:** [October 2, 2007, 5:00pm UTC](https://www.ruby-forum.com/t/rdebug-emacs-gud/116122/1 "2007-10-02T17:00:22Z")

</div>

I’m trying to run rdebug from within emacs using gud (Grand Unified  
Debugger, or something like that).

I see there is a rdebug.el package for this. And using it gives me the  
ability to set breakpoints by visiting the source file pressing the  
approppriate key bindings, which is nice.

But using GUD in other languages (particularly C) gives more. In  
particular, it will display a window containing the file being debugged  
and indicate the current line executing.

Currently the rdebug.el package is not doing the dynamic source code  
display for me. Is my setup wrong? Is rdebug.el not setup to support  
that? Am I missing something?

Thanks.

– Jim W.

---

<div class="post-metadata">

**Author:** ![jimweirich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ce73a5/32.png) [@jimweirich](https://www.ruby-forum.com/u/jimweirich)\
**Post date:** [October 2, 2007, 8:47pm UTC](https://www.ruby-forum.com/t/rdebug-emacs-gud/116122/2 "2007-10-02T20:47:21Z")

</div>

On Oct 2, 6:00 pm, Jim W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Currently the rdebug.el package is not doing the dynamic source code  
> display for me. Is my setup wrong? Is rdebug.el not setup to support  
> that? Am I missing something?

Probably. I have no problem debugging ruby code with my setup:

Debian/lenny (testing)  
emacs22.1+1-2  
ruby1.8-elisp version 1.8.6.36-3

---

<div class="post-metadata">

**Author:** ![jimweirich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ce73a5/32.png) [@jimweirich](https://www.ruby-forum.com/u/jimweirich)\
**Post date:** [October 3, 2007, 3:53am UTC](https://www.ruby-forum.com/t/rdebug-emacs-gud/116122/3 "2007-10-03T03:53:48Z")

</div>

Alex S. wrote:

> Probably. I have no problem debugging ruby code with my setup:

Thanks. Just to be clear, “no problem” means that you _are_ getting the  
live source update, right?

> Debian/lenny (testing)  
> emacs22.1+1-2  
> ruby1.8-elisp version 1.8.6.36-3

(interesting … what is the -elisp designation on your ruby version  
imply?)

I should have listed my system specs too.

MacOS 10.4.10  
GNU Emacs 22.1.1 (i386-apple-darwin8.10.1, Aquamacs Distribution 1.1)  
(also GNU Emacs 22.1.1 (i386-apple-darwin8.9.1))  
Ruby 1.8.5 [i686-darwin8.8.1]

Also tried on:

Linux/Debian (Linux li19-167)  
GNU Emacs 22.1.1 (i486-pc-linux-gnu)  
ruby 1.8.6 [i686-linux]

Thanks for the feedback.

– Jim W.

---

<div class="post-metadata">

**Author:** ![jimweirich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ce73a5/32.png) [@jimweirich](https://www.ruby-forum.com/u/jimweirich)\
**Post date:** [October 3, 2007, 11:05am UTC](https://www.ruby-forum.com/t/rdebug-emacs-gud/116122/4 "2007-10-03T11:05:41Z")

</div>

On Oct 3, 4:53 am, Jim W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Alex S. wrote:
> 
> > Probably. I have no problem debugging ruby code with my setup:
> 
> Thanks. Just to be clear, “no problem” means that you _are_ getting the  
> live source update, right?

Right. 🙂

> > Debian/lenny (testing)  
> > emacs22.1+1-2  
> > ruby1.8-elisp version 1.8.6.36-3
> 
> (interesting … what is the -elisp designation on your ruby version  
> imply?)

ruby1.8-elisp is a Debian package which adds Emacs Lisp scripts for  
ruby editing and debugging to emacsen (XEmacs or GNU Emacs). The ruby  
itself is 1.8.6, I should have listed it too…

> GNU Emacs 22.1.1 (i486-pc-linux-gnu)  
> ruby 1.8.6 [i686-linux]

May be you are missing the very ruby-elisp files or you have some  
version conflict (\*.el files vs. ruby or \*.el files vs Emacs). 🙂

---

<div class="post-metadata">

**Author:** ![jimweirich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ce73a5/32.png) [@jimweirich](https://www.ruby-forum.com/u/jimweirich)\
**Post date:** [October 4, 2007, 3:25am UTC](https://www.ruby-forum.com/t/rdebug-emacs-gud/116122/5 "2007-10-04T03:25:09Z")

</div>

Alex S. wrote:

> May be you are missing the very ruby-elisp files or you have some  
> version conflict (\*.el files vs. ruby or \*.el files vs Emacs). 🙂

Found the problem: The regexp used to filter the output of rdebug to  
determine the source code line was not correct.

Original Version: “\([^:\n]_\):\([0-9]+\):._\n”

Fixed Version: “^Z^Z\([^:\n]_\):\([0-9]+\)._\n”

(yes, the first two character of the regexp are control-Z)

That fixed it for me. I added the control z’s and removing the second  
colon and now everything is working fine. This leads me to suspect that  
the ruby-debug gem and the rdebug.el emacs file are out of sync.

My ruby-debug gem is version 0.9.3. There are no version markings in  
the rdebug.el file.

– Jim W.

---

<div class="post-metadata">

**Author:** ![jimweirich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ce73a5/32.png) [@jimweirich](https://www.ruby-forum.com/u/jimweirich)\
**Post date:** [November 26, 2007, 1:36am UTC](https://www.ruby-forum.com/t/rdebug-emacs-gud/116122/6 "2007-11-26T01:36:45Z")

</div>

One other thing I forgot to mention. It was not clear to me which rdebug  
was getting referred to. Probably not the one I have been using (since  
it works just fine). The other rdebug.el which is distributed in the  
misc directory of Ruby 1.8.6 is by Martin Nordholts \<enselic@…\>

I’ve added an SVN $Id$ line in the rdebug.el in ruby-debug’s SVN, so  
hopefully this will reduce confusion in the future.

Rocky B. wrote:

> My apologies for not seeing this sooner. It has come to my attention  
> that there is a rdebug.el distributed with Ruby 1.8.6.
> 
> Independently I had been writing/revising my own rdebug.el. and it’s now  
> in ruby-debug’s SVN in the emacs directory. Had I known there was  
> another rdebug.el around, I think I would have tried to avoid that  
> confusion.
> 
> The rdebug.el in SVN a bit more filled out. It probably can be used with  
> 0.9.3 (since I started writing it in that release). But it really should  
> be used with the ruby-debug that is in SVN since rdebug now supports  
> gdb-style annotations. Also the rdebug.el in SVN probably should be used  
> with Emacs 23. (It might however work in Emacs 22).
> 
> I’ll write to the author of the other rdebug.el to see what we can do.  
> Perhaps this can be used to support older Emacs versions.
> 
> As for getting this cleared up so in Ruby 1.8.7, I’m kind of new to this  
> and would appreciate suggestions. At a minimum I will post a tracker  
> ticket.
> 
> My apologies for the confusion.
> 
> Jim W. wrote:
> 
> > Alex S. wrote:
> > 
> > > May be you are missing the very ruby-elisp files or you have some  
> > > version conflict (\*.el files vs. ruby or \*.el files vs Emacs). 🙂
> > 
> > Found the problem: The regexp used to filter the output of rdebug to  
> > determine the source code line was not correct.
> > 
> > Original Version: “\([^:\n]_\):\([0-9]+\):._\n”
> > 
> > Fixed Version: “^Z^Z\([^:\n]_\):\([0-9]+\)._\n”
> > 
> > (yes, the first two character of the regexp are control-Z)
> > 
> > That fixed it for me. I added the control z’s and removing the second  
> > colon and now everything is working fine. This leads me to suspect that  
> > the ruby-debug gem and the rdebug.el emacs file are out of sync.
> > 
> > My ruby-debug gem is version 0.9.3. There are no version markings in  
> > the rdebug.el file.
> > 
> > – Jim W.

---

<div class="post-metadata">

**Author:** ![jimweirich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ce73a5/32.png) [@jimweirich](https://www.ruby-forum.com/u/jimweirich)\
**Post date:** [November 26, 2007, 1:24am UTC](https://www.ruby-forum.com/t/rdebug-emacs-gud/116122/7 "2007-11-26T01:24:29Z")

</div>

My apologies for not seeing this sooner. It has come to my attention  
that there is a rdebug.el distributed with Ruby 1.8.6.

Independently I had been writing/revising my own rdebug.el. and it’s now  
in ruby-debug’s SVN in the emacs directory. Had I known there was  
another rdebug.el around, I think I would have tried to avoid that  
confusion.

The rdebug.el in SVN a bit more filled out. It probably can be used with  
0.9.3 (since I started writing it in that release). But it really should  
be used with the ruby-debug that is in SVN since rdebug now supports  
gdb-style annotations. Also the rdebug.el in SVN probably should be used  
with Emacs 23. (It might however work in Emacs 22).

I’ll write to the author of the other rdebug.el to see what we can do.  
Perhaps this can be used to support older Emacs versions.

As for getting this cleared up so in Ruby 1.8.7, I’m kind of new to this  
and would appreciate suggestions. At a minimum I will post a tracker  
ticket.

My apologies for the confusion.

Jim W. wrote:

> Alex S. wrote:
> 
> > May be you are missing the very ruby-elisp files or you have some  
> > version conflict (\*.el files vs. ruby or \*.el files vs Emacs). 🙂
> 
> Found the problem: The regexp used to filter the output of rdebug to  
> determine the source code line was not correct.
> 
> Original Version: “\([^:\n]_\):\([0-9]+\):._\n”
> 
> Fixed Version: “^Z^Z\([^:\n]_\):\([0-9]+\)._\n”
> 
> (yes, the first two character of the regexp are control-Z)
> 
> That fixed it for me. I added the control z’s and removing the second  
> colon and now everything is working fine. This leads me to suspect that  
> the ruby-debug gem and the rdebug.el emacs file are out of sync.
> 
> My ruby-debug gem is version 0.9.3. There are no version markings in  
> the rdebug.el file.
> 
> – Jim W.
