Demangle rust and add classes/methods and bump lib version (#3481)
This commit is contained in:
parent
99213043de
commit
29c1aa8187
4 changed files with 206 additions and 7 deletions
|
|
@ -1327,8 +1327,31 @@ static char *bin_demangle_cxx(RzBinFile *bf, const char *symbol, ut64 vaddr) {
|
|||
return out;
|
||||
}
|
||||
|
||||
static char *bin_demangle_rust(RzBinFile *binfile, const char *symbol, ut64 vaddr) {
|
||||
return rz_demangler_rust(symbol);
|
||||
static char *bin_demangle_rust(RzBinFile *bf, const char *symbol, ut64 vaddr) {
|
||||
char *demangled = rz_demangler_rust(symbol);
|
||||
if (!demangled) {
|
||||
return demangled;
|
||||
}
|
||||
|
||||
char *str = demangled;
|
||||
char *ptr = NULL;
|
||||
char *name = NULL;
|
||||
while ((ptr = strstr(str, "::"))) {
|
||||
name = ptr;
|
||||
str = ptr + 2;
|
||||
}
|
||||
|
||||
if (!name || RZ_STR_ISEMPTY(name + 2)) {
|
||||
return demangled;
|
||||
}
|
||||
|
||||
*name = 0;
|
||||
RzBinSymbol *sym = rz_bin_file_add_method(bf, demangled, name + 2, 0);
|
||||
if (sym && sym->vaddr == 0) {
|
||||
sym->vaddr = vaddr;
|
||||
}
|
||||
*name = ':';
|
||||
return demangled;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
[wrap-git]
|
||||
url = https://github.com/rizinorg/rz-libdemangle.git
|
||||
revision = 67a71ac32f4730660219adc61e37a34cef4ba921
|
||||
revision = 2104d8dadbcb20a6cc67532f505741d2b4f3737a
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ lang rust
|
|||
EOF
|
||||
RUN
|
||||
|
||||
NAME=LANGUAGES : rust disasembly
|
||||
NAME=LANGUAGES : rust disassembly
|
||||
FILE=bins/abi_bins/elf/languages/rust/tree_traversal
|
||||
CMDS=<<EOF
|
||||
pi 10
|
||||
|
|
|
|||
|
|
@ -247,11 +247,187 @@ NAME=rust function in file
|
|||
FILE=bins/elf/rust
|
||||
CMDS=<<EOF
|
||||
aa
|
||||
afl~example
|
||||
ic
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
0x00002b30 2 15 sym._example::Foo_as_example::Bar_::bar::h26dc608664264fb6
|
||||
0x00002b40 1 31 sym.example::main::hf45903a20ef2ad21
|
||||
address min max name super
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
0x00000000 0x00011b00 0x00011b00 collections::str::<impl collections::borrow::ToOwned for str>::to_owned
|
||||
0x00000000 0x000146e0 0x000146e0 collections::string::<impl core::convert::From<collections::string::String> for collections::vec::Vec<u8>>::from
|
||||
0x00000000 0x00011b90 0x00011b90 collections::string::String::from_utf8_lossy
|
||||
0x00000000 0x000220b4 0x000220b4 std_unicode::u_str::UTF8_CHAR_WIDTH
|
||||
0x00000000 0x00014940 0x00014940 std_unicode::tables::general_category::N
|
||||
0x00000000 0x00014700 0x00014700 std_unicode::tables::trie_lookup_range_table
|
||||
0x00000000 0x00005c00 0x00005c00 <<Box<std::error::Error + core::marker::Send + core::marker::Sync + 'static> as core::convert::From<collections::string::String>>::from::StringError as core::fmt::Debug>::fmt
|
||||
0x00000000 0x00005b90 0x00005b90 <<Box<std::error::Error + core::marker::Send + core::marker::Sync + 'static> as core::convert::From<collections::string::String>>::from::StringError as std::error::Error>::description
|
||||
0x00000000 0x00005bd0 0x00005bd0 <<Box<std::error::Error + core::marker::Send + core::marker::Sync + 'static> as core::convert::From<collections::string::String>>::from::StringError as core::fmt::Display>::fmt
|
||||
0x00000000 0x000051a0 0x000051a0 <alloc::arc::Arc<T>>::drop_slow
|
||||
0x00000000 0x0000dcc0 0x0000e220 <T as core::any::Any>::get_type_id
|
||||
0x00000000 0x002299f8 0x002299f8 <core::option::Option<T>>::unwrap::_MSG_FILE_LINE
|
||||
0x00000000 0x0000d290 0x0000d290 <collections::vec::Vec<T>>::into_boxed_slice
|
||||
0x00000000 0x0000df40 0x0000f3c0 <collections::vec::Vec<T>>::reserve
|
||||
0x00000000 0x0022a340 0x0022a340 std::sys_common::at_exit_imp::LOCK
|
||||
0x00000000 0x0022a338 0x0022a338 std::sys_common::at_exit_imp::QUEUE
|
||||
0x00000000 0x00228e50 0x00228e50 std::sys_common::at_exit_imp::cleanup::_FILE_LINE
|
||||
0x00000000 0x00000040 0x00000040 std::sys_common::thread_info::THREAD_INFO::__getit::__KEY
|
||||
0x00000000 0x0000fab0 0x0000fab0 std::sys_common::thread_info::set
|
||||
0x00000000 0x00228e38 0x00228e38 std::sys_common::thread_info::set::{{closure}}::_FILE_LINE
|
||||
0x00000000 0x00228e20 0x00228e20 std::sys_common::thread_local::StaticKey::lazy_init::_FILE_LINE
|
||||
0x00000000 0x0000d520 0x0000d520 std::sys_common::thread_local::StaticKey::lazy_init
|
||||
0x00000000 0x0022a328 0x0022a328 std::sys_common::gnu::libbacktrace::print::init_state::STATE
|
||||
0x00000000 0x00007d60 0x00007d60 std::sys_common::gnu::libbacktrace::print::syminfo_cb
|
||||
0x00000000 0x00007d40 0x00007d40 std::sys_common::gnu::libbacktrace::print::error_cb
|
||||
0x00000000 0x0000c240 0x0000c240 std::sys_common::gnu::libbacktrace::print::pcinfo_cb
|
||||
0x00000000 0x000035c0 0x000035c0 std::sys_common::util::dumb_print
|
||||
0x00000000 0x00004650 0x00004650 std::sys_common::util::abort
|
||||
0x00000000 0x0022a320 0x0022a320 std::sys_common::cleanup::CLEANUP
|
||||
0x00000000 0x0022a330 0x0022a330 std::sys_common::backtrace::log_enabled::ENABLED
|
||||
0x00000000 0x00007d80 0x00007d80 std::sys_common::backtrace::output
|
||||
0x00000000 0x00006200 0x00006200 std::io::Write::write_all
|
||||
0x00000000 0x00005750 0x00005750 std::io::Write::write_fmt
|
||||
0x00000000 0x00228ec8 0x00228ec8 std::io::error::ErrorKind::as_str::_FILE_LINE
|
||||
0x00000000 0x000056b0 0x000056b0 std::io::impls::<impl std::io::Write for &'a mut W>::flush
|
||||
0x00000000 0x00005640 0x00005640 std::io::impls::<impl std::io::Write for &'a mut W>::write
|
||||
0x00000000 0x000056c0 0x000056c0 std::io::impls::<impl std::io::Write for &'a mut W>::write_all
|
||||
0x00000000 0x000056f0 0x000056f0 std::io::impls::<impl std::io::Write for &'a mut W>::write_fmt
|
||||
0x00000000 0x00010390 0x00010390 std::rt::lang_start
|
||||
0x00000000 0x00004720 0x00004720 std::env::_var_os
|
||||
0x00000000 0x00228ee0 0x00228ee0 std::env::_var_os::{{closure}}::_FILE_LINE
|
||||
0x00000000 0x0000da60 0x0000da60 std::env::_var_os::{{closure}}
|
||||
0x00000000 0x0000d880 0x0000d880 std::ffi::c_str::<impl core::convert::From<std::ffi::c_str::NulError> for std::io::error::Error>::from
|
||||
0x00000000 0x0000cc70 0x0000cc70 std::ffi::c_str::CString::from_vec_unchecked
|
||||
0x00000000 0x00228cd0 0x00228cd0 std::sys::imp::thread_local::create::_FILE_LINE
|
||||
0x00000000 0x00004710 0x00004710 std::sys::imp::abort_internal
|
||||
0x00000000 0x00228d48 0x00228d48 std::sys::imp::stack_overflow::imp::get_stackp::_FILE_LINE
|
||||
0x00000000 0x00010220 0x00010220 std::sys::imp::stack_overflow::imp::make_handler
|
||||
0x00000000 0x0022a290 0x0022a290 std::sys::imp::stack_overflow::imp::MAIN_ALTSTACK
|
||||
0x00000000 0x00011260 0x00011260 std::sys::imp::stack_overflow::imp::signal_handler
|
||||
0x00000000 0x0022a298 0x0022a298 std::sys::imp::stack_overflow::imp::PAGE_SIZE
|
||||
0x00000000 0x00004ac0 0x000050a0 std::sys::imp::fast_thread_local::destroy_value
|
||||
0x00000000 0x00004b20 0x00004b20 std::sys::imp::fast_thread_local::register_dtor_fallback
|
||||
0x00000000 0x0022a260 0x0022a260 std::sys::imp::fast_thread_local::register_dtor_fallback::DTORS
|
||||
0x00000000 0x0000f1f0 0x0000f1f0 std::sys::imp::fast_thread_local::register_dtor_fallback::run_dtors
|
||||
0x00000000 0x00228d90 0x00228d90 std::sys::imp::os::error_string::_FILE_LINE
|
||||
0x00000000 0x0000e030 0x0000e030 std::sys::imp::os::error_string
|
||||
0x00000000 0x0022a2a0 0x0022a2a0 std::sys::imp::os::ENV_LOCK
|
||||
0x00000000 0x0022a318 0x0022a318 std::sys::imp::args::imp::GLOBAL_ARGS_PTR
|
||||
0x00000000 0x0022a2f0 0x0022a2f0 std::sys::imp::args::imp::LOCK
|
||||
0x00000000 0x00228e08 0x00228e08 std::sys::imp::args::imp::init::_FILE_LINE
|
||||
0x00000000 0x00011230 0x00011230 std::sys::imp::init::oom_handler
|
||||
0x00000000 0x00228cb8 0x00228cb8 std::sys::imp::init::reset_sigpipe::_FILE_LINE
|
||||
0x00000000 0x00228d60 0x00228d78 std::sys::imp::rwlock::RWLock::read::_FILE_LINE
|
||||
0x00000000 0x00228d00 0x00228d30 std::sys::imp::thread::guard::get_stack_start::_FILE_LINE
|
||||
0x00000000 0x00228ce8 0x00228ce8 std::sys::imp::thread::guard::init::_FILE_LINE
|
||||
0x00000000 0x00228da8 0x00228df0 std::sys::imp::condvar::Condvar::init::_FILE_LINE
|
||||
0x00000000 0x0000ce50 0x0000ce50 std::sys::imp::condvar::Condvar::init
|
||||
0x00000000 0x000064e0 0x000064e0 std::sys::imp::backtrace::tracing::imp::write
|
||||
0x00000000 0x0022a2c8 0x0022a2c8 std::sys::imp::backtrace::tracing::imp::write::LOCK
|
||||
0x00000000 0x00006810 0x00006810 std::sys::imp::backtrace::tracing::imp::write::trace_fn
|
||||
0x00000000 0x00228e80 0x00228e98 std::sync::once::Once::call_inner::_FILE_LINE
|
||||
0x00000000 0x0000e240 0x0000e240 std::sync::once::Once::call_inner
|
||||
0x00000000 0x0000f4e0 0x0000f4e0 std::sync::once::Once::call_once::{{closure}}
|
||||
0x00000000 0x00228eb0 0x00228eb0 std::sync::condvar::Condvar::verify::_FILE_LINE
|
||||
0x00000000 0x00005ba0 0x00005ba0 std::error::Error::cause
|
||||
0x00000000 0x00005bb0 0x00005bb0 std::error::Error::type_id
|
||||
0x00000000 0x0000e9b0 0x0000e9b0 std::thread::park
|
||||
0x00000000 0x0000c6b0 0x0000c6b0 std::thread::Thread::new
|
||||
0x00000000 0x0000f060 0x0000f060 std::thread::Thread::unpark
|
||||
0x00000000 0x00228ef8 0x00228ef8 std::thread::ThreadId::new::_FILE_LINE
|
||||
0x00000000 0x0022a370 0x0022a370 std::thread::ThreadId::new::GUARD
|
||||
0x00000000 0x0022a368 0x0022a368 std::thread::ThreadId::new::COUNTER
|
||||
0x00000000 0x00002b90 0x00003240 std::panicking::begin_panic
|
||||
0x00000000 0x00000018 0x00000018 std::panicking::LOCAL_STDERR::__getit::__KEY
|
||||
0x00000000 0x000036b0 0x000036b0 std::panicking::default_hook
|
||||
0x00000000 0x0022a1f8 0x0022a1f8 std::panicking::default_hook::{{closure}}::FIRST_PANIC
|
||||
0x00000000 0x00005290 0x00005290 std::panicking::default_hook::{{closure}}
|
||||
0x00000000 0x00003120 0x00003120 std::panicking::begin_panic_fmt
|
||||
0x00000000 0x000032d0 0x000032d0 std::panicking::rust_panic_with_hook
|
||||
0x00000000 0x00011af0 0x00011af0 std::panicking::try::do_call
|
||||
0x00000000 0x0022a200 0x0022a200 std::panicking::HOOK
|
||||
0x00000000 0x0022a218 0x0022a218 std::panicking::HOOK_LOCK
|
||||
0x00000000 0x00229978 0x00229978 <alloc::raw_vec::RawVec<T>>::shrink_to_fit::_MSG_FILE_LINE
|
||||
0x00000000 0x0000d1e0 0x0000d7b0 <alloc::raw_vec::RawVec<T>>::double
|
||||
0x00000000 0x00019310 0x00019310 <str as core::fmt::Debug>::fmt
|
||||
0x00000000 0x0001a1d0 0x0001a1d0 <str as core::fmt::Display>::fmt
|
||||
0x00000000 0x000060e0 0x000182a0 <char as core::char::CharExt>::encode_utf8
|
||||
0x00000000 0x002299d0 0x002299d0 <char as core::char::CharExt>::to_digit::_MSG_FILE_LINE
|
||||
0x00000000 0x00002b30 0x00002b30 <example::Foo as example::Bar>::bar
|
||||
0x00000000 0x00004c80 0x00004c80 <std::thread::local::LocalKey<T>>::with
|
||||
0x00000000 0x00019e30 0x00019e30 core::char_private::is_printable
|
||||
0x00000000 0x00019220 0x00019220 core::fmt::ArgumentV1::from_usize
|
||||
0x00000000 0x000177f0 0x000177f0 core::fmt::ArgumentV1::show_usize
|
||||
0x00000000 0x0001a980 0x0001a980 core::fmt::num::<impl core::fmt::Debug for u8>::fmt
|
||||
0x00000000 0x0001aa80 0x0001aa80 core::fmt::num::<impl core::fmt::Debug for i32>::fmt
|
||||
0x00000000 0x0001b010 0x0001b010 core::fmt::num::<impl core::fmt::Debug for usize>::fmt
|
||||
0x00000000 0x0001aa90 0x0001aa90 core::fmt::num::<impl core::fmt::Display for i32>::fmt
|
||||
0x00000000 0x0001a200 0x0001a200 core::fmt::num::<impl core::fmt::Display for u32>::fmt
|
||||
0x00000000 0x0001ad30 0x0001ad30 core::fmt::num::<impl core::fmt::Display for isize>::fmt
|
||||
0x00000000 0x00014c10 0x00014c10 core::fmt::num::<impl core::fmt::Display for usize>::fmt
|
||||
0x00000000 0x0001b170 0x0001b170 core::fmt::num::<impl core::fmt::LowerHex for usize>::fmt
|
||||
0x00000000 0x00005eb0 0x00018070 core::fmt::Write::write_char
|
||||
0x00000000 0x00005ef0 0x000180b0 core::fmt::Write::write_fmt
|
||||
0x00000000 0x00016e10 0x00016e10 core::fmt::write
|
||||
0x00000000 0x00018df0 0x00018df0 core::fmt::builders::DebugInner::entry
|
||||
0x00000000 0x00017800 0x00017800 core::fmt::builders::DebugTuple::field
|
||||
0x00000000 0x00018cb0 0x00018cb0 core::fmt::builders::DebugTuple::finish
|
||||
0x00000000 0x000189a0 0x000189a0 core::fmt::builders::DebugStruct::field
|
||||
0x00000000 0x00019090 0x00019090 core::fmt::builders::debug_list_new
|
||||
0x00000000 0x00018c40 0x00018c40 core::fmt::builders::debug_tuple_new
|
||||
0x00000000 0x00019110 0x00019110 core::fmt::builders::DebugList::entry
|
||||
0x00000000 0x00019130 0x00019130 core::fmt::builders::DebugList::finish
|
||||
0x00000000 0x00014f20 0x00014f20 core::fmt::Formatter::pad_integral
|
||||
0x00000000 0x00015f00 0x00015f00 core::fmt::Formatter::pad
|
||||
0x00000000 0x000192f0 0x000192f0 core::fmt::Formatter::alternate
|
||||
0x00000000 0x000192a0 0x000192a0 core::fmt::Formatter::write_fmt
|
||||
0x00000000 0x00229ab0 0x00229ab0 core::num::from_str_radix::_FILE_LINE
|
||||
0x00000000 0x0001a470 0x0001a470 core::num::from_str_radix
|
||||
0x00000000 0x0001a720 0x0001a720 core::num::<impl core::str::FromStr for usize>::from_str
|
||||
0x00000000 0x0000f9a0 0x0000f9a0 core::ops::FnOnce::call_once
|
||||
0x00000000 0x000227d5 0x000227d5 core::str::UTF8_CHAR_WIDTH
|
||||
0x00000000 0x00229a38 0x00229a50 core::str::slice_error_fail::_FILE_LINE
|
||||
0x00000000 0x00016b70 0x00016b70 core::str::slice_error_fail
|
||||
0x00000000 0x000184b0 0x000184b0 core::str::Utf8Error::valid_up_to
|
||||
0x00000000 0x000184c0 0x000184c0 core::str::from_utf8
|
||||
0x00000000 0x00229a80 0x00229a80 core::slice::slice_index_len_fail::_FILE_LINE
|
||||
0x00000000 0x00014b30 0x00014b30 core::slice::slice_index_len_fail
|
||||
0x00000000 0x00229a68 0x00229a68 core::slice::slice_index_order_fail::_FILE_LINE
|
||||
0x00000000 0x00015e90 0x00015e90 core::slice::slice_index_order_fail
|
||||
0x00000000 0x00229a98 0x00229a98 core::option::expect_failed::_FILE_LINE
|
||||
0x00000000 0x00018440 0x00018440 core::option::expect_failed
|
||||
0x00000000 0x00229a20 0x00229a20 core::result::unwrap_failed::_FILE_LINE
|
||||
0x00000000 0x002299a0 0x002299a0 core::result::unwrap_failed::__STATIC_FMTSTR
|
||||
0x00000000 0x00005110 0x0000ef20 core::result::unwrap_failed
|
||||
0x00000000 0x00014ba0 0x00014ba0 core::panicking::panic_bounds_check
|
||||
0x00000000 0x00015e20 0x00015e20 core::panicking::panic
|
||||
0x00000000 0x00014eb0 0x00014eb0 core::panicking::panic_fmt
|
||||
0x00000000 0x00005630 0x00017aa0 drop
|
||||
0x00000000 0x0000c2c0 0x0000c2c0 <*mut T as core::fmt::Debug>::fmt
|
||||
0x00000000 0x00005c60 0x0001a8a0 <&'a T as core::fmt::Debug>::fmt
|
||||
0x00000000 0x000064b0 0x00016df0 <&'a T as core::fmt::Display>::fmt
|
||||
0x00000000 0x0001b020 0x0001b020 <core::str::Utf8Error as core::fmt::Debug>::fmt
|
||||
0x00000000 0x00228e68 0x00228e68 <std::sync::once::Finish as core::ops::Drop>::drop::_FILE_LINE
|
||||
0x00000000 0x0000e730 0x0000e730 <std::sync::once::Finish as core::ops::Drop>::drop
|
||||
0x00000000 0x000149d0 0x000149d0 alloc::oom::default_oom_handler
|
||||
0x00000000 0x0022a278 0x0022a278 alloc::oom::imp::OOM_HANDLER
|
||||
0x00000000 0x000149e0 0x000149e0 alloc::oom::imp::set_oom_handler
|
||||
0x00000000 0x000149c0 0x000149c0 alloc::oom::oom
|
||||
0x00000000 0x000183c0 0x000183c0 <core::cell::BorrowError as core::fmt::Debug>::fmt
|
||||
0x00000000 0x00002c00 0x00002c00 <std::io::error::Error as core::fmt::Display>::fmt
|
||||
0x00000000 0x0001a750 0x0001a750 <core::num::ParseIntError as core::fmt::Debug>::fmt
|
||||
0x00000000 0x0000d3c0 0x0000d3c0 <std::ffi::c_str::NulError as core::fmt::Debug>::fmt
|
||||
0x00000000 0x00018400 0x00018400 <core::cell::BorrowMutError as core::fmt::Debug>::fmt
|
||||
0x00000000 0x0000dba0 0x0000dba0 <std::sys::imp::os_str::Slice as core::fmt::Debug>::fmt
|
||||
0x00000000 0x0000e160 0x0000e160 <collections::string::String as core::fmt::Display>::fmt
|
||||
0x00000000 0x00019240 0x00019240 <core::fmt::Arguments<'a> as core::fmt::Display>::fmt
|
||||
0x00000000 0x0000c3b0 0x0000c3b0 <&'a mut I as core::iter::iterator::Iterator>::next
|
||||
0x00000000 0x00002b40 0x00002b40 example::main
|
||||
0x00000000 0x0000f030 0x0000f030 <std::sys_common::poison::PoisonError<T> as core::fmt::Debug>::fmt
|
||||
0x00000000 0x00014650 0x00014650 <collections::string::String as core::convert::From<&'a str>>::from
|
||||
0x00000000 0x00005d20 0x00005d20 <std::io::Write::write_fmt::Adaptor<'a, T> as core::fmt::Write>::write_str
|
||||
0x00000000 0x00005f50 0x00018110 <core::fmt::Write::write_fmt::Adapter<'a, T> as core::fmt::Write>::write_char
|
||||
0x00000000 0x00006090 0x00018250 <core::fmt::Write::write_fmt::Adapter<'a, T> as core::fmt::Write>::write_fmt
|
||||
0x00000000 0x00005f40 0x00018100 <core::fmt::Write::write_fmt::Adapter<'a, T> as core::fmt::Write>::write_str
|
||||
0x00000000 0x00017ab0 0x00017ab0 <core::fmt::builders::PadAdapter<'a, 'b> as core::fmt::Write>::write_str
|
||||
EOF
|
||||
RUN
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue