samlib: Add stubbed samlib.dll.
[wine] / dlls / dbghelp / dbghelp_private.h
1 /*
2  * File dbghelp_private.h - dbghelp internal definitions
3  *
4  * Copyright (C) 1995, Alexandre Julliard
5  * Copyright (C) 1996, Eric Youngdale.
6  * Copyright (C) 1999-2000, Ulrich Weigand.
7  * Copyright (C) 2004-2007, Eric Pouech.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23
24 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winver.h"
28 #include "dbghelp.h"
29 #include "objbase.h"
30 #include "oaidl.h"
31 #include "winnls.h"
32 #include "wine/list.h"
33 #include "wine/unicode.h"
34
35 #include "cvconst.h"
36
37 /* #define USE_STATS */
38
39 struct pool /* poor's man */
40 {
41     struct list arena_list;
42     struct list arena_full;
43     size_t      arena_size;
44 };
45
46 void     pool_init(struct pool* a, size_t arena_size);
47 void     pool_destroy(struct pool* a);
48 void*    pool_alloc(struct pool* a, size_t len);
49 char*    pool_strdup(struct pool* a, const char* str);
50
51 struct vector
52 {
53     void**      buckets;
54     unsigned    elt_size;
55     unsigned    shift;
56     unsigned    num_elts;
57     unsigned    num_buckets;
58     unsigned    buckets_allocated;
59 };
60
61 void     vector_init(struct vector* v, unsigned elt_sz, unsigned bucket_sz);
62 unsigned vector_length(const struct vector* v);
63 void*    vector_at(const struct vector* v, unsigned pos);
64 void*    vector_add(struct vector* v, struct pool* pool);
65
66 struct sparse_array
67 {
68     struct vector               key2index;
69     struct vector               elements;
70 };
71
72 void     sparse_array_init(struct sparse_array* sa, unsigned elt_sz, unsigned bucket_sz);
73 void*    sparse_array_find(const struct sparse_array* sa, unsigned long idx);
74 void*    sparse_array_add(struct sparse_array* sa, unsigned long key, struct pool* pool);
75 unsigned sparse_array_length(const struct sparse_array* sa);
76
77 struct hash_table_elt
78 {
79     const char*                 name;
80     struct hash_table_elt*      next;
81 };
82
83 struct hash_table_bucket
84 {
85     struct hash_table_elt*      first;
86     struct hash_table_elt*      last;
87 };
88
89 struct hash_table
90 {
91     unsigned                    num_elts;
92     unsigned                    num_buckets;
93     struct hash_table_bucket*   buckets;
94     struct pool*                pool;
95 };
96
97 void     hash_table_init(struct pool* pool, struct hash_table* ht,
98                          unsigned num_buckets);
99 void     hash_table_destroy(struct hash_table* ht);
100 void     hash_table_add(struct hash_table* ht, struct hash_table_elt* elt);
101
102 struct hash_table_iter
103 {
104     const struct hash_table*    ht;
105     struct hash_table_elt*      element;
106     int                         index;
107     int                         last;
108 };
109
110 void     hash_table_iter_init(const struct hash_table* ht,
111                               struct hash_table_iter* hti, const char* name);
112 void*    hash_table_iter_up(struct hash_table_iter* hti);
113
114 #define GET_ENTRY(__i, __t, __f) \
115     ((__t*)((char*)(__i) - FIELD_OFFSET(__t,__f)))
116
117
118 extern unsigned dbghelp_options;
119 /* some more Wine extensions */
120 #define SYMOPT_WINE_WITH_NATIVE_MODULES 0x40000000
121
122 enum location_kind {loc_error,          /* reg is the error code */
123                     loc_unavailable,    /* location is not available */
124                     loc_absolute,       /* offset is the location */
125                     loc_register,       /* reg is the location */
126                     loc_regrel,         /* [reg+offset] is the location */
127                     loc_user,           /* value is debug information dependent,
128                                            reg & offset can be used ad libidem */
129 };
130
131 enum location_error {loc_err_internal = -1,     /* internal while computing */
132                      loc_err_too_complex = -2,  /* couldn't compute location (even at runtime) */
133                      loc_err_out_of_scope = -3, /* variable isn't available at current address */
134                      loc_err_cant_read = -4,    /* couldn't read memory at given address */
135 };
136
137 struct location
138 {
139     unsigned            kind : 8,
140                         reg;
141     unsigned long       offset;
142 };
143
144 struct symt
145 {
146     enum SymTagEnum             tag;
147 };
148
149 struct symt_ht
150 {
151     struct symt                 symt;
152     struct hash_table_elt       hash_elt;        /* if global symbol or type */
153 };
154
155 /* lexical tree */
156 struct symt_block
157 {
158     struct symt                 symt;
159     unsigned long               address;
160     unsigned long               size;
161     struct symt*                container;      /* block, or func */
162     struct vector               vchildren;      /* sub-blocks & local variables */
163 };
164
165 struct symt_compiland
166 {
167     struct symt                 symt;
168     unsigned long               address;
169     unsigned                    source;
170     struct vector               vchildren;      /* global variables & functions */
171 };
172
173 struct symt_data
174 {
175     struct symt                 symt;
176     struct hash_table_elt       hash_elt;       /* if global symbol */
177     enum DataKind               kind;
178     struct symt*                container;
179     struct symt*                type;
180     union                                       /* depends on kind */
181     {
182         /* DataIs{Global, FileStatic}:
183          *      loc.kind is loc_absolute
184          *      loc.offset is address
185          * DataIs{Local,Param}:
186          *      with loc.kind
187          *              loc_absolute    not supported
188          *              loc_register    location is in register loc.reg
189          *              loc_regrel      location is at address loc.reg + loc.offset
190          *              >= loc_user     ask debug info provider for resolution
191          */
192         struct location         var;
193         /* DataIs{Member} (all values are in bits, not bytes) */
194         struct
195         {
196             long                        offset;
197             unsigned long               length;
198         } member;
199         /* DataIsConstant */
200         VARIANT                 value;
201     } u;
202 };
203
204 struct symt_function
205 {
206     struct symt                 symt;
207     struct hash_table_elt       hash_elt;       /* if global symbol */
208     unsigned long               address;
209     struct symt*                container;      /* compiland */
210     struct symt*                type;           /* points to function_signature */
211     unsigned long               size;
212     struct vector               vlines;
213     struct vector               vchildren;      /* locals, params, blocks, start/end, labels */
214 };
215
216 struct symt_hierarchy_point
217 {
218     struct symt                 symt;           /* either SymTagFunctionDebugStart, SymTagFunctionDebugEnd, SymTagLabel */
219     struct hash_table_elt       hash_elt;       /* if label (and in compiland's hash table if global) */
220     struct symt*                parent;         /* symt_function or symt_compiland */
221     struct location             loc;
222 };
223
224 struct symt_public
225 {
226     struct symt                 symt;
227     struct hash_table_elt       hash_elt;
228     struct symt*                container;      /* compiland */
229     unsigned long               address;
230     unsigned long               size;
231 };
232
233 struct symt_thunk
234 {
235     struct symt                 symt;
236     struct hash_table_elt       hash_elt;
237     struct symt*                container;      /* compiland */
238     unsigned long               address;
239     unsigned long               size;
240     THUNK_ORDINAL               ordinal;        /* FIXME: doesn't seem to be accessible */
241 };
242
243 /* class tree */
244 struct symt_array
245 {
246     struct symt                 symt;
247     int                         start;
248     int                         end;            /* end index if > 0, or -array_len (in bytes) if < 0 */
249     struct symt*                base_type;
250     struct symt*                index_type;
251 };
252
253 struct symt_basic
254 {
255     struct symt                 symt;
256     struct hash_table_elt       hash_elt;
257     enum BasicType              bt;
258     unsigned long               size;
259 };
260
261 struct symt_enum
262 {
263     struct symt                 symt;
264     struct symt*                base_type;
265     const char*                 name;
266     struct vector               vchildren;
267 };
268
269 struct symt_function_signature
270 {
271     struct symt                 symt;
272     struct symt*                rettype;
273     struct vector               vchildren;
274     enum CV_call_e              call_conv;
275 };
276
277 struct symt_function_arg_type
278 {
279     struct symt                 symt;
280     struct symt*                arg_type;
281     struct symt*                container;
282 };
283
284 struct symt_pointer
285 {
286     struct symt                 symt;
287     struct symt*                pointsto;
288 };
289
290 struct symt_typedef
291 {
292     struct symt                 symt;
293     struct hash_table_elt       hash_elt;
294     struct symt*                type;
295 };
296
297 struct symt_udt
298 {
299     struct symt                 symt;
300     struct hash_table_elt       hash_elt;
301     enum UdtKind                kind;
302     int                         size;
303     struct vector               vchildren;
304 };
305
306 enum module_type
307 {
308     DMT_UNKNOWN,        /* for lookup, not actually used for a module */
309     DMT_ELF,            /* a real ELF shared module */
310     DMT_PE,             /* a native or builtin PE module */
311     DMT_MACHO,          /* a real Mach-O shared module */
312     DMT_PDB,            /* .PDB file */
313     DMT_DBG,            /* .DBG file */
314 };
315
316 struct process;
317 struct module;
318
319 /* a module can be made of several debug information formats, so we have to
320  * support them all
321  */
322 enum format_info
323 {
324     DFI_ELF,
325     DFI_PE,
326     DFI_MACHO,
327     DFI_DWARF,
328     DFI_LAST
329 };
330
331 struct module_format
332 {
333     struct module*              module;
334     void                        (*remove)(struct process* pcs, struct module_format* modfmt);
335     void                        (*loc_compute)(struct process* pcs,
336                                                const struct module_format* modfmt,
337                                                const struct symt_function* func,
338                                                struct location* loc);
339     union
340     {
341         struct elf_module_info*         elf_info;
342         struct dwarf2_module_info_s*    dwarf2_info;
343         struct pe_module_info*          pe_info;
344         struct macho_module_info*       macho_info;
345     } u;
346 };
347
348 struct module
349 {
350     IMAGEHLP_MODULEW64          module;
351     /* ANSI copy of module.ModuleName for efficiency */
352     char                        module_name[MAX_PATH];
353     struct module*              next;
354     enum module_type            type : 16;
355     unsigned short              is_virtual : 1;
356     DWORD64                     reloc_delta;
357
358     /* specific information for debug types */
359     struct module_format*       format_info[DFI_LAST];
360
361     /* memory allocation pool */
362     struct pool                 pool;
363
364     /* symbols & symbol tables */
365     struct vector               vsymt;
366     int                         sortlist_valid;
367     unsigned                    num_sorttab;    /* number of symbols with addresses */
368     unsigned                    num_symbols;
369     unsigned                    sorttab_size;
370     struct symt_ht**            addr_sorttab;
371     struct hash_table           ht_symbols;
372
373     /* types */
374     struct hash_table           ht_types;
375     struct vector               vtypes;
376
377     /* source files */
378     unsigned                    sources_used;
379     unsigned                    sources_alloc;
380     char*                       sources;
381 };
382
383 struct process 
384 {
385     struct process*             next;
386     HANDLE                      handle;
387     WCHAR*                      search_path;
388
389     PSYMBOL_REGISTERED_CALLBACK64       reg_cb;
390     PSYMBOL_REGISTERED_CALLBACK reg_cb32;
391     BOOL                        reg_is_unicode;
392     DWORD64                     reg_user;
393
394     struct module*              lmodules;
395     unsigned long               dbg_hdr_addr;
396
397     IMAGEHLP_STACK_FRAME        ctx_frame;
398
399     unsigned                    buffer_size;
400     void*                       buffer;
401 };
402
403 struct line_info
404 {
405     unsigned long               is_first : 1,
406                                 is_last : 1,
407                                 is_source_file : 1,
408                                 line_number;
409     union
410     {
411         unsigned long               pc_offset;   /* if is_source_file isn't set */
412         unsigned                    source_file; /* if is_source_file is set */
413     } u;
414 };
415
416 struct module_pair
417 {
418     struct process*             pcs;
419     struct module*              requested; /* in:  to module_get_debug() */
420     struct module*              effective; /* out: module with debug info */
421 };
422
423 enum pdb_kind {PDB_JG, PDB_DS};
424
425 struct pdb_lookup
426 {
427     const char*                 filename;
428     DWORD                       age;
429     enum pdb_kind               kind;
430     union
431     {
432         struct
433         {
434             DWORD               timestamp;
435             struct PDB_JG_TOC*  toc;
436         } jg;
437         struct
438         {
439             GUID                guid;
440             struct PDB_DS_TOC*  toc;
441         } ds;
442     } u;
443 };
444
445 struct cpu_stack_walk
446 {
447     HANDLE                      hProcess;
448     HANDLE                      hThread;
449     BOOL                        is32;
450     union
451     {
452         struct
453         {
454             PREAD_PROCESS_MEMORY_ROUTINE        f_read_mem;
455             PTRANSLATE_ADDRESS_ROUTINE          f_xlat_adr;
456             PFUNCTION_TABLE_ACCESS_ROUTINE      f_tabl_acs;
457             PGET_MODULE_BASE_ROUTINE            f_modl_bas;
458         } s32;
459         struct
460         {
461             PREAD_PROCESS_MEMORY_ROUTINE64      f_read_mem;
462             PTRANSLATE_ADDRESS_ROUTINE64        f_xlat_adr;
463             PFUNCTION_TABLE_ACCESS_ROUTINE64    f_tabl_acs;
464             PGET_MODULE_BASE_ROUTINE64          f_modl_bas;
465         } s64;
466     } u;
467 };
468
469 enum cpu_addr {cpu_addr_pc, cpu_addr_stack, cpu_addr_frame};
470 struct cpu
471 {
472     DWORD       machine;
473     DWORD       word_size;
474     /* address manipulation */
475     unsigned    (*get_addr)(HANDLE hThread, const CONTEXT* ctx,
476                             enum cpu_addr, ADDRESS64* addr);
477
478     /* stack manipulation */
479     BOOL        (*stack_walk)(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame, CONTEXT* context);
480
481     /* module manipulation */
482     void*       (*find_runtime_function)(struct module*, DWORD64 addr);
483
484     /* dwarf dedicated information */
485     unsigned    (*map_dwarf_register)(unsigned regno);
486
487     /* context related maniputation */
488     void*       (*fetch_context_reg)(CONTEXT* context, unsigned regno, unsigned* size);
489     const char* (*fetch_regname)(unsigned regno);
490 };
491
492 extern struct cpu*      dbghelp_current_cpu;
493
494 /* dbghelp.c */
495 extern struct process* process_find_by_handle(HANDLE hProcess);
496 extern HANDLE hMsvcrt;
497 extern BOOL         validate_addr64(DWORD64 addr);
498 extern BOOL         pcs_callback(const struct process* pcs, ULONG action, void* data);
499 extern void*        fetch_buffer(struct process* pcs, unsigned size);
500 extern const char*  wine_dbgstr_addr(const ADDRESS64* addr);
501 extern struct cpu*  cpu_find(DWORD);
502
503 /* crc32.c */
504 extern DWORD calc_crc32(int fd);
505
506 typedef BOOL (*enum_modules_cb)(const WCHAR*, unsigned long addr, void* user);
507
508 /* elf_module.c */
509 extern BOOL         elf_enum_modules(HANDLE hProc, enum_modules_cb, void*);
510 extern BOOL         elf_fetch_file_info(const WCHAR* name, DWORD* base, DWORD* size, DWORD* checksum);
511 struct image_file_map;
512 extern BOOL         elf_load_debug_info(struct module* module, struct image_file_map* fmap);
513 extern struct module*
514                     elf_load_module(struct process* pcs, const WCHAR* name, unsigned long);
515 extern BOOL         elf_read_wine_loader_dbg_info(struct process* pcs);
516 extern BOOL         elf_synchronize_module_list(struct process* pcs);
517 struct elf_thunk_area;
518 extern int          elf_is_in_thunk_area(unsigned long addr, const struct elf_thunk_area* thunks);
519
520 /* macho_module.c */
521 #define MACHO_NO_MAP    ((const void*)-1)
522 extern BOOL         macho_enum_modules(HANDLE hProc, enum_modules_cb, void*);
523 extern BOOL         macho_fetch_file_info(const WCHAR* name, DWORD* base, DWORD* size, DWORD* checksum);
524 struct macho_file_map;
525 extern BOOL         macho_load_debug_info(struct module* module, struct macho_file_map* fmap);
526 extern struct module*
527                     macho_load_module(struct process* pcs, const WCHAR* name, unsigned long);
528 extern BOOL         macho_read_wine_loader_dbg_info(struct process* pcs);
529 extern BOOL         macho_synchronize_module_list(struct process* pcs);
530
531 /* module.c */
532 extern const WCHAR      S_ElfW[];
533 extern const WCHAR      S_WineLoaderW[];
534 extern const WCHAR      S_WineW[];
535 extern const WCHAR      S_SlashW[];
536
537 extern struct module*
538                     module_find_by_addr(const struct process* pcs, unsigned long addr,
539                                         enum module_type type);
540 extern struct module*
541                     module_find_by_nameA(const struct process* pcs,
542                                          const char* name);
543 extern struct module*
544                     module_is_already_loaded(const struct process* pcs,
545                                              const WCHAR* imgname);
546 extern BOOL         module_get_debug(struct module_pair*);
547 extern struct module*
548                     module_new(struct process* pcs, const WCHAR* name,
549                                enum module_type type, BOOL virtual,
550                                DWORD64 addr, DWORD64 size,
551                                unsigned long stamp, unsigned long checksum);
552 extern struct module*
553                     module_get_containee(const struct process* pcs,
554                                          const struct module* inner);
555 extern enum module_type
556                     module_get_type_by_name(const WCHAR* name);
557 extern void         module_reset_debug_info(struct module* module);
558 extern BOOL         module_remove(struct process* pcs,
559                                   struct module* module);
560 extern void         module_set_module(struct module* module, const WCHAR* name);
561
562 /* msc.c */
563 extern BOOL         pe_load_debug_directory(const struct process* pcs,
564                                             struct module* module, 
565                                             const BYTE* mapping,
566                                             const IMAGE_SECTION_HEADER* sectp, DWORD nsect,
567                                             const IMAGE_DEBUG_DIRECTORY* dbg, int nDbg);
568 extern BOOL         pdb_fetch_file_info(struct pdb_lookup* pdb_lookup);
569
570 /* path.c */
571 extern BOOL         path_find_symbol_file(const struct process* pcs, PCSTR full_path,
572                                           const GUID* guid, DWORD dw1, DWORD dw2, PSTR buffer,
573                                           BOOL* is_unmatched);
574
575 /* pe_module.c */
576 extern BOOL         pe_load_nt_header(HANDLE hProc, DWORD64 base, IMAGE_NT_HEADERS* nth);
577 extern struct module*
578                     pe_load_native_module(struct process* pcs, const WCHAR* name,
579                                           HANDLE hFile, DWORD base, DWORD size);
580 extern struct module*
581                     pe_load_builtin_module(struct process* pcs, const WCHAR* name,
582                                            DWORD64 base, DWORD64 size);
583 extern BOOL         pe_load_debug_info(const struct process* pcs,
584                                        struct module* module);
585 extern const char*  pe_map_directory(struct module* module, int dirno, DWORD* size);
586 extern void         pe_unmap_directoy(struct module* module, int dirno);
587
588 /* source.c */
589 extern unsigned     source_new(struct module* module, const char* basedir, const char* source);
590 extern const char*  source_get(const struct module* module, unsigned idx);
591
592 /* stabs.c */
593 typedef void (*stabs_def_cb)(struct module* module, unsigned long load_offset,
594                                 const char* name, unsigned long offset,
595                                 BOOL is_public, BOOL is_global, unsigned char other,
596                                 struct symt_compiland* compiland, void* user);
597 extern BOOL         stabs_parse(struct module* module, unsigned long load_offset,
598                                 const void* stabs, int stablen,
599                                 const char* strs, int strtablen,
600                                 stabs_def_cb callback, void* user);
601
602 /* dwarf.c */
603 extern BOOL         dwarf2_parse(struct module* module, unsigned long load_offset,
604                                  const struct elf_thunk_area* thunks,
605                                  struct image_file_map* fmap);
606 extern BOOL         dwarf2_virtual_unwind(struct cpu_stack_walk* csw, DWORD_PTR ip,
607                                           CONTEXT* context, ULONG_PTR* cfa);
608
609 /* stack.c */
610 extern BOOL         sw_read_mem(struct cpu_stack_walk* csw, DWORD64 addr, void* ptr, DWORD sz);
611 extern DWORD64      sw_xlat_addr(struct cpu_stack_walk* csw, ADDRESS64* addr);
612 extern void*        sw_table_access(struct cpu_stack_walk* csw, DWORD64 addr);
613 extern DWORD64      sw_module_base(struct cpu_stack_walk* csw, DWORD64 addr);
614
615 /* symbol.c */
616 extern const char*  symt_get_name(const struct symt* sym);
617 extern struct module* symt_cmp_addr_module;
618 extern int          symt_cmp_addr(const void* p1, const void* p2);
619 extern void         copy_symbolW(SYMBOL_INFOW* siw, const SYMBOL_INFO* si);
620 extern struct symt_ht*
621                     symt_find_nearest(struct module* module, DWORD_PTR addr);
622 extern struct symt_compiland*
623                     symt_new_compiland(struct module* module, unsigned long address,
624                                        unsigned src_idx);
625 extern struct symt_public*
626                     symt_new_public(struct module* module, 
627                                     struct symt_compiland* parent, 
628                                     const char* typename,
629                                     unsigned long address, unsigned size);
630 extern struct symt_data*
631                     symt_new_global_variable(struct module* module, 
632                                              struct symt_compiland* parent,
633                                              const char* name, unsigned is_static,
634                                              unsigned long addr, unsigned long size, 
635                                              struct symt* type);
636 extern struct symt_function*
637                     symt_new_function(struct module* module,
638                                       struct symt_compiland* parent,
639                                       const char* name,
640                                       unsigned long addr, unsigned long size,
641                                       struct symt* type);
642 extern BOOL         symt_normalize_function(struct module* module, 
643                                             const struct symt_function* func);
644 extern void         symt_add_func_line(struct module* module,
645                                        struct symt_function* func, 
646                                        unsigned source_idx, int line_num, 
647                                        unsigned long offset);
648 extern struct symt_data*
649                     symt_add_func_local(struct module* module, 
650                                         struct symt_function* func, 
651                                         enum DataKind dt, const struct location* loc,
652                                         struct symt_block* block,
653                                         struct symt* type, const char* name);
654 extern struct symt_block*
655                     symt_open_func_block(struct module* module, 
656                                          struct symt_function* func,
657                                          struct symt_block* block, 
658                                          unsigned pc, unsigned len);
659 extern struct symt_block*
660                     symt_close_func_block(struct module* module, 
661                                           const struct symt_function* func,
662                                           struct symt_block* block, unsigned pc);
663 extern struct symt_hierarchy_point*
664                     symt_add_function_point(struct module* module, 
665                                             struct symt_function* func,
666                                             enum SymTagEnum point, 
667                                             const struct location* loc,
668                                             const char* name);
669 extern BOOL         symt_fill_func_line_info(const struct module* module,
670                                              const struct symt_function* func,
671                                              DWORD64 addr, IMAGEHLP_LINE64* line);
672 extern BOOL         symt_get_func_line_next(const struct module* module, PIMAGEHLP_LINE64 line);
673 extern struct symt_thunk*
674                     symt_new_thunk(struct module* module, 
675                                    struct symt_compiland* parent,
676                                    const char* name, THUNK_ORDINAL ord,
677                                    unsigned long addr, unsigned long size);
678 extern struct symt_data*
679                     symt_new_constant(struct module* module,
680                                       struct symt_compiland* parent,
681                                       const char* name, struct symt* type,
682                                       const VARIANT* v);
683 extern struct symt_hierarchy_point*
684                     symt_new_label(struct module* module,
685                                    struct symt_compiland* compiland,
686                                    const char* name, unsigned long address);
687 extern struct symt* symt_index2ptr(struct module* module, DWORD id);
688 extern DWORD        symt_ptr2index(struct module* module, const struct symt* sym);
689
690 /* type.c */
691 extern void         symt_init_basic(struct module* module);
692 extern BOOL         symt_get_info(struct module* module, const struct symt* type,
693                                   IMAGEHLP_SYMBOL_TYPE_INFO req, void* pInfo);
694 extern struct symt_basic*
695                     symt_new_basic(struct module* module, enum BasicType, 
696                                    const char* typename, unsigned size);
697 extern struct symt_udt*
698                     symt_new_udt(struct module* module, const char* typename,
699                                  unsigned size, enum UdtKind kind);
700 extern BOOL         symt_set_udt_size(struct module* module,
701                                       struct symt_udt* type, unsigned size);
702 extern BOOL         symt_add_udt_element(struct module* module, 
703                                          struct symt_udt* udt_type, 
704                                          const char* name,
705                                          struct symt* elt_type, unsigned offset, 
706                                          unsigned size);
707 extern struct symt_enum*
708                     symt_new_enum(struct module* module, const char* typename,
709                                   struct symt* basetype);
710 extern BOOL         symt_add_enum_element(struct module* module, 
711                                           struct symt_enum* enum_type, 
712                                           const char* name, int value);
713 extern struct symt_array*
714                     symt_new_array(struct module* module, int min, int max, 
715                                    struct symt* base, struct symt* index);
716 extern struct symt_function_signature*
717                     symt_new_function_signature(struct module* module, 
718                                                 struct symt* ret_type,
719                                                 enum CV_call_e call_conv);
720 extern BOOL         symt_add_function_signature_parameter(struct module* module,
721                                                           struct symt_function_signature* sig,
722                                                           struct symt* param);
723 extern struct symt_pointer*
724                     symt_new_pointer(struct module* module, 
725                                      struct symt* ref_type);
726 extern struct symt_typedef*
727                     symt_new_typedef(struct module* module, struct symt* ref, 
728                                      const char* name);