1#! /bin/sh
2# Test for dwarf_next_cfi.
3# Copyright (C) 2018 Red Hat, Inc.
4# This file is part of elfutils.
5#
6# This file is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 3 of the License, or
9# (at your option) any later version.
10#
11# elfutils is distributed in the hope that it will be useful, but
12# WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19. $srcdir/test-subr.sh
20
21# Test files come from run-addrcfi
22testfiles testfile11 testfile12
23testfiles testfilearm testfileaarch64
24testfiles testfileppc32 testfileppc64
25
26testrun_compare ${abs_builddir}/next_cfi testfile11 <<\EOF
27testfile11
28.eh_frame
29[0] CIE augmentation="zPL"
30[28] FDE cie=[0]
31[64] FDE cie=[0]
32[96] FDE cie=[0]
33[128] FDE cie=[0]
34.debug_frame
35[0] CIE augmentation=""
36[20] FDE cie=[0]
37[52] FDE cie=[0]
38[76] FDE cie=[0]
39[100] FDE cie=[0]
40[124] FDE cie=[0]
41[148] FDE cie=[0]
42[172] FDE cie=[0]
43[196] FDE cie=[0]
44EOF
45
46testrun_compare ${abs_builddir}/next_cfi testfile12 <<\EOF
47testfile12
48.eh_frame
49[0] CIE augmentation=""
50[16] CIE augmentation="zR"
51[40] FDE cie=[16]
52.debug_frame
53[0] CIE augmentation=""
54[24] FDE cie=[0]
55EOF
56
57testrun_compare ${abs_builddir}/next_cfi testfilearm <<\EOF
58testfilearm
59.eh_frame
60.debug_frame
61[0] CIE augmentation=""
62[16] FDE cie=[0]
63[32] CIE augmentation=""
64[48] FDE cie=[32]
65EOF
66
67testrun_compare ${abs_builddir}/next_cfi testfileaarch64 <<\EOF
68testfileaarch64
69.eh_frame
70[0] CIE augmentation="zR"
71[24] FDE cie=[0]
72[80] FDE cie=[0]
73.debug_frame
74[0] CIE augmentation=""
75[16] FDE cie=[0]
76[40] CIE augmentation=""
77[56] FDE cie=[40]
78EOF
79
80testrun_compare ${abs_builddir}/next_cfi testfileppc32 <<\EOF
81testfileppc32
82.eh_frame
83[0] CIE augmentation="zR"
84[20] FDE cie=[0]
85[40] FDE cie=[0]
86[96] FDE cie=[0]
87.debug_frame
88[0] CIE augmentation=""
89[16] FDE cie=[0]
90[32] CIE augmentation=""
91[48] FDE cie=[32]
92EOF
93
94testrun_compare ${abs_builddir}/next_cfi testfileppc64 <<\EOF
95testfileppc64
96.eh_frame
97[0] CIE augmentation="zR"
98[20] FDE cie=[0]
99[40] FDE cie=[0]
100[64] CIE augmentation="zR"
101[88] FDE cie=[64]
102[144] FDE cie=[64]
103.debug_frame
104[0] CIE augmentation=""
105[16] FDE cie=[0]
106[56] CIE augmentation=""
107[72] FDE cie=[56]
108EOF
109