<div dir="ltr">Assuming that termios is used for what it sounds like (sending commands to the terminal), couldn't this be solved by just not outputting to stdout in the python scripts, and instead using the SWIG-exported python wrappers to call whatever method accepts raw command strings?</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 2, 2014 at 12:27 PM, Deepak Panickal <span dir="ltr"><<a href="mailto:deepak@codeplay.com" target="_blank">deepak@codeplay.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div>That problem is due to PYTHONPATH not
being exported to the location where the python packages are
built.<br>
Similar to Linux, you have to export PYTHONPATH to
build_dir/lib/site-packages/python.<br>
The _lldb.pyd file symlinks to liblldb.dll on Windows.<br>
<br>
Regardles, you would still get an error on the command-line due to
the missing python termios module on Windows.<br>
In ScriptInterpreterPython.cpp:2628, the termios module is
imported, which would fail immediately.<br>
<table style="width:1887px;margin:0px;border:none;color:rgb(0,0,0);font-family:sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255)" cellpadding="0" cellspacing="0">
<tbody>
<tr style="vertical-align:top;background-color:rgb(240,240,240)">
<td style="vertical-align:top;border-right-width:0px;font-family:monospace;text-align:left;white-space:pre-wrap;width:1830px;border-right-style:solid;border-right-color:rgb(80,80,80);text-decoration:none;font-weight:normal;font-style:normal;padding:1px 5px;background-color:white">
<span>PyRun_SimpleString</span>
<span>(</span><span style="color:rgb(186,33,33)">"sys.dont_write_bytecode
= 1; import lldb.embedded_interpreter; from
lldb.embedded_interpreter import run_python_interpreter;
from lldb.embedded_interpreter import run_one_line; from
termios import *"</span><span>);</span>
</td>
</tr>
<tr style="vertical-align:top;background-color:rgb(240,240,240)">
</tr>
</tbody>
</table>
<br>
We have yet to solve this dependency on Windows.<br>
However, we can use the API directly for now.<br>
<br>
AFAIK, these modules are only used for the command-line
interpreter, so does not affect using the API directly.<br>
If we comment out these out, we can run the examples in
lldb/examples/python/, such as globals.py to load an ELF file and
dump the globals using the Python API on Windows.<br>
<br>
Thanks,<br>
Deepak<div><div class="h5"><br>
<br>
On 02/07/2014 19:48, Zachary Turner wrote:<br>
</div></div></div><div><div class="h5">
<blockquote type="cite">
<div dir="ltr">One more problem. Compiled successfully, and ran
LLDB. Upon startup I get this warning:
<div><br>
</div>
<div>
<div>Traceback (most recent call last):</div>
<div> File "<string>", line 1, in <module></div>
<div>ImportError: No module named lldb.embedded_interpreter</div>
<div>(lldb)</div>
</div>
<div><br>
</div>
<div>So something is wrong there. Typing "script" with no
arguments gives this:</div>
<div><br>
</div>
<div>
<div>
Traceback (most recent call last):</div>
<div> File "<string>", line 1, in <module></div>
<div>NameError: name 'run_one_line' is not defined</div>
<div>Traceback (most recent call last):</div>
<div>
File "<string>", line 1, in <module></div>
<div>NameError: name 'run_one_line' is not defined</div>
<div>Traceback (most recent call last):</div>
<div> File "<string>", line 1, in <module></div>
<div>NameError: name 'run_one_line' is not defined</div>
<div>Traceback (most recent call last):</div>
<div> File "<string>", line 1, in <module></div>
<div>NameError: name 'run_one_line' is not defined</div>
<div>Traceback (most recent call last):</div>
<div> File "<string>", line 1, in <module></div>
<div>NameError: name 'run_one_line' is not defined</div>
</div>
<div><br>
</div>
<div>Just curious, what has been your use case for this so far?
Do you have it working on your end? If so, what kind of
things can you successfully do with it?</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Tue, Jul 1, 2014 at 4:52 PM, Deepak
Panickal <span dir="ltr"><<a href="mailto:deepak@codeplay.com" target="_blank">deepak@codeplay.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div>Thanks, I'll look into the CMake warning.<br>
<br>
For now, you have to enable the variable
LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION
specifically to use the new python scripts, when
LLDB_DISABLE_PYTHON is disabled. <br>
Which is why not using the variable would break the
build on Windows. On Linux, it would work both ways.<br>
<br>
I added this variable so that the new scripts can be
tested without affecting normal builds on other
platforms.<br>
Could you please try,<br>
cmake<b>
-DLLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION=1</b>
-DLLDB_DISABLE_PYTHON=0
-DPYTHON_INCLUDE_DIR=c:\python27\include
-DPYTHON_LIBRARY=C:\Python27\libs\python27.lib ..\..<br>
<br>
Thanks,<br>
Deepak
<div>
<div><br>
<br>
On 01/07/2014 23:56, Zachary Turner wrote:<br>
</div>
</div>
</div>
<div>
<div>
<blockquote type="cite">
<div dir="ltr">Also getting the following error:
<div><br>
</div>
<div>For reference, I ran cmake as </div>
<div><br>
</div>
<div>cmake -DLLDB_DISABLE_PYTHON=0
-DPYTHON_INCLUDE_DIR=c:\python27\include
-DPYTHON_LIBRARY=C:\Python27\libs\python27.lib
..\..<br>
<div><br>
</div>
<div>
<div>D:\src\llvm\build\ninja>ninja lldb</div>
<div>[88/433] Building lldb python wrapper</div>
<div>FAILED: cmd.exe /c cd /D
D:\src\llvm\build\ninja\tools\lldb\scripts
&& env
PYTHON_EXECUTABLE=C:/Python27/python.exe
D:/src/llvm/tools/lldb/scripts/build-swig-wrapper-classes.sh
D:/src/llvm/tools/lldb
D:/src/llvm/build/ninja/tools/lldb/scripts
D:/src/llvm/build/ninja/tools/lldb/scripts
D:/src/llvm/bu</div>
<div>ild/ninja -m && env
PYTHON_EXECUTABLE=C:/Python27/python.exe
D:/src/llvm/tools/lldb/scripts/finish-swig-wrapper-classes.sh
D:/src/llvm/tools/lldb
D:/src/llvm/build/ninja/tools/lldb/scripts
D:/src/llvm/build/ninja/tools/lldb/scripts
D:/src/llvm/build/ninja -m</div>
<div>env:
D:/src/llvm/tools/lldb/scripts/build-swig-wrapper-classes.sh:
Exec format error</div>
<div>[88/433] Building CXX object
tools\lldb\source\Plugins\Process\mach-core\CMakeFiles\lldbPluginProcessMachCore.dir\ProcessMachCore.cpp.obj</div>
<div>ninja: build stopped: subcommand failed.</div>
</div>
<div><br>
</div>
</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Tue, Jul 1, 2014 at
3:41 PM, Zachary Turner <span dir="ltr"><<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">I get the following warning
when running cmake with no special options
passed via -D
<div><br>
</div>
<div>
<div>CMake Warning (dev) at
tools/lldb/CMakeLists.txt:234
(target_link_libraries):</div>
<div> Policy CMP0023 is not set: Plain
and keyword target_link_libraries</div>
<div> signatures cannot be mixed. Run
"cmake --help-policy CMP0023" for policy</div>
<div> details. Use the cmake_policy
command to set the policy and suppress
this</div>
<div> warning.</div>
<div><br>
</div>
<div> The keyword signature for
target_link_libraries has already been
used with</div>
<div> the target "liblldb". All uses of
target_link_libraries with a target</div>
<div> should be either all-keyword or
all-plain.</div>
<div><br>
</div>
<div> The uses of the keyword signature
are here:</div>
<div><br>
</div>
<div> * cmake/modules/AddLLVM.cmake:331
(target_link_libraries)</div>
<div><br>
</div>
<div>Call Stack (most recent call first):</div>
<div>
tools/lldb/source/CMakeLists.txt:214
(add_lldb_library)</div>
<div>This warning is for project
developers. Use -Wno-dev to suppress
it.</div>
</div>
</div>
<div>
<div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Tue, Jul 1,
2014 at 10:54 AM, Deepak Panickal <span dir="ltr"><<a href="mailto:deepak@codeplay.com" target="_blank">deepak@codeplay.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Hi,<br>
<br>
I'm planning to upstream the
Windows Python API changes now.
<br>
<br>
This has been done by completely
rewriting the shell scripts used
for the API generation in Python
so that it's portable across
different platforms. We have
tested it on both Windows and
Linux successfully. <br>
<br>
I have added a new CMake
variable
"LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION",
to control if the new Python
scripts for managing SWIG
generating the API are enabled
or not. This is disabled by
default to not impact other
platforms. This variable can be
removed once we move all the
platforms to the Python scripts
from the shell scripts. There's
some cleanup to be done, which
I'll be working on.<br>
<br>
Please let me know if there are
any issues or comments.<br>
<br>
Thanks,<br>
Deepak
<div>
<div><br>
<br>
On 24/06/14 12:23, Deepak
Panickal wrote:<br>
</div>
</div>
</div>
<div>
<div>
<blockquote type="cite">
<div>Yes, it was compiling
with MSVC 2013. It hasn't
been updated though since
the review was submitted.<br>
We're working on it now,
so should be fixed to
current tip and upstreamed
soon.<br>
<br>
Thanks,<br>
Deepak<br>
<br>
On 24/06/14 01:24, Zachary
Turner wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">By the way,
does this compile with
MSVC 2013? Many of the
changes I had to make to
get things compiling
don't seem to be present
in this patch.</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">
On Mon, Jun 23, 2014
at 5:16 PM, Zachary
Turner <span dir="ltr"><<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Interesting.
I had already
made some progress
towards this in my
own branch, so
I'll have a look.
<div><br>
</div>
<div>BTW, I'm not
sure what your
solution was
regarding the
missing python
modules, but the
pexpect one in
particualr is
pretty trivial
to fix. Just
change it to
subprocess.run()
and remove the
import of
pexpect.</div>
</div>
<div>
<div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On
Mon, Jun 23,
2014 at 5:09
PM, Deepak
Panickal <span dir="ltr"><<a href="mailto:deepak@codeplay.com" target="_blank">deepak@codeplay.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div>We have
already ported
the lldb.py
generating
scripts to
Python for
portability
and got the
API working in
Windows and
Linux.<br>
We can load an
ELF file, dump
symbols, do
remote
debugging etc.<br>
This work has
been put into
review
sometime ago,
so might need
some updation.<br>
<br>
<a href="http://llvm-reviews.chandlerc.com/D2980" target="_blank">http://reviews.llvm.org/D2980</a><br>
<br>
We're planning
to fix it up
quite soon to
match with the
current tip.<br>
<br>
Thanks,<br>
Deepak
<div>
<div><br>
<br>
On 23/06/2014
22:09, Zachary
Turner wrote:<br>
</div>
</div>
</div>
<div>
<div>
<blockquote type="cite">
<div dir="ltr">I'm
already
volunteering,
just want to
make sure it's
ok before I do
the work :)
<div><br>
</div>
<div>That
being said,
Greg mentions
in an earlier
message that
it might not
be possible
because we
wish to
support a
Python-less
build. Who
uses this out
of curiosity?
I don't think
any Windows
developers
mind
installing
Python as a
requirement.
It's also
mentioned on
the Building
LLDB page (<a href="http://lldb.llvm.org/build.html" target="_blank">http://lldb.llvm.org/build.html</a>)
that Python is
a dependency</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On
Mon, Jun 23,
2014 at 2:07
PM, Todd Fiala
<span dir="ltr"><<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">You
can volunteer
to write it
more portably
;-)</div>
<div class="gmail_extra">
<div>
<div><br>
<br>
<div class="gmail_quote">On
Mon, Jun 23,
2014 at 1:55
PM, Zachary
Turner <span dir="ltr"><<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hmm,
a shell
script. kind
of a
non-starter
for Windows.
Any reason
this can't be
a python
script?</div>
<div>
<div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On
Mon, Jun 23,
2014 at 1:52
PM, Greg
Clayton <span dir="ltr"><<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It
is generated
by running
swig with many
options. See:<br>
<br>
lldb/scripts/build-swig-wrapper-classes.sh<br>
<div><br>
<br>
<br>
> On Jun
23, 2014, at
1:41 PM,
Zachary Turner
<<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>>
wrote:<br>
><br>
> I'm
trying to get
the test suite
into a working
state on
windows, or at
the very least
get it to the
point where it
fails by
saying that
none of the
tests are
supported on
this platform.
I seem to be
missing this
file lldb.py
though. Is it
supposed to be
in the tree,
or is it
generated
somehow?<br>
</div>
>
_______________________________________________<br>
> lldb-dev
mailing list<br>
> <a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
<br>
_______________________________________________<br>
lldb-dev
mailing list<br>
<a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
</div>
</div>
<span><font color="#888888">--
<br>
<div dir="ltr">
<table cellpadding="0" cellspacing="0">
<tbody>
<tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small">
<td style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px" nowrap>Todd Fiala |</td>
<td style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px" nowrap> Software Engineer |</td>
<td style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px" nowrap> <a href="mailto:tfiala@google.com" style="color:rgb(17,85,204)" target="_blank"><span style="background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">tfiala@google.com</span></a> |</td>
<td style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px" nowrap><font color="#1155cc"> <a>650-943-3180</a></font></td>
</tr>
</tbody>
</table>
<br>
</div>
</font></span></div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
lldb-dev mailing list
<a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a>
</pre>
</blockquote>
<br>
</div>
</div>
</div>
<br>
_______________________________________________<br>
lldb-dev
mailing list<br>
<a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
lldb-dev mailing list
<a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a>
</pre>
</blockquote>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</div></div></div>
</blockquote></div><br></div>