Debian Codegraph @

src/bin/dwarfdump/dd_checkutil.h

raw
1 /*
2 Copyright (C) 2011 SN Systems Ltd. All Rights Reserved.
3 Portions Copyright (C) 2011 David Anderson. All Rights Reserved.
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of version 2 of the GNU General
7 Public License as published by the Free Software Foundation.
8
9 This program is distributed in the hope that it would be
10 useful, but WITHOUT ANY WARRANTY; without even the implied
11 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE.
13
14 Further, this software is distributed without any warranty
15 that it is free of the rightful claim of any third person
16 regarding infringement or the like. Any license provided
17 herein, whether implied or otherwise, applies only to this
18 software file. Patent licenses, if any, provided herein
19 do not apply to combinations of this program with other
20 software, or any other product whatsoever.
21
22 You should have received a copy of the GNU General Public
23 License along with this program; if not, write the Free
24 Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
25 Boston MA 02110-1301, USA.
26
27 */
28
29 #ifndef CHECKUTIL_H
30 #define CHECKUTIL_H
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif /* __cplusplus */
35
36 /* Map information.
37 Depending on the specific functions used various
38 fields here are either used or ignored.
39
40 */
41 typedef struct {
42 Dwarf_Bool bFlag; /* General flag */
43 const char *name; /* Generic name */
44 Dwarf_Addr key; /* Used for binary search, the key
45 is either a pc address or a DIE offset
46 depending on which bucket table is in use. */
47 Dwarf_Addr base; /* Used for base address */
48 Dwarf_Addr low; /* Used for Low PC */
49 Dwarf_Addr high; /* Used for High PC */
50 } Bucket_Data;
51
52 /* This groups Bucket_Data records into
53 a 'bucket' so that a single malloc creates
54 BUCKET_SIZE entries. The intent is to reduce
55 overhead (as compared to having next/previous
56 pointers in each Bucket_Data and mallocing
57 each Bucket_Data individually.
58 */
59
60 #define BUCKET_SIZE 2040
61 typedef struct bucket {
62 int nEntries;
63 unsigned long b_number;
64 Bucket_Data Entries[BUCKET_SIZE];
65 struct bucket *pNext;
66 } Bucket;
67
68 /* This Forms the head record of a list of Buckets.
69 */
70 typedef struct {
71 int kind; /* Kind of bucket */
72 unsigned long bg_number;
73 Dwarf_Addr lower; /* Lower value for data */
74 Dwarf_Addr upper; /* Upper value for data */
75 Bucket_Data *pFirst; /* First sentinel */
76 Bucket_Data *pLast; /* Last sentinel */
77 Bucket *pHead; /* First bucket in set */
78 Bucket *pTail; /* Last bucket in set */
79 } Bucket_Group;
80
81 Bucket_Group *AllocateBucketGroup(int kind);
82 void ReleaseBucketGroup(Bucket_Group *pBucketGroup);
83 void ResetBucketGroup(Bucket_Group *pBucketGroup);
84 void ResetSentinelBucketGroup(Bucket_Group *pBucketGroup);
85
86 void PrintBucketGroup(Bucket_Group *pBucketGroup);
87
88 void AddEntryIntoBucketGroup(Bucket_Group *pBucketGroup,
89 Dwarf_Addr key,Dwarf_Addr base,Dwarf_Addr low,Dwarf_Addr high,
90 const char *name, Dwarf_Bool bFlag);
91
92 Dwarf_Bool DeleteKeyInBucketGroup(Bucket_Group *pBucketGroup,
93 Dwarf_Addr key);
94 Dwarf_Bool FindAddressInBucketGroup(Bucket_Group *pBucketGroup,
95 Dwarf_Addr address);
96 Bucket_Data *FindDataInBucketGroup(Bucket_Group *pBucketGroup,
97 Dwarf_Addr key);
98 Bucket_Data *FindKeyInBucketGroup(Bucket_Group *pBucketGroup,
99 Dwarf_Addr key);
100 Dwarf_Bool IsValidInBucketGroup(Bucket_Group *pBucketGroup,
101 Dwarf_Addr pc);
102 void ResetLimitsBucketSet(Bucket_Group *pBucketGroup);
103 void SetLimitsBucketGroup(Bucket_Group *pBucketGroup,
104 Dwarf_Addr lower,Dwarf_Addr upper);
105 Dwarf_Bool IsValidInLinkonce(Bucket_Group *pLo,
106 const char *name,Dwarf_Addr lopc,Dwarf_Addr hipc);
107
108 #ifdef __cplusplus
109 }
110 #endif /* __cplusplus */
111
112 #endif /* CHECKUTIL_H */