winedbg: Avoid using 'long' types.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-10-04 14:16:23 +02:00
parent 6a2325609c
commit b9046a4936
12 changed files with 59 additions and 56 deletions

View File

@ -1772,7 +1772,7 @@ static BOOL be_arm_is_jump(const void* insn, ADDRESS64* jumpee)
static BOOL be_arm_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
dbg_ctx_t *ctx, enum be_xpoint_type type,
void* addr, unsigned long* val, unsigned size)
void* addr, unsigned *val, unsigned size)
{
SIZE_T sz;
@ -1790,7 +1790,7 @@ static BOOL be_arm_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pi
static BOOL be_arm_remove_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
dbg_ctx_t *ctx, enum be_xpoint_type type,
void* addr, unsigned long val, unsigned size)
void* addr, unsigned val, unsigned size)
{
SIZE_T sz;

View File

@ -171,7 +171,7 @@ static BOOL be_arm64_is_jump(const void* insn, ADDRESS64* jumpee)
static BOOL be_arm64_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
dbg_ctx_t *ctx, enum be_xpoint_type type,
void* addr, unsigned long* val, unsigned size)
void* addr, unsigned *val, unsigned size)
{
SIZE_T sz;
@ -189,7 +189,7 @@ static BOOL be_arm64_insert_Xpoint(HANDLE hProcess, const struct be_process_io*
static BOOL be_arm64_remove_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
dbg_ctx_t *ctx, enum be_xpoint_type type,
void* addr, unsigned long val, unsigned size)
void* addr, unsigned val, unsigned size)
{
SIZE_T sz;

View File

@ -49,7 +49,7 @@ struct backend_cpu
*/
BOOL (*build_addr)(HANDLE hThread, const dbg_ctx_t *ctx,
ADDRESS64* addr, unsigned seg,
unsigned long offset);
DWORD64 offset);
/* Retrieves in addr an address related to the context (program counter, stack
* pointer, frame pointer)
*/
@ -100,11 +100,11 @@ struct backend_cpu
/* Inserts an Xpoint in the CPU context and/or debuggee address space */
BOOL (*insert_Xpoint)(HANDLE hProcess, const struct be_process_io* pio,
dbg_ctx_t *ctx, enum be_xpoint_type type,
void* addr, unsigned long* val, unsigned size);
void* addr, unsigned *val, unsigned size);
/* Removes an Xpoint in the CPU context and/or debuggee address space */
BOOL (*remove_Xpoint)(HANDLE hProcess, const struct be_process_io* pio,
dbg_ctx_t *ctx, enum be_xpoint_type type,
void* addr, unsigned long val, unsigned size);
void* addr, unsigned val, unsigned size);
/* Checks whether a given watchpoint has been triggered */
BOOL (*is_watchpoint_set)(const dbg_ctx_t *ctx, unsigned idx);
/* Clears the watchpoint indicator */
@ -135,4 +135,4 @@ struct backend_cpu
/* some handy functions for non segmented CPUs */
void* be_cpu_linearize(HANDLE hThread, const ADDRESS64*);
BOOL be_cpu_build_addr(HANDLE hThread, const dbg_ctx_t *ctx, ADDRESS64* addr,
unsigned seg, unsigned long offset);
unsigned seg, DWORD64 offset);

View File

@ -70,7 +70,7 @@ static void* be_i386_linearize(HANDLE hThread, const ADDRESS64* addr)
}
static BOOL be_i386_build_addr(HANDLE hThread, const dbg_ctx_t *ctx, ADDRESS64* addr,
unsigned seg, unsigned long offset)
unsigned seg, DWORD64 offset)
{
addr->Mode = AddrModeFlat;
addr->Segment = seg;
@ -682,13 +682,13 @@ static inline int be_i386_get_unused_DR(dbg_ctx_t *pctx, DWORD** r)
static BOOL be_i386_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
dbg_ctx_t *ctx, enum be_xpoint_type type,
void* addr, unsigned long* val, unsigned size)
void* addr, unsigned *val, unsigned size)
{
unsigned char ch;
SIZE_T sz;
DWORD *pr;
int reg;
unsigned long bits;
unsigned int bits;
switch (type)
{
@ -733,7 +733,7 @@ static BOOL be_i386_insert_Xpoint(HANDLE hProcess, const struct be_process_io* p
static BOOL be_i386_remove_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
dbg_ctx_t *ctx, enum be_xpoint_type type,
void* addr, unsigned long val, unsigned size)
void* addr, unsigned val, unsigned size)
{
SIZE_T sz;
unsigned char ch;

View File

@ -609,13 +609,13 @@ static inline int be_x86_64_get_unused_DR(dbg_ctx_t *pctx, DWORD64** r)
static BOOL be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
dbg_ctx_t *ctx, enum be_xpoint_type type,
void* addr, unsigned long* val, unsigned size)
void* addr, unsigned *val, unsigned size)
{
unsigned char ch;
SIZE_T sz;
DWORD64 *pr;
int reg;
unsigned long bits;
unsigned int bits;
switch (type)
{
@ -661,7 +661,7 @@ static BOOL be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process_io*
static BOOL be_x86_64_remove_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
dbg_ctx_t *ctx, enum be_xpoint_type type,
void* addr, unsigned long val, unsigned size)
void* addr, unsigned val, unsigned size)
{
SIZE_T sz;
unsigned char ch;

View File

@ -1290,7 +1290,7 @@ db_disasm(db_addr_t loc, boolean_t altfmt)
int rep;
int imm;
int imm2;
long imm64;
LONG64 imm64;
int len;
struct i_addr address;
db_addr_t addr;
@ -1603,7 +1603,10 @@ db_disasm(db_addr_t loc, boolean_t altfmt)
case Ilq:
len = db_lengths[rex & REX_W ? QUAD : LONG];
get_value_inc(imm64, loc, len, FALSE);
db_printf("$%#lx", imm64);
if (imm64 >> 32)
db_printf("$0x%x%08x", (DWORD)(imm64 >> 32), (DWORD)imm64);
else
db_printf("$%#x", (DWORD)imm64);
break;
case O:

View File

@ -98,7 +98,7 @@ enum dbg_internal_types
*/
struct dbg_type
{
unsigned long id;
ULONG id;
DWORD_PTR module;
};
@ -133,11 +133,11 @@ enum dbg_exec_mode
struct dbg_breakpoint
{
ADDRESS64 addr;
unsigned long enabled : 1,
unsigned int enabled : 1,
xpoint_type : 2,
refcount : 13,
skipcount : 16;
unsigned long info;
unsigned int info;
struct /* only used for watchpoints */
{
BYTE len : 2;
@ -256,7 +256,7 @@ struct dbg_internal_var
DWORD_PTR val;
const char* name;
DWORD_PTR *pval;
unsigned long typeid; /* always internal type */
ULONG typeid; /* always internal type */
};
enum sym_get_lval {sglv_found, sglv_unknown, sglv_aborted};
@ -328,8 +328,8 @@ extern BOOL display_enable(int displaynum, int enable);
extern void expr_free_all(void);
extern struct expr* expr_alloc_internal_var(const char* name);
extern struct expr* expr_alloc_symbol(const char* name);
extern struct expr* expr_alloc_sconstant(long int val);
extern struct expr* expr_alloc_uconstant(long unsigned val);
extern struct expr* expr_alloc_sconstant(INT_PTR val);
extern struct expr* expr_alloc_uconstant(UINT_PTR val);
extern struct expr* expr_alloc_string(const char* str);
extern struct expr* expr_alloc_binary_op(int oper, struct expr*, struct expr*);
extern struct expr* expr_alloc_unary_op(int oper, struct expr*);
@ -393,7 +393,7 @@ extern BOOL stack_get_current_symbol(SYMBOL_INFO* sym);
/* symbol.c */
extern enum sym_get_lval symbol_get_lvalue(const char* name, const int lineno, struct dbg_lvalue* addr, BOOL bp_disp);
extern void symbol_read_symtable(const char* filename, unsigned long offset);
extern void symbol_read_symtable(const char* filename, ULONG_PTR offset);
extern enum dbg_line_status symbol_get_function_line_status(const ADDRESS64* addr);
extern BOOL symbol_get_line(const char* filename, const char* func, IMAGEHLP_LINE64* ret);
extern void symbol_info(const char* str);
@ -432,16 +432,16 @@ extern enum dbg_start tgt_module_load(const char* name, BOOL keep);
extern void print_value(const struct dbg_lvalue* addr, char format, int level);
extern BOOL types_print_type(const struct dbg_type*, BOOL details);
extern BOOL print_types(void);
extern long int types_extract_as_integer(const struct dbg_lvalue*);
extern INT_PTR types_extract_as_integer(const struct dbg_lvalue*);
extern LONGLONG types_extract_as_longlong(const struct dbg_lvalue*, unsigned* psize, BOOL *pissigned);
extern void types_extract_as_address(const struct dbg_lvalue*, ADDRESS64*);
extern BOOL types_store_value(struct dbg_lvalue* lvalue_to, const struct dbg_lvalue* lvalue_from);
extern BOOL types_udt_find_element(struct dbg_lvalue* value, const char* name, long int* tmpbuf);
extern BOOL types_udt_find_element(struct dbg_lvalue* value, const char* name, ULONG *tmpbuf);
extern BOOL types_array_index(const struct dbg_lvalue* value, int index, struct dbg_lvalue* result);
extern BOOL types_get_info(const struct dbg_type*, IMAGEHLP_SYMBOL_TYPE_INFO, void*);
extern BOOL types_get_real_type(struct dbg_type* type, DWORD* tag);
extern struct dbg_type types_find_pointer(const struct dbg_type* type);
extern struct dbg_type types_find_type(unsigned long linear, const char* name, enum SymTagEnum tag);
extern struct dbg_type types_find_type(DWORD64 linear, const char* name, enum SymTagEnum tag);
/* winedbg.c */
extern void dbg_outputW(const WCHAR* buffer, int len);

View File

@ -37,12 +37,12 @@ struct expr
{
struct
{
long int value;
INT_PTR value;
} s_const;
struct
{
long unsigned int value;
UINT_PTR value;
} u_const;
struct
@ -64,7 +64,7 @@ struct expr
{
int unop_type;
struct expr* exp1;
long int result;
INT_PTR result;
} unop;
struct
@ -72,7 +72,7 @@ struct expr
int binop_type;
struct expr* exp1;
struct expr* exp2;
long int result;
INT_PTR result;
} binop;
struct
@ -85,7 +85,7 @@ struct expr
{
struct expr* exp1;
const char* element_name;
long int result;
ULONG result;
} structure;
struct
@ -93,7 +93,7 @@ struct expr
const char* funcname;
int nargs;
struct expr* arg[5];
long int result;
ULONG result;
} call;
} un;
@ -165,7 +165,7 @@ struct expr* expr_alloc_symbol(const char* name)
return ex;
}
struct expr* expr_alloc_sconstant(long int value)
struct expr* expr_alloc_sconstant(INT_PTR value)
{
struct expr* ex;
@ -176,7 +176,7 @@ struct expr* expr_alloc_sconstant(long int value)
return ex;
}
struct expr* expr_alloc_uconstant(long unsigned int value)
struct expr* expr_alloc_uconstant(UINT_PTR value)
{
struct expr* ex;
@ -583,10 +583,10 @@ struct dbg_lvalue expr_eval(struct expr* exp)
exp->un.binop.result = (types_extract_as_integer(&exp1) != types_extract_as_integer(&exp2));
break;
case EXP_OP_SHL:
exp->un.binop.result = ((unsigned long)types_extract_as_integer(&exp1) << types_extract_as_integer(&exp2));
exp->un.binop.result = ((UINT_PTR)types_extract_as_integer(&exp1) << types_extract_as_integer(&exp2));
break;
case EXP_OP_SHR:
exp->un.binop.result = ((unsigned long)types_extract_as_integer(&exp1) >> types_extract_as_integer(&exp2));
exp->un.binop.result = ((UINT_PTR)types_extract_as_integer(&exp1) >> types_extract_as_integer(&exp2));
break;
case EXP_OP_MUL:
exp->un.binop.result = (types_extract_as_integer(&exp1) * types_extract_as_integer(&exp2));

View File

@ -59,7 +59,7 @@ struct gdb_xpoint
enum be_xpoint_type type;
void *addr;
int size;
unsigned long value;
unsigned int value;
};
struct gdb_context
@ -88,7 +88,7 @@ struct gdb_context
/* Win32 information */
struct dbg_process* process;
/* Unix environment */
unsigned long wine_segs[3]; /* load addresses of the ELF wine exec segments (text, bss and data) */
ULONG_PTR wine_segs[3]; /* load addresses of the ELF wine exec segments (text, bss and data) */
BOOL no_ack_mode;
};
@ -132,7 +132,7 @@ static void gdbctx_insert_xpoint(struct gdb_context *gdbctx, struct dbg_thread *
struct dbg_process *process = thread->process;
struct backend_cpu *cpu = process->be_cpu;
struct gdb_xpoint *x;
unsigned long value;
unsigned int value;
if (!cpu->insert_Xpoint(process->handle, process->process_io, ctx, type, addr, &value, size))
{
@ -742,7 +742,7 @@ static inline void packet_reply_hex_to_str(struct gdb_context* gdbctx, const cha
packet_reply_hex_to(gdbctx, src, strlen(src));
}
static void packet_reply_val(struct gdb_context* gdbctx, unsigned long val, int len)
static void packet_reply_val(struct gdb_context* gdbctx, ULONG_PTR val, int len)
{
int i, shift;
@ -863,13 +863,13 @@ static void packet_reply_status_xpoints(struct gdb_context* gdbctx, struct dbg_t
if (x->type == be_xpoint_watch_write)
{
packet_reply_add(gdbctx, "watch:");
packet_reply_val(gdbctx, (unsigned long)x->addr, sizeof(x->addr));
packet_reply_val(gdbctx, (ULONG_PTR)x->addr, sizeof(x->addr));
packet_reply_add(gdbctx, ";");
}
if (x->type == be_xpoint_watch_read)
{
packet_reply_add(gdbctx, "rwatch:");
packet_reply_val(gdbctx, (unsigned long)x->addr, sizeof(x->addr));
packet_reply_val(gdbctx, (ULONG_PTR)x->addr, sizeof(x->addr));
packet_reply_add(gdbctx, ";");
}
}
@ -1609,7 +1609,7 @@ static BOOL CALLBACK packet_query_libraries_cb(PCSTR mod_name, DWORD64 base, PVO
{
if ((char *)(sec + i) >= buffer + size) break;
packet_reply_add(gdbctx, "<segment address=\"0x");
packet_reply_val(gdbctx, mod.BaseOfImage + sec[i].VirtualAddress, sizeof(unsigned long));
packet_reply_val(gdbctx, mod.BaseOfImage + sec[i].VirtualAddress, sizeof(ULONG_PTR));
packet_reply_add(gdbctx, "\"/>");
}

View File

@ -40,7 +40,7 @@ void* be_cpu_linearize(HANDLE hThread, const ADDRESS64* addr)
}
BOOL be_cpu_build_addr(HANDLE hThread, const dbg_ctx_t *ctx, ADDRESS64* addr,
unsigned seg, unsigned long offset)
unsigned seg, DWORD64 offset)
{
addr->Mode = AddrModeFlat;
addr->Segment = 0; /* don't need segment */

View File

@ -512,7 +512,7 @@ BOOL symbol_is_local(const char* name)
*
* Read a symbol file into the hash table.
*/
void symbol_read_symtable(const char* filename, unsigned long offset)
void symbol_read_symtable(const char* filename, ULONG_PTR offset)
{
dbg_printf("No longer supported\n");

View File

@ -136,7 +136,7 @@ LONGLONG types_extract_as_longlong(const struct dbg_lvalue* lvalue,
* Given a lvalue, try to get an integral (or pointer/address) value
* out of it
*/
long int types_extract_as_integer(const struct dbg_lvalue* lvalue)
INT_PTR types_extract_as_integer(const struct dbg_lvalue* lvalue)
{
return types_extract_as_longlong(lvalue, NULL, NULL);
}
@ -182,7 +182,7 @@ BOOL types_store_value(struct dbg_lvalue* lvalue_to, const struct dbg_lvalue* lv
* Implement a structure derefencement
*/
static BOOL types_get_udt_element_lvalue(struct dbg_lvalue* lvalue,
const struct dbg_type* type, long int* tmpbuf)
const struct dbg_type* type, ULONG *tmpbuf)
{
DWORD offset, bitoffset;
DWORD bt;
@ -237,7 +237,7 @@ static BOOL types_get_udt_element_lvalue(struct dbg_lvalue* lvalue,
* types_udt_find_element
*
*/
BOOL types_udt_find_element(struct dbg_lvalue* lvalue, const char* name, long int* tmpbuf)
BOOL types_udt_find_element(struct dbg_lvalue* lvalue, const char* name, ULONG *tmpbuf)
{
DWORD tag, count;
char buffer[sizeof(TI_FINDCHILDREN_PARAMS) + 256 * sizeof(DWORD)];
@ -345,11 +345,11 @@ BOOL types_array_index(const struct dbg_lvalue* lvalue, int index, struct dbg_lv
struct type_find_t
{
unsigned long result; /* out: the found type */
ULONG result; /* out: the found type */
enum SymTagEnum tag; /* in: the tag to look for */
union
{
unsigned long typeid; /* when tag is SymTagUDT */
ULONG typeid; /* when tag is SymTagUDT */
const char* name; /* when tag is SymTagPointerType */
} u;
};
@ -413,7 +413,7 @@ struct dbg_type types_find_pointer(const struct dbg_type* type)
* Should look up in the module based at linear address whether a type
* named 'name' and with the correct tag exists
*/
struct dbg_type types_find_type(unsigned long linear, const char* name, enum SymTagEnum tag)
struct dbg_type types_find_type(DWORD64 linear, const char* name, enum SymTagEnum tag)
{
struct type_find_t f;
@ -478,7 +478,7 @@ void print_value(const struct dbg_lvalue* lvalue, char format, int level)
TI_FINDCHILDREN_PARAMS* fcp = (TI_FINDCHILDREN_PARAMS*)buffer;
WCHAR* ptr;
char tmp[256];
long int tmpbuf;
ULONG tmpbuf;
struct dbg_type sub_type;
dbg_printf("{");
@ -572,7 +572,7 @@ static BOOL CALLBACK print_types_cb(PSYMBOL_INFO sym, ULONG size, void* ctx)
struct dbg_type type;
type.module = sym->ModBase;
type.id = sym->TypeIndex;
dbg_printf("Mod: %08lx ID: %08lx\n", type.module, type.id);
dbg_printf("Mod: %08lx ID: %08x\n", type.module, type.id);
types_print_type(&type, TRUE);
dbg_printf("\n");
return TRUE;
@ -604,7 +604,7 @@ BOOL types_print_type(const struct dbg_type* type, BOOL details)
if (type->id == dbg_itype_none || !types_get_info(type, TI_GET_SYMTAG, &tag))
{
dbg_printf("--invalid--<%lxh>--", type->id);
dbg_printf("--invalid--<%xh>--", type->id);
return FALSE;
}
@ -931,7 +931,7 @@ BOOL types_get_info(const struct dbg_type* type, IMAGEHLP_SYMBOL_TYPE_INFO ti, v
default: WINE_FIXME("unsupported %u for XMM register\n", ti); return FALSE;
}
break;
default: WINE_FIXME("unsupported type id 0x%lx\n", type->id);
default: WINE_FIXME("unsupported type id 0x%x\n", type->id);
}
#undef X