diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mangling/itanium.py | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/mangling/itanium.py b/tests/mangling/itanium.py index 6bb49d3..a04c590 100644 --- a/tests/mangling/itanium.py +++ b/tests/mangling/itanium.py @@ -109,3 +109,69 @@ class TestItaniumMangling(ChrysalideTestCase): demangled = demangler.decode_routine('_ZN1N1TIiiE2mfES0_IddE') self.check_demangling(demangled, '??? N::T<int, int>::mf(N::T<double, double>)') + + + def testItaniumRoutineManglingExtra(self): + """Check extra Itanium routine demangling cases.""" + + # http://refspecs.linuxbase.org/cxxabi-1.83.html#linkage + + demangler = ItaniumDemangler() + + # A la lecture, il s'agit d'une référence sur un tableau, et non + # d'un tableau de références. + demangled = demangler.decode_routine('_Z3fooILi2EEvRAplT_Li1E_i') + self.check_demangling(demangled, 'void foo<2>(int[2+1] &)') + + + def testAFL(self): + """Tests from AFL.""" + + demangler = ItaniumDemangler() + + demangled = demangler.decode_routine('_Z4makeI7FactoryiET_IT') + self.assertIsNone(demangled) + + demangled = demangler.decode_routine('_Z4makeN7FactoryiET_IT0_Ev') + self.assertIsNone(demangled) + + demangled = demangler.decode_routine('_Z4makeI7FactoryiET_I4makeIMGaptoryiET_T0_Ev') + self.assertIsNone(demangled) + + demangled = demangler.decode_routine('_Z4maktoryiaS_ILNd') + self.assertIsNone(demangled) + + # ?! + demangled = demangler.decode_routine('_Z4makeMVFactoryiES_') + self.assertIsNotNone(demangled) + + + def testOldRealWorldDemanglings(self): + """Check real world demangling cases from previous code.""" + + demangler = ItaniumDemangler() + + demangled = demangler.decode_routine('_ZNSt6vectorItSaItEE6insertEN9__gnu_cxx17__normal_iteratorIPtS1_EERKt') + self.check_demangling(demangled, '??? std::vector<unsigned short, std::allocator<unsigned short>>::insert(__gnu_cxx::__normal_iterator<unsigned short *, std::vector<unsigned short, std::allocator<unsigned short>>>, const unsigned short &)') + + demangled = demangler.decode_routine('_ZSt26__uninitialized_fill_n_auxIP15CProfStringListiS0_ET_S2_T0_RKT1_12__false_type') + self.check_demangling(demangled, 'CProfStringList *std::__uninitialized_fill_n_aux<CProfStringList *, int, CProfStringList>(CProfStringList *, int, const CProfStringList &, __false_type)') + + + demangled = demangler.decode_routine('_ZN21IUDFSettingsValidator15IdNotIllegalStdEN13UDFParameters12UDF_STANDARDES1_') + self.check_demangling(demangled, '??? IUDFSettingsValidator::IdNotIllegalStd(UDFParameters::UDF_STANDARD, UDFParameters::UDF_STANDARD)') + + demangled = demangler.decode_routine('_ZNSbI26NeroMediumFeatureSpecifierSt11char_traitsIS_ESaIS_EE4_Rep10_M_destroyERKS2_') + self.check_demangling(demangled, '??? std::basic_string<NeroMediumFeatureSpecifier, std::char_traits<NeroMediumFeatureSpecifier>, std::allocator<NeroMediumFeatureSpecifier>>::_Rep::_M_destroy(const std::allocator<NeroMediumFeatureSpecifier> &)') + + demangled = demangler.decode_routine('_ZNSt6vectorIlSaIlEE6insertEN9__gnu_cxx17__normal_iteratorIPlS1_EERKl') + self.check_demangling(demangled, '??? std::vector<long, std::allocator<long>>::insert(__gnu_cxx::__normal_iterator<long *, std::vector<long, std::allocator<long>>>, const long &)') + + demangled = demangler.decode_routine('_ZSt22__merge_without_bufferIN9__gnu_cxx17__normal_iteratorIP15CProfStringListSt6vectorIS2_SaIS2_EEEEiEvT_S8_S8_T0_S9_') + self.check_demangling(demangled, 'void std::__merge_without_buffer<__gnu_cxx::__normal_iterator<CProfStringList *, std::vector<CProfStringList, std::allocator<CProfStringList>>>, int>(__gnu_cxx::__normal_iterator<CProfStringList *, std::vector<CProfStringList, std::allocator<CProfStringList>>>, __gnu_cxx::__normal_iterator<CProfStringList *, std::vector<CProfStringList, std::allocator<CProfStringList>>>, __gnu_cxx::__normal_iterator<CProfStringList *, std::vector<CProfStringList, std::allocator<CProfStringList>>>, int, int)') + + demangled = demangler.decode_routine('_ZSt11__push_heapIN9__gnu_cxx17__normal_iteratorIP8DRIVE_IDSt6vectorIS2_SaIS2_EEEEiS2_EvT_T0_S9_T1_') + self.check_demangling(demangled, 'void std::__push_heap<__gnu_cxx::__normal_iterator<DRIVE_ID *, std::vector<DRIVE_ID, std::allocator<DRIVE_ID>>>, int, DRIVE_ID>(__gnu_cxx::__normal_iterator<DRIVE_ID *, std::vector<DRIVE_ID, std::allocator<DRIVE_ID>>>, int, int, DRIVE_ID)') + + demangled = demangler.decode_routine('_ZSt12partial_sortIN9__gnu_cxx17__normal_iteratorIP28CPR_MAI_ADPTY_SectorSequenceSt6vectorIS2_SaIS2_EEEEEvT_S8_S8_') + self.check_demangling(demangled, 'void std::partial_sort<__gnu_cxx::__normal_iterator<CPR_MAI_ADPTY_SectorSequence *, std::vector<CPR_MAI_ADPTY_SectorSequence, std::allocator<CPR_MAI_ADPTY_SectorSequence>>>>(__gnu_cxx::__normal_iterator<CPR_MAI_ADPTY_SectorSequence *, std::vector<CPR_MAI_ADPTY_SectorSequence, std::allocator<CPR_MAI_ADPTY_SectorSequence>>>, __gnu_cxx::__normal_iterator<CPR_MAI_ADPTY_SectorSequence *, std::vector<CPR_MAI_ADPTY_SectorSequence, std::allocator<CPR_MAI_ADPTY_SectorSequence>>>, __gnu_cxx::__normal_iterator<CPR_MAI_ADPTY_SectorSequence *, std::vector<CPR_MAI_ADPTY_SectorSequence, std::allocator<CPR_MAI_ADPTY_SectorSequence>>>)') |