gdb - debugging with piped input (not arguments)

GdbPipe

Gdb Problem Overview


I typically run my program with:

perl -e 'print "A"x200' | ./vuln_prog

The stdin is consumed by a gets() function in C++.

If this were just a command argument, I could open gdb by doing:

gdb ./vuln_prog
run $(perl -e 'print "A"x200')

However, my scenario is not a command argument, but rather input (STDIN?). How would I debug this in gdb? I've tried a bunch of options, but nothing seems to really work.

I would normally just run gdb on the process, and when it prompts for user input, type it in, however I'm not wanting to type just "A". I want to type all chars from \x00-\xff, which I can't type.

Gdb Solutions


Solution 1 - Gdb

gdb ./vuln_prog
run < filename_with_input

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionmandrekoView Question on Stackoverflow
Solution 1 - Gdbzed_0xffView Answer on Stackoverflow