1

I asked this question in the reverse engineering stackexchange: https://reverseengineering.stackexchange.com/questions/15169/transferring-control-of-ptrace-to-another-process because I thought a ptrace question was most appropriate there.

I didn't get any bites, I don't know if that is because there are too few people there, or they are not that familiar with linux. In any event, I thought I would ask here.

I would like to create a process A. In A I would like to start a second process B. I would like A to go on and monitor system resources. When certain conditions are met I want A to ptrace B, start gdb and transfer ptrace control to gdb.

Is this possible? If not is there a way A can pause B, start gdb with B atttached and then "unpause" B?

1
  • 1
    You need to delete the other question as cross posting is heavily frowned upon. Apr 20, 2017 at 0:30

1 Answer 1

0

Can't comment, but since there are no bites yet anyway:

The biggest question is why switch to gdb at all, why not just continue with ptrace?

The difficult part is definitely the transfer of control to gdb from ptrace. Specifically, how to keep the process halted and have GDB connect and resume the debugging from there; when ptrace disconnects the child resumes execution, and as far as I know this is unavoidable.

Maybe there's a different way to do this Instead. Either way, is the condition for the transition to GDB dependent on the system resources monitored by A, or is the condition local to B?

And it sounds like your 'is this possible' and 'if not' options are asking to do the same thing if I'm not mistaken.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .