Set compiler to optimize for debuggability.

Filter cruft from logs and cores output, and attempt to invoke `ulimit -c unlimited` inline before invoking bazel.
diff --git a/.github/workflows/test_ruby.yml b/.github/workflows/test_ruby.yml
index d8adf3e..2e8e561 100644
--- a/.github/workflows/test_ruby.yml
+++ b/.github/workflows/test_ruby.yml
@@ -51,13 +51,20 @@
           image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:{0}-6.3.0-66964dc8b07b6d1fc73a5cc14e59e84c1c534cea', matrix.ruby) }}
           credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
           bazel-cache: ruby_linux/${{ matrix.ruby }}_${{ matrix.bazel }}
-          bazel: test //ruby/... //ruby/tests:ruby_version --test_env=KOKORO_RUBY_VERSION --test_env=BAZEL=true ${{ matrix.ffi == 'FFI' && '--//ruby:ffi=enabled --test_env=PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION=FFI' || '' }}
+          bash: |
+            # Allow core dumps
+            ulimit -c unlimited 
+            # Run Bazel
+            /entrypoint.sh test //ruby/... //ruby/tests:ruby_version --test_env=KOKORO_RUBY_VERSION --test_env=BAZEL=true ${{ matrix.ffi == 'FFI' && '--//ruby:ffi=enabled --test_env=PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION=FFI' || '' }} ${{ env.BAZEL_FLAGS }}
       - uses: actions/upload-artifact@v3
         with:
           name: logs-and-cores
           path: |
             logs/
             core*
+            !core.rb
+            !core.h
+            !**/.DS_Store
 
   linux-aarch64:
     name: Linux aarch64
diff --git a/ruby/lib/google/tasks/ffi.rake b/ruby/lib/google/tasks/ffi.rake
index 30caeba..2b38189 100644
--- a/ruby/lib/google/tasks/ffi.rake
+++ b/ruby/lib/google/tasks/ffi.rake
@@ -12,7 +12,7 @@
 
   task.add_include_path third_party_path
   task.add_define 'NDEBUG'
-  task.cflags << "-std=gnu99 -O0 -g"
+  task.cflags << "-std=gnu99 -Og -g"
   [
     :convert, :defs, :map, :message, :protobuf, :repeated_field, :wrap_memcpy
   ].each { |file| task.exclude << "/#{file}.c" }