如何将参数(I.E. the binarys name)传递给Emacs gdb命令?

时间:2009-03-06 18:46:14

标签: unix emacs gdb

现在,我有F5设置为emacs启动gdb:

(global-set-key [f5]'gdb)

这会切换到迷你缓冲区,然后我输入一个可执行文件的路径......我想找到一种方法来绕过这个路径输入......

我编写了一个可执行文件,查看Makefile,解析它并找出可执行文件的完整路径并将其打印到标准输出...是否可以从我的.emacs中调用它...然后以某种方式通过输出到gdb命令?

1 个答案:

答案 0 :(得分:1)

(defun gdb-getpath ()
  "Figures out the path to executable and launches gdb."
  (interactive)
  (let ((path (shell-command-to-string "/path/to/your/executable")))
    (gdb (concat "gdb " path))
    ))

(global-set-key [f5] 'gdb-getpath)