diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2012-10-20 14:42:03 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2012-10-20 14:42:03 +0400 |
commit | bb1c3da3c12651f1c408d96dd6d33ae157bdadd6 (patch) | |
tree | 4a535b35500684ac6a928bf0fd661325b5a04697 /dwarfdump/checkutil.h | |
download | dwarfutils-bb1c3da3c12651f1c408d96dd6d33ae157bdadd6.tar.gz |
Imported Upstream version 20120410upstream/20120410upstream
Diffstat (limited to 'dwarfdump/checkutil.h')
-rw-r--r-- | dwarfdump/checkutil.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/dwarfdump/checkutil.h b/dwarfdump/checkutil.h new file mode 100644 index 0000000..d922b98 --- /dev/null +++ b/dwarfdump/checkutil.h @@ -0,0 +1,98 @@ +/* + 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 + +/* 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); + + +#endif /* CHECKUTIL_H */ |