[lldb-dev] How does attach work on non-Windows?

Zachary Turner via lldb-dev lldb-dev at lists.llvm.org
Mon Aug 31 16:26:06 PDT 2015


I think it's mostly a problem of tests.  Basically we have tests which are
written in such a way that the inferior and the debugger need to reach a
synchronization point before the test can proceed to test what it wants to
test.

On Mon, Aug 31, 2015 at 4:08 PM Greg Clayton <gclayton at apple.com> wrote:

> Or is this just a problem with a bad test? Are we telling LLDB to launch
> the test and LLDB is doing the launch + attach in the windows platform and
> that is what is hosing up the attach? Or is this a flawed test where the
> test just manually launches the process with no hopes of syncing with the
> process we are attaching to?
>
> > On Aug 31, 2015, at 3:16 PM, Greg Clayton via lldb-dev <
> lldb-dev at lists.llvm.org> wrote:
> >
> > So a few things:
> >
> > 1 - on MacOSX we can reliably launch a process via posix_spawn() with a
> flag set that sets the process to stop at __dyld_start which is the first
> instruction in the program. So our launch then attach always works reliably
> because when we launch the process set set this posix_spawn() flag.
> >
> > 2 - on linux I believe this is solved by doing a manual fork(), sync(),
> exec().
> >
> > 3 - on windows we have a sync problem for the launch first then attach
> due to this extra thread. Is this the case?
> >
> >  Seems like you should be able to launch with Use the CreateProcess()
> function, set CREATE_SUSPENDED and then attach no?
> >
> > I would rather not solve this problem that is windows only by requiring
> that all test suite functions link to a .a file. We should be able to
> launch a process and debug it using the launch then attach method that is
> used by our platform.
> >
> > Greg
> >
> >
> >
> >> On Aug 27, 2015, at 4:04 PM, via lldb-dev <lldb-dev at lists.llvm.org>
> wrote:
> >>
> >> On Thu, Aug 27, 2015 at 10:17:24PM +0000, Zachary Turner wrote:
> >>> In what instances do you think it wouldn't work?  At least on Windows
> it's
> >>> trivial.  Jim provided some code that would work on OSX, and someone
> else
> >>> provided a method earlier in the thread that should work for Linux.
> What
> >>> are the specific reliability concerns you have?
> >>
> >> I'm basing this off our own experiences - we use a similar method to
> >> test Android and iOS platforms, and they work most of the time, but fail
> >> randomly, about once every 25 runs, because one of the 50 or so test
> >> cases couldn't sync up with the debug server on the device.  Do other
> >> people see similar problems?
> >>
> >> If you're running the tests natively, I bet you'll be fine.
> >> _______________________________________________
> >> lldb-dev mailing list
> >> lldb-dev at lists.llvm.org
> >>
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_lldb-2Ddev&d=BQIGaQ&c=eEvniauFctOgLOKGJOplqw&r=e494ZqshU04UaasD49FjA8X8-41XrPe2DEAUCC4uIBA&m=rcCO6AJ3AdDHg5mYGyuAIclByBVrIHeeEMSbtprurNY&s=7I8Xb9uQ5clKv1lA-TQgZ6iHALia6UDWoINpajCOoQ8&e=
> >
> > _______________________________________________
> > lldb-dev mailing list
> > lldb-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20150831/891b3a76/attachment.html>


More information about the lldb-dev mailing list