   "Display the rdebug display buffer."
   (interactive)
   (rdebug-display-secondary-buffer "display"))
+
+(defun rdebug-display-output-buffer ()
+  "Display the rdebug output buffer."
+  (interactive)
+  (rdebug-display-secondary-buffer "output"))
 
 (defun rdebug-display-variables-buffer ()
   "Display the rdebug variables buffer."

    (setq paragraph-start comint-prompt-regexp)
    
    (setq paragraph-start comint-prompt-regexp)
    (when rdebug-many-windows (rdebug-setup-windows))
    
    (run-hooks 'rdebug-mode-hook))
  ))

      (setq buffer-read-only t)
      (let ((inhibit-read-only t)
            (setup-func (gethash name rdebug--annotation-setup-map)))
        (if (string= name "output")
            (goto-char (point-max))
          (erase-buffer))
        (insert contents)
        (when setup-func (funcall setup-func buf comint-buffer)))))))


;;
;; Window layout
;;

(defun rdebug-many-windows-layout-standard (src-buf name)
  "The default rdebug window layout, see `rdebug' for more information."
  (delete-other-windows)
  (split-window nil ( / ( * (window-height) 3) 4))
  (split-window nil ( / (window-height) 3))
  (split-window-horizontally)
  (other-window 1)
  (set-window-buffer
   (selected-window) (rdebug-get-buffer "variables" name))
  (other-window 1)
  (switch-to-buffer src-buf)
  (other-window 1)
  (set-window-buffer
   (selected-window) (rdebug-get-buffer "stack" name))
  (split-window-horizontally)
  (other-window 1)
  (set-window-buffer
   (selected-window) (rdebug-get-buffer "breakpoints" name))
  (other-window 1)
  (goto-char (point-max)))

(defun rdebug-many-windows-layout-conservative (src-buf name)
  "A conservative rdebug window layout with three windows.

This window layout mimics the traditional debugger shell and
source window layout, it only add one secondary window.
Initially, the secondary window displays output of the debugged
process, but any secondary buffer can be displayed, press `?' in
the window for more details."
  (delete-other-windows)
  (split-window-horizontally)
  (other-window 1)
  (switch-to-buffer src-buf)
  (other-window 1)
  (split-window nil 20)
  (set-window-buffer
   (selected-window) (rdebug-get-buffer "output" name))
  (other-window 1))

(defun rdebug-many-windows-layout-stack-of-secondary-windows (src-buf name)
  "A rdebug window layout with several secondary windows to the right.
The debugger shell and the source code window is to the left."
  (delete-other-windows)
  (split-window-horizontally)
  (split-window nil 20)
  (set-window-buffer
   (selected-window) (rdebug-get-buffer "cmd" name))
  (other-window 1)
  (switch-to-buffer src-buf)
  (other-window 1)
  (split-window)
  (split-window)
  (set-window-buffer
   (selected-window) (rdebug-get-buffer "variables" name))
  (other-window 1)
  (set-window-buffer
   (selected-window) (rdebug-get-buffer "stack" name))
  (other-window 1)
  (split-window)
  (set-window-buffer
   (selected-window) (rdebug-get-buffer "output" name))
  (other-window 1)
  (set-window-buffer
   (selected-window) (rdebug-get-buffer "breakpoints" name))
  (other-window 1))


(defun rdebug-setup-windows ()
  "Layout the window pattern for `rdebug-many-windows'. This was mostly copied
from `gdb-setup-windows', but simplified."
  (rdebug-debug-enter "rdebug-setup-windows"
  (pop-to-buffer gud-comint-buffer)
  (rdebug-process-annotation "help" "")
  (let ((buf
         (cond (gud-last-last-frame
                (gud-find-file (car gud-last-last-frame)))
               (gud-target-name
                (gud-find-file gud-target-name))
               (t
                ;; Put buffer list in window if we
                ;; can't find a source file.
                (list-buffers-noselect)))))
    (funcall rdebug-many-windows-layout-function buf gud-target-name))
  (rdebug-set-window-configuration-state 'debugger)))


(defun rdebug-setup-windows-initially ()
  "Like `rdebug-setup-windows', but erase the content of accumulative windows.
This is called when the debugger starts."
  (let ((buf (get-buffer (format "*rdebug-output-%s*" gud-target-name))))
    (if buf
        (with-current-buffer buf
          (let ((inhibit-read-only t))
            (erase-buffer)))))
  (rdebug-setup-windows))

(defun rdebug-get-buffer (name script-name)
  (get-buffer-create (format "*rdebug-%s-%s*" name script-name)))


(defun rdebug-restore-windows ()
  "Equivalent of `gdb-restore-windows' for rdebug."
  (interactive)
