[PATCH] ntdll: Add the ticks debug channel
Detlef Riekenberg
wine.dev at web.de
Sun Nov 11 13:23:19 CST 2007
---
dlls/ntdll/debugtools.c | 5 ++++-
dlls/ntdll/loader.c | 8 ++++++++
dlls/ntdll/relay.c | 14 ++++++++++++++
dlls/ntdll/thread.c | 3 +++
4 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/dlls/ntdll/debugtools.c b/dlls/ntdll/debugtools.c
index cb08285..5a61af8 100644
--- a/dlls/ntdll/debugtools.c
+++ b/dlls/ntdll/debugtools.c
@@ -39,6 +39,7 @@ #include "winternl.h"
#include "ntdll_misc.h"
WINE_DECLARE_DEBUG_CHANNEL(tid);
+WINE_DECLARE_DEBUG_CHANNEL(ticks);
static struct __wine_debug_functions default_funcs;
@@ -164,8 +165,10 @@ static int NTDLL_dbg_vlog( enum __wine_d
/* only print header if we are at the beginning of the line */
if (info->out_pos == info->output || info->out_pos[-1] == '\n')
{
+ if (TRACE_ON(ticks))
+ ret = wine_dbg_printf( "(%05u)", NtGetTickCount() );
if (TRACE_ON(tid))
- ret = wine_dbg_printf( "%04x:", GetCurrentThreadId() );
+ ret += wine_dbg_printf( "%04x:", GetCurrentThreadId() );
if (cls < sizeof(classes)/sizeof(classes[0]))
ret += wine_dbg_printf( "%s:%s:%s ", classes[cls], channel->name, function );
}
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 8769b09..c61c113 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -47,6 +47,7 @@ WINE_DECLARE_DEBUG_CHANNEL(relay);
WINE_DECLARE_DEBUG_CHANNEL(snoop);
WINE_DECLARE_DEBUG_CHANNEL(loaddll);
WINE_DECLARE_DEBUG_CHANNEL(imports);
+WINE_DECLARE_DEBUG_CHANNEL(ticks);
/* we don't want to include winuser.h */
#define RT_MANIFEST ((ULONG_PTR)24)
@@ -875,6 +876,9 @@ static BOOL MODULE_InitDLL( WINE_MODREF
size_t len = min( wm->ldr.BaseDllName.Length, sizeof(mod_name)-sizeof(WCHAR) );
memcpy( mod_name, wm->ldr.BaseDllName.Buffer, len );
mod_name[len / sizeof(WCHAR)] = 0;
+
+ if (TRACE_ON(ticks)) DPRINTF( "(%05u)", NtGetTickCount() );
+
DPRINTF("%04x:Call PE DLL (proc=%p,module=%p %s,reason=%s,res=%p)\n",
GetCurrentThreadId(), entry, module, debugstr_w(mod_name),
reason_names[reason], lpReserved );
@@ -888,9 +892,13 @@ static BOOL MODULE_InitDLL( WINE_MODREF
to the dll. We cannot assume that this module has not been
deleted. */
if (TRACE_ON(relay))
+ {
+ if (TRACE_ON(ticks)) DPRINTF( "(%05u)", NtGetTickCount() );
+
DPRINTF("%04x:Ret PE DLL (proc=%p,module=%p %s,reason=%s,res=%p) retval=%x\n",
GetCurrentThreadId(), entry, module, debugstr_w(mod_name),
reason_names[reason], lpReserved, retv );
+ }
else TRACE("(%p,%s,%p) - RETURN %d\n", module, reason_names[reason], lpReserved, retv );
return retv;
diff --git a/dlls/ntdll/relay.c b/dlls/ntdll/relay.c
index a50ec34..018f80b 100644
--- a/dlls/ntdll/relay.c
+++ b/dlls/ntdll/relay.c
@@ -35,6 +35,7 @@ #include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(relay);
+WINE_DECLARE_DEBUG_CHANNEL(ticks);
#ifdef __i386__
@@ -380,6 +381,8 @@ static LONGLONG WINAPI relay_call_from_3
ret = call_entry_point( entry_point->orig_func, nb_args, stack + 1 );
else
{
+ if (TRACE_ON(ticks)) DPRINTF( "(%05u)", NtGetTickCount() );
+
if (entry_point->name)
DPRINTF( "%04x:Call %s.%s(", GetCurrentThreadId(), data->dllname, entry_point->name );
else
@@ -389,6 +392,8 @@ static LONGLONG WINAPI relay_call_from_3
ret = call_entry_point( entry_point->orig_func, nb_args, stack + 1 );
+ if (TRACE_ON(ticks)) DPRINTF( "(%05u)", NtGetTickCount() );
+
if (entry_point->name)
DPRINTF( "%04x:Ret %s.%s()", GetCurrentThreadId(), data->dllname, entry_point->name );
else
@@ -428,6 +433,8 @@ void WINAPI __regs_relay_call_from_32_re
if (TRACE_ON(relay))
{
+ if (TRACE_ON(ticks)) DPRINTF( "(%05u)", NtGetTickCount() );
+
if (entry_point->name)
DPRINTF( "%04x:Call %s.%s(", GetCurrentThreadId(), data->dllname, entry_point->name );
else
@@ -455,6 +462,8 @@ void WINAPI __regs_relay_call_from_32_re
if (TRACE_ON(relay))
{
+ if (TRACE_ON(ticks)) DPRINTF( "(%05u)", NtGetTickCount() );
+
if (entry_point->name)
DPRINTF( "%04x:Ret %s.%s() retval=%08x ret=%08x\n",
GetCurrentThreadId(), data->dllname, entry_point->name,
@@ -872,6 +881,8 @@ void WINAPI __regs_SNOOP_Entry( CONTEXT8
context->Eip = (DWORD)fun->origfun;
+ if (TRACE_ON(ticks)) DPRINTF( "(%05u)", NtGetTickCount() );
+
if (fun->name) DPRINTF("%04x:CALL %s.%s(",GetCurrentThreadId(),dll->name,fun->name);
else DPRINTF("%04x:CALL %s.%d(",GetCurrentThreadId(),dll->name,dll->ordbase+ordinal);
if (fun->nrofargs>0) {
@@ -906,6 +917,9 @@ void WINAPI __regs_SNOOP_Return( CONTEXT
if (ret->dll->funs[ret->ordinal].nrofargs<0)
ret->dll->funs[ret->ordinal].nrofargs=(context->Esp - ret->origESP-4)/4;
context->Eip = (DWORD)ret->origreturn;
+
+ if (TRACE_ON(ticks)) DPRINTF( "(%05u)", NtGetTickCount() );
+
if (ret->args) {
int i,max;
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 37a845f..0245f85 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -45,6 +45,7 @@ #include "wine/exception.h"
WINE_DEFAULT_DEBUG_CHANNEL(thread);
WINE_DECLARE_DEBUG_CHANNEL(relay);
+WINE_DECLARE_DEBUG_CHANNEL(ticks);
struct _KUSER_SHARED_DATA *user_shared_data = NULL;
@@ -392,6 +393,8 @@ static void DECLSPEC_NORETURN call_threa
MODULE_DllThreadAttach( NULL );
+ if (TRACE_ON(ticks)) DPRINTF( "(%05u)", NtGetTickCount() );
+
if (TRACE_ON(relay))
DPRINTF( "%04x:Starting thread proc %p (arg=%p)\n", GetCurrentThreadId(), rtl_func, arg );
--
1.4.1
--=-CD9av1MVUTfwrRQau/2x--
More information about the wine-patches
mailing list