File: checkutil.h

package info (click to toggle)
dwarfutils 20201201-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 11,868 kB
  • sloc: ansic: 104,667; sh: 5,947; cpp: 4,675; python: 878; makefile: 646; awk: 11
file content (108 lines) | stat: -rw-r--r-- 3,864 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
  Copyright (C) 2011 SN Systems Ltd. All Rights Reserved.
  Portions Copyright (C) 2011 David Anderson. All Rights Reserved.

  This program is free software; you can redistribute it and/or
  modify it under the terms of version 2 of the GNU General
  Public License as published by the Free Software Foundation.

  This program is distributed in the hope that it would be
  useful, but WITHOUT ANY WARRANTY; without even the implied
  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  PURPOSE.

  Further, this software is distributed without any warranty
  that it is free of the rightful claim of any third person
  regarding infringement or the like.  Any license provided
  herein, whether implied or otherwise, applies only to this
  software file.  Patent licenses, if any, provided herein
  do not apply to combinations of this program with other
  software, or any other product whatsoever.

  You should have received a copy of the GNU General Public
  License along with this program; if not, write the Free
  Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
  Boston MA 02110-1301, USA.

*/

#ifndef CHECKUTIL_H
#define CHECKUTIL_H

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/*  Map information.
    Depending on the specific functions used various
    fields here are either used or ignored.

*/
typedef struct {
    Dwarf_Bool bFlag;   /* General flag */
    const char *name;   /* Generic name */
    Dwarf_Addr key;     /* Used for binary search, the key
        is either a pc address or a DIE offset
        depending on which bucket table is in use. */
    Dwarf_Addr base;    /* Used for base address */
    Dwarf_Addr low;     /* Used for Low PC */
    Dwarf_Addr high;    /* Used for High PC */
} Bucket_Data;

/*  This groups Bucket_Data records into
    a 'bucket' so that a single malloc creates
    BUCKET_SIZE entries.  The intent is to reduce
    overhead (as compared to having next/previous
    pointers in each Bucket_Data and mallocing
    each Bucket_Data individually.
*/

#define BUCKET_SIZE 2040
typedef struct bucket {
    int nEntries;
    Bucket_Data Entries[BUCKET_SIZE];
    struct bucket *pNext;
}   Bucket;

/* This Forms the head record of a list of Buckets.
*/
typedef struct {
    int kind;             /* Kind of bucket */
    Dwarf_Addr lower;     /* Lower value for data */
    Dwarf_Addr upper;     /* Upper value for data */
    Bucket_Data *pFirst;  /* First sentinel */
    Bucket_Data *pLast;   /* Last sentinel */
    Bucket *pHead;        /* First bucket in set */
    Bucket *pTail;        /* Last bucket in set */
} Bucket_Group;

Bucket_Group *AllocateBucketGroup(int kind);
void ReleaseBucketGroup(Bucket_Group *pBucketGroup);
void ResetBucketGroup(Bucket_Group *pBucketGroup);
void ResetSentinelBucketGroup(Bucket_Group *pBucketGroup);

void PrintBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Bool bFull);

void AddEntryIntoBucketGroup(Bucket_Group *pBucketGroup,
    Dwarf_Addr key,Dwarf_Addr base,Dwarf_Addr low,Dwarf_Addr high,
    const char *name, Dwarf_Bool bFlag);

Dwarf_Bool DeleteKeyInBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Addr key);

Dwarf_Bool FindAddressInBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Addr address);
Bucket_Data *FindDataInBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Addr key);
Bucket_Data *FindKeyInBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Addr key);
Bucket_Data *FindNameInBucketGroup(Bucket_Group *pBucketGroup,char *name);

Dwarf_Bool IsValidInBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Addr pc);

void ResetLimitsBucketSet(Bucket_Group *pBucketGroup);
void SetLimitsBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Addr lower,Dwarf_Addr upper);
Dwarf_Bool IsValidInLinkonce(Bucket_Group *pLo,
    const char *name,Dwarf_Addr lopc,Dwarf_Addr hipc);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* CHECKUTIL_H */