It's similar with Automatically enter input in command line. But this not work in my situation.
What I want is after run gdb
, I want it automatic input target remote:1337
. Which I script like this:
printf 'target remote:1337\n' | gdb
But the gdb exit automatic after run the script. The log is:
printf 'target remote:1337\n' | gdb
GNU gdb (GDB) 8.3
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin14.5.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) Remote debugging using :1337
Reading /data/local/tmp/helloworld.out from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
Reading /data/local/tmp/helloworld.out from remote target...
Reading symbols from target:/data/local/tmp/helloworld.out...
_start () at helloworld.s:5
5 blx _thumb
(gdb) quit
A debugging session is active.
Inferior 1 [process 11826] will be killed.
Quit anyway? (y or n) [answered Y; input not from terminal]
If I do this manually. It can work normally.
How to fix? Thank you!