]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: move some stabs functions to gdb/buildsym-legacy.h
authorGuinevere Larsen <guinevere@redhat.com>
Tue, 28 Jan 2025 18:45:10 +0000 (15:45 -0300)
committerGuinevere Larsen <guinevere@redhat.com>
Tue, 21 Oct 2025 19:39:53 +0000 (16:39 -0300)
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.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/buildsym-legacy.h
gdb/stabsread.c
gdb/stabsread.h

index 4ae8e1a7b66a779614a11acc6bf55c8cb519f357..06d39e8529f12476dd365badc8dc36a1127e3251 100644 (file)
 
 #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
index c7fc626e31c272c730fbd921cdb93b006f17270f..05a7c27c5df8811d97069c81753ed152feb5f7dc 100644 (file)
@@ -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)
index 15f73266e1cb8c3f4d6d20e2bed72c34a09d7406..1c9ce854dffa160107fc3ecd1c274015d64e04d7 100644 (file)
@@ -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;