binutils-gdb/gdbsupport/Makefile.am
Andrew Burgess 67470b3532 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-10 17:36:21 +01:00

100 lines
2.4 KiB
Makefile

## Process this file with automake to generate Makefile.in
#
# Copyright (C) 2020-2024 Free Software Foundation, Inc.
#
# This file 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; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
#
AUTOMAKE_OPTIONS = no-dist foreign
ACLOCAL_AMFLAGS = -I . -I ../config
# Suppress 'configure.ac: error: AM_GNU_GETTEXT used but SUBDIRS not defined'
# from Automake, as gdbsupport uses AM_GNU_GETTEXT through
# ZW_GNU_GETTEXT_SISTER_DIR, but doesn't have any translations (currently).
SUBDIRS =
AM_CPPFLAGS = \
-I$(srcdir)/../include \
-I$(srcdir)/../gdb \
-I../gnulib/import \
-I$(srcdir)/../gnulib/import \
-I.. \
-I$(srcdir)/.. \
$(INCINTL) \
-I../bfd \
-I$(srcdir)/../bfd \
-include $(srcdir)/common-defs.h \
@LARGEFILE_CPPFLAGS@
override CXX += $(CXX_DIALECT)
AM_CXXFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
noinst_LIBRARIES = libgdbsupport.a
if SELFTEST
selftest = selftest.cc
endif
if HAVE_PIPE_OR_PIPE2
eventpipe = event-pipe.cc
endif
libgdbsupport_a_SOURCES = \
agent.cc \
btrace-common.cc \
cleanups.cc \
common-debug.cc \
common-exceptions.cc \
common-inferior.cc \
common-regcache.cc \
common-utils.cc \
environ.cc \
errors.cc \
event-loop.cc \
fileio.cc \
filestuff.cc \
format.cc \
gdb-dlfcn.cc \
gdb_obstack.cc \
gdb_regex.cc \
gdb_tilde_expand.cc \
gdb_wait.cc \
gdb_vecs.cc \
job-control.cc \
netstuff.cc \
new-op.cc \
osabi.cc \
pathstuff.cc \
print-utils.cc \
ptid.cc \
rsp-low.cc \
run-time-clock.cc \
safe-strerror.cc \
scoped_mmap.cc \
search.cc \
signals.cc \
signals-state-save-restore.cc \
task-group.cc \
tdesc.cc \
thread-pool.cc \
xml-utils.cc \
${eventpipe} \
$(selftest)
# Double-check that no defines are missing from our configury.
check-defines:
cd $(srcdir) && emacs --script check-defines.el