winedbg: Added a way to support differently selector information depending on current target.
This commit is contained in:
parent
bd007a1576
commit
bce64150eb
|
@ -40,7 +40,7 @@ static ADDRESS_MODE get_selector_type(HANDLE hThread, const CONTEXT* ctx, WORD s
|
|||
if (IS_VM86_MODE(ctx)) return AddrModeReal;
|
||||
/* null or system selector */
|
||||
if (!(sel & 4) || ((sel >> 3) < 17)) return AddrModeFlat;
|
||||
if (GetThreadSelectorEntry(hThread, sel, &le))
|
||||
if (dbg_curr_process->process_io->get_selector(hThread, sel, &le))
|
||||
return le.HighWord.Bits.Default_Big ? AddrMode1632 : AddrMode1616;
|
||||
/* selector doesn't exist */
|
||||
return -1;
|
||||
|
@ -59,7 +59,7 @@ static void* be_i386_linearize(HANDLE hThread, const ADDRESS64* addr)
|
|||
return (void*)(DWORD)addr->Offset;
|
||||
/* fall through */
|
||||
case AddrMode1616:
|
||||
if (!GetThreadSelectorEntry(hThread, addr->Segment, &le)) return NULL;
|
||||
if (!dbg_curr_process->process_io->get_selector(hThread, addr->Segment, &le)) return NULL;
|
||||
return (void*)((le.HighWord.Bits.BaseHi << 24) +
|
||||
(le.HighWord.Bits.BaseMid << 16) + le.BaseLow +
|
||||
(DWORD)addr->Offset);
|
||||
|
|
|
@ -234,6 +234,7 @@ struct be_process_io
|
|||
BOOL (*close_process)(struct dbg_process*, BOOL);
|
||||
BOOL (WINAPI *read)(HANDLE, const void*, void*, SIZE_T, SIZE_T*);
|
||||
BOOL (WINAPI *write)(HANDLE, void*, const void*, SIZE_T, SIZE_T*);
|
||||
BOOL (WINAPI *get_selector)(HANDLE, DWORD, LDT_ENTRY*);
|
||||
};
|
||||
|
||||
extern struct dbg_process* dbg_curr_process;
|
||||
|
|
|
@ -584,7 +584,7 @@ void info_win32_segments(DWORD start, int length)
|
|||
|
||||
for (i = start; i < start + length; i++)
|
||||
{
|
||||
if (!GetThreadSelectorEntry(dbg_curr_thread->handle, (i << 3) | 7, &le))
|
||||
if (!dbg_curr_process->process_io->get_selector(dbg_curr_thread->handle, (i << 3) | 7, &le))
|
||||
continue;
|
||||
|
||||
if (le.HighWord.Bits.Type & 0x08)
|
||||
|
|
|
@ -984,4 +984,5 @@ static struct be_process_io be_process_active_io =
|
|||
tgt_process_active_close_process,
|
||||
ReadProcessMemory,
|
||||
WriteProcessMemory,
|
||||
GetThreadSelectorEntry,
|
||||
};
|
||||
|
|
|
@ -452,9 +452,18 @@ static BOOL tgt_process_minidump_close_process(struct dbg_process* pcs, BOOL kil
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL WINAPI tgt_process_minidump_get_selector(HANDLE hThread, DWORD sel, LDT_ENTRY* le)
|
||||
{
|
||||
/* so far, pretend all selectors are valid, and mapped to a 32bit flat address space */
|
||||
memset(le, 0, sizeof(*le));
|
||||
le->HighWord.Bits.Default_Big = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static struct be_process_io be_process_minidump_io =
|
||||
{
|
||||
tgt_process_minidump_close_process,
|
||||
tgt_process_minidump_read,
|
||||
tgt_process_minidump_write,
|
||||
tgt_process_minidump_get_selector,
|
||||
};
|
||||
|
|
|
@ -90,9 +90,15 @@ static BOOL tgt_process_module_close_process(struct dbg_process* pcs, BOOL kill)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL WINAPI tgt_process_module_get_selector(HANDLE hThread, DWORD sel, LDT_ENTRY* le)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static struct be_process_io be_process_module_io =
|
||||
{
|
||||
tgt_process_module_close_process,
|
||||
tgt_process_module_read,
|
||||
tgt_process_module_write,
|
||||
tgt_process_module_get_selector,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue