Add native name demangling support
Currently, to demangle C++ names in dis(1) and mdb(1) (at least), we rely on the closed-source Sun Studio libdemangle.so library to do the work (they both use dlopen(3c) to avoid a link-time dependency).
It would be better to have our own open source implementation. In the x86 world, the amd64 ABI for C++ includes the mangling format. As best as I can tell, recent versions of g++ also use the same mangling for x86 (32-bit). We can leverage the MIT-licensed demangling implementation in LLVM's libcxx and port it back from C++ to C to simplify the task (as the mangling is rather complex and even though documented, isn't always as clear as it can be). Unfortunately, there is no documentation I'm aware of that documents the name mangling for the Sun Studio on Sparc. g++ on sparc however appears to use the same mangling as it does on x86. As such the native library will use a different name so that those that wish to can continue to use the closed-source studio libdemangle.so and c++filt.
Updated by Electric Monk over 2 years ago
- Status changed from In Progress to Closed
- % Done changed from 70 to 100
commit 4226f635096bf9d814aa9fb335518c4855bbe3a3 Author: Jason King <firstname.lastname@example.org> Date: 2018-10-13T19:26:51.000Z 6375 Add native name demangling support Reviewed by: Robert Mustacchi <email@example.com> Reviewed by: Richard Lowe <firstname.lastname@example.org> Approved by: Dan McDonald <email@example.com>