gdbserver for arm does not support multi-process debugging

Luis Machado luis.machado@linaro.org
Thu Oct 24 10:38:00 GMT 2019


Hi,

I just ran a quick check (foll-fork.exp and follow-vfork.exp tests) on a 
arm machine and things worked as expected.

What version of GDB/kernel are you using?

On 10/24/19 2:32 AM, 刘康 wrote:
> Hi Luis,
> 
> Yes, I know that gdbserver willcatch PTRACE_EVENT_FORK in 
> gdb/gdbserver/linux-low.c:handle_extended_wait and get the child 
> process's pid via PTRACE_GETEVENTMSG.
> 
> I found the way of X86 version gdb to deal with PTRACE_EVENT_FORKwill 
> set waitstatus toTARGET_WAITKIND_FORKED and add a new inferior .What's 
> more ,it can trace child/parent process automatically as long as I set 
> "follow-fork-mode" to "child" or "parent".
> 
> But it seems like gdbserver will not tell PTRACE_EVENT_FORK to thehost 
> arm-XXX-gdb this event ,as a result , user cannot trace child process or 
> add a new inferior no matter what value of "detach-on-fork off" and 
> "follow-fork-mode" I have tried.
> 
> At 2019-10-18 20:27:19, "Luis Machado" <luis.machado@linaro.org> wrote:
>>Hi,
>>
>>On 10/17/19 3:19 AM, 刘康 wrote:
>>> Dear gdb@sourceware.org
>>> 
>>> 
>>> I am researching the gdbserver's source code for ARM, what confused me is that it does not support multi-process to debug the target's child process, cause it dose not interesting in PTRACE_EVENT_FORK, I don't know whether it's a bug or it's just a feature by design.
>>
>>The handling of PTRACE_EVENT_FORK, PTRACE_EVENT_VFORK and 
>>PTRACE_EVENT_CLONE is in generic linux code. See 
>>gdb/gdbserver/linux-low.c:handle_extended_wait.
>>
>>As long as the kernel supports reporting such events via ptrace and we 
>>are debugging using extended remote mode (not regular remote mode), it 
>>should work. If it doesn't, then we may have a problem that we should fix.
>>
>>Does that answer your question?
>>
>>Luis
> 
> 
> 



More information about the Gdb mailing list