[lldb-dev] ScriptInterpreterPython::ExecuteOneLine

Zachary Turner zturner at google.com
Tue Oct 7 09:43:17 PDT 2014


I'm having trouble understanding exactly how this function works.  At the
top, there is the following comment:

        // We want to call run_one_line, passing in the dictionary and the
command string.  We cannot do this through
        // PyRun_SimpleString here because the command string may contain
escaped characters, and putting it inside
        // another string to pass to PyRun_SimpleString messes up the
escaping.  So we use the following more complicated
        // method to pass the command string directly down to Python.

Two questions.  First, can you elaborate on the issue with escaped
characters?  PyRun_SimpleString() should be able to accept strings with
escaped characters in them.  Are you saying this isn't the case?

Second, can you explain the more complicated method that is being used?  I
see some pipes, a background thraeding doing some reading, something about
dev/null, and a bunch of IOHandler stuff I don't really understand.

If the entire function could be reduced to a single call to
PyRun_SimpleString() if the escaping problem were fixed, then would it work
to try to just manipulate the string directly to double-escape, or do
soemthing else to it so that PyRun_SimpleString worked, to avoid this
complicated logic?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20141007/89ee7743/attachment.html>


More information about the lldb-dev mailing list