There might be someone who just have trouble forcing in long arguments during hacking, and googling for hours without something useful. I asked myself "I don't think people are trying to put arguments into their program each time manually while gdbing? Even if the arguments are thousands of characters long..."
This is tested in GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Attempted Solution 1 :
#gdb ./a <>
Nope, this will fail definitely.
Attempted Solution 2 :
# gdb
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu".
(gdb) ./a <>
Nope, this will fail too.
So after asking for directions, thanks to Zekta and Tom, we have the 2 solutions below.
Solution 1 :
gdb -x args.in ./a
args.in is a file containing the gdb commands :
For example :
============================
set args args1 args2 args3 args4
============================
Solution 2 :
(gdb) r `cat arguments.in`
arguments.in is a file containing the arguments to be input
There is also a solution called xargs, but I have never tried. It's well worth a try, both of the ways are kind of bruteforce. Anyway, it works, that's it, and is automated.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment