[lldb-dev] Using Python in LLDB on Windows

Zachary Turner zturner at google.com
Mon Jan 12 15:04:51 PST 2015


Seems reasonable to me.  I guess you'd do this so that You generate C++
#defines for these two CMake variables, and then during python
initialization, if the #defines exist you set them?

One thing to be careful of is that I think lldb.exe modifies sys.path on
startup, so as long as it doesn't stomp on that it's probably fine.

On Mon Jan 12 2015 at 2:53:07 PM Ted Woodward <ted.woodward at codeaurora.org>
wrote:

> The paths would be a command line (or gui) option in CMAKE. These would be
> passed in as a define in the build, and then used by code to set PYTHONHOME
> and PYTHONPATH right before python is initialized. If PYTHONHOME and
> PYTHONPATH exist in the environment at runtime the defaults would be
> ignored.
>
>
>
> --
>
> Qualcomm Innovation Center, Inc.
>
> The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
> Linux Foundation Collaborative Project
>
>
>
> *From:* Zachary Turner [mailto:zturner at google.com]
> *Sent:* Monday, January 12, 2015 4:26 PM
> *To:* Ted Woodward; lldb-dev at cs.uiuc.edu
> *Subject:* Re: [lldb-dev] Using Python in LLDB on Windows
>
>
>
> Would this be done by passing the paths you want to add as a command line
> option to LLDB?
>
> Is the PYTHONHOME actually needed?  The CMake already copies python27.dll
> to the output location, so lldb.exe should be able to find it since it's
> side by side.
>
> On Mon Jan 12 2015 at 2:18:48 PM Ted Woodward <ted.woodward at codeaurora.org>
> wrote:
>
> On Windows, there is no notion of a default python installation. A system
> may or may not have python installed. And if it did, but was a different
> version from the python used to build LLDB, we’d see behavior from warnings
> to modules not loading to crashes.
>
>
>
> Because of this, LLDB for Hexagon ships with the python DLLs and Lib
> directories in ../lib/python27, python27.dll, and is invoked via a batch
> file that sets PYTHONHOME to ../lib/python27, and PYTHONPATH to
> ../lib/site-packages (which contains the LLDB python files).
>
>
>
> The problem with using a batch file is it intercepts ctrl-c, so that
> doesn’t work to break into a running program. So I’d like to add code on
> Windows (inside #ifdef _WIN32) that will set PYTHONHOME and PYTHONPATH if
> they don’t exist. The values for these would be controlled by a CMAKE build
> option.
>
>
>
> Thoughts?
>
>
>
> --
>
> Qualcomm Innovation Center, Inc.
>
> The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
> Linux Foundation Collaborative Project
>
>
>
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20150112/4a74fbd5/attachment.html>


More information about the lldb-dev mailing list