diff --git a/symbolic-demangle/Cargo.toml b/symbolic-demangle/Cargo.toml index 0ce4c3b5a..9cedcce42 100644 --- a/symbolic-demangle/Cargo.toml +++ b/symbolic-demangle/Cargo.toml @@ -31,7 +31,7 @@ rust = ["rustc-demangle"] swift = ["cc"] [dependencies] -cpp_demangle = { version = "0.3.2", optional = true } +cpp_demangle = { git = "https://github.com/Swatinem/cpp_demangle", branch = "sentry-patches", version = "0.3.2", optional = true } msvc-demangler = { version = "0.9.0", optional = true } rustc-demangle = { version = "0.1.16", optional = true } symbolic-common = { version = "9.1.0", path = "../symbolic-common" } diff --git a/symbolic-demangle/src/lib.rs b/symbolic-demangle/src/lib.rs index 1d72bf774..3b7f72773 100644 --- a/symbolic-demangle/src/lib.rs +++ b/symbolic-demangle/src/lib.rs @@ -246,10 +246,8 @@ fn try_demangle_cpp(ident: &str, opts: DemangleOptions) -> Option { let stripped = strip_hash_suffix(ident); - let symbol = match CppSymbol::new_with_options( - stripped, - &ParseOptions::default().recursion_limit(192), // default is 96 - ) { + let parse_options = ParseOptions::default().recursion_limit(160); // default is 96 + let symbol = match CppSymbol::new_with_options(stripped, &parse_options) { Ok(symbol) => symbol, Err(_) => return None, }; diff --git a/symbolic-demangle/tests/test_cpp.rs b/symbolic-demangle/tests/test_cpp.rs index db326be9a..d7c1570b2 100644 --- a/symbolic-demangle/tests/test_cpp.rs +++ b/symbolic-demangle/tests/test_cpp.rs @@ -25,6 +25,20 @@ fn test_demangle_cpp() { }); } +#[test] +fn test_demangle_cpp_recursion() { + assert_demangle!(Language::Cpp, DemangleOptions::complete(), { + "_ZNK8xxxxxxxx14xxxxxxxxxxxxxxINS_14xxxxxxxxxxxxxxINS1_INS1_INS1_INS1_INS1_INS_10xxxxxxxxxxE32xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxEES3_EE22xxxxxxxxxxxxxxxxxxxxxxEES6_EE13xxxxxxxxxxxxxEE17xxxxxxxxxxxxxxxxxEE14xxxxxxxxxxxxxxE8xxxxxxxxE7xxxxxxxRKN4xxxx5xxxxxEb" => + "xxxxxxxx::xxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>, xxxxxxxxxxxxxxxxxxxxxx>, xxxxxxxxxxxxxxxxxxxxxx>, xxxxxxxxxxxxx>, xxxxxxxxxxxxxxxxx>, xxxxxxxxxxxxxx>::xxxxxxxx(xxxxxxx, xxxx::xxxxx const&, bool) const", + "_ZN5boost7variantIiJljdbNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_17basic_string_viewIcS4_EElmxyNS_10filesystem4pathEEEC2IS6_EEOT_PNS_9enable_ifINS_3mpl3or_INSG_4and_INS_19is_rvalue_referenceISE_EENSG_4not_INS_8is_constISD_EEEENSL_INS_7is_sameISD_SB_EEEENS_6detail7variant29is_variant_constructible_fromISE_NSG_6l_itemIN4mpl_5long_ILl12EEEiNSV_INSX_ILl11EEElNSV_INSX_ILl10EEEjNSV_INSX_ILl9EEEdNSV_INSX_ILl8EEEbNSV_INSX_ILl7EEES6_NSV_INSX_ILl6EEES8_NSV_INSX_ILl5EEElNSV_INSX_ILl4EEEmNSV_INSX_ILl3EEExNSV_INSX_ILl2EEEyNSV_INSX_ILl1EEESA_NSG_5l_endEEEEEEEEEEEEEEEEEEEEEEEEEEENSW_5bool_ILb1EEEEENSP_ISD_NS_18recursive_variant_EEENS1O_ILb0EEES1T_S1T_EEvE4typeE" => + "boost::variant, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path>::variant, std::allocator > >(boost::enable_if, std::allocator >&&>, boost::mpl::not_, std::allocator > > >, boost::mpl::not_, std::allocator >, boost::variant, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path> > >, boost::detail::variant::is_variant_constructible_from, std::allocator >&&, boost::mpl::l_item, int, boost::mpl::l_item, long, boost::mpl::l_item, unsigned int, boost::mpl::l_item, double, boost::mpl::l_item, bool, boost::mpl::l_item, std::__cxx11::basic_string, std::allocator >, boost::mpl::l_item, boost::basic_string_view >, boost::mpl::l_item, long, boost::mpl::l_item, unsigned long, boost::mpl::l_item, long long, boost::mpl::l_item, unsigned long long, boost::mpl::l_item, boost::filesystem::path, boost::mpl::l_end> > > > > > > > > > > > >, mpl_::bool_ >, boost::is_same, std::allocator >, boost::recursive_variant_>, mpl_::bool_, mpl_::bool_, mpl_::bool_ >, void>::type*)", + "_ZN5boost6detail7variant21make_initializer_node5applyINS_3mpl4pairINS3_INS5_INS3_INS5_INS3_INS5_INS3_INS5_INS3_INS5_INS1_16initializer_rootEN4mpl_4int_ILi0EEEEENS4_6l_iterINS4_6list12IixjdbNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_17basic_string_viewIcSG_EElmxyNS_10filesystem4pathEEEEEE16initializer_nodeENS8_ILi1EEEEENSB_INS4_6list11IxjdbSI_SK_lmxySM_EEEEE16initializer_nodeENS8_ILi2EEEEENSB_INS4_6list10IjdbSI_SK_lmxySM_EEEEE16initializer_nodeENS8_ILi3EEEEENSB_INS4_5list9IdbSI_SK_lmxySM_EEEEE16initializer_nodeENS8_ILi4EEEEENSB_INS4_5list8IbSI_SK_lmxySM_EEEEE16initializer_nodeENS8_ILi5EEEEENSB_INS4_5list7ISI_SK_lmxySM_EEEEE16initializer_node10initializeEPvRKSI_" => + "boost::detail::variant::make_initializer_node::apply >, boost::mpl::l_iter, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path> > >::initializer_node, mpl_::int_<1> >, boost::mpl::l_iter, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path> > >::initializer_node, mpl_::int_<2> >, boost::mpl::l_iter, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path> > >::initializer_node, mpl_::int_<3> >, boost::mpl::l_iter, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path> > >::initializer_node, mpl_::int_<4> >, boost::mpl::l_iter, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path> > >::initializer_node, mpl_::int_<5> >, boost::mpl::l_iter, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path> > >::initializer_node::initialize(void*, std::__cxx11::basic_string, std::allocator > const&)", + "_ZN5boost6detail7variant15visitation_implIN4mpl_4int_ILi0EEENS1_20visitation_impl_stepINS_3mpl6l_iterINS7_6l_itemINS3_5long_ILl12EEEiNS9_INSA_ILl11EEExNS9_INSA_ILl10EEEjNS9_INSA_ILl9EEEdNS9_INSA_ILl8EEEbNS9_INSA_ILl7EEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS9_INSA_ILl6EEENS_17basic_string_viewIcSK_EENS9_INSA_ILl5EEElNS9_INSA_ILl4EEEmNS9_INSA_ILl3EEExNS9_INSA_ILl2EEEyNS9_INSA_ILl1EEENS_10filesystem4pathENS7_5l_endEEEEEEEEEEEEEEEEEEEEEEEEEEENS8_ISX_EEEENS_7variantIiJxjdbSM_SP_lmxySW_EE8assignerEPKvNS1E_18has_fallback_type_EEENT1_11result_typeEiiRS1J_T2_NS3_5bool_ILb0EEET3_PT_PT0_" => + "boost::variant, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path>::assigner::result_type boost::detail::variant::visitation_impl, boost::detail::variant::visitation_impl_step, int, boost::mpl::l_item, long long, boost::mpl::l_item, unsigned int, boost::mpl::l_item, double, boost::mpl::l_item, bool, boost::mpl::l_item, std::__cxx11::basic_string, std::allocator >, boost::mpl::l_item, boost::basic_string_view >, boost::mpl::l_item, long, boost::mpl::l_item, unsigned long, boost::mpl::l_item, long long, boost::mpl::l_item, unsigned long long, boost::mpl::l_item, boost::filesystem::path, boost::mpl::l_end> > > > > > > > > > > > >, boost::mpl::l_iter >, boost::variant, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path>::assigner, void const*, boost::variant, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path>::has_fallback_type_>(int, int, boost::variant, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path>::assigner&, void const*, mpl_::bool_, boost::variant, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path>::has_fallback_type_, mpl_::int_<0>*, boost::detail::variant::visitation_impl_step, int, boost::mpl::l_item, long long, boost::mpl::l_item, unsigned int, boost::mpl::l_item, double, boost::mpl::l_item, bool, boost::mpl::l_item, std::__cxx11::basic_string, std::allocator >, boost::mpl::l_item, boost::basic_string_view >, boost::mpl::l_item, long, boost::mpl::l_item, unsigned long, boost::mpl::l_item, long long, boost::mpl::l_item, unsigned long long, boost::mpl::l_item, boost::filesystem::path, boost::mpl::l_end> > > > > > > > > > > > >, boost::mpl::l_iter >*)" + }); +} + #[test] fn test_demangle_cpp_no_args() { assert_demangle!(Language::Cpp, DemangleOptions::name_only(), {