Commit 44ab1206 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winedbg: Correctly read LDT entries for wow64 debuggee.

This mostly matters for Mac as segment CS is handled as a real LDT entry. Signed-off-by: 's avatarEric Pouech <epouech@codeweavers.com>
parent 91ba80df
......@@ -40,7 +40,12 @@ static ADDRESS_MODE get_selector_type(HANDLE hThread, const WOW64_CONTEXT *ctx,
/* null or system selector */
if (!(sel & 4) || ((sel >> 3) < first_ldt_entry)) return AddrModeFlat;
if (dbg_curr_process->process_io->get_selector(hThread, sel, &le))
return le.HighWord.Bits.Default_Big ? AddrMode1632 : AddrMode1616;
{
ULONG base = (le.HighWord.Bits.BaseHi << 24) + (le.HighWord.Bits.BaseMid << 16) + le.BaseLow;
if (le.HighWord.Bits.Default_Big)
return base == 0 ? AddrModeFlat : AddrMode1632;
return AddrMode1616;
}
/* selector doesn't exist */
return -1;
}
......
......@@ -1067,7 +1067,17 @@ static BOOL tgt_process_active_write(HANDLE hProcess, void* addr,
static BOOL tgt_process_active_get_selector(HANDLE hThread, DWORD sel, LDT_ENTRY* le)
{
#ifdef _WIN64
THREAD_DESCRIPTOR_INFORMATION desc = { .Selector = sel };
ULONG retlen;
if (RtlWow64GetThreadSelectorEntry( hThread, &desc, sizeof(desc), &retlen ))
return FALSE;
*le = desc.Entry;
return TRUE;
#else
return GetThreadSelectorEntry( hThread, sel, le );
#endif
}
static struct be_process_io be_process_active_io =
......
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