This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/6] Introduce throw_ptrace_error
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: palves at redhat dot com
- Cc: gdb-patches at sourceware dot org
- Date: Sun, 8 Mar 2015 21:29:50 +0100 (CET)
- Subject: Re: [PATCH 2/6] Introduce throw_ptrace_error
- Authentication-results: sourceware.org; auth=none
- References: <1425671886-7798-1-git-send-email-palves at redhat dot com> <1425671886-7798-3-git-send-email-palves at redhat dot com> <201503062103 dot t26L3tef004332 at glazunov dot sibelius dot xs4all dot nl> <54FA1EB3 dot 2050706 at redhat dot com>
> Date: Fri, 06 Mar 2015 21:40:03 +0000
> From: Pedro Alves <palves@redhat.com>
>
> On 03/06/2015 09:03 PM, Mark Kettenis wrote:
> >> From: Pedro Alves <palves@redhat.com>
> >> Date: Fri, 6 Mar 2015 19:58:02 +0000
> >>
> >> This adds a new function that is meant to be called instead of
> >> perror_with_name whenever we get an error out of ptrace. The
> >> idea is to convert some errno errors to different GDB exceptions in
> >> a following patch.
> >
> > What is ptrace-specific about throwing an error? This really feels
> > like the wrong direction to me.
>
> Not exactly sure what you mean. Throwing an error is
> of course not ptrace-specific. What is ptrace-specific is the
> interpretation of errno. The end result of the series is that
> an ESRCH as a result of a ptrace error ends up throwing
> a THREAD_NOT_FOUND_ERROR error instead of a GENERIC_ERROR. Then
> callers up the chain can actually distinguish the errors.
>
> Please take a look at patch 3. It should make things clearer.
I think your interpretation of ESRCH is too Linux-centric. You're
once again duct-taping around the Linux kernel's whoefully
insufficient threads debugging capabilities. It really should not be
possible for a thread to just disappear without the debugger being
notified. Do I sound like a broken record?
I think at this point the right approach is to make
linux_resume_one_lwp() call ptrace() directly instead of calling down
into the inf_ptrace_resume(). That way you can simply check errno in
the place where it matters.