471,596 Members | 918 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,596 software developers and data experts.

How do i pass argument to gdb?


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


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.
Aug 28 '08 #1
2 52836
3,652 Expert 2GB
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
256 100+
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.

Similar topics

4 posts views Thread by Todd | last post: by
4 posts views Thread by quiteblack | last post: by
2 posts views Thread by fusillo | last post: by
1 post views Thread by TarDuk a memory beyond the life | last post: by
10 posts views Thread by Robert Dailey | last post: by
19 posts views Thread by Spiros Bousbouras | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.