dbghelp: Support pointer types of various sizes.
This commit is contained in:
parent
06f76236d1
commit
cf1cd33570
|
@ -287,6 +287,7 @@ struct symt_pointer
|
|||
{
|
||||
struct symt symt;
|
||||
struct symt* pointsto;
|
||||
unsigned long size;
|
||||
};
|
||||
|
||||
struct symt_typedef
|
||||
|
@ -724,7 +725,8 @@ extern BOOL symt_add_function_signature_parameter(struct module* module,
|
|||
struct symt* param);
|
||||
extern struct symt_pointer*
|
||||
symt_new_pointer(struct module* module,
|
||||
struct symt* ref_type);
|
||||
struct symt* ref_type,
|
||||
unsigned long size);
|
||||
extern struct symt_typedef*
|
||||
symt_new_typedef(struct module* module, struct symt* ref,
|
||||
const char* name);
|
||||
|
|
|
@ -1098,13 +1098,13 @@ static struct symt* dwarf2_parse_pointer_type(dwarf2_parse_context_t* ctx,
|
|||
|
||||
TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
|
||||
|
||||
if (!dwarf2_find_attribute(ctx, di, DW_AT_byte_size, &size)) size.u.uvalue = 0;
|
||||
if (!dwarf2_find_attribute(ctx, di, DW_AT_byte_size, &size)) size.u.uvalue = sizeof(void *);
|
||||
if (!(ref_type = dwarf2_lookup_type(ctx, di)))
|
||||
{
|
||||
ref_type = ctx->symt_cache[sc_void];
|
||||
assert(ref_type);
|
||||
}
|
||||
di->symt = &symt_new_pointer(ctx->module, ref_type)->symt;
|
||||
di->symt = &symt_new_pointer(ctx->module, ref_type, size.u.uvalue)->symt;
|
||||
if (di->abbrev->have_child) FIXME("Unsupported children\n");
|
||||
return di->symt;
|
||||
}
|
||||
|
@ -1199,7 +1199,7 @@ static struct symt* dwarf2_parse_reference_type(dwarf2_parse_context_t* ctx,
|
|||
|
||||
ref_type = dwarf2_lookup_type(ctx, di);
|
||||
/* FIXME: for now, we hard-wire C++ references to pointers */
|
||||
di->symt = &symt_new_pointer(ctx->module, ref_type)->symt;
|
||||
di->symt = &symt_new_pointer(ctx->module, ref_type, sizeof(void *))->symt;
|
||||
|
||||
if (di->abbrev->have_child) FIXME("Unsupported children\n");
|
||||
|
||||
|
|
|
@ -142,7 +142,6 @@ static struct cv_defined_module*cv_current_module;
|
|||
|
||||
static void codeview_init_basic_types(struct module* module)
|
||||
{
|
||||
struct symt_udt* udt;
|
||||
/*
|
||||
* These are the common builtin types that are used by VC++.
|
||||
*/
|
||||
|
@ -174,68 +173,57 @@ static void codeview_init_basic_types(struct module* module)
|
|||
cv_basic_types[T_UINT8] = &symt_new_basic(module, btUInt, "UINT8", 8)->symt;
|
||||
cv_basic_types[T_HRESULT]= &symt_new_basic(module, btUInt, "HRESULT", 4)->symt;
|
||||
|
||||
if (sizeof(void*) == 4)
|
||||
{
|
||||
cv_basic_types[T_32PVOID] = &symt_new_pointer(module, cv_basic_types[T_VOID])->symt;
|
||||
cv_basic_types[T_32PCHAR] = &symt_new_pointer(module, cv_basic_types[T_CHAR])->symt;
|
||||
cv_basic_types[T_32PSHORT] = &symt_new_pointer(module, cv_basic_types[T_SHORT])->symt;
|
||||
cv_basic_types[T_32PLONG] = &symt_new_pointer(module, cv_basic_types[T_LONG])->symt;
|
||||
cv_basic_types[T_32PQUAD] = &symt_new_pointer(module, cv_basic_types[T_QUAD])->symt;
|
||||
cv_basic_types[T_32PUCHAR] = &symt_new_pointer(module, cv_basic_types[T_UCHAR])->symt;
|
||||
cv_basic_types[T_32PUSHORT] = &symt_new_pointer(module, cv_basic_types[T_USHORT])->symt;
|
||||
cv_basic_types[T_32PULONG] = &symt_new_pointer(module, cv_basic_types[T_ULONG])->symt;
|
||||
cv_basic_types[T_32PUQUAD] = &symt_new_pointer(module, cv_basic_types[T_UQUAD])->symt;
|
||||
cv_basic_types[T_32PBOOL08] = &symt_new_pointer(module, cv_basic_types[T_BOOL08])->symt;
|
||||
cv_basic_types[T_32PBOOL16] = &symt_new_pointer(module, cv_basic_types[T_BOOL16])->symt;
|
||||
cv_basic_types[T_32PBOOL32] = &symt_new_pointer(module, cv_basic_types[T_BOOL32])->symt;
|
||||
cv_basic_types[T_32PBOOL64] = &symt_new_pointer(module, cv_basic_types[T_BOOL64])->symt;
|
||||
cv_basic_types[T_32PREAL32] = &symt_new_pointer(module, cv_basic_types[T_REAL32])->symt;
|
||||
cv_basic_types[T_32PREAL64] = &symt_new_pointer(module, cv_basic_types[T_REAL64])->symt;
|
||||
cv_basic_types[T_32PREAL80] = &symt_new_pointer(module, cv_basic_types[T_REAL80])->symt;
|
||||
cv_basic_types[T_32PRCHAR] = &symt_new_pointer(module, cv_basic_types[T_RCHAR])->symt;
|
||||
cv_basic_types[T_32PWCHAR] = &symt_new_pointer(module, cv_basic_types[T_WCHAR])->symt;
|
||||
cv_basic_types[T_32PINT2] = &symt_new_pointer(module, cv_basic_types[T_INT2])->symt;
|
||||
cv_basic_types[T_32PUINT2] = &symt_new_pointer(module, cv_basic_types[T_UINT2])->symt;
|
||||
cv_basic_types[T_32PINT4] = &symt_new_pointer(module, cv_basic_types[T_INT4])->symt;
|
||||
cv_basic_types[T_32PUINT4] = &symt_new_pointer(module, cv_basic_types[T_UINT4])->symt;
|
||||
cv_basic_types[T_32PINT8] = &symt_new_pointer(module, cv_basic_types[T_INT8])->symt;
|
||||
cv_basic_types[T_32PUINT8] = &symt_new_pointer(module, cv_basic_types[T_UINT8])->symt;
|
||||
cv_basic_types[T_32PHRESULT]= &symt_new_pointer(module, cv_basic_types[T_HRESULT])->symt;
|
||||
cv_basic_types[T_32PVOID] = &symt_new_pointer(module, cv_basic_types[T_VOID], 4)->symt;
|
||||
cv_basic_types[T_32PCHAR] = &symt_new_pointer(module, cv_basic_types[T_CHAR], 4)->symt;
|
||||
cv_basic_types[T_32PSHORT] = &symt_new_pointer(module, cv_basic_types[T_SHORT], 4)->symt;
|
||||
cv_basic_types[T_32PLONG] = &symt_new_pointer(module, cv_basic_types[T_LONG], 4)->symt;
|
||||
cv_basic_types[T_32PQUAD] = &symt_new_pointer(module, cv_basic_types[T_QUAD], 4)->symt;
|
||||
cv_basic_types[T_32PUCHAR] = &symt_new_pointer(module, cv_basic_types[T_UCHAR], 4)->symt;
|
||||
cv_basic_types[T_32PUSHORT] = &symt_new_pointer(module, cv_basic_types[T_USHORT], 4)->symt;
|
||||
cv_basic_types[T_32PULONG] = &symt_new_pointer(module, cv_basic_types[T_ULONG], 4)->symt;
|
||||
cv_basic_types[T_32PUQUAD] = &symt_new_pointer(module, cv_basic_types[T_UQUAD], 4)->symt;
|
||||
cv_basic_types[T_32PBOOL08] = &symt_new_pointer(module, cv_basic_types[T_BOOL08], 4)->symt;
|
||||
cv_basic_types[T_32PBOOL16] = &symt_new_pointer(module, cv_basic_types[T_BOOL16], 4)->symt;
|
||||
cv_basic_types[T_32PBOOL32] = &symt_new_pointer(module, cv_basic_types[T_BOOL32], 4)->symt;
|
||||
cv_basic_types[T_32PBOOL64] = &symt_new_pointer(module, cv_basic_types[T_BOOL64], 4)->symt;
|
||||
cv_basic_types[T_32PREAL32] = &symt_new_pointer(module, cv_basic_types[T_REAL32], 4)->symt;
|
||||
cv_basic_types[T_32PREAL64] = &symt_new_pointer(module, cv_basic_types[T_REAL64], 4)->symt;
|
||||
cv_basic_types[T_32PREAL80] = &symt_new_pointer(module, cv_basic_types[T_REAL80], 4)->symt;
|
||||
cv_basic_types[T_32PRCHAR] = &symt_new_pointer(module, cv_basic_types[T_RCHAR], 4)->symt;
|
||||
cv_basic_types[T_32PWCHAR] = &symt_new_pointer(module, cv_basic_types[T_WCHAR], 4)->symt;
|
||||
cv_basic_types[T_32PINT2] = &symt_new_pointer(module, cv_basic_types[T_INT2], 4)->symt;
|
||||
cv_basic_types[T_32PUINT2] = &symt_new_pointer(module, cv_basic_types[T_UINT2], 4)->symt;
|
||||
cv_basic_types[T_32PINT4] = &symt_new_pointer(module, cv_basic_types[T_INT4], 4)->symt;
|
||||
cv_basic_types[T_32PUINT4] = &symt_new_pointer(module, cv_basic_types[T_UINT4], 4)->symt;
|
||||
cv_basic_types[T_32PINT8] = &symt_new_pointer(module, cv_basic_types[T_INT8], 4)->symt;
|
||||
cv_basic_types[T_32PUINT8] = &symt_new_pointer(module, cv_basic_types[T_UINT8], 4)->symt;
|
||||
cv_basic_types[T_32PHRESULT]= &symt_new_pointer(module, cv_basic_types[T_HRESULT], 4)->symt;
|
||||
|
||||
/* The .pdb file can refer to 64 bit pointers values even on 32 bits applications. */
|
||||
udt = symt_new_udt(module, "PVOID64", 8, UdtStruct);
|
||||
symt_add_udt_element(module, udt, "ptr64_low", cv_basic_types[T_LONG], 0, 32);
|
||||
symt_add_udt_element(module, udt, "ptr64_high", cv_basic_types[T_LONG], 32, 32);
|
||||
cv_basic_types[T_64PVOID]= &udt->symt;
|
||||
}
|
||||
else
|
||||
{
|
||||
cv_basic_types[T_64PVOID] = &symt_new_pointer(module, cv_basic_types[T_VOID])->symt;
|
||||
cv_basic_types[T_64PCHAR] = &symt_new_pointer(module, cv_basic_types[T_CHAR])->symt;
|
||||
cv_basic_types[T_64PSHORT] = &symt_new_pointer(module, cv_basic_types[T_SHORT])->symt;
|
||||
cv_basic_types[T_64PLONG] = &symt_new_pointer(module, cv_basic_types[T_LONG])->symt;
|
||||
cv_basic_types[T_64PQUAD] = &symt_new_pointer(module, cv_basic_types[T_QUAD])->symt;
|
||||
cv_basic_types[T_64PUCHAR] = &symt_new_pointer(module, cv_basic_types[T_UCHAR])->symt;
|
||||
cv_basic_types[T_64PUSHORT] = &symt_new_pointer(module, cv_basic_types[T_USHORT])->symt;
|
||||
cv_basic_types[T_64PULONG] = &symt_new_pointer(module, cv_basic_types[T_ULONG])->symt;
|
||||
cv_basic_types[T_64PUQUAD] = &symt_new_pointer(module, cv_basic_types[T_UQUAD])->symt;
|
||||
cv_basic_types[T_64PBOOL08] = &symt_new_pointer(module, cv_basic_types[T_BOOL08])->symt;
|
||||
cv_basic_types[T_64PBOOL16] = &symt_new_pointer(module, cv_basic_types[T_BOOL16])->symt;
|
||||
cv_basic_types[T_64PBOOL32] = &symt_new_pointer(module, cv_basic_types[T_BOOL32])->symt;
|
||||
cv_basic_types[T_64PBOOL64] = &symt_new_pointer(module, cv_basic_types[T_BOOL64])->symt;
|
||||
cv_basic_types[T_64PREAL32] = &symt_new_pointer(module, cv_basic_types[T_REAL32])->symt;
|
||||
cv_basic_types[T_64PREAL64] = &symt_new_pointer(module, cv_basic_types[T_REAL64])->symt;
|
||||
cv_basic_types[T_64PREAL80] = &symt_new_pointer(module, cv_basic_types[T_REAL80])->symt;
|
||||
cv_basic_types[T_64PRCHAR] = &symt_new_pointer(module, cv_basic_types[T_RCHAR])->symt;
|
||||
cv_basic_types[T_64PWCHAR] = &symt_new_pointer(module, cv_basic_types[T_WCHAR])->symt;
|
||||
cv_basic_types[T_64PINT2] = &symt_new_pointer(module, cv_basic_types[T_INT2])->symt;
|
||||
cv_basic_types[T_64PUINT2] = &symt_new_pointer(module, cv_basic_types[T_UINT2])->symt;
|
||||
cv_basic_types[T_64PINT4] = &symt_new_pointer(module, cv_basic_types[T_INT4])->symt;
|
||||
cv_basic_types[T_64PUINT4] = &symt_new_pointer(module, cv_basic_types[T_UINT4])->symt;
|
||||
cv_basic_types[T_64PINT8] = &symt_new_pointer(module, cv_basic_types[T_INT8])->symt;
|
||||
cv_basic_types[T_64PUINT8] = &symt_new_pointer(module, cv_basic_types[T_UINT8])->symt;
|
||||
cv_basic_types[T_64PHRESULT]= &symt_new_pointer(module, cv_basic_types[T_HRESULT])->symt;
|
||||
}
|
||||
cv_basic_types[T_64PVOID] = &symt_new_pointer(module, cv_basic_types[T_VOID], 8)->symt;
|
||||
cv_basic_types[T_64PCHAR] = &symt_new_pointer(module, cv_basic_types[T_CHAR], 8)->symt;
|
||||
cv_basic_types[T_64PSHORT] = &symt_new_pointer(module, cv_basic_types[T_SHORT], 8)->symt;
|
||||
cv_basic_types[T_64PLONG] = &symt_new_pointer(module, cv_basic_types[T_LONG], 8)->symt;
|
||||
cv_basic_types[T_64PQUAD] = &symt_new_pointer(module, cv_basic_types[T_QUAD], 8)->symt;
|
||||
cv_basic_types[T_64PUCHAR] = &symt_new_pointer(module, cv_basic_types[T_UCHAR], 8)->symt;
|
||||
cv_basic_types[T_64PUSHORT] = &symt_new_pointer(module, cv_basic_types[T_USHORT], 8)->symt;
|
||||
cv_basic_types[T_64PULONG] = &symt_new_pointer(module, cv_basic_types[T_ULONG], 8)->symt;
|
||||
cv_basic_types[T_64PUQUAD] = &symt_new_pointer(module, cv_basic_types[T_UQUAD], 8)->symt;
|
||||
cv_basic_types[T_64PBOOL08] = &symt_new_pointer(module, cv_basic_types[T_BOOL08], 8)->symt;
|
||||
cv_basic_types[T_64PBOOL16] = &symt_new_pointer(module, cv_basic_types[T_BOOL16], 8)->symt;
|
||||
cv_basic_types[T_64PBOOL32] = &symt_new_pointer(module, cv_basic_types[T_BOOL32], 8)->symt;
|
||||
cv_basic_types[T_64PBOOL64] = &symt_new_pointer(module, cv_basic_types[T_BOOL64], 8)->symt;
|
||||
cv_basic_types[T_64PREAL32] = &symt_new_pointer(module, cv_basic_types[T_REAL32], 8)->symt;
|
||||
cv_basic_types[T_64PREAL64] = &symt_new_pointer(module, cv_basic_types[T_REAL64], 8)->symt;
|
||||
cv_basic_types[T_64PREAL80] = &symt_new_pointer(module, cv_basic_types[T_REAL80], 8)->symt;
|
||||
cv_basic_types[T_64PRCHAR] = &symt_new_pointer(module, cv_basic_types[T_RCHAR], 8)->symt;
|
||||
cv_basic_types[T_64PWCHAR] = &symt_new_pointer(module, cv_basic_types[T_WCHAR], 8)->symt;
|
||||
cv_basic_types[T_64PINT2] = &symt_new_pointer(module, cv_basic_types[T_INT2], 8)->symt;
|
||||
cv_basic_types[T_64PUINT2] = &symt_new_pointer(module, cv_basic_types[T_UINT2], 8)->symt;
|
||||
cv_basic_types[T_64PINT4] = &symt_new_pointer(module, cv_basic_types[T_INT4], 8)->symt;
|
||||
cv_basic_types[T_64PUINT4] = &symt_new_pointer(module, cv_basic_types[T_UINT4], 8)->symt;
|
||||
cv_basic_types[T_64PINT8] = &symt_new_pointer(module, cv_basic_types[T_INT8], 8)->symt;
|
||||
cv_basic_types[T_64PUINT8] = &symt_new_pointer(module, cv_basic_types[T_UINT8], 8)->symt;
|
||||
cv_basic_types[T_64PHRESULT]= &symt_new_pointer(module, cv_basic_types[T_HRESULT], 8)->symt;
|
||||
}
|
||||
|
||||
static int leaf_as_variant(VARIANT* v, const unsigned short int* leaf)
|
||||
|
@ -642,7 +630,7 @@ static struct symt* codeview_add_type_pointer(struct codeview_type_parse* ctp,
|
|||
return existing;
|
||||
}
|
||||
pointee = codeview_fetch_type(ctp, pointee_type, FALSE);
|
||||
return &symt_new_pointer(ctp->module, pointee)->symt;
|
||||
return &symt_new_pointer(ctp->module, pointee, sizeof(void *))->symt;
|
||||
}
|
||||
|
||||
static struct symt* codeview_add_type_array(struct codeview_type_parse* ctp,
|
||||
|
|
|
@ -848,7 +848,7 @@ static int stabs_pts_read_type_def(struct ParseTypedefData* ptd, const char* typ
|
|||
case '*':
|
||||
case '&':
|
||||
PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &ref_dt) == -1);
|
||||
new_dt = &symt_new_pointer(ptd->module, ref_dt)->symt;
|
||||
new_dt = &symt_new_pointer(ptd->module, ref_dt, sizeof(void*))->symt;
|
||||
break;
|
||||
case 'k': /* 'const' modifier */
|
||||
case 'B': /* 'volatile' modifier */
|
||||
|
|
|
@ -356,7 +356,7 @@ BOOL symt_add_function_signature_parameter(struct module* module,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
struct symt_pointer* symt_new_pointer(struct module* module, struct symt* ref_type)
|
||||
struct symt_pointer* symt_new_pointer(struct module* module, struct symt* ref_type, unsigned long size)
|
||||
{
|
||||
struct symt_pointer* sym;
|
||||
|
||||
|
@ -364,6 +364,7 @@ struct symt_pointer* symt_new_pointer(struct module* module, struct symt* ref_ty
|
|||
{
|
||||
sym->symt.tag = SymTagPointerType;
|
||||
sym->pointsto = ref_type;
|
||||
sym->size = size;
|
||||
symt_add_type(module, &sym->symt);
|
||||
}
|
||||
return sym;
|
||||
|
@ -639,7 +640,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type,
|
|||
X(DWORD64) = ((const struct symt_function*)type)->size;
|
||||
break;
|
||||
case SymTagPointerType:
|
||||
X(DWORD64) = sizeof(void*);
|
||||
X(DWORD64) = ((const struct symt_pointer*)type)->size;
|
||||
break;
|
||||
case SymTagUDT:
|
||||
X(DWORD64) = ((const struct symt_udt*)type)->size;
|
||||
|
|
Loading…
Reference in New Issue