By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
463,122 Members | 634 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 463,122 IT Pros & Developers. It's quick & easy.

How do i pass argument to gdb?

P: 30
Hi

I want to pass argument to gdb but i don't know to do that.

Say,

my executable taking 3 argument.

<myexe> <arg1> <arg2> <arg3>

when i try to debug myexe,
like that

gdb myexe

but i dont konw how to pass 3 arguments .


Please, some suggestion.
Thanks in advace.
Ashok
Aug 28 '08 #1
Share this Question
Share on Google+
2 Replies

Ganon11
Expert 2.5K+
P: 3,652
When you actually run your program in gdb (by typing run), add your arguments there.

For instance, if I wanted to run myProg.exe with the command line arguments 1, 2, and eleven, I would type:

Expand|Select|Wrap|Line Numbers
  1. gdb myProg.exe
  2. (setup stuff here, maybe set some breakpoints, then...)
  3. run 1 2 eleven
Aug 28 '08 #2

100+
P: 256
you can also use the --args flag on the command line like this:

> gdb --args myprogram arg1 arg2 arg3
Aug 28 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.