From 246d7e4f1d92851356d459f424cbc3491135d1ac Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Sat, 12 Dec 2020 18:46:13 -0800 Subject: [PATCH] Dump a backtrace with gdb Because Ruby often fails to dump a C backtrace. --- bootstraptest/runner.rb | 1 + tool/lib/test/unit.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb index bda02355bd..fbf2572ffb 100755 --- a/bootstraptest/runner.rb +++ b/bootstraptest/runner.rb @@ -530,6 +530,7 @@ def cleanup_coredump core_path = "/tmp/bootstraptest-core.#{Time.now.utc.iso8601}" warn "A core file is found. Saving it at: #{core_path.dump}" FileUtils.mv('core', core_path) + system('gdb', RbConfig.ruby, '-c', core_path, '-ex', 'bt', '-batch') end FileUtils.rm_f Dir.glob('core.*') FileUtils.rm_f @ruby+'.stackdump' if @ruby diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb index 888905b36c..b292f25280 100644 --- a/tool/lib/test/unit.rb +++ b/tool/lib/test/unit.rb @@ -357,6 +357,7 @@ module Test core_path = "/tmp/test-unit-core.#{Time.now.utc.iso8601}" warn "A core file is found. Saving it at: #{core_path.dump}" FileUtils.mv('core', core_path) + system('gdb', RbConfig.ruby, '-c', core_path, '-ex', 'bt', '-batch') end STDERR.flush exit c