1 /* DWARF stringify code
3 Copyright (C) 1994-2022 Free Software Foundation, Inc.
5 Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
6 Inc. with support from Florida State University (under contract
7 with the Ada Joint Program Office), and Silicon Graphics, Inc.
8 Initial contribution by Brent Benson, Harris Computer Systems, Inc.,
9 based on Fred Fish's (Cygnus Support) implementation of DWARF 1
12 This file is part of GDB.
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 3 of the License, or
17 (at your option) any later version.
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program. If not, see <http://www.gnu.org/licenses/>. */
29 #include "dwarf2/stringify.h"
31 /* A convenience function that returns an "unknown" DWARF name,
32 including the value of V. STR is the name of the entity being
33 printed, e.g., "TAG". */
36 dwarf_unknown (const char *str
, unsigned v
)
38 char *cell
= get_print_cell ();
39 xsnprintf (cell
, PRINT_CELL_SIZE
, "DW_%s_<unknown: %u>", str
, v
);
43 /* See stringify.h. */
46 dwarf_tag_name (unsigned tag
)
48 const char *name
= get_DW_TAG_name (tag
);
51 return dwarf_unknown ("TAG", tag
);
56 /* See stringify.h. */
59 dwarf_attr_name (unsigned attr
)
63 #ifdef MIPS /* collides with DW_AT_HP_block_index */
64 if (attr
== DW_AT_MIPS_fde
)
65 return "DW_AT_MIPS_fde";
67 if (attr
== DW_AT_HP_block_index
)
68 return "DW_AT_HP_block_index";
71 name
= get_DW_AT_name (attr
);
74 return dwarf_unknown ("AT", attr
);
79 /* See stringify.h. */
82 dwarf_form_name (unsigned form
)
84 const char *name
= get_DW_FORM_name (form
);
87 return dwarf_unknown ("FORM", form
);
92 /* See stringify.h. */
95 dwarf_bool_name (unsigned mybool
)
103 /* See stringify.h. */
106 dwarf_type_encoding_name (unsigned enc
)
108 const char *name
= get_DW_ATE_name (enc
);
111 return dwarf_unknown ("ATE", enc
);
116 /* See stringify.h. */
119 dwarf_unit_type_name (int unit_type
)
121 const char *name
= get_DW_UT_name (unit_type
);
124 return dwarf_unknown ("UT", unit_type
);