Bug #3886

cannot list the pathname of my own modules in backtrace on mswin64

Added by Usaku NAKAMURA almost 5 years ago. Updated about 4 years ago.

[ruby-dev:42306]
Status:Closed
Priority:Normal
Assignee:Usaku NAKAMURA
ruby -v:ruby 1.9.3dev (2010-09-29 trunk 29360) [x64-mswin64] Backport:

Description

=begin
r29352 によって、WindowsでもSEGV時等にバックトレースが出力さ
れるようになりましたが(ぱちぱちぱち)、64bit版だと、なぜかruby
自身のモジュールのパス名が出力できていません。

モジュールのパス名は、そのモジュール用にアロケートされているベ
ースアドレスをハンドルとみなしてGetModuleFileName()に渡せば取
得できるという仮定に基づいて取得しているわけですが、
(1) ベースアドレスを正しく取得できていない
(2) その仮定はx64版Windowsでは成り立つとは限らない
のいずれかの理由によってうまくいっていないようです。

以上、自分が後で思い出すためのメモでした。
=end

History

#1 Updated by shintaro kuwamoto almost 5 years ago

=begin
ちょうど手元でSEGVしたので見てました。型宣言が違うようです。

Index: ../vm_dump.c
===================================================================
--- ../vm_dump.c (リビジョン 29361)
+++ ../vm_dump.c (作業コピー)
@@ -661,7 +661,7 @@
BOOL (WINAPI *pSymInitialize)(HANDLE, const char *, BOOL);
BOOL (WINAPI *pSymCleanup)(HANDLE);
BOOL (WINAPI *pStackWalk64)(DWORD, HANDLE, HANDLE, STACKFRAME64 *, void *, PREAD_PROCESS_MEMORY_ROUTINE64, PFUNCTION_TABLE_ACCESS_ROUTINE64, PGET_MODULE_BASE_ROUTINE64, PTRANSLATE_ADDRESS_ROUTINE64);
- BOOL (WINAPI *pSymGetModuleBase64)(HANDLE, DWORD64);
+ DWORD64 (WINAPI *pSymGetModuleBase64)(HANDLE, DWORD64);
BOOL (WINAPI *pSymFromAddr)(HANDLE, DWORD64, DWORD64 *, SYMBOL_INFO *);
BOOL (WINAPI *pSymGetLineFromAddr64)(HANDLE, DWORD64, DWORD *, IMAGEHLP_LINE64 *);
HANDLE (WINAPI *pOpenThread)(DWORD, BOOL, DWORD);
@@ -674,7 +674,7 @@
pSymInitialize = (BOOL (WINAPI *)(HANDLE, const char *, BOOL))GetProcAddress(dbghelp, "SymInitialize");
pSymCleanup = (BOOL (WINAPI *)(HANDLE))GetProcAddress(dbghelp, "SymCleanup");
pStackWalk64 = (BOOL (WINAPI *)(DWORD, HANDLE, HANDLE, STACKFRAME64 *, void *, PREAD_PROCESS_MEMORY_ROUTINE64, PFUNCTION_TABLE_ACCESS_ROUTINE64, PGET_MODULE_BASE_ROUTINE64, PTRANSLATE_ADDRESS_ROUTINE64))GetProcAddress(dbghelp, "StackWalk64");
- pSymGetModuleBase64 = (BOOL (WINAPI *)(HANDLE, DWORD64))GetProcAddress(dbghelp, "SymGetModuleBase64");
+ pSymGetModuleBase64 = (DWORD64 (WINAPI *)(HANDLE, DWORD64))GetProcAddress(dbghelp, "SymGetModuleBase64");
pSymFromAddr = (BOOL (WINAPI *)(HANDLE, DWORD64, DWORD64 *, SYMBOL_INFO *))GetProcAddress(dbghelp, "SymFromAddr");
pSymGetLineFromAddr64 = (BOOL (WINAPI *)(HANDLE, DWORD64, DWORD *, IMAGEHLP_LINE64 *))GetProcAddress(dbghelp, "SymGetLineFromAddr64");
pOpenThread = (HANDLE (WINAPI *)(DWORD, BOOL, DWORD))GetProcAddress(GetModuleHandle("kernel32.dll"), "OpenThread");
=end

#2 Updated by Usaku NAKAMURA almost 5 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r29374.
Usaku, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Also available in: Atom PDF