Summary: | Rust v0 symbol demangling is broken | ||
---|---|---|---|
Product: | [Developer tools] valgrind | Reporter: | Nick Nethercote <n.nethercote> |
Component: | general | Assignee: | Julian Seward <jseward> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | mark, philippe.waroquiers |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Bug Depends on: | |||
Bug Blocks: | 445235 | ||
Attachments: | Fix Rust v0 demangling. |
Description
Nick Nethercote
2021-11-09 02:21:59 UTC
I have push permission for the repository, so once people are happy with this (assuming they are) I can push it myself. Thanks! This looks correct. Sorry for missing this myself when I merged the libiberty support. And thanks for the testcases. One question which was also true before your fix, so do don't hold pushing this if you don't know the answer. What about the Java Ada/gnat and D demangling defined in ML_(cplus_demangle)? We seem to miss demangling them too because they (probably) don't start with _Z or _R and aren't guarded by AUTO_DEMANGLING. Has that also always been broken? Did we simple not notice because nobody uses valgrind with those languages? > What about the Java Ada/gnat and D demangling defined in ML_(cplus_demangle)?
> We seem to miss demangling them too because they (probably) don't start with
> _Z or _R and aren't guarded by AUTO_DEMANGLING.
> Has that also always been broken? Did we simple not notice because nobody
> uses valgrind with those languages?
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.
- 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.
I found the AUTO_DEMANGLING stuff a bit confusing, but you are right that the code for Rust and C++ looks a bit different to the code for Java/Ada/D, in that respect. I suspect that you are also right about Java/Ada/D demangling being broken but nobody noticing due to low levels of usage.
Fixing the Java/Ada/D problems is outside the scope of this bug, and I'm not familiar enough with those languages to fix and test things anyway.
Here's what I'll do: I'll file a new bug pointing out the problems, update my commit to include a comment in `VG_(demangle)` that points to the bug, and then push. That way the Rust problems will be fixed, and the Java/Ada/D problems at least will be documented.
I filed #445235 for Java/Ada/D. Pushed as: commit 4831385c6706b377851284adc4c4545fff4c6564 (HEAD -> master, origin/master, origin/HEAD) Author: Nicholas Nethercote <nnethercote@apple.com> Date: Tue Nov 9 12:30:07 2021 +1100 Fix Rust v0 demangling. It's currently broken due to a silly test that prevents the v0 demangling code from even running. The commit also adds a test, to avoid such problems in the future. |