Skip to content

Commit

Permalink
Create sanitizer build mode (Gcc only)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed Jan 12, 2025
1 parent 2d19908 commit 356022f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Note that these are case sensitive!
* linuxathena
- `-PtgtIP`: Specifies where `./gradlew deploy` should try to copy the fat JAR to
- `-Pprofile`: enables JVM profiling
- `-PwithSanitizers`: On Linux, enables `-fsanitize=address,undefined,leak`

If you're cross-compiling, you'll need the wpilib toolchain installed. This can be done via Gradle: for example `./gradlew installArm64Toolchain` or `./gradlew installRoboRioToolchain`

Expand Down
6 changes: 6 additions & 0 deletions shared/config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ model {
withType(NativeBinarySpec).all {
nativeUtils.usePlatformArguments(it)
if (it.toolChain instanceof GccCompatibleToolChain) {
println("Hello! " + it)
it.cppCompiler.args << "-Wno-deprecated-enum-enum-conversion"

if (project.hasProperty('withSanitizers')) {
it.cppCompiler.args << "-fsanitize=address,undefined,leak" << "-g"
it.linker.args << "-fsanitize=address,undefined,leak"
}
}
}
}
Expand Down

0 comments on commit 356022f

Please sign in to comment.