Skip to content

[Bug] Bridj VC9Demangler parse fail #567

Open

Description

@MarvelFisher

Hi,
I encountered a problem that demangling vc symbolic:
"?setParamWithDefaultArgs@HelloWorld@@SAPEAV1@PEBD@Z" =>
“public: static class HelloWorld * __ptr64 __cdecl HelloWorld::setParamWithDefaultArgs(char const * __ptr64)”
but it return me : "public: static class HelloWorld * __ptr64 __cdecl HelloWorld::setParamWithDefaultArgs()"
missed parameters.

I find that, in VC9Demangler class void parseFunctionProperty(MemberRef mr) missed to parseParams() to paramTypes;
So I modified private List parseParams() ->

private List parseParams() throws DemanglingException {

    List<TypeRef> paramTypes = new ArrayList<TypeRef>();
    if (!consumeCharIf('X')) {          
        char c;            
        // add 3 line here
        if (peekChar() == '@') {
            consumeChar();
        }
        while ((c = peekChar() ) != '@' && c != 0 && (c != 'Z' || peekChar(2) == 'Z')) {

            TypeRef tr = parseType(false);
            if (tr == null) {
                continue;
            }
            paramTypes.add(tr);
        }
        if (c == 'Z') {
            consumeChar();
        }
        //break;
        if (c == '@') {
            consumeChar();
        }
    }
    return paramTypes;
}

and build it again.
seems resolved this problem.

I think this is not a best solution, I tried another case "?setParamWithDefaultArgs@HelloWorld@@SAPEAVLink@@PeBd@Z" can be parsed correctly.
I think the error should happened in returnType parser.

Activity

  1. MarvelFisher commented on May 27, 2015

    @MarvelFisher
    Author

    I found this problem with test a C++ singleton:
    class DllExport HelloWorld
    {
    public:
    HelloWorld(void);
    static HelloWorld *getInstance(const char *pszFlowPath = "default param");
    ~HelloWorld(void);
    };
    Compiled with VS2010; Exception : java.lang.UnsatisfiedLinkError throws in JVM runtime
    Then, I tried this case compile by GCC, works fine.

  2. koujun2012 commented on Aug 19, 2019

    @koujun2012

    I encounter this issue too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions