Commit bce64150 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winedbg: Added a way to support differently selector information depending on current target.

parent bd007a15
...@@ -40,7 +40,7 @@ static ADDRESS_MODE get_selector_type(HANDLE hThread, const CONTEXT* ctx, WORD s ...@@ -40,7 +40,7 @@ static ADDRESS_MODE get_selector_type(HANDLE hThread, const CONTEXT* ctx, WORD s
if (IS_VM86_MODE(ctx)) return AddrModeReal; if (IS_VM86_MODE(ctx)) return AddrModeReal;
/* null or system selector */ /* null or system selector */
if (!(sel & 4) || ((sel >> 3) < 17)) return AddrModeFlat; 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; return le.HighWord.Bits.Default_Big ? AddrMode1632 : AddrMode1616;
/* selector doesn't exist */ /* selector doesn't exist */
return -1; return -1;
...@@ -59,7 +59,7 @@ static void* be_i386_linearize(HANDLE hThread, const ADDRESS64* addr) ...@@ -59,7 +59,7 @@ static void* be_i386_linearize(HANDLE hThread, const ADDRESS64* addr)
return (void*)(DWORD)addr->Offset; return (void*)(DWORD)addr->Offset;
/* fall through */ /* fall through */
case AddrMode1616: 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) + return (void*)((le.HighWord.Bits.BaseHi << 24) +
(le.HighWord.Bits.BaseMid << 16) + le.BaseLow + (le.HighWord.Bits.BaseMid << 16) + le.BaseLow +
(DWORD)addr->Offset); (DWORD)addr->Offset);
......
...@@ -234,6 +234,7 @@ struct be_process_io ...@@ -234,6 +234,7 @@ struct be_process_io
BOOL (*close_process)(struct dbg_process*, BOOL); BOOL (*close_process)(struct dbg_process*, BOOL);
BOOL (WINAPI *read)(HANDLE, const void*, void*, SIZE_T, SIZE_T*); BOOL (WINAPI *read)(HANDLE, const void*, void*, SIZE_T, SIZE_T*);
BOOL (WINAPI *write)(HANDLE, void*, const 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; extern struct dbg_process* dbg_curr_process;
......
...@@ -584,7 +584,7 @@ void info_win32_segments(DWORD start, int length) ...@@ -584,7 +584,7 @@ void info_win32_segments(DWORD start, int length)
for (i = start; i < start + length; i++) 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; continue;
if (le.HighWord.Bits.Type & 0x08) if (le.HighWord.Bits.Type & 0x08)
......
...@@ -984,4 +984,5 @@ static struct be_process_io be_process_active_io = ...@@ -984,4 +984,5 @@ static struct be_process_io be_process_active_io =
tgt_process_active_close_process, tgt_process_active_close_process,
ReadProcessMemory, ReadProcessMemory,
WriteProcessMemory, WriteProcessMemory,
GetThreadSelectorEntry,
}; };
...@@ -452,9 +452,18 @@ static BOOL tgt_process_minidump_close_process(struct dbg_process* pcs, BOOL kil ...@@ -452,9 +452,18 @@ static BOOL tgt_process_minidump_close_process(struct dbg_process* pcs, BOOL kil
return TRUE; 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 = static struct be_process_io be_process_minidump_io =
{ {
tgt_process_minidump_close_process, tgt_process_minidump_close_process,
tgt_process_minidump_read, tgt_process_minidump_read,
tgt_process_minidump_write, 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) ...@@ -90,9 +90,15 @@ static BOOL tgt_process_module_close_process(struct dbg_process* pcs, BOOL kill)
return TRUE; 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 = static struct be_process_io be_process_module_io =
{ {
tgt_process_module_close_process, tgt_process_module_close_process,
tgt_process_module_read, tgt_process_module_read,
tgt_process_module_write, tgt_process_module_write,
tgt_process_module_get_selector,
}; };
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