[lldb-dev] Use of termios in Python scripts

Greg Clayton gclayton at apple.com
Fri Jul 11 11:27:53 PDT 2014


> On Jul 11, 2014, at 9:37 AM, Zachary Turner <zturner at google.com> wrote:
> 
> From what I can tell, there are exactly two use cases for termios in the embedded script interpreter:
> 
> 1) Getting the size of the terminal (done from embedded_interpreter initialization, and dotest.py) and 
> 
> 2) Turning on or off echo (also done from embedded_interpreter initialization, and dotest.py)
> 
> I'm curious about the history here.  What is the reason for this code?  In my testing so far I haven't been able to exercise these codepaths on Windows, so I'm not sure if they're MacOSX only or something like that.  If it's possible to exercise these code paths on Windows I'll need to move this functionality behind another module that reproduces these two use cases on Windows.
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev


This stuff is for running the embedded interpreter within an IDE where the IDE create a new SBDebugger and then gives us the in/out/err file handles from the slave side of a pseudo terminal. Xcode, our IDE, currently uses this method and we ended up with a double echo of any characters since they use a normal Cocoa text field and they don't have the notion of not echoing characters like a real terminal does. So this is a kind of hack that says "the file handles we have been given for in/out/err claim to be terminals (pty) but they don't actually have a height and width, so we know this means the special pseudo terminal IDE case and we can avoid the double echo issue.

For normal command line stuff this can be disabled and for anything non darwin it can be disabled.

Greg



More information about the lldb-dev mailing list