-(defun gud-gdb-complete-command (&optional command a b)
- "Perform completion on the GDB command preceding point.
-This is implemented using the GDB `complete' command which isn't
-available with older versions of GDB."
- (interactive)
- (if command
- ;; Used by gud-watch in mini-buffer.
- (setq command (concat "p " command))
- ;; Used in GUD buffer.
- (let ((end (point)))
- (setq command (buffer-substring (comint-line-beginning-position) end))))
- (let* ((command-word
- ;; Find the word break. This match will always succeed.
- (and (string-match "\\(\\`\\| \\)\\([^ ]*\\)\\'" command)
- (substring command (match-beginning 2))))
- (complete-list
- (gud-gdb-run-command-fetch-lines (concat "complete " command)
+(defun gud-gdb-completions (context command)
+ "Completion table for GDB commands.
+COMMAND is the prefix for which we seek completion.
+CONTEXT is the text before COMMAND on the line."
+ (let* ((start (- (point) (field-beginning)))
+ (complete-list
+ (gud-gdb-run-command-fetch-lines (concat "complete " context command)