ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: Koichi Sasada <ko1@atdot.net>
To: Ruby developers <ruby-core@ruby-lang.org>, Greg.mpls@gmail.com
Subject: [ruby-core:90127] Re: [Ruby trunk Bug#15348] r66003 Support targetting TracePoint - MinGW
Date: Thu, 29 Nov 2018 02:13:18 +0900	[thread overview]
Message-ID: <904ab409-8db0-7dc0-de98-c9b3cc2f0e0f@atdot.net> (raw)
In-Reply-To: <redmine.issue-15348.20181127194226.6fdf6629de41d8d7@ruby-lang.org>

On my msys2 environment, it hits!

On my environemnt,

```
using
```

only this script hangs.


And I found these articles:

http://www.agardner.me/golang/windows/cgo/64-bit/setjmp/longjmp/2016/02/29/go-windows-setjmp-x86.html

 > Following the thread’s advice, I was able to work around the issue by 
using the compiler’s built-in functions __builtin_setjmp and 
__builtin_longjmp instead of setjmp and longjmp. These seem to be 
alternative implementations included in GCC which don’t call msvcrt.dll. 
The downside is that the __builtin functions are GCC-specific and not 
technically user-facing. They could change in any release. But using the 
built-in functions did fix the crash bug, and now exception handling is 
working correctly in my project.

https://sourceforge.net/p/mingw-w64/bugs/406/
 > https://github.com/antoniovazquezblanco/nspire_emu uses setjmp and 
longjmp (emu.c) and crashes when used in a 64bit windows environment 
because setjmp sets the stack register value to 0x10. Using 
__builtin_setjump avoids the problem because the stack register doesn't 
get messed (doesn't seem to call setjmp3 function of the 
C:\Windows\SysWOW64\msvcrt.dll library).

I changed config.h to

```
#define RUBY_SETJMP(env) __builtin_setjmp((env))
#define RUBY_LONGJMP(env,val) __builtin_longjmp((env),val)
```

and this test passes!!!

I'm not sure it is correct way, but could you try it?

Thanks,
Koichi

On 2018/11/28 4:42, Greg.mpls@gmail.com wrote:
> Issue #15348 has been reported by MSP-Greg (Greg L).
> 
> ----------------------------------------
> Bug #15348: r66003 Support targetting TracePoint - MinGW
> https://bugs.ruby-lang.org/issues/15348
> 
> * Author: MSP-Greg (Greg L)
> * Status: Open
> * Priority: Normal
> * Assignee:
> * Target version:
> * ruby -v:
> * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN
> ----------------------------------------
> This has caused failures in spec/ruby/core/main/using_spec.rb, specifically the first spec.
> 
> On Appveyor, trying several versions of both specs, the first one (`eval('using', TOPLEVEL_BINDING)`) fails, the second one (`eval('using "foo"', TOPLEVEL_BINDING)`) passes.
> 
> Locally (Windows 10), all versions of both specs have always passed using the same build (saved as an artifact) from Appveyor...
> 
> 
> 

-- 
// SASADA Koichi at atdot dot net

  reply	other threads:[~2018-11-28 17:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-15348.20181127194226@ruby-lang.org>
2018-11-27 19:42 ` [ruby-core:90094] [Ruby trunk Bug#15348] r66003 Support targetting TracePoint - MinGW Greg.mpls
2018-11-28 17:13   ` Koichi Sasada [this message]
2018-11-28 18:41 ` [ruby-core:90132] " Greg.mpls
2018-11-28 21:36 ` [ruby-core:90138] " Greg.mpls

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=904ab409-8db0-7dc0-de98-c9b3cc2f0e0f@atdot.net \
    --to=ruby-core@ruby-lang.org \
    --cc=Greg.mpls@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).