Update copyright and license
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.rocm / show-info.exp
CommitLineData
ec980634 1# Copyright (C) 2019-2020 Free Software Foundation, Inc.
2# Copyright (C) 2019-2020 Advanced Micro Devices, Inc. All rights reserved.
44a6f9b3 3
ec980634 4# This file is part of GDB.
44a6f9b3 5
6# This program 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.
ec980634 10
44a6f9b3 11# This program is distributed in the hope that it will be useful,
12# but 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.
ec980634 15
44a6f9b3 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
19load_lib rocm.exp
20
83bd8cbb 21set testfile "show-info"
44a6f9b3 22set srcfile ${srcdir}/${subdir}/${testfile}.cpp
23set objfile [standard_output_file ${testfile}.o]
24set binfile [standard_output_file ${testfile}]
25
26
27# Check if skip hip tests
28if [skip_hipcc_tests] {
29 verbose "Skipping hip test: ${testfile}."
30 return 0
31}
32
33# Compile the hip program
34if {[prepare_for_testing "failed to prepare ${testfile}" $testfile $srcfile {debug hip}]} {
35 return -1
36}
37
38gdb_start
39
40# Load the hip program
41if {[gdb_load ${binfile}] == -1} {
42 verbose "failed to load program ${testfile}."
43 return -1
44}
45
46
47# Run to main and break
48if ![runto_main] {
49 fail "can't run to main and break in program ${testfile}."
50 return -1
51}
52
53
54#Set breakpoint in device code
55gdb_breakpoint "bit_extract_kernel" "allow-pending"
56gdb_continue_to_breakpoint "bit_extract_kernel"
57
58#Test1
59# Check info agents
60# vega10 sample output "1 43:00.0 vega10 4 56 4 10"
61# vega20 sample output "1 b1:00.0 vega20 4 60 4 10"
62gdb_test_sequence "info agents" "info agents" {
63 {Id\s+PCI Slot\s+Device Name\s+Shader Engines\s+Compute Units\s+SIMD/CU\s+Wavefronts/SIMD}
ec980634 64 {\d\s+\w+:\d+\.\d\s+\w+\s+\d+\s+\d+\s+\d+\s+\d+}
44a6f9b3 65}
66
67#Test2
68#Check info threads
69#sample output
70#* 5 AMDGPU Thread 1.1 (0,0,0)/0 "bit_extract_kernel" bit_extract_kernel () at bit_extract.cpp:38
71# 6 AMDGPU Thread 1.2 (0,0,0)/1 "bit_extract_kernel" __hip_get_block_dim_x ()
72gdb_test_sequence "info threads" "info threads" {
73 {\sId\s+Target\s+Id\s+Frame}
74 {.+\s+\d+\s+AMDGPU\sThread\s\d+\.\d+\s\(\d+,\d+,\d+\)/\d+.*}
75}
76
77#Test3
78#Show architecture info while debugging in device code
79#Sample output "The target architecture is set automatically (currently amdgcn:gfx906)"
80gdb_test_sequence "show architecture" "show architecture" {
81 {The target architecture is set automatically\s\(currently amdgcn:gfx\d+\)}
82}
83
84#Test4
85gdb_test_sequence "show convenience" "show convenience" {
86 {.+\$_thread = \d+.+}
87 {\$_wave_id = \"\(\d+,\d+,\d+\)/\d+\"}
88
89}
90
91#Test5
92#info sharedlibrary
93#sample output
94#From To Syms Read Shared Object Library
95#0x00007ffbdfe05000 0x00007ffbdfe07a2c Yes (*) AMDGPU shared object [loaded from memory 0xab9900..0xac3470]
96#0x00007ffbdc201000 0x00007ffbdc201c94 Yes AMDGPU shared object [loaded from memory 0x9b71d0..0x9bae28]
ec980634 97#Disabled test until complete fix for CODE URI is not in
98#gdb_test_sequence "info sharedlibrary" "info sharedlibrary" {
99# {From\s+To\s+Syms\s+Read\s+Shared Object Library}
100# {0x[0-9a-fA-F]+\s+0x[0-9a-fA-F]+\s+Yes\s\(\*\)\s+AMDGPU shared object.}
101# {0x[0-9a-fA-F]+\s+0x[0-9a-fA-F]+\s+Yes\s+AMDGPU shared object.}
102#}
103
44a6f9b3 104
105#Test6
106#info break
107#sample output
108#Num Type Disp Enb Address What
109#1 breakpoint keep y 0x0000000000400d49 in main(int, char**) at bit_extract.cpp:54
110# breakpoint already hit 1 time
111#2 breakpoint keep y 0x00007ffbdc2012dc in bit_extract_kernel() at bit_extract.cpp:38
112# breakpoint already hit 1 time
113gdb_test_sequence "info break" "info break" {
114 {Num\s+Type\s+Disp\sEnb Address\s+What}
115 {\d+\s+breakpoint\s+keep\s+y}
116 {breakpoint already hit\s\d+\stime}
117}
118
119#Test7
120#info inferiors
121# Num Description Executable
122#* 1 process 34544 /home/amd/rohit/samples/0_Intro/bit_extract/bit_extrac
123gdb_test_sequence "info inferiors" "info inferiors" {
124 {\s+Num\s+Description\s+Executable}
125 {\*\s\d+\s+process\s+\d+}
126}
127
2cc9b6f3 128set timeout 40
44a6f9b3 129gdb_test "clear bit_extract_kernel" "Deleted breakpoint.*"
130gdb_test "continue" {.+Inferior\s\d+.+\sexited\snormally.+}
131
132
133
134gdb_exit
This page took 0.035023 seconds and 4 git commands to generate.