binutils-gdb/gdbsupport/osabi.def

58 lines
2.1 KiB
Modula-2
Raw Permalink Normal View History

gdb: split osabi support between gdb/ and gdbsupport/ directories In future commits I want to call set_tdesc_osabi from gdbserver/ code. Currently the only version of set_tdesc_osabi available to gdbserver takes a string representing the osabi. The problem with this is that, having lots of calls to set_tdesc_osabi which all take a string is an invite for a typo to slip in. This typo could potentially go unnoticed until someone tries to debug the wrong combination of GDB and gdbserver, at which point GDB will fail to find the correct gdbarch because it doesn't understand the osabi string. It would be better if the set_tdesc_osabi calls in gdbserver could take an 'enum gdb_osabi' value and then convert this to the "correct" string internally. In this way we are guaranteed to always have a valid, known, osabi string. This commit splits the osabi related code, which currently lives entirely on the GDB side, between gdb/ and gdbsupport/. I've moved the enum definition along with the array of osabi names into gdbsupport/. Then all the functions that access the names list, and which convert between names and enum values are also moved. I've taken the opportunity of this move to add a '.def' file which contains all the enum names along with the name strings. This '.def' file is then used to create 'enum gdb_osabi' as well as the array of osabi name strings. By using a '.def' file we know that the enum order will always match the name string array. This commit is just a refactor, there are no user visible changes after this commit. This commit doesn't change how gdbserver sets the target description osabi string, that will come in the next commit. Approved-By: Luis Machado <luis.machado@arm.com> Approved-By: Simon Marchi <simon.marchi@efficios.com>
2024-10-08 17:21:59 +08:00
/* OS ABI variant definitions for GDB and gdbserver.
Copyright (C) 2001-2024 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Each definition in this file is an osabi known to GDB.
The first argument is used to create the enum name and is appended
to 'GDB_OSABI_'.
The second argument is the osabi name. These strings can't be
changed _ever_ as gdbserver will emit these. Changing these
strings would break compatibility with already released versions of
GDB and/or gdbserver.
The third argument is a regexp which matches against a target
triplet. */
GDB_OSABI_DEF_FIRST (UNKNOWN, "unknown", nullptr)
GDB_OSABI_DEF (NONE, "none", nullptr)
GDB_OSABI_DEF (SVR4, "SVR4", nullptr)
GDB_OSABI_DEF (HURD, "GNU/Hurd", nullptr)
GDB_OSABI_DEF (SOLARIS, "Solaris", nullptr)
GDB_OSABI_DEF (LINUX, "GNU/Linux", "linux(-gnu[^-]*)?")
GDB_OSABI_DEF (FREEBSD, "FreeBSD", nullptr)
GDB_OSABI_DEF (NETBSD, "NetBSD", nullptr)
GDB_OSABI_DEF (OPENBSD, "OpenBSD", nullptr)
GDB_OSABI_DEF (WINCE, "WindowsCE", nullptr)
GDB_OSABI_DEF (GO32, "DJGPP", nullptr)
GDB_OSABI_DEF (CYGWIN, "Cygwin", nullptr)
GDB_OSABI_DEF (WINDOWS, "Windows", nullptr)
GDB_OSABI_DEF (AIX, "AIX", nullptr)
GDB_OSABI_DEF (DICOS, "DICOS", nullptr)
GDB_OSABI_DEF (DARWIN, "Darwin", nullptr)
GDB_OSABI_DEF (OPENVMS, "OpenVMS", nullptr)
GDB_OSABI_DEF (LYNXOS178, "LynxOS178", nullptr)
GDB_OSABI_DEF (NEWLIB, "Newlib", nullptr)
GDB_OSABI_DEF (SDE, "SDE", nullptr)
GDB_OSABI_DEF (PIKEOS, "PikeOS", nullptr)
GDB_OSABI_DEF_LAST (INVALID, "<invalid>", nullptr)