Home | History | Annotate | Line # | Download | only in gdb.rocm
      1 # Copyright 2021-2024 Free Software Foundation, Inc.
      2 
      3 # This file is part of GDB.
      4 
      5 # This program 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 # This program is distributed in the hope that it will be useful,
     11 # but 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 # Test that the "set amdgpu precise-memory" setting is inherited by an inferior
     19 # created following an exec.
     20 
     21 load_lib rocm.exp
     22 
     23 require allow_hipcc_tests
     24 
     25 standard_testfile .c
     26 
     27 if {[build_executable "failed to prepare $testfile" $testfile $srcfile {debug}]} {
     28     return
     29 }
     30 
     31 proc do_test { follow-exec-mode } {
     32     clean_restart $::binfile
     33 
     34     with_rocm_gpu_lock {
     35 	if ![runto_main] {
     36 	    return
     37 	}
     38 
     39 	# Set precise-memory on the inferior before exec.
     40 	gdb_test "show amdgpu precise-memory" " is off.*" \
     41 	    "show amdgpu precise-memory before set"
     42 	gdb_test "set amdgpu precise-memory on"
     43 	gdb_test "show amdgpu precise-memory" " is on.*" \
     44 	    "show amdgpu precise-memory after set"
     45 
     46 	# Continue past exec.  The precise-memory setting should
     47 	# be on.
     48 	gdb_test_no_output "set follow-exec-mode ${follow-exec-mode}"
     49 	gdb_test "break second"
     50 	gdb_test "continue" "Breakpoint 1(\.$::decimal)?, main .*"
     51 	gdb_test "show amdgpu precise-memory" " is on.*" \
     52 	    "show amdgpu precise-memory after exec"
     53     }
     54 }
     55 
     56 foreach_with_prefix follow-exec-mode {same new} {
     57     do_test ${follow-exec-mode}
     58 }
     59