winspool/tests: Use 0xdeadbeef as magic value.
[wine/multimedia.git] / programs / winedbg / types.c
blobf4df0d8a9315a552e105cbd3dfc5f354c0ec7cbf
1 /*
2 * File types.c - datatype handling stuff for internal debugger.
4 * Copyright (C) 1997, Eric Youngdale.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 * Note: This really doesn't do much at the moment, but it forms the framework
21 * upon which full support for datatype handling will eventually be built.
24 #include "config.h"
25 #include <stdlib.h>
27 #include "debugger.h"
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
32 /******************************************************************
33 * types_extract_as_integer
35 * Given a lvalue, try to get an integral (or pointer/address) value
36 * out of it
38 long int types_extract_as_integer(const struct dbg_lvalue* lvalue)
40 long int rtn;
41 LONGLONG val;
42 DWORD tag, bt;
43 DWORD64 size;
45 if (lvalue->type.id == dbg_itype_none ||
46 !types_get_info(&lvalue->type, TI_GET_SYMTAG, &tag))
47 RaiseException(DEBUG_STATUS_NOT_AN_INTEGER, 0, 0, NULL);
49 if (lvalue->type.id == dbg_itype_segptr)
51 return (long int)memory_to_linear_addr(&lvalue->addr);
54 switch (tag)
56 case SymTagBaseType:
57 if (!types_get_info(&lvalue->type, TI_GET_LENGTH, &size) ||
58 !types_get_info(&lvalue->type, TI_GET_BASETYPE, &bt))
60 WINE_ERR("Couldn't get information\n");
61 RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
63 if (size > sizeof(rtn))
65 WINE_ERR("Size too large (%s)\n", wine_dbgstr_longlong(size));
66 RaiseException(DEBUG_STATUS_NOT_AN_INTEGER, 0, 0, NULL);
68 switch (bt)
70 case btChar:
71 case btInt:
72 if (!be_cpu->fetch_integer(lvalue, (unsigned)size, TRUE, &val))
73 RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
74 rtn = (long)val;
75 break;
76 case btUInt:
77 if (!be_cpu->fetch_integer(lvalue, (unsigned)size, FALSE, &val))
78 RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
79 rtn = (DWORD)(DWORD64)val;
80 break;
81 case btFloat:
82 RaiseException(DEBUG_STATUS_NOT_AN_INTEGER, 0, 0, NULL);
84 break;
85 case SymTagPointerType:
86 if (!memory_read_value(lvalue, sizeof(void*), &rtn))
87 RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
88 break;
89 case SymTagArrayType:
90 case SymTagUDT:
91 assert(lvalue->cookie == DLV_TARGET);
92 if (!memory_read_value(lvalue, sizeof(rtn), &rtn))
93 RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
94 break;
95 case SymTagEnum:
96 assert(lvalue->cookie == DLV_TARGET);
97 if (!memory_read_value(lvalue, sizeof(rtn), &rtn))
98 RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
99 break;
100 case SymTagFunctionType:
101 rtn = (unsigned)memory_to_linear_addr(&lvalue->addr);
102 break;
103 default:
104 WINE_FIXME("Unsupported tag %lu\n", tag);
105 RaiseException(DEBUG_STATUS_NOT_AN_INTEGER, 0, 0, NULL);
106 break;
109 return rtn;
112 /******************************************************************
113 * types_extract_as_address
117 void types_extract_as_address(const struct dbg_lvalue* lvalue, ADDRESS* addr)
119 if (lvalue->type.id == dbg_itype_segptr && lvalue->type.module == 0)
121 *addr = lvalue->addr;
123 else
125 addr->Mode = AddrModeFlat;
126 addr->Offset = types_extract_as_integer( lvalue );
130 /******************************************************************
131 * types_deref
134 BOOL types_deref(const struct dbg_lvalue* lvalue, struct dbg_lvalue* result)
136 DWORD tag;
138 memset(result, 0, sizeof(*result));
139 result->type.id = dbg_itype_none;
140 result->type.module = 0;
143 * Make sure that this really makes sense.
145 if (!types_get_info(&lvalue->type, TI_GET_SYMTAG, &tag) ||
146 tag != SymTagPointerType ||
147 !memory_read_value(lvalue, sizeof(result->addr.Offset), &result->addr.Offset) ||
148 !types_get_info(&lvalue->type, TI_GET_TYPE, &result->type.id))
149 return FALSE;
150 result->type.module = lvalue->type.module;
151 result->cookie = DLV_TARGET;
152 /* FIXME: this is currently buggy.
153 * there is no way to tell were the deref:ed value is...
154 * for example:
155 * x is a pointer to struct s, x being on the stack
156 * => lvalue is in debuggee, result is in debugger
157 * x is a pointer to struct s, x being optimized into a reg
158 * => lvalue is debugger, result is debuggee
159 * x is a pointer to internal variable x
160 * => lvalue is debugger, result is debuggee
161 * so we force debuggee address space, because dereferencing pointers to
162 * internal variables is very unlikely. A correct fix would be
163 * rather large.
165 result->addr.Mode = AddrModeFlat;
166 return TRUE;
169 /******************************************************************
170 * types_get_udt_element_lvalue
172 * Implement a structure derefencement
174 static BOOL types_get_udt_element_lvalue(struct dbg_lvalue* lvalue,
175 const struct dbg_type* type, long int* tmpbuf)
177 DWORD offset, bitoffset;
178 DWORD bt;
179 DWORD64 length;
181 unsigned mask;
183 types_get_info(type, TI_GET_TYPE, &lvalue->type.id);
184 lvalue->type.module = type->module;
185 if (!types_get_info(type, TI_GET_OFFSET, &offset)) return FALSE;
186 lvalue->addr.Offset += offset;
188 if (types_get_info(type, TI_GET_BITPOSITION, &bitoffset))
190 types_get_info(type, TI_GET_LENGTH, &length);
191 /* FIXME: this test isn't sufficient, depending on start of bitfield
192 * (ie a 32 bit field can spread across 5 bytes)
194 if (length > 8 * sizeof(*tmpbuf)) return FALSE;
195 lvalue->addr.Offset += bitoffset >> 3;
197 * Bitfield operation. We have to extract the field and store
198 * it in a temporary buffer so that we get it all right.
200 if (!memory_read_value(lvalue, sizeof(*tmpbuf), tmpbuf)) return FALSE;
201 mask = 0xffffffff << (DWORD)length;
202 *tmpbuf >>= bitoffset & 7;
203 *tmpbuf &= ~mask;
205 lvalue->cookie = DLV_HOST;
206 lvalue->addr.Offset = (DWORD)tmpbuf;
209 * OK, now we have the correct part of the number.
210 * Check to see whether the basic type is signed or not, and if so,
211 * we need to sign extend the number.
213 if (types_get_info(&lvalue->type, TI_GET_BASETYPE, &bt) &&
214 bt == btInt && (*tmpbuf & (1 << ((DWORD)length - 1))))
216 *tmpbuf |= mask;
219 else
221 if (!memory_read_value(lvalue, sizeof(*tmpbuf), tmpbuf)) return FALSE;
224 return TRUE;
227 /******************************************************************
228 * types_udt_find_element
231 BOOL types_udt_find_element(struct dbg_lvalue* lvalue, const char* name, long int* tmpbuf)
233 DWORD tag, count;
234 char buffer[sizeof(TI_FINDCHILDREN_PARAMS) + 256 * sizeof(DWORD)];
235 TI_FINDCHILDREN_PARAMS* fcp = (TI_FINDCHILDREN_PARAMS*)buffer;
236 WCHAR* ptr;
237 char tmp[256];
238 int i;
239 struct dbg_type type;
241 if (!types_get_info(&lvalue->type, TI_GET_SYMTAG, &tag) ||
242 tag != SymTagUDT)
243 return FALSE;
245 if (types_get_info(&lvalue->type, TI_GET_CHILDRENCOUNT, &count))
247 fcp->Start = 0;
248 while (count)
250 fcp->Count = min(count, 256);
251 if (types_get_info(&lvalue->type, TI_FINDCHILDREN, fcp))
253 type.module = lvalue->type.module;
254 for (i = 0; i < min(fcp->Count, count); i++)
256 ptr = NULL;
257 type.id = fcp->ChildId[i];
258 types_get_info(&type, TI_GET_SYMNAME, &ptr);
259 if (!ptr) continue;
260 WideCharToMultiByte(CP_ACP, 0, ptr, -1, tmp, sizeof(tmp), NULL, NULL);
261 HeapFree(GetProcessHeap(), 0, ptr);
262 if (strcmp(tmp, name)) continue;
264 return types_get_udt_element_lvalue(lvalue, &type, tmpbuf);
267 count -= min(count, 256);
268 fcp->Start += 256;
271 return FALSE;
274 /******************************************************************
275 * types_array_index
277 * Grab an element from an array
279 BOOL types_array_index(const struct dbg_lvalue* lvalue, int index,
280 struct dbg_lvalue* result)
282 DWORD tag, count;
283 DWORD64 length;
285 if (!types_get_info(&lvalue->type, TI_GET_SYMTAG, &tag))
286 return FALSE;
287 switch (tag)
289 case SymTagArrayType:
290 types_get_info(&lvalue->type, TI_GET_COUNT, &count);
291 if (index < 0 || index >= count) return FALSE;
292 /* fall through */
293 case SymTagPointerType:
294 /* Contents of array share same data (addr mode, module...) */
295 *result = *lvalue;
297 * Get the base type, so we know how much to index by.
299 types_get_info(&lvalue->type, TI_GET_TYPE, &result->type.id);
300 types_get_info(&result->type, TI_GET_LENGTH, &length);
301 memory_read_value(lvalue, sizeof(result->addr.Offset), &result->addr.Offset);
302 result->addr.Offset += index * (DWORD)length;
303 break;
304 default:
305 assert(FALSE);
307 return TRUE;
310 struct type_find_t
312 unsigned long result; /* out: the found type */
313 enum SymTagEnum tag; /* in: the tag to look for */
314 union
316 unsigned long typeid; /* when tag is SymTagUDT */
317 const char* name; /* when tag is SymTagPointerType */
318 } u;
321 static BOOL CALLBACK types_cb(PSYMBOL_INFO sym, ULONG size, void* _user)
323 struct type_find_t* user = (struct type_find_t*)_user;
324 BOOL ret = TRUE;
325 struct dbg_type type;
326 DWORD type_id;
328 if (sym->Tag == user->tag)
330 switch (user->tag)
332 case SymTagUDT:
333 if (!strcmp(user->u.name, sym->Name))
335 user->result = sym->TypeIndex;
336 ret = FALSE;
338 break;
339 case SymTagPointerType:
340 type.module = sym->ModBase;
341 type.id = sym->TypeIndex;
342 if (types_get_info(&type, TI_GET_TYPE, &type_id) && type_id == user->u.typeid)
344 user->result = sym->TypeIndex;
345 ret = FALSE;
347 break;
348 default: break;
351 return ret;
354 /******************************************************************
355 * types_find_pointer
357 * Should look up in module based at linear whether (typeid*) exists
358 * Otherwise, we could create it locally
360 struct dbg_type types_find_pointer(const struct dbg_type* type)
362 struct type_find_t f;
363 struct dbg_type ret;
365 f.result = dbg_itype_none;
366 f.tag = SymTagPointerType;
367 f.u.typeid = type->id;
368 SymEnumTypes(dbg_curr_process->handle, type->module, types_cb, &f);
369 ret.module = type->module;
370 ret.id = f.result;
371 return ret;
374 /******************************************************************
375 * types_find_type
377 * Should look up in the module based at linear address whether a type
378 * named 'name' and with the correct tag exists
380 struct dbg_type types_find_type(unsigned long linear, const char* name, enum SymTagEnum tag)
383 struct type_find_t f;
384 struct dbg_type ret;
386 f.result = dbg_itype_none;
387 f.tag = tag;
388 f.u.name = name;
389 SymEnumTypes(dbg_curr_process->handle, linear, types_cb, &f);
390 ret.module = linear;
391 ret.id = f.result;
392 return ret;
395 /***********************************************************************
396 * print_value
398 * Implementation of the 'print' command.
400 void print_value(const struct dbg_lvalue* lvalue, char format, int level)
402 struct dbg_lvalue lvalue_field;
403 int i;
404 DWORD tag;
405 DWORD count;
406 DWORD64 size;
408 if (lvalue->type.id == dbg_itype_none)
410 /* No type, just print the addr value */
411 print_bare_address(&lvalue->addr);
412 goto leave;
415 if (format == 'i' || format == 's' || format == 'w' || format == 'b' || format == 'g')
417 dbg_printf("Format specifier '%c' is meaningless in 'print' command\n", format);
418 format = '\0';
421 if (!types_get_info(&lvalue->type, TI_GET_SYMTAG, &tag))
423 WINE_FIXME("---error\n");
424 return;
426 switch (tag)
428 case SymTagBaseType:
429 case SymTagEnum:
430 case SymTagPointerType:
431 print_basic(lvalue, 1, format);
432 break;
433 case SymTagUDT:
434 if (types_get_info(&lvalue->type, TI_GET_CHILDRENCOUNT, &count))
436 char buffer[sizeof(TI_FINDCHILDREN_PARAMS) + 256 * sizeof(DWORD)];
437 TI_FINDCHILDREN_PARAMS* fcp = (TI_FINDCHILDREN_PARAMS*)buffer;
438 WCHAR* ptr;
439 char tmp[256];
440 long int tmpbuf;
441 struct dbg_type type;
443 dbg_printf("{");
444 fcp->Start = 0;
445 while (count)
447 fcp->Count = min(count, 256);
448 if (types_get_info(&lvalue->type, TI_FINDCHILDREN, fcp))
450 for (i = 0; i < min(fcp->Count, count); i++)
452 ptr = NULL;
453 type.module = lvalue->type.module;
454 type.id = fcp->ChildId[i];
455 types_get_info(&type, TI_GET_SYMNAME, &ptr);
456 if (!ptr) continue;
457 WideCharToMultiByte(CP_ACP, 0, ptr, -1, tmp, sizeof(tmp), NULL, NULL);
458 dbg_printf("%s=", tmp);
459 HeapFree(GetProcessHeap(), 0, ptr);
460 lvalue_field = *lvalue;
461 if (types_get_udt_element_lvalue(&lvalue_field, &type, &tmpbuf))
463 print_value(&lvalue_field, format, level + 1);
465 if (i < min(fcp->Count, count) - 1 || count > 256) dbg_printf(", ");
468 count -= min(count, 256);
469 fcp->Start += 256;
471 dbg_printf("}");
473 break;
474 case SymTagArrayType:
476 * Loop over all of the entries, printing stuff as we go.
478 count = 1; size = 1;
479 types_get_info(&lvalue->type, TI_GET_COUNT, &count);
480 types_get_info(&lvalue->type, TI_GET_LENGTH, &size);
482 if (size == count)
484 unsigned len;
485 char buffer[256];
487 * Special handling for character arrays.
489 /* FIXME should check basic type here (should be a char!!!!)... */
490 len = min(count, sizeof(buffer));
491 memory_get_string(dbg_curr_process,
492 memory_to_linear_addr(&lvalue->addr),
493 lvalue->cookie == DLV_TARGET, TRUE, buffer, len);
494 dbg_printf("\"%s%s\"", buffer, (len < count) ? "..." : "");
495 break;
497 lvalue_field = *lvalue;
498 types_get_info(&lvalue->type, TI_GET_TYPE, &lvalue_field.type.id);
499 dbg_printf("{");
500 for (i = 0; i < count; i++)
502 print_value(&lvalue_field, format, level + 1);
503 lvalue_field.addr.Offset += size / count;
504 dbg_printf((i == count - 1) ? "}" : ", ");
506 break;
507 case SymTagFunctionType:
508 dbg_printf("Function ");
509 print_bare_address(&lvalue->addr);
510 dbg_printf(": ");
511 types_print_type(&lvalue->type, FALSE);
512 break;
513 default:
514 WINE_FIXME("Unknown tag (%lu)\n", tag);
515 RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
516 break;
519 leave:
521 if (level == 0) dbg_printf("\n");
524 static BOOL CALLBACK print_types_cb(PSYMBOL_INFO sym, ULONG size, void* ctx)
526 struct dbg_type type;
527 type.module = sym->ModBase;
528 type.id = sym->TypeIndex;
529 dbg_printf("Mod: %08lx ID: %08lx \n", type.module, type.id);
530 types_print_type(&type, TRUE);
531 dbg_printf("\n");
532 return TRUE;
535 static BOOL CALLBACK print_types_mod_cb(PSTR mod_name, DWORD base, void* ctx)
537 return SymEnumTypes(dbg_curr_process->handle, base, print_types_cb, ctx);
540 int print_types(void)
542 SymEnumerateModules(dbg_curr_process->handle, print_types_mod_cb, NULL);
543 return 0;
546 int types_print_type(const struct dbg_type* type, BOOL details)
548 WCHAR* ptr;
549 char tmp[256];
550 const char* name;
551 DWORD tag, udt, count;
552 struct dbg_type subtype;
554 if (type->id == dbg_itype_none || !types_get_info(type, TI_GET_SYMTAG, &tag))
556 dbg_printf("--invalid--<%lxh>--", type->id);
557 return FALSE;
560 if (types_get_info(type, TI_GET_SYMNAME, &ptr) && ptr)
562 WideCharToMultiByte(CP_ACP, 0, ptr, -1, tmp, sizeof(tmp), NULL, NULL);
563 name = tmp;
564 HeapFree(GetProcessHeap(), 0, ptr);
566 else name = "--none--";
568 switch (tag)
570 case SymTagBaseType:
571 if (details) dbg_printf("Basic<%s>", name); else dbg_printf("%s", name);
572 break;
573 case SymTagPointerType:
574 types_get_info(type, TI_GET_TYPE, &subtype.id);
575 subtype.module = type->module;
576 types_print_type(&subtype, FALSE);
577 dbg_printf("*");
578 break;
579 case SymTagUDT:
580 types_get_info(type, TI_GET_UDTKIND, &udt);
581 switch (udt)
583 case UdtStruct: dbg_printf("struct %s", name); break;
584 case UdtUnion: dbg_printf("union %s", name); break;
585 case UdtClass: dbg_printf("class %s", name); break;
586 default: WINE_ERR("Unsupported UDT type (%ld) for %s", udt, name); break;
588 if (details &&
589 types_get_info(type, TI_GET_CHILDRENCOUNT, &count))
591 char buffer[sizeof(TI_FINDCHILDREN_PARAMS) + 256 * sizeof(DWORD)];
592 TI_FINDCHILDREN_PARAMS* fcp = (TI_FINDCHILDREN_PARAMS*)buffer;
593 WCHAR* ptr;
594 char tmp[256];
595 int i;
596 struct dbg_type type_elt;
597 dbg_printf(" {");
599 fcp->Start = 0;
600 while (count)
602 fcp->Count = min(count, 256);
603 if (types_get_info(type, TI_FINDCHILDREN, fcp))
605 for (i = 0; i < min(fcp->Count, count); i++)
607 ptr = NULL;
608 type_elt.module = type->module;
609 type_elt.id = fcp->ChildId[i];
610 types_get_info(&type_elt, TI_GET_SYMNAME, &ptr);
611 if (!ptr) continue;
612 WideCharToMultiByte(CP_ACP, 0, ptr, -1, tmp, sizeof(tmp), NULL, NULL);
613 HeapFree(GetProcessHeap(), 0, ptr);
614 dbg_printf("%s", tmp);
615 if (types_get_info(&type_elt, TI_GET_TYPE, &type_elt.id))
617 dbg_printf(":");
618 types_print_type(&type_elt, details);
620 if (i < min(fcp->Count, count) - 1 || count > 256) dbg_printf(", ");
623 count -= min(count, 256);
624 fcp->Start += 256;
626 dbg_printf("}");
628 break;
629 case SymTagArrayType:
630 types_get_info(type, TI_GET_TYPE, &subtype.id);
631 subtype.module = type->module;
632 types_print_type(&subtype, details);
633 dbg_printf(" %s[]", name);
634 break;
635 case SymTagEnum:
636 dbg_printf("enum %s", name);
637 break;
638 case SymTagFunctionType:
639 types_get_info(type, TI_GET_TYPE, &subtype.id);
640 subtype.module = type->module;
641 types_print_type(&subtype, FALSE);
642 dbg_printf(" (*%s)(", name);
643 if (types_get_info(type, TI_GET_CHILDRENCOUNT, &count))
645 char buffer[sizeof(TI_FINDCHILDREN_PARAMS) + 256 * sizeof(DWORD)];
646 TI_FINDCHILDREN_PARAMS* fcp = (TI_FINDCHILDREN_PARAMS*)buffer;
647 int i;
649 fcp->Start = 0;
650 while (count)
652 fcp->Count = min(count, 256);
653 if (types_get_info(type, TI_FINDCHILDREN, fcp))
655 for (i = 0; i < min(fcp->Count, count); i++)
657 subtype.id = fcp->ChildId[i];
658 types_get_info(&subtype, TI_GET_TYPE, &subtype.id);
659 types_print_type(&subtype, FALSE);
660 if (i < min(fcp->Count, count) - 1 || count > 256) dbg_printf(", ");
663 count -= min(count, 256);
664 fcp->Start += 256;
667 dbg_printf(")");
668 break;
669 default:
670 WINE_ERR("Unknown type %lu for %s\n", tag, name);
671 break;
674 return TRUE;
677 /* helper to typecast pInfo to its expected type (_t) */
678 #define X(_t) (*((_t*)pInfo))
680 BOOL types_get_info(const struct dbg_type* type, IMAGEHLP_SYMBOL_TYPE_INFO ti, void* pInfo)
682 if (type->id == dbg_itype_none) return FALSE;
683 if (type->module != 0)
685 DWORD ret, tag, bt;
686 ret = SymGetTypeInfo(dbg_curr_process->handle, type->module, type->id, ti, pInfo);
687 if (!ret &&
688 SymGetTypeInfo(dbg_curr_process->handle, type->module, type->id, TI_GET_SYMTAG, &tag) &&
689 tag == SymTagBaseType &&
690 SymGetTypeInfo(dbg_curr_process->handle, type->module, type->id, TI_GET_BASETYPE, &bt))
692 static const WCHAR voidW[] = {'v','o','i','d','\0'};
693 static const WCHAR charW[] = {'c','h','a','r','\0'};
694 static const WCHAR wcharW[] = {'W','C','H','A','R','\0'};
695 static const WCHAR intW[] = {'i','n','t','\0'};
696 static const WCHAR uintW[] = {'u','n','s','i','g','n','e','d',' ','i','n','t','\0'};
697 static const WCHAR floatW[] = {'f','l','o','a','t','\0'};
698 static const WCHAR boolW[] = {'b','o','o','l','\0'};
699 static const WCHAR longW[] = {'l','o','n','g',' ','i','n','t','\0'};
700 static const WCHAR ulongW[] = {'u','n','s','i','g','n','e','d',' ','l','o','n','g',' ','i','n','t','\0'};
701 static const WCHAR complexW[] = {'c','o','m','p','l','e','x','\0'};
702 const WCHAR* name = NULL;
704 switch (bt)
706 case btVoid: name = voidW; break;
707 case btChar: name = charW; break;
708 case btWChar: name = wcharW; break;
709 case btInt: name = intW; break;
710 case btUInt: name = uintW; break;
711 case btFloat: name = floatW; break;
712 case btBool: name = boolW; break;
713 case btLong: name = longW; break;
714 case btULong: name = ulongW; break;
715 case btComplex: name = complexW; break;
716 default: WINE_FIXME("Unsupported basic type %ld\n", bt); return FALSE;
718 X(WCHAR*) = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(name) + 1) * sizeof(WCHAR));
719 if (X(WCHAR*))
721 lstrcpyW(X(WCHAR*), name);
722 ret = TRUE;
725 return ret;
728 assert(type->id >= dbg_itype_first);
730 switch (type->id)
732 case dbg_itype_unsigned_int:
733 switch (ti)
735 case TI_GET_SYMTAG: X(DWORD) = SymTagBaseType; break;
736 case TI_GET_LENGTH: X(DWORD64) = 4; break;
737 case TI_GET_BASETYPE: X(DWORD) = btUInt; break;
738 default: WINE_FIXME("unsupported %u for u-int\n", ti); return FALSE;
740 break;
741 case dbg_itype_signed_int:
742 switch (ti)
744 case TI_GET_SYMTAG: X(DWORD) = SymTagBaseType; break;
745 case TI_GET_LENGTH: X(DWORD64) = 4; break;
746 case TI_GET_BASETYPE: X(DWORD) = btInt; break;
747 default: WINE_FIXME("unsupported %u for s-int\n", ti); return FALSE;
749 break;
750 case dbg_itype_unsigned_short_int:
751 switch (ti)
753 case TI_GET_SYMTAG: X(DWORD) = SymTagBaseType; break;
754 case TI_GET_LENGTH: X(DWORD64) = 2; break;
755 case TI_GET_BASETYPE: X(DWORD) = btUInt; break;
756 default: WINE_FIXME("unsupported %u for u-short int\n", ti); return FALSE;
758 break;
759 case dbg_itype_signed_short_int:
760 switch (ti)
762 case TI_GET_SYMTAG: X(DWORD) = SymTagBaseType; break;
763 case TI_GET_LENGTH: X(DWORD64) = 2; break;
764 case TI_GET_BASETYPE: X(DWORD) = btInt; break;
765 default: WINE_FIXME("unsupported %u for s-short int\n", ti); return FALSE;
767 break;
768 case dbg_itype_unsigned_char_int:
769 switch (ti)
771 case TI_GET_SYMTAG: X(DWORD) = SymTagBaseType; break;
772 case TI_GET_LENGTH: X(DWORD64) = 1; break;
773 case TI_GET_BASETYPE: X(DWORD) = btUInt; break;
774 default: WINE_FIXME("unsupported %u for u-char int\n", ti); return FALSE;
776 break;
777 case dbg_itype_signed_char_int:
778 switch (ti)
780 case TI_GET_SYMTAG: X(DWORD) = SymTagBaseType; break;
781 case TI_GET_LENGTH: X(DWORD64) = 1; break;
782 case TI_GET_BASETYPE: X(DWORD) = btInt; break;
783 default: WINE_FIXME("unsupported %u for s-char int\n", ti); return FALSE;
785 break;
786 case dbg_itype_char:
787 switch (ti)
789 case TI_GET_SYMTAG: X(DWORD) = SymTagBaseType; break;
790 case TI_GET_LENGTH: X(DWORD64) = 1; break;
791 case TI_GET_BASETYPE: X(DWORD) = btChar; break;
792 default: WINE_FIXME("unsupported %u for char int\n", ti); return FALSE;
794 break;
795 case dbg_itype_astring:
796 switch (ti)
798 case TI_GET_SYMTAG: X(DWORD) = SymTagPointerType; break;
799 case TI_GET_LENGTH: X(DWORD64) = 4; break;
800 case TI_GET_TYPE: X(DWORD) = dbg_itype_char; break;
801 default: WINE_FIXME("unsupported %u for a string\n", ti); return FALSE;
803 break;
804 case dbg_itype_segptr:
805 switch (ti)
807 case TI_GET_SYMTAG: X(DWORD) = SymTagBaseType; break;
808 case TI_GET_LENGTH: X(DWORD64) = 4; break;
809 case TI_GET_BASETYPE: X(DWORD) = btInt; break;
810 default: WINE_FIXME("unsupported %u for seg-ptr\n", ti); return FALSE;
812 break;
813 default: WINE_FIXME("unsupported type id 0x%lx\n", type->id);
816 #undef X
817 return TRUE;