0

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?

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.