From 30c112e665974704372f580ecdc29b4bbefc29fb Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sat, 14 Nov 1998 17:06:55 +0000 Subject: [PATCH] Speed up relay32, snoop16 and snoop32 include/excludes by doing them just once at creation time. --- if1632/snoop.c | 13 +++++-------- include/snoop.h | 1 + relay32/builtin32.c | 13 +++++++++++++ relay32/snoop.c | 7 ++----- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/if1632/snoop.c b/if1632/snoop.c index bec67530663..bb93b29daf0 100644 --- a/if1632/snoop.c +++ b/if1632/snoop.c @@ -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); diff --git a/include/snoop.h b/include/snoop.h index 72466f6e12e..e4714c47291 100644 --- a/include/snoop.h +++ b/include/snoop.h @@ -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 diff --git a/relay32/builtin32.c b/relay32/builtin32.c index 270548536da..e01bd584544 100644 --- a/relay32/builtin32.c +++ b/relay32/builtin32.c @@ -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;jdescr->nb_names;j++) + if (dll->descr->ordinals[j] == i) + break; + if (jdescr->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 */ diff --git a/relay32/snoop.c b/relay32/snoop.c index 8db202fbd19..aac32c8e48a 100644 --- a/relay32/snoop.c +++ b/relay32/snoop.c @@ -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(ordinalnrofordinals); 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: