How to run a program with commandline arguments using GDB within a Bash script?

https://stackoverflow.com/questions/6121094/how-do-i-run-a-program-with-commandline-arguments-using-gdb-within-a-bash-script

Run gdb with --args parameter:

gdb --args executablename arg1 arg2 arg3

If you are doing this often (e.g. when running GDB from a script), you might want to consider the following arguments to automate things further. First, you can place your GDB commands (such as ‘run’) in a text file and provide the filename to the -x argument. Second, you can have GDB exit after running your commands by providing the --batch argument. A full example:

gdb -x commands.txt --batch --args executablename arg1 arg2 arg3

15 thoughts on “How to run a program with commandline arguments using GDB within a Bash script?

  1. What i don’t realize is in fact how you’re now not actually much more smartly-preferred than you might be now. You’re so intelligent. You understand thus considerably in terms of this matter, produced me for my part imagine it from a lot of various angles. Its like men and women are not fascinated unless it’s one thing to do with Girl gaga! Your own stuffs great. All the time handle it up!

  2. I’m not sure exactly why but this blog is loading very slow for me. Is anyone else having this issue or is it a problem on my end? I’ll check back later and see if the problem still exists.

  3. Your style is really unique in comparison to other folks I have read stuff from. Thank you for posting when you’ve got the opportunity, Guess I will just bookmark this page.

  4. Hello outstanding blog! Does running a blog like this require a large amount of work? I have no understanding of coding however I had been hoping to start my own blog in the near future. Anyway, if you have any suggestions or techniques for new blog owners please share. I know this is off topic but I simply wanted to ask. Kudos!

  5. Today, while I was at work, my sister stole my iPad and tested to see if it can survive a thirty foot drop, just so she can be a youtube sensation. My iPad is now destroyed and she has 83 views. I know this is entirely off topic but I had to share it with someone!

  6. Unquestionably believe that that you said. Your favourite justification appeared to be on the internet the easiest thing to keep in mind of. I say to you, I definitely get annoyed even as other people consider concerns that they just don’t recognize about. You controlled to hit the nail upon the top and also defined out the whole thing without having side effect , other folks can take a signal. Will likely be again to get more. Thanks

  7. Hello this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding know-how so I wanted to get advice from someone with experience. Any help would be greatly appreciated!

  8. Howdy! Would you mind if I share your blog with my myspace group? There’s a lot of folks that I think would really enjoy your content. Please let me know. Thank you

  9. Good post but I was wondering if you could write a litte more on this topic? I’d be very thankful if you could elaborate a little bit more. Bless you!

Leave a Reply to Haco Cancel reply

Your email address will not be published. Required fields are marked *