++-----------------------------------+----------------------------------+
+
+To run GDB in text command mode, replace the GDB \"--annotate=3\"
+option with \"--fullname\" either in the minibuffer for the
+current Emacs session, or the custom variable
+`gud-gdb-command-name' for all future sessions. You need to use
+text command mode to debug multiple programs within one Emacs
+session."
+ (interactive (list (gud-query-cmdline 'gdb)))
+
+ (when (and gud-comint-buffer
+ (buffer-name gud-comint-buffer)
+ (get-buffer-process gud-comint-buffer)
+ (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)))
+ (gdb-restore-windows)
+ (error
+ "Multiple debugging requires restarting in text command mode"))
+
+ (gud-common-init command-line nil 'gud-gdba-marker-filter)
+ (set (make-local-variable 'gud-minor-mode) 'gdba)
+ (setq comint-input-sender 'gdb-send)
+
+ (gud-def gud-break "break %f:%l" "\C-b" "Set breakpoint at current line.")
+ (gud-def gud-tbreak "tbreak %f:%l" "\C-t"
+ "Set temporary breakpoint at current line.")
+ (gud-def gud-remove "clear %f:%l" "\C-d" "Remove breakpoint at current line")
+ (gud-def gud-step "step %p" "\C-s" "Step one source line with display.")
+ (gud-def gud-stepi "stepi %p" "\C-i" "Step one instruction with display.")
+ (gud-def gud-next "next %p" "\C-n" "Step one line (skip functions).")
+ (gud-def gud-nexti "nexti %p" nil "Step one instruction (skip functions).")
+ (gud-def gud-cont "cont" "\C-r" "Continue with display.")
+ (gud-def gud-finish "finish" "\C-f" "Finish executing current function.")
+ (gud-def gud-jump
+ (progn (gud-call "tbreak %f:%l") (gud-call "jump %f:%l"))
+ "\C-j" "Set execution address to current line.")
+
+ (gud-def gud-up "up %p" "<" "Up N stack frames (numeric arg).")
+ (gud-def gud-down "down %p" ">" "Down N stack frames (numeric arg).")
+ (gud-def gud-print "print %e" "\C-p" "Evaluate C expression at point.")
+ (gud-def gud-pstar "print* %e" nil
+ "Evaluate C dereferenced pointer expression at point.")
+
+ ;; For debugging Emacs only.
+ (gud-def gud-pv "pv1 %e" "\C-v" "Print the value of the lisp variable.")
+
+ (gud-def gud-until "until %l" "\C-u" "Continue to current line.")
+ (gud-def gud-run "run" nil "Run the program.")
+
+ (local-set-key "\C-i" 'gud-gdb-complete-command)
+ (setq comint-prompt-regexp "^(.*gdb[+]?) *")
+ (setq paragraph-start comint-prompt-regexp)
+ (setq gdb-output-sink 'user)
+ (setq gdb-first-prompt t)
+ (setq gud-running nil)
+ (setq gdb-ready nil)
+ (setq gdb-flush-pending-output nil)
+ (setq gdb-early-user-input nil)
+ (setq gud-filter-pending-text nil)
+ (run-hooks 'gdb-mode-hook))
+
+;; Keep as an alias for compatibility with Emacs 22.1.
+;;;###autoload
+(defalias 'gdba 'gdb)