10BC0 Function Name Demangling · Issue #23 · ran-j/PS2Recomp · GitHub
[go: up one dir, main page]

Skip to content

Function Name Demangling #23

@playmer

Description

@playmer

Something I noticed is that currently function names are still mangled. I'm not sure there's really an easy use for demangled names currently, given the modeling of every function as a c function that manipulates the PS2 model/runtime. You can't exactly implement them as classes with member functions, at least as it is now. But for those games with debug symbols and functionality implemented in C++, there's a fair bit of information that can be gleaned via demangling.

I explored this some time back and found that the mangling of the symbols in games I've seen seems to be pre-3.x gcc. At some point this ABI/mangling scheme was dropped, so you can't use modern c++filt implementations to demangle them, at least not that I've seen. Back then I had an old toolchain I was tinkering with, but for the use of this project you'd want something like a library for it.

I spent some time spelunking today and found that c++filt was moved to binutils at some point, and was able to grab a drop of 2.11.94 which could still demangle these names. I trimmed binutils' files down to the minimum required for it and set up a CMake in demonstration earlier: https://github.com/playmer/old_cxxfilt

Right now it's set up to build it as an executable, but it seems already set up for usage as a library. For the sake of the executable and running in MSVC, I've got the old mingw implementation of getopt in there, but that would be unneeded if used as a library.

Like I said, I'm not sure how this could be immediately used, looking at output from ps2recomp, perhaps something like grouping functions into files based on class might be appropriate as just one example. Perhaps the names could be cleaned up, maybe a comment placed above functions with their demangled representation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0