NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Attaching gdb session to a service launched from rc.d



On Wed, Jan 23, 2019 at 12:52:17PM -0800, Germain wrote:
> Greetings!
> 
> 
> I am having trouble debugging with gdb a service that I am launching with
> rc.d:
> 
> When going `attach <pid>' in gdb (running as the same user as the user under
> which the service is running.)
> 
> 
> I get :
> 
> (gdb) attach 26536
> Attaching to program: /home/german/work/supportTools/Emailizer/Emailizer,
> process 26536
> ptrace: Device busy.

from ptrace(2):

     [EBUSY]
               o   PT_ATTACH was attempted on a process that was already being
                   traced.
               o   A request attempted to manipulate a process that was being
                   traced by some process other than the one making the
                   request.
               o   A request (other than PT_ATTACH) specified a process that
                   wasn't stopped.

The third possibility is out (as you are trying to attach). Is there some
other debugger active, or is the process that forks your process tracing
the child?

What does "ps axwww" (or similar) show for the process you want to attach?
The flags column could show a "T" for stopped and/or a "X" for traced.

What are the user ids involved here? Is the process setuid? You may need
to debug as root in that case.


Martin


Home | Main Index | Thread Index | Old Index