This is an archive of the discontinued LLVM Phabricator instance.

[CMake] LLDB.framework tools handling
ClosedPublic

Authored by sgraenitz on May 26 2019, 11:32 PM.

Details

Summary

Modify the way LLDB.framework tools are collected. This allows for better fine-tuning of the install behavior downstream. Each target calls lldb_add_to_framework() individually. When entering the function, the target exists and we can tweak its very own post-build and install steps. This was not possible with the old LLDB_FRAMEWORK_TOOLS approach.

No function change otherwise.
This is a reduced follow-up from the proposal in D61952.

Diff Detail

Repository
rL LLVM

Event Timeline

sgraenitz created this revision.May 26 2019, 11:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 26 2019, 11:32 PM

lldb-vscode is no fremwork tool, but instead it needs the RPATHs

JDevlieghere added inline comments.May 28 2019, 10:46 AM
lldb/tools/argdumper/CMakeLists.txt
9 ↗(On Diff #201479)

Why do we need this in the framework? Is it only there for testing?

lldb/tools/darwin-debug/CMakeLists.txt
6 ↗(On Diff #201479)

Presumably this should be darwin-debug. But do we need it at all?

friss added a subscriber: friss.May 28 2019, 11:01 AM
friss added inline comments.
lldb/tools/argdumper/CMakeLists.txt
9 ↗(On Diff #201479)

It is definitely use by our process launch code.

lldb/tools/darwin-debug/CMakeLists.txt
6 ↗(On Diff #201479)

I think it has come in handy a handful of times to debug some issues. It's not needed for LLDB to do its job though.

sgraenitz marked an inline comment as done.

Fix copy/paste mistake for darwin-debug

Thanks for having a look. I'd to focus on the mechanism here and keep the contents of the framework bundle unchanged. Happy to discuss this in separate reviews like D62474.

lldb/tools/darwin-debug/CMakeLists.txt
6 ↗(On Diff #201479)

Thanks for catching that one!

This is a much nicer solution. Thanks for doing this.

lldb/tools/debugserver/source/CMakeLists.txt
268 ↗(On Diff #201479)

This should be debugserver.

JDevlieghere accepted this revision.May 28 2019, 11:23 AM
JDevlieghere added inline comments.
lldb/tools/argdumper/CMakeLists.txt
9 ↗(On Diff #201479)

I see, apparently it's used from Host::ShellExpandArguments

This revision is now accepted and ready to land.May 28 2019, 11:23 AM
clayborg added inline comments.
lldb/tools/darwin-debug/CMakeLists.txt
6 ↗(On Diff #201726)

We need it for launching in a terminal on macOS. So it actually is needed for "process launch --tty" on macOS

sgraenitz updated this revision to Diff 201859.May 29 2019, 4:15 AM
sgraenitz marked an inline comment as done.

Fixed debugserver; excluded changes in add_lldb_library() for now; result of this test looks as good as before:

$ cmake -GNinja -C../llvm-project/lldb/cmake/caches/Apple-lldb-macOS.cmake -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi;lldb" ../llvm-project/llvm
$ ninja lldb lldb-argdumper lldb-server darwin-debug debugserver lldb-framework
$ DESTDIR=install ninja install

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 29 2019, 4:26 AM

The typical trick for doing argument substitution before debugging was roughly to debug:

exec /bin/sh executable arg1 arg2 ...

then follow through the shell to the executable. That failed when SIP made it impossible to debug any of the shells, so we had to come up with another way to do shell expansion. That's what argdumper does. We run that under the user's shell and it just dumps the args array in a structured output so we can launch directly with those expanded arguments.