# Copyright (C) 2026 Free Software Foundation, Inc. # Copyright (C) 2026 Advanced Micro Devices, Inc. All rights reserved. # This file is part of GDB. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Verify that GDB detects the HIP program language correctly based # on what the compiler has emitted as the DW_LANG attribute. load_lib rocm.exp require allow_hip_tests # The debug behavior this test checks is not reliable with # link-time optimization, so skip it for -flto builds. require no_lto standard_testfile hip-builtin-variables.cpp if {[prepare_for_testing "failed to prepare ${testfile}" \ $testfile $srcfile {debug hip}]} { return -1 } with_rocm_gpu_lock { if {![runto_main]} { return -1 } set dw_lang [compiler_dwarf_language] set test "expected compiler language" if {$dw_lang == "hip"} { set expected_re "hip" } elseif {$dw_lang == "cpp"} { set expected_re "c\\+\\+" } else { fail "$test (found \"$dw_lang\")" return } pass $test gdb_test "show language" \ "The current source language is \"auto; currently $expected_re\"\." \ "expected gdb language" }