0

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
  • Are you referring to command-line arguments or arguments read from the standard input? Commented Mar 24, 2013 at 21:16

1 Answer 1

2

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]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.