1#!/usr/local/bin/bash
2# Copyright (C) 2018 Red Hat, Inc.
3# This file is part of elfutils.
4#
5# This file is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
9#
10# elfutils is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18. $srcdir/test-subr.sh
19
20# See run-dwarf-ranges.sh
21# Compiled with:
22# gcc -c -O2 -o testfile-ranges-hello.o -gsplit-dwarf -gdwarf-4 hello.c
23# gcc -c -O2 -o testfile-ranges-world.o -gsplit-dwarf -gdwarf-4 world.c
24# gcc -o testfilesplitranges4 -O2 \
25#        testfile-ranges-hello.o testfile-ranges-world.o
26# eu-strip -f testfilesplitranges4.debug testfilesplitranges4
27
28testfiles testfilesplitranges4.debug
29testfiles testfile-ranges-hello.dwo testfile-ranges-world.dwo
30
31testrun_compare ${abs_builddir}/all-dwarf-ranges testfilesplitranges4.debug <<\EOF
32die: hello.c (11)
33 4004e0..4004ff
34 4003e0..4003f7
35
36die: no_say (2e)
37 4004f0..4004ff
38
39die: main (2e)
40 4003e0..4003f7
41
42die: subject (1d)
43 4003e3..4003ef
44
45die: subject (2e)
46 4004e0..4004f0
47
48die: world.c (11)
49 400500..400567
50
51die: no_main (2e)
52 400550..400567
53
54die: no_subject (1d)
55 400553..40055f
56
57die: say (2e)
58 400500..400540
59
60die: happy (1d)
61 40051c..400526
62 400530..400534
63 400535..40053f
64
65die: sad (1d)
66 40051c..400526
67 400535..40053f
68
69die: no_subject (2e)
70 400540..400550
71
72EOF
73
74# Same with -gdwarf-5
75# gcc -c -O2 -o testfile-ranges-hello5.o -gsplit-dwarf -gdwarf-5 hello.c
76# gcc -c -O2 -o testfile-ranges-world5.o -gsplit-dwarf -gdwarf-5 world.c
77# gcc -o testfilesplitranges5 -O2 testfile-ranges-hello5.o testfile-ranges-world5.o
78# eu-strip -f testfilesplitranges5.debug testfilesplitranges5
79
80testfiles testfilesplitranges5.debug
81testfiles testfile-ranges-hello5.dwo testfile-ranges-world5.dwo
82
83testrun_compare ${abs_builddir}/all-dwarf-ranges testfilesplitranges5.debug <<\EOF
84die: hello.c (11)
85 401150..40117a
86 401050..401067
87
88die: no_say (2e)
89 401160..40117a
90
91die: main (2e)
92 401050..401067
93
94die: subject (1d)
95 401053..40105f
96
97die: subject (2e)
98 401150..401160
99
100die: world.c (11)
101 401180..4011e7
102
103die: no_main (2e)
104 4011d0..4011e7
105
106die: no_subject (1d)
107 4011d3..4011df
108
109die: say (2e)
110 401180..4011c0
111
112die: happy (1d)
113 40119b..40119b
114 40119c..4011a6
115 4011b0..4011b4
116 4011b5..4011bf
117
118die: sad (1d)
119 40119b..40119b
120 40119c..4011a6
121 4011b4..4011b4
122 4011b5..4011bf
123
124die: no_subject (2e)
125 4011c0..4011d0
126
127EOF
128
129exit 0
130