aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp/demangle.exp
blob: fe51c55d2aa4301a472964d7afad1450d25419f9 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
# Copyright (C) 1992-2017 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, see <http://www.gnu.org/licenses/>.

# This file was written by Fred Fish. (fnf@cygnus.com)

if { [skip_cplus_tests] } { continue }

### The demangling style we last sent to GDB.
set current_demangling_style none

### Set GDB's current demangling style to STYLE.  Subsequent calls to
### test_demangle will include STYLE in the test name when reporting
### passes and failures.
proc set_demangling_style {style} {
    global gdb_prompt
    global current_demangling_style

    gdb_test_multiple "set demangle-style $style" \
	"$style: set demangle-style" {
	    -re "set demangle-style $style\[\r\n\]+$gdb_prompt $" {
		pass "$style: set demangle-style"
	    }
	    -re ".*$gdb_prompt $" {
		fail "$style: set demangle-style"
		error "set_demangling_style: set style"
	    }
	    timeout { 
		fail "$style: set demangle-style (timeout)"
		error "set_demangling_style: set style"
	    }
	}

    gdb_test_multiple "show demangle-style" \
	"$style: check demangling style" {
	    -re "The current C\[+\]+ demangling style is \"$style\".\r\n$gdb_prompt $" { 
		pass "$style: check demangling style"
	    }
	    -re ".*$gdb_prompt $" {
		fail "$style: check demangling style"
		error "set_demangling_style: check style"
	    }
	    timeout { 
		fail "$style: check demangling style (timeout)" 
		error "set_demangling_style: check style"
	    }
	}

    set current_demangling_style $style
}


### Utility function for test_demangling and test_demangling_exact.
proc test_demangling_core {tester test result} {
    global current_demangling_style

    if {! [regexp {^([^ ]+): (.+)$} $test dummy style name]} {
      error "bad test name passed to test_demangling"
    }

    if {[string compare $style $current_demangling_style]} {
	with_test_prefix $test {
	    set_demangling_style $style
	}
    }

    $tester "demangle $name" $result $test
}

### Demangle an identifier, and check that the result matches a pattern.
###
### TEST should be of the form "STYLE: NAME", where STYLE is the name
### of a demangling style (like "gnu" or "arm"), and NAME is a mangled
### identifier to demangle.  Pass when the result matches the regular
### expression RESULT.  Report passes and fails using TEST as the name
### of the test.
###
### Why don't we just pass the STYLE and NAME as two separate
### arguments, or let the style be a global variable?  That would be
### cleaner.  However, doing it this way means that:
### 
### 1) the name of the test, as recorded in the summary and log,
### appears verbatim in the script, and
### 
### 2) that test names are unique, even though we try to demangle the same
### identifiers using several different mangling styles.
### 
### This makes it a lot easier for people tracking down failures to
### find the one they care about.

proc test_demangling {test result} {
    test_demangling_core gdb_test $test $result
}

### Like test_demangling, above, except that RESULT is not a regexp,
### but a string that must match exactly.

proc test_demangling_exact {test result} {
    test_demangling_core gdb_test_exact $test $result
}



#
#  Test gnu style name demangling
#

proc test_gnu_style_demangling {} {
    global gdb_prompt

    test_demangling "gnu: Abort__FP6EditoriPCc" \
	"Abort\[(\]+Editor \[*\]+, int, (const char|char const) \[*\]+\[)\]+"
    test_demangling_exact "gnu: AddAlignment__9ivTSolverUiP12ivInteractorP7ivTGlue" "ivTSolver::AddAlignment(unsigned int, ivInteractor *, ivTGlue *)"
    test_demangling "gnu: Append__15NameChooserViewPCc" \
	"NameChooserView::Append\[(\]+(const char|char const) \[*\]+\[)\]+"
    test_demangling_exact "gnu: ArrowheadIntersects__9ArrowLineP9ArrowheadR6BoxObjP7Graphic" "ArrowLine::ArrowheadIntersects(Arrowhead *, BoxObj &, Graphic *)"
    test_demangling_exact "gnu: AtEnd__13ivRubberGroup" "ivRubberGroup::AtEnd(void)"
    test_demangling_exact "gnu: BgFilter__9ivTSolverP12ivInteractor" "ivTSolver::BgFilter(ivInteractor *)"
    test_demangling "gnu: BitPatterntoa__FRC10BitPatternccc" \
	"BitPatterntoa\[(\]+(const BitPattern|BitPattern const) &, char, char, char\[)\]+"
    test_demangling_exact "gnu: Check__6UArrayi" "UArray::Check(int)"
    test_demangling_exact "gnu: CoreConstDecls__8TextCodeR7ostream" "TextCode::CoreConstDecls(ostream &)"
    test_demangling_exact "gnu: Detach__8StateVarP12StateVarView" "StateVar::Detach(StateVarView *)"
    test_demangling_exact "gnu: Done__9ComponentG8Iterator" "Component::Done(Iterator)"
    test_demangling "gnu: DrawDestinationTransformedImage__FP7_XImageiiT0iiUlUiiiUiUlUlP4_XGCRC13ivTransformeriiii" \
	"DrawDestinationTransformedImage\[(\]+_XImage \[*\]+, int, int, _XImage \[*\]+, int, int, unsigned long, unsigned int, int, int, unsigned int, unsigned long, unsigned long, _XGC \[*\]+, (const ivTransformer|ivTransformer const) &, int, int, int, int\[)\]+"

    test_demangling "gnu: Edit__12StringEditorPCcii" \
	"StringEditor::Edit\[(\]+(const char|char const) \[*\]+, int, int\[)\]+"
    test_demangling_exact "gnu: Effect__11RelateManipR7ivEvent" "RelateManip::Effect(ivEvent &)"
    test_demangling "gnu: FilterName__FPCc" \
	"FilterName\[(\]+(const char|char const) \[*\]+\[)\]+"
    test_demangling "gnu: Filter__6PSTextPCci" \
	"PSText::Filter\[(\]+(const char|char const) \[*\]+, int\[)\]+"
    test_demangling "gnu: FindColor__7CatalogPCciii" \
	"Catalog::FindColor\[(\]+(const char|char const) \[*\]+, int, int, int\[)\]+"
    test_demangling_exact "gnu: FindFixed__FRP4CNetP4CNet" "FindFixed(CNet *&, CNet *)"
    test_demangling "gnu: FindFont__7CatalogPCcN21" \
	"Catalog::FindFont\[(\]+(const char|char const) \[*\]+, (const char|char const) \[*\]+, (const char|char const) \[*\]+\[)\]+"
    test_demangling_exact "gnu: Fix48_abort__FR8twolongs" "Fix48_abort(twolongs &)"
    test_demangling_exact "gnu: GetBarInfo__15iv2_6_VScrollerP13ivPerspectiveRiT2" "iv2_6_VScroller::GetBarInfo(ivPerspective *, int &, int &)"
    test_demangling_exact "gnu: GetBgColor__C9ivPainter" "ivPainter::GetBgColor(void) const"

    test_demangling "gnu: Iisdouble__FPC6IntRep" \
	"Iisdouble\[(\]+(const IntRep|IntRep const) \[*\]+\[)\]+"
    test_demangling_exact "gnu: InsertBody__15H_PullrightMenuii" "H_PullrightMenu::InsertBody(int, int)"
    test_demangling_exact "gnu: InsertCharacter__9TextManipc" "TextManip::InsertCharacter(char)"

    test_demangling_exact "gnu: InsertToplevel__7ivWorldP12ivInteractorT1" "ivWorld::InsertToplevel(ivInteractor *, ivInteractor *)"
    test_demangling_exact "gnu: InsertToplevel__7ivWorldP12ivInteractorT1iiUi" "ivWorld::InsertToplevel(ivInteractor *, ivInteractor *, int, int, unsigned int)"
    test_demangling "gnu: IsADirectory__FPCcR4stat" \
	"IsADirectory\[(\]+(const char|char const) \[*\]+, stat &\[)\]+"
    test_demangling_exact "gnu: IsAGroup__FP11GraphicViewP11GraphicComp" "IsAGroup(GraphicView *, GraphicComp *)"
    test_demangling_exact "gnu: IsA__10ButtonCodeUl" "ButtonCode::IsA(unsigned long)"

    test_demangling_exact "gnu: ReadName__FR7istreamPc" "ReadName(istream &, char *)"
    test_demangling_exact "gnu: Redraw__13StringBrowseriiii" "StringBrowser::Redraw(int, int, int, int)"
    test_demangling_exact "gnu: Rotate__13ivTransformerf" "ivTransformer::Rotate(float)"
    test_demangling_exact "gnu: Rotated__C13ivTransformerf" "ivTransformer::Rotated(float) const"
    test_demangling_exact "gnu: Round__Ff" "Round(float)"

    test_demangling_exact "gnu: SetExport__16MemberSharedNameUi" "MemberSharedName::SetExport(unsigned int)"
    test_demangling_exact "gnu: Set__14ivControlState13ControlStatusUi" "ivControlState::Set(ControlStatus, unsigned int)"
    test_demangling_exact "gnu: Set__5DFacePcii" "DFace::Set(char *, int, int)"

    test_demangling_exact "gnu: VConvert__9ivTSolverP12ivInteractorRP8TElementT2" "ivTSolver::VConvert(ivInteractor *, TElement *&, TElement *&)"
    test_demangling_exact "gnu: VConvert__9ivTSolverP7ivTGlueRP8TElement" "ivTSolver::VConvert(ivTGlue *, TElement *&)"
    test_demangling_exact "gnu: VOrder__9ivTSolverUiRP12ivInteractorT2" "ivTSolver::VOrder(unsigned int, ivInteractor *&, ivInteractor *&)"
    test_demangling "gnu: Valid__7CatalogPCcRP4Tool" \
	"Catalog::Valid\[(\]+(const char|char const) \[*\]+, Tool \[*\]+&\[)\]+"
    test_demangling_exact "gnu: _10PageButton\$__both" "PageButton::__both"
    test_demangling_exact "gnu: _3RNG\$singleMantissa" "RNG::singleMantissa"
    test_demangling_exact "gnu: _5IComp\$_release" "IComp::_release"
    test_demangling_exact "gnu: _\$_10BitmapComp" "BitmapComp::~BitmapComp(void)"

    test_demangling_exact "gnu: _\$_9__io_defs" "__io_defs::~__io_defs(void)"
    test_demangling_exact "gnu: _\$_Q23foo3bar" "foo::bar::~bar(void)"
    test_demangling_exact "gnu: _\$_Q33foo3bar4bell" "foo::bar::bell::~bell(void)"
    test_demangling_exact "gnu: __10ivTelltaleiP7ivGlyph" "ivTelltale::ivTelltale(int, ivGlyph *)"
    test_demangling_exact "gnu: __10ivViewportiP12ivInteractorUi" "ivViewport::ivViewport(int, ivInteractor *, unsigned int)"
    test_demangling_exact "gnu: __10ostrstream" "ostrstream::ostrstream(void)"
    test_demangling_exact "gnu: __10ostrstreamPcii" "ostrstream::ostrstream(char *, int, int)"
    test_demangling "gnu: __11BasicDialogiPCcP13ivButtonStateN22Ui" \
	"BasicDialog::BasicDialog\[(\]+int, (const char|char const) \[*\]+, ivButtonState \[*\]+, (const char|char const) \[*\]+, (const char|char const) \[*\]+, unsigned int\[)\]+"
    test_demangling_exact "gnu: __11BitmapTablei" "BitmapTable::BitmapTable(int)"
    test_demangling_exact "gnu: __12ViewportCodeP12ViewportComp" "ViewportCode::ViewportCode(ViewportComp *)"
    test_demangling "gnu: __12iv2_6_BorderiPCci" \
	"iv2_6_Border::iv2_6_Border\[(\]+int, (const char|char const) \[*\]+, int\[)\]+"
    test_demangling_exact "gnu: __12iv2_6_Borderii" "iv2_6_Border::iv2_6_Border(int, int)"
    test_demangling "gnu: __12ivBackgroundiP7ivGlyphPC7ivColor" \
	"ivBackground::ivBackground\[(\]+int, ivGlyph \[*\]+, (const ivColor|ivColor const) \[*\]+\[)\]+"
    test_demangling_exact "gnu: __12ivBreak_Listl" "ivBreak_List::ivBreak_List(long)"
    test_demangling "gnu: __14TextInteractoriPCcUi" \
	"TextInteractor::TextInteractor\[(\]+int, (const char|char const) \[*\]+, unsigned int\[)\]+"
    test_demangling_exact "gnu: __14iv2_6_MenuItemiP12ivInteractor" "iv2_6_MenuItem::iv2_6_MenuItem(int, ivInteractor *)"
    test_demangling "gnu: __14iv2_6_MenuItemiPCcP12ivInteractor" \
	"iv2_6_MenuItem::iv2_6_MenuItem\[(\]+int, (const char|char const) \[*\]+, ivInteractor \[*\]+\[)\]+"

    test_demangling_exact "gnu: __20DisplayList_IteratorR11DisplayList" "DisplayList_Iterator::DisplayList_Iterator(DisplayList &)"
    test_demangling_exact "gnu: __3fooRT0" "foo::foo(foo &)"
    test_demangling_exact "gnu: __3fooiN31" "foo::foo(int, int, int, int)"
    test_demangling "gnu: __3fooiPCc" \
	"foo::foo\[(\]+int, (const char|char const) \[*\]+\[)\]+"
    test_demangling_exact "gnu: __3fooiRT0iT2iT2" "foo::foo(int, foo &, int, foo &, int, foo &)"
    test_demangling "gnu: __6GetOptiPPcPCc" \
	"GetOpt::GetOpt\[(\]+int, char \[*\]+\[*\]+, (const char|char const) \[*\]+\[)\]+"
    test_demangling_exact "gnu: __6KeyMapPT0" "KeyMap::KeyMap(KeyMap *)"
    test_demangling "gnu: __7ivWorldPCcRiPPcPC12ivOptionDescPC14ivPropertyData" \
	"ivWorld::ivWorld\[(\]+(const char|char const) \[*\]+, int &, char \[*\]+\[*\]+, (const ivOptionDesc|ivOptionDesc const) \[*\]+, (const ivPropertyData|ivPropertyData const) \[*\]+\[)\]+"
    test_demangling "gnu: __7procbufPCci" \
	"procbuf::procbuf\[(\]+(const char|char const) \[*\]+, int\[)\]+"
    test_demangling_exact "gnu: __8ArrowCmdP6EditorUiUi" "ArrowCmd::ArrowCmd(Editor *, unsigned int, unsigned int)"

    test_demangling_exact "gnu: __9F_EllipseiiiiP7Graphic" "F_Ellipse::F_Ellipse(int, int, int, int, Graphic *)"
    test_demangling_exact "gnu: __9FrameDataP9FrameCompi" "FrameData::FrameData(FrameComp *, int)"
    test_demangling_exact "gnu: __9HVGraphicP9CanvasVarP7Graphic" "HVGraphic::HVGraphic(CanvasVar *, Graphic *)"
    test_demangling_exact "gnu: __Q23foo3bar" "foo::bar::bar(void)"
    test_demangling_exact "gnu: __Q33foo3bar4bell" "foo::bar::bell::bell(void)"
    test_demangling_exact "gnu: __aa__3fooRT0" "foo::operator&&(foo &)"
    test_demangling_exact "gnu: __aad__3fooRT0" "foo::operator&=(foo &)"
    test_demangling_exact "gnu: __ad__3fooRT0" "foo::operator&(foo &)"
    test_demangling_exact "gnu: __adv__3fooRT0" "foo::operator/=(foo &)"
    test_demangling_exact "gnu: __aer__3fooRT0" "foo::operator^=(foo &)"
    test_demangling_exact "gnu: __als__3fooRT0" "foo::operator<<=(foo &)"
    test_demangling_exact "gnu: __amd__3fooRT0" "foo::operator%=(foo &)"
    test_demangling_exact "gnu: __ami__3fooRT0" "foo::operator-=(foo &)"
    test_demangling_exact "gnu: __aml__3FixRT0" "Fix::operator*=(Fix &)"
    test_demangling_exact "gnu: __aml__5Fix16i" "Fix16::operator*=(int)"
    test_demangling_exact "gnu: __aml__5Fix32RT0" "Fix32::operator*=(Fix32 &)"
    test_demangling_exact "gnu: __aor__3fooRT0" "foo::operator|=(foo &)"
    test_demangling_exact "gnu: __apl__3fooRT0" "foo::operator+=(foo &)"
    test_demangling_exact "gnu: __ars__3fooRT0" "foo::operator>>=(foo &)"

    test_demangling_exact "gnu: __as__3fooRT0" "foo::operator=(foo &)"
    test_demangling_exact "gnu: __cl__3fooRT0" "foo::operator()(foo &)"
    test_demangling_exact "gnu: __cl__6Normal" "Normal::operator()(void)"
    test_demangling_exact "gnu: __cl__6Stringii" "String::operator()(int, int)"
    test_demangling_exact "gnu: __cm__3fooRT0" "foo::operator, (foo &)"
    test_demangling_exact "gnu: __co__3foo" "foo::operator~(void)"
    test_demangling_exact "gnu: __dl__3fooPv" "foo::operator delete(void *)"
    test_demangling_exact "gnu: __dv__3fooRT0" "foo::operator/(foo &)"
    test_demangling_exact "gnu: __eq__3fooRT0" "foo::operator==(foo &)"
    test_demangling_exact "gnu: __er__3fooRT0" "foo::operator^(foo &)"
    test_demangling_exact "gnu: __ge__3fooRT0" "foo::operator>=(foo &)"
    test_demangling_exact "gnu: __gt__3fooRT0" "foo::operator>(foo &)"
    test_demangling_exact "gnu: __le__3fooRT0" "foo::operator<=(foo &)"
    test_demangling_exact "gnu: __ls__3fooRT0" "foo::operator<<(foo &)"
    test_demangling_exact "gnu: __ls__FR7ostreamPFR3ios_R3ios" "operator<<(ostream &, ios &(*)(ios &))"
    test_demangling_exact "gnu: __ls__FR7ostreamR3Fix" "operator<<(ostream &, Fix &)"
    test_demangling_exact "gnu: __lt__3fooRT0" "foo::operator<(foo &)"
    test_demangling_exact "gnu: __md__3fooRT0" "foo::operator%(foo &)"
    test_demangling_exact "gnu: __mi__3fooRT0" "foo::operator-(foo &)"
    test_demangling_exact "gnu: __ml__3fooRT0" "foo::operator*(foo &)"
    test_demangling_exact "gnu: __mm__3fooi" "foo::operator--(int)"

    test_demangling_exact "gnu: __ne__3fooRT0" "foo::operator!=(foo &)"
    test_demangling "gnu: __ne__FRC7ComplexT0" \
	"operator!=\[(\]+(const Complex|Complex const) &, (const Complex|Complex const) &\[)\]+"
    test_demangling "gnu: __ne__FRC7Complexd" \
	"operator!=\[(\]+(const Complex|Complex const) &, double\[)\]+"
    test_demangling "gnu: __ne__FRC9SubStringRC6String" \
	"operator!=\[(\]+(const SubString|SubString const) &, (const String|String const) &\[)\]+"
    test_demangling_exact "gnu: __nt__3foo" "foo::operator!(void)"
    test_demangling_exact "gnu: __nw__3fooi" "foo::operator new(int)"
    test_demangling_exact "gnu: __oo__3fooRT0" "foo::operator||(foo &)"
    test_demangling_exact "gnu: __opPc__3foo" "foo::operator char *(void)"
    test_demangling_exact "gnu: __opi__3foo" "foo::operator int(void)"
    test_demangling_exact "gnu: __or__3fooRT0" "foo::operator|(foo &)"
    test_demangling_exact "gnu: __pl__3fooRT0" "foo::operator+(foo &)"
    test_demangling_exact "gnu: __pp__3fooi" "foo::operator++(int)"
    test_demangling_exact "gnu: __rf__3foo" "foo::operator->(void)"
    test_demangling_exact "gnu: __rm__3fooRT0" "foo::operator->*(foo &)"
    test_demangling_exact "gnu: __rs__3fooRT0" "foo::operator>>(foo &)"
    test_demangling "gnu: __vc__3fooRT0" "foo::operator\\\[\\\]\\(foo &\\)"
    test_demangling "gnu: _gsub__6StringRC5RegexPCci" \
	"String::_gsub\[(\]+(const Regex|Regex const) &, (const char|char const) \[*\]+, int\[)\]+"
    test_demangling_exact "gnu: _new_Fix__FUs" "_new_Fix(unsigned short)"

    # gcc 2.4.5 (and earlier) style virtual tables.  We want to continue to
    # correctly demangle these even if newer compilers use a different form.
    test_demangling_exact "gnu: _vt.foo" "foo virtual table"
    test_demangling_exact "gnu: _vt.foo.bar" "foo::bar virtual table"
    test_demangling_exact "gnu: _vt\$foo" "foo virtual table"
    test_demangling_exact "gnu: _vt\$foo\$bar" "foo::bar virtual table"

    test_demangling_exact "gnu: append__7ivGlyphPT0" "ivGlyph::append(ivGlyph *)"
    test_demangling "gnu: arg__FRC7Complex" \
	"arg\[(\]+(const Complex|Complex const) &\[)\]+"
    test_demangling_exact "gnu: clearok__FP7_win_sti" "clearok(_win_st *, int)"

    test_demangling_exact "gnu: complexfunc2__FPFPc_i" "complexfunc2(int (*)(char *))"
    test_demangling_exact "gnu: complexfunc3__FPFPFPl_s_i" "complexfunc3(int (*)(short (*)(long *)))"
    test_demangling_exact "gnu: complexfunc4__FPFPFPc_s_i" "complexfunc4(int (*)(short (*)(char *)))"
    test_demangling_exact "gnu: complexfunc5__FPFPc_PFl_i" "complexfunc5(int (*(*)(char *))(long))"
    test_demangling_exact "gnu: complexfunc6__FPFPi_PFl_i" "complexfunc6(int (*(*)(int *))(long))"
    test_demangling_exact "gnu: complexfunc7__FPFPFPc_i_PFl_i" "complexfunc7(int (*(*)(int (*)(char *)))(long))"
    test_demangling "gnu: contains__C9BitStringRC10BitPattern" \
	"BitString::contains\[(\]+(const BitPattern|BitPattern const) &\[)\]+ const"
    test_demangling "gnu: contains__C9BitStringRC12BitSubStringi" \
	"BitString::contains\[(\]+(const BitSubString|BitSubString const) &, int\[)\]+ const"
    test_demangling "gnu: contains__C9BitStringRT0" \
	"BitString::contains\[(\]+(const BitString|BitString const) &\[)\]+ const"
    test_demangling "gnu: div__FPC6IntRepT0P6IntRep" \
	"div\[(\]+(const IntRep|IntRep const) \[*\]+, (const IntRep|IntRep const) \[*\]+, IntRep \[*\]+\[)\]+"
    test_demangling "gnu: div__FPC6IntReplP6IntRep" \
	"div\[(\]+(const IntRep|IntRep const) \[*\]+, long, IntRep \[*\]+\[)\]+"
    test_demangling "gnu: div__FRC8RationalT0R8Rational" \
	"div\[(\]+(const Rational|Rational const) &, (const Rational|Rational const) &, Rational &\[)\]+"
    test_demangling "gnu: divide__FRC7IntegerT0R7IntegerT2" \
	"divide\[(\]+(const Integer|Integer const) &, (const Integer|Integer const) &, Integer &, Integer &\[)\]+"
    test_demangling "gnu: divide__FRC7IntegerlR7IntegerRl" \
	"divide\[(\]+(const Integer|Integer const) &, long, Integer &, long &\[)\]+"
    test_demangling "gnu: enable__14DocumentViewerPCcUi" \
	"DocumentViewer::enable\[(\]+(const char|char const) \[*\]+, unsigned int\[)\]+"

    test_demangling_exact "gnu: foo__FiN30" "foo(int, int, int, int)"
    test_demangling_exact "gnu: foo__FiR3fooiT1iT1" "foo(int, foo &, int, foo &, int, foo &)"
    test_demangling_exact "gnu: foo___3barl" "bar::foo_(long)"
    test_demangling_exact "gnu: insert__15ivClippingStacklRP8_XRegion" "ivClippingStack::insert(long, _XRegion *&)"
    test_demangling_exact "gnu: insert__16ChooserInfo_ListlR11ChooserInfo" "ChooserInfo_List::insert(long, ChooserInfo &)"
    test_demangling_exact "gnu: insert__17FontFamilyRepListlRP15ivFontFamilyRep" "FontFamilyRepList::insert(long, ivFontFamilyRep *&)"
    test_demangling_exact "gnu: leaveok__FP7_win_stc" "leaveok(_win_st *, char)"
    test_demangling_exact "gnu: left_mover__C7ivMFKitP12ivAdjustableP7ivStyle" "ivMFKit::left_mover(ivAdjustable *, ivStyle *) const"
    test_demangling "gnu: matches__C9BitStringRC10BitPatterni" \
	"BitString::matches\[(\]+(const BitPattern|BitPattern const) &, int\[)\]+ const"
    test_demangling "gnu: matches__C9SubStringRC5Regex" \
	"SubString::matches\[(\]+(const Regex|Regex const) &\[)\]+ const"

    test_demangling_exact "gnu: overload1arg__FSc" "overload1arg(signed char)"
    test_demangling_exact "gnu: overload1arg__FUc" "overload1arg(unsigned char)"
    test_demangling_exact "gnu: overload1arg__FUi" "overload1arg(unsigned int)"
    test_demangling_exact "gnu: overload1arg__FUl" "overload1arg(unsigned long)"
    test_demangling_exact "gnu: overload1arg__FUs" "overload1arg(unsigned short)"
    test_demangling_exact "gnu: overload1arg__Fc" "overload1arg(char)"
    test_demangling_exact "gnu: overload1arg__Fd" "overload1arg(double)"
    test_demangling_exact "gnu: overload1arg__Ff" "overload1arg(float)"
    test_demangling_exact "gnu: overload1arg__Fi" "overload1arg(int)"
    test_demangling_exact "gnu: overload1arg__Fl" "overload1arg(long)"
    test_demangling_exact "gnu: overload1arg__Fs" "overload1arg(short)"
    test_demangling_exact "gnu: overload1arg__Fv" "overload1arg(void)"
    test_demangling_exact "gnu: overloadargs__Fi" "overloadargs(int)"
    test_demangling_exact "gnu: overloadargs__Fii" "overloadargs(int, int)"
    test_demangling_exact "gnu: overloadargs__Fiii" "overloadargs(int, int, int)"
    test_demangling_exact "gnu: overloadargs__Fiiii" "overloadargs(int, int, int, int)"

    test_demangling_exact "gnu: overloadargs__Fiiiii" "overloadargs(int, int, int, int, int)"
    test_demangling_exact "gnu: overloadargs__Fiiiiii" "overloadargs(int, int, int, int, int, int)"
    test_demangling_exact "gnu: overloadargs__Fiiiiiii" "overloadargs(int, int, int, int, int, int, int)"
    test_demangling_exact "gnu: overloadargs__Fiiiiiiii" "overloadargs(int, int, int, int, int, int, int, int)"
    test_demangling_exact "gnu: overloadargs__Fiiiiiiiii" "overloadargs(int, int, int, int, int, int, int, int, int)"
    test_demangling_exact "gnu: overloadargs__Fiiiiiiiiii" "overloadargs(int, int, int, int, int, int, int, int, int, int)"
    test_demangling_exact "gnu: overloadargs__Fiiiiiiiiiii" "overloadargs(int, int, int, int, int, int, int, int, int, int, int)"
    test_demangling "gnu: pick__13ivCompositionP8ivCanvasRC12ivAllocationiR5ivHit" \
	"ivComposition::pick\[(\]+ivCanvas \[*\]+, (const ivAllocation|ivAllocation const) &, int, ivHit &\[)\]+"
    test_demangling "gnu: pointer__C11ivHScrollerRC7ivEventRC12ivAllocation" \
	"ivHScroller::pointer\[(\]+(const ivEvent|ivEvent const) &, (const ivAllocation|ivAllocation const) &\[)\]+ const"
    test_demangling_exact "gnu: poke__8ivRasterUlUlffff" "ivRaster::poke(unsigned long, unsigned long, float, float, float, float)"
    test_demangling_exact "gnu: polar__Fdd" "polar(double, double)"
    test_demangling "gnu: read__10osStdInputRPCc" \
	"osStdInput::read\[(\]+(const char|char const) \[*\]+&\[)\]+"

    test_demangling_exact "gnu: scale__13ivTransformerff" "ivTransformer::scale(float, float)"
    test_demangling "gnu: scanw__12CursesWindowPCce" \
	"CursesWindow::scanw\[(\]+(const char|char const) \[*\]+,...\[)\]+"
    test_demangling "gnu: scmp__FPCcT0" \
	"scmp\[(\]+(const char|char const) \[*\]+, (const char|char const) \[*\]+\[)\]+"
    test_demangling_exact "gnu: sgetn__7filebufPci" "filebuf::sgetn(char *, int)"
    test_demangling_exact "gnu: shift__FP5_FrepiT0" "shift(_Frep *, int, _Frep *)"
    test_demangling_exact "gnu: test__C6BitSeti" "BitSet::test(int) const"
    test_demangling_exact "gnu: test__C6BitSetii" "BitSet::test(int, int) const"
    test_demangling "gnu: testbit__FRC7Integerl" \
	"testbit\[(\]+(const Integer|Integer const) &, long\[)\]+"
    test_demangling_exact "gnu: text_source__8Documentl" "Document::text_source(long)"
    test_demangling_exact "gnu: variance__6Erlangd" "Erlang::variance(double)"
    test_demangling "gnu: vform__8iostreamPCcPc" \
	"iostream::vform\[(\]+(const char|char const) \[*\]+, char \[*\]+\[)\]+"
    test_demangling_exact "gnu: view__14DocumentViewerP8ItemViewP11TabularItem" "DocumentViewer::view(ItemView *, TabularItem *)"
    test_demangling_exact "gnu: xy_extents__11ivExtensionffff" "ivExtension::xy_extents(float, float, float, float)"
    test_demangling_exact "gnu: zero__8osMemoryPvUi" "osMemory::zero(void *, unsigned int)"
    test_demangling_exact "gnu: _2T4\$N" "T4::N"
    test_demangling_exact "gnu: _Q22T42t1\$N" "T4::t1::N"
    test_demangling_exact "gnu: get__2T1" "T1::get(void)"
    test_demangling_exact "gnu: get__Q22T11a" "T1::a::get(void)"
    test_demangling_exact "gnu: get__Q32T11a1b" "T1::a::b::get(void)"
    test_demangling_exact "gnu: get__Q42T11a1b1c" "T1::a::b::c::get(void)"
    test_demangling_exact "gnu: get__Q52T11a1b1c1d" "T1::a::b::c::d::get(void)"
    test_demangling_exact "gnu: put__2T1i" "T1::put(int)"
    test_demangling_exact "gnu: put__Q22T11ai" "T1::a::put(int)"
    test_demangling_exact "gnu: put__Q32T11a1bi" "T1::a::b::put(int)"
    test_demangling_exact "gnu: put__Q42T11a1b1ci" "T1::a::b::c::put(int)"
    test_demangling_exact "gnu: put__Q52T11a1b1c1di" "T1::a::b::c::d::put(int)"

    test_demangling_exact "gnu: bar__3fooPv"       "foo::bar(void *)"
    test_demangling "gnu: bar__3fooPCv" \
	"foo::bar\[(\]+(const void|void const) *\[*\]+\[)\]+"
    test_demangling_exact "gnu: bar__C3fooPv"      "foo::bar(void *) const"
    test_demangling "gnu: bar__C3fooPCv" \
	"foo::bar\[(\]+(const void|void const) *\[*\]+\[)\]+ const"
    test_demangling_exact "gnu: __eq__3fooRT0"     "foo::operator==(foo &)"
    test_demangling "gnu: __eq__3fooRC3foo" \
	 "foo::operator==\[(\]+(const foo|foo const) &\[)\]+"
    test_demangling_exact "gnu: __eq__C3fooR3foo"  "foo::operator==(foo &) const"
    test_demangling "gnu: __eq__C3fooRT0" \
	   "foo::operator==\[(\]+(const foo|foo const) &\[)\]+ const"

    test_demangling_exact "gnu: elem__t6vector1Zdi" "vector<double>::elem(int)"
    test_demangling_exact "gnu: elem__t6vector1Zii" "vector<int>::elem(int)"
    test_demangling_exact "gnu: __t6vector1Zdi"     "vector<double>::vector(int)"
    test_demangling_exact "gnu: __t6vector1Zii"     "vector<int>::vector(int)"
    test_demangling_exact "gnu: _\$_t6vector1Zdi"    "vector<double>::~vector(int)"
    test_demangling_exact "gnu: _\$_t6vector1Zii"    "vector<int>::~vector(int)"

    test_demangling_exact "gnu: __nw__t2T11ZcUi" "T1<char>::operator new(unsigned int)"
    test_demangling_exact "gnu: __nw__t2T11Z1tUi" "T1<t>::operator new(unsigned int)"
    test_demangling_exact "gnu: __dl__t2T11ZcPv" "T1<char>::operator delete(void *)"
    test_demangling_exact "gnu: __dl__t2T11Z1tPv" "T1<t>::operator delete(void *)"
    test_demangling_exact "gnu: __t2T11Zci" "T1<char>::T1(int)"
    test_demangling_exact "gnu: __t2T11Zc" "T1<char>::T1(void)"
    test_demangling_exact "gnu: __t2T11Z1ti" "T1<t>::T1(int)"
    test_demangling_exact "gnu: __t2T11Z1t" "T1<t>::T1(void)"

    test_demangling_exact "gnu: __Q2t4List1Z10VHDLEntity3Pix" \
	"List<VHDLEntity>::Pix::Pix(void)"

    test_demangling_exact "gnu: __Q2t4List1Z10VHDLEntity3PixPQ2t4List1Z10VHDLEntity7element" \
	"List<VHDLEntity>::Pix::Pix(List<VHDLEntity>::element *)"

    test_demangling_exact "gnu: __Q2t4List1Z10VHDLEntity3PixRCQ2t4List1Z10VHDLEntity3Pix" \
	"List<VHDLEntity>::Pix::Pix(List<VHDLEntity>::Pix const &)"

    test_demangling_exact "gnu: __Q2t4List1Z10VHDLEntity7elementRC10VHDLEntityPT0" \
	"List<VHDLEntity>::element::element(VHDLEntity const &, List<VHDLEntity>::element *)"

    test_demangling_exact "gnu: __Q2t4List1Z10VHDLEntity7elementRCQ2t4List1Z10VHDLEntity7element" \
	"List<VHDLEntity>::element::element(List<VHDLEntity>::element const &)"

    test_demangling_exact "gnu: __cl__C11VHDLLibraryGt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
	"VHDLLibrary::operator()(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >) const"

    test_demangling_exact "gnu: __cl__Ct4List1Z10VHDLEntityRCQ2t4List1Z10VHDLEntity3Pix" \
	"List<VHDLEntity>::operator()(List<VHDLEntity>::Pix const &) const"

    test_demangling_exact "gnu: __ne__FPvRCQ2t4List1Z10VHDLEntity3Pix" \
	"operator!=(void *, List<VHDLEntity>::Pix const &)"

    test_demangling_exact "gnu: __ne__FPvRCt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
	"operator!=(void *, PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> > const &)"

    test_demangling_exact "gnu: __t4List1Z10VHDLEntityRCt4List1Z10VHDLEntity" \
	"List<VHDLEntity>::List(List<VHDLEntity> const &)"

    test_demangling_exact "gnu: __t4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
	"PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >::PixX(void)"

    test_demangling_exact "gnu: __t4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntityP14VHDLLibraryRepGQ2t4List1Z10VHDLEntity3Pix" \
	"PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >::PixX(VHDLLibraryRep *, List<VHDLEntity>::Pix)"

    test_demangling_exact "gnu: __t4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntityRCt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
	"PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >::PixX(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> > const &)"

    test_demangling_exact "gnu: nextE__C11VHDLLibraryRt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
	"VHDLLibrary::nextE(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> > &) const"

    test_demangling_exact "gnu: next__Ct4List1Z10VHDLEntityRQ2t4List1Z10VHDLEntity3Pix" \
	"List<VHDLEntity>::next(List<VHDLEntity>::Pix &) const"

    test_demangling_exact "gnu: _GLOBAL_\$D\$set" "global destructors keyed to set"

    test_demangling_exact "gnu: _GLOBAL_\$I\$set" "global constructors keyed to set"

    test_demangling_exact "gnu: __as__t5ListS1ZUiRCt5ListS1ZUi" \
	"ListS<unsigned int>::operator=(ListS<unsigned int> const &)"

    test_demangling_exact "gnu: __cl__Ct5ListS1ZUiRCQ2t5ListS1ZUi3Vix" \
	"ListS<unsigned int>::operator()(ListS<unsigned int>::Vix const &) const"

    test_demangling_exact "gnu: __cl__Ct5SetLS1ZUiRCQ2t5SetLS1ZUi3Vix" \
	"SetLS<unsigned int>::operator()(SetLS<unsigned int>::Vix const &) const"

    test_demangling_exact "gnu: __t10ListS_link1ZUiRCUiPT0" \
	"ListS_link<unsigned int>::ListS_link(unsigned int const &, ListS_link<unsigned int> *)"

    test_demangling_exact "gnu: __t10ListS_link1ZUiRCt10ListS_link1ZUi" \
	"ListS_link<unsigned int>::ListS_link(ListS_link<unsigned int> const &)"

    test_demangling_exact "gnu: __t5ListS1ZUiRCt5ListS1ZUi" \
	"ListS<unsigned int>::ListS(ListS<unsigned int> const &)"

    test_demangling_exact "gnu: next__Ct5ListS1ZUiRQ2t5ListS1ZUi3Vix" \
	"ListS<unsigned int>::next(ListS<unsigned int>::Vix &) const"

    test_demangling_exact "gnu: __ne__FPvRCQ2t5SetLS1ZUi3Vix" \
	"operator!=(void *, SetLS<unsigned int>::Vix const &)"
    test_demangling_exact "gnu: __t8ListElem1Z5LabelRt4List1Z5Label" \
	"ListElem<Label>::ListElem(List<Label> &)"
    test_demangling_exact "gnu: __t8BDDHookV1ZPcRCPc" \
	"BDDHookV<char *>::BDDHookV(char *const &)"

    test_demangling_exact "gnu: _vt\$t8BDDHookV1ZPc" "BDDHookV<char *> virtual table"

    test_demangling_exact "gnu: __ne__FPvRCQ211BDDFunction4VixB" \
	"operator!=(void *, BDDFunction::VixB const &)"
    test_demangling_exact "gnu: __eq__FPvRCQ211BDDFunction4VixB" \
	"operator==(void *, BDDFunction::VixB const &)"

    test_demangling_exact "gnu: relativeId__CQ36T_phi210T_preserve8FPC_nextRCQ26T_phi210T_preserveRC10Parameters" \
	 "T_phi2::T_preserve::FPC_next::relativeId(T_phi2::T_preserve const &, Parameters const &) const"

    test_demangling_exact "gnu: _Utf390_1__1_9223372036854775807__9223372036854775" \
	    "Can't demangle \"_Utf390_1__1_9223372036854775807__9223372036854775\""
    test_demangling_exact "gnu: foo__I40" "foo(int64_t)"
    test_demangling_exact "gnu: foo__I_200_" "foo(int512_t)"
    test_demangling_exact "gnu: foo__I_200" "Can't demangle \"foo__I_200\""

    # Rvalue reference tests
    test_demangling_exact "gnu-v3: _ZN9ArrowLine19ArrowheadIntersectsEP9ArrowheadO6BoxObjP7Graphic" "ArrowLine::ArrowheadIntersects(Arrowhead*, BoxObj&&, Graphic*)"
    test_demangling "gnu-v3: _Z13BitPatterntoaOK10BitPatternccc" \
	"BitPatterntoa\[(\]+(const BitPattern|BitPattern const)&&, char, char, char\[)\]+"
    test_demangling_exact "gnu-v3: _ZN8TextCode14CoreConstDeclsEO7ostream" "TextCode::CoreConstDecls(ostream&&)"
    test_demangling "gnu-v3: _Z31DrawDestinationTransformedImageP7_XImageiiS0_iimjiijmmP4_XGCOK13ivTransformeriiii" \
	"DrawDestinationTransformedImage\[(\]+_XImage\[*\]+, int, int, _XImage\[*\]+, int, int, unsigned long, unsigned int, int, int, unsigned int, unsigned long, unsigned long, _XGC\[*\]+, (const ivTransformer|ivTransformer const)&&, int, int, int, int\[)\]+"
    test_demangling_exact "gnu-v3: _ZN11RelateManip6EffectEO7ivEvent" "RelateManip::Effect(ivEvent&&)"
    test_demangling_exact "gnu-v3: _ZN20DisplayList_IteratorC4EO11DisplayList" "DisplayList_Iterator::DisplayList_Iterator(DisplayList&&)"
    test_demangling_exact "gnu-v3: _ZN3fooC4EOS_" "foo::foo(foo&&)"
    test_demangling_exact "gnu-v3: _ZN3fooC4EiOS_iS0_iS0_" "foo::foo(int, foo&&, int, foo&&, int, foo&&)"
    test_demangling "gnu-v3: _ZN7ivWorldC2EPKcOiPPcPK12ivOptionDescPK14ivPropertyData" \
	"ivWorld::ivWorld\[(\]+(const char|char const)\[*\]+, int&&, char\[*\]+\[*\]+, (const ivOptionDesc|ivOptionDesc const)\[*\]+, (const ivPropertyData|ivPropertyData const)\[*\]+\[)\]+"
    test_demangling "gnu-v3: _Z3argOK7Complex" \
	"arg\[(\]+(const Complex|Complex const)&&\[)\]+"
    test_demangling "gnu-v3: _ZNK9BitString8containsEOK10BitPattern" \
	"BitString::contains\[(\]+(const BitPattern|BitPattern const)&&\[)\]+ const"
    test_demangling "gnu-v3: _ZNK9BitString8containsEOK12BitSubStringi" \
	"BitString::contains\[(\]+(const BitSubString|BitSubString const)&&, int\[)\]+ const"
    test_demangling "gnu-v3: _ZNK9BitString8containsEOKS_" \
	"BitString::contains\[(\]+(const BitString|BitString const)&&\[)\]+ const"
    test_demangling_exact "gnu-v3: _ZN4ListI10VHDLEntityE3PixC4EOKS2_" \
	"List<VHDLEntity>::Pix::Pix(List<VHDLEntity>::Pix const&&)"
    test_demangling_exact "gnu-v3: _ZN4ListI10VHDLEntityE7elementC2EOKS0_PS2_" \
	"List<VHDLEntity>::element::element(VHDLEntity const&&, List<VHDLEntity>::element*)"
    test_demangling_exact "gnu-v3: _ZN4ListI10VHDLEntityE7elementC4EOKS2_" \
	"List<VHDLEntity>::element::element(List<VHDLEntity>::element const&&)"
    test_demangling_exact "gnu-v3: _ZNK4ListI10VHDLEntityEclEOKNS1_3PixE" \
	"List<VHDLEntity>::operator()(List<VHDLEntity>::Pix const&&) const"
    test_demangling_exact "gnu-v3: _ZN4ListI10VHDLEntityEC4EOKS1_" \
	"List<VHDLEntity>::List(List<VHDLEntity> const&&)"
    test_demangling_exact "gnu-v3: _ZN4PixXI11VHDLLibrary14VHDLLibraryRep4ListI10VHDLEntityEEC2EOKS5_" \
	"PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >::PixX(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> > const&&)"
    test_demangling_exact "gnu-v3: _ZNK11VHDLLibrary5nextEEO4PixXIS_14VHDLLibraryRep4ListI10VHDLEntityEE" \
	"VHDLLibrary::nextE(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >&&) const"
    test_demangling_exact "gnu-v3: _ZNK4ListI10VHDLEntityE4nextEONS1_3PixE" \
	"List<VHDLEntity>::next(List<VHDLEntity>::Pix&&) const"

    ## Buffer overrun.  Should make GDB crash.  Woo hoo!
    test_demangling_exact "gnu: foo__I_4000000000000000000000000000000000000000000000000000000000000000000000000" "Can't demangle \"foo__I_4000000000000000000000000000000000000000000000000000000000000000000000000\""

    ## 1999-04-19: "Fix from Dale Hawkins".  Shouldn't segfault.
    # Accept even a dubious demangling; the string is ambiguous.

    gdb_test_multiple "demangle __thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlRPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingRPQ29CosNaming15BindingIterator" "gnu: __thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlRPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingRPQ29CosNaming15BindingIterator" {
	-re "virtual function thunk \\(delta:-64\\) for CosNaming::_proxy_NamingContext::_0RL__list\\(unsigned long, _CORBA_Unbounded_Sequence<CosNaming::Binding> \\*\\&, CosNaming::BindingIterator \\*\\&\\)\r\n$gdb_prompt $" {
	    pass "gnu: __thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlRPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingRPQ29CosNaming15BindingIterator"
	}
	-re ".*Can't demangle \"__thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlRPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingRPQ29CosNaming15BindingIterator\"\r\n$gdb_prompt $" {
	    pass "gnu: __thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlRPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingRPQ29CosNaming15BindingIterator"
	}
    }
}

#
#  Test lucid style name demangling
#

proc test_lucid_style_demangling {} {
    test_demangling_exact "lucid: WS__FR7istream" "WS(istream &)"
    test_demangling_exact "lucid: __aa__3fooFR3foo" "foo::operator&&(foo &)"
    test_demangling_exact "lucid: __aad__3fooFR3foo" "foo::operator&=(foo &)"
    test_demangling_exact "lucid: __ad__3fooFR3foo" "foo::operator&(foo &)"
    test_demangling_exact "lucid: __adv__3fooFR3foo" "foo::operator/=(foo &)"
    test_demangling_exact "lucid: __adv__7complexF7complex" "complex::operator/=(complex)"
    test_demangling_exact "lucid: __aer__3fooFR3foo" "foo::operator^=(foo &)"
    test_demangling_exact "lucid: __als__3fooFR3foo" "foo::operator<<=(foo &)"
    test_demangling_exact "lucid: __amd__3fooFR3foo" "foo::operator%=(foo &)"
    test_demangling_exact "lucid: __ami__3fooFR3foo" "foo::operator-=(foo &)"
    test_demangling_exact "lucid: __amu__3fooFR3foo" "foo::operator*=(foo &)"
    test_demangling_exact "lucid: __amu__7complexF7complex" "complex::operator*=(complex)"
    test_demangling_exact "lucid: __aor__3fooFR3foo" "foo::operator|=(foo &)"
    test_demangling_exact "lucid: __apl__3fooFR3foo" "foo::operator+=(foo &)"
    test_demangling_exact "lucid: __ars__3fooFR3foo" "foo::operator>>=(foo &)"
    test_demangling_exact "lucid: __as__18istream_withassignFP9streambuf" "istream_withassign::operator=(streambuf *)"
    test_demangling_exact "lucid: __as__18istream_withassignFR7istream" "istream_withassign::operator=(istream &)"
    test_demangling_exact "lucid: __as__3fooFR3foo" "foo::operator=(foo &)"
    test_demangling_exact "lucid: __as__3iosFR3ios" "ios::operator=(ios &)"
    test_demangling_exact "lucid: __cl__3fooFR3foo" "foo::operator()(foo &)"
    test_demangling_exact "lucid: __cm__3fooFR3foo" "foo::operator, (foo &)"

    test_demangling_exact "lucid: __co__3fooFv" "foo::operator~(void)"
    test_demangling_exact "lucid: __ct__10istrstreamFPc" "istrstream::istrstream(char *)"
    test_demangling_exact "lucid: __ct__10istrstreamFPci" "istrstream::istrstream(char *, int)"
    test_demangling_exact "lucid: __ct__10ostrstreamFPciT2" "ostrstream::ostrstream(char *, int, int)"
    test_demangling_exact "lucid: __ct__10ostrstreamFv" "ostrstream::ostrstream(void)"
    test_demangling_exact "lucid: __ct__10smanip_intFPFR3iosi_R3iosi" "smanip_int::smanip_int(ios &(*)(ios &, int), int)"
    test_demangling "lucid: __ct__11c_exceptionFPcRC7complexT2" "c_exception::c_exception\[(\]+char \[*\]+, (const complex|complex const) &, (const complex|complex const) &\[)\]+"
    test_demangling "lucid: __ct__11fstreambaseFPCciT2" "fstreambase::fstreambase\[(\]+(const char|char const) \[*\]+, int, int\[)\]+"
    test_demangling_exact "lucid: __ct__11fstreambaseFi" "fstreambase::fstreambase(int)"
    test_demangling_exact "lucid: __ct__11fstreambaseFiPcT1" "fstreambase::fstreambase(int, char *, int)"
    test_demangling_exact "lucid: __ct__11fstreambaseFv" "fstreambase::fstreambase(void)"
    test_demangling_exact "lucid: __ct__11smanip_longFPFR3iosl_R3iosl" "smanip_long::smanip_long(ios &(*)(ios &, long), long)"
    test_demangling_exact "lucid: __ct__11stdiostreamFP4FILE" "stdiostream::stdiostream(FILE *)"
    test_demangling_exact "lucid: __ct__12strstreambufFPFl_PvPFPv_v" "strstreambuf::strstreambuf(void *(*)(long), void (*)(void *))"
    test_demangling_exact "lucid: __ct__12strstreambufFPUciT1" "strstreambuf::strstreambuf(unsigned char *, int, unsigned char *)"
    test_demangling_exact "lucid: __ct__12strstreambufFPciT1" "strstreambuf::strstreambuf(char *, int, char *)"
    test_demangling_exact "lucid: __ct__12strstreambufFi" "strstreambuf::strstreambuf(int)"
    test_demangling_exact "lucid: __ct__12strstreambufFv" "strstreambuf::strstreambuf(void)"
    test_demangling_exact "lucid: __ct__13strstreambaseFPciT1" "strstreambase::strstreambase(char *, int, char *)"
    test_demangling_exact "lucid: __ct__3fooFR3foo" "foo::foo(foo &)"

    test_demangling_exact "lucid: __ct__3fooFi" "foo::foo(int)"
    test_demangling_exact "lucid: __ct__3fooFiN31" "foo::foo(int, int, int, int)"
    test_demangling "lucid: __ct__3fooFiPCc" \
	"foo::foo\[(\]+int, (const char|char const) \[*\]+\[)\]+"
    test_demangling_exact "lucid: __ct__3fooFiR3fooT1T2T1T2" "foo::foo(int, foo &, int, foo &, int, foo &)"
    test_demangling_exact "lucid: __ct__3iosFP9streambuf" "ios::ios(streambuf *)"
    test_demangling_exact "lucid: __ct__7filebufFiPcT1" "filebuf::filebuf(int, char *, int)"
    test_demangling "lucid: __ct__7fstreamFPCciT2" \
	"fstream::fstream\[(\]+(const char|char const) \[*\]+, int, int\[)\]+"
    test_demangling_exact "lucid: __ct__7fstreamFiPcT1" "fstream::fstream(int, char *, int)"
    test_demangling_exact "lucid: __ct__7istreamFP9streambuf" "istream::istream(streambuf *)"
    test_demangling_exact "lucid: __ct__7istreamFP9streambufiP7ostream" "istream::istream(streambuf *, int, ostream *)"
    test_demangling_exact "lucid: __ct__7istreamFiPcT1" "istream::istream(int, char *, int)"
    test_demangling_exact "lucid: __ct__7istreamFiT1P7ostream" "istream::istream(int, int, ostream *)"
    test_demangling_exact "lucid: __ct__7ostreamFP9streambuf" "ostream::ostream(streambuf *)"
    test_demangling_exact "lucid: __ct__7ostreamFiPc" "ostream::ostream(int, char *)"
    test_demangling "lucid: __ct__8ifstreamFPCciT2" \
	"ifstream::ifstream\[(\]+(const char|char const) \[*\]+, int, int\[)\]+"
    test_demangling_exact "lucid: __ct__8ifstreamFiPcT1" "ifstream::ifstream(int, char *, int)"

    test_demangling_exact "lucid: __ct__Q23foo3barFv" "foo::bar::bar(void)"
    test_demangling_exact "lucid: __ct__Q33foo3bar4bellFv" "foo::bar::bell::bell(void)"
    test_demangling_exact "lucid: __dl__3fooSFPv" "foo::operator delete(void *) static"
    test_demangling_exact "lucid: __dl__FPv" "operator delete(void *)"
    test_demangling_exact "lucid: __dt__10istrstreamFv" "istrstream::~istrstream(void)"

    test_demangling_exact "lucid: __dt__Q23foo3barFv" "foo::bar::~bar(void)"
    test_demangling_exact "lucid: __dt__Q33foo3bar4bellFv" "foo::bar::bell::~bell(void)"
    test_demangling_exact "lucid: __dv__3fooFR3foo" "foo::operator/(foo &)"
    test_demangling_exact "lucid: __dv__F7complexT1" "operator/(complex, complex)"
    test_demangling_exact "lucid: __eq__3fooFR3foo" "foo::operator==(foo &)"
    test_demangling_exact "lucid: __er__3fooFR3foo" "foo::operator^(foo &)"
    test_demangling_exact "lucid: __ge__3fooFR3foo" "foo::operator>=(foo &)"
    test_demangling_exact "lucid: __gt__3fooFR3foo" "foo::operator>(foo &)"
    test_demangling_exact "lucid: __le__3fooFR3foo" "foo::operator<=(foo &)"
    test_demangling_exact "lucid: __ls__3fooFR3foo" "foo::operator<<(foo &)"
    test_demangling_exact "lucid: __ls__7ostreamFP9streambuf" "ostream::operator<<(streambuf *)"

    test_demangling "lucid: __ls__7ostreamFPCc" \
	"ostream::operator<<\[(\]+(const char|char const) \[*\]+\[)\]+"
    test_demangling_exact "lucid: __ls__7ostreamFPFR3ios_R3ios" "ostream::operator<<(ios &(*)(ios &))"
    test_demangling_exact "lucid: __ls__7ostreamFPv" "ostream::operator<<(void *)"
    test_demangling_exact "lucid: __ls__7ostreamFUi" "ostream::operator<<(unsigned int)"
    test_demangling_exact "lucid: __ls__7ostreamFUl" "ostream::operator<<(unsigned long)"
    test_demangling_exact "lucid: __ls__7ostreamFd" "ostream::operator<<(double)"
    test_demangling_exact "lucid: __ls__7ostreamFf" "ostream::operator<<(float)"
    test_demangling_exact "lucid: __ls__7ostreamFi" "ostream::operator<<(int)"
    test_demangling_exact "lucid: __ls__7ostreamFl" "ostream::operator<<(long)"
    test_demangling_exact "lucid: __ls__FR7ostream7complex" "operator<<(ostream &, complex)"
    test_demangling_exact "lucid: __lt__3fooFR3foo" "foo::operator<(foo &)"
    test_demangling_exact "lucid: __md__3fooFR3foo" "foo::operator%(foo &)"
    test_demangling_exact "lucid: __mi__3fooFR3foo" "foo::operator-(foo &)"
    test_demangling_exact "lucid: __ml__3fooFR3foo" "foo::operator*(foo &)"
    test_demangling_exact "lucid: __ml__F7complexT1" "operator*(complex, complex)"
    test_demangling_exact "lucid: __mm__3fooFi" "foo::operator--(int)"
    test_demangling_exact "lucid: __ne__3fooFR3foo" "foo::operator!=(foo &)"
    test_demangling_exact "lucid: __nt__3fooFv" "foo::operator!(void)"
    test_demangling_exact "lucid: __nw__3fooSFi" "foo::operator new(int) static"
    test_demangling_exact "lucid: __nw__FUi" "operator new(unsigned int)"
    test_demangling_exact "lucid: __nw__FUiPv" "operator new(unsigned int, void *)"
    test_demangling_exact "lucid: __oo__3fooFR3foo" "foo::operator||(foo &)"
    test_demangling_exact "lucid: __opPc__3fooFv" "foo::operator char *(void)"
    test_demangling_exact "lucid: __opi__3fooFv" "foo::operator int(void)"
    test_demangling_exact "lucid: __or__3fooFR3foo" "foo::operator|(foo &)"

    test_demangling_exact "lucid: __pl__3fooFR3foo" "foo::operator+(foo &)"
    test_demangling_exact "lucid: __pp__3fooFi" "foo::operator++(int)"
    test_demangling_exact "lucid: __pt__3fooFv" "foo::operator->(void)"
    test_demangling_exact "lucid: __rm__3fooFR3foo" "foo::operator->*(foo &)"
    test_demangling_exact "lucid: __rs__3fooFR3foo" "foo::operator>>(foo &)"
    test_demangling_exact "lucid: __rs__7istreamFP9streambuf" "istream::operator>>(streambuf *)"
    test_demangling_exact "lucid: __rs__7istreamFPFR3ios_R3ios" "istream::operator>>(ios &(*)(ios &))"
    test_demangling_exact "lucid: __rs__7istreamFPFR7istream_R7istream" "istream::operator>>(istream &(*)(istream &))"
    test_demangling_exact "lucid: __rs__7istreamFPUc" "istream::operator>>(unsigned char *)"
    test_demangling_exact "lucid: __rs__7istreamFPc" "istream::operator>>(char *)"
    test_demangling_exact "lucid: __rs__7istreamFRUi" "istream::operator>>(unsigned int &)"
    test_demangling_exact "lucid: __rs__7istreamFRUl" "istream::operator>>(unsigned long &)"
    test_demangling_exact "lucid: __rs__7istreamFRUs" "istream::operator>>(unsigned short &)"
    test_demangling_exact "lucid: __rs__7istreamFRd" "istream::operator>>(double &)"
    test_demangling_exact "lucid: __rs__7istreamFRf" "istream::operator>>(float &)"
    test_demangling_exact "lucid: __rs__7istreamFRi" "istream::operator>>(int &)"
    test_demangling_exact "lucid: __rs__7istreamFRl" "istream::operator>>(long &)"
    test_demangling_exact "lucid: __rs__7istreamFRs" "istream::operator>>(short &)"
    test_demangling_exact "lucid: __rs__FR7istreamR7complex" "operator>>(istream &, complex &)"
    test_demangling "lucid: __vc__3fooFR3foo" "foo::operator\\\[\\\]\\(foo &\\)"
    test_demangling_exact "lucid: __vtbl__10istrstream" "istrstream virtual table"
    test_demangling_exact "lucid: __vtbl__17ostream__iostream__19iostream_withassign" "iostream_withassign::ostream__iostream virtual table"

    test_demangling_exact "lucid: __vtbl__3ios" "ios virtual table"
    test_demangling_exact "lucid: __vtbl__3ios__13strstreambase" "strstreambase::ios virtual table"

    # GDB 930414 demangles this as t_cc_main_ (obviously wrong).
    # GDB 930701 gets into an infinite loop.
    # GDB 930727 says "Can't demangle".
    # What is the correct demangling?  FIXME.

    # NOTE: carlton/2003-01-17: No, don't FIXME, just obsolete lucid.
    # I'm KFAILing this rather than deleting it for form's sake.
    setup_kfail "gdb/945" "*-*-*"
    test_demangling_exact "lucid: __vtbl__3foo__vt_cc_main_" ""

    test_demangling_exact "lucid: abs__F7complex" "abs(complex)"
    test_demangling_exact "lucid: allocate__9streambufFv" "streambuf::allocate(void)"
    test_demangling_exact "lucid: attach__11fstreambaseFi" "fstreambase::attach(int)"
    test_demangling_exact "lucid: bitalloc__3iosSFv" "ios::bitalloc(void) static"
    test_demangling_exact "lucid: chr__FiT1" "chr(int, int)"
    test_demangling_exact "lucid: complex_error__FR11c_exception" "complex_error(c_exception &)"
    test_demangling_exact "lucid: complexfunc2__FPFPc_i" "complexfunc2(int (*)(char *))"
    test_demangling_exact "lucid: complexfunc3__FPFPFPl_s_i" "complexfunc3(int (*)(short (*)(long *)))"

    test_demangling_exact "lucid: complexfunc4__FPFPFPc_s_i" "complexfunc4(int (*)(short (*)(char *)))"
    test_demangling_exact "lucid: complexfunc5__FPFPc_PFl_i" "complexfunc5(int (*(*)(char *))(long))"
    test_demangling_exact "lucid: complexfunc6__FPFPi_PFl_i" "complexfunc6(int (*(*)(int *))(long))"
    test_demangling_exact "lucid: complexfunc7__FPFPFPc_i_PFl_i" "complexfunc7(int (*(*)(int (*)(char *)))(long))"
    test_demangling_exact "lucid: complicated_put__7ostreamFc" "ostream::complicated_put(char)"
    test_demangling_exact "lucid: conv10__FlPc" "conv10(long, char *)"
    test_demangling_exact "lucid: conv16__FUlPc" "conv16(unsigned long, char *)"
    test_demangling_exact "lucid: dec__FR3ios" "dec(ios &)"
    test_demangling_exact "lucid: dec__Fli" "dec(long, int)"
    test_demangling_exact "lucid: dofield__FP7ostreamPciT2T3" "dofield(ostream *, char *, int, char *, int)"

    test_demangling_exact "lucid: flags__3iosFl" "ios::flags(long)"
    test_demangling_exact "lucid: flags__3iosFv" "ios::flags(void)"
    test_demangling_exact "lucid: foo__FiN31" "foo(int, int, int, int)"
    test_demangling_exact "lucid: foo__FiR3fooT1T2T1T2" "foo(int, foo &, int, foo &, int, foo &)"
    test_demangling_exact "lucid: foo___3barFl" "bar::foo_(long)"
    test_demangling "lucid: form__FPCce" "form\[(\]+(const char|char const) \[*\]+,...\[)\]+"
    test_demangling_exact "lucid: get__7istreamFPcic" "istream::get(char *, int, char)"
    test_demangling_exact "lucid: get__7istreamFR9streambufc" "istream::get(streambuf &, char)"
    test_demangling_exact "lucid: get_complicated__7istreamFRUc" "istream::get_complicated(unsigned char &)"
    test_demangling_exact "lucid: get_complicated__7istreamFRc" "istream::get_complicated(char &)"
    test_demangling_exact "lucid: getline__7istreamFPUcic" "istream::getline(unsigned char *, int, char)"
    test_demangling_exact "lucid: getline__7istreamFPcic" "istream::getline(char *, int, char)"

    test_demangling_exact "lucid: ignore__7istreamFiT1" "istream::ignore(int, int)"
    test_demangling_exact "lucid: init__12strstreambufFPciT1" "strstreambuf::init(char *, int, char *)"
    test_demangling_exact "lucid: init__3iosFP9streambuf" "ios::init(streambuf *)"
    test_demangling_exact "lucid: initcount__13Iostream_init" "Iostream_init::initcount"
    test_demangling_exact "lucid: ipfx__7istreamFi" "istream::ipfx(int)"
    test_demangling_exact "lucid: ls_complicated__7ostreamFUc" "ostream::ls_complicated(unsigned char)"
    test_demangling_exact "lucid: ls_complicated__7ostreamFc" "ostream::ls_complicated(char)"
    test_demangling "lucid: open__11fstreambaseFPCciT2" \
	"fstreambase::open\[(\]+(const char|char const) \[*\]+, int, int\[)\]+"
    test_demangling "lucid: open__7filebufFPCciT2" \
	"filebuf::open\[(\]+(const char|char const) \[*\]+, int, int\[)\]+"

    test_demangling_exact "lucid: overload1arg__FSc" "overload1arg(signed char)"
    test_demangling_exact "lucid: overload1arg__FUc" "overload1arg(unsigned char)"
    test_demangling_exact "lucid: overload1arg__FUi" "overload1arg(unsigned int)"
    test_demangling_exact "lucid: overload1arg__FUl" "overload1arg(unsigned long)"
    test_demangling_exact "lucid: overload1arg__FUs" "overload1arg(unsigned short)"
    test_demangling_exact "lucid: overload1arg__Fc" "overload1arg(char)"
    test_demangling_exact "lucid: overload1arg__Fd" "overload1arg(double)"
    test_demangling_exact "lucid: overload1arg__Ff" "overload1arg(float)"
    test_demangling_exact "lucid: overload1arg__Fi" "overload1arg(int)"
    test_demangling_exact "lucid: overload1arg__Fl" "overload1arg(long)"
    test_demangling_exact "lucid: overload1arg__Fs" "overload1arg(short)"
    test_demangling_exact "lucid: overload1arg__Fv" "overload1arg(void)"
    test_demangling_exact "lucid: overloadargs__FiN21" "overloadargs(int, int, int)"
    test_demangling_exact "lucid: overloadargs__FiN31" "overloadargs(int, int, int, int)"
    test_demangling_exact "lucid: overloadargs__FiN41" "overloadargs(int, int, int, int, int)"
    test_demangling_exact "lucid: overloadargs__FiN51" "overloadargs(int, int, int, int, int, int)"
    test_demangling_exact "lucid: overloadargs__FiN61" "overloadargs(int, int, int, int, int, int, int)"

    test_demangling_exact "lucid: overloadargs__FiN71" "overloadargs(int, int, int, int, int, int, int, int)"
    test_demangling_exact "lucid: overloadargs__FiN81" "overloadargs(int, int, int, int, int, int, int, int, int)"
    test_demangling_exact "lucid: overloadargs__FiN91" "overloadargs(int, int, int, int, int, int, int, int, int, int)"
    test_demangling_exact "lucid: overloadargs__FiN91N11" "overloadargs(int, int, int, int, int, int, int, int, int, int, int)"
    test_demangling_exact "lucid: overloadargs__FiT1" "overloadargs(int, int)"
    test_demangling_exact "lucid: polar__FdT1" "polar(double, double)"
    test_demangling_exact "lucid: pow__F7complexT1" "pow(complex, complex)"
    test_demangling_exact "lucid: pow__F7complexd" "pow(complex, double)"
    test_demangling_exact "lucid: pow__F7complexi" "pow(complex, int)"
    test_demangling_exact "lucid: pow__Fd7complex" "pow(double, complex)"
    test_demangling_exact "lucid: pstart__FPciT2" "pstart(char *, int, int)"
    test_demangling_exact "lucid: put__7ostreamFc" "ostream::put(char)"

    test_demangling_exact "lucid: read__7istreamFPci" "istream::read(char *, int)"
    test_demangling_exact "lucid: resetiosflags__FR3iosl" "resetiosflags(ios &, long)"
    test_demangling_exact "lucid: restore_errno__FRi" "restore_errno(int &)"
    test_demangling_exact "lucid: rs_complicated__7istreamFRUc" "istream::rs_complicated(unsigned char &)"
    test_demangling_exact "lucid: rs_complicated__7istreamFRc" "istream::rs_complicated(char &)"
    test_demangling_exact "lucid: seekg__7istreamFl8seek_dir" "istream::seekg(long, seek_dir)"
    test_demangling_exact "lucid: seekoff__12strstreambufFl8seek_diri" "strstreambuf::seekoff(long, seek_dir, int)"
    test_demangling_exact "lucid: seekoff__9streambufFlQ2_3ios12ios_seek_diri" "streambuf::seekoff(long, ios::ios_seek_dir, int)"
    test_demangling_exact "lucid: seekpos__9streambufFli" "streambuf::seekpos(long, int)"
    test_demangling_exact "lucid: set_new_handler__FPFv_v" "set_new_handler(void (*)(void))"
    test_demangling_exact "lucid: setb__9streambufFPcT1i" "streambuf::setb(char *, char *, int)"

    test_demangling_exact "lucid: setb__FR3iosi" "setb(ios &, int)"
    test_demangling_exact "lucid: setbuf__11fstreambaseFPci" "fstreambase::setbuf(char *, int)"
    test_demangling_exact "lucid: setbuf__9streambufFPUci" "streambuf::setbuf(unsigned char *, int)"
    test_demangling_exact "lucid: setbuf__9streambufFPciT2" "streambuf::setbuf(char *, int, int)"
    test_demangling_exact "lucid: setf__3iosFlT1" "ios::setf(long, long)"
    test_demangling_exact "lucid: setfill__FR3iosi" "setfill(ios &, int)"
    test_demangling_exact "lucid: setg__9streambufFPcN21" "streambuf::setg(char *, char *, char *)"
    test_demangling_exact "lucid: setp__9streambufFPcT1" "streambuf::setp(char *, char *)"

    test_demangling "lucid: sputn__9streambufFPCci" \
	"streambuf::sputn\[(\]+(const char|char const) \[*\]+, int\[)\]+"
    test_demangling "lucid: str__FPCci" \
	"str\[(\]+(const char|char const) \[*\]+, int\[)\]+"
    test_demangling_exact "lucid: tie__3iosFP7ostream" "ios::tie(ostream *)"
    test_demangling_exact "lucid: uconv10__FUlPc" "uconv10(unsigned long, char *)"

    test_demangling "lucid: write__7ostreamFPCci" \
	"ostream::write\[(\]+(const char|char const) \[*\]+, int\[)\]+"
    test_demangling_exact "lucid: xget__7istreamFPc" "istream::xget(char *)"
    test_demangling_exact "lucid: xsgetn__9streambufFPci" "streambuf::xsgetn(char *, int)"
    test_demangling "lucid: xsputn__9streambufFPCci" \
	"streambuf::xsputn\[(\]+(const char|char const) \[*\]+, int\[)\]+"

    test_demangling_exact "lucid: _Utf390_1__1_9223372036854775807__9223372036854775" \
	    "Can't demangle \"_Utf390_1__1_9223372036854775807__9223372036854775\""
}

#
#  Test arm style name demangling
#

proc test_arm_style_demangling {} {
    test_demangling_exact "arm: __dt__21T5__pt__11_PFiPPdPv_iFv" "T5<int (*)(int, double **, void *)>::~T5(void)"

    test_demangling_exact "arm: __ct__1cFi" "c::c(int)"

    test_demangling_exact "arm: __dt__11T5__pt__2_iFv" "T5<int>::~T5(void)"

    test_demangling_exact "arm: __dt__11T5__pt__2_cFv" "T5<char>::~T5(void)"

    test_demangling_exact "arm: __ct__2T2Fi" "T2::T2(int)"
    test_demangling_exact "arm: __dt__2T1Fv" "T1::~T1(void)"

    test_demangling_exact "arm: __dt__12T5__pt__3_1xFv" "T5<x>::~T5(void)"

    test_demangling_exact "arm: __dt__17T5__pt__8_PFcPv_iFv" "T5<int (*)(char, void *)>::~T5(void)"

    test_demangling "arm: g__FP1cPC1cT1" \
	"g\[(\]+c *\[*\]+, (const c|c const) *\[*\]+, c *\[*\]+\[)\]+"
    test_demangling "arm: g__FPUlPCUlT1" \
	"g\[(\]+unsigned long \[*\]+, (const unsigned long|unsigned long const) \[*\]+, unsigned long \[*\]+\[)\]+"
    test_demangling "arm: g__FPUiPCUiT1" \
	"g\[(\]+unsigned int \[*\]+, (const unsigned int|unsigned int const) \[*\]+, unsigned int \[*\]+\[)\]+"
    test_demangling "arm: g__FPUsPCUsT1" \
	"g\[(\]+unsigned short \[*\]+, (const unsigned short|unsigned short const) \[*\]+, unsigned short \[*\]+\[)\]+"
    test_demangling "arm: g__FPUcPCUcT1" \
	"g\[(\]+unsigned char \[*\]+, (const unsigned char|unsigned char const) \[*\]+, unsigned char \[*\]+\[)\]+"
    test_demangling "arm: g__F1TPlPClT2" \
	"g\[(\]+T, long \[*\]+, (const long|long const) \[*\]+, long \[*\]+\[)\]+"
    test_demangling "arm: g__F1RRlRClT2" \
	"g\[(\]+R, long &, (const long|long const) &, long &\[)\]+"
    test_demangling "arm: g__F1TPiPCiT2" \
	"g\[(\]+T, int \[*\]+, (const int|int const) \[*\]+, int \[*\]+\[)\]+"
    test_demangling "arm: g__F1RRiRCiT2" \
	"g\[(\]+R, int &, (const int|int const) &, int &\[)\]+"
    test_demangling "arm: g__F1TPsPCsT2" \
	"g\[(\]+T, short \[*\]+, (const short|short const) \[*\]+, short \[*\]+\[)\]+"
    test_demangling "arm: g__F1RRsRCsT2" \
	"g\[(\]+R, short &, (const short|short const) &, short &\[)\]+"
    test_demangling "arm: g__F1TPcPCcT2" \
	"g\[(\]+T, char \[*\]+, (const char|char const) \[*\]+, char \[*\]+\[)\]+"
    test_demangling "arm: g__F1RRcRCcT2" \
	"g\[(\]+R, char &, (const char|char const) &, char &\[)\]+"

    test_demangling_exact "arm: __ct__21T5__pt__11_PFiPPdPv_iFi" "T5<int (*)(int, double **, void *)>::T5(int)"

    test_demangling "arm: __gt__FRC2T2c" \
	"operator>\[(\]+(const T2|T2 const) &, char\[)\]+"
    test_demangling "arm: __ge__FRC2T2c" \
	"operator>=\[(\]+(const T2|T2 const) &, char\[)\]+"
    test_demangling "arm: __lt__FRC2T2c" \
	"operator<\[(\]+(const T2|T2 const) &, char\[)\]+"

    test_demangling "arm: __le__FRC2T2c" \
	"operator<=\[(\]+(const T2|T2 const) &, char\[)\]+"
    test_demangling "arm: __ne__FRC2T2c" \
	"operator!=\[(\]+(const T2|T2 const) &, char\[)\]+"
    test_demangling "arm: __eq__FRC2T2c" \
	"operator==\[(\]+(const T2|T2 const) &, char\[)\]+"
    test_demangling_exact "arm: __amd__FR2T2i" "operator%=(T2 &, int)"
    test_demangling_exact "arm: __adv__FR2T2i" "operator/=(T2 &, int)"
    test_demangling_exact "arm: __amu__FR2T2i" "operator*=(T2 &, int)"
    test_demangling_exact "arm: __ami__FR2T2i" "operator-=(T2 &, int)"
    test_demangling_exact "arm: __apl__FR2T2i" "operator+=(T2 &, int)"
    test_demangling_exact "arm: __nw__2T1SFUi" "T1::operator new(unsigned int) static"
    test_demangling_exact "arm: __dl__2T1SFPv" "T1::operator delete(void *) static"
    test_demangling_exact "arm: put__2T7SFi" "T7::put(int) static"

    test_demangling_exact "arm: __dl__12T5__pt__3_1xSFPv" "T5<x>::operator delete(void *) static"

    test_demangling_exact "arm: h__FUc" "h(unsigned char)"
    test_demangling_exact "arm: f__Fic" "f(int, char)"
    test_demangling_exact "arm: h__FUi" "h(unsigned int)"
    test_demangling_exact "arm: h__Fci" "h(char, int)"
    test_demangling_exact "arm: h__FUl" "h(unsigned long)"
    test_demangling_exact "arm: h__Fcl" "h(char, long)"
    test_demangling_exact "arm: h__FUs" "h(unsigned short)"
    test_demangling_exact "arm: h__Fcs" "h(char, short)"
    test_demangling "arm: __amd__FR2T2RC2T2" \
	"operator%=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"
    test_demangling "arm: __adv__FR2T2RC2T2" \
	"operator/=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"
    test_demangling "arm: __amu__FR2T2RC2T2" \
	"operator\[*\]+=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"
    test_demangling "arm: __ami__FR2T2RC2T2" \
	"operator-=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"
    test_demangling "arm: __apl__FR2T2RC2T2" \
	"operator\[+\]+=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"

    test_demangling "arm: g__F1SRPUlRPCUlT2" \
	"g\[(\]+S, unsigned long \[*\]+&, (const unsigned long|unsigned long const) \[*\]+&, unsigned long \[*\]+&\[)\]+"
    test_demangling "arm: g__F1SRPUiRPCUiT2" \
	"g\[(\]+S, unsigned int \[*\]+&, (const unsigned int|unsigned int const) \[*\]+&, unsigned int \[*\]+&\[)\]+"
    test_demangling "arm: g__F1SRPUsRPCUsT2" \
	"g\[(\]+S, unsigned short \[*\]+&, (const unsigned short|unsigned short const) \[*\]+&, unsigned short \[*\]+&\[)\]+"
    test_demangling "arm: g__F1SRPUcRPCUcT2" \
	"g\[(\]+S, unsigned char \[*\]+&, (const unsigned char|unsigned char const) \[*\]+&, unsigned char \[*\]+&\[)\]+"
    test_demangling "arm: g__F1T1SRPlRPClT3" \
	"g\[(\]+T, S, long \[*\]+&, (const long|long const) \[*\]+&, long \[*\]+&\[)\]+"
    test_demangling "arm: g__F1T1SRPiRPCiT3" \
	"g\[(\]+T, S, int \[*\]+&, (const int|int const) \[*\]+&, int \[*\]+&\[)\]+"
    test_demangling "arm: g__F1T1SRPcRPCcT3" \
	"g\[(\]+T, S, char \[*\]+&, (const char|char const) \[*\]+&, char \[*\]+&\[)\]+"

    test_demangling_exact "arm: X__12T5__pt__3_1x" "T5<x>::X"

    test_demangling_exact "arm: __ct__11T5__pt__2_iFi" "T5<int>::T5(int)"

    test_demangling_exact "arm: __ct__11T5__pt__2_cFi" "T5<char>::T5(int)"

    test_demangling "arm: __gt__FRC2T2T1" \
	"operator>\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
    test_demangling "arm: __ge__FRC2T2T1" \
	"operator>=\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
    test_demangling "arm: __lt__FRC2T2T1" \
	"operator<\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
    test_demangling "arm: __le__FRC2T2T1" \
	"operator<=\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
    test_demangling "arm: __ne__FRC2T2T1" \
	"operator!=\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
    test_demangling "arm: __eq__FRC2T2T1" \
	"operator==\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
    test_demangling "arm: g__FcR1cRC1cT2" \
	"g\[(\]+char, c &, (const c|c const) &, c &\[)\]+"
    test_demangling "arm: g__FcRPdRPCdT2" \
	"g\[(\]+char, double *\[*\]+&, (const double|double const) *\[*\]+&, double *\[*\]+&\[)\]+"
    test_demangling "arm: g__FcRPfRPCfT2" \
	"g\[(\]+char, float *\[*\]+&, (const float|float const) *\[*\]+&, float *\[*\]+&\[)\]+"
    test_demangling_exact "arm: h__FcT1" "h(char, char)"
    test_demangling_exact "arm: f__Ficd" "f(int, char, double)"
    test_demangling "arm: g__F1T1SdRPsRPCsT4" \
	"g\[(\]+T, S, double, short \[*\]+&, (const short|short const) \[*\]+&, short \[*\]+&\[)\]+"
    test_demangling "arm: g__F1cC1cT1" \
	"g\[(\]+c, (const c|c const), c\[)\]+"
    test_demangling "arm: g__FPdPCdT1" \
	"g\[(\]+double *\[*\]+, (const double|double const) *\[*\]+, double *\[*\]+\[)\]+"
    test_demangling "arm: g__FPfPCfT1" \
	"g\[(\]+float *\[*\]+, (const float|float const) *\[*\]+, float *\[*\]+\[)\]+"

    test_demangling "arm: g__FUlCUlT1" \
	"g\[(\]+unsigned long, (const unsigned long|unsigned long const), unsigned long\[)\]+"
    test_demangling "arm: g__FPlPClT1" \
	"g\[(\]+long \[*\]+, (const long|long const) \[*\]+, long \[*\]+\[)\]+"
    test_demangling "arm: g__FUiCUiT1" \
	"g\[(\]+unsigned int, (const unsigned int|unsigned int const), unsigned int\[)\]+"
    test_demangling "arm: g__FPiPCiT1" \
	"g\[(\]+int \[*\]+, (const int|int const) \[*\]+, int \[*\]+\[)\]+"
    test_demangling "arm: g__FUsCUsT1" \
	"g\[(\]+unsigned short, (const unsigned short|unsigned short const), unsigned short\[)\]+"
    test_demangling "arm: g__FPsPCsT1" \
	"g\[(\]+short \[*\]+, (const short|short const) \[*\]+, short \[*\]+\[)\]+"
    test_demangling "arm: g__FUcCUcT1" \
	"g\[(\]+unsigned char, (const unsigned char|unsigned char const), unsigned char\[)\]+"
    test_demangling "arm: g__FPcPCcT1" \
	"g\[(\]+char \[*\]+, (const char|char const) \[*\]+, char \[*\]+\[)\]+"
    test_demangling "arm: g__F1TlClT2" \
	"g\[(\]+T, long, (const long|long const), long\[)\]+"
    test_demangling "arm: g__F1TiCiT2" \
	"g\[(\]+T, int, (const int|int const), int\[)\]+"
    test_demangling "arm: g__F1TsCsT2" \
	"g\[(\]+T, short, (const short|short const), short\[)\]+"
    test_demangling "arm: g__F1TcCcT2" \
	"g\[(\]+T, char, (const char|char const), char\[)\]+"

    test_demangling_exact "arm: __dl__17T5__pt__8_PFcPv_iSFPv" "T5<int (*)(char, void *)>::operator delete(void *) static"

    test_demangling "arm: printf__FPCce" \
	"printf\[(\]+(const char|char const) \[*\]+,...\[)\]+"

    test_demangling_exact "arm: X__17T5__pt__8_PFcPv_i" "T5<int (*)(char, void *)>::X"

    test_demangling_exact "arm: __ct__12T5__pt__3_1xFi" "T5<x>::T5(int)"

    test_demangling "arm: g__F1SRUlRCUlT2" \
	"g\[(\]+S, unsigned long &, (const unsigned long|unsigned long const) &, unsigned long &\[)\]+"
    test_demangling "arm: g__F1SRPlRPClT2" \
	"g\[(\]+S, long \[*\]+&, (const long|long const) \[*\]+&, long \[*\]+&\[)\]+"
    test_demangling "arm: g__F1RRUiRCUiT2" \
	"g\[(\]+R, unsigned int &, (const unsigned int|unsigned int const) &, unsigned int &\[)\]+"
    test_demangling "arm: g__F1SRPiRPCiT2" \
	"g\[(\]+S, int \[*\]+&, (const int|int const) \[*\]+&, int \[*\]+&\[)\]+"
    test_demangling "arm: g__F1RRUsRCUsT2" \
	"g\[(\]+R, unsigned short &, (const unsigned short|unsigned short const) &, unsigned short &\[)\]+"
    test_demangling "arm: g__F1SRPsRPCsT2" \
	"g\[(\]+S, short \[*\]+&, (const short|short const) \[*\]+&, short \[*\]+&\[)\]+"
    test_demangling "arm: g__F1RRUcRCUcT2" \
	"g\[(\]+R, unsigned char &, (const unsigned char|unsigned char const) &, unsigned char &\[)\]+"
    test_demangling "arm: g__F1SRPcRPCcT2" \
	"g\[(\]+S, char \[*\]+&, (const char|char const) \[*\]+&, char \[*\]+&\[)\]+"
    test_demangling "arm: g__F1T1RRlRClT3" \
	"g\[(\]+T, R, long &, (const long|long const) &, long &\[)\]+"
    test_demangling "arm: g__F1T1RRiRCiT3" \
	"g\[(\]+T, R, int &, (const int|int const) &, int &\[)\]+"
    test_demangling "arm: g__F1T1RRsRCsT3" \
	"g\[(\]+T, R, short &, (const short|short const) &, short &\[)\]+"
    test_demangling "arm: g__F1T1RRcRCcT3" \
	"g\[(\]+T, R, char &, (const char|char const) &, char &\[)\]+"

    test_demangling_exact "arm: __dl__21T5__pt__11_PFiPPdPv_iSFPv" "T5<int (*)(int, double **, void *)>::operator delete(void *) static"

    test_demangling_exact "arm: __std__foo" "global destructors keyed to foo"

    test_demangling_exact "arm: __sti__bar" "global constructors keyed to bar"

    test_demangling_exact "arm: f__FicdPcPFci_v" "f(int, char, double, char *, void (*)(char, int))"
    test_demangling_exact "arm: f__FicdPcPFic_v" "f(int, char, double, char *, void (*)(int, char))"
    test_demangling_exact "arm: get__2T7SFv" "T7::get(void) static"

    test_demangling_exact "arm: X__21T5__pt__11_PFiPPdPv_i" "T5<int (*)(int, double **, void *)>::X"

    test_demangling "arm: g__FcRdRCdT2" \
	"g\[(\]+char, double &, (const double|double const) &, double &\[)\]+"
    test_demangling "arm: g__FcRfRCfT2" \
	"g\[(\]+char, float &, (const float|float const) &, float &\[)\]+"
    test_demangling "arm: __md__FC2T2i" \
	"operator%\[(\]+(const T2|T2 const), int\[)\]+"
    test_demangling "arm: __dv__FC2T2i" \
	"operator/\[(\]+(const T2|T2 const), int\[)\]+"
    test_demangling "arm: __ml__FC2T2i" \
	"operator\[*\]+\[(\]+(const T2|T2 const), int\[)\]+"
    test_demangling "arm: __mi__FC2T2i" \
	"operator-\[(\]+(const T2|T2 const), int\[)\]+"
    test_demangling "arm: __pl__FC2T2i" \
	"operator\[+\]+\[(\]+(const T2|T2 const), int\[)\]+"

    test_demangling_exact "arm: __dl__11T5__pt__2_iSFPv" "T5<int>::operator delete(void *) static"

    test_demangling_exact "arm: __dl__11T5__pt__2_cSFPv" "T5<char>::operator delete(void *) static"

    test_demangling_exact "arm: h__Fc" "h(char)"
    test_demangling_exact "arm: h__Fd" "h(double)"
    test_demangling_exact "arm: h__Ff" "h(float)"
    test_demangling_exact "arm: h__Fi" "h(int)"
    test_demangling_exact "arm: f__Fi" "f(int)"
    test_demangling_exact "arm: h__Fl" "h(long)"

    test_demangling_exact "arm: h__Fs" "h(short)"
    test_demangling "arm: __md__FC2T2RC2T2" \
	"operator%\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
    test_demangling "arm: __dv__FC2T2RC2T2" \
	"operator/\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
    test_demangling "arm: __ml__FC2T2RC2T2" \
	"operator\[*\]+\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
    test_demangling "arm: __mi__FC2T2RC2T2" \
	"operator-\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
    test_demangling "arm: __pl__FC2T2RC2T2" \
	"operator\[+\]+\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
    test_demangling "arm: g__FcRP1cRPC1cT2" \
	"g\[(\]+char, c *\[*\]+&, (const c|c const) *\[*\]+&, c *\[*\]+&\[)\]+"

    test_demangling_exact "arm: X__11T5__pt__2_c" "T5<char>::X"

    test_demangling_exact "arm: X__11T5__pt__2_i" "T5<int>::X"

    test_demangling "arm: g__FdCdT1" \
	"g\[(\]+double, (const double|double const), double\[)\]+"
    test_demangling "arm: g__FfCfT1" \
	"g\[(\]+float, (const float|float const), float\[)\]+"
    test_demangling "arm: g__FlClT1" \
	"g\[(\]+long, (const long|long const), long\[)\]+"
    test_demangling "arm: g__FiCiT1" \
	"g\[(\]+int, (const int|int const), int\[)\]+"
    test_demangling "arm: g__FsCsT1" \
	"g\[(\]+short, (const short|short const), short\[)\]+"
    test_demangling "arm: g__FcCcT1" \
	"g\[(\]+char, (const char|char const), char\[)\]+"

    test_demangling_exact "arm: __ct__17T5__pt__8_PFcPv_iFi" "T5<int (*)(char, void *)>::T5(int)"

    test_demangling_exact "arm: f__FicdPc" "f(int, char, double, char *)"
    test_demangling_exact "arm: __nw__FUi" "operator new(unsigned int)"
    test_demangling_exact "arm: __ct__Q3_2T11a1bSFi" "T1::a::b::b(int) static"
    test_demangling_exact "arm: __dt__Q3_2T11a1bSFi" "T1::a::b::~b(int) static"
    test_demangling_exact "arm: put__Q3_2T11a1bSFi" "T1::a::b::put(int) static"
    test_demangling_exact "arm: get__Q2_2T11aSFv" "T1::a::get(void) static"
    test_demangling_exact "arm: put__2T1SFi" "T1::put(int) static"
    test_demangling_exact "arm: put__Q5_2T11a1b1c1dSFi" "T1::a::b::c::d::put(int) static"
    test_demangling_exact "arm: get__Q4_2T11a1b1cSFv" "T1::a::b::c::get(void) static"
    test_demangling_exact "arm: put__Q2_2T11aSFi" "T1::a::put(int) static"
    test_demangling_exact "arm: put__Q4_2T11a1b1cSFi" "T1::a::b::c::put(int) static"
    test_demangling_exact "arm: get__Q3_2T11a1bSFv" "T1::a::b::get(void) static"
    test_demangling_exact "arm: get__2T1SFv" "T1::get(void) static"
    test_demangling_exact "arm: get__Q5_2T11a1b1c1dSFv" "T1::a::b::c::d::get(void) static"

    test_demangling_exact "arm: __dt__11T1__pt__2_cFv" "T1<char>::~T1(void)"

    test_demangling_exact "arm: __dt__12T1__pt__3_1tFv" "T1<t>::~T1(void)"

    test_demangling_exact "arm: __dl__12T1__pt__3_1tSFPv" "T1<t>::operator delete(void *) static"

    test_demangling_exact "arm: __ct__11T1__pt__2_cFi" "T1<char>::T1(int)"

    test_demangling_exact "arm: __ct__11T1__pt__2_cFv" "T1<char>::T1(void)"

    test_demangling_exact "arm: __ct__12T1__pt__3_1tFi" "T1<t>::T1(int)"

    test_demangling_exact "arm: __ct__12T1__pt__3_1tFv" "T1<t>::T1(void)"

    test_demangling_exact "arm: __dl__11T1__pt__2_cSFPv" "T1<char>::operator delete(void *) static"

    test_demangling_exact "arm: bar__3fooFPv"       "foo::bar(void *)"
    test_demangling "arm: bar__3fooFPCv" \
	     "foo::bar\[(\]+(const void|void const) *\[*\]+\[)\]+"
    test_demangling_exact "arm: bar__3fooCFPv"      "foo::bar(void *) const"
    test_demangling "arm: bar__3fooCFPCv" \
	    "foo::bar\[(\]+(const void|void const) *\[*\]+\[)\]+ const"
    test_demangling_exact "arm: __eq__3fooFR3foo"   "foo::operator==(foo &)"
    test_demangling "arm: __eq__3fooFRC3foo" \
	 "foo::operator==\[(\]+(const foo|foo const) &\[)\]+"
    test_demangling_exact "arm: __eq__3fooCFR3foo"  "foo::operator==(foo &) const"
    test_demangling "arm: __eq__3fooCFRC3foo" \
	"foo::operator==\[(\]+(const foo|foo const) &\[)\]+ const"

    test_demangling_exact "arm: elem__15vector__pt__2_dFi" "vector<double>::elem(int)"

    test_demangling_exact "arm: elem__15vector__pt__2_iFi" "vector<int>::elem(int)"

    test_demangling_exact "arm: __ct__15vector__pt__2_dFi" "vector<double>::vector(int)"

    test_demangling_exact "arm: __ct__15vector__pt__2_iFi" "vector<int>::vector(int)"

    test_demangling_exact "arm: __ct__25DListNode__pt__9_R6RLabelFR6RLabelP25DListNode__pt__9_R6RLabelT2" \
	"DListNode<RLabel &>::DListNode(RLabel &, DListNode<RLabel &> *, DListNode<RLabel &> *)"

    test_demangling_exact "arm: bar__3fooFiT16FooBar" "foo::bar(int, int, FooBar)"

    test_demangling_exact "arm: bar__3fooFPiN51PdN37PcN211T1iN215" \
      "foo::bar(int *, int *, int *, int *, int *, int *, double *, double *, double *, double *, char *, char *, char *, int *, int, int, int)"

    test_demangling_exact "arm: _Utf390_1__1_9223372036854775807__9223372036854775" \
	    "Can't demangle \"_Utf390_1__1_9223372036854775807__9223372036854775\""
}

proc test_hp_style_demangling {} {

    # HP aCC mangling style is based on ARM for all the basic stuff,
    # so first we use some of the ARM tests here.  Later we have HP-specific
    # tests.
        
    test_demangling "hp: g__FP1cPC1cT1" \
	"g\[(\]+c *\[*\]+, (const c|c const) *\[*\]+, c *\[*\]+\[)\]+"
    test_demangling "hp: g__FPUlPCUlT1" \
	"g\[(\]+unsigned long \[*\]+, (const unsigned long|unsigned long const) \[*\]+, unsigned long \[*\]+\[)\]+"
    test_demangling "hp: g__FPUiPCUiT1" \
	"g\[(\]+unsigned int \[*\]+, (const unsigned int|unsigned int const) \[*\]+, unsigned int \[*\]+\[)\]+"
    test_demangling "hp: g__FPUsPCUsT1" \
	"g\[(\]+unsigned short \[*\]+, (const unsigned short|unsigned short const) \[*\]+, unsigned short \[*\]+\[)\]+"
    test_demangling "hp: g__FPUcPCUcT1" \
	"g\[(\]+unsigned char \[*\]+, (const unsigned char|unsigned char const) \[*\]+, unsigned char \[*\]+\[)\]+"
    test_demangling "hp: g__F1TPlPClT2" \
	"g\[(\]+T, long \[*\]+, (const long|long const) \[*\]+, long \[*\]+\[)\]+"
    test_demangling "hp: g__F1RRlRClT2" \
	"g\[(\]+R, long &, (const long|long const) &, long &\[)\]+"
    test_demangling "hp: g__F1TPiPCiT2" \
	"g\[(\]+T, int \[*\]+, (const int|int const) \[*\]+, int \[*\]+\[)\]+"
    test_demangling "hp: g__F1RRiRCiT2" \
	"g\[(\]+R, int &, (const int|int const) &, int &\[)\]+"
    test_demangling "hp: g__F1TPsPCsT2" \
	"g\[(\]+T, short \[*\]+, (const short|short const) \[*\]+, short \[*\]+\[)\]+"
    test_demangling "hp: g__F1RRsRCsT2" \
	"g\[(\]+R, short &, (const short|short const) &, short &\[)\]+"
    test_demangling "hp: g__F1TPcPCcT2" \
	"g\[(\]+T, char \[*\]+, (const char|char const) \[*\]+, char \[*\]+\[)\]+"
    test_demangling "hp: g__F1RRcRCcT2" \
	"g\[(\]+R, char &, (const char|char const) &, char &\[)\]+"

    test_demangling "hp: __gt__FRC2T2c" \
	"operator>\[(\]+(const T2|T2 const) &, char\[)\]+"
    test_demangling "hp: __ge__FRC2T2c" \
	"operator>=\[(\]+(const T2|T2 const) &, char\[)\]+"
    test_demangling "hp: __lt__FRC2T2c" \
	"operator<\[(\]+(const T2|T2 const) &, char\[)\]+"

    test_demangling "hp: __le__FRC2T2c" \
	"operator<=\[(\]+(const T2|T2 const) &, char\[)\]+"
    test_demangling "hp: __ne__FRC2T2c" \
	"operator!=\[(\]+(const T2|T2 const) &, char\[)\]+"
    test_demangling "hp: __eq__FRC2T2c" \
	"operator==\[(\]+(const T2|T2 const) &, char\[)\]+"
    test_demangling_exact "hp: __amd__FR2T2i" "operator%=(T2 &, int)"
    test_demangling_exact "hp: __adv__FR2T2i" "operator/=(T2 &, int)"
    test_demangling_exact "hp: __amu__FR2T2i" "operator*=(T2 &, int)"
    test_demangling_exact "hp: __ami__FR2T2i" "operator-=(T2 &, int)"
    test_demangling_exact "hp: __apl__FR2T2i" "operator+=(T2 &, int)"
    test_demangling_exact "hp: __nw__2T1SFUi" "T1::operator new(unsigned int) static"
    test_demangling_exact "hp: __dl__2T1SFPv" "T1::operator delete(void *) static"
    test_demangling_exact "hp: put__2T7SFi" "T7::put(int) static"

    test_demangling_exact "hp: h__FUc" "h(unsigned char)"
    test_demangling_exact "hp: f__Fic" "f(int, char)"
    test_demangling_exact "hp: h__FUi" "h(unsigned int)"
    test_demangling_exact "hp: h__Fci" "h(char, int)"
    test_demangling_exact "hp: h__FUl" "h(unsigned long)"
    test_demangling_exact "hp: h__Fcl" "h(char, long)"
    test_demangling_exact "hp: h__FUs" "h(unsigned short)"
    test_demangling_exact "hp: h__Fcs" "h(char, short)"
    test_demangling "hp: __amd__FR2T2RC2T2" \
	"operator%=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"
    test_demangling "hp: __adv__FR2T2RC2T2" \
	"operator/=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"
    test_demangling "hp: __amu__FR2T2RC2T2" \
	"operator\[*\]+=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"
    test_demangling "hp: __ami__FR2T2RC2T2" \
	"operator-=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"
    test_demangling "hp: __apl__FR2T2RC2T2" \
	"operator\[+\]+=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"

    test_demangling "hp: g__F1SRPUlRPCUlT2" \
	"g\[(\]+S, unsigned long \[*\]+&, (const unsigned long|unsigned long const) \[*\]+&, unsigned long \[*\]+&\[)\]+"
    test_demangling "hp: g__F1SRPUiRPCUiT2" \
	"g\[(\]+S, unsigned int \[*\]+&, (const unsigned int|unsigned int const) \[*\]+&, unsigned int \[*\]+&\[)\]+"
    test_demangling "hp: g__F1SRPUsRPCUsT2" \
	"g\[(\]+S, unsigned short \[*\]+&, (const unsigned short|unsigned short const) \[*\]+&, unsigned short \[*\]+&\[)\]+"
    test_demangling "hp: g__F1SRPUcRPCUcT2" \
	"g\[(\]+S, unsigned char \[*\]+&, (const unsigned char|unsigned char const) \[*\]+&, unsigned char \[*\]+&\[)\]+"
    test_demangling "hp: g__F1T1SRPlRPClT3" \
	"g\[(\]+T, S, long \[*\]+&, (const long|long const) \[*\]+&, long \[*\]+&\[)\]+"
    test_demangling "hp: g__F1T1SRPiRPCiT3" \
	"g\[(\]+T, S, int \[*\]+&, (const int|int const) \[*\]+&, int \[*\]+&\[)\]+"
    test_demangling "hp: g__F1T1SRPcRPCcT3" \
	"g\[(\]+T, S, char \[*\]+&, (const char|char const) \[*\]+&, char \[*\]+&\[)\]+"


    test_demangling "hp: __gt__FRC2T2T1" \
	"operator>\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
    test_demangling "hp: __ge__FRC2T2T1" \
	"operator>=\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
    test_demangling "hp: __lt__FRC2T2T1" \
	"operator<\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
    test_demangling "hp: __le__FRC2T2T1" \
	"operator<=\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
    test_demangling "hp: __ne__FRC2T2T1" \
	"operator!=\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
    test_demangling "hp: __eq__FRC2T2T1" \
	"operator==\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
    test_demangling "hp: g__FcR1cRC1cT2" \
	"g\[(\]+char, c &, (const c|c const) &, c &\[)\]+"
    test_demangling "hp: g__FcRPdRPCdT2" \
	"g\[(\]+char, double *\[*\]+&, (const double|double const) *\[*\]+&, double *\[*\]+&\[)\]+"
    test_demangling "hp: g__FcRPfRPCfT2" \
	"g\[(\]+char, float *\[*\]+&, (const float|float const) *\[*\]+&, float *\[*\]+&\[)\]+"
    test_demangling_exact "hp: h__FcT1" "h(char, char)"
    test_demangling_exact "hp: f__Ficd" "f(int, char, double)"
    test_demangling "hp: g__F1T1SdRPsRPCsT4" \
	"g\[(\]+T, S, double, short \[*\]+&, (const short|short const) \[*\]+&, short \[*\]+&\[)\]+"
    test_demangling "hp: g__F1cC1cT1" \
	"g\[(\]+c, (const c|c const), c\[)\]+"
    test_demangling "hp: g__FPdPCdT1" \
	"g\[(\]+double *\[*\]+, (const double|double const) *\[*\]+, double *\[*\]+\[)\]+"
    test_demangling "hp: g__FPfPCfT1" \
	"g\[(\]+float *\[*\]+, (const float|float const) *\[*\]+, float *\[*\]+\[)\]+"

    test_demangling "hp: g__FUlCUlT1" \
	"g\[(\]+unsigned long, (const unsigned long|unsigned long const), unsigned long\[)\]+"
    test_demangling "hp: g__FPlPClT1" \
	"g\[(\]+long \[*\]+, (const long|long const) \[*\]+, long \[*\]+\[)\]+"
    test_demangling "hp: g__FUiCUiT1" \
	"g\[(\]+unsigned int, (const unsigned int|unsigned int const), unsigned int\[)\]+"
    test_demangling "hp: g__FPiPCiT1" \
	"g\[(\]+int \[*\]+, (const int|int const) \[*\]+, int \[*\]+\[)\]+"
    test_demangling "hp: g__FUsCUsT1" \
	"g\[(\]+unsigned short, (const unsigned short|unsigned short const), unsigned short\[)\]+"
    test_demangling "hp: g__FPsPCsT1" \
	"g\[(\]+short \[*\]+, (const short|short const) \[*\]+, short \[*\]+\[)\]+"
    test_demangling "hp: g__FUcCUcT1" \
	"g\[(\]+unsigned char, (const unsigned char|unsigned char const), unsigned char\[)\]+"
    test_demangling "hp: g__FPcPCcT1" \
	"g\[(\]+char \[*\]+, (const char|char const) \[*\]+, char \[*\]+\[)\]+"
    test_demangling "hp: g__F1TlClT2" \
	"g\[(\]+T, long, (const long|long const), long\[)\]+"
    test_demangling "hp: g__F1TiCiT2" \
	"g\[(\]+T, int, (const int|int const), int\[)\]+"
    test_demangling "hp: g__F1TsCsT2" \
	"g\[(\]+T, short, (const short|short const), short\[)\]+"
    test_demangling "hp: g__F1TcCcT2" \
	"g\[(\]+T, char, (const char|char const), char\[)\]+"

    test_demangling "hp: printf__FPCce" \
	"printf\[(\]+(const char|char const) \[*\]+,...\[)\]+"


    test_demangling "hp: g__F1SRUlRCUlT2" \
	"g\[(\]+S, unsigned long &, (const unsigned long|unsigned long const) &, unsigned long &\[)\]+"
    test_demangling "hp: g__F1SRPlRPClT2" \
	"g\[(\]+S, long \[*\]+&, (const long|long const) \[*\]+&, long \[*\]+&\[)\]+"
    test_demangling "hp: g__F1RRUiRCUiT2" \
	"g\[(\]+R, unsigned int &, (const unsigned int|unsigned int const) &, unsigned int &\[)\]+"
    test_demangling "hp: g__F1SRPiRPCiT2" \
	"g\[(\]+S, int \[*\]+&, (const int|int const) \[*\]+&, int \[*\]+&\[)\]+"
    test_demangling "hp: g__F1RRUsRCUsT2" \
	"g\[(\]+R, unsigned short &, (const unsigned short|unsigned short const) &, unsigned short &\[)\]+"
    test_demangling "hp: g__F1SRPsRPCsT2" \
	"g\[(\]+S, short \[*\]+&, (const short|short const) \[*\]+&, short \[*\]+&\[)\]+"
    test_demangling "hp: g__F1RRUcRCUcT2" \
	"g\[(\]+R, unsigned char &, (const unsigned char|unsigned char const) &, unsigned char &\[)\]+"
    test_demangling "hp: g__F1SRPcRPCcT2" \
	"g\[(\]+S, char \[*\]+&, (const char|char const) \[*\]+&, char \[*\]+&\[)\]+"
    test_demangling "hp: g__F1T1RRlRClT3" \
	"g\[(\]+T, R, long &, (const long|long const) &, long &\[)\]+"
    test_demangling "hp: g__F1T1RRiRCiT3" \
	"g\[(\]+T, R, int &, (const int|int const) &, int &\[)\]+"
    test_demangling "hp: g__F1T1RRsRCsT3" \
	"g\[(\]+T, R, short &, (const short|short const) &, short &\[)\]+"
    test_demangling "hp: g__F1T1RRcRCcT3" \
	"g\[(\]+T, R, char &, (const char|char const) &, char &\[)\]+"


    test_demangling_exact "hp: f__FicdPcPFci_v" "f(int, char, double, char *, void (*)(char, int))"
    test_demangling_exact "hp: f__FicdPcPFic_v" "f(int, char, double, char *, void (*)(int, char))"
    test_demangling_exact "hp: get__2T7SFv" "T7::get(void) static"


    test_demangling "hp: g__FcRdRCdT2" \
	"g\[(\]+char, double &, (const double|double const) &, double &\[)\]+"
    test_demangling "hp: g__FcRfRCfT2" \
	"g\[(\]+char, float &, (const float|float const) &, float &\[)\]+"
    test_demangling "hp: __md__FC2T2i" \
	"operator%\[(\]+(const T2|T2 const), int\[)\]+"
    test_demangling "hp: __dv__FC2T2i" \
	"operator/\[(\]+(const T2|T2 const), int\[)\]+"
    test_demangling "hp: __ml__FC2T2i" \
	"operator\[*\]+\[(\]+(const T2|T2 const), int\[)\]+"
    test_demangling "hp: __mi__FC2T2i" \
	"operator-\[(\]+(const T2|T2 const), int\[)\]+"
    test_demangling "hp: __pl__FC2T2i" \
	"operator\[+\]+\[(\]+(const T2|T2 const), int\[)\]+"


    test_demangling_exact "hp: h__Fc" "h(char)"
    test_demangling_exact "hp: h__Fd" "h(double)"
    test_demangling_exact "hp: h__Ff" "h(float)"
    test_demangling_exact "hp: h__Fi" "h(int)"
    test_demangling_exact "hp: f__Fi" "f(int)"
    test_demangling_exact "hp: h__Fl" "h(long)"

    test_demangling_exact "hp: h__Fs" "h(short)"
    test_demangling "hp: __md__FC2T2RC2T2" \
	"operator%\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
    test_demangling "hp: __dv__FC2T2RC2T2" \
	"operator/\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
    test_demangling "hp: __ml__FC2T2RC2T2" \
	"operator\[*\]+\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
    test_demangling "hp: __mi__FC2T2RC2T2" \
	"operator-\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
    test_demangling "hp: __pl__FC2T2RC2T2" \
	"operator\[+\]+\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
    test_demangling "hp: g__FcRP1cRPC1cT2" \
	"g\[(\]+char, c *\[*\]+&, (const c|c const) *\[*\]+&, c *\[*\]+&\[)\]+"


    test_demangling "hp: g__FdCdT1" \
	"g\[(\]+double, (const double|double const), double\[)\]+"
    test_demangling "hp: g__FfCfT1" \
	"g\[(\]+float, (const float|float const), float\[)\]+"
    test_demangling "hp: g__FlClT1" \
	"g\[(\]+long, (const long|long const), long\[)\]+"
    test_demangling "hp: g__FiCiT1" \
	"g\[(\]+int, (const int|int const), int\[)\]+"
    test_demangling "hp: g__FsCsT1" \
	"g\[(\]+short, (const short|short const), short\[)\]+"
    test_demangling "hp: g__FcCcT1" \
	"g\[(\]+char, (const char|char const), char\[)\]+"


    test_demangling_exact "hp: f__FicdPc" "f(int, char, double, char *)"
    test_demangling_exact "hp: __nw__FUi" "operator new(unsigned int)"
    test_demangling_exact "hp: __ct__Q3_2T11a1bSFi" "T1::a::b::b(int) static"
    test_demangling_exact "hp: __dt__Q3_2T11a1bSFi" "T1::a::b::~b(int) static"
    test_demangling_exact "hp: put__Q3_2T11a1bSFi" "T1::a::b::put(int) static"
    test_demangling_exact "hp: get__Q2_2T11aSFv" "T1::a::get(void) static"
    test_demangling_exact "hp: put__2T1SFi" "T1::put(int) static"
    test_demangling_exact "hp: put__Q5_2T11a1b1c1dSFi" "T1::a::b::c::d::put(int) static"
    test_demangling_exact "hp: get__Q4_2T11a1b1cSFv" "T1::a::b::c::get(void) static"
    test_demangling_exact "hp: put__Q2_2T11aSFi" "T1::a::put(int) static"
    test_demangling_exact "hp: put__Q4_2T11a1b1cSFi" "T1::a::b::c::put(int) static"
    test_demangling_exact "hp: get__Q3_2T11a1bSFv" "T1::a::b::get(void) static"
    test_demangling_exact "hp: get__2T1SFv" "T1::get(void) static"
    test_demangling_exact "hp: get__Q5_2T11a1b1c1dSFv" "T1::a::b::c::d::get(void) static"


    test_demangling_exact "hp: bar__3fooFPv"       "foo::bar(void *)"
    test_demangling "hp: bar__3fooFPCv" \
	     "foo::bar\[(\]+(const void|void const) *\[*\]+\[)\]+"
    test_demangling_exact "hp: bar__3fooCFPv"      "foo::bar(void *) const"
    test_demangling "hp: bar__3fooCFPCv" \
	    "foo::bar\[(\]+(const void|void const) *\[*\]+\[)\]+ const"
    test_demangling_exact "hp: __eq__3fooFR3foo"   "foo::operator==(foo &)"
    test_demangling "hp: __eq__3fooFRC3foo" \
	 "foo::operator==\[(\]+(const foo|foo const) &\[)\]+"
    test_demangling_exact "hp: __eq__3fooCFR3foo"  "foo::operator==(foo &) const"
    test_demangling "hp: __eq__3fooCFRC3foo" \
	"foo::operator==\[(\]+(const foo|foo const) &\[)\]+ const"

    test_demangling_exact "hp: bar__3fooFiT16FooBar" "foo::bar(int, int, FooBar)"

    test_demangling_exact "hp: bar__3fooFPiN51PdN37PcN211T1iN215" \
      "foo::bar(int *, int *, int *, int *, int *, int *, double *, double *, double *, double *, char *, char *, char *, int *, int, int, int)"


    # HP aCC specific tests. HP aCC demangling does not use __pt__ for
    # template specifications.  There are other differences as well.

    test_demangling_exact "hp: __dt__2T5XTPFiPPdPv_i__Fv" "T5<int (*)(int, double **, void *)>::~T5(void)"

    test_demangling_exact "hp: __ct__1cFi" "c::c(int)"

    test_demangling_exact "hp: __dt__2T5XTi__Fv" "T5<int>::~T5(void)"

    test_demangling_exact "hp: __dt__2T5XTc__Fv" "T5<char>::~T5(void)"

    test_demangling_exact "hp: __ct__2T2Fi" "T2::T2(int)"
    test_demangling_exact "hp: __dt__2T1Fv" "T1::~T1(void)"

    test_demangling_exact "hp: __dt__2T5XT1x__Fv" "T5<x>::~T5(void)"

    test_demangling_exact "hp: __dt__2T5XTPFcPv_i__Fv" "T5<int (*)(char, void *)>::~T5(void)"
    
    test_demangling_exact "hp: __ct__2T5XTPFiPPdPv_i__Fi" "T5<int (*)(int, double **, void *)>::T5(int)"

    test_demangling_exact "hp: __dl__2T5XT1x__SFPv" "T5<x>::operator delete(void *) static"
    
    test_demangling_exact "hp: X__2T5XT1x" "T5<x>::X"

    test_demangling_exact "hp: __ct__2T5XTi__Fi" "T5<int>::T5(int)"

    test_demangling_exact "hp: __ct__2T5XTc__Fi" "T5<char>::T5(int)"

    test_demangling_exact "hp: __dl__2T5XTPFcPv_i__SFPv" "T5<int (*)(char, void *)>::operator delete(void *) static"

    test_demangling_exact "hp: X__2T5XTPFcPv_i" "T5<int (*)(char, void *)>::X"

    test_demangling_exact "hp: __ct__2T5XT1x__Fi" "T5<x>::T5(int)"

    test_demangling_exact "hp: __dl__2T5XTPFiPPdPv_i__SFPv" "T5<int (*)(int, double **, void *)>::operator delete(void *) static"
    test_demangling_exact "hp: X__2T5XTPFiPPdPv_i" "T5<int (*)(int, double **, void *)>::X"

    test_demangling_exact "hp: __dl__2T5XTi__SFPv" "T5<int>::operator delete(void *) static"

    test_demangling_exact "hp: __dl__2T5XTc__SFPv" "T5<char>::operator delete(void *) static"

    test_demangling_exact "hp: X__2T5XTc" "T5<char>::X"

    test_demangling_exact "hp: X__2T5XTi" "T5<int>::X"

    test_demangling_exact "hp: __ct__2T5XTPFcPv_i__Fi" "T5<int (*)(char, void *)>::T5(int)"
    
    test_demangling_exact "hp: __dt__2T1XTc__Fv" "T1<char>::~T1(void)"

    test_demangling_exact "hp: __dt__2T1XT1t__Fv" "T1<t>::~T1(void)"

    test_demangling_exact "hp: __dl__2T1XT1t__SFPv" "T1<t>::operator delete(void *) static"

    test_demangling_exact "hp: __ct__2T1XTc__Fi" "T1<char>::T1(int)"

    test_demangling_exact "hp: __ct__2T1XTc__Fv" "T1<char>::T1(void)"

    test_demangling_exact "hp: __ct__2T1XT1t__Fi" "T1<t>::T1(int)"

    test_demangling_exact "hp: __ct__2T1XT1t__Fv" "T1<t>::T1(void)"

    test_demangling_exact "hp: __dl__2T1XTc__SFPv" "T1<char>::operator delete(void *) static"

    test_demangling_exact "hp: elem__6vectorXTd__Fi" "vector<double>::elem(int)"

    test_demangling_exact "hp: elem__6vectorXTi__Fi" "vector<int>::elem(int)"

    test_demangling_exact "hp: __ct__6vectorXTd__Fi" "vector<double>::vector(int)"

    test_demangling_exact "hp: __ct__6vectorXTi__Fi" "vector<int>::vector(int)"

    test_demangling_exact "hp: __ct__9DListNodeXTR6RLabel__FR6RLabelP9DListNodeXTR6RLabel_T2" \
	"DListNode<RLabel &>::DListNode(RLabel &, DListNode<RLabel &> *, DListNode<RLabel &> *)"


    # Absolute integer constants in template args

    test_demangling_exact "hp: elem__6vectorXTiUP34__Fi" "vector<int,34U>::elem(int)"
    test_demangling_exact "hp: elem__6vectorXUP2701Td__Fi" "vector<2701U,double>::elem(int)"
    test_demangling_exact "hp: elem__6vectorXTiSP334__Fi" "vector<int,334>::elem(int)"
    test_demangling_exact "hp: elem__6vectorXTiSN67__Fi" "vector<int,-67>::elem(int)"
    test_demangling_exact "hp: elem__6vectorXTiSM__SCFPPd" "vector<int,-2147483648>::elem(double **) static const"
    test_demangling_exact "hp: elem__6vectorXTiSN67UP4000TRs__Fi" "vector<int,-67,4000U,short &>::elem(int)"
    test_demangling_exact "hp: elem__6vectorXTiSN67TRdTFPv_i__Fi" "vector<int,-67,double &,int (void *)>::elem(int)"
    test_demangling_exact "hp: X__6vectorXTiSN67TdTPvUP5TRs" "vector<int,-67,double,void *,5U,short &>::X"

    # Named constants in template args

    test_demangling_exact "hp: elem__6vectorXTiA3foo__Fi" "vector<int,&foo>::elem(int)"
    test_demangling_exact "hp: elem__6vectorXTiA3fooTPvA5Label__FiPPvT2" "vector<int,&foo,void *,&Label>::elem(int, void **, void **)"
    test_demangling_exact "hp: elem__6vectorXTiSN42A3foo__Fi" "vector<int,-42,&foo>::elem(int)"

    # Alternate entry points for functions

    test_demangling_exact "hp: __ct__2T5XTPFcPv_i__Fi_2" "T5<int (*)(char, void *)>::T5(int)"
    test_demangling_exact "hp: __ct__2T5XTPFcPv_i__Fi_19" "T5<int (*)(char, void *)>::T5(int)"
    test_demangling_exact "hp: f__FicdPcPFci_v_34" "f(int, char, double, char *, void (*)(char, int))"


    # Template partial specializations

# FIXME!  The # characters don't go through expect, and backslashes don't seem to work.
#    test_demangling_exact "hp: spec__13Spec<#1,#1.*>XTiTPi_FPi" "Spec<int,int *>::spec(int *)"
#    test_demangling_exact "hp: spec__16Spec<#1,#1.&,#1>XTiTRiTi_FPi" "Spec<int,int &, int>::spec(int *)"
# Fake test -- replace # with %
    test_demangling_exact "hp: spec__13Spec<%1,%1.*>XTiTPi_FPi" "Spec<int,int *>::spec(int *)"
    test_demangling_exact "hp: spec__16Spec<%1,%1.&,%1>XTiTRiTi_FPi" "Spec<int,int &,int>::spec(int *)"

    # Global template functions

    test_demangling_exact "hp: add__XTc_FcT1" "add<char>(char, char)"
    test_demangling_exact "hp: add__XTcSP9A5label_FcPPlT1" "add<char,9,&label>(char, long **, char)"
    test_demangling_exact "hp: add__XTPfTFPd_f_FcT1" "add<float *,float (double *)>(char, char)"

    # Template for template arg

    test_demangling_exact "hp: unLink__12basic_stringXTcT18string_char_traitsXTc_T9allocator_Fv" "basic_string<char,string_char_traits<char>,allocator>::unLink(void)"

    test_demangling_exact "hp: _Utf390_1__1_9223372036854775807__9223372036854775" \
	    "Can't demangle \"_Utf390_1__1_9223372036854775807__9223372036854775\""
}


proc catch_demangling_errors {command} {
    if {[catch $command result]} {
	puts "ERROR: demangle.exp: while running $command: $result"
    }
}

# Test support for different demangling styles.  Note that this does
# not depend upon running the test program and does not depend upon
# gdb being able to lookup any C++ symbols.  It simply calls the 
# internal demangler with synthesized strings and tests the results.

proc do_tests {} {
    global subdir
    global gdb_prompt


    # Start with a fresh gdb.

    gdb_exit
    gdb_start

    gdb_test_no_output "set language c++"
    gdb_test_no_output "set width 0"

    # Using catch_demangling_errors this way ensures that, if one of
    # the functions raises a Tcl error, then it'll get reported, and
    # the rest of the functions will still run.
    catch_demangling_errors test_lucid_style_demangling
    catch_demangling_errors test_gnu_style_demangling
    catch_demangling_errors test_arm_style_demangling
    catch_demangling_errors test_hp_style_demangling

    # Verify specifying demangle language.
    gdb_test_no_output "set language unknown"
    set_demangling_style "auto"
    gdb_test_exact "demangle -l c++ -- _ZSt4cout" "std::cout"
    gdb_test_exact "demangle -l c++ _ZSt4cout" "std::cout"
    gdb_test_exact "demangle -l c -- _ZSt4cout" "Can't demangle \"_ZSt4cout\""
    gdb_test_exact "demangle -l garbage xyzdje" "Unknown language \"garbage\""
}

do_tests