| 1 |
/* |
| 2 |
Copyright 2015-2016 David Anderson. All rights reserved. |
| 3 |
|
| 4 |
This program is free software; you can redistribute it and/or |
| 5 |
modify it under the terms of version 2 of the GNU General |
| 6 |
Public License as published by the Free Software Foundation. |
| 7 |
|
| 8 |
This program is distributed in the hope that it would be |
| 9 |
useful, but WITHOUT ANY WARRANTY; without even the implied |
| 10 |
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 11 |
PURPOSE. |
| 12 |
|
| 13 |
Further, this software is distributed without any warranty |
| 14 |
that it is free of the rightful claim of any third person |
| 15 |
regarding infringement or the like. Any license provided |
| 16 |
herein, whether implied or otherwise, applies only to this |
| 17 |
software file. Patent licenses, if any, provided herein |
| 18 |
do not apply to combinations of this program with other |
| 19 |
software, or any other product whatsoever. |
| 20 |
|
| 21 |
You should have received a copy of the GNU General Public |
| 22 |
License along with this program; if not, write the Free |
| 23 |
Software Foundation, Inc., 51 Franklin Street - Fifth Floor, |
| 24 |
Boston MA 02110-1301, USA. |
| 25 |
|
| 26 |
*/ |
| 27 |
#ifndef HELPERTREE_H |
| 28 |
#define HELPERTREE_H |
| 29 |
|
| 30 |
/* This is a tsearch tree interface we may use in various ways |
| 31 |
where each different sort of use is a different |
| 32 |
Helpertree_Base_s instance. */ |
| 33 |
|
| 34 |
/* We create Helpertree_Base_s so we can use type-checked calls, |
| 35 |
not showing the tsearch void* outside of helpertree.c. */ |
| 36 |
struct Helpertree_Base_s { |
| 37 |
void * hb_base; |
| 38 |
}; |
| 39 |
|
| 40 |
/* For .debug_info */ |
| 41 |
extern struct Helpertree_Base_s helpertree_offsets_base_info; |
| 42 |
/* For .debug_types. */ |
| 43 |
extern struct Helpertree_Base_s helpertree_offsets_base_types; |
| 44 |
|
| 45 |
struct Helpertree_Map_Entry_s { |
| 46 |
/* Key is offset. It will be a section-global offset so |
| 47 |
applicable across an entire executable/object section. */ |
| 48 |
Dwarf_Unsigned hm_key; |
| 49 |
|
| 50 |
/* val is something defined differently in different uses. |
| 51 |
for integer type it is |
| 52 |
0 means unknown |
| 53 |
-1 known signed |
| 54 |
1 known unsigned. */ |
| 55 |
int hm_val; |
| 56 |
/* Add fields here as needed. */ |
| 57 |
}; |
| 58 |
|
| 59 |
/* Add entry or set to known-signed or known-unsigned. */ |
| 60 |
struct Helpertree_Map_Entry_s * |
| 61 |
helpertree_add_entry( Dwarf_Unsigned offset, int val, |
| 62 |
struct Helpertree_Base_s *helper); |
| 63 |
|
| 64 |
/* Look for entry. Use hm_val (if non-null return) |
| 65 |
to determine signedness. */ |
| 66 |
struct Helpertree_Map_Entry_s * |
| 67 |
helpertree_find(Dwarf_Unsigned offset, |
| 68 |
struct Helpertree_Base_s *helper); |
| 69 |
|
| 70 |
void helpertree_clear_statistics(struct Helpertree_Base_s *helper); |
| 71 |
#endif /* HELPERTREE_H */ |