From: Guinevere Larsen <guinevere@redhat.com>
To: gdb-patches@sourceware.org
Cc: Guinevere Larsen <guinevere@redhat.com>
Subject: [PATCH v2 1/8] gdb: move some stabs functions to gdb/buildsym-legacy.h
Date: Mon, 20 Oct 2025 12:28:45 -0300 [thread overview]
Message-ID: <20251020152853.28195-2-guinevere@redhat.com> (raw)
In-Reply-To: <20251020152853.28195-1-guinevere@redhat.com>
The gdb/stabsread.h and .c files define 2 things that, while originally
intended only for stabs reading, actually end up being used for coff,
ecoff and maybe more debuginfo formats. That is the function "hashname",
and the macro HASHSIZE. Both are used for small hashtables when reading
some symbols with incomplete information.
With the upcoming removal of stabs code, this code should be moved
somewhere, and the location that looked most reasonable was
gdb/buildsym-legacy. No change in behavior is expected after this
commit.
---
gdb/buildsym-legacy.h | 10 ++++++++++
gdb/stabsread.c | 8 --------
gdb/stabsread.h | 9 ++-------
3 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/gdb/buildsym-legacy.h b/gdb/buildsym-legacy.h
index 4ae8e1a7b66..06d39e8529f 100644
--- a/gdb/buildsym-legacy.h
+++ b/gdb/buildsym-legacy.h
@@ -21,6 +21,16 @@
#include "buildsym.h"
+/* Legacy hash for symbol names used for several debuginfo formats. */
+
+#define HASHSIZE 127
+
+static inline int
+hashname (const char *name)
+{
+ return fast_hash (name, strlen (name)) % HASHSIZE;
+}
+
/* This module provides definitions used for creating and adding to
the symbol table. These routines are called from various symbol-
file-reading routines. This file holds the legacy API, which
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 733fc9e6ddc..60cd5702396 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -7190,14 +7190,6 @@ find_name_end (const char *name)
}
}
-/* See stabsread.h. */
-
-int
-hashname (const char *name)
-{
- return fast_hash (name, strlen (name)) % HASHSIZE;
-}
-
/* Initializer for this module. */
INIT_GDB_FILE (stabsread)
diff --git a/gdb/stabsread.h b/gdb/stabsread.h
index 15f73266e1c..1c9ce854dff 100644
--- a/gdb/stabsread.h
+++ b/gdb/stabsread.h
@@ -19,6 +19,8 @@
#ifndef GDB_STABSREAD_H
#define GDB_STABSREAD_H
+#include "buildsym-legacy.h"
+
struct objfile;
struct legacy_psymtab;
enum language;
@@ -26,13 +28,6 @@ enum language;
/* Definitions, prototypes, etc for stabs debugging format support
functions. */
-#define HASHSIZE 127 /* Size of things hashed via
- hashname(). */
-
-/* Compute a small integer hash code for the given name. */
-
-extern int hashname (const char *name);
-
/* Count symbols as they are processed, for error messages. */
extern unsigned int symnum;
--
2.51.0
next prev parent reply other threads:[~2025-10-20 15:33 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-20 15:28 [PATCH v2 0/8] Remove stabs support from GDB Guinevere Larsen
2025-10-20 15:28 ` Guinevere Larsen [this message]
2025-10-20 16:25 ` [PATCH v2 1/8] gdb: move some stabs functions to gdb/buildsym-legacy.h Tom Tromey
2025-10-20 15:28 ` [PATCH v2 2/8] gdb/mdebug: Remove stabs support from mips inferiors Guinevere Larsen
2025-10-20 15:28 ` [PATCH v2 3/8] gdb: Remove stabs support from ELF files Guinevere Larsen
2025-10-20 15:28 ` [PATCH v2 4/8] gdb: Remove stabs support from dbx Guinevere Larsen
2025-10-20 15:28 ` [PATCH v2 5/8] gdb: Remove stabs support for COFF files Guinevere Larsen
2025-10-20 15:28 ` [PATCH v2 6/8] gdb: Remove stabs support from XCOFF inferiors Guinevere Larsen
2025-11-07 10:46 ` Andrew Burgess
2025-11-07 12:09 ` Guinevere Larsen
2025-11-07 14:46 ` Tom Tromey
2025-10-20 15:28 ` [PATCH v2 7/8] gdb: Fully remove stabs code from GDB Guinevere Larsen
2025-10-20 16:39 ` Eli Zaretskii
2025-10-20 19:12 ` Guinevere Larsen
2025-10-20 15:28 ` [PATCH v2 8/8] gdb: remove support for dbx " Guinevere Larsen
2025-10-21 19:14 ` [PATCH v2 0/8] Remove stabs support " Tom Tromey
2025-10-21 19:42 ` Guinevere Larsen
2025-10-22 9:48 ` Luis
2025-10-22 13:08 ` Tom Tromey
2025-10-22 13:19 ` Guinevere Larsen
2025-10-22 19:19 ` Luis
2025-10-23 0:58 ` Luis
2025-10-23 2:03 ` Andrew Pinski
2025-10-23 18:11 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251020152853.28195-2-guinevere@redhat.com \
--to=guinevere@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox