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

Greg Clayton via lldb-dev lldb-dev at lists.llvm.org
Mon Aug 31 15:16:05 PDT 2015


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= 



More information about the lldb-dev mailing list