Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old August 28th, 2008, 04:06 PM
Newbie
 
Join Date: Aug 2008
Posts: 23
Default How do i pass argument to gdb?

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
Reply
  #2  
Old August 28th, 2008, 04:23 PM
Ganon11's Avatar
Moderator
 
Join Date: Oct 2006
Location: New York, United States of America
Age: 19
Posts: 3,424
Default

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
Reply
  #3  
Old August 28th, 2008, 05:22 PM
Familiar Sight
 
Join Date: Apr 2007
Posts: 158
Default

you can also use the --args flag on the command line like this:

> gdb --args myprogram arg1 arg2 arg3
Reply
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles