Skip to content

Instantly share code, notes, and snippets.

@jeromegn
Created May 8, 2018 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeromegn/11a7a73110b91c112e7ea5248ad01c39 to your computer and use it in GitHub Desktop.
Save jeromegn/11a7a73110b91c112e7ea5248ad01c39 to your computer and use it in GitHub Desktop.
require "./v8"
require "./fly/*"
require "http/server"
iso = V8::Isolate.new
ctx = V8::Context.new(iso)
cfn = V8::CrystalFunction.new(ctx, "blah", V8::FunctionCallback.new do |info|
info.args.each do |a|
puts "arg: '#{a.to_s}'"
end
nil
end)
global = ctx.global
global.set("addEventListener", cfn)
s = File.read("script.js").to_s
ctx.eval(s)
initing iso
init iso
got isolate in ISOLATE_SCOPE
init ctx
got isolate in ISOLATE_SCOPE
got isolate in ISOLATE_SCOPE
got isolate in ISOLATE_SCOPE
in fn, sizeof info:
8
to s: fetch
pointer of arg 0 is 0x7f82c450bdb0
to s: function (event) {
'blah';
event.respondWith(body)
}
pointer of arg 1 is 0x7f82c450c580
sizeof argv 16
sizeof ret 16
sizeof parsed thing: 16
initial pointer: Pointer(LibV8::PersistentValue)@0x7fff503995c0
arg 0
Pointer(Void)@0x7fff00000002
arg 1
Pointer(Void)@0x7fff503995c0
Slice(LibV8::PersistentValue)
16
got isolate in ISOLATE_SCOPE
got my value scope, value 0x7fff00000002
Received signal 11 SEGV_MAPERR 7fff00000002
==== C stack trace ===============================
[0x00011010f7d4]
[0x7fffccffab3a]
[0x000000000000]
[0x00010f8e483c]
[0x00010f876191]
[0x00010f8759d9]
[0x00010f92a701]
[0x00010f981c3c]
[0x00010f9812b3]
[0x3bdda93040bd]
[end of stack trace]
Program exited because of a segmentation fault (11)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment