Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 11-18-2009, 09:30 AM   #1
LQ Newbie
Registered: Nov 2009
Posts: 20

Rep: Reputation: Disabled
Passing program arguments to gdb

I'm using gdb to debug my program. My program requires arguments (e.g., ./prog -dfile). But if I use gdb as in gdb ./prog -dfile, gdb wants to interpret the -d argument.

How do I pass an argument to my program via gdb?
Old 11-18-2009, 09:36 AM   #2
LQ Guru
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181
Originally Posted by eddyq View Post
How do I pass an argument to my program via gdb?
gdb --args ./prog -dfile
--args is in, but not in the man page.

For a complicated program like gdb, I have no idea how someone decides what is important enough to go in the man page. But usually such decisions are made amazingly badly. Most of the man page for gdb are obscure details far less likely to be needed than --args.

Last edited by johnsfine; 11-18-2009 at 09:43 AM.
Old 11-18-2009, 11:17 AM   #3
LQ Newbie
Registered: Nov 2009
Posts: 20

Original Poster
Rep: Reputation: Disabled
Thanks, and looking at the man page, I agree.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Spawning a process - passing arguments Kenhokie Programming 1 04-03-2009 01:51 PM
bash, passing arguments Four Linux - Newbie 3 02-06-2006 08:24 AM
Problem with passing arguments in Perl bahadur Programming 1 05-30-2005 01:47 AM
Handline passing arguments in C AMMullan Programming 9 03-22-2004 01:37 AM
Passing external variables/arguments to SQL program ganninu Programming 12 11-25-2003 05:30 AM

All times are GMT -5. The time now is 04:40 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration