Add a real stub for Advpack.extract.
[wine/wine64.git] / dlls / dbghelp / dbghelp_private.h
blob01a6b411986caf06860becc6934a21f4ff4315aa
1 /*
2 * File dbghelp_private.h - dbghelp internal definitions
4 * Copyright (C) 1995, Alexandre Julliard
5 * Copyright (C) 1996, Eric Youngdale.
6 * Copyright (C) 1999-2000, Ulrich Weigand.
7 * Copyright (C) 2004, Eric Pouech.
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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"
32 #include "cvconst.h"
34 /* #define USE_STATS */
36 struct pool /* poor's man */
38 struct pool_arena* first;
39 unsigned arena_size;
42 void pool_init(struct pool* a, unsigned arena_size);
43 void pool_destroy(struct pool* a);
44 void* pool_alloc(struct pool* a, unsigned len);
45 /* void* pool_realloc(struct pool* a, void* p,
46 unsigned old_size, unsigned new_size); */
47 char* pool_strdup(struct pool* a, const char* str);
49 struct vector
51 void** buckets;
52 unsigned elt_size;
53 unsigned shift;
54 unsigned num_elts;
55 unsigned num_buckets;
58 void vector_init(struct vector* v, unsigned elt_sz, unsigned bucket_sz);
59 unsigned vector_length(const struct vector* v);
60 void* vector_at(const struct vector* v, unsigned pos);
61 void* vector_add(struct vector* v, struct pool* pool);
62 /*void vector_pool_normalize(struct vector* v, struct pool* pool); */
63 void* vector_iter_up(const struct vector* v, void* elt);
64 void* vector_iter_down(const struct vector* v, void* elt);
66 struct hash_table_elt
68 const char* name;
69 struct hash_table_elt* next;
72 struct hash_table
74 unsigned num_buckets;
75 struct hash_table_elt** buckets;
78 void hash_table_init(struct pool* pool, struct hash_table* ht,
79 unsigned num_buckets);
80 void hash_table_destroy(struct hash_table* ht);
81 void hash_table_add(struct hash_table* ht, struct hash_table_elt* elt);
82 void* hash_table_find(const struct hash_table* ht, const char* name);
83 unsigned hash_table_hash(const char* name, unsigned num_buckets);
85 struct hash_table_iter
87 const struct hash_table* ht;
88 struct hash_table_elt* element;
89 int index;
90 int last;
93 void hash_table_iter_init(const struct hash_table* ht,
94 struct hash_table_iter* hti, const char* name);
95 void* hash_table_iter_up(struct hash_table_iter* hti);
97 #define GET_ENTRY(__i, __t, __f) \
98 ((__t*)((char*)(__i) - (unsigned int)(&((__t*)0)->__f)))
101 extern unsigned dbghelp_options;
102 /* some more Wine extensions */
103 #define SYMOPT_WINE_WITH_ELF_MODULES 0x40000000
105 struct symt
107 enum SymTagEnum tag;
110 struct symt_ht
112 struct symt symt;
113 struct hash_table_elt hash_elt; /* if global symbol or type */
116 /* lexical tree */
117 struct symt_block
119 struct symt symt;
120 unsigned long address;
121 unsigned long size;
122 struct symt* container; /* block, or func */
123 struct vector vchildren; /* sub-blocks & local variables */
126 struct symt_compiland
128 struct symt symt;
129 unsigned source;
130 struct vector vchildren; /* global variables & functions */
133 struct symt_data
135 struct symt symt;
136 struct hash_table_elt hash_elt; /* if global symbol */
137 enum DataKind kind;
138 struct symt* container;
139 struct symt* type;
140 union /* depends on kind */
142 unsigned long address; /* DataIs{Global, FileStatic} */
143 struct
145 long offset; /* DataIs{Member,Local,Param} in bits*/
146 unsigned long length; /* DataIs{Member} in bits */
147 unsigned long reg_id; /* DataIs{Local} (0 if frame relative) */
148 } s;
149 VARIANT value; /* DataIsConstant */
150 } u;
153 struct symt_function
155 struct symt symt;
156 struct hash_table_elt hash_elt; /* if global symbol */
157 unsigned long address;
158 struct symt* container; /* compiland */
159 struct symt* type; /* points to function_signature */
160 unsigned long size;
161 struct vector vlines;
162 struct vector vchildren; /* locals, params, blocks, start/end, labels */
165 struct symt_function_point
167 struct symt symt; /* either SymTagFunctionDebugStart, SymTagFunctionDebugEnd, SymTagLabel */
168 struct symt_function* parent;
169 unsigned long offset;
170 const char* name; /* for labels */
173 struct symt_public
175 struct symt symt;
176 struct hash_table_elt hash_elt;
177 struct symt* container; /* compiland */
178 unsigned long address;
179 unsigned long size;
180 unsigned in_code : 1,
181 is_function : 1;
184 struct symt_thunk
186 struct symt symt;
187 struct hash_table_elt hash_elt;
188 struct symt* container; /* compiland */
189 unsigned long address;
190 unsigned long size;
191 THUNK_ORDINAL ordinal; /* FIXME: doesn't seem to be accessible */
194 /* class tree */
195 struct symt_array
197 struct symt symt;
198 int start;
199 int end;
200 struct symt* basetype;
203 struct symt_basic
205 struct symt symt;
206 struct hash_table_elt hash_elt;
207 enum BasicType bt;
208 unsigned long size;
211 struct symt_enum
213 struct symt symt;
214 const char* name;
215 struct vector vchildren;
218 struct symt_function_signature
220 struct symt symt;
221 struct symt* rettype;
222 struct vector vchildren;
225 struct symt_pointer
227 struct symt symt;
228 struct symt* pointsto;
231 struct symt_typedef
233 struct symt symt;
234 struct hash_table_elt hash_elt;
235 struct symt* type;
238 struct symt_udt
240 struct symt symt;
241 struct hash_table_elt hash_elt;
242 enum UdtKind kind;
243 int size;
244 struct vector vchildren;
247 enum module_type
249 DMT_UNKNOWN, /* for lookup, not actually used for a module */
250 DMT_ELF, /* a real ELF shared module */
251 DMT_PE, /* a native or builtin PE module */
252 DMT_PDB, /* PDB file */
255 struct module
257 IMAGEHLP_MODULE module;
258 struct module* next;
259 enum module_type type;
260 struct elf_module_info* elf_info;
262 /* memory allocation pool */
263 struct pool pool;
265 /* symbol tables */
266 int sortlist_valid;
267 struct symt_ht** addr_sorttab;
268 struct hash_table ht_symbols;
270 /* types */
271 struct hash_table ht_types;
272 struct vector vtypes;
274 /* source files */
275 unsigned sources_used;
276 unsigned sources_alloc;
277 char* sources;
280 struct process
282 struct process* next;
283 HANDLE handle;
284 char* search_path;
286 struct module* lmodules;
287 unsigned long dbg_hdr_addr;
289 IMAGEHLP_STACK_FRAME ctx_frame;
292 struct line_info
294 unsigned long is_first : 1,
295 is_last : 1,
296 is_source_file : 1,
297 line_number;
298 union
300 unsigned long pc_offset; /* if is_source_file isn't set */
301 unsigned source_file; /* if is_source_file is set */
302 } u;
305 /* dbghelp.c */
306 extern struct process* process_find_by_handle(HANDLE hProcess);
307 extern HANDLE hMsvcrt;
309 /* elf_module.c */
310 typedef BOOL (*elf_enum_modules_cb)(const char*, unsigned long addr, void* user);
311 extern BOOL elf_enum_modules(HANDLE hProc, elf_enum_modules_cb, void*);
312 extern BOOL elf_fetch_file_info(const char* name, DWORD* base, DWORD* size, DWORD* checksum);
313 struct elf_file_map;
314 extern BOOL elf_load_debug_info(struct module* module, struct elf_file_map* fmap);
315 extern struct module*
316 elf_load_module(struct process* pcs, const char* name, unsigned long);
317 extern BOOL elf_read_wine_loader_dbg_info(struct process* pcs);
318 extern BOOL elf_synchronize_module_list(struct process* pcs);
320 extern DWORD WINAPI addr_to_linear(HANDLE hProcess, HANDLE hThread, ADDRESS* addr);
322 /* module.c */
323 extern struct module*
324 module_find_by_addr(const struct process* pcs, unsigned long addr,
325 enum module_type type);
326 extern struct module*
327 module_find_by_name(const struct process* pcs,
328 const char* name, enum module_type type);
329 extern struct module*
330 module_get_debug(const struct process* pcs, struct module*);
331 extern struct module*
332 module_new(struct process* pcs, const char* name,
333 enum module_type type, unsigned long addr,
334 unsigned long size, unsigned long stamp,
335 unsigned long checksum);
336 extern struct module*
337 module_get_container(const struct process* pcs,
338 const struct module* inner);
339 extern struct module*
340 module_get_containee(const struct process* pcs,
341 const struct module* inner);
342 extern enum module_type
343 module_get_type_by_name(const char* name);
344 extern void module_reset_debug_info(struct module* module);
345 extern BOOL module_remove(struct process* pcs,
346 struct module* module);
347 /* msc.c */
348 extern BOOL pe_load_debug_directory(const struct process* pcs,
349 struct module* module,
350 const BYTE* mapping,
351 const IMAGE_SECTION_HEADER* sectp, DWORD nsect,
352 const IMAGE_DEBUG_DIRECTORY* dbg, int nDbg);
353 /* pe_module.c */
354 extern BOOL pe_load_nt_header(HANDLE hProc, DWORD base, IMAGE_NT_HEADERS* nth);
355 extern struct module*
356 pe_load_module(struct process* pcs, char* name,
357 HANDLE hFile, DWORD base, DWORD size);
358 extern struct module*
359 pe_load_module_from_pcs(struct process* pcs, const char* name,
360 const char* mod_name, DWORD base, DWORD size);
361 extern BOOL pe_load_debug_info(const struct process* pcs,
362 struct module* module);
363 /* source.c */
364 extern unsigned source_new(struct module* module, const char* source);
365 extern const char* source_get(const struct module* module, unsigned idx);
367 /* stabs.c */
368 extern BOOL stabs_parse(struct module* module, unsigned long load_offset,
369 const void* stabs, int stablen,
370 const char* strs, int strtablen);
372 /* dwarf.c */
373 extern BOOL dwarf2_parse(struct module* module, unsigned long load_offset,
374 const unsigned char* debug, unsigned int debug_size,
375 const unsigned char* abbrev, unsigned int abbrev_size,
376 const unsigned char* str, unsigned int str_sz);
378 /* symbol.c */
379 extern const char* symt_get_name(const struct symt* sym);
380 extern int symt_cmp_addr(const void* p1, const void* p2);
381 extern int symt_find_nearest(struct module* module, DWORD addr);
382 extern struct symt_compiland*
383 symt_new_compiland(struct module* module,
384 const char* filename);
385 extern struct symt_public*
386 symt_new_public(struct module* module,
387 struct symt_compiland* parent,
388 const char* typename,
389 unsigned long address, unsigned size,
390 BOOL in_code, BOOL is_func);
391 extern struct symt_data*
392 symt_new_global_variable(struct module* module,
393 struct symt_compiland* parent,
394 const char* name, unsigned is_static,
395 unsigned long addr, unsigned long size,
396 struct symt* type);
397 extern struct symt_function*
398 symt_new_function(struct module* module,
399 struct symt_compiland* parent,
400 const char* name,
401 unsigned long addr, unsigned long size,
402 struct symt* type);
403 extern BOOL symt_normalize_function(struct module* module,
404 struct symt_function* func);
405 extern void symt_add_func_line(struct module* module,
406 struct symt_function* func,
407 unsigned source_idx, int line_num,
408 unsigned long offset);
409 extern struct symt_data*
410 symt_add_func_local(struct module* module,
411 struct symt_function* func,
412 int regno, int offset,
413 struct symt_block* block,
414 struct symt* type, const char* name);
415 extern struct symt_block*
416 symt_open_func_block(struct module* module,
417 struct symt_function* func,
418 struct symt_block* block,
419 unsigned pc, unsigned len);
420 extern struct symt_block*
421 symt_close_func_block(struct module* module,
422 struct symt_function* func,
423 struct symt_block* block, unsigned pc);
424 extern struct symt_function_point*
425 symt_add_function_point(struct module* module,
426 struct symt_function* func,
427 enum SymTagEnum point,
428 unsigned offset, const char* name);
429 extern BOOL symt_fill_func_line_info(struct module* module,
430 struct symt_function* func,
431 DWORD addr, IMAGEHLP_LINE* line);
432 extern BOOL symt_get_func_line_next(struct module* module, PIMAGEHLP_LINE line);
433 extern struct symt_thunk*
434 symt_new_thunk(struct module* module,
435 struct symt_compiland* parent,
436 const char* name, THUNK_ORDINAL ord,
437 unsigned long addr, unsigned long size);
439 /* type.c */
440 extern void symt_init_basic(struct module* module);
441 extern BOOL symt_get_info(const struct symt* type,
442 IMAGEHLP_SYMBOL_TYPE_INFO req, void* pInfo);
443 extern struct symt_basic*
444 symt_new_basic(struct module* module, enum BasicType,
445 const char* typename, unsigned size);
446 extern struct symt_udt*
447 symt_new_udt(struct module* module, const char* typename,
448 unsigned size, enum UdtKind kind);
449 extern BOOL symt_set_udt_size(struct module* module,
450 struct symt_udt* type, unsigned size);
451 extern BOOL symt_add_udt_element(struct module* module,
452 struct symt_udt* udt_type,
453 const char* name,
454 struct symt* elt_type, unsigned offset,
455 unsigned size);
456 extern struct symt_enum*
457 symt_new_enum(struct module* module, const char* typename);
458 extern BOOL symt_add_enum_element(struct module* module,
459 struct symt_enum* enum_type,
460 const char* name, int value);
461 extern struct symt_array*
462 symt_new_array(struct module* module, int min, int max,
463 struct symt* base);
464 extern struct symt_function_signature*
465 symt_new_function_signature(struct module* module,
466 struct symt* ret_type);
467 extern BOOL symt_add_function_signature_parameter(struct module* module,
468 struct symt_function_signature* sig,
469 struct symt* param);
470 extern struct symt_pointer*
471 symt_new_pointer(struct module* module,
472 struct symt* ref_type);
473 extern struct symt_typedef*
474 symt_new_typedef(struct module* module, struct symt* ref,
475 const char* name);