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

Segmentation Fault on ParseHeader #1885

Open
junalmeida opened this issue Dec 24, 2024 · 2 comments
Open

Segmentation Fault on ParseHeader #1885

junalmeida opened this issue Dec 24, 2024 · 2 comments

Comments

@junalmeida
Copy link

junalmeida commented Dec 24, 2024

Brief Description

The application is aborting with Segmentation Fault. I could get the stack trace below by attaching gdb to the process spawned by dotnet run. The library CppSharp is referenced by nuget: <PackageReference Include="CppSharp" Version="1.1.5.3168" />.

OS: Linux (Ubuntu Noble, x86_64)

Used headers

/usr/include/x86_64-linux-gnu/qt6/QtCore/QtCore v6.8.1

Used settings
            driver.ParserOptions.MicrosoftMode = false;
            driver.ParserOptions.NoBuiltinIncludes = true;
            driver.ParserOptions.NoStandardIncludes = true;
            driver.ParserOptions.UnityBuild = true;
            driver.ParserOptions.SkipPrivateDeclarations = false;
            driver.ParserOptions.LanguageVersion = CppSharp.Parser.LanguageVersion.CPP17;

            driver.Options.GeneratorKind = GeneratorKind.CSharp;
            driver.Options.CheckSymbols = true;
            driver.Options.CompileCode = true;
            driver.Options.GenerateDefaultValuesForArguments = true;
            driver.Options.GenerateClassTemplates = true;
            driver.Options.MarshalCharAsManagedChar = true;
            driver.Options.CommentKind = CommentKind.BCPLSlash;

Target: x86_64-linux-gnu

Other settings

Stack trace or incompilable generated code
libCppSharp.CppParser.so!clang::DeclarationName::getStoredNameKind() (/home/runner/work/CppSharp/CppSharp/build/llvm/llvm-6eb36a-linux-x64-gcc-11-Release/clang/include/clang/AST/DeclarationName.h:266)
libCppSharp.CppParser.so!clang::DeclarationName::isIdentifier() (/home/runner/work/CppSharp/CppSharp/build/llvm/llvm-6eb36a-linux-x64-gcc-11-Release/clang/include/clang/AST/DeclarationName.h:384)
libCppSharp.CppParser.so!clang::DeclarationName::getAsIdentifierInfo() (/home/runner/work/CppSharp/CppSharp/build/llvm/llvm-6eb36a-linux-x64-gcc-11-Release/clang/include/clang/AST/DeclarationName.h:420)
libCppSharp.CppParser.so!clang::NamedDecl::getIdentifier() (/home/runner/work/CppSharp/CppSharp/build/llvm/llvm-6eb36a-linux-x64-gcc-11-Release/clang/include/clang/AST/Decl.h:268)
libCppSharp.CppParser.so!GetDeclName(const clang::NamedDecl * D, const clang::NamedDecl * D@entry) (/home/runner/work/CppSharp/CppSharp/src/CppParser/Parser.cpp:459)
libCppSharp.CppParser.so!CppSharp::CppParser::Parser::WalkTypeTemplateParameter(CppSharp::CppParser::Parser * const this, CppSharp::CppParser::Parser * const this@entry, const clang::TemplateTypeParmDecl * TTPD) (/home/runner/work/CppSharp/CppSharp/src/CppParser/Parser.cpp:1424)
libCppSharp.CppParser.so!CppSharp::CppParser::Parser::WalkType(CppSharp::CppParser::Parser * const this, CppSharp::CppParser::Parser * const this@entry, clang::QualType QualType, const clang::TypeLoc * TL, const clang::TypeLoc * TL@entry, bool DesugarType, bool DesugarType@entry) (/home/runner/work/CppSharp/CppSharp/build/llvm/llvm-6eb36a-linux-x64-gcc-11-Release/llvm/include/llvm/ADT/PointerIntPair.h:110)
libCppSharp.CppParser.so!CppSharp::CppParser::Parser::GetQualifiedType(CppSharp::CppParser::Parser * const this, clang::QualType qual, const clang::TypeLoc * TL) (/home/runner/work/CppSharp/CppSharp/src/CppParser/Parser.cpp:591)
libCppSharp.CppParser.so!CppSharp::CppParser::Parser::WalkParameter(CppSharp::CppParser::Parser * const this, CppSharp::CppParser::Parser * const this@entry, const clang::ParmVarDecl * PVD, const clang::ParmVarDecl * PVD@entry, const clang::SourceLocation & ParamStartLoc) (/home/runner/work/CppSharp/CppSharp/src/CppParser/Parser.cpp:3167)
libCppSharp.CppParser.so!CppSharp::CppParser::Parser::WalkFunction(CppSharp::CppParser::Parser * const this, CppSharp::CppParser::Parser * const this@entry, const clang::FunctionDecl * FD, const clang::FunctionDecl * FD@entry, CppSharp::CppParser::AST::Function * F, CppSharp::CppParser::AST::Function * F@entry) (/home/runner/work/CppSharp/CppSharp/src/CppParser/Parser.cpp:3374)
libCppSharp.CppParser.so!CppSharp::CppParser::Parser::WalkFunction(CppSharp::CppParser::Parser * const this, const clang::FunctionDecl * FD) (/home/runner/work/CppSharp/CppSharp/src/CppParser/Parser.cpp:3443)
libCppSharp.CppParser.so!CppSharp::CppParser::Parser::WalkFunctionTemplate(CppSharp::CppParser::Parser * const this, const clang::FunctionTemplateDecl * TD, const clang::FunctionTemplateDecl * TD@entry) (/home/runner/work/CppSharp/CppSharp/src/CppParser/Parser.cpp:1638)
libCppSharp.CppParser.so!CppSharp::CppParser::Parser::WalkDeclaration(CppSharp::CppParser::Parser * const this, CppSharp::CppParser::Parser * const this@entry, const clang::Decl * D, const clang::Decl * D@entry) (/home/runner/work/CppSharp/CppSharp/src/CppParser/Parser.cpp:4055)
libCppSharp.CppParser.so!CppSharp::CppParser::Parser::WalkDeclarationDef(CppSharp::CppParser::Parser * const this, CppSharp::CppParser::Parser * const this@entry, clang::Decl * D, clang::Decl * D@entry) (/home/runner/work/CppSharp/CppSharp/src/CppParser/Parser.cpp:3990)
libCppSharp.CppParser.so!CppSharp::CppParser::Parser::WalkAST(CppSharp::CppParser::Parser * const this, clang::TranslationUnitDecl * TU) (/home/runner/work/CppSharp/CppSharp/src/CppParser/Parser.cpp:3489)
libCppSharp.CppParser.so!clang::ParseAST(clang::Sema&, bool, bool) (Unknown Source:0)
libCppSharp.CppParser.so!CppSharp::CppParser::Parser::Parse(CppSharp::CppParser::Parser * const this, CppSharp::CppParser::Parser * const this@entry, const std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > & SourceFiles) (/usr/include/c++/11/bits/unique_ptr.h:173)
libCppSharp.CppParser.so!CppSharp::CppParser::ClangParser::ParseHeader(CppSharp::CppParser::CppParserOptions * Opts) (/home/runner/work/CppSharp/CppSharp/src/CppParser/Parser.cpp:4774)
[Unknown/Just-In-Time compiled code] (Unknown Source:0)
@tritao
Copy link
Collaborator

tritao commented Dec 24, 2024

We need the header code for reproduction.

@junalmeida
Copy link
Author

The header is QtCore 6.8.1

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

No branches or pull requests

2 participants