]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/dwarf2/index-common.h
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / dwarf2 / index-common.h
CommitLineData
cd4fb1b2
SM
1/* Things needed for both reading and writing DWARF indices.
2
1d506c26 3 Copyright (C) 1994-2024 Free Software Foundation, Inc.
cd4fb1b2
SM
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#ifndef DWARF_INDEX_COMMON_H
21#define DWARF_INDEX_COMMON_H
22
87d6a7aa
SM
23/* The suffix for an index file. */
24#define INDEX4_SUFFIX ".gdb-index"
25#define INDEX5_SUFFIX ".debug_names"
26#define DEBUG_STR_SUFFIX ".debug_str"
27
cd4fb1b2
SM
28/* All offsets in the index are of this type. It must be
29 architecture-independent. */
30typedef uint32_t offset_type;
31
42c2c694 32/* Unpack a 32-bit little-endian value. */
cd4fb1b2
SM
33
34static inline offset_type
42c2c694 35gdb_index_unpack (const gdb_byte *value)
cd4fb1b2 36{
42c2c694
TT
37 return (offset_type) extract_unsigned_integer (value, sizeof (offset_type),
38 BFD_ENDIAN_LITTLE);
cd4fb1b2
SM
39}
40
cd4fb1b2
SM
41/* The hash function for strings in the mapped index. This is the same as
42 SYMBOL_HASH_NEXT, but we keep a separate copy to maintain control over the
43 implementation. This is necessary because the hash function is tied to the
44 format of the mapped index file. The hash values do not have to match with
45 SYMBOL_HASH_NEXT.
46
47 Use INT_MAX for INDEX_VERSION if you generate the current index format. */
48
49hashval_t mapped_index_string_hash (int index_version, const void *p);
50
51/* Symbol name hashing function as specified by DWARF-5. */
52
53uint32_t dwarf5_djb_hash (const char *str_);
54
4e9e4fcd
TT
55/* Symbol name hashing function as specified by DWARF-5. */
56
8082468f 57uint32_t dwarf5_djb_hash (std::string_view str_);
4e9e4fcd 58
cd4fb1b2 59#endif /* DWARF_INDEX_COMMON_H */