   :type 'boolean
   :group 'rdebug)
 
+(defcustom rdebug-restore-original-frame-configuration t
+  "*If non-nil, the original window layout is restored when debugger exits."
+  :type 'boolean
+  :group 'rdebug)
+
 (defgroup rdebugtrack nil
   "Rdebug file tracking by watching the prompt."
   :prefix "rdebugtrack"

  (when gud-last-frame (setq gud-last-last-frame gud-last-frame))
  (when rdebug-many-windows
    (rdebug-setup-windows)))

;; Fontification and keymaps for secondary buffers (breakpoints, stack)


    (setq gud-target-name target-name)
    (when rdebug-buffer (kill-buffer rdebug-buffer))
    (rename-buffer rdebug-buffer-name)

    ;; Setup exit callback so that the original frame configuration
    ;; can be restored.
    (let ((process (get-buffer-process gud-comint-buffer)))
      (if process
          (set-process-sentinel process
                                'rdebug-process-sentinel)))

    (set (make-local-variable 'gud-minor-mode) 'rdebug)

