00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef pu_info_INCLUDED
00041 #define pu_info_INCLUDED
00042
00043 #if defined(BUILD_OS_DARWIN)
00044 #include "darwin_elf.h"
00045 #else
00046 #include <elf.h>
00047 #endif
00048
00049 #include "dwarf_DST_mem.h"
00050
00051 #ifndef _symtab_INCLUDED
00052 #include "symtab.h"
00053 #endif
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 #define PU_HEADER_VERSION 1
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083 #define WT_SYMTAB 0x0
00084 #define WT_TREE 0x1
00085 #define WT_DEPGRAPH 0x2
00086 #define WT_PREFETCH 0x3
00087 #define WT_REGIONS 0x4
00088 #define WT_FEEDBACK 0x5
00089 #define WT_FREQ 0x6
00090 #define WT_AC_INTERNAL 0x7
00091 #define WT_ALIAS_CLASS 0x8
00092
00093 #define WT_SUBSECTIONS 0x9
00094 #define WT_PROC_SYM -1
00095
00096
00097
00098
00099 #define PU_HAS_GLOBALS 0x1
00100
00101 #define PU_HAS_NESTED_PU 0x2
00102 #define PU_IS_COMPILER_GENERATED 0x4
00103 #define PU_IS_DRA_CLONE 0x8
00104 #define PU_PREGS_RENUMBERED 0x10
00105
00106
00107
00108
00109 #ifdef KEY
00110 #define PU_IS_PROFILER 0x20
00111 #endif
00112
00113 #define PU_INTERNAL_MASK 0xf0000000
00114 #define PU_DELETED 0x10000000
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132 typedef struct pu_info {
00133 struct pu_info *next;
00134 struct pu_info *child;
00135 mINT32 state;
00136
00137 ST_IDX proc_sym;
00138 mINT32 flags;
00139 DST_IDX pu_dst;
00140 DST_IDX cu_dst;
00141
00142
00143
00144 struct {
00145 Elf64_Word offset;
00146 union {
00147 Elf64_Word size;
00148 void *ptr;
00149 } u;
00150 } subsect[WT_SUBSECTIONS];
00151
00152
00153 struct wn_map_tab *maptab;
00154 } PU_Info;
00155
00156
00157 #define PU_Info_proc_sym(pu) (pu)->proc_sym
00158 #define PU_Info_proc_id(pu) (pu)->proc_sym
00159
00160 #ifdef __cplusplus
00161
00162 inline PU &
00163 PU_Info_pu(PU_Info *ppui)
00164 {
00165 return Pu_Table[ST_pu(St_Table[PU_Info_proc_sym(ppui)])];
00166 }
00167 #endif
00168
00169 #define PU_Info_subsect_offset(pu,scn) (pu)->subsect[scn].offset
00170 #define PU_Info_subsect_size(pu,scn) (pu)->subsect[scn].u.size
00171 #define PU_Info_subsect_ptr(pu,scn) (pu)->subsect[scn].u.ptr
00172 #define PU_Info_flags(pu) (pu)->flags
00173 #define PU_Info_pu_dst(pu) (pu)->pu_dst
00174 #define PU_Info_cu_dst(pu) (pu)->cu_dst
00175 #define PU_Info_cu_dst(pu) (pu)->cu_dst
00176 #define PU_Info_maptab(pu) (pu)->maptab
00177 #define PU_Info_next(pu) (pu)->next
00178 #define PU_Info_child(pu) (pu)->child
00179
00180 #define Set_PU_Info_flags(pu,flag_value) (pu)->flags |= (flag_value)
00181 #define Clear_PU_Info_flags(pu,flag_value) (pu)->flags &= ~(flag_value)
00182 #define Is_Set_PU_Info_flags(pu,flag_value) ((pu)->flags & (flag_value))
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195 typedef enum subsect_state {
00196 Subsect_Missing = 0,
00197 Subsect_Exists = 1,
00198 Subsect_InMem = 2,
00199 Subsect_Written = 3
00200 } Subsect_State;
00201
00202 #define PU_Info_state(pu, ndx) \
00203 (Subsect_State)(((pu)->state >> (((ndx) + 1) << 1)) & 0x3)
00204 #define Set_PU_Info_state(pu, ndx, st) (pu)->state = (pu)->state & \
00205 ~(0x3 << (((ndx) + 1) << 1)) | (st << (((ndx) + 1) << 1))
00206
00207
00208
00209
00210
00211
00212 #define PU_Info_symtab_ptr(pu) \
00213 (LOCAL_SYMTAB_HEADER_TABLE *) PU_Info_subsect_ptr((pu), WT_SYMTAB)
00214 #define PU_Info_tree_ptr(pu) \
00215 (WN *)PU_Info_subsect_ptr((pu), WT_TREE)
00216 #define PU_Info_depgraph_ptr(pu) \
00217 (void *)PU_Info_subsect_ptr((pu), WT_DEPGRAPH)
00218 #define PU_Info_regions_ptr(pu) \
00219 (struct region_id *)PU_Info_subsect_ptr((pu), WT_REGIONS)
00220 #define PU_Info_feedback_ptr(pu) \
00221 (void *)PU_Info_subsect_ptr((pu), WT_FEEDBACK)
00222 #define PU_Info_frequencies_ptr(pu) \
00223 (INT32 *) PU_Info_subsect_ptr((pu), WT_FREQ)
00224 #define PU_Info_alias_class_ptr(pu) \
00225 (INT32 *) PU_Info_subsect_ptr((pu), WT_ALIAS_CLASS)
00226 #define PU_Info_ac_internal_ptr(pu) \
00227 (void *) PU_Info_subsect_ptr((pu), WT_AC_INTERNAL)
00228
00229 #define Set_PU_Info_tree_ptr(pu,x) \
00230 PU_Info_subsect_ptr((pu), WT_TREE) = (void *)(x)
00231 #define Set_PU_Info_symtab_ptr(pu,x) \
00232 PU_Info_subsect_ptr((pu), WT_SYMTAB) = (void *)(x)
00233 #define Set_PU_Info_depgraph_ptr(pu,x) \
00234 PU_Info_subsect_ptr((pu), WT_DEPGRAPH) = (void *)(x)
00235 #define Set_PU_Info_regions_ptr(pu,x) \
00236 PU_Info_subsect_ptr((pu), WT_REGIONS) = (void *)(x)
00237 #define Set_PU_Info_feedback_ptr(pu,x) \
00238 PU_Info_subsect_ptr((pu), WT_FEEDBACK) = (void *)(x)
00239 #define Set_PU_Info_frequencies_ptr(pu,x) \
00240 PU_Info_subsect_ptr((pu), WT_FREQ) = (void *) (x)
00241 #define Set_PU_Info_alias_class_ptr(pu,x) \
00242 PU_Info_subsect_ptr((pu), WT_ALIAS_CLASS) = (void *) (x)
00243 #define Set_PU_Info_ac_internal_ptr(pu,x) \
00244 PU_Info_subsect_ptr((pu), WT_AC_INTERNAL) = (void *) (x)
00245
00246 #define Set_PU_Info_pu_dst(pu, x) \
00247 PU_Info_pu_dst(pu) = x;
00248 #define Set_PU_Info_cu_dst(pu, x) \
00249 PU_Info_cu_dst(pu) = x;
00250
00251
00252 #ifdef __cplusplus
00253 extern "C" {
00254 #endif
00255
00256 extern void PU_Info_init (PU_Info *pu);
00257 extern INT Sizeof_PU_Infos (PU_Info *pu_tree);
00258 extern INT Write_PU_Infos (PU_Info *pu_tree, char *base);
00259 extern PU_Info *Read_PU_Infos (char *base, INT32 size, INT32 *p_num_PUs);
00260
00261 extern PU_Info *Current_PU_Info;
00262
00263 extern void Save_Local_Symtab (SYMTAB_IDX level, PU_Info *pu);
00264 extern void Restore_Local_Symtab (PU_Info *pu);
00265
00266 #ifdef __cplusplus
00267 }
00268 #endif
00269
00270 #ifdef __cplusplus
00271
00272 inline PU &
00273 Current_PU_Info_pu()
00274 {
00275 return PU_Info_pu(Current_PU_Info);
00276 }
00277 #endif
00278
00279 #ifdef FIL
00280 extern PU_Info *Last_PU;
00281 #endif
00282 #endif