Search code examples
linuxgdbxargsshellcode

How do I pass the arguments from a text file to run a program under gdb?


I want to use the function like the command under gdb.

$ cat arg.txt | xargs ./binary

Is there any way to make it?


Solution

  • Thanks and I got an simple solution.

    (gdb) run $( cat arg.txt )
    

    It is also possible to pass the output of a command to be the arguments.

    (gdb) run $( ruby -e 'print( "text as arguments" )' )