symfile.h
4.25 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/*
* Copyright (C) 1996-1998 by the Board of Trustees
* of Leland Stanford Junior University.
*
* This file is part of the SimOS distribution.
* See LICENSE file for terms of the license.
*
*/
/*
* This module hides the layout of the symbol table from the user.
*
* Also, for SimOS address space reasons, the data for the symbol stuff
* is in another process. This file hides all that too.
*
* Since symfile hides all the symbol table layout and the rpc stuff
* don't expect the code to be pretty, its not.
*/
#ifndef _SYMFILE_H_
#define _SYMFILE_H_
#include "sym-sgi.h"
struct Execfile;
/*
* flags for symbol routines
*/
#define SYM_TAGS 1 /* for symlookup and symfind
* default is variable namespace
*/
#define SYM_RESOLVE 2 /* for symtype, symsubtype
* resolve all typedefs
*/
#define SYM_RECURSE 4 /* in symlookup, look into procs */
/*
* symbol types
*/
#define tNil 0
#define tChar 1
#define tUChar 2
#define tShort 3
#define tUShort 4
#define tInt 5
#define tUInt 6
#define tLong 7
#define tULong 8
#define tFloat 9
#define tDouble 10
#define tStruct 11
#define tUnion 12
#define tEnum 13
#define tTypedef 14
#define tPtr 15
#define tArray 16
#define tLabel 17
#define tProc 18
#define tStructDef 19
#define tUnionDef 20
#define tEnumDef 21
#define tAddr 22
#define tFile 23
#define tEnd 24
#define tBlock 25
#define tTypedefDef 26
#define tIndirect 27
/*
* opaque symb object
*/
#define MAX_TYPES 8
typedef struct Symb {
int type[MAX_TYPES];
int nextt;
Reg value;
char *name;
char global;
int isym;
int filenum;
int index;
RNDXR rndx;
int fip;
struct Execfile *exec;
} Symb;
#define DWARF_INDEX 0x8f8f8f8f /* marks sym as dwarf sym */
typedef struct SymbInfo {
char hier; /* can use SymIn and SymFind */
char basic; /* do not have subtypes */
char vartype; /* can be subtypes of tProc, tTypedef, tPtr, tArray */
char mass; /* value is an address in the object file */
} SymbInfo;
extern SymbInfo *SymInfo;
/*
* loading symbol tables
*/
int SymLoad(char *pathname, char *execname);
/*
* lookup address
*/
int SymAddr2Symbol(char *execname, int addr, Symb *sym);
/*
* line nuber stuff
*
* SymLine2Addr to be added.
*/
int SymLine2Addr(char *execname, char *srcfile, int line, Symb *sym);
/*
* symbol type info
*/
#define SymIsHier(_sym) (SymInfo[(_sym)->type[(_sym)->nextt]].hier)
#define SymIsBasicType(_sym) (SymInfo[(_sym)->type[(_sym)->nextt]].basic)
#define SymIsVarType(_sym) (SymInfo[(_sym)->type[(_sym)->nextt]].vartype)
#define SymIsMassive(_sym) (SymInfo[(_sym)->type[(_sym)->nextt]].mass)
/*
* symbol table navigation
*/
int SymLookup(char *execname, char *srcfile, char *symname, int flags, Symb *sym);
int SymFind(Symb *sym, char *name, int flags);
int SymNext(Symb *sym);
int SymIn(Symb *sym);
int SymSubtype(Symb *sym, int flags);
/*
* symbol info
*/
int SymType(Symb *sym, int flags);
#define SymValue(_sym) ((_sym)->value)
#define SymName(_sym) ((_sym)->name)
Reg_s SymSize(Symb *sym);
/*
* symbol type manipulation
*/
int SymTypeCast(char *execname, char *srcfile, int *types, char *name, Symb *sym);
int SymMakeAddr(Symb *sym);
#ifdef DWARF2
int Dwarf_SymLoad(char *pathname, char *execname);
int Dwarf_SymAddr2Symbol(char *execname, int addr, Symb *sym);
int Dwarf_SymLine2Addr(char *execname, char *srcfile, int line, Symb *sym);
int Dwarf_SymLookup(char *execname, char *srcfile, char *symname, int flags, Symb *sym);
int Dwarf_SymFind(Symb *sym, char *name, int flags);
int Dwarf_SymNext(Symb *sym);
int Dwarf_SymIn(Symb *sym);
int Dwarf_SymSubtype(Symb *sym, int flags);
int Dwarf_SymType(Symb *sym, int flags);
Reg64 Dwarf_SymSize(Symb *sym);
int Dwarf_SymTypeCast(char *execname, char *srcfile, int *types, char *name, Symb *sym);
int Dwarf_SymMakeAddr(Symb *sym);
#endif /* DWARF2 */
#endif