Reputation: 21
I tried to use gdb to debug a new process which is created by a script. In the linux shell, I tried this:
ps -ef | grep -i [m]yprocess | awk '{print "gdb -p " $2}' | sh
Every time,gdb got a ‘quit’ automatically then quit:
***0xf7788430 in __kernel_vsyscall ()
Missing separate debuginfos, use: debuginfo-install glibc-2.17-105.i686 libgcc-4.8.3-10.i686
(gdb) quit
A debugging session is active.
Inferior 1 [process 834] will be detached.
Quit anyway? (y or n) [answered Y; input not from terminal]***
What can I do to fix this?
Upvotes: 2
Views: 817
Reputation: 5289
You can do just
gdb -p `pgrep myprocess`
I guess weird behavior is the consequence of STDIN not being a terminal but a pipe from awk
.
Upvotes: 1