hello-world crashes under debug libraries of 4.9

60 views
Skip to first unread message

Danny Dorfman

unread,
Feb 17, 2016, 9:25:31 AM2/17/16
to v8-users
Hello there,

I successfully made an installation of the V8 4.9  stable version and I am having trouble with the hello-world program.
If I compile and link it against the "release" dynamic library, everything works fine. But if I switch to "debug", I get the following crash:

# gdb hello-world
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-80.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
Reading symbols from /root/v8/samples/hello-world...done.
(gdb) run
Starting program: /root/v8/samples/hello-world 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
[New Thread 0x7ffff52ec700 (LWP 31545)]
[New Thread 0x7ffff4aeb700 (LWP 31546)]
[New Thread 0x7ffff42ea700 (LWP 31547)]
[New Thread 0x7ffff3ae9700 (LWP 31548)]

Program received signal SIGSEGV, Segmentation fault.
v8::internal::Map::instance_type (this=0x3f5c00000000) at .././src/objects-inl.h:4424
4424  return static_cast<InstanceType>(READ_BYTE_FIELD(this, kInstanceTypeOffset));
Missing separate debuginfos, use: debuginfo-install glibc-2.17-106.el7_2.1.x86_64 libgcc-4.8.5-4.el7.x86_64 libstdc++-4.8.5-4.el7.x86_64
(gdb) bt

#0  v8::internal::Map::instance_type (this=0x1d2400000000) at .././src/objects-inl.h:4424
#1  0x00007ffff6f5a7e6 in v8::internal::Object::IsWeakCell (this=0x19f6746c5851) at .././src/objects-inl.h:844
#2  0x00007ffff73af45b in v8::internal::WeakFixedArray::Get (this=0x19f67467c7b9, index=78) at .././src/objects-inl.h:2466
#3  0x00007ffff75d8480 in v8::internal::WeakFixedArray::Remove (this=0x19f67467c7b9, value=...) at ../src/objects.cc:10706
#4  0x00007ffff75e3741 in v8::internal::SharedFunctionInfo::SetScript (shared=..., script_object=...) at ../src/objects.cc:13581
#5  0x00007ffff7295d10 in v8::internal::Compiler::GetSharedFunctionInfo (literal=0x687548, script=..., outer_info=0x7fffffffbed8) at ../src/compiler.cc:1676
#6  0x00007ffff7448cc7 in v8::internal::FullCodeGenerator::VisitFunctionLiteral (this=0x7fffffffbb48, expr=0x687548) at ../src/full-codegen/full-codegen.cc:1295
#7  0x00007ffff6f89501 in v8::internal::FunctionLiteral::Accept (this=0x687548, v=0x7fffffffbb48) at ../src/ast/ast.cc:28
#8  0x00007ffff74448cf in v8::internal::FullCodeGenerator::Visit (this=0x7fffffffbb48, node=0x687548) at .././src/full-codegen/full-codegen.h:961
#9  0x00007ffff7445174 in v8::internal::FullCodeGenerator::VisitForAccumulatorValue (this=0x7fffffffbb48, expr=0x687548) at .././src/full-codegen/full-codegen.h:364
#10 0x00007ffff7904384 in v8::internal::FullCodeGenerator::VisitFunctionDeclaration (this=0x7fffffffbb48, declaration=0x687640) at ../src/full-codegen/x64/full-codegen-x64.cc:837
#11 0x00007ffff6f8910e in v8::internal::FunctionDeclaration::Accept (this=0x687640, v=0x7fffffffbb48) at ../src/ast/ast.cc:28
#12 0x00007ffff74448cf in v8::internal::FullCodeGenerator::Visit (this=0x7fffffffbb48, node=0x687640) at .././src/full-codegen/full-codegen.h:961
#13 0x00007ffff6f8d87a in v8::internal::AstVisitor::VisitDeclarations (this=0x7fffffffbb48, declarations=0x674d40) at ../src/ast/ast.cc:775
#14 0x00007ffff74445e1 in v8::internal::FullCodeGenerator::VisitDeclarations (this=0x7fffffffbb48, declarations=0x674d40) at ../src/full-codegen/full-codegen.cc:381
#15 0x00007ffff79016c6 in v8::internal::FullCodeGenerator::Generate (this=0x7fffffffbb48) at ../src/full-codegen/x64/full-codegen-x64.cc:319
#16 0x00007ffff7441e5b in v8::internal::FullCodeGenerator::MakeCode (info=0x7fffffffbed8) at ../src/full-codegen/full-codegen.cc:49
#17 0x00007ffff72960ae in v8::internal::GenerateBaselineCode (info=0x7fffffffbed8) at ../src/compiler.cc:812
#18 0x00007ffff72959f9 in v8::internal::Compiler::GetSharedFunctionInfo (literal=0x68b290, script=..., outer_info=0x7fffffffd2d0) at ../src/compiler.cc:1651
#19 0x00007ffff7448cc7 in v8::internal::FullCodeGenerator::VisitFunctionLiteral (this=0x7fffffffcdb8, expr=0x68b290) at ../src/full-codegen/full-codegen.cc:1295
#20 0x00007ffff6f89501 in v8::internal::FunctionLiteral::Accept (this=0x68b290, v=0x7fffffffcdb8) at ../src/ast/ast.cc:28
#21 0x00007ffff74448cf in v8::internal::FullCodeGenerator::Visit (this=0x7fffffffcdb8, node=0x68b290) at .././src/full-codegen/full-codegen.h:961
#22 0x00007ffff7445174 in v8::internal::FullCodeGenerator::VisitForAccumulatorValue (this=0x7fffffffcdb8, expr=0x68b290) at .././src/full-codegen/full-codegen.h:364
#23 0x00007ffff790b828 in v8::internal::FullCodeGenerator::VisitAssignment (this=0x7fffffffcdb8, expr=0x68b4b0) at ../src/full-codegen/x64/full-codegen-x64.cc:1824
#24 0x00007ffff6f896b1 in v8::internal::Assignment::Accept (this=0x68b4b0, v=0x7fffffffcdb8) at ../src/ast/ast.cc:28
#25 0x00007ffff74448cf in v8::internal::FullCodeGenerator::Visit (this=0x7fffffffcdb8, node=0x68b4b0) at .././src/full-codegen/full-codegen.h:961
#26 0x00007ffff7446444 in v8::internal::FullCodeGenerator::VisitForEffect (this=0x7fffffffcdb8, expr=0x68b4b0) at .././src/full-codegen/full-codegen.h:358
#27 0x00007ffff7446aa1 in v8::internal::FullCodeGenerator::VisitExpressionStatement (this=0x7fffffffcdb8, stmt=0x68b350) at ../src/full-codegen/full-codegen.cc:809
#28 0x00007ffff6f891ce in v8::internal::ExpressionStatement::Accept (this=0x68b350, v=0x7fffffffcdb8) at ../src/ast/ast.cc:28
#29 0x00007ffff74448cf in v8::internal::FullCodeGenerator::Visit (this=0x7fffffffcdb8, node=0x68b350) at .././src/full-codegen/full-codegen.h:961
#30 0x00007ffff6f8d901 in v8::internal::AstVisitor::VisitStatements (this=0x7fffffffcdb8, statements=0x674c28) at ../src/ast/ast.cc:783
#31 0x00007ffff7901907 in v8::internal::FullCodeGenerator::Generate (this=0x7fffffffcdb8) at ../src/full-codegen/x64/full-codegen-x64.cc:338
#32 0x00007ffff7441e5b in v8::internal::FullCodeGenerator::MakeCode (info=0x7fffffffd2d0) at ../src/full-codegen/full-codegen.cc:49
#33 0x00007ffff72960ae in v8::internal::GenerateBaselineCode (info=0x7fffffffd2d0) at ../src/compiler.cc:812
#34 0x00007ffff729e1ad in v8::internal::CompileBaselineCode (info=0x7fffffffd2d0) at ../src/compiler.cc:819
#35 0x00007ffff729421f in v8::internal::CompileToplevel (info=0x7fffffffd2d0) at ../src/compiler.cc:1305
#36 0x00007ffff72950c4 in v8::internal::Compiler::CompileScript (source=..., script_name=..., line_offset=0, column_offset=0, resource_options=..., source_map_url=..., context=..., 
    extension=0x0, cached_data=0x0, compile_options=v8::ScriptCompiler::kNoCompileOptions, natives=v8::internal::NATIVES_CODE, is_module=false) at ../src/compiler.cc:1531
#37 0x00007ffff6fc7af1 in v8::internal::Bootstrapper::CompileNative (isolate=0x62acd0, name=..., source=..., argc=2, argv=0x7fffffffd800) at ../src/bootstrapper.cc:1871
#38 0x00007ffff6fc7e1c in v8::internal::Bootstrapper::CompileExperimentalBuiltin (isolate=0x62acd0, index=0) at ../src/bootstrapper.cc:1820
#39 0x00007ffff6fd23a0 in v8::internal::Genesis::InstallExperimentalNatives (this=0x7fffffffde80) at ../src/bootstrapper.cc:2864
#40 0x00007ffff6fd5403 in v8::internal::Genesis::Genesis (this=0x7fffffffde80, isolate=0x62acd0, maybe_global_proxy=..., global_proxy_template=..., extensions=0x7fffffffe060, 
    context_type=v8::internal::FULL_CONTEXT) at ../src/bootstrapper.cc:3466
#41 0x00007ffff6fba474 in v8::internal::Bootstrapper::CreateEnvironment (this=0x6420b0, maybe_global_proxy=..., global_proxy_template=..., extensions=0x7fffffffe060, 
    context_type=v8::internal::FULL_CONTEXT) at ../src/bootstrapper.cc:327
#42 0x00007ffff6f3401f in v8::CreateEnvironment (isolate=0x62acd0, extensions=0x7fffffffe060, global_template=..., maybe_global_proxy=...) at ../src/api.cc:5490
#43 0x00007ffff6f0e3e9 in v8::Context::New (external_isolate=0x62acd0, extensions=0x7fffffffe060, global_template=..., global_object=...) at ../src/api.cc:5518
#44 0x0000000000408d00 in main ()

Any idea what's happening here? How do I fix this?

Regards,
Danny

Jochen Eisinger

unread,
Feb 18, 2016, 3:57:25 AM2/18/16
to v8-users
What exact version of v8 did you use, and how did you compile hello world?

When I build with make library=shared x64.debug, executing hello_world works fine for me.

best
-jochen

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Danny Dorfman

unread,
Feb 18, 2016, 4:06:47 AM2/18/16
to v8-users
v8-version.h shows:

#define V8_MAJOR_VERSION 4
#define V8_MINOR_VERSION 9
#define V8_BUILD_NUMBER 385
#define V8_PATCH_LEVEL 18

hello-world.cc was built like this:
# g++ -I/usr hello-world.cc -o hello-world -Wl,--start-group /usr/lib64/{libv8_libbase.a,libv8_libplatform.a} -Wl,--end-group -lv8 -lrt -ldl -pthread -std=c++11

Danny Dorfman

unread,
Feb 18, 2016, 8:33:51 AM2/18/16
to v8-users
I found out the nature of the problem. I forgot to exchange the *_blob.bin files with those of the "debug" version.

Sorry for your trouble ...

Zac Hansen

unread,
Feb 22, 2016, 2:13:47 PM2/22/16
to v8-users
It's much easier doing your testing work with the libv8_nosnapshot library instead.  That way you never have to worry about it.  Startup overhead is like.. fractions of a second worse - you'd have to run thousands of times for it to be worse than forgetting to update your blob files once.

Danny Dorfman

unread,
Feb 26, 2016, 11:54:52 PM2/26/16
to v8-users
Sounds like a great idea, Zac. Is its use documented someplace?

Zac Hansen

unread,
Feb 26, 2016, 11:57:27 PM2/26/16
to v8-u...@googlegroups.com
you just link libv8_nosnapshot instead of libv8_external_snapshot.

You'll know you did it right when you delete the .bin files and your program still works.



You received this message because you are subscribed to a topic in the Google Groups "v8-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/v8-users/Y25TiAY6350/unsubscribe.
To unsubscribe from this group and all its topics, send an email to v8-users+u...@googlegroups.com.

Curtis Jones

unread,
Feb 28, 2016, 12:27:32 AM2/28/16
to v8-users
How would you properly check for the bins? It does print an error so it knows they are not there, but its a void that does not throw exceptions.

Zac Hansen

unread,
Feb 28, 2016, 12:29:25 AM2/28/16
to v8-u...@googlegroups.com
I don't know.  I've never figured that out.   That's why I just use the no_snapshot option and don't worry about it.


Danny Dorfman

unread,
Feb 28, 2016, 2:52:36 AM2/28/16
to v8-users
Zac, I don't quite follow you. Currently, my build line (for hello-world) doesn't have either  libv8_nosnapshot or libv8_external_snapshot.
Still, it compiles, builds, and runs (searching for those .bin files). How do I make the switch?

Zac Hansen

unread,
Feb 28, 2016, 2:54:36 AM2/28/16
to v8-u...@googlegroups.com
Here's an example command line I use to compile/link a program (on OS X);

clang++ -I./ -I/Users/xaxxon/v8  -std=c++14 -I/usr/local/include  -Wall -Werror  samples/exception_sample.cpp -o samples/exception_sample -L/usr/local/lib -L/Users/xaxxon/v8/out/x64.debug/  libv8toolkit.a -lv8_base -lv8_libbase -lv8_base -lv8_libplatform -lv8_nosnapshot -licudata -licuuc -licui18n  


You can see I link against libv8_nosnapshot

Reply all
Reply to author
Forward
0 new messages