GithubHelp home page GithubHelp logo

castxml crash about castxml HOT 6 CLOSED

castxml avatar castxml commented on July 23, 2024
castxml crash

from castxml.

Comments (6)

thewtex avatar thewtex commented on July 23, 2024

Please try with clang / llvm from this GitHub organization to see if this can be reproduced with those versions.

from castxml.

mamoll avatar mamoll commented on July 23, 2024

I wasn't able to get a completely working version of clang++ with the clang / llvm from this GitHub organization (mainly because I didn't put in the time to also download and install cfe, compiler-rt, libc++, etc.). The version in Macports is fairly recent and seems to include all of Brad King's fixes. I forgot to mention this, but the unit tests all pass. Anyway, it's exciting that an alternative to gccxml that can handle modern C++ is being developed!

from castxml.

bradking avatar bradking commented on July 23, 2024

From the lldb log shown I don't see how you convinced castxml to process a translation unit. No input file is given. Do you have sample C++ code that causes this crash?

from castxml.

bradking avatar bradking commented on July 23, 2024

No input file is given

Oops, I didn't notice the horizontal scroll and it happened to be cut off on a whitespace character.

The bindings/util.h input file may contain some content that happens to trigger the crash that the test suite does not. Please narrow it as much as possible and provide a sample source file.

from castxml.

mamoll avatar mamoll commented on July 23, 2024

Here's some more info. The problem turns out to be in Boost (I use Boost 1.57, installed via MacPorts). I used the latest CastXML from the repo. CastXML crashes, e.g., on ${prefix}/include/boost/random/mersenne_twister.hpp:

> lldb /usr/local/castxml/bin/castxml 
(lldb) target create "/usr/local/castxml/bin/castxml"
Current executable set to '/usr/local/castxml/bin/castxml' (x86_64).
(lldb) r -v -x c++  --castxml-gccxml  -iwithprefix /opt/local/libexec/llvm-3.6/lib/c++/v1 -I"/opt/local/include" /opt/local/include/boost/random/mersenne_twister.hpp  -o=foo.xml
Process 61609 launched: '/usr/local/castxml/bin/castxml' (x86_64)
clang version 3.6.0 (tags/RELEASE_360/final)
Target: x86_64-apple-darwin14.1.0
Thread model: posix
clang -cc1 version 3.6.0 based upon LLVM 3.6.0 default target x86_64-apple-darwin14.1.0
ignoring nonexistent directory "/usr/local/castxml/include/c++/v1"
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
 /opt/local/include
 /usr/local/include
 /usr/local/castxml/share/castxml/clang/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
 /opt/local/libexec/llvm-3.6/lib/c++/v1
End of search list.
Process 61609 stopped
* thread #1: tid = 0x298779, 0x0000000100020c6c castxml`clang::FunctionType::getReturnType() const + 12, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x18)
    frame #0: 0x0000000100020c6c castxml`clang::FunctionType::getReturnType() const + 12
castxml`clang::FunctionType::getReturnType() const + 12:
-> 0x100020c6c:  movq   0x18(%rdi), %rdi
   0x100020c70:  movq   %rdi, -0x8(%rbp)
   0x100020c74:  movq   -0x8(%rbp), %rax
   0x100020c78:  popq   %rbp
(lldb) bt
* thread #1: tid = 0x298779, 0x0000000100020c6c castxml`clang::FunctionType::getReturnType() const + 12, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x18)
  * frame #0: 0x0000000100020c6c castxml`clang::FunctionType::getReturnType() const + 12
    frame #1: 0x0000000100017beb castxml`ASTVisitor::AddDumpNode(clang::Decl const*, bool) + 427
    frame #2: 0x000000010001899e castxml`ASTVisitor::AddDeclContextMembers(clang::DeclContext const*, std::__1::set<unsigned int, std::__1::less<unsigned int>, std::__1::allocator<unsigned int> >&) + 750
    frame #3: 0x0000000100018972 castxml`ASTVisitor::AddDeclContextMembers(clang::DeclContext const*, std::__1::set<unsigned int, std::__1::less<unsigned int>, std::__1::allocator<unsigned int> >&) + 706
    frame #4: 0x000000010001e7d5 castxml`ASTVisitor::PrintMembersAttribute(clang::DeclContext const*) + 69
    frame #5: 0x000000010001cf7f castxml`ASTVisitor::OutputTranslationUnitDecl(clang::TranslationUnitDecl const*, ASTVisitorBase::DumpNode const*) + 303
    frame #6: 0x000000010001a1ae castxml`ASTVisitor::OutputDecl(clang::Decl const*, ASTVisitorBase::DumpNode const*) + 1710
    frame #7: 0x0000000100019aa4 castxml`ASTVisitor::ProcessQueue() + 660
    frame #8: 0x00000001000208c6 castxml`ASTVisitor::HandleTranslationUnit(clang::TranslationUnitDecl const*) + 614
    frame #9: 0x000000010002099d castxml`outputXML(clang::CompilerInstance&, clang::ASTContext const&, llvm::raw_ostream&, Options const&) + 125
    frame #10: 0x0000000100042b7d castxml`ASTConsumer::HandleTranslationUnit(clang::ASTContext&) + 333
    frame #11: 0x00000001001fc7c2 castxml`clang::ParseAST(S=0x0000000103049c00, PrintStats=false, SkipFunctionBodies=<unavailable>) + 391 at ParseAST.cpp:151
    frame #12: 0x00000001000e672c castxml`clang::FrontendAction::Execute(this=<unavailable>) + 62 at FrontendAction.cpp:428
    frame #13: 0x00000001000c4d14 castxml`clang::CompilerInstance::ExecuteAction(this=0x0000000102907140, Act=0x0000000102907620) + 450 at CompilerInstance.cpp:811
    frame #14: 0x000000010003f998 castxml`runClangCI(clang::CompilerInstance*, Options const&) + 856
    frame #15: 0x000000010003e532 castxml`runClangImpl(char const* const*, char const* const*, Options const&) + 4434
    frame #16: 0x000000010003d371 castxml`runClang(char const* const*, char const* const*, Options const&) + 3105
    frame #17: 0x0000000100003e58 castxml`main + 5976
    frame #18: 0x00007fff8e4195c9 libdyld.dylib`start + 1

from castxml.

bradking avatar bradking commented on July 23, 2024

Thanks. I was able to narrow the boost header down to:

int f(int* p) { return __atomic_fetch_add(p, 0, 0); }

The problem is that the builtin function has no prototype.

Commit 4402138 should fix this.

from castxml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.