       (define-key menu [view] (cons "View" submenu)))
 
     (define-key map [menu-bar debugger view output]
-      '(menu-item "Output" rdebug-display-output-buffer))
+      (rdebug-menu-item common-map "Output" 'rdebug-display-output-buffer))
 
     (define-key map [menu-bar debugger view watch]
-      '(menu-item "Watch" rdebug-display-watch-buffer))
+      (rdebug-menu-item common-map "Watch" 'rdebug-display-watch-buffer))
 
     (define-key map [menu-bar debugger view stack]
-      '(menu-item "Stack trace" rdebug-display-stack-buffer))
+      (rdebug-menu-item common-map "Stack trace" 'rdebug-display-stack-buffer))
 
     (define-key map [menu-bar debugger view shell]
-      '(menu-item "Debugger Shell" rdebug-display-cmd-buffer))
+      (rdebug-menu-item common-map "Debugger Shell" 'rdebug-display-cmd-buffer))
 
     (define-key map [menu-bar debugger view variables]
-      '(menu-item "Variables" rdebug-display-variables-buffer))
+      (rdebug-menu-item common-map "Variables" 'rdebug-display-variables-buffer))
 
     (define-key map [menu-bar debugger view breakpoints]
-      '(menu-item "Breakpoints" rdebug-display-breakpoints-buffer))
+      (rdebug-menu-item common-map
+                        "Breakpoints" 'rdebug-display-breakpoints-buffer))
     menu))
 
 

  "History of argument lists passed to rdebug.")

(defconst gud-rdebug-marker-regexp
  "^\\([^:\n]*\\):\\([0-9]*\\).*\n"
  "Regular expression used to find a file location given by rdebug.

Program-location lines look like this:


;; -- General, for all secondary buffers.


(defun rdebug-menu-item (common-map name cmd &rest args)
  "Return a menu item entry with the correct key bindings.

A command can be bound to a number of different key sequences. If
the rdebug common map contains a binding it is displayed in the
menu. (The common map typically contains function key bindings.)"
  (let ((key-binding-list (where-is-internal cmd (list common-map)))
        (hint '()))
    (if key-binding-list
        (setq hint (list :key-sequence (car key-binding-list))))
    (append (list 'menu-item name cmd)
            hint
            args)))


;; Note, we re-populate the menus of the different minor and major
;; modes. The reason is that Emacs caches the key bindings, which
;; means that wrong ones are shown when buffers are changed.
