Feature #3875
closed[Patch] backtrace for i386-mswin32_100
Description
=begin
Naive implementation of backtrace for mswin.
ruby -e "Process.kill :SEGV, $$"
-e:1: [BUG] Segmentation fault
ruby 1.9.3dev (2010-09-19) [i386-mswin32_100]
-- control frame ----------
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :kill
c:0003 p:0019 s:0006 b:0006 l:000d9c d:001bbc EVAL -e:1
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:000d9c d:000d9c TOP
-- Ruby level backtrace information ----------------------------------------
-e:1:in <main>' -e:1:in
kill'
-- C level backtrace information -------------------------------------------
(KiFastSystemCallRet) [0x77af64f4]
(WaitForSingleObjectEx) [0x762ff003]
(WaitForSingleObject) [0x762fefb2]
(rb_w32_backtrace)(c:\jello\ruby\github\ruby\win32\win32.c:5796) [0x6f55f066]
(rb_vm_bugreport)(c:\jello\ruby\vm_dump.c:622) [0x6f591d2a]
(report_bug)(c:\jello\ruby\error.c:236) [0x6f52a0cb]
(rb_bug)(c:\jello\ruby\error.c:250) [0x6f52a101]
(sigsegv)(c:\jello\ruby\signal.c:613) [0x6f54f6d6]
(raise) [0x6f4cb416]
(kill)(c:\jello\ruby\win32\win32.c:3773) [0x6f55cce2]
(rb_f_kill)(c:\jello\ruby\signal.c:406) [0x6f54f60f]
(call_cfunc)(c:\jello\ruby\vm_insnhelper.c:315) [0x6f52c097]
(vm_call_cfunc)(c:\jello\ruby\vm_insnhelper.c:404) [0x6f52c352]
(vm_call_method)(c:\jello\ruby\vm_insnhelper.c:524) [0x6f53034a]
(vm_exec_core)(c:\jello\ruby\insns.def:1006) [0x6f5311d4]
(vm_exec)(c:\jello\ruby\vm.c:1146) [0x6f532a21]
(rb_iseq_eval_main)(c:\jello\ruby\vm.c:1387) [0x6f532b66]
(ruby_exec_internal)(c:\jello\ruby\eval.c:217) [0x6f50124e]
(ruby_exec_node)(c:\jello\ruby\eval.c:261) [0x6f5012b6]
(ruby_run_node)(c:\jello\ruby\eval.c:254) [0x6f502c83]
(main)(c:\jello\ruby\main.c:35) [0x001f1030]
(__tmainCRTStartup)(f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c:555) [0x001f11c1]
(BaseThreadInitThunk) [0x76301194]
(RtlInitializeExceptionChain) [0x77b0b495]
(RtlInitializeExceptionChain) [0x77b0b468]
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
=end
Files
Updated by nobu (Nobuyoshi Nakada) about 14 years ago
=begin
Hi,
At Sat, 25 Sep 2010 10:06:46 +0900,
Peter Weldon wrote in [ruby-core:32551]:
Naive implementation of backtrace for mswin.
Thank you.
May I ask a couple of questions?
- why StackWalk64 instead of StackWalk?
- why does it need another thread?
--
Nobu Nakada
=end
Updated by pweldon (Peter Weldon) about 14 years ago
- File 0002-Add-C-level-backtrace-for-MSWIN-x86.patch 0002-Add-C-level-backtrace-for-MSWIN-x86.patch added
=begin
- why StackWalk64 instead of StackWalk?
StackWalk64 supersedes StackWalk in the newer Windows SDKs and has support for x64.
- why does it need another thread?
It most probably doesn't. GetThreadContext() documentation says it is not guaranteed to return a valid context for running threads. What I think they mean is that the context will not remain valid after GetThreadContext() if the thread is running. As long as the existing stack at the time of the GetThreadContext() does not get modified while trying to walk it I don't think there would be a problem.
I've updated the patch to fix a mingw compile problem and fix some code style/formatting.
=end
Updated by nobu (Nobuyoshi Nakada) about 14 years ago
- Category set to core
- Status changed from Open to Assigned
- Assignee set to usa (Usaku NAKAMURA)
=begin
=end
Updated by pweldon (Peter Weldon) about 14 years ago
- File 0003-Add-C-level-backtrace-for-MSWIN-x86.patch 0003-Add-C-level-backtrace-for-MSWIN-x86.patch added
=begin
New version of patch:
- Fixed race condition
- Fixed event object leak
=end
Updated by usa (Usaku NAKAMURA) about 14 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r29352.
Peter, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end
Updated by usa (Usaku NAKAMURA) about 14 years ago
=begin
Thanks for your suggestion.
I've changed and added some details.
Please check it :)
=end
Updated by pweldon (Peter Weldon) about 14 years ago
=begin
Tested in:
- ruby 1.9.3dev (2010-09-28 trunk 29354) [i386-mingw32]
- ruby 1.9.3dev (2010-09-28) [i386-mswin32_100]
Beautiful. Thank you.
=end