   "^\\ +\\([0-9]+\\) \\([yn]\\) +at +\\(.+\\):\\([0-9]+\\)$"
   "Regexp to recognize breakpoint lines in rdebug breakpoint buffers.")
 
-(defun rdebug--setup-breakpoints-buffer (buf name)
+(defun rdebug--setup-breakpoints-buffer (buf comint-buffer)
   "Detects breakpoint lines and sets up keymap and mouse navigation."
   (rdebug-debug-enter "rdebug--setup-breakpoints-buffer"
   (with-current-buffer buf
     (let ((inhibit-read-only t) (flag))
       (rdebug-breakpoints-mode)
-      (set (make-local-variable 'gud-target-name) name)
+      (set (make-local-variable 'gud-comint-buffer) comint-buffer)
       (goto-char (point-min))
       (while (not (eobp))
         (let ((b (line-beginning-position)) (e (line-end-position)))

  (if (eq rdebug-window-configuration-state 'original)
      (setq rdebug-original-window-configuration
            (current-window-configuration)))
  (setq rdebug-window-configuration-state 'debugger)
  ; Parse the command line and pick out the script name and whether --annotate
  ; has been set.
  (let* ((words (split-string-and-unquote command-line))

            (goto-char (point-max))
            ;; 32 = space.
            (insert (make-string (* 4 rdebug-debug-depth) 32))
            (insert (apply #'format args))
            (insert "\n"))))))


(defmacro rdebug-debug-enter (str &rest body)
  (declare (indent 1) (debug t))
  `(progn
     (rdebug-debug-message "--> %s" ,str)
     (setq rdebug-debug-depth (+ rdebug-debug-depth 1))
     (unwind-protect
         (progn
           ,@body)
       (setq rdebug-debug-depth (max 0 (- rdebug-debug-depth 1)))
       (rdebug-debug-message "<-- %s" ,str))))


;; Interface to gud.
