mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 09:13:01 +00:00
- Raw test app for DbgUi+Dbgk Debugging Subsystem (skeletal, and doesn't test Win32 APIs).
svn path=/trunk/; revision=24988
This commit is contained in:
parent
3b4c74ae10
commit
58809635ad
2 changed files with 133 additions and 0 deletions
|
@ -42,6 +42,38 @@ DriverEntry(
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @unimplemented
|
||||||
|
*/
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
HalStopProfileInterrupt(IN KPROFILE_SOURCE ProfileSource)
|
||||||
|
{
|
||||||
|
KEBUGCHECK(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @unimplemented
|
||||||
|
*/
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
HalStartProfileInterrupt(IN KPROFILE_SOURCE ProfileSource)
|
||||||
|
{
|
||||||
|
KEBUGCHECK(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @unimplemented
|
||||||
|
*/
|
||||||
|
ULONG_PTR
|
||||||
|
NTAPI
|
||||||
|
HalSetProfileInterval(IN ULONG_PTR Interval)
|
||||||
|
{
|
||||||
|
KEBUGCHECK(0);
|
||||||
|
return Interval;
|
||||||
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FASTCALL
|
FASTCALL
|
||||||
|
@ -1161,6 +1193,14 @@ KeAcquireQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle)
|
||||||
return (KIRQL)0;
|
return (KIRQL)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KIRQL
|
||||||
|
FASTCALL
|
||||||
|
KeAcquireQueuedSpinLockRaiseToSynch(IN PKLOCK_QUEUE_HANDLE LockHandle)
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
return (KIRQL)0;
|
||||||
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FASTCALL
|
FASTCALL
|
||||||
KeReleaseQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle,
|
KeReleaseQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle,
|
||||||
|
|
93
reactos/ntoskrnl/tests/TestDebug.c
Normal file
93
reactos/ntoskrnl/tests/TestDebug.c
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
#define _X86_
|
||||||
|
#include "ntndk.h"
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Main(VOID)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
HANDLE hProcess;
|
||||||
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
CLIENT_ID ClientId;
|
||||||
|
DBGUI_WAIT_STATE_CHANGE State;
|
||||||
|
BOOLEAN Alive = TRUE;
|
||||||
|
|
||||||
|
printf("*** Native (DbgUi) Debugging Test Application\n");
|
||||||
|
printf("Press any key to connect to Dbgk...");
|
||||||
|
getchar();
|
||||||
|
|
||||||
|
Status = DbgUiConnectToDbg();
|
||||||
|
printf(" Connection Established. Status: %lx\n", Status);
|
||||||
|
printf("Debug Object Handle: %lx\n", NtCurrentTeb()->DbgSsReserved[1]);
|
||||||
|
printf("Press any key to debug services.exe...");
|
||||||
|
getchar();
|
||||||
|
|
||||||
|
InitializeObjectAttributes(&ObjectAttributes, NULL, 0, 0, 0);
|
||||||
|
ClientId.UniqueThread = 0;
|
||||||
|
ClientId.UniqueProcess = UlongToHandle(168);
|
||||||
|
Status = NtOpenProcess(&hProcess,
|
||||||
|
PROCESS_ALL_ACCESS,
|
||||||
|
&ObjectAttributes,
|
||||||
|
&ClientId);
|
||||||
|
Status = DbgUiDebugActiveProcess(hProcess);
|
||||||
|
printf(" Debugger Attached. Status: %lx\n", Status);
|
||||||
|
printf("Press any key to get first debug event... ");
|
||||||
|
getchar();
|
||||||
|
|
||||||
|
while (Alive)
|
||||||
|
{
|
||||||
|
Status = DbgUiWaitStateChange(&State, NULL);
|
||||||
|
printf(" Event Received. Status: %lx\n", Status);
|
||||||
|
printf("New State: %lx. Application Client ID: %lx/%lx\n",
|
||||||
|
State.NewState,
|
||||||
|
State.AppClientId.UniqueProcess, State.AppClientId.UniqueThread);
|
||||||
|
|
||||||
|
switch (State.NewState)
|
||||||
|
{
|
||||||
|
case DbgCreateProcessStateChange:
|
||||||
|
printf("Process Handle: %lx. Thread Handle: %lx\n",
|
||||||
|
State.StateInfo.CreateProcessInfo.HandleToProcess,
|
||||||
|
State.StateInfo.CreateProcessInfo.HandleToThread);
|
||||||
|
printf("Process image handle: %lx\n",
|
||||||
|
State.StateInfo.CreateProcessInfo.NewProcess.FileHandle);
|
||||||
|
printf("Process image base: %lx\n",
|
||||||
|
State.StateInfo.CreateProcessInfo.NewProcess.BaseOfImage);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DbgCreateThreadStateChange:
|
||||||
|
printf("New thread: %lx\n", State.StateInfo.CreateThread.HandleToThread);
|
||||||
|
printf("Thread Start Address: %p\n", State.StateInfo.CreateThread.NewThread.StartAddress);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DbgLoadDllStateChange:
|
||||||
|
printf("New DLL: %lx\n", State.StateInfo.LoadDll.FileHandle);
|
||||||
|
printf("DLL LoadAddress: %p\n", State.StateInfo.LoadDll.BaseOfDll);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DbgBreakpointStateChange:
|
||||||
|
printf("Initial breakpoint hit at: %p!\n",
|
||||||
|
State.StateInfo.Exception.ExceptionRecord.ExceptionAddress);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DbgExitThreadStateChange:
|
||||||
|
printf("Thread exited: %lx\n", State.StateInfo.ExitThread.ExitStatus);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DbgExitProcessStateChange:
|
||||||
|
printf("Process exited: %lx\n", State.StateInfo.ExitProcess.ExitStatus);
|
||||||
|
Alive = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Press any key to continue debuggee...");
|
||||||
|
getchar();
|
||||||
|
|
||||||
|
ClientId.UniqueProcess = State.AppClientId.UniqueProcess;
|
||||||
|
ClientId.UniqueThread = State.AppClientId.UniqueThread;
|
||||||
|
Status = DbgUiContinue(&ClientId, DBG_CONTINUE);
|
||||||
|
printf(" Debuggee Resumed. Status: %lx\n", Status);
|
||||||
|
printf("Press any key to get next debug event... ");
|
||||||
|
getchar();
|
||||||
|
};
|
||||||
|
printf("*** End of test\n");
|
||||||
|
getchar();
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue