1

While debugging a program under gdb with gdb-peda installed, I need to pass args to the binary using output from something like python.

Why I am not getting AAAAA?

gdb-peda$ b doSomthing
gdb-peda$ run  python -c 'print "A"*(5)'

I got the same text: python -c 'print "A"*(150)' as an output but I want to print AAAAA

I think formatting mistake!? Any suggestion, please?

2 Answers 2

0

You don't need "run"


python -c 'print "A"*(5)'

prints:

AAAAA

0

To pass args to a binary using a program such as python use normal bash evaluation. On bash this works

$ echo $(python -c "print('ABC'*3)")
ABCABCABC

Similarly under gdb console

r  $(python2 -c 'print "A"*(58))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.