haziz
haziz

Reputation: 13602

How do I run GDB, enter text into the command line AND see how the executable treats those entries?

How do you run GDB while allowing interactive entry of characters from the command line while simultaneosuly "printing" the values of the variables arising from the parsed characters from those entries?

In other words how do I run gdb, enter text into the command line AND see how the executable treats those entries?

Also is there any difference in the behavior of gdb if I run it from within Emacs with M-x gdb? Suspending the executable with C-c C-c and then trying to print variable values does not behave like I expected. It did not seem to recognize valid variable values from the suspended executable being debugged. I did generate a "debuggable" excutable from Clang with -ggdb -O0 flags.

I also tried to link gdb to the pid of the program executable running in a separate terminal but still am having difficulty with it. The program needs to parse command line entries interactively; I cannot pass them as initial command line arguments.

I hope I made my question clear.

Upvotes: 2

Views: 423

Answers (1)

edt_devel
edt_devel

Reputation: 573

After you started M-x gdb enter M-x gdb-many-windows . This opens new windows in your frame which show the stack, breakpoints, locals, your code and I/O of your program, meaning if you type there the input will be given to your executable.

Upvotes: 1

Related Questions