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

    (define-key gud-menu-map [tbreak]    '("Temporary break" . gud-tbreak))
    (define-key gud-menu-map [up]        '("Up Stack" . gud-up))
    (define-key gud-menu-map [where]     '("Show stack trace" . gud-where))
    
    (local-set-key [menu-bar debug finish] '("Finish Function" . gud-finish))
    (local-set-key [menu-bar debug up] '("Up Stack" . gud-up))
    (local-set-key [menu-bar debug down] '("Down Stack" . gud-down))
    
    (setq comint-prompt-regexp "^(rdb:-) ")
    (setq paragraph-start comint-prompt-regexp)
    
    (setq paragraph-start comint-prompt-regexp)
    (when rdebug-many-windows (rdebug-setup-windows-initially))
    
    (run-hooks 'rdebug-mode-hook))
  ))
;)


(defvar rdebug-frames-mode-map
  (let ((map (make-sparse-keymap)))
    (define-key map [mouse-1] 'rdebug-goto-stack-frame-mouse)
    (define-key map [mouse-2] 'rdebug-goto-stack-frame-mouse)
    (define-key map [mouse-3] 'rdebug-goto-stack-frame-mouse)
    (define-key map [(control m)] 'rdebug-goto-stack-frame)
    (rdebug-populate-secondary-buffer-map map)

    ;; --------------------
    ;; The "Stack window" submeny.
    (let ((submenu (make-sparse-keymap)))
      (define-key-after map [menu-bar debugger stack]
        (cons "Stack window" submenu)
        'placeholder))

    (define-key map [menu-bar debugger stack goto]
      '(menu-item "Goto frame" rdebug-goto-stack-frame))
    map)
  "Keymap to navigate rdebug stack frames.")

