diff --git a/.github/workflows/buildAndTestCMake.yml b/.github/workflows/buildAndTestCMake.yml index caad5aa1142..616200721f0 100644 --- a/.github/workflows/buildAndTestCMake.yml +++ b/.github/workflows/buildAndTestCMake.yml @@ -65,7 +65,18 @@ jobs: uses: ./.github/actions/setup-build with: llvm-version: ${{ steps.llvm-version.outputs.version }} - + - name: Setup Core Dumps + run: | + sudo mkdir /cores + sudo chmod 777 /cores + # Core filenames will be of the form executable.pid.timestamp: + sudo bash -c 'echo "/cores/%e.%p.%t" > /proc/sys/kernel/core_pattern' + - name: Build and Run X + run: | + ulimit -c unlimited + make x + cat /proc/sys/kernel/core_pattern + ./x - name: Configure and Build LLVM shell: bash run: | @@ -73,10 +84,10 @@ jobs: env: CMAKE_BUILD_TYPE: Release MLIR_ENABLE_BINDINGS_PYTHON: ON - - name: Build and Test StableHLO (with AddressSanitizer) shell: bash run: | + ulimit -c unlimited # Enable core dumps to be captured (must be in same run block) ./build_tools/github_actions/ci_build_cmake.sh "$LLVM_BUILD_DIR" "$STABLEHLO_BUILD_DIR" env: CMAKE_BUILD_TYPE: Release @@ -89,4 +100,12 @@ jobs: ./build_tools/github_actions/ci_build_cmake.sh "$LLVM_BUILD_DIR" "$STABLEHLO_BUILD_DIR" env: CMAKE_BUILD_TYPE: Release - STABLEHLO_ENABLE_BINDINGS_PYTHON: ON \ No newline at end of file + STABLEHLO_ENABLE_BINDINGS_PYTHON: ON + + - name: Upload Core Dumps + if: ${{ failure() }} + uses: actions/upload-artifact@v4 + with: + name: crashes + path: /cores/* + if-no-files-found: ignore diff --git a/x.c b/x.c new file mode 100644 index 00000000000..2cb27d9b444 --- /dev/null +++ b/x.c @@ -0,0 +1,19 @@ +#include +#include + +int x() { + return 1; +} + +int y() { + return 1 + x(); +} + +int z() { + return 2 + y(); +} + +int main() { + kill(getpid(), SIGABRT); + return 3 + z(); +}