]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Recognize new DWARF5 DW_LANG constants
authorMark Wielaard <mark@klomp.org>
Fri, 6 Dec 2024 14:39:25 +0000 (15:39 +0100)
committerMark Wielaard <mark@klomp.org>
Mon, 9 Dec 2024 12:06:13 +0000 (13:06 +0100)
When using --read-var-info=yes readdwarf3 will try to read and
interpret the CU DW_AT_langauge attribute. Since DWARF5 was released a
number if new language constants have been introduced. See
https://dwarfstd.org/languages.html

GCC15 might start emitting some of these when switching to C23 by
default.

When valgrind --read-var-info=yes encounters an unknown DW_LANG
constant it will produce an error and stop processing any further
DWARF.

Recognize all currently known language constants. In particular
recognize DW_LANG_C17, DW_LANG_C23, DW_LANG_C_plus_plus_17,
DW_LANG_C_plus_plus_20, DW_LANG_C_plus_plus_23, DW_LANG_Fortran18,
DW_LANG_Fortran23, DW_LANG_Ada2005, DW_LANG_Ada2012 and DW_LANG_Rust.

https://bugs.kde.org/show_bug.cgi?id=497130

NEWS
coregrind/m_debuginfo/priv_d3basics.h
coregrind/m_debuginfo/readdwarf3.c

diff --git a/NEWS b/NEWS
index 2651600222f3aa0ad5a8b884f0156936d28ab2d0..06e42e577f9b85a598993ae821dab1ca2016197b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
 494337  All threaded applications cause still holding lock errors
 495488  Add FreeBSD getrlimitusage syscall wrapper
 496571  False positive for null key passed to bpf_map_get_next_key syscall.
+497130  Recognize new DWARF5 DW_LANG constants
 
 To see details of a given bug, visit
   https://bugs.kde.org/show_bug.cgi?id=XXXXXX
index 3f6e5c72c9e44a114829f10026c0681a2fa0b2a3..34c98728711cae46fbe82737cd448fab11445425 100644 (file)
@@ -179,6 +179,7 @@ typedef enum dwarf_source_language
     /* DWARF 4.  */
     DW_LANG_Python = 0x0014,
     /* DWARF 5.  */
+    DW_LANG_OpenCL = 0x0015,
     DW_LANG_Go = 0x0016,
     DW_LANG_Modula3 = 0x0017,
     DW_LANG_Haskell = 0x0018,
@@ -195,6 +196,36 @@ typedef enum dwarf_source_language
     DW_LANG_Fortran08 = 0x0023,
     DW_LANG_RenderScript = 0x0024,
     DW_LANG_BLISS = 0x0025,
+    /* Language codes added since DWARF 5.
+       https://dwarfstd.org/languages.html */
+    DW_LANG_Kotlin = 0x0026,
+    DW_LANG_Zig = 0x0027,
+    DW_LANG_Crystal = 0x0028,
+    DW_LANG_C_plus_plus_17 = 0x002a,
+    DW_LANG_C_plus_plus_20 = 0x002b,
+    DW_LANG_C17 = 0x002c,
+    DW_LANG_Fortran18 = 0x002d,
+    DW_LANG_Ada2005 = 0x002e,
+    DW_LANG_Ada2012 = 0x002f,
+    DW_LANG_HIP = 0x0030,
+    DW_LANG_Assembly = 0x0031,
+    DW_LANG_C_sharp = 0x0032,
+    DW_LANG_Mojo = 0x0033,
+    DW_LANG_GLSL = 0x0034,
+    DW_LANG_GLSL_ES = 0x0035,
+    DW_LANG_HLSL = 0x0036,
+    DW_LANG_OpenCL_CPP = 0x0037,
+    DW_LANG_CPP_for_OpenCL = 0x0038,
+    DW_LANG_SYCL = 0x0039,
+    DW_LANG_C_plus_plus_23 = 0x003a,
+    DW_LANG_Odin = 0x003b,
+    DW_LANG_P4 = 0x003c,
+    DW_LANG_Metal = 0x003d,
+    DW_LANG_C23 = 0x003e,
+    DW_LANG_Fortran23 = 0x003f,
+    DW_LANG_Ruby = 0x0040,
+    DW_LANG_Move = 0x0041,
+    DW_LANG_Hylo = 0x0042,
     /* MIPS.  */
     DW_LANG_Mips_Assembler = 0x8001,
     /* UPC.  */
index a4b75a8c532b206d6705941486f4a432a8ec6a3b..735896f7c0d386c5635cc179c3153f5ffe87678a 100644 (file)
@@ -3972,19 +3972,42 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents,
             case DW_LANG_C_plus_plus: case DW_LANG_ObjC:
             case DW_LANG_ObjC_plus_plus: case DW_LANG_UPC:
             case DW_LANG_Upc: case DW_LANG_C99: case DW_LANG_C11:
+            case DW_LANG_C17: case DW_LANG_C23:
             case DW_LANG_C_plus_plus_11: case DW_LANG_C_plus_plus_14:
+            case DW_LANG_C_plus_plus_17: case DW_LANG_C_plus_plus_20:
+            case DW_LANG_C_plus_plus_23:
                parser->language = 'C'; break;
             case DW_LANG_Fortran77: case DW_LANG_Fortran90:
             case DW_LANG_Fortran95: case DW_LANG_Fortran03:
-            case DW_LANG_Fortran08:
+            case DW_LANG_Fortran08: case DW_LANG_Fortran18:
+            case DW_LANG_Fortran23:
                parser->language = 'F'; break;
             case DW_LANG_Ada83: case DW_LANG_Ada95: 
+            case DW_LANG_Ada2005: case DW_LANG_Ada2012:
                parser->language = 'A'; break;
             case DW_LANG_Cobol74:
             case DW_LANG_Cobol85: case DW_LANG_Pascal83:
             case DW_LANG_Modula2: case DW_LANG_Java:
             case DW_LANG_PLI:
-            case DW_LANG_D: case DW_LANG_Python: case DW_LANG_Go:
+            case DW_LANG_D: case DW_LANG_Python:
+            case DW_LANG_OpenCL: case DW_LANG_Go:
+            case DW_LANG_Modula3: case DW_LANG_Haskell:
+            case DW_LANG_OCaml: case DW_LANG_Rust: case DW_LANG_Swift:
+            case DW_LANG_Julia: case DW_LANG_Dylan:
+            case DW_LANG_RenderScript: case DW_LANG_BLISS:
+            case DW_LANG_Kotlin: case DW_LANG_Zig:
+            case DW_LANG_Crystal: case DW_LANG_HIP:
+            case DW_LANG_Assembly: case DW_LANG_C_sharp:
+            case DW_LANG_Mojo: case DW_LANG_GLSL:
+            case DW_LANG_GLSL_ES: case DW_LANG_HLSL:
+            case DW_LANG_OpenCL_CPP: case DW_LANG_CPP_for_OpenCL:
+            case DW_LANG_SYCL:
+            case DW_LANG_Odin:
+            case DW_LANG_P4:
+            case DW_LANG_Metal:
+            case DW_LANG_Ruby:
+            case DW_LANG_Move:
+            case DW_LANG_Hylo:
             case DW_LANG_Mips_Assembler:
                parser->language = '?'; break;
             default: