1da0c48c4Sopenharmony_ci#! /bin/sh
2da0c48c4Sopenharmony_ci# Variant of run-get-files that uses dwarf_next_lines.
3da0c48c4Sopenharmony_ci# Copyright (C) 2018 Red Hat, Inc.
4da0c48c4Sopenharmony_ci# This file is part of elfutils.
5da0c48c4Sopenharmony_ci#
6da0c48c4Sopenharmony_ci# This file is free software; you can redistribute it and/or modify
7da0c48c4Sopenharmony_ci# it under the terms of the GNU General Public License as published by
8da0c48c4Sopenharmony_ci# the Free Software Foundation; either version 3 of the License, or
9da0c48c4Sopenharmony_ci# (at your option) any later version.
10da0c48c4Sopenharmony_ci#
11da0c48c4Sopenharmony_ci# elfutils is distributed in the hope that it will be useful, but
12da0c48c4Sopenharmony_ci# WITHOUT ANY WARRANTY; without even the implied warranty of
13da0c48c4Sopenharmony_ci# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14da0c48c4Sopenharmony_ci# GNU General Public License for more details.
15da0c48c4Sopenharmony_ci#
16da0c48c4Sopenharmony_ci# You should have received a copy of the GNU General Public License
17da0c48c4Sopenharmony_ci# along with this program.  If not, see <http://www.gnu.org/licenses/>.
18da0c48c4Sopenharmony_ci
19da0c48c4Sopenharmony_ci. $srcdir/test-subr.sh
20da0c48c4Sopenharmony_ci
21da0c48c4Sopenharmony_citestfiles testfile testfile2
22da0c48c4Sopenharmony_ci
23da0c48c4Sopenharmony_citestrun_compare ${abs_builddir}/next-files testfile testfile2 <<\EOF
24da0c48c4Sopenharmony_cioff = 0
25da0c48c4Sopenharmony_ci dirs[0] = "/home/drepper/gnu/new-bu/build/ttt"
26da0c48c4Sopenharmony_ci file[0] = "???"
27da0c48c4Sopenharmony_ci file[1] = "/home/drepper/gnu/new-bu/build/ttt/m.c"
28da0c48c4Sopenharmony_cioff = 75
29da0c48c4Sopenharmony_ci dirs[0] = "/home/drepper/gnu/new-bu/build/ttt"
30da0c48c4Sopenharmony_ci file[0] = "???"
31da0c48c4Sopenharmony_ci file[1] = "/home/drepper/gnu/new-bu/build/ttt/b.c"
32da0c48c4Sopenharmony_ci file[2] = "/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h"
33da0c48c4Sopenharmony_ci file[3] = "/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h"
34da0c48c4Sopenharmony_ci file[4] = "/usr/include/bits/types.h"
35da0c48c4Sopenharmony_ci file[5] = "/usr/include/bits/sched.h"
36da0c48c4Sopenharmony_ci file[6] = "/usr/include/bits/pthreadtypes.h"
37da0c48c4Sopenharmony_ci file[7] = "/usr/include/stdio.h"
38da0c48c4Sopenharmony_ci file[8] = "/usr/include/libio.h"
39da0c48c4Sopenharmony_ci file[9] = "/usr/include/wchar.h"
40da0c48c4Sopenharmony_ci file[10] = "/usr/include/_G_config.h"
41da0c48c4Sopenharmony_ci file[11] = "/usr/include/gconv.h"
42da0c48c4Sopenharmony_cioff = 480
43da0c48c4Sopenharmony_ci dirs[0] = "/home/drepper/gnu/new-bu/build/ttt"
44da0c48c4Sopenharmony_ci file[0] = "???"
45da0c48c4Sopenharmony_ci file[1] = "/home/drepper/gnu/new-bu/build/ttt/f.c"
46da0c48c4Sopenharmony_cioff = 0
47da0c48c4Sopenharmony_ci dirs[0] = "/shoggoth/drepper"
48da0c48c4Sopenharmony_ci file[0] = "???"
49da0c48c4Sopenharmony_ci file[1] = "/shoggoth/drepper/b.c"
50da0c48c4Sopenharmony_ci file[2] = "/home/geoffk/objs/laurel-000912-branch/lib/gcc-lib/powerpc-unknown-linux-gnu/2.96-laurel-000912/include/stddef.h"
51da0c48c4Sopenharmony_ci file[3] = "/home/geoffk/objs/laurel-000912-branch/lib/gcc-lib/powerpc-unknown-linux-gnu/2.96-laurel-000912/include/stdarg.h"
52da0c48c4Sopenharmony_ci file[4] = "/shoggoth/drepper/<built-in>"
53da0c48c4Sopenharmony_ci file[5] = "/usr/include/bits/types.h"
54da0c48c4Sopenharmony_ci file[6] = "/usr/include/stdio.h"
55da0c48c4Sopenharmony_ci file[7] = "/usr/include/libio.h"
56da0c48c4Sopenharmony_ci file[8] = "/usr/include/_G_config.h"
57da0c48c4Sopenharmony_cioff = 418
58da0c48c4Sopenharmony_ci dirs[0] = "/shoggoth/drepper"
59da0c48c4Sopenharmony_ci file[0] = "???"
60da0c48c4Sopenharmony_ci file[1] = "/shoggoth/drepper/f.c"
61da0c48c4Sopenharmony_cioff = 485
62da0c48c4Sopenharmony_ci dirs[0] = "/shoggoth/drepper"
63da0c48c4Sopenharmony_ci file[0] = "???"
64da0c48c4Sopenharmony_ci file[1] = "/shoggoth/drepper/m.c"
65da0c48c4Sopenharmony_ciEOF
66da0c48c4Sopenharmony_ci
67da0c48c4Sopenharmony_ci# see tests/testfile-dwarf-45.source
68da0c48c4Sopenharmony_citestfiles testfile-splitdwarf-4 testfile-hello4.dwo testfile-world4.dwo
69da0c48c4Sopenharmony_citestfiles testfile-splitdwarf-5 testfile-hello5.dwo testfile-world5.dwo
70da0c48c4Sopenharmony_ci
71da0c48c4Sopenharmony_citestrun_compare ${abs_builddir}/next-files testfile-splitdwarf-4 testfile-hello4.dwo testfile-world4.dwo <<\EOF
72da0c48c4Sopenharmony_cioff = 0
73da0c48c4Sopenharmony_ci dirs[0] = "/home/mark/src/elfutils/tests"
74da0c48c4Sopenharmony_ci dirs[1] = "/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include"
75da0c48c4Sopenharmony_ci file[0] = "???"
76da0c48c4Sopenharmony_ci file[1] = "/home/mark/src/elfutils/tests/hello.c"
77da0c48c4Sopenharmony_ci file[2] = "/home/mark/src/elfutils/tests/hello.h"
78da0c48c4Sopenharmony_ci file[3] = "/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include/stddef.h"
79da0c48c4Sopenharmony_cioff = 612
80da0c48c4Sopenharmony_ci dirs[0] = "/home/mark/src/elfutils/tests"
81da0c48c4Sopenharmony_ci dirs[1] = "/usr/include"
82da0c48c4Sopenharmony_ci file[0] = "???"
83da0c48c4Sopenharmony_ci file[1] = "/home/mark/src/elfutils/tests/world.c"
84da0c48c4Sopenharmony_ci file[2] = "/home/mark/src/elfutils/tests/hello.h"
85da0c48c4Sopenharmony_ci file[3] = "/usr/include/stdlib.h"
86da0c48c4Sopenharmony_cioff = 0
87da0c48c4Sopenharmony_ci dirs[0] = "/home/mark/src/elfutils/tests"
88da0c48c4Sopenharmony_ci dirs[1] = "/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include"
89da0c48c4Sopenharmony_ci file[0] = "???"
90da0c48c4Sopenharmony_ci file[1] = "/home/mark/src/elfutils/tests/hello.c"
91da0c48c4Sopenharmony_ci file[2] = "/home/mark/src/elfutils/tests/hello.h"
92da0c48c4Sopenharmony_ci file[3] = "/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include/stddef.h"
93da0c48c4Sopenharmony_cioff = 0
94da0c48c4Sopenharmony_ci dirs[0] = "/home/mark/src/elfutils/tests"
95da0c48c4Sopenharmony_ci dirs[1] = "/usr/include"
96da0c48c4Sopenharmony_ci file[0] = "???"
97da0c48c4Sopenharmony_ci file[1] = "/home/mark/src/elfutils/tests/world.c"
98da0c48c4Sopenharmony_ci file[2] = "/home/mark/src/elfutils/tests/hello.h"
99da0c48c4Sopenharmony_ci file[3] = "/usr/include/stdlib.h"
100da0c48c4Sopenharmony_ciEOF
101da0c48c4Sopenharmony_ci
102da0c48c4Sopenharmony_ci# No problem with dirs[0] for DWARF5 line tables.
103da0c48c4Sopenharmony_citestrun_compare ${abs_builddir}/next-files testfile-splitdwarf-5 testfile-hello5.dwo testfile-world5.dwo <<\EOF
104da0c48c4Sopenharmony_cioff = 0
105da0c48c4Sopenharmony_ci dirs[0] = "/home/mark/src/elfutils/tests"
106da0c48c4Sopenharmony_ci dirs[1] = "/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include"
107da0c48c4Sopenharmony_ci file[0] = "/home/mark/src/elfutils/tests/hello.c"
108da0c48c4Sopenharmony_ci file[1] = "/home/mark/src/elfutils/tests/hello.c"
109da0c48c4Sopenharmony_ci file[2] = "/home/mark/src/elfutils/tests/hello.h"
110da0c48c4Sopenharmony_ci file[3] = "/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include/stddef.h"
111da0c48c4Sopenharmony_cioff = 655
112da0c48c4Sopenharmony_ci dirs[0] = "/home/mark/src/elfutils/tests"
113da0c48c4Sopenharmony_ci dirs[1] = "/usr/include"
114da0c48c4Sopenharmony_ci file[0] = "/home/mark/src/elfutils/tests/world.c"
115da0c48c4Sopenharmony_ci file[1] = "/home/mark/src/elfutils/tests/world.c"
116da0c48c4Sopenharmony_ci file[2] = "/home/mark/src/elfutils/tests/hello.h"
117da0c48c4Sopenharmony_ci file[3] = "/usr/include/stdlib.h"
118da0c48c4Sopenharmony_cioff = 0
119da0c48c4Sopenharmony_ci dirs[0] = "/home/mark/src/elfutils/tests"
120da0c48c4Sopenharmony_ci dirs[1] = "/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include"
121da0c48c4Sopenharmony_ci file[0] = "/home/mark/src/elfutils/tests/hello.c"
122da0c48c4Sopenharmony_ci file[1] = "/home/mark/src/elfutils/tests/hello.c"
123da0c48c4Sopenharmony_ci file[2] = "/home/mark/src/elfutils/tests/hello.h"
124da0c48c4Sopenharmony_ci file[3] = "/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include/stddef.h"
125da0c48c4Sopenharmony_cioff = 0
126da0c48c4Sopenharmony_ci dirs[0] = "/home/mark/src/elfutils/tests"
127da0c48c4Sopenharmony_ci dirs[1] = "/usr/include"
128da0c48c4Sopenharmony_ci file[0] = "/home/mark/src/elfutils/tests/world.c"
129da0c48c4Sopenharmony_ci file[1] = "/home/mark/src/elfutils/tests/world.c"
130da0c48c4Sopenharmony_ci file[2] = "/home/mark/src/elfutils/tests/hello.h"
131da0c48c4Sopenharmony_ci file[3] = "/usr/include/stdlib.h"
132da0c48c4Sopenharmony_ciEOF
133da0c48c4Sopenharmony_ci
134da0c48c4Sopenharmony_ci# Created from testfile using
135da0c48c4Sopenharmony_ci# cp testfile testfile-only-debug-line
136da0c48c4Sopenharmony_ci# eu-strip -g --keep-section .debug_line
137da0c48c4Sopenharmony_ci#
138da0c48c4Sopenharmony_ci# Note how the comp dir cannot be retrieved and some files become relative.
139da0c48c4Sopenharmony_citestfiles testfile-only-debug-line
140da0c48c4Sopenharmony_citestrun_compare ${abs_builddir}/next-files testfile-only-debug-line <<\EOF
141da0c48c4Sopenharmony_cioff = 0
142da0c48c4Sopenharmony_ci dirs[0] = (null)
143da0c48c4Sopenharmony_ci file[0] = "???"
144da0c48c4Sopenharmony_ci file[1] = "m.c"
145da0c48c4Sopenharmony_cioff = 75
146da0c48c4Sopenharmony_ci dirs[0] = (null)
147da0c48c4Sopenharmony_ci file[0] = "???"
148da0c48c4Sopenharmony_ci file[1] = "b.c"
149da0c48c4Sopenharmony_ci file[2] = "/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h"
150da0c48c4Sopenharmony_ci file[3] = "/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h"
151da0c48c4Sopenharmony_ci file[4] = "/usr/include/bits/types.h"
152da0c48c4Sopenharmony_ci file[5] = "/usr/include/bits/sched.h"
153da0c48c4Sopenharmony_ci file[6] = "/usr/include/bits/pthreadtypes.h"
154da0c48c4Sopenharmony_ci file[7] = "/usr/include/stdio.h"
155da0c48c4Sopenharmony_ci file[8] = "/usr/include/libio.h"
156da0c48c4Sopenharmony_ci file[9] = "/usr/include/wchar.h"
157da0c48c4Sopenharmony_ci file[10] = "/usr/include/_G_config.h"
158da0c48c4Sopenharmony_ci file[11] = "/usr/include/gconv.h"
159da0c48c4Sopenharmony_cioff = 480
160da0c48c4Sopenharmony_ci dirs[0] = (null)
161da0c48c4Sopenharmony_ci file[0] = "???"
162da0c48c4Sopenharmony_ci file[1] = "f.c"
163da0c48c4Sopenharmony_ciEOF
164da0c48c4Sopenharmony_ci
165da0c48c4Sopenharmony_ciexit 0
166