xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/dwarf2/sect-names.h (revision 6881a4007f077b54e5f51159c52b9b25f57deb0d)
1*6881a400Schristos /* DWARF 2 section names.
2*6881a400Schristos 
3*6881a400Schristos    Copyright (C) 1990-2023 Free Software Foundation, Inc.
4*6881a400Schristos 
5*6881a400Schristos    This file is part of GDB.
6*6881a400Schristos 
7*6881a400Schristos    This program is free software; you can redistribute it and/or modify
8*6881a400Schristos    it under the terms of the GNU General Public License as published by
9*6881a400Schristos    the Free Software Foundation; either version 3 of the License, or
10*6881a400Schristos    (at your option) any later version.
11*6881a400Schristos 
12*6881a400Schristos    This program is distributed in the hope that it will be useful,
13*6881a400Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
14*6881a400Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*6881a400Schristos    GNU General Public License for more details.
16*6881a400Schristos 
17*6881a400Schristos    You should have received a copy of the GNU General Public License
18*6881a400Schristos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19*6881a400Schristos 
20*6881a400Schristos #ifndef GDB_DWARF2_SECT_NAMES_H
21*6881a400Schristos #define GDB_DWARF2_SECT_NAMES_H
22*6881a400Schristos 
23*6881a400Schristos /* Names for a dwarf2 debugging section.  The field NORMAL is the normal
24*6881a400Schristos    section name (usually from the DWARF standard), while the field COMPRESSED
25*6881a400Schristos    is the name of compressed sections.  If your object file format doesn't
26*6881a400Schristos    support compressed sections, the field COMPRESSED can be NULL.  Likewise,
27*6881a400Schristos    the debugging section is not supported, the field NORMAL can be NULL too.
28*6881a400Schristos    It doesn't make sense to have a NULL NORMAL field but a non-NULL COMPRESSED
29*6881a400Schristos    field.  */
30*6881a400Schristos 
31*6881a400Schristos struct dwarf2_section_names {
32*6881a400Schristos   const char *normal;
33*6881a400Schristos   const char *compressed;
34*6881a400Schristos 
35*6881a400Schristos   /* Return true if NAME matches either of this section's names.  */
36*6881a400Schristos   bool matches (const char *name) const
37*6881a400Schristos   {
38*6881a400Schristos     return ((normal != nullptr && strcmp (name, normal) == 0)
39*6881a400Schristos 	    || (compressed != nullptr && strcmp (name, compressed) == 0));
40*6881a400Schristos   }
41*6881a400Schristos };
42*6881a400Schristos 
43*6881a400Schristos /* List of names for dward2 debugging sections.  Also most object file formats
44*6881a400Schristos    use the standardized (ie ELF) names, some (eg XCOFF) have customized names
45*6881a400Schristos    due to restrictions.
46*6881a400Schristos    The table for the standard names is defined in dwarf2read.c.  Please
47*6881a400Schristos    update all instances of dwarf2_debug_sections if you add a field to this
48*6881a400Schristos    structure.  It is always safe to use { NULL, NULL } in this case.  */
49*6881a400Schristos 
50*6881a400Schristos struct dwarf2_debug_sections {
51*6881a400Schristos   struct dwarf2_section_names info;
52*6881a400Schristos   struct dwarf2_section_names abbrev;
53*6881a400Schristos   struct dwarf2_section_names line;
54*6881a400Schristos   struct dwarf2_section_names loc;
55*6881a400Schristos   struct dwarf2_section_names loclists;
56*6881a400Schristos   struct dwarf2_section_names macinfo;
57*6881a400Schristos   struct dwarf2_section_names macro;
58*6881a400Schristos   struct dwarf2_section_names str;
59*6881a400Schristos   struct dwarf2_section_names str_offsets;
60*6881a400Schristos   struct dwarf2_section_names line_str;
61*6881a400Schristos   struct dwarf2_section_names ranges;
62*6881a400Schristos   struct dwarf2_section_names rnglists;
63*6881a400Schristos   struct dwarf2_section_names types;
64*6881a400Schristos   struct dwarf2_section_names addr;
65*6881a400Schristos   struct dwarf2_section_names frame;
66*6881a400Schristos   struct dwarf2_section_names eh_frame;
67*6881a400Schristos   struct dwarf2_section_names gdb_index;
68*6881a400Schristos   struct dwarf2_section_names debug_names;
69*6881a400Schristos   struct dwarf2_section_names debug_aranges;
70*6881a400Schristos   /* This field has no meaning, but exists solely to catch changes to
71*6881a400Schristos      this structure which are not reflected in some instance.  */
72*6881a400Schristos   int sentinel;
73*6881a400Schristos };
74*6881a400Schristos 
75*6881a400Schristos /* Section names for ELF.  */
76*6881a400Schristos extern const struct dwarf2_debug_sections dwarf2_elf_names;
77*6881a400Schristos 
78*6881a400Schristos #endif /* GDB_DWARF2_SECT_NAMES_H */
79