3 * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS kernel
23 * FILE: ntoskrnl/dbg/rdebug.c
24 * PURPOSE: Runtime debugging support
25 * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
27 * 01-05-2001 CSH Created
30 /* INCLUDES *****************************************************************/
32 #include <ddk/ntddk.h>
37 /* GLOBALS ******************************************************************/
39 typedef struct _RDEBUG_ENTRY {
41 CHAR Filename[MAX_PATH];
42 } RDEBUG_ENTRY, *PRDEBUG_ENTRY;
44 LIST_ENTRY RDebugListHead;
45 BOOLEAN RDebugInitialized = FALSE;
47 /* FUNCTIONS ****************************************************************/
50 DbgpFind(PCH Filename)
55 Current = RDebugListHead.Flink;
56 while (Current != &RDebugListHead)
58 Entry = CONTAINING_RECORD(Current, RDEBUG_ENTRY, ListEntry);
60 if (strcmp(Filename, Entry->Filename) == 0)
64 Current = Current->Flink;
73 if (RDebugInitialized)
76 InitializeListHead(&RDebugListHead);
77 RDebugInitialized = TRUE;
87 if (!RDebugInitialized)
91 Current = RDebugListHead.Flink;
92 while (Current != &RDebugListHead)
94 Entry = CONTAINING_RECORD(Current, RDEBUG_ENTRY, ListEntry);
96 DbgPrint(" %s\n", Entry->Filename);
99 Current = Current->Flink;
104 DbgPrint(" 1 file listed\n");
108 DbgPrint(" %d files listed\n", Count);
113 DbgEnableFile(PCH Filename)
117 if (!RDebugInitialized)
120 if (!DbgpFind(Filename))
122 Entry = ExAllocatePool(NonPagedPool, sizeof(RDEBUG_ENTRY));
124 RtlMoveMemory(Entry->Filename, Filename, strlen(Filename) + 1);
125 InsertTailList(&RDebugListHead, &Entry->ListEntry);
130 DbgDisableFile(PCH Filename)
134 if (!RDebugInitialized)
137 Entry = DbgpFind(Filename);
141 RemoveEntryList(&Entry->ListEntry);
146 DbgShouldPrint(PCH Filename)
148 if (!RDebugInitialized)
151 return(DbgpFind(Filename) != NULL);