Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8526517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:17:39+00:00 2026-06-11T08:17:39+00:00

When I run gdb within emacs (with M-x gdb ) and I try to

  • 0

When I run gdb within emacs (with M-x gdb) and I try to tab-complete directory names, it completes with a space instead of a slash. So, for example:

(gdb) run/mn

tab-completes to

(gdb) run /mnt 

when it should tab-complete to

(gdb) run /mnt/

If I run gdb outside of emacs, tab-completion works as expected.

I’m running gdb 7.4.1-debian and emacs 23.4.1 on debian testing.

Any help you could give me here would be greatly appreciated; this is really irritating!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:17:41+00:00Added an answer on June 11, 2026 at 8:17 am

    gud-mode retrieves the list of possible completitions by calling gdb‘s complete command. In your example, the returned list would contain the following (assuming that there’s only one directory in your file system that starts with “/mn”):

    (run /mnt)
    

    The first part of each entry in the returned list is cut off, so that the remaining complete-list is

    (/mnt)
    

    As you can see, this entry returned by gdb’s complete command already lacks the trailing slash. Your only hope to fix this would be to either patch gdb‘s complete command, or to patch Emacs’ gud-mode, by somehow detecting that the completed word is a directory and then appending a slash (and suppressing the auto-insertion of the space character).

    But of course, you could simply bind the TAB key to a different completion function, potentially one that falls back on the default gud-gdb-complete-command, but perhaps does a different kind of completion when called for.

    For this, try putting the following in your .emacs file:

    (defun my-gud-gdb-setup ()
      (define-key (current-local-map) "\t" 'my-gud-gdb-complete-command))
    
    (defun my-gud-gdb-complete-command (&optional COMMAND PREDICATE FLAGS)
      (interactive)
      (unless (comint-dynamic-complete-filename)
        (gud-gdb-complete-command COMMAND PREDICATE FLAGS)))
    
    (add-hook 'gdb-mode-hook 'my-gud-gdb-setup)
    

    This code binds a new function to the TAB key which first tries to expand the current word as a file, and only if that fails calls the default gud-gdb-complete-command.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I redefined a built-in command in gdb, for example run, I want to do
I asked a question just yesterday which caused this new issue. gdb within emacs
I use gdb-many-windows in emacs as normal user. But the program need to run
I enter gdb within emacs using M-x gdb . Then, when I execute b
I'm writing a Ruby C extension, and frequently need to run GDB or Valgrind
I run a local directory website (think yelp/yell.com etc) and need to provide analytical
I have a program that I'd like to debug with gdb via emacs. In
When I run GDB with BACKTRACE command locally (Ubuntu 10.10) I am getting this
I'm pretty much using GDB for the first time. I run $ gdb then
I am getting a segmentation fault error when I try to run my program

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.