Small Debugging Services re-arrangement. /dbgk created for User-Mode debugging and Native Debug Objects (implemented an experimental NtCreateDebugObject. Untested and doesn't work since the DbgkObjectType isn't created yet. Added dbgk.h with the basic structures for now. Removed /dbg and split up code in ex/debug.c for executive and rtl/debug.c for RunTime Library Debug calls. Kdbg now dedicated in /kdbg.
Modified: trunk/reactos/ntoskrnl/Makefile
Modified: trunk/reactos/ntoskrnl/Makefile.i386
Deleted: trunk/reactos/ntoskrnl/dbg/
Modified: trunk/reactos/ntoskrnl/ex/init.c
Modified: trunk/reactos/ntoskrnl/include/internal/dbg.h
Modified: trunk/reactos/ntoskrnl/include/internal/debug.h
Modified: trunk/reactos/ntoskrnl/include/ntoskrnl.h
Modified: trunk/reactos/ntoskrnl/io/iomgr.c
Modified: trunk/reactos/ntoskrnl/kd/kdebug.c
Modified: trunk/reactos/ntoskrnl/kd/mda.c
Added: trunk/reactos/ntoskrnl/kdbg/
Modified: trunk/reactos/ntoskrnl/kdbg/kdb.c
Modified: trunk/reactos/ntoskrnl/kdbg/kdb_cli.c
Modified: trunk/reactos/ntoskrnl/kdbg/kdb_expr.c
Modified: trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c
Modified: trunk/reactos/ntoskrnl/ke/i386/irq.c
Modified: trunk/reactos/ntoskrnl/lpc/send.c

Modified: trunk/reactos/ntoskrnl/Makefile
--- trunk/reactos/ntoskrnl/Makefile	2005-04-23 05:43:35 UTC (rev 14759)
+++ trunk/reactos/ntoskrnl/Makefile	2005-04-23 06:41:25 UTC (rev 14760)
@@ -24,18 +24,6 @@
 LINKER_SCRIPT := ntoskrnl.lnk
 STRIP_FLAGS := -Wl,-s
 
-ifeq ($(KDBG), 1)
-OBJECTS_KDBG := dbg/kdb.o dbg/kdb_cli.o dbg/kdb_expr.o dbg/kdb_keyboard.o \
-                dbg/kdb_serial.o dbg/kdb_string.o dbg/rdebug.o dbg/i386/kdb_help.o \
-                dbg/i386/i386-dis.o dbg/i386/longjmp.o dbg/i386/setjmp.o
-preall: all
-else
-OBJECTS_KDBG :=
-endif
-ifeq ($(DBG_OR_KDBG), 1)
-OBJECTS_KDBG := $(OBJECTS_KDBG) dbg/kdb_symbols.o
-endif
-
 TARGET_ASFLAGS = -I./include
 TARGET_CFLAGS = -I./include $(CFLAGS_KDBG) -Wall -Werror $(CFLAGS_OPT)
 
@@ -74,6 +62,7 @@
 	rtl/atom.o \
 	rtl/capture.o \
 	rtl/ctype.o \
+	rtl/debug.o \
 	rtl/handle.o \
 	rtl/message.o \
 	rtl/misc.o \
@@ -240,6 +229,7 @@
 # Executive Subsystem (Ex)
 OBJECTS_EX = \
 	ex/callback.o \
+	ex/dbgctrl.o \
 	ex/error.o \
 	ex/event.o \
 	ex/evtpair.o \
@@ -301,14 +291,6 @@
 	cm/registry.o  \
 	cm/regobj.o \
 
-# Debugger Support (Dbg)
-OBJECTS_DBG = \
-	dbg/dbgctrl.o \
-	dbg/errinfo.o \
-	dbg/print.o \
-	dbg/user.o \
-	$(OBJECTS_KDBG)
-
 # Loader
 OBJECTS_LDR = \
 	ldr/init.o \
@@ -352,7 +334,30 @@
 	kd/kdebug.o \
 	kd/mda.o \
 	kd/service.o
+	
+# User-Mode Debugging (Dbgk)
+OBJECTS_DBGK = \
+	dbgk/dbgkutil.o \
+	dbgk/debug.o
 
+ifeq ($(KDBG), 1)
+OBJECTS_KDBG := \
+	kdbg/kdb.o \
+	kdbg/kdb_cli.o \
+	kdbg/kdb_expr.o \
+	kdbg/kdb_keyboard.o \
+	kdbg/kdb_serial.o \
+	kdbg/kdb_string.o
+preall: all
+else
+OBJECTS_KDBG :=
+endif
+ifeq ($(DBG_OR_KDBG), 1)
+OBJECTS_KDBG := \
+	$(OBJECTS_KDBG) \
+	kdbg/kdb_symbols.o
+endif
+
 # Boot video (Inbv)
 OBJECTS_INBV = \
 	inbv/inbv.o
@@ -360,7 +365,7 @@
 DEP_OBJECTS := $(OBJECTS_MM) $(OBJECTS_ARCH) \
 	$(OBJECTS_IO) $(OBJECTS_KE) $(OBJECTS_OB) \
 	$(OBJECTS_PS) $(OBJECTS_EX) $(OBJECTS_CC) $(OBJECTS_FS) $(OBJECTS_SE) \
-	$(OBJECTS_DBG) $(OBJECTS_CM) $(OBJECTS_LDR) $(OBJECTS_LPC) \
+	$(OBJECTS_KDBG) $(OBJECTS_DBGK) $(OBJECTS_CM) $(OBJECTS_LDR) $(OBJECTS_LPC) \
 	$(OBJECTS_PO) $(OBJECTS_KD) $(OBJECTS_RTL) $(OBJECTS_INBV)
 
 TAG_OBJECTS := $(join $(dir $(DEP_OBJECTS)),$(patsubst %.o, .%.TAG, $(notdir $(DEP_OBJECTS))))
@@ -383,12 +388,12 @@
 	$(OBJECTS_KE) \
 	$(OBJECTS_CC) \
 	$(OBJECTS_CM) \
-	$(OBJECTS_DBG) \
 	$(OBJECTS_EX) \
 	$(OBJECTS_LPC) \
 	$(OBJECTS_FS) \
 	$(OBJECTS_IO) \
 	$(OBJECTS_KD) \
+	$(OBJECTS_DBGK) \
 	$(OBJECTS_LDR) \
 	$(OBJECTS_MM) \
 	$(OBJECTS_OB) \
@@ -396,6 +401,7 @@
 	$(OBJECTS_PS) \
 	$(OBJECTS_RTL) \
 	$(OBJECTS_SE) \
+	$(OBJECTS_KDBG) \
 	$(OBJECTS_INBV) \
 	$(OBJECTS_RESOURCE)
 

Modified: trunk/reactos/ntoskrnl/Makefile.i386
--- trunk/reactos/ntoskrnl/Makefile.i386	2005-04-23 05:43:35 UTC (rev 14759)
+++ trunk/reactos/ntoskrnl/Makefile.i386	2005-04-23 06:41:25 UTC (rev 14760)
@@ -52,10 +52,21 @@
 	rtl/i386/exception.o \
 	rtl/i386/seh.o
 
+ifeq ($(KDBG), 1)
+OBJECTS_KDBG_I386 := \
+	kdbg/i386/kdb_help.o \
+	kdbg/i386/i386-dis.o \
+	kdbg/i386/longjmp.o \
+	kdbg/i386/setjmp.o
+preall: all
+else
+OBJECTS_KDBG_I386 :=
+endif
+
 OBJECTS_PS_I386 := \
 	ps/i386/continue.o
 
 RTL_EXCLUDE_FILTER := 
 
 OBJECTS_ARCH = $(OBJECTS_BOOT) $(OBJECTS_EX_I386) $(OBJECTS_KE_I386) $(OBJECTS_MM_I386) \
-  $(OBJECTS_RTL_I386) $(OBJECTS_PS_I386)
+  $(OBJECTS_RTL_I386) $(OBJECTS_KDBG_I386) $(OBJECTS_PS_I386)

Modified: trunk/reactos/ntoskrnl/ex/init.c
--- trunk/reactos/ntoskrnl/ex/init.c	2005-04-23 05:43:35 UTC (rev 14759)
+++ trunk/reactos/ntoskrnl/ex/init.c	2005-04-23 06:41:25 UTC (rev 14760)
@@ -11,7 +11,7 @@
 
 #include <ntoskrnl.h>
 #include <ntos/bootvid.h>
-#include "../dbg/kdb.h"
+#include <internal/kdb.h>
 #define NDEBUG
 #include <internal/debug.h>
 

Modified: trunk/reactos/ntoskrnl/include/internal/dbg.h
--- trunk/reactos/ntoskrnl/include/internal/dbg.h	2005-04-23 05:43:35 UTC (rev 14759)
+++ trunk/reactos/ntoskrnl/include/internal/dbg.h	2005-04-23 06:41:25 UTC (rev 14760)
@@ -10,11 +10,5 @@
 LpcSendDebugMessagePort(PEPORT Port,
 			PLPC_DBG_MESSAGE Message,
 			PLPC_DBG_MESSAGE Reply);
-VOID
-DbgkCreateThread(PVOID StartAddress);
-ULONG
-DbgkForwardException(EXCEPTION_RECORD Er, ULONG FirstChance);
-BOOLEAN
-DbgShouldPrint(PCH Filename);
 
 #endif /* __INCLUDE_INTERNAL_DBG_H */

Modified: trunk/reactos/ntoskrnl/include/internal/debug.h
--- trunk/reactos/ntoskrnl/include/internal/debug.h	2005-04-23 05:43:35 UTC (rev 14759)
+++ trunk/reactos/ntoskrnl/include/internal/debug.h	2005-04-23 06:41:25 UTC (rev 14760)
@@ -93,19 +93,6 @@
 
 #define CHECKPOINT1 do { DbgPrint("%s:%d\n",__FILE__,__LINE__); } while(0)
 
-#if defined(KDBG) && defined(NDEBUG) && defined(__NTOSKRNL__)
-
-#define DPRINT(args...) do { \
-  if (DbgShouldPrint(__FILE__)) { \
-    DbgPrint("(%s:%d) ",__FILE__,__LINE__); \
-    DbgPrint(args); \
-  } \
-} while(0)
-
-#define CHECKPOINT
-
-#else /* KDBG && NDEBUG && __NTOSKRNL__ */
-
 #ifndef NDEBUG
 #ifdef __GNUC__ /* using GNU C/C99 macro ellipsis */
 #define DPRINT(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0)
@@ -122,7 +109,6 @@
 #define CHECKPOINT
 #endif /* NDEBUG */
 
-#endif /* KDBG && NDEBUG */
 
 /*
  * FUNCTION: Assert a maximum value for the current irql

Modified: trunk/reactos/ntoskrnl/include/ntoskrnl.h
--- trunk/reactos/ntoskrnl/include/ntoskrnl.h	2005-04-23 05:43:35 UTC (rev 14759)
+++ trunk/reactos/ntoskrnl/include/ntoskrnl.h	2005-04-23 06:41:25 UTC (rev 14760)
@@ -54,6 +54,7 @@
 #include <internal/port.h>
 #include <internal/nls.h>
 #include <internal/dbg.h>
+#include <internal/dbgk.h>
 #include <internal/trap.h>
 #include <internal/safe.h>
 #include <internal/test.h>

Modified: trunk/reactos/ntoskrnl/io/iomgr.c
--- trunk/reactos/ntoskrnl/io/iomgr.c	2005-04-23 05:43:35 UTC (rev 14759)
+++ trunk/reactos/ntoskrnl/io/iomgr.c	2005-04-23 06:41:25 UTC (rev 14760)
@@ -11,7 +11,7 @@
 /* INCLUDES ****************************************************************/
 
 #include <ntoskrnl.h>
-#include "../dbg/kdb.h"
+#include <internal/kdb.h>
 #define NDEBUG
 #include <internal/debug.h>
 
@@ -642,7 +642,6 @@
     Status = IoCreateSystemRootLink((PCHAR)KeLoaderBlock.CommandLine);
     if (!NT_SUCCESS(Status)) {
         DbgPrint("IoCreateSystemRootLink FAILED: (0x%x) - ", Status);
-        DbgPrintErrorMessage (Status);
         KEBUGCHECK(INACCESSIBLE_BOOT_DEVICE);
     }
 

Modified: trunk/reactos/ntoskrnl/kd/kdebug.c
--- trunk/reactos/ntoskrnl/kd/kdebug.c	2005-04-23 05:43:35 UTC (rev 14759)
+++ trunk/reactos/ntoskrnl/kd/kdebug.c	2005-04-23 06:41:25 UTC (rev 14760)
@@ -9,7 +9,7 @@
  */
 
 #include <ntoskrnl.h>
-#include "../dbg/kdb.h"
+#include <internal/kdb.h>
 #include <internal/debug.h>
 
 /* serial debug connection */
@@ -79,11 +79,6 @@
   if (BootPhase > 0)
     {
 #ifdef KDBG
-      /* Initialize runtime debugging if available */
-      DbgRDebugInit();
-#endif
-
-#ifdef KDBG
       /* Initialize the local kernel debugger. */
       KdDebuggerEnabled = TRUE;
       KdDebugState |= KD_DEBUG_KDB;

Modified: trunk/reactos/ntoskrnl/kd/mda.c
--- trunk/reactos/ntoskrnl/kd/mda.c	2005-04-23 05:43:35 UTC (rev 14759)
+++ trunk/reactos/ntoskrnl/kd/mda.c	2005-04-23 06:41:25 UTC (rev 14760)
@@ -11,7 +11,7 @@
 /* INCLUDES ******************************************************************/
 
 #include <ntoskrnl.h>
-#include "../dbg/kdb.h"
+#include <internal/kdb.h>
 
 /* VARIABLES ***************************************************************/
 

Copied: trunk/reactos/ntoskrnl/kdbg (from rev 14742, trunk/reactos/ntoskrnl/dbg)

Modified: trunk/reactos/ntoskrnl/kdbg/kdb.c
--- trunk/reactos/ntoskrnl/dbg/kdb.c	2005-04-22 12:52:25 UTC (rev 14742)
+++ trunk/reactos/ntoskrnl/kdbg/kdb.c	2005-04-23 06:41:25 UTC (rev 14760)
@@ -11,7 +11,7 @@
 /* INCLUDES ******************************************************************/
 
 #include <ntoskrnl.h>
-#include "kdb.h"
+#include <internal/kdb.h>
 #define NDEBUG
 #include <internal/debug.h>
 

Modified: trunk/reactos/ntoskrnl/kdbg/kdb_cli.c
--- trunk/reactos/ntoskrnl/dbg/kdb_cli.c	2005-04-22 12:52:25 UTC (rev 14742)
+++ trunk/reactos/ntoskrnl/kdbg/kdb_cli.c	2005-04-23 06:41:25 UTC (rev 14760)
@@ -30,7 +30,7 @@
 
 #include <ntoskrnl.h>
 #include <ctype.h>
-#include "kdb.h"
+#include <internal/kdb.h>
 
 #define NDEBUG
 #include <internal/debug.h>

Modified: trunk/reactos/ntoskrnl/kdbg/kdb_expr.c
--- trunk/reactos/ntoskrnl/dbg/kdb_expr.c	2005-04-22 12:52:25 UTC (rev 14742)
+++ trunk/reactos/ntoskrnl/kdbg/kdb_expr.c	2005-04-23 06:41:25 UTC (rev 14760)
@@ -35,7 +35,7 @@
 /* INCLUDES ******************************************************************/
 
 #include <ntoskrnl.h>
-#include "kdb.h"
+#include <internal/kdb.h>
 #define NDEBUG
 #include <internal/debug.h>
 

Modified: trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c
--- trunk/reactos/ntoskrnl/dbg/kdb_symbols.c	2005-04-22 12:52:25 UTC (rev 14742)
+++ trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c	2005-04-23 06:41:25 UTC (rev 14760)
@@ -28,7 +28,7 @@
 #define NDEBUG
 #include <internal/debug.h>
 
-#include "kdb.h"
+#include <internal/kdb.h>
 
 /* GLOBALS ******************************************************************/
 

Modified: trunk/reactos/ntoskrnl/ke/i386/irq.c
--- trunk/reactos/ntoskrnl/ke/i386/irq.c	2005-04-23 05:43:35 UTC (rev 14759)
+++ trunk/reactos/ntoskrnl/ke/i386/irq.c	2005-04-23 06:41:25 UTC (rev 14760)
@@ -20,7 +20,7 @@
 
 #include <ntoskrnl.h>
 #if defined(KDBG) || defined(DBG)
-#include <../dbg/kdb.h>
+#include <internal/kdb.h>
 #endif /* KDBG */
 
 #include <../hal/halx86/include/halirq.h>

Modified: trunk/reactos/ntoskrnl/lpc/send.c
--- trunk/reactos/ntoskrnl/lpc/send.c	2005-04-23 05:43:35 UTC (rev 14759)
+++ trunk/reactos/ntoskrnl/lpc/send.c	2005-04-23 06:41:25 UTC (rev 14760)
@@ -11,6 +11,7 @@
 /* INCLUDES *****************************************************************/
 
 #include <ntoskrnl.h>
+
 #define NDEBUG
 #include <internal/debug.h>