       (setq mode-name "RDEBUG Breakpoints")
       (goto-char (point-min))
       (while (not (eobp))
-        (let ((b (point-at-bol)) (e (point-at-eol)))
+        (let ((b (line-beginning-position)) (e (line-end-position)))
           (when (string-match rdebug--breakpoint-regexp
                               (buffer-substring b e))
             (add-text-properties b e

  (interactive "d")
  (save-excursion
    (goto-char pt)
    (let ((s (buffer-substring (point-at-bol) (point-at-eol))))
      (when (string-match rdebug--breakpoint-regexp s)
        (rdebug-display-line
         (substring s (match-beginning 2) (match-end 2))

    map)
  "Keymap to navigate rdebug stack frames.")

(defun rdebug-frames-mode ()
  "Major mode for rdebug frames.

\\{rdebug-frames-mode-map}"
  ; (kill-all-local-variables)
  (interactive "")
  (setq major-mode 'rdebug-frames-mode)
  (setq mode-name "RDEBUG Stack Frames")
  (use-local-map rdebug-frames-mode-map)
  ; (set (make-local-variable 'font-lock-defaults)
  ;     '(gdb-locals-font-lock-keywords))
  (run-mode-hooks 'rdebug-frames-mode-hook))

(defconst rdebug--stack-frame-1st-regexp
  "^\\(-->\\|   \\) +#\\([0-9]+\\)\\(.*\\)"
  "Regexp to recognize the first line of a a stack frame line in rdebug stack buffers.")

(defconst rdebug--stack-frame-2nd-regexp
  "\s+at line +\\([^:]+\\):\\([0-9]+\\)$"
  "Regexp to recognize the second line of a a stack frame line in rdebug stack buffers.")

(defconst rdebug--stack-frame-regexp
  (concat rdebug--stack-frame-1st-regexp rdebug--stack-frame-2nd-regexp)
  "Regexp to recognize a stack frame line in rdebug stack buffers.")

(defun rdebug--setup-stack-buffer (buf)
  "Detects stack frame lines and sets up mouse navigation."
