[Lldb-commits] [lldb] r202311 - A better long term fix for stopping the process when it is running by writing to the pipe that was used for cancel.

Greg Clayton gclayton at apple.com
Thu Feb 27 09:39:07 PST 2014


On Feb 26, 2014, at 5:20 PM, Ed Maste <emaste at freebsd.org> wrote:

> On 26 February 2014 17:47, Greg Clayton <gclayton at apple.com> wrote:
>> Author: gclayton
>> Date: Wed Feb 26 16:47:33 2014
>> New Revision: 202311
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=202311&view=rev
>> Log:
>> A better long term fix for stopping the process when it is running by writing to the pipe that was used for cancel.
> 
> Thanks Greg - looks good and ^C does work as expected for me after this change.
> 
> One question though (not part of this change, I just noticed in the context):
> 
>> @@ -4829,15 +4838,28 @@ public:
>>     Cancel ()
>>     {
>>         size_t n = 1;
>> -        char ch = 'q';
>> +        char ch = 'q';  // Send 'q' for quit
>>         m_pipe_write.Write (&ch, n);
> 
> Isn't a Windows special-case needed here too?

Yes. We need a general "pipe" compatibility layer in the lldb_private::Host realm so we can interrupt something stuck in an infinite read. We currently use a pipe fd pair to be able to interrupt any long standing read by running select() on both the fd for the read and for the interrupt (the pipe). There are a few places where we use pipes right now in the code that work find for unix, but windows has chosen to just comment them out. This should be fixed by the windows gurus that will be able to test and prove their new approach works. I don't know what resources people typically use to replace pipes on windows, or maybe the Windows version of LLDB can add an emulation layer for "int pipe(int fildes[2]);" (like was done for libedit and for getopt) so it just works on windows?





More information about the lldb-commits mailing list