• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2011 Red Hat, Inc.
2# This file is part of elfutils.
3#
4# This file is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3 of the License, or
7# (at your option) any later version.
8#
9# elfutils is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17. $srcdir/test-subr.sh
18
19# NOTE:
20#   the file testfile_nvidia_linemap is a CUDA binary for an NVIDIA A100 generated as follows using CUDA 11.2
21#   nvcc -o main main.cu  -Xcompiler "-g -fopenmp" -O3 -lineinfo -arch sm_80  -lcudart -lcuda -lstdc++ -lm
22#   cuobjdump -xelf all main
23#   mv main.sm_80.cubin testfile_nvidia_linemap
24
25testfiles testfile_nvidia_linemap
26testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=line testfile_nvidia_linemap << EOF
27
28DWARF section [ 5] '.debug_line' at offset 0x3e0:
29
30Table at offset 0:
31
32 Length:                         253
33 DWARF version:                  2
34 Prologue length:                111
35 Address size:                   8
36 Segment selector size:          0
37 Min instruction length:         1
38 Max operations per instruction: 1
39 Initial value if 'is_stmt':     1
40 Line base:                      -5
41 Line range:                     14
42 Opcode base:                    10
43
44Opcodes:
45  [1]  0 arguments
46  [2]  1 argument
47  [3]  1 argument
48  [4]  1 argument
49  [5]  1 argument
50  [6]  0 arguments
51  [7]  0 arguments
52  [8]  0 arguments
53  [9]  1 argument
54
55Directory table:
56 /home/johnmc/hpctoolkit-gpu-samples/nvidia_extended_linemap4
57
58File name table:
59 Entry Dir   Time      Size      Name
60 1     1     1626104146 1819      main.cu
61 2     1     1626104111 211       bar.h
62
63Line number statements:
64 [    79] extended opcode 2:  set address to 0 <kernel>
65 [    84] set file to 1
66 [    86] advance line by constant 24 to 25
67 [    88] copy
68 [    89] special opcode 240: address+16 = 0x10 <kernel+0x10>, line+1 = 26
69 [    8a] advance line by constant 1 to 27
70 [    8c] advance address by 48 to 0x40 <kernel+0x40>
71 [    8e] copy
72 [    8f] advance line by constant -2 to 25
73 [    91] advance address by 80 to 0x90 <kernel+0x90>
74 [    94] copy
75 [    95] special opcode 242: address+16 = 0xa0 <kernel+0xa0>, line+3 = 28
76 [    96] advance address by 96 to 0x100 <kernel+0x100>
77 [    99] copy
78 [    9a] extended opcode 144:  set inlined context 6, function name foo (0x0)
79 [    9f] advance line by constant -20 to 8
80 [    a1] copy
81 [    a2] advance line by constant 1 to 9
82 [    a4] advance address by 80 to 0x150 <kernel+0x150>
83 [    a7] copy
84 [    a8] extended opcode 144:  set inlined context 0, function name foo (0x0)
85 [    ad] advance line by constant 22 to 31
86 [    af] advance address by 144 to 0x1e0 <kernel+0x1e0>
87 [    b2] copy
88 [    b3] set file to 2
89 [    b5] extended opcode 144:  set inlined context 9, function name bar (0x4)
90 [    ba] advance line by constant -25 to 6
91 [    bc] copy
92 [    bd] set file to 1
93 [    bf] extended opcode 144:  set inlined context 10, function name foo (0x0)
94 [    c4] advance line by constant 2 to 8
95 [    c6] copy
96 [    c7] advance line by constant 1 to 9
97 [    c9] advance address by 64 to 0x220 <kernel+0x220>
98 [    cc] copy
99 [    cd] set file to 2
100 [    cf] extended opcode 144:  set inlined context 9, function name bar (0x4)
101 [    d4] advance line by constant -2 to 7
102 [    d6] advance address by 144 to 0x2b0 <kernel+0x2b0>
103 [    d9] copy
104 [    da] advance line by constant 1 to 8
105 [    dc] advance address by 64 to 0x2f0 <kernel+0x2f0>
106 [    df] copy
107 [    e0] set file to 1
108 [    e2] extended opcode 144:  set inlined context 14, function name _Z1aPiS_S_ (0x8)
109 [    e7] advance line by constant 10 to 18
110 [    e9] copy
111 [    ea] advance line by constant 1 to 19
112 [    ec] advance address by 64 to 0x330 <kernel+0x330>
113 [    ef] copy
114 [    f0] extended opcode 144:  set inlined context 0, function name foo (0x0)
115 [    f5] advance line by constant 14 to 33
116 [    f7] advance address by 144 to 0x3c0 <kernel+0x3c0>
117 [    fa] copy
118 [    fb] advance address by 192 to 0x480
119 [    fe] extended opcode 1:  end of sequence
120EOF
121