Reputation: 10507
Without the need of starting gdb first and then attach to an existing process. Is there a one shot gdb command line option to do this?
Upvotes: 0
Views: 64
Reputation: 992
You can do that by using the below command
$ gdb <executable_file> -p <pid>
It will attach the gdb
to process pid
which is created after executing the executable_file
.
In some situations <executable_file>
can be omitted from the command line, in which case gdb will locate the executable file on its own, and read its symbols.
Upvotes: 3