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

Support Android kernels running with a 16kB page size #2040

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## TBD

### Enhancements

* Support for Android Kernels with a 16kB page size
[]()

### Bug fixes

* Corrected the behavior when `Bugsnag.startSession` is called when `config.autoTrackSessions=true`, the first automatic session will now be correctly discarded
Expand Down
24 changes: 14 additions & 10 deletions bugsnag-android-core/src/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
set(BUGSNAG_VERSION 1.0.1)
add_library( # Specifies the name of the library.
bugsnag-root-detection
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
jni/root_detection.c
)
bugsnag-root-detection
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
jni/root_detection.c
)

include_directories(jni)

set_target_properties(bugsnag-root-detection
PROPERTIES
COMPILE_OPTIONS
-Werror -Wall -pedantic)
set(EXTRA_LINK_FLAGS "-Wl,-z,max-page-size=16384")

set_target_properties(
bugsnag-root-detection
PROPERTIES
COMPILE_OPTIONS -Werror -Wall -pedantic
LINK_FLAGS "${EXTRA_LINK_FLAGS}"
)
36 changes: 20 additions & 16 deletions bugsnag-plugin-android-anr/src/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
set(BUGSNAG_VERSION 1.0.1)
add_library( # Specifies the name of the library.
bugsnag-plugin-android-anr
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
jni/anr_google.c
jni/anr_handler.c
jni/bugsnag_anr.c
jni/utils/string.c
)
bugsnag-plugin-android-anr
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
jni/anr_google.c
jni/anr_handler.c
jni/bugsnag_anr.c
jni/utils/string.c
)

include_directories(jni)

set(EXTRA_LINK_FLAGS "-Wl,-z,max-page-size=16384")

target_link_libraries( # Specifies the target library.
bugsnag-plugin-android-anr
# Links the log library to the target library.
log)
bugsnag-plugin-android-anr
# Links the log library to the target library.
log)

set_target_properties(bugsnag-plugin-android-anr
PROPERTIES
COMPILE_OPTIONS
-Werror -Wall -pedantic)
set_target_properties(
bugsnag-plugin-android-anr
PROPERTIES
COMPILE_OPTIONS -Werror -Wall -pedantic
LINK_FLAGS "${EXTRA_LINK_FLAGS}"
)
90 changes: 47 additions & 43 deletions bugsnag-plugin-android-ndk/src/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,58 +1,62 @@
set(BUGSNAG_VERSION 1.0.1)
add_library( # Specifies the name of the library.
bugsnag-ndk

# Sets the library as a shared library.
SHARED

# Provides a relative path to your source file(s).
jni/bugsnag_ndk.c
jni/bugsnag.c
jni/metadata.c
jni/safejni.c
jni/jni_cache.c
jni/event.c
jni/featureflags.c
jni/internal_metrics.c
jni/handlers/signal_handler.c
jni/handlers/cpp_handler.cpp
jni/utils/crash_info.c
jni/utils/serializer/buffered_writer.c
jni/utils/serializer/event_writer.c
jni/utils/serializer/BSG_KSJSONCodec.c
jni/utils/serializer/BSG_KSCrashStringConversion.c
jni/utils/stack_unwinder.cpp
jni/utils/seqlock.c
jni/utils/serializer.c
jni/utils/string.c
jni/utils/threads.c
jni/utils/memory.c
jni/deps/parson/parson.c
bugsnag-ndk

# Sets the library as a shared library.
SHARED

# Provides a relative path to your source file(s).
jni/bugsnag_ndk.c
jni/bugsnag.c
jni/metadata.c
jni/safejni.c
jni/jni_cache.c
jni/event.c
jni/featureflags.c
jni/internal_metrics.c
jni/handlers/signal_handler.c
jni/handlers/cpp_handler.cpp
jni/utils/crash_info.c
jni/utils/serializer/buffered_writer.c
jni/utils/serializer/event_writer.c
jni/utils/serializer/BSG_KSJSONCodec.c
jni/utils/serializer/BSG_KSCrashStringConversion.c
jni/utils/stack_unwinder.cpp
jni/utils/seqlock.c
jni/utils/serializer.c
jni/utils/string.c
jni/utils/threads.c
jni/utils/memory.c
jni/deps/parson/parson.c
)

include_directories(
jni
jni/deps
jni/external/libunwindstack-ndk/include
jni
jni/deps
jni/external/libunwindstack-ndk/include
)

target_include_directories(bugsnag-ndk PRIVATE ${BUGSNAG_DIR}/assets/include)

target_link_libraries( # Specifies the target library.
bugsnag-ndk
# Links the log library to the target library.
log)
target_link_libraries(
# Specifies the target library.
bugsnag-ndk
# Links the log library to the target library.
log
)

# Avoid exporting symbols in release mode to keep internals private
# More symbols are exported in debug mode for the sake of unit testing
set(EXTRA_LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_LIST_DIR}/exported_native_symbols-${CMAKE_BUILD_TYPE}.txt")

set_target_properties(bugsnag-ndk
PROPERTIES
COMPILE_OPTIONS -Werror -Wall -pedantic
LINK_FLAGS "${EXTRA_LINK_FLAGS}"
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES)
set(EXTRA_LINK_FLAGS "-Wl,-z,max-page-size=16384,--version-script=${CMAKE_CURRENT_LIST_DIR}/exported_native_symbols-${CMAKE_BUILD_TYPE}.txt")

set_target_properties(
bugsnag-ndk
PROPERTIES
COMPILE_OPTIONS -Werror -Wall -pedantic
LINK_FLAGS "${EXTRA_LINK_FLAGS}"
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
)

add_subdirectory(jni/external/libunwindstack-ndk/cmake)
target_link_libraries(bugsnag-ndk unwindstack)
9 changes: 9 additions & 0 deletions examples/sdk-app-example/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,14 @@ find_package(bugsnag-plugin-android-ndk REQUIRED CONFIG)
add_library(entrypoint SHARED
src/main/cpp/entrypoint.cpp)

set(EXTRA_LINK_FLAGS "-Wl,-z,max-page-size=16384")

target_include_directories(entrypoint PRIVATE ${BUGSNAG_INCLUDE_DIR})
target_link_libraries(entrypoint bugsnag-plugin-android-ndk::bugsnag-ndk)

set_target_properties(
entrypoint
PROPERTIES
COMPILE_OPTIONS -Werror -Wall -pedantic
LINK_FLAGS "${EXTRA_LINK_FLAGS}"
)
4 changes: 2 additions & 2 deletions scripts/run-cpp-check.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cppcheck --error-exitcode=2 --enable=warning,performance bugsnag-plugin-android-anr/src/main/jni && \
cppcheck --error-exitcode=2 --enable=warning,performance bugsnag-plugin-android-ndk/src/main/jni -i bugsnag-plugin-android-ndk/src/main/jni/deps -i bugsnag-plugin-android-ndk/src/main/jni/external
cppcheck --error-exitcode=2 --enable=warning,performance --check-level=exhaustive bugsnag-plugin-android-anr/src/main/jni && \
cppcheck --error-exitcode=2 --enable=warning,performance --check-level=exhaustive bugsnag-plugin-android-ndk/src/main/jni -i bugsnag-plugin-android-ndk/src/main/jni/deps -i bugsnag-plugin-android-ndk/src/main/jni/external
Loading