Project

General

Profile

Actions

Feature #6375

closed

Add native name demangling support

Added by Jason King almost 8 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
lib - userland libraries
Start date:
2015-10-22
Due date:
% Done:

100%

Estimated time:
Difficulty:
Hard
Tags:
needs-triage
Gerrit CR:
External Bug:

Description

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.

Actions #2

Updated by Electric Monk almost 5 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 70 to 100

git commit 4226f635096bf9d814aa9fb335518c4855bbe3a3

commit  4226f635096bf9d814aa9fb335518c4855bbe3a3
Author: Jason King <jason.brian.king@gmail.com>
Date:   2018-10-13T19:26:51.000Z

    6375 Add native name demangling support
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Richard Lowe <richlowe@richlowe.net>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF