LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-27-2006, 03:38 AM   #1
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 655

Rep: Reputation: 40
GDB: Run program automatically


I'm running gdb to debug a program, and want to make it so that I don't have to enter "run" every time I want to start the application. Anybody got any ideas on how is this done?
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 02-27-2006, 10:54 PM   #2
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 725

Rep: Reputation: 33
If you don't type run, how can you pass the parameter to the being-debugged program?
 
Old 02-28-2006, 01:47 AM   #3
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
I gotta ask: what's wrong with typing "r-u-n"?

PS:
Understanding why you're asking might help us give you a better solution. For example, maybe you're actually looking for an automated script that can attach to and get a stack traceback from a live process (something that's both do-able, and actually fairly easy, btw).
 
Old 02-28-2006, 03:11 AM   #4
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 655

Original Poster
Rep: Reputation: 40
Just to clearify: I'm developing a distributed application, and having to type "run" in four terminals every time I start the application is very time consuming. Every time I start the application four xterms pop up, each running a ssh-session to a remote machine. This is why I want to avoid typing "run".

If there is some other way of doing this feel free to give me a hint.
 
Old 03-06-2006, 08:28 AM   #5
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 655

Original Poster
Rep: Reputation: 40
In order to run the application automatically under gdb I need to type "r" i the terminal. Isn't there some way of passing an argument to gdb similar to typing "r" in the terminal? Something like

gdb <application> < echo 'r'

or something?
 
Old 12-05-2009, 09:14 AM   #6
sswam
LQ Newbie
 
Registered: Dec 2009
Posts: 10

Rep: Reputation: 1
how to do it

gdb -ex run your-program

gdb -ex run --args your-program arg1 arg2 ...
 
2 members found this post helpful.
  


Reply


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can a command/program be run automatically on boot? chuanweizuo Linux - Hardware 1 11-28-2005 10:36 AM
run program automatically at specific time simon_qwl Programming 2 03-20-2005 10:58 AM
I want to automatically run a program when a user logs on their account bad_andy Linux - Newbie 7 02-01-2005 08:55 PM
Automatically run root program. Hammett Linux - Software 4 05-16-2004 12:45 PM
How do I automatically run at boot an X program or script cmisip Linux - General 4 01-05-2003 06:30 PM


All times are GMT -5. The time now is 07:04 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration