This is an archive of the discontinued LLVM Phabricator instance.

cmake: provide flag that enables 'log enable --stack' to provide useful file/line info on POSIX systems
ClosedPublic

Authored by tfiala on Oct 12 2015, 12:59 PM.

Details

Summary

This change addresses:
https://llvm.org/bugs/show_bug.cgi?id=25133

On Linux (and likely other GNU ld-based systems), the llvm backtrace utility used by 'log enable --stack' cannot walk through private symbols in liblldb.so. This makes the --stack option useless just about everywhere but OS X. This change provides a way to address that.

By default, nothing changes. However, if the cmake -DLLDB_EXPORT_ALL_SYMBOLS=TRUE option is provided (also a CACHE variable, so can be set via UI), then on non-Windows systems, we'll drop exporting a named list of symbols, and tell the linker to export all symbols. This allows the backtrace mechanism used by 'log enable --stack' to find file/line number info, and makes introspection of source code within lldb much more productive.

The change is a do-nothing operation on Windows.

On OS X cmake builds, the additional linker option is not needed (nor is it supported by the linker).

Google folks - feel free to adjust the Linux-side reviewers. Just looking for representation.

Ed - I'd guess FreeBSD was in the same boat as Linux here.

Diff Detail

Event Timeline

tfiala updated this revision to Diff 37150.Oct 12 2015, 12:59 PM
tfiala retitled this revision from to cmake: provide flag that enables 'log enable --stack' to provide useful file/line info on POSIX systems.
tfiala updated this object.
tfiala added reviewers: emaste, chaoren.
tfiala added subscribers: lldb-commits, labath.

I've been using this now for a couple days and it seems to work fine on both OS X and Linux. The Linux side enables the 'log enable --stack' to work.

Any concerns with this?

brucem accepted this revision.Oct 13 2015, 11:48 PM
brucem added a reviewer: brucem.
brucem added a subscriber: brucem.

lgtm

This revision is now accepted and ready to land.Oct 13 2015, 11:48 PM

sounds reasonable

tfiala closed this revision.Oct 14 2015, 7:54 AM

Closed by the following commit:

svn commit
Sending        cmake/modules/AddLLDB.cmake
Sending        cmake/modules/LLDBConfig.cmake
Sending        source/API/CMakeLists.txt
Transmitting file data ...
Committed revision 250299.