How can I use the output of a shell command as an argument to GDB command within GDB?

Viewed 1693

I don't want to spend time searching for the PID of the process I want to attach to, so I do something like this,

gdb -p ($pidof foo)

where foo is the process name.

I want to know if I can so something like this from within GDB.

I am looking for something like the following.

(gdb) attach $(pidof foo)
Illegal process-id: $(pidof foo).
(gdb) attach `pidof foo`
Illegal process-id: `pidof foo`.

Is there anything like this in GDB?

1 Answers
Related