Bug 445235 - Java/Ada/D demangling is probably broken
Summary: Java/Ada/D demangling is probably broken
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on: 445184
Blocks:
  Show dependency treegraph
 
Reported: 2021-11-09 22:52 UTC by Nick Nethercote
Modified: 2023-01-29 21:09 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Nethercote 2021-11-09 22:52:43 UTC
+++ This bug was initially created as a clone of Bug #445184 +++

Valgrind has code to demangle symbols for: C++, Rust, Java, Ada, and D. But the Java/Ada/D demangling is probably broken because the code is unreachable.

`VG_(demangle)` has an initial test that requires that the first two chars be "_Z" or "_R", which excludes a bunch of cases. Also, the code in `ML_(cplus_demangle)` that calls the demanglers for Java/Ada/D is a bit different to that for C++ and Rust (in the way the `*_DEMANGLING` constants are used), which may also be a problem.

From a quick look at the code, I think the following is true.
- C++ symbols usually start with "_Z", but "_GLOBAL_" is also possible, which won't work.
- Rust symbols start with "_Z" or "_R".
- Java symbols are a subset of C++ symbols, so should be ok, modulo possible "_GLOBAL_" cases, and possible AUTO_DEMANGLING problems.
- D symbols start with "_D", and so will be broken.
- Ada symbols can start with "_ada_", or with a lower-case letter, and so will be broken.
Comment 1 Paul Floyd 2023-01-29 21:09:38 UTC
The D demangling should be fixed (see https://bugs.kde.org/show_bug.cgi?id=464969)