While using Termdebug, occasionally it would be useful to pass extra arguments to gdb (for example, -x).

I've tried :Termdebug -x <my_file> <command_to_debug>, but that just seems to confuse the plugin. I've also tried the less convenient :let termdebugger = "gdb -x <my_file>" before invoking Termdebug, with similarly poor results.

Is there any way to do this?

  • 1
    Termdebug -x ... works fine for me, my script contains only run, the culprit might be something in your <my_file> ? – dedowsdi May 23 at 0:20
  • Well, it works when I run gdb -x <my_file> <command_to_debug> outside vim, and it works when I do source <my_file> inside the Termdebug window (which has been my workaround), so I think the file is okay. When I try Termdebug -x ..., it looks like it's going into Termdebug for a split second before immediately leaving, as if gdb might be exiting immediately. – Dominick Pastore May 24 at 0:06
  • 1
    gdb argument support is added at patch 8.0.1713, make sure your vim is new enough. – dedowsdi May 24 at 1:08
  • Ah, that explains it. Thanks. – Dominick Pastore May 24 at 1:47
  • I turned that comment into an answer, you may accept it if it solved your problem. – dedowsdi May 28 at 13:01

gdb argument support is added at patch 8.0.1713:

Termdebug [gdb-args] command

command argument support is added at patch 8.0.1725:

TermdebugCommand command [command-args]
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.