[Lldb-commits] [PATCH] D69589: [lldb] Refactor all POST_BUILD commands into targets

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 31 11:02:45 PDT 2019


I see your concern about source and target paths for Python files, but I also think it is valuable that it is really easy to find examples of using lldb with the Python SB API's - both with toy examples and with fully worked examples.  I know people have found and copied from here to good effect, whereas if they were somewhere buried in the source tree, that would be less likely to happen.  So however this ends up I don't want any of these scripts to be hard to find in the sources, and would rather they all stay in a common directory sub-tree to that end.

Jim

> On Oct 31, 2019, at 2:02 AM, Pavel Labath via Phabricator via lldb-commits <lldb-commits at lists.llvm.org> wrote:
> 
> labath accepted this revision.
> labath added a comment.
> This revision is now accepted and ready to land.
> 
> This looks great to me. Maybe wait a while to see if anyone else has any thoughts on this?
> 
> This not your fault, but the thing that bothers me about this build process (and which this patch makes visible) is how the locations of the python files in source bear absolutely no resemblance to the locations the files will end up installed.  For instance, I would never have expected that something from the "examples" folder ends up in an actual shippable artifact. I think it would be great if we could rearrange the sources so that their source layout roughly matches the way in which they are going to be used...
> 
> 
> 
> ================
> Comment at: lldb/CMakeLists.txt:133
> +  add_copy_file_target(lldb_python_init
> +    FILES          "${lldb_scripts_dir}/lldb.py"
> +    DEST_DIR       "${lldb_python_build_path}"
> ----------------
> hhb wrote:
>> labath wrote:
>>> Would it be possible to just make the swig step place this file into the correct place directly?
>> The difficulty is that, there is a config time path dependency like this:
>> 
>> swig_wrapper -> liblldb -> finish_swig (renamed to lldb_python_packages in this change)
>> 
>> Where liblldb uses the path of LLDBWrapPython.cpp in swig_wrapper. And here we reference the path of liblldb, to calculate the right path for python packages.
>> 
>> That means when swig_wrapper is created, we don't have a good way to figure out the right path for python packages and put the file there directly.
>> 
>> The best way to solve this is to hard code liblldb path for framework build. I.e. replace line 92 here:
>> 
>> ```
>> get_target_property(liblldb_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
>> ```
>> 
>> With something more constant. This removes the liblldb -> finish_swig dependency. Then all the code here can be moved to scripts/CMakeLists.txt (I think they belong there better anyway). And swig_wrapper can get access to python package path.
>> 
>> The only question is whether we can / should "predict" liblldb path for framework... I'll look more into this. But it probably deserves a separate change.
> Ok, that sounds fair. I think it would be great if this stuff could be moved to the scripts folder.
> 
> 
> Repository:
> rG LLVM Github Monorepo
> 
> CHANGES SINCE LAST ACTION
> https://reviews.llvm.org/D69589/new/
> 
> https://reviews.llvm.org/D69589
> 
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits



More information about the lldb-commits mailing list