-   Programming (
-   -   GDB: Run program automatically (

kenneho 02-27-2006 03:38 AM

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?

TruongAn 02-27-2006 10:54 PM

If you don't type run, how can you pass the parameter to the being-debugged program?

paulsm4 02-28-2006 01:47 AM

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

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).

kenneho 02-28-2006 03:11 AM

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.

kenneho 03-06-2006 08:28 AM

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?

sswam 12-05-2009 09:14 AM

how to do it
gdb -ex run your-program

gdb -ex run --args your-program arg1 arg2 ...

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