LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 11-18-2009, 09:30 AM   #1
eddyq
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
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by eddyq View Post
How do I pass an argument to my program via gdb?
Code:
gdb --args ./prog -dfile
--args is in gdb.info, 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
eddyq
LQ Newbie
 
Registered: Nov 2009
Posts: 20

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


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

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