rubydebuggingemacsrdebug

turn-on-rdebug-track-mode shows wrong line number in emacs


I'm debugging a pretty large rails project and I've found the rdebug library for emacs to be a huge help. One annoyance, however, has been the pointer in the source showing the wrong line. In the example below, the code is executing line #277 (as shown in the left hand terminal) but the pointer in the code is on the next line (shown in the right hand terminal).

rdebug track mode points to wrong line in source

Does anyone have any ideas on how to track down this bug? I think this is in the ruby-debug-extras package but I haven't done any hacking on emacs so I don't even know the right mailing list to report this bug to.


Solution

  • I can't claim to understand elisp or emacs functions particularly well, but I had the same problem (and some other issues too), and worked out a hack in this commit of my fork of ruby-debug-extra. The patch just adjusts the lineno variable by one:

    --- a/emacs/rdebug-track.el
    +++ b/emacs/rdebug-track.el
    @@ -212,8 +212,8 @@ problem as best as we can determine."
           "line number cue not found"
         ;;else
         (let* ((filename (match-string rdebug-marker-regexp-file-group block-str))
    -           (lineno (string-to-number
    -           (match-string rdebug-marker-regexp-line-group block-str)))
    +           (lineno (- (string-to-number
    +                    (match-string rdebug-marker-regexp-line-group block-str)) 1))