I want to write a shell script to help me start gdb and input some commands which I don’t want to input by myself, how should I do that?
I tried the heredoc below, but it doesn’t work, what did I do wrong?
#! /bin/sh -
gdb ./myexe << MYHEREDOC
b xxx.c:1234
commands 1
printf "xxxxxxxx"
continue
end
MYHEREDOC
Thanks in advance for your kindly help~
It really should work (see docs). Perhaps if you used a command file you could get away from having to use a heredoc:
commands.gdb: