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. I also tried gdb with Unix prompt directly and everything went smoothly. So is there any trick in passing the argument into the program in the gdb mode of emacs?
1 Answer
The canonical way to pass arguments to the debugged program is to add them after gdb's run command.
For example:
M-xgdbRETechoRET
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]