简体   繁体   English

如何在emacs的gdb模式下将参数传递给C程序

[英]how to pass argument to the C program in the gdb mode of emacs

I used the gdb mode in emacs to run a small code counting the number of digits in a string, but when I type in the string (using the keyboard), the gdb did nothing but wait forever after I hit the "enter" button. 我在emacs中使用gdb模式运行一个小代码来计算字符串中的位数,但是当我输入字符串(使用键盘)时,gdb什么也没做,只是在我点击“enter”按钮后等待。 I also tried gdb with Unix prompt directly and everything went smoothly. 我也直接尝试使用Unix提示gdb,一切顺利。 So is there any trick in passing the argument into the program in the gdb mode of emacs? 那么在emacs的gdb模式下将参数传递给程序是否有任何技巧?

The canonical way to pass arguments to the debugged program is to add them after gdb 's run command. 将参数传递给调试程序的规范方法是在gdb的run命令之后添加它们。

For example: 例如:

Mx gdb RET echo RET Mx gdb RET echo RET

Current directory is ~/
GNU gdb (GDB) 7.3-debian
[...]
Reading symbols from /bin/echo...(no debugging symbols found)...done.
(gdb) run foo
Starting program: /bin/echo foo
foo
[Inferior 1 (process 10176) exited normally]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM