 
       (setcdr (assq 'rdebug-debugger-support-minor-mode minor-mode-map-alist)
               rdebug-debugger-support-minor-mode-map-when-active)
-      (when rdebug-many-windows (rdebug-setup-windows-initially))
+      (when rdebug-many-windows
+        (rdebug-setup-windows-initially))
 
       (run-hooks 'rdebug-mode-hook))))
+
+
+(defun rdebug-set-windows (&optional name)
+  "Rename the processor buffer to correspond to script name NAME.
+
+When `rdebug-many-windows' is non-nil, the initial debugger
+window layout is used."
+  (interactive "sProgram name: ")
+  (rdebug-debug-enter "rdebug-set-windows"
+    (rdebug-set-window-configuration-state 'debugger t)
+    (rdebug-common-initialization)
+    (when name
+      (setq gud-target-name name)
+      (setq gud-comint-buffer (current-buffer)))
+    (when gud-last-frame
+      (setq gud-last-last-frame gud-last-frame))
+    (rename-buffer (format "*rdebug-cmd-%s*" gud-target-name))
+
+    (setcdr (assq 'rdebug-debugger-support-minor-mode minor-mode-map-alist)
+            rdebug-debugger-support-minor-mode-map-when-active)
+    (when rdebug-many-windows
+      (rdebug-setup-windows))))
 
 
 (defun rdebug-quit ()

  (message
   "Type `M-x rdebug-display-original-window-configuration RET' to restore."))

(defun rdebug-set-windows (&optional name)
  "Rename the processor buffer to correspond to script name NAME.

When `rdebug-many-windows' is non-nil, the initial debugger
window layout is used."
  (interactive "sProgram name: ")
  (when name
    (setq gud-target-name name)
    (setq gud-comint-buffer (current-buffer)))
  (when gud-last-frame
    (setq gud-last-last-frame gud-last-frame))
  (rename-buffer (format "*rdebug-cmd-%s*" gud-target-name))
  (when rdebug-many-windows
    (rdebug-setup-windows)))

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


      (when rdebug-buffer (kill-buffer rdebug-buffer))
      (rename-buffer rdebug-buffer-name)

      (rdebug-common-initialization)

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