0

Simple, maybe not so simple issue. How can I run GDB with the results of a script?

What I mean is that instead of saying:

run arg1 

You would say:

run "python generatingscript.py" 

which would output the args. I'm aware I could find a way to do this by sleeping the program after run the args from the command line, but it would be really darn convenient if there was a way to do this kind of thing directly in gdb.

Just for context, my use case is a situation where I writing crash test cases that look like long strings of hex data. Putting them in by hand at the command line isn't the most convenient thing.

1
  • 1
    What operating system? If you have one with a Unix shell, try (gdb) run $(python generatingscript.py) Commented Jul 12, 2016 at 14:35

3 Answers 3

1

You can use gdb with the --args option like this: gdb --args your_program $(python generatingscript.py.

Sign up to request clarification or add additional context in comments.

Comments

0

You could also use bash to generate an output file

$python generatingscript.py > testinput

then in gdb

gdb$ run < testinput

Comments

0

This works for my ubuntu machine which deploys "<<<" instead of "<".

(gdb) r <<< $(python exploit.py )

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.