summaryrefslogtreecommitdiff
path: root/binutils/testsuite/binutils-all/cxxfilt.exp
blob: fc2d4e5c03e82b5f8bf1e773e7ecfea4c00539eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#   Copyright (C) 2018-2022 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.

proc test_cxxfilt {options mangled_string demangled_string} {
    global CXXFILT
    global CXXFILTFLAGS
    
    set testname "cxxfilt: demangling $mangled_string"
    set got [binutils_run $CXXFILT "$options $CXXFILTFLAGS $mangled_string"]

    if ![regexp $demangled_string $got] then {
	fail "$testname"
	verbose 0 "expected: $demangled_string"
	return
    }

    pass $testname
}

# Mangled and demangled strings stolen from libiberty/testsuite/demangle-expected.
test_cxxfilt {--no-strip-underscores} \
    "_Z1fIvJiELb0EEvPDOT1_EFT_DpT0_E" \
    "void f.void, int, false.(void (.)(int) noexcept(false))*"

test_cxxfilt {--format=gnu-v3 --no-strip-underscores} \
    "_Z14int_if_addableI1YERiP1AIXszpldecvPT_Li0EdecvS4_Li0EEE" \
    "int& int_if_addable.Y.(A.sizeof ((.((Y.)(0))).(.((Y.)(0))))..)*"

test_cxxfilt {--no-recurse-limit} \
    "Z3fooiPiPS_PS0_PS1_PS2_PS3_PS4_PS5_PS6_PS7_PS8_PS9_PSA_PSB_PSC_" \
    "foo(int, int., int.., int..., int...., int....., int......, int......., int........, int........., int.........., int..........., int............, int............., int.............., int...............)*"