Project

General

Profile

Feature #11267

Add rust demangling support

Added by Jason King 4 months ago. Updated 3 months ago.

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

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

Upstream of Joyent OS-7478:

With the replacement of the closed source C++ demangler, the design deliberately left open the possibilities of demangling other languages with the library. We should go ahead and extend it to support demangling rust given the high amount of interest in using it with SmartOS.

Specifically, it supports demangling rust names up to 1.35. The not yet (as of the time of issue creation) released 1.36 rust changes the demangling format, however it does so in a manner that will not interfere. Basically the demangling library will merely not recognize any names mangled using the 1.36 and later format at this time (that will be a future feature).

History

#1

Updated by Jason King 4 months ago

Also upstream of Joyent OS-7723 (the rust demangler adds a build dependency on libcustr that was missed in OS-7478). It makes the most sense to upstream both as a single change.

#2

Updated by Jason King 4 months ago

It seems appropriate to also upstream Joyent OS-7695 at the same time as this:

OS-7478 introduced support for demangling rust names. One of the consequences of that was that the language parameter used by mdb(1) was changed from C++ to auto detect. This unfortunately exposed a corner case not caught earlier – both EINVAL and ENOTSUP are both legitimate demangler failure modes – the former being when the name itself appears to be a known language, but fails demangling, while the latter when the demangler cannot determine which language the mangled name is from (which can only happen when the language is set to SYSDEM_LANG_AUTO).

The fix is simple – on failure, also check for ENOTSUP and don't print any warnings when this occurs. It also means the warnings can be ignored as annoying spam, as it happens on names that wouldn't be demangled in the first place (so mdb will just print out the original symbol name).

The other consumers of the demangler never bothered to report any errors in the demangler – at best they used the old DEMANGLE_ESPACE to retry with a larger buffer, but unlike mdb, never output any demangling errors.

#3

Updated by Electric Monk 3 months ago

git commit 6a6cfa5d0723a95a9ad915bdb8ca2c9731449041

commit  6a6cfa5d0723a95a9ad915bdb8ca2c9731449041
Author: Jason King <jason.king@joyent.com>
Date:   2019-07-05T01:08:28.000Z

    11267 Add rust demangling support
    Reviewed by: Michal Nowak <mnowak@startmail.com>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

#4

Updated by Joshua M. Clulow 3 months ago

  • Status changed from New to Closed

Also available in: Atom PDF