mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 01:07:52 +00:00
Synchronize the dwarf2.h and dwarf2.def files with their gcc counterparts, bringing the definitions of DW_AT_language_name and DW_AT_language_version. Add code to binutils/dwarf.c to display these attributes.
This commit is contained in:
@@ -1825,6 +1825,74 @@ get_AT_name (unsigned long attribute)
|
||||
return name;
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_AT_language_name (unsigned long value)
|
||||
{
|
||||
/* Libiberty does not (yet) provide a get_DW_AT_language_name()
|
||||
function so we define our own. */
|
||||
|
||||
switch (value)
|
||||
{
|
||||
case DW_LNAME_Ada: return "Ada";
|
||||
case DW_LNAME_BLISS: return "BLISS";
|
||||
case DW_LNAME_C: return "C";
|
||||
case DW_LNAME_C_plus_plus: return "C_plus_plus";
|
||||
case DW_LNAME_Cobol: return "Cobol";
|
||||
case DW_LNAME_Crystal: return "Crystal";
|
||||
case DW_LNAME_D: return "D";
|
||||
case DW_LNAME_Dylan: return "Dylan";
|
||||
case DW_LNAME_Fortran: return "Fortran";
|
||||
case DW_LNAME_Go: return "Go";
|
||||
case DW_LNAME_Haskell: return "Haskell";
|
||||
case DW_LNAME_Java: return "Java";
|
||||
case DW_LNAME_Julia: return "Julia";
|
||||
case DW_LNAME_Kotlin: return "Kotlin";
|
||||
case DW_LNAME_Modula2: return "Modula2";
|
||||
case DW_LNAME_Modula3: return "Modula3";
|
||||
case DW_LNAME_ObjC: return "ObjC";
|
||||
case DW_LNAME_ObjC_plus_plus: return "ObjC_plus_plus";
|
||||
case DW_LNAME_OCaml: return "OCaml";
|
||||
case DW_LNAME_OpenCL_C: return "OpenCL_C";
|
||||
case DW_LNAME_Pascal: return "Pascal";
|
||||
case DW_LNAME_PLI: return "PLI";
|
||||
case DW_LNAME_Python: return "Python";
|
||||
case DW_LNAME_RenderScript: return "RenderScript";
|
||||
case DW_LNAME_Rust: return "Rust";
|
||||
case DW_LNAME_Swift: return "Swift";
|
||||
case DW_LNAME_UPC: return "UPC";
|
||||
case DW_LNAME_Zig: return "Zig";
|
||||
case DW_LNAME_Assembly: return "Assembly";
|
||||
case DW_LNAME_C_sharp: return "C_sharp";
|
||||
case DW_LNAME_Mojo: return "Mojo";
|
||||
case DW_LNAME_GLSL: return "GLSL";
|
||||
case DW_LNAME_GLSL_ES: return "GLSL_ES";
|
||||
case DW_LNAME_HLSL: return "HLSL";
|
||||
case DW_LNAME_OpenCL_CPP: return "OpenCL_CPP";
|
||||
case DW_LNAME_CPP_for_OpenCL: return "CPP_for_OpenCL";
|
||||
case DW_LNAME_SYCL: return "SYCL";
|
||||
case DW_LNAME_Ruby: return "Ruby";
|
||||
case DW_LNAME_Move: return "Move";
|
||||
case DW_LNAME_Hylo: return "Hylo";
|
||||
case DW_LNAME_HIP: return "HIP";
|
||||
case DW_LNAME_Odin: return "Odin";
|
||||
case DW_LNAME_P4: return "P4";
|
||||
case DW_LNAME_Metal: return "Metal";
|
||||
case DW_LNAME_Algol68: return "Algol68";
|
||||
default: break;
|
||||
}
|
||||
|
||||
static char buffer[100];
|
||||
|
||||
if (value >= DW_LNAME_lo_user && value <= DW_LNAME_hi_user)
|
||||
snprintf (buffer, sizeof (buffer), _("Implementation specific AT_language_name value: %lx"),
|
||||
value);
|
||||
else
|
||||
snprintf (buffer, sizeof (buffer), _("Unknown AT_language_name value: %lx"),
|
||||
value);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static void
|
||||
add_dwo_info (const char * value, uint64_t cu_offset, dwo_type type)
|
||||
{
|
||||
@@ -3147,6 +3215,14 @@ read_and_display_attr_value (unsigned long attribute,
|
||||
/* For some attributes we can display further information. */
|
||||
switch (attribute)
|
||||
{
|
||||
case DW_AT_language_name:
|
||||
printf ("\t(%s)", get_AT_language_name (uvalue));
|
||||
break;
|
||||
|
||||
case DW_AT_language_version:
|
||||
printf ("\t(%lu)", (unsigned long) uvalue);
|
||||
break;
|
||||
|
||||
case DW_AT_type:
|
||||
if (level >= 0 && level < MAX_CU_NESTING
|
||||
&& uvalue < (size_t) (end - start))
|
||||
|
||||
@@ -174,6 +174,11 @@ DW_TAG (DW_TAG_GNU_formal_parameter_pack, 0x4108)
|
||||
are properly part of DWARF 5. */
|
||||
DW_TAG (DW_TAG_GNU_call_site, 0x4109)
|
||||
DW_TAG (DW_TAG_GNU_call_site_parameter, 0x410a)
|
||||
|
||||
/* GNU annotation extension used by btf_decl_tag and btf_type_tag.
|
||||
See https://gcc.gnu.org/wiki/GNUAnnotationsDwarf . */
|
||||
DW_TAG (DW_TAG_GNU_annotation, 0x6001)
|
||||
|
||||
/* Extensions for UPC. See: http://dwarfstd.org/doc/DWARF4.pdf. */
|
||||
DW_TAG (DW_TAG_upc_shared_type, 0x8765)
|
||||
DW_TAG (DW_TAG_upc_strict_type, 0x8766)
|
||||
@@ -364,6 +369,9 @@ DW_AT (DW_AT_export_symbols, 0x89)
|
||||
DW_AT (DW_AT_deleted, 0x8a)
|
||||
DW_AT (DW_AT_defaulted, 0x8b)
|
||||
DW_AT (DW_AT_loclists_base, 0x8c)
|
||||
/* DWARF 6. */
|
||||
DW_AT (DW_AT_language_name, 0x90)
|
||||
DW_AT (DW_AT_language_version, 0x91)
|
||||
|
||||
DW_AT_DUP (DW_AT_lo_user, 0x2000) /* Implementation-defined range start. */
|
||||
DW_AT_DUP (DW_AT_hi_user, 0x3fff) /* Implementation-defined range end. */
|
||||
@@ -453,6 +461,9 @@ DW_AT (DW_AT_GNU_pubtypes, 0x2135)
|
||||
DW_AT (DW_AT_GNU_discriminator, 0x2136)
|
||||
DW_AT (DW_AT_GNU_locviews, 0x2137)
|
||||
DW_AT (DW_AT_GNU_entry_view, 0x2138)
|
||||
/* GNU annotation extension used by btf_decl_tag and btf_type_tag.
|
||||
See https://gcc.gnu.org/wiki/GNUAnnotationsDwarf . */
|
||||
DW_AT (DW_AT_GNU_annotation, 0x2139)
|
||||
/* VMS extensions. */
|
||||
DW_AT (DW_AT_VMS_rtnbeg_pd_address, 0x2201)
|
||||
/* GNAT extensions. */
|
||||
|
||||
@@ -409,9 +409,10 @@ enum dwarf_source_language
|
||||
DW_LANG_Ruby = 0x0040,
|
||||
DW_LANG_Move = 0x0041,
|
||||
DW_LANG_Hylo = 0x0042,
|
||||
DW_LANG_Algol68 = 0x0044,
|
||||
|
||||
DW_LANG_lo_user = 0x8000, /* Implementation-defined range start. */
|
||||
DW_LANG_hi_user = 0xffff, /* Implementation-defined range start. */
|
||||
DW_LANG_hi_user = 0xffff, /* Implementation-defined range end. */
|
||||
|
||||
/* MIPS. */
|
||||
DW_LANG_Mips_Assembler = 0x8001,
|
||||
@@ -428,6 +429,60 @@ enum dwarf_source_language
|
||||
DW_LANG_Rust_old = 0x9000
|
||||
};
|
||||
|
||||
/* DWARF 6 source language names and codes. */
|
||||
enum dwarf_source_language_name
|
||||
{
|
||||
/* https://dwarfstd.org/languages-v6.html */
|
||||
DW_LNAME_Ada = 0x0001,
|
||||
DW_LNAME_BLISS = 0x0002,
|
||||
DW_LNAME_C = 0x0003,
|
||||
DW_LNAME_C_plus_plus = 0x0004,
|
||||
DW_LNAME_Cobol = 0x0005,
|
||||
DW_LNAME_Crystal = 0x0006,
|
||||
DW_LNAME_D = 0x0007,
|
||||
DW_LNAME_Dylan = 0x0008,
|
||||
DW_LNAME_Fortran = 0x0009,
|
||||
DW_LNAME_Go = 0x000a,
|
||||
DW_LNAME_Haskell = 0x000b,
|
||||
DW_LNAME_Java = 0x000c,
|
||||
DW_LNAME_Julia = 0x000d,
|
||||
DW_LNAME_Kotlin = 0x000e,
|
||||
DW_LNAME_Modula2 = 0x000f,
|
||||
DW_LNAME_Modula3 = 0x0010,
|
||||
DW_LNAME_ObjC = 0x0011,
|
||||
DW_LNAME_ObjC_plus_plus = 0x0012,
|
||||
DW_LNAME_OCaml = 0x0013,
|
||||
DW_LNAME_OpenCL_C = 0x0014,
|
||||
DW_LNAME_Pascal = 0x0015,
|
||||
DW_LNAME_PLI = 0x0016,
|
||||
DW_LNAME_Python = 0x0017,
|
||||
DW_LNAME_RenderScript = 0x0018,
|
||||
DW_LNAME_Rust = 0x0019,
|
||||
DW_LNAME_Swift = 0x001a,
|
||||
DW_LNAME_UPC = 0x001b,
|
||||
DW_LNAME_Zig = 0x001c,
|
||||
DW_LNAME_Assembly = 0x001d,
|
||||
DW_LNAME_C_sharp = 0x001e,
|
||||
DW_LNAME_Mojo = 0x001f,
|
||||
DW_LNAME_GLSL = 0x0020,
|
||||
DW_LNAME_GLSL_ES = 0x0021,
|
||||
DW_LNAME_HLSL = 0x0022,
|
||||
DW_LNAME_OpenCL_CPP = 0x0023,
|
||||
DW_LNAME_CPP_for_OpenCL = 0x0024,
|
||||
DW_LNAME_SYCL = 0x0025,
|
||||
DW_LNAME_Ruby = 0x0026,
|
||||
DW_LNAME_Move = 0x0027,
|
||||
DW_LNAME_Hylo = 0x0028,
|
||||
DW_LNAME_HIP = 0x0029,
|
||||
DW_LNAME_Odin = 0x002a,
|
||||
DW_LNAME_P4 = 0x002b,
|
||||
DW_LNAME_Metal = 0x002c,
|
||||
DW_LNAME_Algol68 = 0x002e,
|
||||
|
||||
DW_LNAME_lo_user = 0x8000, /* Implementation-defined range start. */
|
||||
DW_LNAME_hi_user = 0xffff /* Implementation-defined range end. */
|
||||
};
|
||||
|
||||
/* Names and codes for macro information. */
|
||||
enum dwarf_macinfo_record_type
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user