mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 12:27:09 +00:00
winedbg: Cache wow64 status inside struct process.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
parent
79161ea00a
commit
bde065746e
|
@ -280,6 +280,7 @@ struct dbg_process
|
|||
struct backend_cpu* be_cpu;
|
||||
HANDLE event_on_first_exception;
|
||||
BOOL active_debuggee;
|
||||
BOOL is_wow64;
|
||||
struct dbg_breakpoint bp[MAX_BREAKPOINTS];
|
||||
unsigned next_bp;
|
||||
struct dbg_delayed_bp* delayed_bp;
|
||||
|
|
|
@ -1685,7 +1685,6 @@ static BOOL CALLBACK packet_query_libraries_cb(PCSTR mod_name, DWORD64 base, PVO
|
|||
IMAGE_NT_HEADERS *nth = NULL;
|
||||
IMAGEHLP_MODULE64 mod;
|
||||
SIZE_T size, i;
|
||||
BOOL is_wow64;
|
||||
char buffer[0x400];
|
||||
|
||||
mod.SizeOfStruct = sizeof(mod);
|
||||
|
@ -1709,8 +1708,7 @@ static BOOL CALLBACK packet_query_libraries_cb(PCSTR mod_name, DWORD64 base, PVO
|
|||
|
||||
if ((unix_path = wine_get_unix_file_name(nt_name.Buffer)))
|
||||
{
|
||||
if (IsWow64Process(gdbctx->process->handle, &is_wow64) &&
|
||||
is_wow64 && (tmp = strstr(unix_path, "system32")))
|
||||
if (gdbctx->process->is_wow64 && (tmp = strstr(unix_path, "system32")))
|
||||
memcpy(tmp, "syswow64", 8);
|
||||
reply_buffer_append_xmlstr(reply, unix_path);
|
||||
}
|
||||
|
@ -1743,7 +1741,7 @@ static BOOL CALLBACK packet_query_libraries_cb(PCSTR mod_name, DWORD64 base, PVO
|
|||
* the following computation valid in all cases. */
|
||||
dos = (IMAGE_DOS_HEADER *)buffer;
|
||||
nth = (IMAGE_NT_HEADERS *)(buffer + dos->e_lfanew);
|
||||
if (IsWow64Process(gdbctx->process->handle, &is_wow64) && is_wow64)
|
||||
if (gdbctx->process->is_wow64)
|
||||
sec = IMAGE_FIRST_SECTION((IMAGE_NT_HEADERS32 *)nth);
|
||||
else
|
||||
sec = IMAGE_FIRST_SECTION((IMAGE_NT_HEADERS64 *)nth);
|
||||
|
@ -1967,7 +1965,6 @@ static enum packet_return packet_query_exec_file(struct gdb_context* gdbctx)
|
|||
struct reply_buffer* reply = &gdbctx->qxfer_buffer;
|
||||
struct dbg_process* process = gdbctx->process;
|
||||
char *unix_path;
|
||||
BOOL is_wow64;
|
||||
char *tmp;
|
||||
|
||||
if (!process) return packet_error;
|
||||
|
@ -1978,8 +1975,7 @@ static enum packet_return packet_query_exec_file(struct gdb_context* gdbctx)
|
|||
if (!(unix_path = wine_get_unix_file_name(process->imageName)))
|
||||
return packet_reply_error(gdbctx, GetLastError() == ERROR_NOT_ENOUGH_MEMORY ? HOST_ENOMEM : HOST_ENOENT);
|
||||
|
||||
if (IsWow64Process(process->handle, &is_wow64) &&
|
||||
is_wow64 && (tmp = strstr(unix_path, "system32")))
|
||||
if (process->is_wow64 && (tmp = strstr(unix_path, "system32")))
|
||||
memcpy(tmp, "syswow64", 8);
|
||||
|
||||
reply_buffer_append_str(reply, unix_path);
|
||||
|
|
|
@ -869,15 +869,13 @@ static void output_system_info(void)
|
|||
|
||||
const char *(CDECL *wine_get_build_id)(void);
|
||||
void (CDECL *wine_get_host_version)( const char **sysname, const char **release );
|
||||
BOOL is_wow64;
|
||||
|
||||
wine_get_build_id = (void *)GetProcAddress(GetModuleHandleA("ntdll.dll"), "wine_get_build_id");
|
||||
wine_get_host_version = (void *)GetProcAddress(GetModuleHandleA("ntdll.dll"), "wine_get_host_version");
|
||||
if (!IsWow64Process( dbg_curr_process->handle, &is_wow64 )) is_wow64 = FALSE;
|
||||
|
||||
dbg_printf( "System information:\n" );
|
||||
if (wine_get_build_id) dbg_printf( " Wine build: %s\n", wine_get_build_id() );
|
||||
dbg_printf( " Platform: %s%s\n", platform, is_wow64 ? " (WOW64)" : "" );
|
||||
dbg_printf( " Platform: %s%s\n", platform, dbg_curr_process->is_wow64 ? " (WOW64)" : "" );
|
||||
dbg_printf( " Version: Windows %s\n", get_windows_version() );
|
||||
if (wine_get_host_version)
|
||||
{
|
||||
|
|
|
@ -266,6 +266,8 @@ struct dbg_process* dbg_add_process(const struct be_process_io* pio, DWORD pid,
|
|||
if (!h)
|
||||
h = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
|
||||
|
||||
if (!IsWow64Process(h, &wow64)) wow64 = FALSE;
|
||||
|
||||
if (!(p = malloc(sizeof(struct dbg_process)))) return NULL;
|
||||
p->handle = h;
|
||||
p->pid = pid;
|
||||
|
@ -276,6 +278,7 @@ struct dbg_process* dbg_add_process(const struct be_process_io* pio, DWORD pid,
|
|||
list_init(&p->modules);
|
||||
p->event_on_first_exception = NULL;
|
||||
p->active_debuggee = FALSE;
|
||||
p->is_wow64 = wow64;
|
||||
p->next_bp = 1; /* breakpoint 0 is reserved for step-over */
|
||||
memset(p->bp, 0, sizeof(p->bp));
|
||||
p->delayed_bp = NULL;
|
||||
|
@ -291,8 +294,6 @@ struct dbg_process* dbg_add_process(const struct be_process_io* pio, DWORD pid,
|
|||
|
||||
list_add_head(&dbg_process_list, &p->entry);
|
||||
|
||||
IsWow64Process(h, &wow64);
|
||||
|
||||
#ifdef __i386__
|
||||
p->be_cpu = &be_i386;
|
||||
#elif defined(__x86_64__)
|
||||
|
|
Loading…
Reference in a new issue