Re: [lldb-dev] Race condition crashes during launching LLDB

2016-02-12 Thread Greg Clayton via lldb-dev
The main problem you are running into is in async mode when you say "launch" or "continue", those calls will return immediately and you must consume the events to make sure it is safe to do things. If your process is stopped, then until your actually resume your process with process.Continue() o

Re: [lldb-dev] Race condition crashes during launching LLDB

2016-02-12 Thread Greg Clayton via lldb-dev
If you are going to set async to true, then you must consume the events by waiting for events. See the following example: svn cat http://llvm.org/svn/llvm-project/lldb/trunk/examples/python/process_events.py So you can rewrite your wait_for_process_stop to use the debugger to fetch the events

Re: [lldb-dev] Race condition crashes during launching LLDB

2016-02-05 Thread Jeffrey Tan via lldb-dev
Thanks Pavel, yeah, that's what I figured out yesterday. In "So now Destroy starts destroying the process while it is just being *started up* and things go south", for "started up", I assume you mean inferior is not *continued/resumed* from first entry point breakpoint, right? The inferior is defin

Re: [lldb-dev] Race condition crashes during launching LLDB

2016-02-05 Thread Pavel Labath via lldb-dev
On 5 February 2016 at 05:09, Jeffrey Tan via lldb-dev wrote: > After adding some logging I figured out that the race condition is caused by > process.Continue() did not guarantee process has been really resumed yet in > async mode, so the second wait_for_process_stop() is skipped immediately to >

Re: [lldb-dev] Race condition crashes during launching LLDB

2016-02-04 Thread Jeffrey Tan via lldb-dev
After adding some logging I figured out that the race condition is caused by process.Continue() did not guarantee process has been really resumed yet in async mode, so the second wait_for_process_stop() is skipped immediately to kill listener thread and destroying debugger. I know I have a race con

Re: [lldb-dev] Race condition crashes during launching LLDB

2016-02-04 Thread Jim Ingham via lldb-dev
I don't know what: event_thread = LLDBListenerThread(debugger) does, but from your little sketch it looks like you are starting up a thread listening on this debugger, and so far as I can see you destroy the debugger out from under it without ever closing down that thread. That doesn't see

[lldb-dev] Race condition crashes during launching LLDB

2016-02-04 Thread Jeffrey Tan via lldb-dev
Hi, I am revising our lldb automation tests into async mode. However, I found it randomly crashes depends on timing. And the crash happens mostly while launching lldb twice in a row. I have narrowed down the code into a simple repro below. Any assumption I made wrong with the LLDB API here? The c