| 1 |
/* |
| 2 |
Copyright (C) 2021 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 ATTR_FORM_H |
| 28 |
#define ATTR_FORM_H |
| 29 |
#ifdef __cplusplus |
| 30 |
extern "C" { |
| 31 |
#endif /* __cplusplus */ |
| 32 |
|
| 33 |
#define AF_UNKNOWN 0 /* also means malloc, so free required */ |
| 34 |
#define AF_STD 1 /* also means static alloc, do not free */ |
| 35 |
#define AF_EXTEN 2 /* also means static alloc, do not free */ |
| 36 |
|
| 37 |
/* See also: glflags.gf_check_tag_tree |
| 38 |
all while respecting */ |
| 39 |
|
| 40 |
#define TK_OK 0 |
| 41 |
#define TK_SHOW_MESSAGE 1 |
| 42 |
#define TK_ERROR 2 |
| 43 |
|
| 44 |
/* For a tag->tag tree key1s a tag number, key 2 is a tag number |
| 45 |
and key3 is zero. |
| 46 |
For a tag->attr tree key1 is a tag number, key 2 is attrnum, |
| 47 |
and key3 is zero. |
| 48 |
for attr-> form tree key1 is DW_AT_ number, key2 is |
| 49 |
FORM_CLASS, key3 is a DW_FORM number. */ |
| 50 |
|
| 51 |
struct Three_Key_Entry_s { |
| 52 |
Dwarf_Half key1; |
| 53 |
Dwarf_Half key2; |
| 54 |
Dwarf_Half key3; |
| 55 |
|
| 56 |
/* Not from tables:0. std table:1. extension table:2. */ |
| 57 |
Dwarf_Small from_tables; |
| 58 |
Dwarf_Small reserved; |
| 59 |
Dwarf_Unsigned count; /* The number actually encountered |
| 60 |
in print_die.c */ |
| 61 |
}; |
| 62 |
typedef struct Three_Key_Entry_s Three_Key_Entry; |
| 63 |
|
| 64 |
/* Returns DW_DLV_ERROR if out of memory, else DW_DLV_OK */ |
| 65 |
int make_3key(Dwarf_Half k1, |
| 66 |
Dwarf_Half k2, |
| 67 |
Dwarf_Half k3, |
| 68 |
Dwarf_Small from_table, |
| 69 |
Dwarf_Small reserved, |
| 70 |
Dwarf_Unsigned count, |
| 71 |
Three_Key_Entry ** out); |
| 72 |
|
| 73 |
Dwarf_Unsigned three_key_entry_count(void *base); |
| 74 |
void free_func_3key_entry(void *keystructptr); |
| 75 |
int std_compare_3key_entry(const void *l, const void *r); |
| 76 |
|
| 77 |
/* First Calls the next five */ |
| 78 |
int dd_build_tag_attr_form_base_trees(int*errnum); |
| 79 |
|
| 80 |
void dd_destroy_tag_use_base_tree(void); |
| 81 |
void dd_destroy_tag_attr_form_trees(void); |
| 82 |
void record_attr_form_use(Dwarf_Debug dbg, |
| 83 |
Dwarf_Half tag, Dwarf_Half attr, |
| 84 |
Dwarf_Half fclass, Dwarf_Half form, |
| 85 |
int die_stack_indent_level); |
| 86 |
|
| 87 |
/* The standard main tree for attr_form data. |
| 88 |
Starting out as simple global variables. */ |
| 89 |
extern void * threekey_attr_form_base; /* for attr-form combos */ |
| 90 |
void print_attr_form_usage(void); |
| 91 |
|
| 92 |
void record_tag_tag_use(Dwarf_Debug dbg, |
| 93 |
Dwarf_Half tagp, Dwarf_Half tagc); |
| 94 |
void record_tag_attr_use(Dwarf_Debug dbg, |
| 95 |
Dwarf_Half tag, Dwarf_Half attrnum); |
| 96 |
|
| 97 |
/* The standard main trees for tag and attr use |
| 98 |
Starting out as simple global variables. */ |
| 99 |
extern void * threekey_tag_tag_base; /* tag-tree recording */ |
| 100 |
extern void * threekey_tag_attr_base; /* for tag_attr recording */ |
| 101 |
extern void * threekey_tag_use_base; /* for tag count recording */ |
| 102 |
/* The following two print all from the above trees.*/ |
| 103 |
/* FIXME and printing tag_use_base??? */ |
| 104 |
void print_tag_tree_usage(void); |
| 105 |
void print_tag_attr_usage(void); |
| 106 |
|
| 107 |
void dd_print_tag_tree_results(Dwarf_Unsigned tag_tag_count); |
| 108 |
void dd_print_tag_attr_results(Dwarf_Unsigned tag_attr_count); |
| 109 |
void dd_print_tag_use_results(Dwarf_Unsigned tag_count); |
| 110 |
|
| 111 |
#ifdef __cplusplus |
| 112 |
} |
| 113 |
#endif /* __cplusplus */ |
| 114 |
#endif /* ATTR_FORM_H */ |