-
Notifications
You must be signed in to change notification settings - Fork 33
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
Allow to use crash handler code from the crashpad library #62
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The log message should explain why this change is being made and maybe link to the internal ticket.
handler/CMakeLists.txt
Outdated
target_include_directories(handler PUBLIC ..) | ||
else () | ||
add_executable(handler main.cc) | ||
set_property(TARGET handler PROPERTY ENABLE_EXPORTS 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't need to specify ENABLE_EXPORTS
if a separate target is being generated for the static library.
handler/CMakeLists.txt
Outdated
|
||
if (ANDROID) | ||
if (CUSTOM_CRASHPAD_HANDLER_DESTINATION) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should CUSTOM_CRASHPAD_HANDLER_DESTINATION
be supported for the static library as well?
handler/CMakeLists.txt
Outdated
target_compile_features(handler PUBLIC cxx_std_17) | ||
target_include_directories(handler PRIVATE ..) | ||
target_link_libraries(handler PRIVATE client tools compat snapshot minidump) | ||
if (HANDLER STREQUAL "INTEGRATED") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of having the user set a separate, likely hard to find CMake variable, maybe create the static library unconditionally, or maybe conditioned on ANDROID
instead, along with a comment explaining how is intended to be used. Something like,
# Used to implement a work-around for launching the Crashpad handler stored in an APK.
if (ANDROID)
add_library(handlerlib STATIC ${CRASHPAD_HANDLER_LIBRARY_FILES})
target_compile_features(handlerlib PUBLIC cxx_std_17)
target_link_libraries(handlerlib PRIVATE client tools compat snapshot minidump)
target_include_directories(handlerlib PUBLIC ..)
endif(ANDROID)
This would require updating the name used in the backtrace-android commit:
target_link_libraries(backtrace-native handlerlib)
handler/CMakeLists.txt
Outdated
COMMAND ${CMAKE_COMMAND} -E copy | ||
$<TARGET_FILE:handler> | ||
${CUSTOM_CRASHPAD_HANDLER_DESTINATION} | ||
COMMAND ${CMAKE_COMMAND} -E copy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit) These changes seem unnecessary in this PR.
Why
Crashpad allows using direct methods like HandlerMain to generate a minidump and send it via Java Crash Handler. Right now, we're including crashpad handler code in the crashpad_handler.so we're unable to call methods like HandlerMain.
This change allows defining a variable that cmake can set to tell where to include handler code.
ref: BT-2852