Since the value I am gonna input is unpredictable befor the program runs. So is there any way to input like "\x01\x02" in gdb? The program I am debugging is a c program and the function in the program which needs an input is gets(). Any help would be appreciated! Thanks in advance!
Asked
Active
Viewed 219 times
0
-
How would you input these values when run without gdb? – ssbssa Aug 21 '22 at 11:02
-
Without gdb, stdin redirection can be used to send unprintable value for simple. And python script can be used too. – nakeydoln Aug 21 '22 at 13:04
-
You can [redirect stdin](https://stackoverflow.com/a/455588/1983398) with gdb as well. – ssbssa Aug 21 '22 at 14:10
-
Do you need to start the program and run it for a bit before you can determine what input to send to it? – Mark Plotnick Aug 22 '22 at 03:06
1 Answers
0
the value I am gonna input is unpredictable befor the program runs
Assuming that you mean: "the value that needs to be read can only be determined while debugging the program with GDB", use named pipe as input (and standard GDB I/O redirection).

Employed Russian
- 199,314
- 34
- 295
- 362