Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring bindgen up-to-date and add some fixes #200

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

m8nmueller
Copy link

  • API changes of scala-native (renaming to unsafe, casts, array typing, struct field access, alloc call)
  • a segfault in bindgen/ir/Record.cpp (for unknown reasons, I have to admit)
  • illegal scala code generated for anonymous struct members (as used for unions)

@m8nmueller
Copy link
Author

Segfault appeared:

Program received signal SIGSEGV, Segmentation fault.
0x000000000046249c in Record::usesType(std::shared_ptr<Type const> const&, bool, std::vector<std::shared_ptr<Type const>, std::allocator<std::shared_ptr<Type const> > >&) const ()
(gdb) bt 10
#0  0x000000000046249c in Record::usesType(std::shared_ptr<Type const> const&, bool, std::vector<std::shared_ptr<Type const>, std::allocator<std::shared_ptr<Type const> > >&) const ()
#1  0x000000000047a4bc in TypeDef::usesType(std::shared_ptr<Type const> const&, bool, std::vector<std::shared_ptr<Type const>, std::allocator<std::shared_ptr<Type const> > >&) const ()
#2  0x00000000004580ac in IR::isTypeUsed(std::shared_ptr<Type const> const&, std::vector<std::shared_ptr<Type const>, std::allocator<std::shared_ptr<Type const> > >&) const ()
#3  0x0000000000454934 in IR::shouldOutput(std::shared_ptr<LocatableType const> const&, std::vector<std::shared_ptr<Type const>, std::allocator<std::shared_ptr<Type const> > >&) const ()
#4  0x0000000000453624 in operator<<(llvm::raw_ostream&, IR const&) ()
#5  0x0000000000426248 in main ()

With debug symbols:

Program received signal SIGSEGV, Segmentation fault.
Record::usesType (this=<optimized out>, type=warning: RTTI symbol not found for class 'std::_Sp_counted_ptr_inplace<Enum, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>'
warning: RTTI symbol not found for class 'std::_Sp_counted_ptr_inplace<Enum, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>'
std::shared_ptr<const Type> (use count 4, weak count 1) = {...}, stopOnTypeDefs=<optimized out>, visitedTypes=...)
    at /tmp/nix-build-scala-native-bindgen-0.1.0.drv-0/bindgen/ir/Record.cpp:37
37	/tmp/nix-build-scala-native-bindgen-0.1.0.drv-0/bindgen/ir/Record.cpp: No such file or directory.
(gdb) f
#0  Record::usesType (this=<optimized out>, type=warning: RTTI symbol not found for class 'std::_Sp_counted_ptr_inplace<Enum, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>'
warning: RTTI symbol not found for class 'std::_Sp_counted_ptr_inplace<Enum, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>'
std::shared_ptr<const Type> (use count 4, weak count 1) = {...}, stopOnTypeDefs=<optimized out>, visitedTypes=...)
    at /tmp/nix-build-scala-native-bindgen-0.1.0.drv-0/bindgen/ir/Record.cpp:37
warning: Source file is more recent than executable.
37	        if (*field->getType() == *type ||
(gdb) print field
$1 = warning: RTTI symbol not found for class 'std::_Sp_counted_ptr_inplace<Field, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>'
warning: RTTI symbol not found for class 'std::_Sp_counted_ptr_inplace<Field, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>'
std::shared_ptr<Field> (use count 1, weak count 0) = {get() = 0x2727d7a0}

(gdb) print *field
$2 = {<TypeAndName> = {name = <incomplete type>, type = std::shared_ptr<const Type> (empty) = {get() = 0x0}}, offsetInBits = 0}

(gdb) print type
$3 = warning: RTTI symbol not found for class 'std::_Sp_counted_ptr_inplace<Enum, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>'
warning: RTTI symbol not found for class 'std::_Sp_counted_ptr_inplace<Enum, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>'
std::shared_ptr<const Type> (use count 4, weak count 1) = {get() = 0x26f46fa8}
(gdb) print *type
$4 = {<std::enable_shared_from_this<Type>> = {_M_weak_this = warning: RTTI symbol not found for class 'std::_Sp_counted_ptr_inplace<Enum, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>'
warning: RTTI symbol not found for class 'std::_Sp_counted_ptr_inplace<Enum, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>'
std::weak_ptr<Type> (use count 4, weak count 1) = {get() = 0x26f46fa8}}, _vptr$Type = 0x14131a0 <vtable for Enum+208>}

Copy link

@WojciechMazur WojciechMazur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you for making it up to date with latest Scala Native.

@WojciechMazur
Copy link

I believe the changes should be also applied to tests, it's not catched becouse CI is broken and would require moving it from Travis to GHA. I would not be able to allocate a time for that soon.
Because this project is severely outdated and unmaintained I recommend to use an alternative https://github.com/indoorvivants/sn-bindgen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants