]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: remove support for dbx from GDB
authorGuinevere Larsen <guinevere@redhat.com>
Wed, 12 Feb 2025 19:07:38 +0000 (16:07 -0300)
committerGuinevere Larsen <guinevere@redhat.com>
Tue, 21 Oct 2025 19:40:11 +0000 (16:40 -0300)
With the removal of stabs support, reading a dbx inferior has become a
no-op and GDB is unable to perform sybmolic debugging in such inferiors.
As such, this commit removes the files that work on it with spotty
support.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
gdb/Makefile.in
gdb/NEWS
gdb/configure
gdb/configure.ac
gdb/dbxread.c [deleted file]
gdb/gdb-stabs.h [deleted file]

index 381c064bc4ee833f7209570a8436cdf15ecf2dd9..c9cd98a75a88478e769eb1d522560e3083709ce9 100644 (file)
@@ -917,7 +917,6 @@ ALL_TARGET_OBS = \
 
 # Object files for reading specific types of debug information.
 coff_SRCS = coffread.c coff-pe-read.c
-dbx_SRCS = dbxread.c
 elf_SRCS = elfread.c stap-probe.c dtrace-probe.c
 macho_SRCS = machoread.c
 mips_SRCS = mipsread.c
@@ -1469,7 +1468,10 @@ HFILES_NO_SRCDIR = \
        gdb-demangle.h \
        gdb_expat.h \
        gdb_proc_service.h \
-       gdb-stabs.h \
+       gdb_vfork.h \
+       gdb_wchar.h \
+       gdbarch.h \
+       gdbcore.h \
        gdbthread.h \
        gdbtypes.h \
        gdb_vfork.h \
index 2c94e786f41906cb264d6c16c0a2d98fd37175b0..097d8da350bb106972a49d6e93d9d08f6c188b4d 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -33,6 +33,8 @@
 
 * Support for stabs debug information has been removed.
 
+* Support for the binary file format dbx has been removed.
+
 * New targets
 
 GNU/Linux/MicroBlaze (gdbserver) microblazeel-*linux*
index 55be281fbb4229fb4d74603000fa92ce19d55690..9993e3fcc66ecb8082e3d55e927f28af8d6c26ee 100755 (executable)
@@ -1651,8 +1651,8 @@ Optional Features:
                           alternative target configurations
   --enable-binary-file-formats=FORMATS
                           enable support for selected file formats (default
-                          'all') available formats: coff, dbx, elf, macho,
-                          mips, xcoff, all
+                          'all') available formats: coff, elf, macho, mips,
+                          xcoff, all
   --enable-gdb-mdebug-support
                           Enable support for the mdebug debuginfo format
                           (default 'yes')
@@ -31848,7 +31848,7 @@ WIN32LIBS="$WIN32LIBS $WIN32APILIBS"
 # Object files to be used when building with support for all file formats.
 # This should not have elf or macho, as support for those formats depends
 # on BFD enabling them as well.
-all_binary_file_srcs="\$(dbx_SRCS) \$(mips_SRCS) \$(coff_SRCS) \$(xcoff_SRCS)"
+all_binary_file_srcs="\$(mips_SRCS) \$(coff_SRCS) \$(xcoff_SRCS)"
 
 bfd_supports_elf=no
 # Add ELF support to GDB, but only if BFD includes ELF support.
index 9c258eedc757d44fe90e618f8ef203d87466076f..70247b00e80d98774f3972955d67a28da3a11926 100644 (file)
@@ -194,7 +194,7 @@ esac])
 AC_ARG_ENABLE(binary_file_formats,
              AS_HELP_STRING([--enable-binary-file-formats=FORMATS],
                             [enable support for selected file formats (default 'all')
-                             available formats: coff, dbx, elf, macho, mips, xcoff, all]),
+                             available formats: coff, elf, macho, mips, xcoff, all]),
 [case "${enableval}" in
  yes | "") AC_MSG_ERROR(enable-binary-file-formats option must specify file formats or 'all')
             ;;
@@ -1998,7 +1998,7 @@ WIN32LIBS="$WIN32LIBS $WIN32APILIBS"
 # Object files to be used when building with support for all file formats.
 # This should not have elf or macho, as support for those formats depends
 # on BFD enabling them as well.
-all_binary_file_srcs="\$(dbx_SRCS) \$(mips_SRCS) \$(coff_SRCS) \$(xcoff_SRCS)"
+all_binary_file_srcs="\$(mips_SRCS) \$(coff_SRCS) \$(xcoff_SRCS)"
 
 bfd_supports_elf=no
 # Add ELF support to GDB, but only if BFD includes ELF support.
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
deleted file mode 100644 (file)
index 0a6e13f..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-/* Read dbx symbol tables and convert to internal format, for GDB.
-   Copyright (C) 1986-2025 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/>.  */
-
-/* This module provides three functions: dbx_symfile_init,
-   which initializes to read a symbol file; dbx_new_init, which
-   discards existing cached information when all symbols are being
-   discarded; and dbx_symfile_read, which reads a symbol table
-   from a file.
-
-   dbx_symfile_read only does the minimum work necessary for letting the
-   user "name" things symbolically; it does not read the entire symtab.
-   Instead, it reads the external and static symbols and puts them in partial
-   symbol tables.  When more extensive information is requested of a
-   file, the corresponding partial symbol table is mutated into a full
-   fledged symbol table by going back and reading the symbols
-   for real.  dbx_psymtab_to_symtab() is the function that does this */
-
-
-#include <sys/stat.h>
-#include "symtab.h"
-#include "target.h"
-#include "libaout.h"
-#include "objfiles.h"
-#include "buildsym-legacy.h"
-#include "gdb-stabs.h"
-#include "cp-support.h"
-#include "c-lang.h"
-#include "psymtab.h"
-#include "block.h"
-#include "aout/aout64.h"
-#include "aout/stab_gnu.h"
-
-/* Local function prototypes.  */
-
-static void dbx_symfile_init (struct objfile *);
-
-static void dbx_new_init (struct objfile *);
-
-static void dbx_symfile_read (struct objfile *, symfile_add_flags);
-
-static void dbx_symfile_finish (struct objfile *);
-
-
-#if 0
-static struct type **
-explicit_lookup_type (int real_filenum, int index)
-{
-  struct header_file *f = &HEADER_FILES (dbxread_objfile)[real_filenum];
-
-  if (index >= f->length)
-    {
-      f->length *= 2;
-      f->vector = (struct type **)
-       xrealloc (f->vector, f->length * sizeof (struct type *));
-      memset (&f->vector[f->length / 2],
-             '\0', f->length * sizeof (struct type *) / 2);
-    }
-  return &f->vector[index];
-}
-#endif
-\f
-
-const registry<objfile>::key<dbx_symfile_info> dbx_objfile_data_key;
-
-/* This could leak memory, but it will be removed soon, so it
-   shouldn't have a large impact.  */
-dbx_symfile_info::~dbx_symfile_info ()
-{
-}
-
-/* Scan and build partial symbols for a symbol file.
-   We have been initialized by a call to dbx_symfile_init, which
-   put all the relevant info into a "struct dbx_symfile_info",
-   hung off the objfile structure.  */
-
-static void
-dbx_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
-{
-}
-
-/* Initialize anything that needs initializing when a completely new
-   symbol file is specified (not just adding some symbols from another
-   file, e.g. a shared library).  */
-
-static void
-dbx_new_init (struct objfile *ignore)
-{
-}
-
-
-/* dbx_symfile_init ()
-   is the dbx-specific initialization routine for reading symbols.
-   It is passed a struct objfile which contains, among other things,
-   the BFD for the file whose symbols are being read, and a slot for a pointer
-   to "private data" which we fill with goodies.
-
-   We read the string table into malloc'd space and stash a pointer to it.
-
-   Since BFD doesn't know how to read debug symbols in a format-independent
-   way (and may never do so...), we have to do it ourselves.  We will never
-   be called unless this is an a.out (or very similar) file.
-   FIXME, there should be a cleaner peephole into the BFD environment here.  */
-
-#define DBX_STRINGTAB_SIZE_SIZE sizeof(long)   /* FIXME */
-
-static void
-dbx_symfile_init (struct objfile *objfile)
-{
-  int val;
-  bfd *sym_bfd = objfile->obfd.get ();
-  const char *name = bfd_get_filename (sym_bfd);
-  asection *text_sect;
-  unsigned char size_temp[DBX_STRINGTAB_SIZE_SIZE];
-
-  /* Allocate struct to keep track of the symfile.  */
-  dbx_objfile_data_key.emplace (objfile);
-
-  DBX_TEXT_SECTION (objfile) = bfd_get_section_by_name (sym_bfd, ".text");
-  DBX_DATA_SECTION (objfile) = bfd_get_section_by_name (sym_bfd, ".data");
-  DBX_BSS_SECTION (objfile) = bfd_get_section_by_name (sym_bfd, ".bss");
-
-  /* FIXME POKING INSIDE BFD DATA STRUCTURES.  */
-#define        STRING_TABLE_OFFSET     (sym_bfd->origin + obj_str_filepos (sym_bfd))
-#define        SYMBOL_TABLE_OFFSET     (sym_bfd->origin + obj_sym_filepos (sym_bfd))
-
-  /* FIXME POKING INSIDE BFD DATA STRUCTURES.  */
-
-  text_sect = bfd_get_section_by_name (sym_bfd, ".text");
-  if (!text_sect)
-    error (_("Can't find .text section in symbol file"));
-  DBX_TEXT_ADDR (objfile) = bfd_section_vma (text_sect);
-  DBX_TEXT_SIZE (objfile) = bfd_section_size (text_sect);
-
-  DBX_SYMBOL_SIZE (objfile) = obj_symbol_entry_size (sym_bfd);
-  DBX_SYMCOUNT (objfile) = bfd_get_symcount (sym_bfd);
-  DBX_SYMTAB_OFFSET (objfile) = SYMBOL_TABLE_OFFSET;
-
-  /* Read the string table and stash it away in the objfile_obstack.
-     When we blow away the objfile the string table goes away as well.
-     Note that gdb used to use the results of attempting to malloc the
-     string table, based on the size it read, as a form of sanity check
-     for botched byte swapping, on the theory that a byte swapped string
-     table size would be so totally bogus that the malloc would fail.  Now
-     that we put in on the objfile_obstack, we can't do this since gdb gets
-     a fatal error (out of virtual memory) if the size is bogus.  We can
-     however at least check to see if the size is less than the size of
-     the size field itself, or larger than the size of the entire file.
-     Note that all valid string tables have a size greater than zero, since
-     the bytes used to hold the size are included in the count.  */
-
-  if (STRING_TABLE_OFFSET == 0)
-    {
-      /* It appears that with the existing bfd code, STRING_TABLE_OFFSET
-        will never be zero, even when there is no string table.  This
-        would appear to be a bug in bfd.  */
-      DBX_STRINGTAB_SIZE (objfile) = 0;
-      DBX_STRINGTAB (objfile) = NULL;
-    }
-  else
-    {
-      val = bfd_seek (sym_bfd, STRING_TABLE_OFFSET, SEEK_SET);
-      if (val < 0)
-       perror_with_name (name);
-
-      memset (size_temp, 0, sizeof (size_temp));
-      val = bfd_read (size_temp, sizeof (size_temp), sym_bfd);
-      if (val < 0)
-       {
-         perror_with_name (name);
-       }
-      else if (val == 0)
-       {
-         /* With the existing bfd code, STRING_TABLE_OFFSET will be set to
-            EOF if there is no string table, and attempting to read the size
-            from EOF will read zero bytes.  */
-         DBX_STRINGTAB_SIZE (objfile) = 0;
-         DBX_STRINGTAB (objfile) = NULL;
-       }
-      else
-       {
-         /* Read some data that would appear to be the string table size.
-            If there really is a string table, then it is probably the right
-            size.  Byteswap if necessary and validate the size.  Note that
-            the minimum is DBX_STRINGTAB_SIZE_SIZE.  If we just read some
-            random data that happened to be at STRING_TABLE_OFFSET, because
-            bfd can't tell us there is no string table, the sanity checks may
-            or may not catch this.  */
-         DBX_STRINGTAB_SIZE (objfile) = bfd_h_get_32 (sym_bfd, size_temp);
-
-         if (DBX_STRINGTAB_SIZE (objfile) < sizeof (size_temp)
-             || DBX_STRINGTAB_SIZE (objfile) > bfd_get_size (sym_bfd))
-           error (_("ridiculous string table size (%d bytes)."),
-                  DBX_STRINGTAB_SIZE (objfile));
-
-         DBX_STRINGTAB (objfile) =
-           (char *) obstack_alloc (&objfile->objfile_obstack,
-                                   DBX_STRINGTAB_SIZE (objfile));
-         OBJSTAT (objfile, sz_strtab += DBX_STRINGTAB_SIZE (objfile));
-
-         /* Now read in the string table in one big gulp.  */
-
-         val = bfd_seek (sym_bfd, STRING_TABLE_OFFSET, SEEK_SET);
-         if (val < 0)
-           perror_with_name (name);
-         val = bfd_read (DBX_STRINGTAB (objfile),
-                         DBX_STRINGTAB_SIZE (objfile),
-                         sym_bfd);
-         if (val != DBX_STRINGTAB_SIZE (objfile))
-           perror_with_name (name);
-       }
-    }
-}
-
-/* Perform any local cleanups required when we are done with a particular
-   objfile.  I.E, we are in the process of discarding all symbol information
-   for an objfile, freeing up all memory held for it, and unlinking the
-   objfile struct from the global list of known objfiles.  */
-
-static void
-dbx_symfile_finish (struct objfile *objfile)
-{
-}
-
-\f
-
-\f
-\f
-\f
-static const struct sym_fns aout_sym_fns =
-{
-  dbx_new_init,                        /* init anything gbl to entire symtab */
-  dbx_symfile_init,            /* read initial info, setup for sym_read() */
-  dbx_symfile_read,            /* read a symbol file into symtab */
-  dbx_symfile_finish,          /* finished with file, cleanup */
-  default_symfile_offsets,     /* parse user's offsets to internal form */
-  default_symfile_segments,    /* Get segment information from a file.  */
-  NULL,
-  default_symfile_relocate,    /* Relocate a debug section.  */
-  NULL,                                /* sym_probe_fns */
-};
-
-INIT_GDB_FILE (dbxread)
-{
-  add_symtab_fns (bfd_target_aout_flavour, &aout_sym_fns);
-}
diff --git a/gdb/gdb-stabs.h b/gdb/gdb-stabs.h
deleted file mode 100644 (file)
index 9909129..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/* Definitions for symbol-reading containing "stabs", for GDB.
-   Copyright (C) 1992-2025 Free Software Foundation, Inc.
-   Contributed by Cygnus Support.  Written by John Gilmore.
-
-   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/>.  */
-
-#ifndef GDB_GDB_STABS_H
-#define GDB_GDB_STABS_H
-
-/* During initial symbol reading, we need to have a structure to keep
-   track of which psymtabs have which bincls in them.  This structure
-   is used during reading to setup the list of dependencies within each
-   partial symbol table.  */
-struct legacy_psymtab;
-
-struct header_file_location
-{
-  header_file_location (const char *name_, int instance_,
-                       legacy_psymtab *pst_)
-    : name (name_),
-      instance (instance_),
-      pst (pst_)
-  {
-  }
-
-  const char *name;            /* Name of header file */
-  int instance;                        /* See above */
-  legacy_psymtab *pst; /* Partial symtab that has the
-                                  BINCL/EINCL defs for this file.  */
-};
-
-/* This file exists to hold the common definitions required of most of
-   the symbol-readers that end up using stabs.  The common use of
-   these `symbol-type-specific' customizations of the generic data
-   structures makes the stabs-oriented symbol readers able to call
-   each others' functions as required.  */
-
-struct stabsread_context {
-  /* Remember what we deduced to be the source language of this psymtab.  */
-  enum language psymtab_language = language_unknown;
-
-  /* The size of each symbol in the symbol file (in external form).
-     This is set by dbx_symfile_read when building psymtabs, and by
-     dbx_psymtab_to_symtab when building symtabs.  */
-  unsigned symbol_size = 0;
-
-  /* This is the offset of the symbol table in the executable file.  */
-  unsigned symbol_table_offset = 0;
-
-  /* This is the offset of the string table in the executable file.  */
-  unsigned string_table_offset = 0;
-
-  /* For elf+stab executables, the n_strx field is not a simple index
-     into the string table.  Instead, each .o file has a base offset in
-     the string table, and the associated symbols contain offsets from
-     this base.  The following two variables contain the base offset for
-     the current and next .o files.  */
-  unsigned int file_string_table_offset = 0;
-
-  /* .o and NLM files contain unrelocated addresses which are based at
-     0.  When non-zero, this flag disables some of the special cases for
-     Solaris elf+stab text addresses at location 0.  */
-  int symfile_relocatable = 0;
-
-  /* When set, we are processing a .o file compiled by sun acc.  This is
-     misnamed; it refers to all stabs-in-elf implementations which use
-     N_UNDF the way Sun does, including Solaris gcc.  Hopefully all
-     stabs-in-elf implementations ever invented will choose to be
-     compatible.  */
-  unsigned char processing_acc_compilation = 0;
-
-  /* The lowest text address we have yet encountered.  This is needed
-     because in an a.out file, there is no header field which tells us
-     what address the program is actually going to be loaded at, so we
-     need to make guesses based on the symbols (which *are* relocated to
-     reflect the address it will be loaded at).  */
-  unrelocated_addr lowest_text_address;
-
-  /* Non-zero if there is any line number info in the objfile.  Prevents
-     dbx_end_psymtab from discarding an otherwise empty psymtab.  */
-  int has_line_numbers = 0;
-
-  /* The list of bincls.  */
-  std::vector<struct header_file_location> bincl_list;
-
-  /* Name of last function encountered.  Used in Solaris to approximate
-     object file boundaries.  */
-  const char *last_function_name = nullptr;
-
-  /* The address in memory of the string table of the object file we are
-     reading (which might not be the "main" object file, but might be a
-     shared library or some other dynamically loaded thing).  This is
-     set by read_dbx_symtab when building psymtabs, and by
-     read_ofile_symtab when building symtabs, and is used only by
-     next_symbol_text.  FIXME: If that is true, we don't need it when
-     building psymtabs, right?  */
-  char *stringtab_global = nullptr;
-
-  /* These variables are used to control fill_symbuf when the stabs
-     symbols are not contiguous (as may be the case when a COFF file is
-     linked using --split-by-reloc).  */
-  const std::vector<asection *> *symbuf_sections;
-  size_t sect_idx = 0;
-  unsigned int symbuf_left = 0;
-  unsigned int symbuf_read = 0;
-
-  /* This variable stores a global stabs buffer, if we read stabs into
-     memory in one chunk in order to process relocations.  */
-  bfd_byte *stabs_data = nullptr;
-};
-
-
-/* Information is passed among various dbxread routines for accessing
-   symbol files.  A pointer to this structure is kept in the objfile,
-   using the dbx_objfile_data_key.  */
-
-struct dbx_symfile_info
-  {
-    ~dbx_symfile_info ();
-
-    CORE_ADDR text_addr = 0;   /* Start of text section */
-    int text_size = 0;         /* Size of text section */
-    int symcount = 0;          /* How many symbols are there in the file */
-    char *stringtab = nullptr;         /* The actual string table */
-    int stringtab_size = 0;            /* Its size */
-    file_ptr symtab_offset = 0;        /* Offset in file to symbol table */
-    int symbol_size = 0;               /* Bytes in a single symbol */
-
-    stabsread_context ctx; /* Context for the symfile being read.  */
-
-    /* See stabsread.h for the use of the following.  */
-    struct header_file *header_files = nullptr;
-    int n_header_files = 0;
-    int n_allocated_header_files = 0;
-
-    /* Pointers to BFD sections.  These are used to speed up the building of
-       minimal symbols.  */
-    asection *text_section = nullptr;
-    asection *data_section = nullptr;
-    asection *bss_section = nullptr;
-
-    /* Pointer to the separate ".stab" section, if there is one.  */
-    asection *stab_section = nullptr;
-  };
-
-/* The tag used to find the DBX info attached to an objfile.  This is
-   global because it is referenced by several modules.  */
-extern const registry<objfile>::key<dbx_symfile_info> dbx_objfile_data_key;
-
-#define DBX_SYMFILE_INFO(o)    (dbx_objfile_data_key.get (o))
-#define DBX_TEXT_ADDR(o)       (DBX_SYMFILE_INFO(o)->text_addr)
-#define DBX_TEXT_SIZE(o)       (DBX_SYMFILE_INFO(o)->text_size)
-#define DBX_SYMCOUNT(o)                (DBX_SYMFILE_INFO(o)->symcount)
-#define DBX_STRINGTAB(o)       (DBX_SYMFILE_INFO(o)->stringtab)
-#define DBX_STRINGTAB_SIZE(o)  (DBX_SYMFILE_INFO(o)->stringtab_size)
-#define DBX_SYMTAB_OFFSET(o)   (DBX_SYMFILE_INFO(o)->symtab_offset)
-#define DBX_SYMBOL_SIZE(o)     (DBX_SYMFILE_INFO(o)->symbol_size)
-#define DBX_TEXT_SECTION(o)    (DBX_SYMFILE_INFO(o)->text_section)
-#define DBX_DATA_SECTION(o)    (DBX_SYMFILE_INFO(o)->data_section)
-#define DBX_BSS_SECTION(o)     (DBX_SYMFILE_INFO(o)->bss_section)
-#define DBX_STAB_SECTION(o)    (DBX_SYMFILE_INFO(o)->stab_section)
-
-#endif /* GDB_GDB_STABS_H */