Skip to content

Commit

Permalink
Enable folly::Symbolizer for debug symbols
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Florin Papa committed Feb 9, 2018
1 parent 99f57fe commit 01d7370
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CMake/Options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ option(ENABLE_PROXYGEN_SERVER "Build the Proxygen HTTP server" ON)
option(ENABLE_SPLIT_DWARF "Reduce linker memory usage by putting debugging information into .dwo files" OFF)

IF (LINUX)
option(MAP_TEXT_HUGE_PAGES "Remap hot static code onto huge pages" ON)
option(MAP_TEXT_HUGE_PAGES "Remap hot static code onto huge pages" ON)
IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
option(ENABLE_FOLLY_SYMBOLIZER "Use folly::Symbolizer to obtain debug symbols when mapping text section onto huge pages" ON)
ENDIF()
ENDIF()

IF (NOT DEFAULT_CONFIG_DIR)
Expand Down
4 changes: 4 additions & 0 deletions hphp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/tools/oss-repo-mode

add_definitions("-DUSE_CMAKE")

if (ENABLE_FOLLY_SYMBOLIZER)
add_definitions(-DUSE_FOLLY_SYMBOLIZER)
endif()

enable_language(ASM)

link_libraries(folly)
Expand Down
1 change: 0 additions & 1 deletion hphp/util/portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@
//////////////////////////////////////////////////////////////////////

#if FACEBOOK
#define USE_FOLLY_SYMBOLIZER 1
// Linking in libbfd is a gigantic PITA, but if folly symbolizer doesn't
// work on your platform, you'll need to figure it out.
#define HAVE_LIBBFD 1
Expand Down

0 comments on commit 01d7370

Please sign in to comment.