Commit 30c112e6 authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

Speed up relay32, snoop16 and snoop32 include/excludes by doing them

just once at creation time.
parent 06b4eb32
......@@ -60,7 +60,6 @@ typedef struct tagSNOOP16_RETURNENTRY {
DWORD ordinal;
WORD origSP;
WORD *args; /* saved args across a stdcall */
BYTE show;
} SNOOP16_RETURNENTRY;
typedef struct tagSNOOP16_RETURNENTRIES {
......@@ -187,6 +186,9 @@ SNOOP16_GetProcAddress16(HMODULE16 hmod,DWORD ordinal,FARPROC16 origfun) {
fun->name = HEAP_strdupA(SystemHeap,0,name);
else
fun->name = HEAP_strdupA(SystemHeap,0,"");
if (!SNOOP_ShowDebugmsgSnoop(dll->name, ordinal, fun->name))
return origfun;
/* more magic. do not try to snoop thunk data entries (MMSYSTEM) */
if (strchr(fun->name,'_')) {
char *s=strchr(fun->name,'_');
......@@ -214,8 +216,6 @@ void WINAPI SNOOP16_Entry(CONTEXT *context) {
SNOOP16_RETURNENTRIES **rets = &firstrets;
SNOOP16_RETURNENTRY *ret;
int i,max;
/* from relay32/snoop.c */
extern int SNOOP_ShowDebugmsgSnoop(const char *dll,int ord,const char *fname);
while (dll) {
if (xcs == dll->funhandle) {
......@@ -257,8 +257,7 @@ void WINAPI SNOOP16_Entry(CONTEXT *context) {
IP_reg(context)= LOWORD(fun->origfun);
CS_reg(context)= HIWORD(fun->origfun);
ret->show = SNOOP_ShowDebugmsgSnoop(dll->name, ordinal, fun->name);
if(!ret->show) return;
DPRINTF("Call %s.%ld: %s(",dll->name,ordinal,fun->name);
if (fun->nrofargs>0) {
max = fun->nrofargs;
......@@ -288,9 +287,7 @@ void WINAPI SNOOP16_Return(CONTEXT *context) {
}
IP_reg(context) = LOWORD(ret->origreturn);
CS_reg(context) = HIWORD(ret->origreturn);
if(!ret->show) {
;
} else if (ret->args) {
if (ret->args) {
int i,max;
DPRINTF("Ret %s.%ld: %s(",ret->dll->name,ret->ordinal,ret->dll->funs[ret->ordinal].name);
......
......@@ -11,4 +11,5 @@ extern FARPROC32 SNOOP_GetProcAddress32(HMODULE32,LPCSTR,DWORD,FARPROC32);
extern void (*fnSNOOP16_RegisterDLL)(NE_MODULE*,LPCSTR);
extern FARPROC16 (*fnSNOOP16_GetProcAddress16)(HMODULE16,DWORD,FARPROC16);
extern void SNOOP16_Init();
extern int SNOOP_ShowDebugmsgSnoop(const char *dll,int ord,const char *fname);
#endif
......@@ -236,10 +236,23 @@ static HMODULE32 BUILTIN32_DoLoadModule( BUILTIN32_DLL *dll, PDB32 *pdb )
for (i = 0; i < dll->descr->nb_funcs; i++, funcs++, debug++)
{
BYTE args = dll->descr->args[i];
int j;
if (!dll->descr->functions[i]) continue;
*funcs = (LPVOID)((BYTE *)dll->descr->functions[i] - addr);
#ifdef __i386__
if (!TRACE_ON(relay)) continue;
for (j=0;j<dll->descr->nb_names;j++)
if (dll->descr->ordinals[j] == i)
break;
if (j<dll->descr->nb_names) {
if (dll->descr->names[j]) {
char buffer[200];
sprintf(buffer,"%s.%d: %s",dll->descr->name,i,dll->descr->names[j]);
if (!RELAY_ShowDebugmsgRelay(buffer))
continue;
}
}
switch(args)
{
case 0xfe: /* register func */
......
......@@ -197,6 +197,8 @@ SNOOP_GetProcAddress32(HMODULE32 hmod,LPCSTR name,DWORD ordinal,FARPROC32 origfu
}
if (!dll) /* probably internal */
return origfun;
if (!SNOOP_ShowDebugmsgSnoop(dll->name,ordinal,name))
return origfun;
assert(ordinal<dll->nrofordinals);
fun = dll->funs+ordinal;
if (!fun->name) fun->name = HEAP_strdupA(SystemHeap,0,name);
......@@ -285,11 +287,6 @@ REGS_ENTRYPOINT(SNOOP_Entry) {
FIXME(snoop,"entrypoint 0x%08lx not found\n",entry);
return; /* oops */
}
if (!SNOOP_ShowDebugmsgSnoop(dll->name, ordinal, fun->name)) {
/* we don't display, so we don't need returndisplay either */
EIP_reg(context)= (DWORD)fun->origfun;
return;
}
/* guess cdecl ... */
if (fun->nrofargs<0) {
/* Typical cdecl return frame is:
......
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