gdb/dbx: Remove stabsect_build_psymtab as it was unused

Message ID 20241125163125.82018-1-guinevere@redhat.com
State New
Headers
Series gdb/dbx: Remove stabsect_build_psymtab as it was unused |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Guinevere Larsen Nov. 25, 2024, 4:31 p.m. UTC
  The function stabsect_build_psymtabs, defined in the dbxread file, is no
longer used in any parts of GDB, so this commit just removes it.

Tested by rebuilding.
---
 gdb/dbxread.c   | 84 -------------------------------------------------
 gdb/stabsread.h |  3 --
 2 files changed, 87 deletions(-)
  

Comments

Andrew Burgess Dec. 3, 2024, 3:58 p.m. UTC | #1
Guinevere Larsen <guinevere@redhat.com> writes:

> The function stabsect_build_psymtabs, defined in the dbxread file, is no
> longer used in any parts of GDB, so this commit just removes it.
>
> Tested by rebuilding.

Approved-By: Andrew Burgess <aburgess@redhat.com>

Thanks,
Andrew

> ---
>  gdb/dbxread.c   | 84 -------------------------------------------------
>  gdb/stabsread.h |  3 --
>  2 files changed, 87 deletions(-)
>
> diff --git a/gdb/dbxread.c b/gdb/dbxread.c
> index 1b29d6e7c55..4cd721057bc 100644
> --- a/gdb/dbxread.c
> +++ b/gdb/dbxread.c
> @@ -252,90 +252,6 @@ dbx_symfile_finish (struct objfile *objfile)
>  
>  
>  
> -/* Scan and build partial symbols for a file with special sections for stabs
> -   and stabstrings.  The file has already been processed to get its minimal
> -   symbols, and any other symbols that might be necessary to resolve GSYMs.
> -
> -   This routine is the equivalent of dbx_symfile_init and dbx_symfile_read
> -   rolled into one.
> -
> -   OBJFILE is the object file we are reading symbols from.
> -   ADDR is the address relative to which the symbols are (e.g. the base address
> -   of the text segment).
> -   STAB_NAME is the name of the section that contains the stabs.
> -   STABSTR_NAME is the name of the section that contains the stab strings.
> -
> -   This routine is mostly copied from dbx_symfile_init and
> -   dbx_symfile_read.  */
> -
> -void
> -stabsect_build_psymtabs (struct objfile *objfile, char *stab_name,
> -			 char *stabstr_name, char *text_name)
> -{
> -  int val;
> -  bfd *sym_bfd = objfile->obfd.get ();
> -  const char *name = bfd_get_filename (sym_bfd);
> -  asection *stabsect;
> -  asection *stabstrsect;
> -  asection *text_sect;
> -
> -  stabsect = bfd_get_section_by_name (sym_bfd, stab_name);
> -  stabstrsect = bfd_get_section_by_name (sym_bfd, stabstr_name);
> -
> -  if (!stabsect)
> -    return;
> -
> -  if (!stabstrsect)
> -    error (_("stabsect_build_psymtabs:  Found stabs (%s), "
> -	     "but not string section (%s)"),
> -	   stab_name, stabstr_name);
> -
> -  dbx_objfile_data_key.emplace (objfile);
> -
> -  text_sect = bfd_get_section_by_name (sym_bfd, text_name);
> -  if (!text_sect)
> -    error (_("Can't find %s section in symbol file"), text_name);
> -  DBX_TEXT_ADDR (objfile) = bfd_section_vma (text_sect);
> -  DBX_TEXT_SIZE (objfile) = bfd_section_size (text_sect);
> -
> -  DBX_SYMBOL_SIZE (objfile) = sizeof (struct external_nlist);
> -  DBX_SYMCOUNT (objfile) = bfd_section_size (stabsect)
> -    / DBX_SYMBOL_SIZE (objfile);
> -  DBX_STRINGTAB_SIZE (objfile) = bfd_section_size (stabstrsect);
> -  DBX_SYMTAB_OFFSET (objfile) = stabsect->filepos;	/* XXX - FIXME: POKING
> -							   INSIDE BFD DATA
> -							   STRUCTURES */
> -
> -  if (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) + 1);
> -  OBJSTAT (objfile, sz_strtab += DBX_STRINGTAB_SIZE (objfile) + 1);
> -
> -  /* Now read in the string table in one big gulp.  */
> -
> -  val = bfd_get_section_contents (sym_bfd,	/* bfd */
> -				  stabstrsect,	/* bfd section */
> -				  DBX_STRINGTAB (objfile), /* input buffer */
> -				  0,		/* offset into section */
> -				  DBX_STRINGTAB_SIZE (objfile)); /* amount to
> -								    read */
> -
> -  if (!val)
> -    perror_with_name (name);
> -
> -  stabsread_new_init ();
> -  free_header_files ();
> -  init_header_files ();
> -
> -  /* Now, do an incremental load.  */
> -
> -  dbx_objfile_data_key.get (objfile)->ctx.processing_acc_compilation = 1;
> -  dbx_symfile_read (objfile, 0);
> -}
> -
>  static const struct sym_fns aout_sym_fns =
>  {
>    dbx_new_init,			/* init anything gbl to entire symtab */
> diff --git a/gdb/stabsread.h b/gdb/stabsread.h
> index 565038ae4ac..5f6f2df87b5 100644
> --- a/gdb/stabsread.h
> +++ b/gdb/stabsread.h
> @@ -202,9 +202,6 @@ extern void coffstab_build_psymtabs
>     const std::vector<asection *> &stabs,
>     file_ptr stabstroffset, unsigned int stabstrsize);
>  
> -extern void stabsect_build_psymtabs (struct objfile *objfile, char *stab_name,
> -				     char *stabstr_name, char *text_name);
> -
>  extern int symbol_reference_defined (const char **);
>  
>  extern void ref_add (int, struct symbol *, const char *, CORE_ADDR);
> -- 
> 2.47.0
  
Guinevere Larsen Dec. 3, 2024, 6:12 p.m. UTC | #2
On 12/3/24 12:58 PM, Andrew Burgess wrote:
> Guinevere Larsen <guinevere@redhat.com> writes:
>
>> The function stabsect_build_psymtabs, defined in the dbxread file, is no
>> longer used in any parts of GDB, so this commit just removes it.
>>
>> Tested by rebuilding.
> Approved-By: Andrew Burgess <aburgess@redhat.com>
Thanks, pushed!
>
> Thanks,
> Andrew
>
>> ---
>>   gdb/dbxread.c   | 84 -------------------------------------------------
>>   gdb/stabsread.h |  3 --
>>   2 files changed, 87 deletions(-)
>>
>> diff --git a/gdb/dbxread.c b/gdb/dbxread.c
>> index 1b29d6e7c55..4cd721057bc 100644
>> --- a/gdb/dbxread.c
>> +++ b/gdb/dbxread.c
>> @@ -252,90 +252,6 @@ dbx_symfile_finish (struct objfile *objfile)
>>   
>>   
>>   
>> -/* Scan and build partial symbols for a file with special sections for stabs
>> -   and stabstrings.  The file has already been processed to get its minimal
>> -   symbols, and any other symbols that might be necessary to resolve GSYMs.
>> -
>> -   This routine is the equivalent of dbx_symfile_init and dbx_symfile_read
>> -   rolled into one.
>> -
>> -   OBJFILE is the object file we are reading symbols from.
>> -   ADDR is the address relative to which the symbols are (e.g. the base address
>> -   of the text segment).
>> -   STAB_NAME is the name of the section that contains the stabs.
>> -   STABSTR_NAME is the name of the section that contains the stab strings.
>> -
>> -   This routine is mostly copied from dbx_symfile_init and
>> -   dbx_symfile_read.  */
>> -
>> -void
>> -stabsect_build_psymtabs (struct objfile *objfile, char *stab_name,
>> -			 char *stabstr_name, char *text_name)
>> -{
>> -  int val;
>> -  bfd *sym_bfd = objfile->obfd.get ();
>> -  const char *name = bfd_get_filename (sym_bfd);
>> -  asection *stabsect;
>> -  asection *stabstrsect;
>> -  asection *text_sect;
>> -
>> -  stabsect = bfd_get_section_by_name (sym_bfd, stab_name);
>> -  stabstrsect = bfd_get_section_by_name (sym_bfd, stabstr_name);
>> -
>> -  if (!stabsect)
>> -    return;
>> -
>> -  if (!stabstrsect)
>> -    error (_("stabsect_build_psymtabs:  Found stabs (%s), "
>> -	     "but not string section (%s)"),
>> -	   stab_name, stabstr_name);
>> -
>> -  dbx_objfile_data_key.emplace (objfile);
>> -
>> -  text_sect = bfd_get_section_by_name (sym_bfd, text_name);
>> -  if (!text_sect)
>> -    error (_("Can't find %s section in symbol file"), text_name);
>> -  DBX_TEXT_ADDR (objfile) = bfd_section_vma (text_sect);
>> -  DBX_TEXT_SIZE (objfile) = bfd_section_size (text_sect);
>> -
>> -  DBX_SYMBOL_SIZE (objfile) = sizeof (struct external_nlist);
>> -  DBX_SYMCOUNT (objfile) = bfd_section_size (stabsect)
>> -    / DBX_SYMBOL_SIZE (objfile);
>> -  DBX_STRINGTAB_SIZE (objfile) = bfd_section_size (stabstrsect);
>> -  DBX_SYMTAB_OFFSET (objfile) = stabsect->filepos;	/* XXX - FIXME: POKING
>> -							   INSIDE BFD DATA
>> -							   STRUCTURES */
>> -
>> -  if (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) + 1);
>> -  OBJSTAT (objfile, sz_strtab += DBX_STRINGTAB_SIZE (objfile) + 1);
>> -
>> -  /* Now read in the string table in one big gulp.  */
>> -
>> -  val = bfd_get_section_contents (sym_bfd,	/* bfd */
>> -				  stabstrsect,	/* bfd section */
>> -				  DBX_STRINGTAB (objfile), /* input buffer */
>> -				  0,		/* offset into section */
>> -				  DBX_STRINGTAB_SIZE (objfile)); /* amount to
>> -								    read */
>> -
>> -  if (!val)
>> -    perror_with_name (name);
>> -
>> -  stabsread_new_init ();
>> -  free_header_files ();
>> -  init_header_files ();
>> -
>> -  /* Now, do an incremental load.  */
>> -
>> -  dbx_objfile_data_key.get (objfile)->ctx.processing_acc_compilation = 1;
>> -  dbx_symfile_read (objfile, 0);
>> -}
>> -
>>   static const struct sym_fns aout_sym_fns =
>>   {
>>     dbx_new_init,			/* init anything gbl to entire symtab */
>> diff --git a/gdb/stabsread.h b/gdb/stabsread.h
>> index 565038ae4ac..5f6f2df87b5 100644
>> --- a/gdb/stabsread.h
>> +++ b/gdb/stabsread.h
>> @@ -202,9 +202,6 @@ extern void coffstab_build_psymtabs
>>      const std::vector<asection *> &stabs,
>>      file_ptr stabstroffset, unsigned int stabstrsize);
>>   
>> -extern void stabsect_build_psymtabs (struct objfile *objfile, char *stab_name,
>> -				     char *stabstr_name, char *text_name);
>> -
>>   extern int symbol_reference_defined (const char **);
>>   
>>   extern void ref_add (int, struct symbol *, const char *, CORE_ADDR);
>> -- 
>> 2.47.0
  

Patch

diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 1b29d6e7c55..4cd721057bc 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -252,90 +252,6 @@  dbx_symfile_finish (struct objfile *objfile)
 
 
 
-/* Scan and build partial symbols for a file with special sections for stabs
-   and stabstrings.  The file has already been processed to get its minimal
-   symbols, and any other symbols that might be necessary to resolve GSYMs.
-
-   This routine is the equivalent of dbx_symfile_init and dbx_symfile_read
-   rolled into one.
-
-   OBJFILE is the object file we are reading symbols from.
-   ADDR is the address relative to which the symbols are (e.g. the base address
-   of the text segment).
-   STAB_NAME is the name of the section that contains the stabs.
-   STABSTR_NAME is the name of the section that contains the stab strings.
-
-   This routine is mostly copied from dbx_symfile_init and
-   dbx_symfile_read.  */
-
-void
-stabsect_build_psymtabs (struct objfile *objfile, char *stab_name,
-			 char *stabstr_name, char *text_name)
-{
-  int val;
-  bfd *sym_bfd = objfile->obfd.get ();
-  const char *name = bfd_get_filename (sym_bfd);
-  asection *stabsect;
-  asection *stabstrsect;
-  asection *text_sect;
-
-  stabsect = bfd_get_section_by_name (sym_bfd, stab_name);
-  stabstrsect = bfd_get_section_by_name (sym_bfd, stabstr_name);
-
-  if (!stabsect)
-    return;
-
-  if (!stabstrsect)
-    error (_("stabsect_build_psymtabs:  Found stabs (%s), "
-	     "but not string section (%s)"),
-	   stab_name, stabstr_name);
-
-  dbx_objfile_data_key.emplace (objfile);
-
-  text_sect = bfd_get_section_by_name (sym_bfd, text_name);
-  if (!text_sect)
-    error (_("Can't find %s section in symbol file"), text_name);
-  DBX_TEXT_ADDR (objfile) = bfd_section_vma (text_sect);
-  DBX_TEXT_SIZE (objfile) = bfd_section_size (text_sect);
-
-  DBX_SYMBOL_SIZE (objfile) = sizeof (struct external_nlist);
-  DBX_SYMCOUNT (objfile) = bfd_section_size (stabsect)
-    / DBX_SYMBOL_SIZE (objfile);
-  DBX_STRINGTAB_SIZE (objfile) = bfd_section_size (stabstrsect);
-  DBX_SYMTAB_OFFSET (objfile) = stabsect->filepos;	/* XXX - FIXME: POKING
-							   INSIDE BFD DATA
-							   STRUCTURES */
-
-  if (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) + 1);
-  OBJSTAT (objfile, sz_strtab += DBX_STRINGTAB_SIZE (objfile) + 1);
-
-  /* Now read in the string table in one big gulp.  */
-
-  val = bfd_get_section_contents (sym_bfd,	/* bfd */
-				  stabstrsect,	/* bfd section */
-				  DBX_STRINGTAB (objfile), /* input buffer */
-				  0,		/* offset into section */
-				  DBX_STRINGTAB_SIZE (objfile)); /* amount to
-								    read */
-
-  if (!val)
-    perror_with_name (name);
-
-  stabsread_new_init ();
-  free_header_files ();
-  init_header_files ();
-
-  /* Now, do an incremental load.  */
-
-  dbx_objfile_data_key.get (objfile)->ctx.processing_acc_compilation = 1;
-  dbx_symfile_read (objfile, 0);
-}
-
 static const struct sym_fns aout_sym_fns =
 {
   dbx_new_init,			/* init anything gbl to entire symtab */
diff --git a/gdb/stabsread.h b/gdb/stabsread.h
index 565038ae4ac..5f6f2df87b5 100644
--- a/gdb/stabsread.h
+++ b/gdb/stabsread.h
@@ -202,9 +202,6 @@  extern void coffstab_build_psymtabs
    const std::vector<asection *> &stabs,
    file_ptr stabstroffset, unsigned int stabstrsize);
 
-extern void stabsect_build_psymtabs (struct objfile *objfile, char *stab_name,
-				     char *stabstr_name, char *text_name);
-
 extern int symbol_reference_defined (const char **);
 
 extern void ref_add (int, struct symbol *, const char *, CORE_ADDR);