[Lldb-commits] [PATCH] Make CommandObjectProcess check process state before calling WaitForProcessToStop

Malea, Daniel daniel.malea at intel.com
Wed Oct 9 08:25:28 PDT 2013


Hi Jim, how does this look?

I noticed the need to add a flag to WaitForProcessToStop that makes it not
wait for an event in certain scenarios (when called from
CommandObjectProcessLaunch). The same function when used from other places
needs to wait for an event based on my testing..


This is the last thing that needs to be committed before I can push the
initial version of the terminal ui we've been hacking on here :)


Cheers,
Dan

On 2013-10-04 10:15 AM, "Malea, Daniel" <daniel.malea at intel.com> wrote:

>Yes, originally I had the state-checking logic in WaitForProcessToStop()
>and noticed some regressions, but I didn't investigate them too much...I
>will take another look.
>
>Thanks,
>Dan
>
>-----Original Message-----
>From: jingham at apple.com [mailto:jingham at apple.com]
>Sent: Thursday, October 3, 2013 7:09 PM
>To: Malea, Daniel
>Cc: lldb-commits at cs.uiuc.edu
>Subject: Re: [Lldb-commits] [PATCH] Make CommandObjectProcess check
>process state before calling WaitForProcessToStop
>
>Shouldn't this be done in WaitForProcessToStop?
>
>Jim
>
>On Oct 3, 2013, at 3:34 PM, Malea, Daniel <daniel.malea at intel.com> wrote:
>
>> Hi all,
>> 
>> I noticed a race condition where a process is launched and hits a
>>breakpoint while CommandObjectProcessLaunch is still in DoExecute. The
>>effect I'm seeing is that if Process::WaitForProcessToStop() is called
>>on a stopped process, LLDB hangs.
>> 
>> This patch fixes the issue by checking the process state before calling
>>WaitForProcessToStop from CommandObjectProcessLaunch. I think there
>>might still be a race condition in between getting the state and
>>checking if StateIsStoppedState, but I'm not sure what process mutex to
>>acquire in the command object while checking the state, or if that
>>approach is any better..
>> 
>> Comments welcome!
>> 
>> Thanks,
>> Dan
>> 
>><command_object_process_check_state.patch>_______________________________
>>________________
>> lldb-commits mailing list
>> lldb-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
>
>_______________________________________________
>lldb-commits mailing list
>lldb-commits at cs.uiuc.edu
>http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

-------------- next part --------------
A non-text attachment was scrubbed...
Name: wait_for_process_to_stop_nohang.patch
Type: application/octet-stream
Size: 2931 bytes
Desc: wait_for_process_to_stop_nohang.patch
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20131009/f1cfd5b6/attachment.obj>


More information about the lldb-commits mailing list