[RXCE]
authorPierre Schweitzer <pierre@reactos.org>
Sat, 27 May 2017 08:39:42 +0000 (08:39 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Sat, 27 May 2017 08:39:42 +0000 (08:39 +0000)
Implement reference tracing

CORE-11327

svn path=/trunk/; revision=74676

reactos/sdk/include/ddk/fcb.h
reactos/sdk/lib/drivers/rxce/rxce.c

index bfc6a64..726750e 100644 (file)
@@ -324,6 +324,7 @@ typedef struct _FOBX
 #define RDBSS_REF_TRACK_NETFOBX  0x00000008
 #define RDBSS_REF_TRACK_NETFCB   0x00000010
 #define RDBSS_REF_TRACK_SRVOPEN  0x00000020
+#define RX_PRINT_REF_TRACKING    0x40000000
 
 extern ULONG RdbssReferenceTracingValue;
 
@@ -341,6 +342,14 @@ RxpTrackDereference(
     _In_ ULONG Line,
     _In_ PVOID Instance);
 
+#define REF_TRACING_ON(TraceMask) (TraceMask & RdbssReferenceTracingValue)
+#define PRINT_REF_COUNT(TYPE, Count)                          \
+    if (REF_TRACING_ON( RDBSS_REF_TRACK_ ## TYPE) &&          \
+        (RdbssReferenceTracingValue & RX_PRINT_REF_TRACKING)) \
+    {                                                         \
+        DbgPrint("%ld\n", Count);                             \
+    }
+
 #define RxReferenceSrvCall(SrvCall)                                         \
    RxpTrackReference(RDBSS_REF_TRACK_SRVCALL, __FILE__, __LINE__, SrvCall); \
    RxReference(SrvCall)
index 9cffb08..13f206c 100644 (file)
@@ -1718,16 +1718,29 @@ RxDereference(
     RefCount = InterlockedDecrement((volatile long *)&Node->NodeReferenceCount);
     ASSERT(RefCount >= 0);
 
-    /* TODO: trace */
+    /* Trace refcount */
     switch (NodeType)
     {
         case RDBSS_NTC_SRVCALL:
+            PRINT_REF_COUNT(SRVCALL, Node->NodeReferenceCount);
+            break;
+
         case RDBSS_NTC_NETROOT:
+            PRINT_REF_COUNT(NETROOT, Node->NodeReferenceCount);
+            break;
+
         case RDBSS_NTC_V_NETROOT:
+            PRINT_REF_COUNT(VNETROOT, Node->NodeReferenceCount);
+            break;
+
         case RDBSS_NTC_SRVOPEN:
+            PRINT_REF_COUNT(SRVOPEN, Node->NodeReferenceCount);
+            break;
+
         case RDBSS_NTC_FOBX:
-            UNIMPLEMENTED;
+            PRINT_REF_COUNT(NETFOBX, Node->NodeReferenceCount);
             break;
+
         default:
             ASSERT(FALSE);
             break;
@@ -4752,16 +4765,29 @@ RxReference(
     Node = (PNODE_TYPE_AND_SIZE)Instance;
     InterlockedIncrement((volatile long *)&Node->NodeReferenceCount);
 
-    /* And that's not implemented! (yay, we leak :-D) */
+    /* Trace refcount if asked */
     switch (NodeType)
     {
         case RDBSS_NTC_SRVCALL:
+            PRINT_REF_COUNT(SRVCALL, Node->NodeReferenceCount);
+            break;
+
         case RDBSS_NTC_NETROOT:
+            PRINT_REF_COUNT(NETROOT, Node->NodeReferenceCount);
+            break;
+
         case RDBSS_NTC_V_NETROOT:
+            PRINT_REF_COUNT(VNETROOT, Node->NodeReferenceCount);
+            break;
+
         case RDBSS_NTC_SRVOPEN:
+            PRINT_REF_COUNT(SRVOPEN, Node->NodeReferenceCount);
+            break;
+
         case RDBSS_NTC_FOBX:
-            UNIMPLEMENTED;
+            PRINT_REF_COUNT(NETFOBX, Node->NodeReferenceCount);
             break;
+
         default:
             ASSERT(FALSE);
             break;