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