libiberty: Support the new ("v0") mangling scheme in rust-demangle
This is the libiberty (mainly for binutils/gdb) counterpart of https://github.com/alexcrichton/rustc-demangle/pull/23. Relevant links for the new Rust mangling scheme (aka "v0"): * Rust RFC: https://github.com/rust-lang/rfcs/pull/2603 * tracking issue: https://github.com/rust-lang/rust/issues/60705 * implementation: https://github.com/rust-lang/rust/pull/57967 This implementation includes full support for UTF-8 identifiers via punycode, so I've included a testcase for that as well. libiberty/ChangeLog: * rust-demangle.c (struct rust_demangler): Add skipping_printing and bound_lifetime_depth fields. (eat): Add (v0-only). (parse_integer_62): Add (v0-only). (parse_opt_integer_62): Add (v0-only). (parse_disambiguator): Add (v0-only). (struct rust_mangled_ident): Add punycode{,_len} fields. (parse_ident): Support v0 identifiers. (print_str): Respect skipping_printing. (print_uint64): Add (v0-only). (print_uint64_hex): Add (v0-only). (print_ident): Respect skipping_printing, Support v0 identifiers. (print_lifetime_from_index): Add (v0-only). (demangle_binder): Add (v0-only). (demangle_path): Add (v0-only). (demangle_generic_arg): Add (v0-only). (demangle_type): Add (v0-only). (demangle_path_maybe_open_generics): Add (v0-only). (demangle_dyn_trait): Add (v0-only). (demangle_const): Add (v0-only). (demangle_const_uint): Add (v0-only). (basic_type): Add (v0-only). (rust_demangle_callback): Support v0 symbols. * testsuite/rust-demangle-expected: Add v0 testcases.
This commit is contained in:
parent
16b00dc63f
commit
84096498a7
File diff suppressed because it is too large
Load Diff
@ -11,7 +11,7 @@
|
||||
#
|
||||
############
|
||||
#
|
||||
# Coverage Tests
|
||||
# Coverage Tests (legacy)
|
||||
#
|
||||
#
|
||||
# Demangles as rust symbol.
|
||||
@ -163,3 +163,135 @@ _ZN63_$LT$core..ptr..Unique$LT$T$GT$$u20$as$u20$core..ops..Deref$GT$5deref17h19f
|
||||
--format=rust
|
||||
_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17h059a991a004536adE
|
||||
issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo
|
||||
--format=rust
|
||||
_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h000b1ad6c4f30bd6E
|
||||
core::ops::function::FnOnce::call_once{{vtable.shim}}
|
||||
#
|
||||
############
|
||||
#
|
||||
# Coverage Tests (v0)
|
||||
#
|
||||
#
|
||||
# Crate with a leading digit.
|
||||
--format=rust
|
||||
_RNvC6_123foo3bar
|
||||
123foo::bar
|
||||
# UTF-8 identifiers.
|
||||
--format=rust
|
||||
_RNqCs4fqI2P2rA04_11utf8_identsu30____7hkackfecea1cbdathfdh9hlq6y
|
||||
utf8_idents::საჭმელად_გემრიელი_სადილი
|
||||
# Closure path elements.
|
||||
--format=rust
|
||||
_RNCNCNgCs6DXkGYLi8lr_2cc5spawn00B5_
|
||||
cc::spawn::{closure#0}::{closure#0}
|
||||
#
|
||||
--format=rust
|
||||
_RNCINkXs25_NgCsbmNqQUJIY6D_4core5sliceINyB9_4IterhENuNgNoBb_4iter8iterator8Iterator9rpositionNCNgNpB9_6memchr7memrchrs_0E0Bb_
|
||||
<core::slice::Iter<u8> as core::iter::iterator::Iterator>::rposition::<core::slice::memchr::memrchr::{closure#1}>::{closure#0}
|
||||
# dyn Trait ("trait object") types.
|
||||
--format=rust
|
||||
_RINbNbCskIICzLVDPPb_5alloc5alloc8box_freeDINbNiB4_5boxed5FnBoxuEp6OutputuEL_ECs1iopQbuBiw2_3std
|
||||
alloc::alloc::box_free::<dyn alloc::boxed::FnBox<(), Output = ()>>
|
||||
# Types with const generics parameters.
|
||||
--format=rust
|
||||
_RNvMC0INtC8arrayvec8ArrayVechKj7b_E3new
|
||||
<arrayvec::ArrayVec<u8, 123>>::new
|
||||
#
|
||||
--format=rust
|
||||
_RMCs4fqI2P2rA04_13const_genericINtB0_8UnsignedKhb_E
|
||||
<const_generic::Unsigned<11>>
|
||||
#
|
||||
--format=rust
|
||||
_RMCs4fqI2P2rA04_13const_genericINtB0_6SignedKs98_E
|
||||
<const_generic::Signed<152>>
|
||||
#
|
||||
--format=rust
|
||||
_RMCs4fqI2P2rA04_13const_genericINtB0_6SignedKanb_E
|
||||
<const_generic::Signed<-11>>
|
||||
#
|
||||
--format=rust
|
||||
_RMCs4fqI2P2rA04_13const_genericINtB0_4BoolKb0_E
|
||||
<const_generic::Bool<false>>
|
||||
#
|
||||
--format=rust
|
||||
_RMCs4fqI2P2rA04_13const_genericINtB0_4BoolKb1_E
|
||||
<const_generic::Bool<true>>
|
||||
#
|
||||
--format=rust
|
||||
_RMCs4fqI2P2rA04_13const_genericINtB0_4CharKc76_E
|
||||
<const_generic::Char<'v'>>
|
||||
#
|
||||
--format=rust
|
||||
_RMCs4fqI2P2rA04_13const_genericINtB0_4CharKca_E
|
||||
<const_generic::Char<'\n'>>
|
||||
#
|
||||
--format=rust
|
||||
_RMCs4fqI2P2rA04_13const_genericINtB0_4CharKc2202_E
|
||||
<const_generic::Char<'\u{2202}'>>
|
||||
#
|
||||
--format=rust
|
||||
_RNvNvMCs4fqI2P2rA04_13const_genericINtB4_3FooKpE3foo3FOO
|
||||
<const_generic::Foo<_>>::foo::FOO
|
||||
#
|
||||
# All of the tests above but in auto mode instead:
|
||||
#
|
||||
# Crate with a leading digit.
|
||||
--format=auto
|
||||
_RNvC6_123foo3bar
|
||||
123foo::bar
|
||||
# UTF-8 identifiers.
|
||||
--format=auto
|
||||
_RNqCs4fqI2P2rA04_11utf8_identsu30____7hkackfecea1cbdathfdh9hlq6y
|
||||
utf8_idents::საჭმელად_გემრიელი_სადილი
|
||||
# Closure path elements.
|
||||
--format=auto
|
||||
_RNCNCNgCs6DXkGYLi8lr_2cc5spawn00B5_
|
||||
cc::spawn::{closure#0}::{closure#0}
|
||||
#
|
||||
--format=auto
|
||||
_RNCINkXs25_NgCsbmNqQUJIY6D_4core5sliceINyB9_4IterhENuNgNoBb_4iter8iterator8Iterator9rpositionNCNgNpB9_6memchr7memrchrs_0E0Bb_
|
||||
<core::slice::Iter<u8> as core::iter::iterator::Iterator>::rposition::<core::slice::memchr::memrchr::{closure#1}>::{closure#0}
|
||||
# dyn Trait ("trait object") types.
|
||||
--format=auto
|
||||
_RINbNbCskIICzLVDPPb_5alloc5alloc8box_freeDINbNiB4_5boxed5FnBoxuEp6OutputuEL_ECs1iopQbuBiw2_3std
|
||||
alloc::alloc::box_free::<dyn alloc::boxed::FnBox<(), Output = ()>>
|
||||
# Types with const generics parameters.
|
||||
--format=auto
|
||||
_RNvMC0INtC8arrayvec8ArrayVechKj7b_E3new
|
||||
<arrayvec::ArrayVec<u8, 123>>::new
|
||||
#
|
||||
--format=auto
|
||||
_RMCs4fqI2P2rA04_13const_genericINtB0_8UnsignedKhb_E
|
||||
<const_generic::Unsigned<11>>
|
||||
#
|
||||
--format=auto
|
||||
_RMCs4fqI2P2rA04_13const_genericINtB0_6SignedKs98_E
|
||||
<const_generic::Signed<152>>
|
||||
#
|
||||
--format=auto
|
||||
_RMCs4fqI2P2rA04_13const_genericINtB0_6SignedKanb_E
|
||||
<const_generic::Signed<-11>>
|
||||
#
|
||||
--format=auto
|
||||
_RMCs4fqI2P2rA04_13const_genericINtB0_4BoolKb0_E
|
||||
<const_generic::Bool<false>>
|
||||
#
|
||||
--format=auto
|
||||
_RMCs4fqI2P2rA04_13const_genericINtB0_4BoolKb1_E
|
||||
<const_generic::Bool<true>>
|
||||
#
|
||||
--format=auto
|
||||
_RMCs4fqI2P2rA04_13const_genericINtB0_4CharKc76_E
|
||||
<const_generic::Char<'v'>>
|
||||
#
|
||||
--format=auto
|
||||
_RMCs4fqI2P2rA04_13const_genericINtB0_4CharKca_E
|
||||
<const_generic::Char<'\n'>>
|
||||
#
|
||||
--format=auto
|
||||
_RMCs4fqI2P2rA04_13const_genericINtB0_4CharKc2202_E
|
||||
<const_generic::Char<'\u{2202}'>>
|
||||
#
|
||||
--format=auto
|
||||
_RNvNvMCs4fqI2P2rA04_13const_genericINtB4_3FooKpE3foo3FOO
|
||||
<const_generic::Foo<_>>::foo::FOO
|
||||
|
Loading…
Reference in New Issue
Block a user