SymGetType(...,TI_GET_LENGTH,...) requires a 64 bit parameter, not a

32 bit one.
This commit is contained in:
Eric Pouech 2005-11-17 11:51:53 +00:00 committed by Alexandre Julliard
parent 3d086ca2b7
commit 6b7bebfbf9
11 changed files with 91 additions and 81 deletions

View File

@ -37,7 +37,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
* but those values are not directly usable from a debugger (that's why, I
* assume, that we have also to define constants for enum values, as
* Codeview does BTW.
* + SymGetType(TI_GET_LENGTH) takes a ULONG64 (yurk, ugly)
* - SymGetLine{Next|Prev} don't work as expected (they don't seem to work across
* functions, and even across function blocks...). Basically, for *Next* to work
* it requires an address after the prolog of the func (the base address of the

View File

@ -570,8 +570,8 @@ static int elf_new_wine_thunks(struct module* module, struct hash_table* ht_symt
}
else if (strcmp(ste->ht_elt.name, module->addr_sorttab[idx]->hash_elt.name))
{
ULONG64 xaddr = 0;
DWORD xsize = 0, kind = -1;
ULONG64 xaddr = 0, xsize = 0;
DWORD kind = -1;
symt_get_info(&module->addr_sorttab[idx]->symt, TI_GET_ADDRESS, &xaddr);
symt_get_info(&module->addr_sorttab[idx]->symt, TI_GET_LENGTH, &xsize);
@ -584,11 +584,11 @@ static int elf_new_wine_thunks(struct module* module, struct hash_table* ht_symt
*/
if ((xsize || ste->symp->st_size) &&
(kind == (ELF32_ST_BIND(ste->symp->st_info) == STB_LOCAL) ? DataIsFileStatic : DataIsGlobal))
FIXME("Duplicate in %s: %s<%08lx-%08x> %s<%s-%08lx>\n",
FIXME("Duplicate in %s: %s<%08lx-%08x> %s<%s-%s>\n",
module->module.ModuleName,
ste->ht_elt.name, addr, ste->symp->st_size,
module->addr_sorttab[idx]->hash_elt.name,
wine_dbgstr_longlong(xaddr), xsize);
wine_dbgstr_longlong(xaddr), wine_dbgstr_longlong(xsize));
}
}
}

View File

@ -403,9 +403,9 @@ static int codeview_add_type_array(struct module* module,
if (elem)
{
DWORD elem_size;
DWORD64 elem_size;
symt_get_info(elem, TI_GET_LENGTH, &elem_size);
if (elem_size) arr_max = arr_len / elem_size;
if (elem_size) arr_max = arr_len / (DWORD)elem_size;
}
symt = &symt_new_array(module, 0, arr_max, elem)->symt;
return codeview_add_type(typeno, symt);
@ -567,11 +567,11 @@ static int codeview_add_type_struct_field_list(struct module* module,
if (!subtype || subtype->tag != SymTagCVBitField)
{
DWORD elem_size = 0;
DWORD64 elem_size = 0;
if (subtype) symt_get_info(subtype, TI_GET_LENGTH, &elem_size);
symt_add_udt_element(module, symt, terminate_string(p_name),
codeview_get_type(type->member_v1.type, TRUE),
value << 3, elem_size << 3);
value << 3, (DWORD)elem_size << 3);
}
else
{
@ -591,10 +591,10 @@ static int codeview_add_type_struct_field_list(struct module* module,
if (!subtype || subtype->tag != SymTagCVBitField)
{
DWORD elem_size = 0;
DWORD64 elem_size = 0;
if (subtype) symt_get_info(subtype, TI_GET_LENGTH, &elem_size);
symt_add_udt_element(module, symt, terminate_string(p_name),
subtype, value << 3, elem_size << 3);
subtype, value << 3, (DWORD)elem_size << 3);
}
else
{
@ -614,10 +614,10 @@ static int codeview_add_type_struct_field_list(struct module* module,
if (!subtype || subtype->tag != SymTagCVBitField)
{
DWORD elem_size = 0;
DWORD64 elem_size = 0;
if (subtype) symt_get_info(subtype, TI_GET_LENGTH, &elem_size);
symt_add_udt_element(module, symt, c_name,
subtype, value << 3, elem_size << 3);
subtype, value << 3, (DWORD)elem_size << 3);
}
else
{

View File

@ -627,7 +627,7 @@ static inline int stabs_pts_read_aggregate(struct ParseTypedefData* ptd,
{
char tmp[256];
WCHAR* name;
DWORD size;
DWORD64 size;
symt_get_info(adt, TI_GET_SYMNAME, &name);
strcpy(tmp, "__inherited_class_");
@ -642,7 +642,7 @@ static inline int stabs_pts_read_aggregate(struct ParseTypedefData* ptd,
* be much of a problem
*/
symt_get_info(adt, TI_GET_LENGTH, &size);
symt_add_udt_element(ptd->module, sdt, tmp, adt, ofs, size * 8);
symt_add_udt_element(ptd->module, sdt, tmp, adt, ofs, (DWORD)size * 8);
}
PTS_ABORTIF(ptd, *ptd->ptr++ != ';');
}

View File

@ -179,7 +179,7 @@ struct symt_data* symt_new_global_variable(struct module* module,
{
struct symt_data* sym;
struct symt** p;
DWORD tsz;
DWORD64 tsz;
TRACE_(dbghelp_symt)("Adding global symbol %s:%s @%lx %p\n",
module->module.ModuleName, name, addr, type);
@ -196,8 +196,9 @@ struct symt_data* symt_new_global_variable(struct module* module,
if (type && size && symt_get_info(type, TI_GET_LENGTH, &tsz))
{
if (tsz != size)
FIXME("Size mismatch for %s.%s between type (%lu) and src (%lu)\n",
module->module.ModuleName, name, tsz, size);
FIXME("Size mismatch for %s.%s between type (%s) and src (%lu)\n",
module->module.ModuleName, name,
wine_dbgstr_longlong(tsz), size);
}
if (compiland)
{
@ -440,10 +441,12 @@ static void symt_fill_sym_info(const struct module* module,
const struct symt* sym, SYMBOL_INFO* sym_info)
{
const char* name;
DWORD64 size;
sym_info->TypeIndex = (DWORD)sym;
sym_info->info = 0; /* TBD */
symt_get_info(sym, TI_GET_LENGTH, &sym_info->Size);
symt_get_info(sym, TI_GET_LENGTH, &size);
sym_info->Size = (DWORD)size;
sym_info->ModBase = module->module.BaseOfImage;
sym_info->Flags = 0;
switch (sym->tag)
@ -601,8 +604,7 @@ static BOOL resort_symbols(struct module* module)
int symt_find_nearest(struct module* module, DWORD addr)
{
int mid, high, low;
ULONG64 ref_addr;
DWORD ref_size;
ULONG64 ref_addr, ref_size;
if (!module->sortlist_valid || !module->addr_sorttab)
{

View File

@ -370,6 +370,7 @@ BOOL WINAPI SymEnumTypes(HANDLE hProcess, ULONG64 BaseOfDll,
const char* tmp;
struct symt* type;
void* pos = NULL;
DWORD64 size;
TRACE("(%p %s %p %p)\n",
hProcess, wine_dbgstr_longlong(BaseOfDll), EnumSymbolsCallback,
@ -387,7 +388,8 @@ BOOL WINAPI SymEnumTypes(HANDLE hProcess, ULONG64 BaseOfDll,
type = *(struct symt**)pos;
sym_info->TypeIndex = (DWORD)type;
sym_info->info = 0; /* FIXME */
symt_get_info(type, TI_GET_LENGTH, &sym_info->Size);
symt_get_info(type, TI_GET_LENGTH, &size);
sym_info->Size = size;
sym_info->ModBase = module->module.BaseOfImage;
sym_info->Flags = 0; /* FIXME */
sym_info->Value = 0; /* FIXME */
@ -559,40 +561,40 @@ BOOL symt_get_info(const struct symt* type, IMAGEHLP_SYMBOL_TYPE_INFO req,
switch (type->tag)
{
case SymTagBaseType:
X(DWORD) = ((const struct symt_basic*)type)->size;
X(DWORD64) = ((const struct symt_basic*)type)->size;
break;
case SymTagFunction:
X(DWORD) = ((const struct symt_function*)type)->size;
X(DWORD64) = ((const struct symt_function*)type)->size;
break;
case SymTagPointerType:
X(DWORD) = sizeof(void*);
X(DWORD64) = sizeof(void*);
break;
case SymTagUDT:
X(DWORD) = ((const struct symt_udt*)type)->size;
X(DWORD64) = ((const struct symt_udt*)type)->size;
break;
case SymTagEnum:
X(DWORD) = sizeof(int); /* FIXME: should be size of base-type of enum !!! */
X(DWORD64) = sizeof(int); /* FIXME: should be size of base-type of enum !!! */
break;
case SymTagData:
if (((const struct symt_data*)type)->kind != DataIsMember ||
!((const struct symt_data*)type)->u.s.length)
return FALSE;
X(DWORD) = ((const struct symt_data*)type)->u.s.length;
X(DWORD64) = ((const struct symt_data*)type)->u.s.length;
break;
case SymTagArrayType:
if (!symt_get_info(((const struct symt_array*)type)->basetype,
TI_GET_LENGTH, pInfo))
return FALSE;
X(DWORD) *= ((const struct symt_array*)type)->end -
X(DWORD64) *= ((const struct symt_array*)type)->end -
((const struct symt_array*)type)->start + 1;
break;
case SymTagPublicSymbol:
X(DWORD) = ((const struct symt_public*)type)->size;
X(DWORD64) = ((const struct symt_public*)type)->size;
break;
case SymTagTypedef:
return symt_get_info(((const struct symt_typedef*)type)->type, TI_GET_LENGTH, pInfo);
case SymTagThunk:
X(DWORD) = ((const struct symt_thunk*)type)->size;
X(DWORD64) = ((const struct symt_thunk*)type)->size;
break;
default:
FIXME("Unsupported sym-tag %s for get-length\n",

View File

@ -357,7 +357,7 @@ void break_check_delayed_bp(void)
static void break_add_watch(const struct dbg_lvalue* lvalue, BOOL is_write)
{
int num;
DWORD l = 4;
DWORD64 l = 4;
num = init_xpoint((is_write) ? be_xpoint_watch_write : be_xpoint_watch_read,
&lvalue->addr);
@ -371,13 +371,14 @@ static void break_add_watch(const struct dbg_lvalue* lvalue, BOOL is_write)
{
case 4: case 2: case 1: break;
default:
dbg_printf("Unsupported length (%lu) for watch-points, defaulting to 4\n", l);
dbg_printf("Unsupported length (%s) for watch-points, defaulting to 4\n",
wine_dbgstr_longlong(l));
break;
}
}
else dbg_printf("Cannot get watch size, defaulting to 4\n");
}
dbg_curr_process->bp[num].w.len = l - 1;
dbg_curr_process->bp[num].w.len = (DWORD)l - 1;
if (!get_watched_value(num, &dbg_curr_process->bp[num].w.oldval))
{

View File

@ -279,7 +279,7 @@ struct dbg_lvalue expr_eval(struct expr* exp)
struct dbg_lvalue exp1;
struct dbg_lvalue exp2;
unsigned int cexp[5];
DWORD scale1, scale2, scale3;
DWORD64 scale1, scale2, scale3;
struct dbg_type type1, type2;
DWORD tag;
const struct dbg_internal_var* div;
@ -509,8 +509,8 @@ struct dbg_lvalue expr_eval(struct expr* exp)
types_get_info(&type2, TI_GET_LENGTH, &scale1);
rtn.type = exp2.type;
}
exp->un.binop.result = (types_extract_as_integer(&exp1) * scale1 +
scale2 * types_extract_as_integer(&exp2));
exp->un.binop.result = types_extract_as_integer(&exp1) * (DWORD)scale1 +
(DWORD)scale2 * types_extract_as_integer(&exp2);
break;
case EXP_OP_SUB:
if (!types_get_info(&exp1.type, TI_GET_SYMTAG, &tag) ||
@ -541,8 +541,8 @@ struct dbg_lvalue expr_eval(struct expr* exp)
types_get_info(&type2, TI_GET_LENGTH, &scale1);
rtn.type = exp2.type;
}
exp->un.binop.result = (types_extract_as_integer(&exp1) * scale1 -
types_extract_as_integer(&exp2) * scale2) / scale3;
exp->un.binop.result = (types_extract_as_integer(&exp1) * (DWORD)scale1 -
types_extract_as_integer(&exp2) * (DWORD)scale2) / (DWORD)scale3;
break;
case EXP_OP_SEG:
rtn.type.id = dbg_itype_none;

View File

@ -119,9 +119,9 @@ BOOL memory_read_value(const struct dbg_lvalue* lvalue, DWORD size, void* result
BOOL memory_write_value(const struct dbg_lvalue* lvalue, DWORD size, void* value)
{
BOOL ret = TRUE;
DWORD os;
DWORD64 os;
os = ~size;
os = ~(DWORD64)size;
types_get_info(&lvalue->type, TI_GET_LENGTH, &os);
assert(size == os);
@ -287,6 +287,7 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue)
long long int val_int;
void* val_ptr;
long double val_real;
DWORD64 size64;
DWORD tag, size, count, bt;
struct dbg_type rtype;
@ -297,13 +298,13 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue)
switch (tag)
{
case SymTagBaseType:
if (!types_get_info(&lvalue->type, TI_GET_LENGTH, &size) ||
if (!types_get_info(&lvalue->type, TI_GET_LENGTH, &size64) ||
!types_get_info(&lvalue->type, TI_GET_BASETYPE, &bt))
{
WINE_ERR("Couldn't get information\n");
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
}
size = (DWORD)size64;
switch (bt)
{
case btInt:
@ -343,14 +344,14 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue)
rtype.module = lvalue->type.module;
if (types_get_info(&rtype, TI_GET_SYMTAG, &tag) && tag == SymTagBaseType &&
types_get_info(&rtype, TI_GET_BASETYPE, &bt) && bt == btChar &&
types_get_info(&rtype, TI_GET_LENGTH, &size))
types_get_info(&rtype, TI_GET_LENGTH, &size64))
{
char buffer[1024];
if (!val_ptr) dbg_printf("0x0");
else if (memory_get_string(dbg_curr_process, val_ptr,
lvalue->cookie == DLV_TARGET,
size == 2, buffer, sizeof(buffer)))
size64 == 2, buffer, sizeof(buffer)))
dbg_printf("\"%s\"", buffer);
else
dbg_printf("*** invalid address %p ***", val_ptr);

View File

@ -444,8 +444,8 @@ void symbol_read_symtable(const char* filename, unsigned long offset)
enum dbg_line_status symbol_get_function_line_status(const ADDRESS* addr)
{
IMAGEHLP_LINE il;
DWORD disp, size;
ULONG64 disp64, start;
DWORD disp;
ULONG64 disp64, start, size;
DWORD lin = (DWORD)memory_to_linear_addr(addr);
char buffer[sizeof(SYMBOL_INFO) + 256];
SYMBOL_INFO* sym = (SYMBOL_INFO*)buffer;

View File

@ -39,6 +39,7 @@ long int types_extract_as_integer(const struct dbg_lvalue* lvalue)
{
long int rtn = 0;
DWORD tag, size, bt;
DWORD64 size64;
if (lvalue->type.id == dbg_itype_none ||
!types_get_info(&lvalue->type, TI_GET_SYMTAG, &tag))
@ -47,17 +48,18 @@ long int types_extract_as_integer(const struct dbg_lvalue* lvalue)
switch (tag)
{
case SymTagBaseType:
if (!types_get_info(&lvalue->type, TI_GET_LENGTH, &size) ||
if (!types_get_info(&lvalue->type, TI_GET_LENGTH, &size64) ||
!types_get_info(&lvalue->type, TI_GET_BASETYPE, &bt))
{
WINE_ERR("Couldn't get information\n");
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
}
if (size > sizeof(rtn))
if (size64 > sizeof(rtn))
{
WINE_ERR("Size too large (%lu)\n", size);
WINE_ERR("Size too large (%s)\n", wine_dbgstr_longlong(size64));
return 0;
}
size = (DWORD)size64;
/* FIXME: we have an ugly & non portable thing here !!! */
if (!memory_read_value(lvalue, size, &rtn)) return 0;
@ -144,8 +146,10 @@ BOOL types_deref(const struct dbg_lvalue* lvalue, struct dbg_lvalue* result)
static BOOL types_get_udt_element_lvalue(struct dbg_lvalue* lvalue,
const struct dbg_type* type, long int* tmpbuf)
{
DWORD offset, length, bitoffset;
DWORD offset, bitoffset;
DWORD bt;
DWORD64 length;
unsigned mask;
types_get_info(type, TI_GET_TYPE, &lvalue->type.id);
@ -166,7 +170,7 @@ static BOOL types_get_udt_element_lvalue(struct dbg_lvalue* lvalue,
* it in a temporary buffer so that we get it all right.
*/
if (!memory_read_value(lvalue, sizeof(*tmpbuf), tmpbuf)) return FALSE;
mask = 0xffffffff << length;
mask = 0xffffffff << (DWORD)length;
*tmpbuf >>= bitoffset & 7;
*tmpbuf &= ~mask;
@ -179,7 +183,7 @@ static BOOL types_get_udt_element_lvalue(struct dbg_lvalue* lvalue,
* we need to sign extend the number.
*/
if (types_get_info(&lvalue->type, TI_GET_BASETYPE, &bt) &&
bt == btInt && (*tmpbuf & (1 << (length - 1))))
bt == btInt && (*tmpbuf & (1 << ((DWORD)length - 1))))
{
*tmpbuf |= mask;
}
@ -247,7 +251,8 @@ BOOL types_udt_find_element(struct dbg_lvalue* lvalue, const char* name, long in
BOOL types_array_index(const struct dbg_lvalue* lvalue, int index,
struct dbg_lvalue* result)
{
DWORD tag, length, count;
DWORD tag, count;
DWORD64 length;
if (!types_get_info(&lvalue->type, TI_GET_SYMTAG, &tag))
return FALSE;
@ -266,7 +271,7 @@ BOOL types_array_index(const struct dbg_lvalue* lvalue, int index,
types_get_info(&lvalue->type, TI_GET_TYPE, &result->type.id);
types_get_info(&result->type, TI_GET_LENGTH, &length);
memory_read_value(lvalue, sizeof(result->addr.Offset), &result->addr.Offset);
result->addr.Offset += index * length;
result->addr.Offset += index * (DWORD)length;
break;
default:
assert(FALSE);
@ -370,7 +375,7 @@ void print_value(const struct dbg_lvalue* lvalue, char format, int level)
int i;
DWORD tag;
DWORD count;
DWORD size;
DWORD64 size;
if (lvalue->type.id == dbg_itype_none)
{
@ -656,7 +661,7 @@ BOOL types_get_info(const struct dbg_type* type, IMAGEHLP_SYMBOL_TYPE_INFO ti, v
switch (ti)
{
case TI_GET_SYMTAG: X(DWORD) = SymTagBaseType; break;
case TI_GET_LENGTH: X(DWORD) = 4; break;
case TI_GET_LENGTH: X(DWORD64) = 4; break;
case TI_GET_BASETYPE: X(DWORD) = btUInt; break;
default: WINE_FIXME("unsupported %u for u-int\n", ti); return FALSE;
}
@ -665,7 +670,7 @@ BOOL types_get_info(const struct dbg_type* type, IMAGEHLP_SYMBOL_TYPE_INFO ti, v
switch (ti)
{
case TI_GET_SYMTAG: X(DWORD) = SymTagBaseType; break;
case TI_GET_LENGTH: X(DWORD) = 4; break;
case TI_GET_LENGTH: X(DWORD64) = 4; break;
case TI_GET_BASETYPE: X(DWORD) = btInt; break;
default: WINE_FIXME("unsupported %u for s-int\n", ti); return FALSE;
}
@ -674,7 +679,7 @@ BOOL types_get_info(const struct dbg_type* type, IMAGEHLP_SYMBOL_TYPE_INFO ti, v
switch (ti)
{
case TI_GET_SYMTAG: X(DWORD) = SymTagBaseType; break;
case TI_GET_LENGTH: X(DWORD) = 2; break;
case TI_GET_LENGTH: X(DWORD64) = 2; break;
case TI_GET_BASETYPE: X(DWORD) = btUInt; break;
default: WINE_FIXME("unsupported %u for u-short int\n", ti); return FALSE;
}
@ -683,7 +688,7 @@ BOOL types_get_info(const struct dbg_type* type, IMAGEHLP_SYMBOL_TYPE_INFO ti, v
switch (ti)
{
case TI_GET_SYMTAG: X(DWORD) = SymTagBaseType; break;
case TI_GET_LENGTH: X(DWORD) = 2; break;
case TI_GET_LENGTH: X(DWORD64) = 2; break;
case TI_GET_BASETYPE: X(DWORD) = btInt; break;
default: WINE_FIXME("unsupported %u for s-short int\n", ti); return FALSE;
}
@ -692,7 +697,7 @@ BOOL types_get_info(const struct dbg_type* type, IMAGEHLP_SYMBOL_TYPE_INFO ti, v
switch (ti)
{
case TI_GET_SYMTAG: X(DWORD) = SymTagBaseType; break;
case TI_GET_LENGTH: X(DWORD) = 1; break;
case TI_GET_LENGTH: X(DWORD64) = 1; break;
case TI_GET_BASETYPE: X(DWORD) = btUInt; break;
default: WINE_FIXME("unsupported %u for u-char int\n", ti); return FALSE;
}
@ -701,7 +706,7 @@ BOOL types_get_info(const struct dbg_type* type, IMAGEHLP_SYMBOL_TYPE_INFO ti, v
switch (ti)
{
case TI_GET_SYMTAG: X(DWORD) = SymTagBaseType; break;
case TI_GET_LENGTH: X(DWORD) = 1; break;
case TI_GET_LENGTH: X(DWORD64) = 1; break;
case TI_GET_BASETYPE: X(DWORD) = btInt; break;
default: WINE_FIXME("unsupported %u for s-char int\n", ti); return FALSE;
}
@ -710,7 +715,7 @@ BOOL types_get_info(const struct dbg_type* type, IMAGEHLP_SYMBOL_TYPE_INFO ti, v
switch (ti)
{
case TI_GET_SYMTAG: X(DWORD) = SymTagBaseType; break;
case TI_GET_LENGTH: X(DWORD) = 1; break;
case TI_GET_LENGTH: X(DWORD64) = 1; break;
case TI_GET_BASETYPE: X(DWORD) = btChar; break;
default: WINE_FIXME("unsupported %u for char int\n", ti); return FALSE;
}
@ -719,7 +724,7 @@ BOOL types_get_info(const struct dbg_type* type, IMAGEHLP_SYMBOL_TYPE_INFO ti, v
switch (ti)
{
case TI_GET_SYMTAG: X(DWORD) = SymTagPointerType; break;
case TI_GET_LENGTH: X(DWORD) = 4; break;
case TI_GET_LENGTH: X(DWORD64) = 4; break;
case TI_GET_TYPE: X(DWORD) = dbg_itype_char; break;
default: WINE_FIXME("unsupported %u for a string\n", ti); return FALSE;
}