1 /* Things needed for both reading and writing DWARF indices.
3 Copyright (C) 1994-2018 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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/>. */
20 #ifndef DWARF_INDEX_COMMON_H
21 #define DWARF_INDEX_COMMON_H
23 /* All offsets in the index are of this type. It must be
24 architecture-independent. */
25 typedef uint32_t offset_type
;
29 /* Convert VALUE between big- and little-endian. */
31 static inline offset_type
32 byte_swap (offset_type value
)
36 result
= (value
& 0xff) << 24;
37 result
|= (value
& 0xff00) << 8;
38 result
|= (value
& 0xff0000) >> 8;
39 result
|= (value
& 0xff000000) >> 24;
43 #define MAYBE_SWAP(V) byte_swap (V)
46 #define MAYBE_SWAP(V) static_cast<offset_type> (V)
47 #endif /* WORDS_BIGENDIAN */
49 /* The hash function for strings in the mapped index. This is the same as
50 SYMBOL_HASH_NEXT, but we keep a separate copy to maintain control over the
51 implementation. This is necessary because the hash function is tied to the
52 format of the mapped index file. The hash values do not have to match with
55 Use INT_MAX for INDEX_VERSION if you generate the current index format. */
57 hashval_t
mapped_index_string_hash (int index_version
, const void *p
);
59 /* Symbol name hashing function as specified by DWARF-5. */
61 uint32_t dwarf5_djb_hash (const char *str_
);
63 #endif /* DWARF_INDEX_COMMON_H */
This page took 0.033548 seconds and 4 git commands to generate.