[binutils-gdb] Avoid minimal language when DW_LANG_HIP is used.

Simon Marchi simark@sourceware.org
Fri Feb 27 19:31:35 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0c135aa3c53353109677dc0485d5309b8b1bda72

commit 0c135aa3c53353109677dc0485d5309b8b1bda72
Author: Allyson Cauble-Chantrenne <acaublec@amd.com>
Date:   Tue Feb 17 13:50:37 2026 -0600

    Avoid minimal language when DW_LANG_HIP is used.
    
    AMD clang is going to start using DW_LANG_HIP instead of
    DW_LANG_C_plus_plus_14 (see PR at
    https://github.com/llvm/llvm-project/pull/181738). Rather than
    falling back to the minimal language, this commit ensures that
    GDB will still treat it like a C++ app. The commit also adds
    a test to an existing one.
    
    Approved-By: Tom Tromey <tom@tromey.com>
    Change-Id: Idc7f18d154036ffceaa0a28032eabb19f110bb11

Diff:
---
 gdb/dwarf2/read.c                           | 1 +
 gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 302b137526f..a6244319f71 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -15147,6 +15147,7 @@ dwarf_lang_to_enum_language (ULONGEST lang)
     case DW_LANG_C_plus_plus_17:
     case DW_LANG_C_plus_plus_20:
     case DW_LANG_C_plus_plus_23:
+    case DW_LANG_HIP:
       language = language_cplus;
       break;
     case DW_LANG_D:
diff --git a/gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp b/gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp
index 0c15cd5a988..e4c9177575e 100644
--- a/gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp
+++ b/gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp
@@ -67,7 +67,7 @@ proc do_test {cu_lang gdb_lang} {
 }
 
 proc do_test_with_prefix {cu_lang gdb_lang} {
-    with_test_prefix $gdb_lang {
+    with_test_prefix $cu_lang {
 	do_test $cu_lang $gdb_lang
     }
 }
@@ -77,3 +77,6 @@ proc do_test_with_prefix {cu_lang gdb_lang} {
 # fallback.
 do_test_with_prefix DW_LANG_C "c"
 do_test_with_prefix DW_LANG_C_plus_plus "c\\+\\+"
+
+# Check that HIP shows c++ and not minimal
+do_test_with_prefix DW_LANG_HIP "c\\+\\+"


More information about the Gdb-cvs mailing list