jimingham wrote:

The way interruption works in lldb is that the first time you dispatch an 
interrupt, it just raises the "voluntary interrupt" flag.  Turns out the 
process attach part of lldb isn't written in a way that makes checking for the 
interrupt flag possible, so that doesn't work.  The second time you issue the 
interrupt, since we've already raised the Debugger interrupt flag, we send the 
Process level interrupt to any running processes.  That's the one that actually 
interrupts the attach attempt.

This is a variant of the scheme gdb used (at least back in the day), where the 
first ^C tries to interrupt the current command, and the second ^C tries to 
interrupt the process connection.  In gdb, on the second ^C you would get a 
prompt "I see you pressed ^C twice, did you really want to interrupt the 
process".  I didn't emulate that part as in my usage I pretty much never 
answered "no" to this question...

Jim


> On Sep 20, 2023, at 2:16 AM, David Spickett ***@***.***> wrote:
> 
> 
> @DavidSpickett commented on this pull request.
> 
> In lldb/test/API/commands/process/attach/TestProcessAttach.py 
> <https://github.com/llvm/llvm-project/pull/65822#discussion_r1331325797>:
> 
> > +        # No need to track the output
> +        self.stdout_path = self.getBuildArtifact("stdout.txt")
> +        self.out_filehandle = open(self.stdout_path, "w")
> +        self.dbg.SetOutputFileHandle(self.out_filehandle, False)
> +        self.dbg.SetErrorFileHandle(self.out_filehandle, False)
> +
> +        n_errors, quit_req, crashed = self.dbg.RunCommandInterpreter(
> +            True, True, options, 0, False, False)
> +        
> +        while 1:
> +            time.sleep(1)
> +            if target.process.state == lldb.eStateAttaching:
> +                break
> +
> +        self.dbg.DispatchInputInterrupt()
> +        self.dbg.DispatchInputInterrupt()
> Why is this done twice?
> 
> —
> Reply to this email directly, view it on GitHub 
> <https://github.com/llvm/llvm-project/pull/65822#pullrequestreview-1635156963>,
>  or unsubscribe 
> <https://github.com/notifications/unsubscribe-auth/ADUPVW5Y7TPO7JCFGAH5KH3X3KX7DANCNFSM6AAAAAA4RAWCQY>.
> You are receiving this because you modified the open/close state.
> 



https://github.com/llvm/llvm-project/pull/65822
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to