Hind Forsum
Hind Forsum

Reputation: 10507

Could gdb start with attaching to a process?

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

Answers (1)

The Philomath
The Philomath

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

Related Questions