   (rdebug-debug-enter "rdebug-process-annotation"
   (let ((buf (get-buffer-create (format "*rdebug-%s-%s*" name gud-target-name)))
         ;; Buffer local, doesn't survive the buffer change.
-        (target-name gud-target-name))
+        (comint-buffer gud-comint-buffer))
     (with-current-buffer buf
       (setq buffer-read-only t)
       (let ((inhibit-read-only t)
             (setup-func (gethash name rdebug--annotation-setup-map)))
         (erase-buffer)
         (insert contents)
-        (when setup-func (funcall setup-func buf target-name)))))))
+        (when setup-func (funcall setup-func buf comint-buffer)))))))
 
 (defun rdebug-setup-windows ()
   "Layout the window pattern for `rdebug-many-windows'. This was mostly copied

  "Restore the original window configuration when the debugger process exits."
  (gud-sentinel process event)
  (rdebug-debug-enter "rdebug-process-sentinel"
    (rdebug-debug-message "status=%S event=%S state=%S\n"
                          (process-status process)
                          event
                          rdebug-window-configuration-state)

  :type 'boolean
  :group 'rdebug)

(defcustom rdebug-restore-original-window-configuration :many
  "*Control if the original window layout is restored when the debugger exits.
The value can be t, nil, or :many.

A value of t means that the original layout is always restored,
nil means that it's never restored.

:many means that the original layout is restored only when
`rdebug-many-windows' is used."
  :type '(choice (const :tag "Always restore" t)
		 (const :tag "Never restore" nil)
		 (const :tag "Restore in many windows mode" :many))
  :group 'rdebug)

(defgroup rdebugtrack nil
