1

If I have a program A, which uses execve to run program B. How can I set a breakpoint in program B's main routine if I'm debugging program A?

After a certain point in the execve routine, program B will be loaded into memory. After that I can see the symbols in the binary and the regions of memory they have been loaded into. However, to get to that point at the moment I just step through some of the execve instructions which is very fiddly and prone to mistakes.

Is there a simpler approach to this?

1

There's a debugging flag called dbg.execs that setting it to true should stop the execution when an execv is happening. So try this:

> e dbg.execs = true

It looks like it works on Linux, but I couldn't get the same behaviour on OSX.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.