Commit 1d04f826 authored by Ge van Geldorp's avatar Ge van Geldorp Committed by Alexandre Julliard

winedbg: Change ADDRESS variables to ADDRESS64 so we can handle 64-bit addresses.

parent 3b10a021
......@@ -23,7 +23,7 @@
#if defined(__ALPHA__)
static unsigned be_alpha_get_addr(HANDLE hThread, const CONTEXT* ctx,
enum be_cpu_addr bca, ADDRESS* addr)
enum be_cpu_addr bca, ADDRESS64* addr)
{
dbg_printf("not done\n");
return FALSE;
......@@ -77,7 +77,7 @@ static unsigned be_alpha_is_func_call(void* insn, void** insn_callee)
return FALSE;
}
static void be_alpha_disasm_one_insn(ADDRESS* addr, int display)
static void be_alpha_disasm_one_insn(ADDRESS64* addr, int display)
{
dbg_printf("Disasm NIY\n");
}
......
......@@ -29,20 +29,20 @@ struct backend_cpu
/* Linearizes an address. Only CPUs with segmented address model need this.
* Otherwise, implementation is straigthforward (be_cpu_linearize will do)
*/
void* (*linearize)(HANDLE hThread, const ADDRESS*);
/* Fills in an ADDRESS structure from a segment & an offset. CPUs without
void* (*linearize)(HANDLE hThread, const ADDRESS64*);
/* Fills in an ADDRESS64 structure from a segment & an offset. CPUs without
* segment address model should use 0 as seg. Required method to fill
* in an ADDRESS (except an linear one).
* in an ADDRESS64 (except an linear one).
* Non segmented CPU shall use be_cpu_build_addr
*/
unsigned (*build_addr)(HANDLE hThread, const CONTEXT* ctx,
ADDRESS* addr, unsigned seg,
ADDRESS64* addr, unsigned seg,
unsigned long offset);
/* Retrieves in addr an address related to the context (program counter, stack
* pointer, frame pointer)
*/
unsigned (*get_addr)(HANDLE hThread, const CONTEXT* ctx,
enum be_cpu_addr, ADDRESS* addr);
enum be_cpu_addr, ADDRESS64* addr);
/* -------------------------------------------------------------------------------
* context manipulation
* ------------------------------------------------------------------------------- */
......@@ -73,11 +73,11 @@ struct backend_cpu
*/
unsigned (*is_break_insn)(const void*);
/* Check whether instruciton at 'addr' is a function call */
unsigned (*is_function_call)(const void* insn, ADDRESS* callee);
unsigned (*is_function_call)(const void* insn, ADDRESS64* callee);
/* Ask for dissasembling one instruction. If display is true, assembly code
* will be printed. In all cases, 'addr' is advanced at next instruction
*/
void (*disasm_one_insn)(ADDRESS* addr, int display);
void (*disasm_one_insn)(ADDRESS64* addr, int display);
/* -------------------------------------------------------------------------------
* break points / watchpoints handling
* -------------------------------------------------------------------------------*/
......@@ -111,6 +111,6 @@ struct backend_cpu
extern struct backend_cpu* be_cpu;
/* some handy functions for non segmented CPUs */
void* be_cpu_linearize(HANDLE hThread, const ADDRESS*);
unsigned be_cpu_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS* addr,
void* be_cpu_linearize(HANDLE hThread, const ADDRESS64*);
unsigned be_cpu_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* addr,
unsigned seg, unsigned long offset);
......@@ -26,7 +26,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
#ifdef __i386__
/* debugger/db_disasm.c */
extern void be_i386_disasm_one_insn(ADDRESS* addr, int display);
extern void be_i386_disasm_one_insn(ADDRESS64* addr, int display);
#define STEP_FLAG 0x00000100 /* single step flag */
#define V86_FLAG 0x00020000
......@@ -46,30 +46,31 @@ static ADDRESS_MODE get_selector_type(HANDLE hThread, const CONTEXT* ctx, WORD s
return -1;
}
static void* be_i386_linearize(HANDLE hThread, const ADDRESS* addr)
static void* be_i386_linearize(HANDLE hThread, const ADDRESS64* addr)
{
LDT_ENTRY le;
switch (addr->Mode)
{
case AddrModeReal:
return (void*)((DWORD)(LOWORD(addr->Segment) << 4) + addr->Offset);
return (void*)((DWORD)(LOWORD(addr->Segment) << 4) + (DWORD)addr->Offset);
case AddrMode1632:
if (!(addr->Segment & 4) || ((addr->Segment >> 3) < 17))
return (void*)addr->Offset;
return (void*)(DWORD)addr->Offset;
/* fall through */
case AddrMode1616:
if (!GetThreadSelectorEntry(hThread, addr->Segment, &le)) return NULL;
return (void*)((le.HighWord.Bits.BaseHi << 24) +
(le.HighWord.Bits.BaseMid << 16) + le.BaseLow + addr->Offset);
(le.HighWord.Bits.BaseMid << 16) + le.BaseLow +
(DWORD)addr->Offset);
break;
case AddrModeFlat:
return (void*)addr->Offset;
return (void*)(DWORD)addr->Offset;
}
return NULL;
}
static unsigned be_i386_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS* addr,
static unsigned be_i386_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* addr,
unsigned seg, unsigned long offset)
{
addr->Mode = AddrModeFlat;
......@@ -96,7 +97,7 @@ static unsigned be_i386_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS*
}
static unsigned be_i386_get_addr(HANDLE hThread, const CONTEXT* ctx,
enum be_cpu_addr bca, ADDRESS* addr)
enum be_cpu_addr bca, ADDRESS64* addr)
{
switch (bca)
{
......@@ -378,7 +379,7 @@ static unsigned be_i386_is_break_insn(const void* insn)
return c == 0xCC;
}
static unsigned be_i386_is_func_call(const void* insn, ADDRESS* callee)
static unsigned be_i386_is_func_call(const void* insn, ADDRESS64* callee)
{
BYTE ch;
int delta;
......
......@@ -24,7 +24,7 @@
#if defined(__powerpc__)
static unsigned be_ppc_get_addr(HANDLE hThread, const CONTEXT* ctx,
enum be_cpu_addr bca, ADDRESS* addr)
enum be_cpu_addr bca, ADDRESS64* addr)
{
switch (bca)
{
......@@ -90,7 +90,7 @@ static unsigned be_ppc_is_func_call(void* insn, void** insn_callee)
return FALSE;
}
static void be_ppc_disasm_one_insn(ADDRESS* addr, int display)
static void be_ppc_disasm_one_insn(ADDRESS64* addr, int display)
{
dbg_printf("Disasm NIY\n");
}
......
......@@ -23,7 +23,7 @@
#if defined(__x86_64__)
static unsigned be_x86_64_get_addr(HANDLE hThread, const CONTEXT* ctx,
enum be_cpu_addr bca, ADDRESS* addr)
enum be_cpu_addr bca, ADDRESS64* addr)
{
addr->Mode = AddrModeFlat;
switch (bca)
......@@ -142,13 +142,13 @@ static unsigned be_x86_64_is_break_insn(const void* insn)
return FALSE;
}
static unsigned be_x86_64_is_func_call(const void* insn, ADDRESS* callee)
static unsigned be_x86_64_is_func_call(const void* insn, ADDRESS64* callee)
{
dbg_printf("not done is_func_call\n");
return FALSE;
}
static void be_x86_64_disasm_one_insn(ADDRESS* addr, int display)
static void be_x86_64_disasm_one_insn(ADDRESS64* addr, int display)
{
dbg_printf("Disasm NIY\n");
}
......
......@@ -88,7 +88,7 @@ void break_set_xpoints(BOOL set)
* Find the breakpoint for a given address. Return the breakpoint
* number or -1 if none.
*/
static int find_xpoint(const ADDRESS* addr, enum be_xpoint_type type)
static int find_xpoint(const ADDRESS64* addr, enum be_xpoint_type type)
{
int i;
void* lin = memory_to_linear_addr(addr);
......@@ -108,7 +108,7 @@ static int find_xpoint(const ADDRESS* addr, enum be_xpoint_type type)
*
* Find an empty slot in BP table to add a new break/watch point
*/
static int init_xpoint(int type, const ADDRESS* addr)
static int init_xpoint(int type, const ADDRESS64* addr)
{
int num;
struct dbg_breakpoint* bp = dbg_curr_process->bp;
......@@ -160,7 +160,7 @@ static BOOL get_watched_value(int num, LPDWORD val)
*
* Add a breakpoint.
*/
BOOL break_add_break(const ADDRESS* addr, BOOL verbose, BOOL swbp)
BOOL break_add_break(const ADDRESS64* addr, BOOL verbose, BOOL swbp)
{
int num;
BYTE ch;
......@@ -204,7 +204,7 @@ BOOL break_add_break(const ADDRESS* addr, BOOL verbose, BOOL swbp)
*/
BOOL break_add_break_from_lvalue(const struct dbg_lvalue* lvalue, BOOL swbp)
{
ADDRESS addr;
ADDRESS64 addr;
types_extract_as_address(lvalue, &addr);
......@@ -270,7 +270,7 @@ void break_add_break_from_id(const char *name, int lineno, BOOL swbp)
struct cb_break_lineno
{
int lineno;
ADDRESS addr;
ADDRESS64 addr;
};
static BOOL CALLBACK line_cb(SRCCODEINFO* sci, void* user)
......@@ -336,6 +336,7 @@ void break_check_delayed_bp(void)
struct dbg_lvalue lvalue;
int i;
struct dbg_delayed_bp* dbp = dbg_curr_process->delayed_bp;
char hexbuf[MAX_OFFSET_TO_STR_LEN];
for (i = 0; i < dbg_curr_process->num_delayed_bp; i++)
{
......@@ -350,8 +351,9 @@ void break_check_delayed_bp(void)
lvalue.addr = dbp[i].u.addr;
WINE_TRACE("trying to add delayed %s-bp\n", dbp[i].is_symbol ? "S" : "A");
if (!dbp[i].is_symbol)
WINE_TRACE("\t%04x:%08lx\n",
dbp[i].u.addr.Segment, dbp[i].u.addr.Offset);
WINE_TRACE("\t%04x:%s\n",
dbp[i].u.addr.Segment,
memory_offset_to_string(hexbuf, dbp[i].u.addr.Offset, 0));
else
WINE_TRACE("\t'%s' @ %d\n",
dbp[i].u.symbol.name, dbp[i].u.symbol.lineno);
......@@ -721,7 +723,7 @@ static BOOL should_stop(int bpnum)
* Determine if we should continue execution after a SIGTRAP signal when
* executing in the given mode.
*/
BOOL break_should_continue(ADDRESS* addr, DWORD code, int* count, BOOL* is_break)
BOOL break_should_continue(ADDRESS64* addr, DWORD code, int* count, BOOL* is_break)
{
DWORD oldval = 0;
enum dbg_exec_mode mode = dbg_curr_thread->exec_mode;
......@@ -836,10 +838,10 @@ void break_suspend_execution(void)
*/
void break_restart_execution(int count)
{
ADDRESS addr;
ADDRESS64 addr;
enum dbg_line_status status;
enum dbg_exec_mode mode, ret_mode;
ADDRESS callee;
ADDRESS64 callee;
void* linear;
memory_get_current_pc(&addr);
......
......@@ -1063,7 +1063,7 @@ static const int db_lengths[] = {
10, /* EXTR */
};
static unsigned int db_get_task_value( const ADDRESS* addr,
static unsigned int db_get_task_value( const ADDRESS64* addr,
int size, int is_signed )
{
unsigned int result = 0;
......@@ -1104,7 +1104,7 @@ static unsigned int db_get_task_value( const ADDRESS* addr,
/*
* Read address at location and return updated location.
*/
static void db_read_address( ADDRESS* addr, int short_addr, int regmodrm,
static void db_read_address( ADDRESS64* addr, int short_addr, int regmodrm,
struct i_addr *addrp )
{
int mod, rm, sib, index, disp;
......@@ -1186,7 +1186,7 @@ static void db_read_address( ADDRESS* addr, int short_addr, int regmodrm,
static void db_task_printsym(unsigned int addr, int size)
{
ADDRESS a;
ADDRESS64 a;
a.Mode = AddrModeFlat;
a.Offset = addr;
......@@ -1238,7 +1238,7 @@ static void db_print_address(const char *seg, int size, struct i_addr *addrp, in
* Disassemble floating-point ("escape") instruction
* and return updated location.
*/
static void db_disasm_esc( ADDRESS* addr, int inst, int short_addr,
static void db_disasm_esc( ADDRESS64* addr, int inst, int short_addr,
int size, const char *seg )
{
int regmodrm;
......@@ -1311,7 +1311,7 @@ static void db_disasm_esc( ADDRESS* addr, int inst, int short_addr,
* Disassemble instruction at 'addr'. addr is changed to point to the
* start of the next instruction.
*/
void be_i386_disasm_one_insn(ADDRESS *addr, int display)
void be_i386_disasm_one_insn(ADDRESS64 *addr, int display)
{
int inst;
int size;
......@@ -1791,7 +1791,7 @@ void be_i386_disasm_one_insn(ADDRESS *addr, int display)
case OS:
{
ADDRESS address;
ADDRESS64 address;
get_value_inc( address.Offset, addr, /* offset */
short_addr ? 2 : 4, FALSE );
get_value_inc( address.Segment, addr, /* segment */
......
......@@ -105,7 +105,7 @@ struct dbg_lvalue /* structure to hold left-values... */
*/
# define DLV_TARGET 0xF00D
# define DLV_HOST 0x50DA
ADDRESS addr;
ADDRESS64 addr;
struct dbg_type type;
};
......@@ -127,7 +127,7 @@ enum dbg_exec_mode
struct dbg_breakpoint
{
ADDRESS addr;
ADDRESS64 addr;
unsigned long enabled : 1,
xpoint_type : 2,
refcount : 13,
......@@ -174,8 +174,8 @@ struct dbg_thread
EXCEPTION_RECORD excpt_record; /* only valid when in_exception is TRUE */
struct
{
ADDRESS addr_pc;
ADDRESS addr_frame;
ADDRESS64 addr_pc;
ADDRESS64 addr_frame;
}* frames;
int num_frames;
int curr_frame;
......@@ -192,7 +192,7 @@ struct dbg_delayed_bp
int lineno;
char* name;
} symbol;
ADDRESS addr;
ADDRESS64 addr;
} u;
};
......@@ -263,7 +263,7 @@ enum dbg_start {start_ok, start_error_parse, start_error_init};
/* break.c */
extern void break_set_xpoints(BOOL set);
extern BOOL break_add_break(const ADDRESS* addr, BOOL verbose, BOOL swbp);
extern BOOL break_add_break(const ADDRESS64* addr, BOOL verbose, BOOL swbp);
extern BOOL break_add_break_from_lvalue(const struct dbg_lvalue* value, BOOL swbp);
extern void break_add_break_from_id(const char* name, int lineno, BOOL swbp);
extern void break_add_break_from_lineno(int lineno, BOOL swbp);
......@@ -274,7 +274,7 @@ extern void break_delete_xpoint(int num);
extern void break_delete_xpoints_from_module(unsigned long base);
extern void break_enable_xpoint(int num, BOOL enable);
extern void break_info(void);
extern BOOL break_should_continue(ADDRESS* addr, DWORD code, int* count, BOOL* is_break);
extern BOOL break_should_continue(ADDRESS64* addr, DWORD code, int* count, BOOL* is_break);
extern void break_suspend_execution(void);
extern void break_restart_execution(int count);
extern int break_add_condition(int bpnum, struct expr* exp);
......@@ -333,22 +333,24 @@ extern void info_wine_dbg_channel(BOOL add, const char* chnl, const
extern BOOL memory_read_value(const struct dbg_lvalue* lvalue, DWORD size, void* result);
extern BOOL memory_write_value(const struct dbg_lvalue* val, DWORD size, void* value);
extern void memory_examine(const struct dbg_lvalue *lvalue, int count, char format);
extern void* memory_to_linear_addr(const ADDRESS* address);
extern BOOL memory_get_current_pc(ADDRESS* address);
extern BOOL memory_get_current_stack(ADDRESS* address);
extern BOOL memory_get_current_frame(ADDRESS* address);
extern void* memory_to_linear_addr(const ADDRESS64* address);
extern BOOL memory_get_current_pc(ADDRESS64* address);
extern BOOL memory_get_current_stack(ADDRESS64* address);
extern BOOL memory_get_current_frame(ADDRESS64* address);
extern BOOL memory_get_string(struct dbg_process* pcs, void* addr, BOOL in_debuggee, BOOL unicode, char* buffer, int size);
extern BOOL memory_get_string_indirect(struct dbg_process* pcs, void* addr, BOOL unicode, char* buffer, int size);
extern BOOL memory_get_register(DWORD regno, DWORD** value, char* buffer, int len);
extern void memory_disassemble(const struct dbg_lvalue*, const struct dbg_lvalue*, int instruction_count);
extern BOOL memory_disasm_one_insn(ADDRESS* addr);
extern void print_bare_address(const ADDRESS* addr);
extern void print_address(const ADDRESS* addr, BOOLEAN with_line);
extern BOOL memory_disasm_one_insn(ADDRESS64* addr);
#define MAX_OFFSET_TO_STR_LEN 19
extern char* memory_offset_to_string(char *str, DWORD64 offset, unsigned mode);
extern void print_bare_address(const ADDRESS64* addr);
extern void print_address(const ADDRESS64* addr, BOOLEAN with_line);
extern void print_basic(const struct dbg_lvalue* value, int count, char format);
/* source.c */
extern void source_list(IMAGEHLP_LINE* src1, IMAGEHLP_LINE* src2, int delta);
extern void source_list_from_addr(const ADDRESS* addr, int nlines);
extern void source_list_from_addr(const ADDRESS64* addr, int nlines);
extern void source_show_path(void);
extern void source_add_path(const char* path);
extern void source_nuke_path(void);
......@@ -364,7 +366,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 enum dbg_line_status symbol_get_function_line_status(const ADDRESS* addr);
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_LINE* ret);
extern void symbol_info(const char* str);
extern int symbol_info_locals(void);
......@@ -387,7 +389,7 @@ extern void print_value(const struct dbg_lvalue* addr, char format,
extern int types_print_type(const struct dbg_type*, BOOL details);
extern int print_types(void);
extern long int types_extract_as_integer(const struct dbg_lvalue*);
extern void types_extract_as_address(const struct dbg_lvalue*, ADDRESS*);
extern void types_extract_as_address(const struct dbg_lvalue*, ADDRESS64*);
extern BOOL types_deref(const struct dbg_lvalue* value, struct dbg_lvalue* result);
extern BOOL types_udt_find_element(struct dbg_lvalue* value, const char* name, long int* tmpbuf);
extern BOOL types_array_index(const struct dbg_lvalue* value, int index, struct dbg_lvalue* result);
......
......@@ -32,13 +32,13 @@
WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
void* be_cpu_linearize(HANDLE hThread, const ADDRESS* addr)
void* be_cpu_linearize(HANDLE hThread, const ADDRESS64* addr)
{
assert(addr->Mode == AddrModeFlat);
return (void*)addr->Offset;
return (void*)(DWORD_PTR)addr->Offset;
}
unsigned be_cpu_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS* addr,
unsigned be_cpu_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* addr,
unsigned seg, unsigned long offset)
{
addr->Mode = AddrModeFlat;
......@@ -47,26 +47,26 @@ unsigned be_cpu_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS* addr,
return TRUE;
}
void* memory_to_linear_addr(const ADDRESS* addr)
void* memory_to_linear_addr(const ADDRESS64* addr)
{
return be_cpu->linearize(dbg_curr_thread->handle, addr);
}
BOOL memory_get_current_pc(ADDRESS* addr)
BOOL memory_get_current_pc(ADDRESS64* addr)
{
assert(be_cpu->get_addr);
return be_cpu->get_addr(dbg_curr_thread->handle, &dbg_context,
be_cpu_addr_pc, addr);
}
BOOL memory_get_current_stack(ADDRESS* addr)
BOOL memory_get_current_stack(ADDRESS64* addr)
{
assert(be_cpu->get_addr);
return be_cpu->get_addr(dbg_curr_thread->handle, &dbg_context,
be_cpu_addr_stack, addr);
}
BOOL memory_get_current_frame(ADDRESS* addr)
BOOL memory_get_current_frame(ADDRESS64* addr)
{
assert(be_cpu->get_addr);
return be_cpu->get_addr(dbg_curr_thread->handle, &dbg_context,
......@@ -75,7 +75,7 @@ BOOL memory_get_current_frame(ADDRESS* addr)
static void memory_report_invalid_addr(const void* addr)
{
ADDRESS address;
ADDRESS64 address;
address.Mode = AddrModeFlat;
address.Segment = 0;
......@@ -104,7 +104,7 @@ BOOL memory_read_value(const struct dbg_lvalue* lvalue, DWORD size, void* result
{
if (lvalue->addr.Offset)
{
memcpy(result, (void*)lvalue->addr.Offset, size);
memcpy(result, (void*)(DWORD_PTR)lvalue->addr.Offset, size);
ret = TRUE;
}
}
......@@ -134,7 +134,7 @@ BOOL memory_write_value(const struct dbg_lvalue* lvalue, DWORD size, void* value
}
else
{
memcpy((void*)lvalue->addr.Offset, value, size);
memcpy((void*)(DWORD_PTR)lvalue->addr.Offset, value, size);
}
return ret;
}
......@@ -148,7 +148,7 @@ void memory_examine(const struct dbg_lvalue *lvalue, int count, char format)
{
int i;
char buffer[256];
ADDRESS addr;
ADDRESS64 addr;
void *linear;
types_extract_as_address(lvalue, &addr);
......@@ -273,6 +273,32 @@ BOOL memory_get_string_indirect(struct dbg_process* pcs, void* addr, BOOL unicod
return FALSE;
}
/*
* Convert an address offset to hex string. If mode == 32, treat offset as
* 32 bits (discard upper 32 bits), if mode == 64 use all 64 bits, if mode == 0
* treat as either 32 or 64 bits, depending on whether we're running as
* Wine32 or Wine64.
*/
char* memory_offset_to_string(char *str, DWORD64 offset, unsigned mode)
{
if (mode != 32 && mode != 64)
{
#ifdef _WIN64
mode = 64;
#else
mode = 32;
#endif
}
if (mode == 32)
sprintf(str, "0x%08x", (unsigned int) offset);
else
sprintf(str, "0x%08x%08x", (unsigned int)(offset >> 32),
(unsigned int)offset);
return str;
}
static void print_typed_basic(const struct dbg_lvalue* lvalue)
{
LONGLONG val_int;
......@@ -478,19 +504,22 @@ void print_basic(const struct dbg_lvalue* lvalue, int count, char format)
}
}
void print_bare_address(const ADDRESS* addr)
void print_bare_address(const ADDRESS64* addr)
{
char hexbuf[MAX_OFFSET_TO_STR_LEN];
switch (addr->Mode)
{
case AddrModeFlat:
dbg_printf("0x%08lx", addr->Offset);
dbg_printf("%s", memory_offset_to_string(hexbuf, addr->Offset, 0));
break;
case AddrModeReal:
case AddrMode1616:
dbg_printf("0x%04x:0x%04lx", addr->Segment, addr->Offset);
dbg_printf("0x%04x:0x%04x", addr->Segment, (unsigned) addr->Offset);
break;
case AddrMode1632:
dbg_printf("0x%04x:0x%08lx", addr->Segment, addr->Offset);
dbg_printf("0x%04x:%s", addr->Segment,
memory_offset_to_string(hexbuf, addr->Offset, 32));
break;
default:
dbg_printf("Unknown mode %x\n", addr->Mode);
......@@ -503,7 +532,7 @@ void print_bare_address(const ADDRESS* addr)
*
* Print an 16- or 32-bit address, with the nearest symbol if any.
*/
void print_address(const ADDRESS* addr, BOOLEAN with_line)
void print_address(const ADDRESS64* addr, BOOLEAN with_line)
{
char buffer[sizeof(SYMBOL_INFO) + 256];
SYMBOL_INFO* si = (SYMBOL_INFO*)buffer;
......@@ -532,7 +561,7 @@ void print_address(const ADDRESS* addr, BOOLEAN with_line)
}
}
BOOL memory_disasm_one_insn(ADDRESS* addr)
BOOL memory_disasm_one_insn(ADDRESS64* addr)
{
char ch;
......@@ -551,7 +580,7 @@ BOOL memory_disasm_one_insn(ADDRESS* addr)
void memory_disassemble(const struct dbg_lvalue* xstart,
const struct dbg_lvalue* xend, int instruction_count)
{
static ADDRESS last = {0,0,0};
static ADDRESS64 last = {0,0,0};
int stop = 0;
int i;
......
......@@ -355,10 +355,10 @@ void source_list(IMAGEHLP_LINE* src1, IMAGEHLP_LINE* src2, int delta)
source_end_line = end;
}
void source_list_from_addr(const ADDRESS* addr, int nlines)
void source_list_from_addr(const ADDRESS64* addr, int nlines)
{
IMAGEHLP_LINE il;
ADDRESS la;
ADDRESS64 la;
DWORD disp;
if (!addr)
......
......@@ -101,7 +101,7 @@ BOOL stack_get_current_frame(IMAGEHLP_STACK_FRAME* ihsf)
BOOL stack_set_frame(int newframe)
{
ADDRESS addr;
ADDRESS64 addr;
if (!stack_set_frame_internal(newframe)) return FALSE;
addr.Mode = AddrModeFlat;
addr.Offset = (unsigned long)memory_to_linear_addr(&dbg_curr_thread->frames[dbg_curr_thread->curr_frame].addr_pc);
......@@ -124,7 +124,7 @@ BOOL stack_get_current_symbol(SYMBOL_INFO* symbol)
&disp, symbol);
}
static BOOL CALLBACK stack_read_mem(HANDLE hProc, DWORD addr,
static BOOL CALLBACK stack_read_mem(HANDLE hProc, DWORD64 addr,
PVOID buffer, DWORD size, PDWORD written)
{
SIZE_T sz;
......@@ -132,7 +132,8 @@ static BOOL CALLBACK stack_read_mem(HANDLE hProc, DWORD addr,
struct dbg_process* pcs = dbg_get_process_h(hProc);
if (!pcs) return FALSE;
ret = pcs->process_io->read(hProc, (const void*)addr, buffer, size, &sz);
ret = pcs->process_io->read(hProc, (const void*)(DWORD_PTR)addr, buffer,
size, &sz);
if (written != NULL) *written = sz;
return ret;
}
......@@ -144,8 +145,8 @@ static BOOL CALLBACK stack_read_mem(HANDLE hProc, DWORD addr,
*/
unsigned stack_fetch_frames(void)
{
STACKFRAME sf;
unsigned nf = 0;
STACKFRAME64 sf;
unsigned nf = 0;
HeapFree(GetProcessHeap(), 0, dbg_curr_thread->frames);
dbg_curr_thread->frames = NULL;
......@@ -161,9 +162,9 @@ unsigned stack_fetch_frames(void)
sf.AddrFrame.Mode = AddrModeFlat;
}
while (StackWalk(IMAGE_FILE_MACHINE_I386, dbg_curr_process->handle,
dbg_curr_thread->handle, &sf, &dbg_context, stack_read_mem,
SymFunctionTableAccess, SymGetModuleBase, NULL))
while (StackWalk64(IMAGE_FILE_MACHINE_I386, dbg_curr_process->handle,
dbg_curr_thread->handle, &sf, &dbg_context, stack_read_mem,
SymFunctionTableAccess64, SymGetModuleBase64, NULL))
{
dbg_curr_thread->frames = dbg_heap_realloc(dbg_curr_thread->frames,
(nf + 1) * sizeof(dbg_curr_thread->frames[0]));
......
......@@ -419,7 +419,7 @@ void symbol_read_symtable(const char* filename, unsigned long offset)
*
* Find the symbol nearest to a given address.
*/
enum dbg_line_status symbol_get_function_line_status(const ADDRESS* addr)
enum dbg_line_status symbol_get_function_line_status(const ADDRESS64* addr)
{
IMAGEHLP_LINE il;
DWORD disp;
......@@ -573,7 +573,7 @@ static BOOL CALLBACK info_locals_cb(SYMBOL_INFO* sym, ULONG size, void* ctx)
int symbol_info_locals(void)
{
IMAGEHLP_STACK_FRAME ihsf;
ADDRESS addr;
ADDRESS64 addr;
stack_get_current_frame(&ihsf);
addr.Mode = AddrModeFlat;
......
......@@ -47,7 +47,7 @@ static void dbg_init_current_thread(void* start)
!dbg_curr_process->threads->next && /* first thread ? */
DBG_IVAR(BreakAllThreadsStartup))
{
ADDRESS addr;
ADDRESS64 addr;
break_set_xpoints(FALSE);
addr.Mode = AddrModeFlat;
......@@ -118,8 +118,9 @@ static unsigned dbg_fetch_context(void)
static unsigned dbg_exception_prolog(BOOL is_debug, const EXCEPTION_RECORD* rec)
{
ADDRESS addr;
ADDRESS64 addr;
BOOL is_break;
char hexbuf[MAX_OFFSET_TO_STR_LEN];
memory_get_current_pc(&addr);
break_suspend_execution();
......@@ -130,10 +131,19 @@ static unsigned dbg_exception_prolog(BOOL is_debug, const EXCEPTION_RECORD* rec)
{
switch (addr.Mode)
{
case AddrModeFlat: dbg_printf(" in 32-bit code (0x%08lx)", addr.Offset); break;
case AddrModeReal: dbg_printf(" in vm86 code (%04x:%04lx)", addr.Segment, addr.Offset); break;
case AddrMode1616: dbg_printf(" in 16-bit code (%04x:%04lx)", addr.Segment, addr.Offset); break;
case AddrMode1632: dbg_printf(" in 32-bit code (%04x:%08lx)", addr.Segment, addr.Offset); break;
case AddrModeFlat:
dbg_printf(" in 32-bit code (%s)",
memory_offset_to_string(hexbuf, addr.Offset, 0));
break;
case AddrModeReal:
dbg_printf(" in vm86 code (%04x:%04x)", addr.Segment, (unsigned) addr.Offset);
break;
case AddrMode1616:
dbg_printf(" in 16-bit code (%04x:%04x)", addr.Segment, (unsigned) addr.Offset);
break;
case AddrMode1632:
dbg_printf(" in 32-bit code (%04x:%08lx)", addr.Segment, (unsigned long) addr.Offset);
break;
default: dbg_printf(" bad address");
}
dbg_printf(".\n");
......@@ -209,7 +219,7 @@ static unsigned dbg_exception_prolog(BOOL is_debug, const EXCEPTION_RECORD* rec)
dbg_curr_thread->exec_mode == dbg_exec_step_over_insn ||
dbg_curr_thread->exec_mode == dbg_exec_step_into_insn)
{
ADDRESS tmp = addr;
ADDRESS64 tmp = addr;
/* Show where we crashed */
memory_disasm_one_insn(&tmp);
}
......@@ -312,7 +322,7 @@ static DWORD dbg_handle_exception(const EXCEPTION_RECORD* rec, BOOL first_chance
break;
case STATUS_POSSIBLE_DEADLOCK:
{
ADDRESS addr;
ADDRESS64 addr;
addr.Mode = AddrModeFlat;
addr.Offset = rec->ExceptionInformation[0];
......@@ -605,12 +615,14 @@ static void dbg_resume_debuggee(DWORD cont)
{
if (dbg_curr_thread->in_exception)
{
ADDRESS addr;
ADDRESS64 addr;
char hexbuf[MAX_OFFSET_TO_STR_LEN];
dbg_exception_epilog();
memory_get_current_pc(&addr);
WINE_TRACE("Exiting debugger PC=0x%lx mode=%d count=%d\n",
addr.Offset, dbg_curr_thread->exec_mode,
WINE_TRACE("Exiting debugger PC=%s mode=%d count=%d\n",
memory_offset_to_string(hexbuf, addr.Offset, 0),
dbg_curr_thread->exec_mode,
dbg_curr_thread->exec_count);
if (dbg_curr_thread)
{
......@@ -626,7 +638,8 @@ static void dbg_resume_debuggee(DWORD cont)
void dbg_wait_next_exception(DWORD cont, int count, int mode)
{
DEBUG_EVENT de;
ADDRESS addr;
ADDRESS64 addr;
char hexbuf[MAX_OFFSET_TO_STR_LEN];
if (cont == DBG_CONTINUE)
{
......@@ -643,8 +656,9 @@ void dbg_wait_next_exception(DWORD cont, int count, int mode)
dbg_interactiveP = TRUE;
memory_get_current_pc(&addr);
WINE_TRACE("Entering debugger PC=0x%lx mode=%d count=%d\n",
addr.Offset, dbg_curr_thread->exec_mode,
WINE_TRACE("Entering debugger PC=%s mode=%d count=%d\n",
memory_offset_to_string(hexbuf, addr.Offset, 0),
dbg_curr_thread->exec_mode,
dbg_curr_thread->exec_count);
}
......
......@@ -332,7 +332,7 @@ static enum dbg_start minidump_do_reload(struct tgt_process_minidump_data* data)
if ((dbg_curr_thread = dbg_get_thread(dbg_curr_process, mes->ThreadId)))
{
ADDRESS addr;
ADDRESS64 addr;
dbg_curr_tid = mes->ThreadId;
dbg_curr_thread->in_exception = TRUE;
......
......@@ -132,7 +132,7 @@ long int types_extract_as_integer(const struct dbg_lvalue* lvalue)
*
*
*/
void types_extract_as_address(const struct dbg_lvalue* lvalue, ADDRESS* addr)
void types_extract_as_address(const struct dbg_lvalue* lvalue, ADDRESS64* addr)
{
if (lvalue->type.id == dbg_itype_segptr && lvalue->type.module == 0)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment