Skip to content

Commit 01d7370

Browse files
author
Florin Papa
committed
Enable folly::Symbolizer for debug symbols
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.
1 parent 99f57fe commit 01d7370

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CMake/Options.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ option(ENABLE_PROXYGEN_SERVER "Build the Proxygen HTTP server" ON)
3131
option(ENABLE_SPLIT_DWARF "Reduce linker memory usage by putting debugging information into .dwo files" OFF)
3232

3333
IF (LINUX)
34-
option(MAP_TEXT_HUGE_PAGES "Remap hot static code onto huge pages" ON)
34+
option(MAP_TEXT_HUGE_PAGES "Remap hot static code onto huge pages" ON)
35+
IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
36+
option(ENABLE_FOLLY_SYMBOLIZER "Use folly::Symbolizer to obtain debug symbols when mapping text section onto huge pages" ON)
37+
ENDIF()
3538
ENDIF()
3639

3740
IF (NOT DEFAULT_CONFIG_DIR)

hphp/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/tools/oss-repo-mode
108108

109109
add_definitions("-DUSE_CMAKE")
110110

111+
if (ENABLE_FOLLY_SYMBOLIZER)
112+
add_definitions(-DUSE_FOLLY_SYMBOLIZER)
113+
endif()
114+
111115
enable_language(ASM)
112116

113117
link_libraries(folly)

hphp/util/portability.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@
231231
//////////////////////////////////////////////////////////////////////
232232

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

0 commit comments

Comments
 (0)