The DWARF standard recently added language constants for Erlang,
Elixir and Gleam. https://dwarfstd.org/languages.html
https://dwarfstd.org/languages-v6.html

        * libdw/dwarf.h: Add DW_LANG_Erlang, DW_LNAME_Erlang,
        DW_LANG_Elixir, DW_LNAME_Elixir, DW_LANG_Gleam and
        DW_LNAME_Gleam.
        * libdw/dwarf_default_lower_bound.c
        (dwarf_default_lower_bound): Add DW_LANG_Gleam, DW_LANG_Erlang
        and DW_LANG_Elixir.
        (dwarf_language_lower_bound): Add DW_LNAME_Gleam, DW_LNAME_Erlang
        and DW_LNAME_Elixir.
        * libdw/dwarf_srclang.c (srclang_to_language): Handle
        DW_LANG_Erlang, DW_LANG_Elixir and DW_LANG_Gleam.
        (language_to_srclang): Handle DW_LNAME_Erlang, DW_LNAME_Elixir
        and Add DW_LNAME_Gleam.

Signed-off-by: Mark Wielaard <[email protected]>
---
 libdw/dwarf.h                     |  6 ++++++
 libdw/dwarf_default_lower_bound.c |  6 ++++++
 libdw/dwarf_srclang.c             | 21 +++++++++++++++++++++
 3 files changed, 33 insertions(+)

diff --git a/libdw/dwarf.h b/libdw/dwarf.h
index e1808096ca5f..cc43727290cf 100644
--- a/libdw/dwarf.h
+++ b/libdw/dwarf.h
@@ -778,6 +778,9 @@ enum
     DW_LANG_V = 0x0043,                     /* V Programming Language */
     DW_LANG_Algol68 = 0x0044,       /* Algol68 */
     DW_LANG_Nim = 0x0045,           /* Nim */
+    DW_LANG_Erlang = 0x0046,        /* Erlang */
+    DW_LANG_Elixir = 0x0047,        /* Elixir */
+    DW_LANG_Gleam = 0x0048,         /* Gleam */
 
     DW_LANG_lo_user = 0x8000,
     DW_LANG_Mips_Assembler = 0x8001, /* Assembler */
@@ -837,6 +840,9 @@ enum
     DW_LNAME_V = 0x002d,
     DW_LNAME_Algol68 = 0x002e,
     DW_LNAME_Nim = 0x002f,
+    DW_LNAME_Erlang = 0x0030,
+    DW_LNAME_Elixir = 0x0031,
+    DW_LNAME_Gleam = 0x0032,
 
     DW_LNAME_lo_user = 0x8000,
     DW_LNAME_hi_user = 0xffff
diff --git a/libdw/dwarf_default_lower_bound.c 
b/libdw/dwarf_default_lower_bound.c
index 71a313fe577c..a729ed1fc860 100644
--- a/libdw/dwarf_default_lower_bound.c
+++ b/libdw/dwarf_default_lower_bound.c
@@ -90,6 +90,7 @@ dwarf_default_lower_bound (int lang, Dwarf_Sword *result)
     case DW_LANG_Hylo:
     case DW_LANG_V:
     case DW_LANG_Nim:
+    case DW_LANG_Gleam:
       *result = 0;
       return 0;
 
@@ -112,6 +113,8 @@ dwarf_default_lower_bound (int lang, Dwarf_Sword *result)
     case DW_LANG_Ada2012:
     case DW_LANG_Fortran23:
     case DW_LANG_Algol68:
+    case DW_LANG_Erlang:
+    case DW_LANG_Elixir:
       *result = 1;
       return 0;
 
@@ -172,6 +175,7 @@ dwarf_language_lower_bound (Dwarf_Word lang, Dwarf_Sword 
*result)
     case DW_LNAME_Metal:
     case DW_LNAME_V:
     case DW_LNAME_Nim:
+    case DW_LNAME_Gleam:
       *result = 0;
       return 0;
 
@@ -184,6 +188,8 @@ dwarf_language_lower_bound (Dwarf_Word lang, Dwarf_Sword 
*result)
     case DW_LNAME_Pascal:
     case DW_LNAME_PLI:
     case DW_LNAME_Algol68:
+    case DW_LNAME_Erlang:
+    case DW_LNAME_Elixir:
       *result = 1;
       return 0;
 
diff --git a/libdw/dwarf_srclang.c b/libdw/dwarf_srclang.c
index 10dfce8be3e3..3df13757be67 100644
--- a/libdw/dwarf_srclang.c
+++ b/libdw/dwarf_srclang.c
@@ -315,6 +315,18 @@ static int srclang_to_language (Dwarf_Word srclang,
       *lname = DW_LNAME_Nim;
       *lversion = 0;
       return 0;
+    case DW_LANG_Erlang:
+      *lname = DW_LNAME_Erlang;
+      *lversion = 0;
+      return 0;
+    case DW_LANG_Elixir:
+      *lname = DW_LNAME_Elixir;
+      *lversion = 0;
+      return 0;
+    case DW_LANG_Gleam:
+      *lname = DW_LNAME_Gleam;
+      *lversion = 0;
+      return 0;
     default:
       __libdw_seterrno (DWARF_E_UNKNOWN_LANGUAGE);
       return -1;
@@ -513,6 +525,15 @@ language_to_srclang (Dwarf_Word lname, Dwarf_Word 
lversion, Dwarf_Word *value)
     case DW_LNAME_Nim:
       *value = DW_LANG_Nim;
       return 0;
+    case DW_LNAME_Erlang:
+      *value = DW_LANG_Erlang;
+      return 0;
+    case DW_LNAME_Elixir:
+      *value = DW_LANG_Elixir;
+      return 0;
+    case DW_LNAME_Gleam:
+      *value = DW_LANG_Gleam;
+      return 0;
     default:
       __libdw_seterrno (DWARF_E_UNKNOWN_LANGUAGE);
       return -1;
-- 
2.52.0

Reply via email to