SM - Sorry, I forgot silence dbg messages!
[reactos.git] / reactos / ntoskrnl / dbg / user.c
1 /* $Id:$
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/dbg/user.c
6 * PURPOSE: User mode debugging
7 *
8 * PROGRAMMERS: David Welch (welch@cwcom.net)
9 */
10
11 /* INCLUDES ******************************************************************/
12
13 #include <ntoskrnl.h>
14 #include <internal/debug.h>
15
16 /* FUNCTIONS *****************************************************************/
17
18 VOID
19 DbgkCreateThread(PVOID StartAddress)
20 {
21 LPC_DBG_MESSAGE Message;
22 LPC_DBG_MESSAGE Reply;
23 NTSTATUS Status;
24
25 if (PsGetCurrentThread()->ThreadsProcess->DebugPort == NULL)
26 {
27 return;
28 }
29
30 Message.Header.MessageSize = sizeof(LPC_DBG_MESSAGE);
31 Message.Header.DataSize = sizeof(LPC_DBG_MESSAGE) -
32 sizeof(LPC_MESSAGE);
33 Message.Type = DBG_EVENT_CREATE_THREAD;
34 Message.Status = STATUS_SUCCESS;
35 Message.Data.CreateThread.Reserved = 0;
36 Message.Data.CreateThread.StartAddress = StartAddress;
37
38 /* FIXME: Freeze all threads in process */
39
40 /* Send the message to the process's debug port and wait for a reply */
41 Status =
42 LpcSendDebugMessagePort(PsGetCurrentThread()->ThreadsProcess->DebugPort,
43 &Message,
44 &Reply);
45 if (!NT_SUCCESS(Status))
46 {
47 return;
48 }
49
50 /* FIXME: Examine reply */
51 return;
52 }
53
54 ULONG
55 DbgkForwardException(EXCEPTION_RECORD Er, ULONG FirstChance)
56 {
57 LPC_DBG_MESSAGE Message;
58 LPC_DBG_MESSAGE Reply;
59 NTSTATUS Status;
60
61 if (PsGetCurrentThread()->ThreadsProcess->DebugPort == NULL)
62 {
63 return(0);
64 }
65
66 Message.Header.MessageSize = sizeof(LPC_DBG_MESSAGE);
67 Message.Header.DataSize = sizeof(LPC_DBG_MESSAGE) -
68 sizeof(LPC_MESSAGE);
69 Message.Type = DBG_EVENT_EXCEPTION;
70 Message.Status = STATUS_SUCCESS;
71 Message.Data.Exception.ExceptionRecord = Er;
72 Message.Data.Exception.FirstChance = FirstChance;
73
74 /* FIXME: Freeze all threads in process */
75
76 /* Send the message to the process's debug port and wait for a reply */
77 Status =
78 LpcSendDebugMessagePort(PsGetCurrentThread()->ThreadsProcess->DebugPort,
79 &Message,
80 &Reply);
81 if (!NT_SUCCESS(Status))
82 {
83 return(0);
84 }
85
86 /* FIXME: Examine reply */
87 return(0);
88 }
89
90 /* EOF */