2 * File types.c - management of types (hierarchical tree)
4 * Copyright (C) 1997, Eric Youngdale.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 * Note: This really doesn't do much at the moment, but it forms the framework
22 * upon which full support for datatype handling will eventually be built.
25 #define NONAMELESSUNION
35 #include "wine/debug.h"
36 #include "dbghelp_private.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp
);
39 WINE_DECLARE_DEBUG_CHANNEL(dbghelp_symt
);
41 static const char* symt_get_tag_str(DWORD tag
)
45 case SymTagNull
: return "SymTagNull";
46 case SymTagExe
: return "SymTagExe";
47 case SymTagCompiland
: return "SymTagCompiland";
48 case SymTagCompilandDetails
: return "SymTagCompilandDetails";
49 case SymTagCompilandEnv
: return "SymTagCompilandEnv";
50 case SymTagFunction
: return "SymTagFunction";
51 case SymTagBlock
: return "SymTagBlock";
52 case SymTagData
: return "SymTagData";
53 case SymTagAnnotation
: return "SymTagAnnotation";
54 case SymTagLabel
: return "SymTagLabel";
55 case SymTagPublicSymbol
: return "SymTagPublicSymbol";
56 case SymTagUDT
: return "SymTagUDT";
57 case SymTagEnum
: return "SymTagEnum";
58 case SymTagFunctionType
: return "SymTagFunctionType";
59 case SymTagPointerType
: return "SymTagPointerType";
60 case SymTagArrayType
: return "SymTagArrayType";
61 case SymTagBaseType
: return "SymTagBaseType";
62 case SymTagTypedef
: return "SymTagTypedef,";
63 case SymTagBaseClass
: return "SymTagBaseClass";
64 case SymTagFriend
: return "SymTagFriend";
65 case SymTagFunctionArgType
: return "SymTagFunctionArgType,";
66 case SymTagFuncDebugStart
: return "SymTagFuncDebugStart,";
67 case SymTagFuncDebugEnd
: return "SymTagFuncDebugEnd";
68 case SymTagUsingNamespace
: return "SymTagUsingNamespace,";
69 case SymTagVTableShape
: return "SymTagVTableShape";
70 case SymTagVTable
: return "SymTagVTable";
71 case SymTagCustom
: return "SymTagCustom";
72 case SymTagThunk
: return "SymTagThunk";
73 case SymTagCustomType
: return "SymTagCustomType";
74 case SymTagManagedType
: return "SymTagManagedType";
75 case SymTagDimension
: return "SymTagDimension";
76 default: return "---";
80 const char* symt_get_name(const struct symt
* sym
)
85 case SymTagData
: return ((const struct symt_data
*)sym
)->hash_elt
.name
;
86 case SymTagFunction
: return ((const struct symt_function
*)sym
)->hash_elt
.name
;
87 case SymTagPublicSymbol
: return ((const struct symt_public
*)sym
)->hash_elt
.name
;
88 case SymTagBaseType
: return ((const struct symt_basic
*)sym
)->hash_elt
.name
;
89 case SymTagLabel
: return ((const struct symt_hierarchy_point
*)sym
)->hash_elt
.name
;
90 case SymTagThunk
: return ((const struct symt_thunk
*)sym
)->hash_elt
.name
;
92 case SymTagEnum
: return ((const struct symt_enum
*)sym
)->name
;
93 case SymTagTypedef
: return ((const struct symt_typedef
*)sym
)->hash_elt
.name
;
94 case SymTagUDT
: return ((const struct symt_udt
*)sym
)->hash_elt
.name
;
96 FIXME("Unsupported sym-tag %s\n", symt_get_tag_str(sym
->tag
));
99 case SymTagPointerType
:
100 case SymTagFunctionType
:
105 static struct symt
* symt_find_type_by_name(const struct module
* module
,
106 enum SymTagEnum sym_tag
,
107 const char* typename
)
110 struct symt_ht
* type
;
111 struct hash_table_iter hti
;
116 hash_table_iter_init(&module
->ht_types
, &hti
, typename
);
117 while ((ptr
= hash_table_iter_up(&hti
)))
119 type
= GET_ENTRY(ptr
, struct symt_ht
, hash_elt
);
121 if ((sym_tag
== SymTagNull
|| type
->symt
.tag
== sym_tag
) &&
122 type
->hash_elt
.name
&& !strcmp(type
->hash_elt
.name
, typename
))
125 SetLastError(ERROR_INVALID_NAME
); /* FIXME ?? */
129 static void symt_add_type(struct module
* module
, struct symt
* symt
)
132 p
= vector_add(&module
->vtypes
, &module
->pool
);
137 struct symt_basic
* symt_new_basic(struct module
* module
, enum BasicType bt
,
138 const char* typename
, unsigned size
)
140 struct symt_basic
* sym
;
144 sym
= (struct symt_basic
*)symt_find_type_by_name(module
, SymTagBaseType
,
146 if (sym
&& sym
->bt
== bt
&& sym
->size
== size
)
149 if ((sym
= pool_alloc(&module
->pool
, sizeof(*sym
))))
151 sym
->symt
.tag
= SymTagBaseType
;
154 sym
->hash_elt
.name
= pool_strdup(&module
->pool
, typename
);
155 hash_table_add(&module
->ht_types
, &sym
->hash_elt
);
156 } else sym
->hash_elt
.name
= NULL
;
159 symt_add_type(module
, &sym
->symt
);
164 struct symt_udt
* symt_new_udt(struct module
* module
, const char* typename
,
165 unsigned size
, enum UdtKind kind
)
167 struct symt_udt
* sym
;
169 TRACE_(dbghelp_symt
)("Adding udt %s:%s\n",
170 debugstr_w(module
->module
.ModuleName
), typename
);
171 if ((sym
= pool_alloc(&module
->pool
, sizeof(*sym
))))
173 sym
->symt
.tag
= SymTagUDT
;
178 sym
->hash_elt
.name
= pool_strdup(&module
->pool
, typename
);
179 hash_table_add(&module
->ht_types
, &sym
->hash_elt
);
180 } else sym
->hash_elt
.name
= NULL
;
181 vector_init(&sym
->vchildren
, sizeof(struct symt
*), 8);
182 symt_add_type(module
, &sym
->symt
);
187 BOOL
symt_set_udt_size(struct module
* module
, struct symt_udt
* udt
, unsigned size
)
189 assert(udt
->symt
.tag
== SymTagUDT
);
190 if (vector_length(&udt
->vchildren
) != 0)
192 if (udt
->size
!= size
)
193 FIXME_(dbghelp_symt
)("Changing size for %s from %u to %u\n",
194 udt
->hash_elt
.name
, udt
->size
, size
);
201 /******************************************************************
202 * symt_add_udt_element
204 * add an element to a udt (struct, class, union)
205 * the size & offset parameters are expressed in bits (not bytes) so that
206 * we can mix in the single call bytes aligned elements (regular fields) and
207 * the others (bit fields)
209 BOOL
symt_add_udt_element(struct module
* module
, struct symt_udt
* udt_type
,
210 const char* name
, struct symt
* elt_type
,
211 unsigned offset
, unsigned size
)
216 assert(udt_type
->symt
.tag
== SymTagUDT
);
218 TRACE_(dbghelp_symt
)("Adding %s to UDT %s\n", name
, udt_type
->hash_elt
.name
);
222 for (i
=0; i
<vector_length(&udt_type
->vchildren
); i
++)
224 m
= *(struct symt_data
**)vector_at(&udt_type
->vchildren
, i
);
226 assert(m
->symt
.tag
== SymTagData
);
227 if (strcmp(m
->hash_elt
.name
, name
) == 0)
232 if ((m
= pool_alloc(&module
->pool
, sizeof(*m
))) == NULL
) return FALSE
;
233 memset(m
, 0, sizeof(*m
));
234 m
->symt
.tag
= SymTagData
;
235 m
->hash_elt
.name
= name
? pool_strdup(&module
->pool
, name
) : "";
236 m
->hash_elt
.next
= NULL
;
238 m
->kind
= DataIsMember
;
239 m
->container
= &udt_type
->symt
;
241 m
->u
.member
.offset
= offset
;
242 m
->u
.member
.length
= ((offset
& 7) || (size
& 7)) ? size
: 0;
243 p
= vector_add(&udt_type
->vchildren
, &module
->pool
);
249 struct symt_enum
* symt_new_enum(struct module
* module
, const char* typename
,
250 struct symt
* basetype
)
252 struct symt_enum
* sym
;
254 if ((sym
= pool_alloc(&module
->pool
, sizeof(*sym
))))
256 sym
->symt
.tag
= SymTagEnum
;
257 sym
->name
= (typename
) ? pool_strdup(&module
->pool
, typename
) : NULL
;
258 sym
->base_type
= basetype
;
259 vector_init(&sym
->vchildren
, sizeof(struct symt
*), 8);
264 BOOL
symt_add_enum_element(struct module
* module
, struct symt_enum
* enum_type
,
265 const char* name
, int value
)
270 assert(enum_type
->symt
.tag
== SymTagEnum
);
271 e
= pool_alloc(&module
->pool
, sizeof(*e
));
272 if (e
== NULL
) return FALSE
;
274 e
->symt
.tag
= SymTagData
;
275 e
->hash_elt
.name
= pool_strdup(&module
->pool
, name
);
276 e
->hash_elt
.next
= NULL
;
277 e
->kind
= DataIsConstant
;
278 e
->container
= &enum_type
->symt
;
279 e
->type
= enum_type
->base_type
;
280 e
->u
.value
.n1
.n2
.vt
= VT_I4
;
281 e
->u
.value
.n1
.n2
.n3
.lVal
= value
;
283 p
= vector_add(&enum_type
->vchildren
, &module
->pool
);
284 if (!p
) return FALSE
; /* FIXME we leak e */
290 struct symt_array
* symt_new_array(struct module
* module
, int min
, int max
,
291 struct symt
* base
, struct symt
* index
)
293 struct symt_array
* sym
;
295 if ((sym
= pool_alloc(&module
->pool
, sizeof(*sym
))))
297 sym
->symt
.tag
= SymTagArrayType
;
300 sym
->base_type
= base
;
301 sym
->index_type
= index
;
302 symt_add_type(module
, &sym
->symt
);
307 struct symt_function_signature
* symt_new_function_signature(struct module
* module
,
308 struct symt
* ret_type
,
309 enum CV_call_e call_conv
)
311 struct symt_function_signature
* sym
;
313 if ((sym
= pool_alloc(&module
->pool
, sizeof(*sym
))))
315 sym
->symt
.tag
= SymTagFunctionType
;
316 sym
->rettype
= ret_type
;
317 vector_init(&sym
->vchildren
, sizeof(struct symt
*), 4);
318 sym
->call_conv
= call_conv
;
319 symt_add_type(module
, &sym
->symt
);
324 BOOL
symt_add_function_signature_parameter(struct module
* module
,
325 struct symt_function_signature
* sig_type
,
329 struct symt_function_arg_type
* arg
;
331 assert(sig_type
->symt
.tag
== SymTagFunctionType
);
332 arg
= pool_alloc(&module
->pool
, sizeof(*arg
));
333 if (!arg
) return FALSE
;
334 arg
->symt
.tag
= SymTagFunctionArgType
;
335 arg
->arg_type
= param
;
336 arg
->container
= &sig_type
->symt
;
337 p
= vector_add(&sig_type
->vchildren
, &module
->pool
);
338 if (!p
) return FALSE
; /* FIXME we leak arg */
344 struct symt_pointer
* symt_new_pointer(struct module
* module
, struct symt
* ref_type
)
346 struct symt_pointer
* sym
;
348 if ((sym
= pool_alloc(&module
->pool
, sizeof(*sym
))))
350 sym
->symt
.tag
= SymTagPointerType
;
351 sym
->pointsto
= ref_type
;
352 symt_add_type(module
, &sym
->symt
);
357 struct symt_typedef
* symt_new_typedef(struct module
* module
, struct symt
* ref
,
360 struct symt_typedef
* sym
;
362 if ((sym
= pool_alloc(&module
->pool
, sizeof(*sym
))))
364 sym
->symt
.tag
= SymTagTypedef
;
366 sym
->hash_elt
.name
= pool_strdup(&module
->pool
, name
);
367 hash_table_add(&module
->ht_types
, &sym
->hash_elt
);
368 symt_add_type(module
, &sym
->symt
);
373 /******************************************************************
374 * SymEnumTypes (DBGHELP.@)
377 BOOL WINAPI
SymEnumTypes(HANDLE hProcess
, ULONG64 BaseOfDll
,
378 PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback
,
381 struct module_pair pair
;
382 char buffer
[sizeof(SYMBOL_INFO
) + 256];
383 SYMBOL_INFO
* sym_info
= (SYMBOL_INFO
*)buffer
;
389 TRACE("(%p %s %p %p)\n",
390 hProcess
, wine_dbgstr_longlong(BaseOfDll
), EnumSymbolsCallback
,
393 if (!(pair
.pcs
= process_find_by_handle(hProcess
))) return FALSE
;
394 pair
.requested
= module_find_by_addr(pair
.pcs
, BaseOfDll
, DMT_UNKNOWN
);
395 if (!module_get_debug(&pair
)) return FALSE
;
397 sym_info
->SizeOfStruct
= sizeof(SYMBOL_INFO
);
398 sym_info
->MaxNameLen
= sizeof(buffer
) - sizeof(SYMBOL_INFO
);
400 for (i
=0; i
<vector_length(&pair
.effective
->vtypes
); i
++)
402 type
= *(struct symt
**)vector_at(&pair
.effective
->vtypes
, i
);
403 sym_info
->TypeIndex
= (DWORD
)type
;
404 sym_info
->info
= 0; /* FIXME */
405 symt_get_info(type
, TI_GET_LENGTH
, &size
);
406 sym_info
->Size
= size
;
407 sym_info
->ModBase
= pair
.requested
->module
.BaseOfImage
;
408 sym_info
->Flags
= 0; /* FIXME */
409 sym_info
->Value
= 0; /* FIXME */
410 sym_info
->Address
= 0; /* FIXME */
411 sym_info
->Register
= 0; /* FIXME */
412 sym_info
->Scope
= 0; /* FIXME */
413 sym_info
->Tag
= type
->tag
;
414 tmp
= symt_get_name(type
);
417 sym_info
->NameLen
= min(strlen(tmp
),sym_info
->MaxNameLen
-1);
418 memcpy(sym_info
->Name
, tmp
, sym_info
->NameLen
);
419 sym_info
->Name
[sym_info
->NameLen
] = '\0';
422 sym_info
->Name
[sym_info
->NameLen
= 0] = '\0';
423 if (!EnumSymbolsCallback(sym_info
, sym_info
->Size
, UserContext
)) break;
428 struct enum_types_AtoW
430 char buffer
[sizeof(SYMBOL_INFOW
) + 256 * sizeof(WCHAR
)];
432 PSYM_ENUMERATESYMBOLS_CALLBACKW callback
;
435 static BOOL CALLBACK
enum_types_AtoW(PSYMBOL_INFO si
, ULONG addr
, PVOID _et
)
437 struct enum_types_AtoW
* et
= _et
;
438 SYMBOL_INFOW
* siW
= (SYMBOL_INFOW
*)et
->buffer
;
440 copy_symbolW(siW
, si
);
441 return et
->callback(siW
, addr
, et
->user
);
444 /******************************************************************
445 * SymEnumTypesW (DBGHELP.@)
448 BOOL WINAPI
SymEnumTypesW(HANDLE hProcess
, ULONG64 BaseOfDll
,
449 PSYM_ENUMERATESYMBOLS_CALLBACKW EnumSymbolsCallback
,
452 struct enum_types_AtoW et
;
454 et
.callback
= EnumSymbolsCallback
;
455 et
.user
= UserContext
;
457 return SymEnumTypes(hProcess
, BaseOfDll
, enum_types_AtoW
, &et
);
460 /******************************************************************
463 * Retrieves information about a symt (either symbol or type)
465 BOOL
symt_get_info(const struct symt
* type
, IMAGEHLP_SYMBOL_TYPE_INFO req
,
470 if (!type
) return FALSE
;
472 /* helper to typecast pInfo to its expected type (_t) */
473 #define X(_t) (*((_t*)pInfo))
477 case TI_FINDCHILDREN
:
479 const struct vector
* v
;
482 TI_FINDCHILDREN_PARAMS
* tifp
= pInfo
;
486 case SymTagUDT
: v
= &((const struct symt_udt
*)type
)->vchildren
; break;
487 case SymTagEnum
: v
= &((const struct symt_enum
*)type
)->vchildren
; break;
488 case SymTagFunctionType
: v
= &((const struct symt_function_signature
*)type
)->vchildren
; break;
489 case SymTagFunction
: v
= &((const struct symt_function
*)type
)->vchildren
; break;
491 FIXME("Unsupported sym-tag %s for find-children\n",
492 symt_get_tag_str(type
->tag
));
495 for (i
= 0; i
< tifp
->Count
; i
++)
497 if (!(pt
= vector_at(v
, tifp
->Start
+ i
))) return FALSE
;
498 tifp
->ChildId
[i
] = (DWORD
)*pt
;
507 switch (((const struct symt_data
*)type
)->kind
)
510 case DataIsFileStatic
:
511 X(ULONG64
) = ((const struct symt_data
*)type
)->u
.var
.offset
;
513 default: return FALSE
;
517 X(ULONG64
) = ((const struct symt_function
*)type
)->address
;
519 case SymTagPublicSymbol
:
520 X(ULONG64
) = ((const struct symt_public
*)type
)->address
;
522 case SymTagFuncDebugStart
:
523 case SymTagFuncDebugEnd
:
525 if (!symt_get_info(((const struct symt_hierarchy_point
*)type
)->parent
,
528 X(ULONG64
) += ((const struct symt_hierarchy_point
*)type
)->loc
.offset
;
531 X(ULONG64
) = ((const struct symt_thunk
*)type
)->address
;
533 case SymTagCompiland
:
534 X(ULONG64
) = ((const struct symt_compiland
*)type
)->address
;
537 FIXME("Unsupported sym-tag %s for get-address\n",
538 symt_get_tag_str(type
->tag
));
543 case TI_GET_BASETYPE
:
547 X(DWORD
) = ((const struct symt_basic
*)type
)->bt
;
557 case TI_GET_BITPOSITION
:
558 if (type
->tag
== SymTagData
&&
559 ((const struct symt_data
*)type
)->kind
== DataIsMember
&&
560 ((const struct symt_data
*)type
)->u
.member
.length
!= 0)
561 X(DWORD
) = ((const struct symt_data
*)type
)->u
.member
.offset
& 7;
565 case TI_GET_CHILDRENCOUNT
:
569 X(DWORD
) = vector_length(&((const struct symt_udt
*)type
)->vchildren
);
572 X(DWORD
) = vector_length(&((const struct symt_enum
*)type
)->vchildren
);
574 case SymTagFunctionType
:
575 X(DWORD
) = vector_length(&((const struct symt_function_signature
*)type
)->vchildren
);
578 X(DWORD
) = vector_length(&((const struct symt_function
*)type
)->vchildren
);
580 case SymTagPointerType
: /* MS does it that way */
581 case SymTagArrayType
: /* MS does it that way */
582 case SymTagThunk
: /* MS does it that way */
586 FIXME("Unsupported sym-tag %s for get-children-count\n",
587 symt_get_tag_str(type
->tag
));
590 case SymTagPublicSymbol
:
599 case SymTagArrayType
:
600 X(DWORD
) = ((const struct symt_array
*)type
)->end
-
601 ((const struct symt_array
*)type
)->start
+ 1;
603 case SymTagFunctionType
:
604 /* this seems to be wrong for (future) C++ methods, where 'this' parameter
605 * should be included in this value (and not in GET_CHILDREN_COUNT)
607 X(DWORD
) = vector_length(&((const struct symt_function_signature
*)type
)->vchildren
);
609 default: return FALSE
;
613 case TI_GET_DATAKIND
:
614 if (type
->tag
!= SymTagData
) return FALSE
;
615 X(DWORD
) = ((const struct symt_data
*)type
)->kind
;
622 X(DWORD64
) = ((const struct symt_basic
*)type
)->size
;
625 X(DWORD64
) = ((const struct symt_function
*)type
)->size
;
627 case SymTagPointerType
:
628 X(DWORD64
) = sizeof(void*);
631 X(DWORD64
) = ((const struct symt_udt
*)type
)->size
;
634 X(DWORD64
) = sizeof(int); /* FIXME: should be size of base-type of enum !!! */
637 if (((const struct symt_data
*)type
)->kind
!= DataIsMember
||
638 !((const struct symt_data
*)type
)->u
.member
.length
)
640 X(DWORD64
) = ((const struct symt_data
*)type
)->u
.member
.length
;
642 case SymTagArrayType
:
643 if (!symt_get_info(((const struct symt_array
*)type
)->base_type
,
644 TI_GET_LENGTH
, pInfo
))
646 X(DWORD64
) *= ((const struct symt_array
*)type
)->end
-
647 ((const struct symt_array
*)type
)->start
+ 1;
649 case SymTagPublicSymbol
:
650 X(DWORD64
) = ((const struct symt_public
*)type
)->size
;
653 return symt_get_info(((const struct symt_typedef
*)type
)->type
, TI_GET_LENGTH
, pInfo
);
655 X(DWORD64
) = ((const struct symt_thunk
*)type
)->size
;
661 FIXME("Unsupported sym-tag %s for get-length\n",
662 symt_get_tag_str(type
->tag
));
664 case SymTagFunctionType
:
669 case TI_GET_LEXICALPARENT
:
673 X(DWORD
) = (DWORD
)((const struct symt_block
*)type
)->container
;
676 X(DWORD
) = (DWORD
)((const struct symt_data
*)type
)->container
;
679 X(DWORD
) = (DWORD
)((const struct symt_function
*)type
)->container
;
682 X(DWORD
) = (DWORD
)((const struct symt_thunk
*)type
)->container
;
684 case SymTagFunctionArgType
:
685 X(DWORD
) = (DWORD
)((const struct symt_function_arg_type
*)type
)->container
;
688 FIXME("Unsupported sym-tag %s for get-lexical-parent\n",
689 symt_get_tag_str(type
->tag
));
710 switch (((const struct symt_data
*)type
)->kind
)
714 X(ULONG
) = ((const struct symt_data
*)type
)->u
.var
.offset
;
717 X(ULONG
) = ((const struct symt_data
*)type
)->u
.member
.offset
>> 3;
720 FIXME("Unknown kind (%u) for get-offset\n",
721 ((const struct symt_data
*)type
)->kind
);
726 FIXME("Unsupported sym-tag %s for get-offset\n",
727 symt_get_tag_str(type
->tag
));
734 const char* name
= symt_get_name(type
);
735 if (!name
) return FALSE
;
736 len
= MultiByteToWideChar(CP_ACP
, 0, name
, -1, NULL
, 0);
737 X(WCHAR
*) = HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
738 if (!X(WCHAR
*)) return FALSE
;
739 MultiByteToWideChar(CP_ACP
, 0, name
, -1, X(WCHAR
*), len
);
744 X(DWORD
) = type
->tag
;
751 /* hierarchical => hierarchical */
752 case SymTagArrayType
:
753 X(DWORD
) = (DWORD
)((const struct symt_array
*)type
)->base_type
;
755 case SymTagPointerType
:
756 X(DWORD
) = (DWORD
)((const struct symt_pointer
*)type
)->pointsto
;
758 case SymTagFunctionType
:
759 X(DWORD
) = (DWORD
)((const struct symt_function_signature
*)type
)->rettype
;
762 X(DWORD
) = (DWORD
)((const struct symt_typedef
*)type
)->type
;
764 /* lexical => hierarchical */
766 X(DWORD
) = (DWORD
)((const struct symt_data
*)type
)->type
;
769 X(DWORD
) = (DWORD
)((const struct symt_function
*)type
)->type
;
772 X(DWORD
) = (DWORD
)((const struct symt_enum
*)type
)->base_type
;
774 case SymTagFunctionArgType
:
775 X(DWORD
) = (DWORD
)((const struct symt_function_arg_type
*)type
)->arg_type
;
778 FIXME("Unsupported sym-tag %s for get-type\n",
779 symt_get_tag_str(type
->tag
));
780 case SymTagPublicSymbol
:
788 if (type
->tag
!= SymTagUDT
) return FALSE
;
789 X(DWORD
) = ((const struct symt_udt
*)type
)->kind
;
793 if (type
->tag
!= SymTagData
|| ((const struct symt_data
*)type
)->kind
!= DataIsConstant
)
795 X(VARIANT
) = ((const struct symt_data
*)type
)->u
.value
;
798 case TI_GET_CALLING_CONVENTION
:
799 if (type
->tag
!= SymTagFunctionType
) return FALSE
;
800 if (((const struct symt_function_signature
*)type
)->call_conv
== -1)
802 FIXME("No support for calling convention for this signature\n");
803 X(DWORD
) = CV_CALL_FAR_C
; /* FIXME */
805 else X(DWORD
) = ((const struct symt_function_signature
*)type
)->call_conv
;
807 case TI_GET_ARRAYINDEXTYPEID
:
808 if (type
->tag
!= SymTagArrayType
) return FALSE
;
809 X(DWORD
) = (DWORD
)((const struct symt_array
*)type
)->index_type
;
812 case TI_GET_CLASSPARENTID
:
813 /* FIXME: we don't support properly C++ for now, pretend this symbol doesn't
814 * belong to a parent class
820 case TI_GET_ADDRESSOFFSET
:
821 case TI_GET_SYMINDEX
:
822 case TI_GET_THISADJUST
:
823 case TI_GET_VIRTUALBASECLASS
:
824 case TI_GET_VIRTUALBASEPOINTEROFFSET
:
825 case TI_GET_VIRTUALTABLESHAPEID
:
827 FIXME("Unsupported GetInfo request (%u)\n", req
);
830 FIXME("Unknown GetInfo request (%u)\n", req
);
837 /******************************************************************
838 * SymGetTypeInfo (DBGHELP.@)
841 BOOL WINAPI
SymGetTypeInfo(HANDLE hProcess
, DWORD64 ModBase
,
842 ULONG TypeId
, IMAGEHLP_SYMBOL_TYPE_INFO GetType
,
845 struct module_pair pair
;
847 pair
.pcs
= process_find_by_handle(hProcess
);
848 if (!pair
.pcs
) return FALSE
;
850 pair
.requested
= module_find_by_addr(pair
.pcs
, ModBase
, DMT_UNKNOWN
);
851 if (!module_get_debug(&pair
))
853 FIXME("Someone didn't properly set ModBase (%s)\n", wine_dbgstr_longlong(ModBase
));
857 return symt_get_info((struct symt
*)TypeId
, GetType
, pInfo
);
860 /******************************************************************
861 * SymGetTypeFromName (DBGHELP.@)
864 BOOL WINAPI
SymGetTypeFromName(HANDLE hProcess
, ULONG64 BaseOfDll
,
865 PCSTR Name
, PSYMBOL_INFO Symbol
)
867 struct process
* pcs
= process_find_by_handle(hProcess
);
868 struct module
* module
;
871 if (!pcs
) return FALSE
;
872 module
= module_find_by_addr(pcs
, BaseOfDll
, DMT_UNKNOWN
);
873 if (!module
) return FALSE
;
874 type
= symt_find_type_by_name(module
, SymTagNull
, Name
);
875 if (!type
) return FALSE
;
876 Symbol
->TypeIndex
= (DWORD
)type
;