Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable folly::Symbolizer for debug symbols #8123

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

florinpapa
Copy link

This PR enables folly::Symbolizer in HHVM, in order to have debug symbols (in stacktraces, perf, GDB) when huge pages are enabled (default behavior for open source builds). This feature can be
turned off by setting the CMake option ENABLE_FOLLY_SYMBOLIZER to OFF.

Also, one nice side-effect is that this change causes HHVM to show symbols in backtraces (after a crash) for non-huge-pages builds, which were missing for some reason.

It also fixes an issue with the build system, by creating a new cmake file that initializes the OS variables and including it before Options.cmake, where these variables are used. More specifically, MAP_TEXT_HUGE_PAGES and ENABLE_FOLLY_SYMBOLIZER are set depending on the value of the LINUX variable, which is only set in HPHPCompiler.cmake, included later. This causes these 2 variables not to be visible in third-party modules the first time configure is run (subsequent times the variables are taken from the cmake cache).

This PR depends on hhvm/hhvm-third-party#123.

Florin Papa added 2 commits February 9, 2018 11:32
In the Options.cmake file, MAP_TEXT_HUGE_PAGES and ENABLE_FOLLY_SYMBOLIZER
are set depending on the value of the LINUX variable, which is only set in
a file included later - HPHPCompiler.cmake. This causes these 2 variables not
to be visible in third-party modules the first time configure is run
(subsequent times the variables are taken from the cmake cache).

This change fixes this behavior by adding a new cmake file that sets the OS
variables and including it before Options.cmake.
This change depends on hhvm/hhvm-third-party#123,
which enables 2 additional source files to be compiled and adds libunwind as a
dependency for folly. The "-lgcc_s" added before "-lunwind" is used to solve a
linking order issue that causes "_Ux86_64_setcontext" to be called from
libunwind instead of libgcc_s and messes up the signal mask
(more details here http://savannah.nongnu.org/bugs/?48486). The libgcc_s
dependency is already part of HHVM, this change enforces the order in which
the libraries are linked.

By enabling folly::Symbolizer, HHVM will show debug symbols (in stacktraces,
perf, GDB) when huge pages are enabled (default behavior for open
source builds). Also, one nice side-effect is that this change causes HHVM
to show symbols in backtraces (after a crash) for non-huge-pages builds,
which were missing for some reason.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants