I have a C program that accepts arguments. I want to pass arguments to it while debugging through gdb but I want to specify the arguments through, say, a python command. So,
(gdb) run >>python return "a"*20 #arg1 >>python return 1+2 #arg2
How can I do this? The reason why I want to do this is because I want to pass bytecode address to the program as an argument but if I pass it as a sting it just converts everything to ASCII. i.e. if I try:
(gdb) run \xf7\xff\xba\xb5
then the address that I gave above is just converted into an ASCII string instead of being used as a memory address. I think if my first query is answered my second query might also get answered.
Thanks.
I found the solution.
(gdb) run "`python -c 'print "\xff\xff\xff\xff"'`"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With