ReactOS 0.4.15-dev-7961-gdcf9eb0
debug.c File Reference
#include "bl.h"
Include dependency graph for debug.c:

Go to the source code of this file.

Functions

BOOLEAN BdDebuggerInitialized (VOID)
 
NTSTATUS BlBdPullRemoteFile (_In_ PWCHAR FilePath, _Out_ PVOID BaseAddress, _Out_ PULONGLONG FileSize)
 
BOOLEAN BlBdDebuggerEnabled (VOID)
 
VOID BlStatusPrint (_In_ PCWCH Format,...)
 
VOID BlStatusError (_In_ ULONG ErrorCode, _In_ ULONG Parameter1, _In_ ULONG_PTR Parameter2, _In_ ULONG_PTR Parameter3, _In_ ULONG_PTR Parameter4)
 

Variables

CHAR AnsiBuffer [1024]
 
BOOLEAN BdDebuggerNotPresent
 
BOOLEAN BdSubsystemInitialized
 
BOOLEAN BdArchBlockDebuggerOperation
 
BOOLEAN BlpStatusErrorInProgress
 
PBL_STATUS_ERROR_HANDLER BlpStatusErrorHandler
 

Function Documentation

◆ BdDebuggerInitialized()

BOOLEAN BdDebuggerInitialized ( VOID  )

Definition at line 25 of file debug.c.

28{
29 /* Check if BD was initialized, and is currently usable */
31}
BOOLEAN BdArchBlockDebuggerOperation
Definition: debug.c:18
BOOLEAN BdSubsystemInitialized
Definition: debug.c:17

Referenced by BlBdDebuggerEnabled().

◆ BlBdDebuggerEnabled()

BOOLEAN BlBdDebuggerEnabled ( VOID  )

Definition at line 53 of file debug.c.

56{
58
59 /* Check if the debugger is initialized */
61
62 /* Check if it's currently active */
63 Enabled = FALSE;
65 {
66 /* Yep! */
67 Enabled = TRUE;
68 }
69
70 /* Return enabled state */
71 return Enabled;
72}
unsigned char BOOLEAN
BOOLEAN BdDebuggerInitialized(VOID)
Definition: debug.c:25
BOOLEAN BdDebuggerNotPresent
Definition: debug.c:16
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
@ Enabled
Definition: mountmgr.h:159
@ Initialized
Definition: ketypes.h:388

Referenced by BlBdPullRemoteFile(), BlImgLoadBootApplication(), BlStatusError(), BlStatusPrint(), and MmHapReportHeapCorruption().

◆ BlBdPullRemoteFile()

NTSTATUS BlBdPullRemoteFile ( _In_ PWCHAR  FilePath,
_Out_ PVOID  BaseAddress,
_Out_ PULONGLONG  FileSize 
)

Definition at line 34 of file debug.c.

39{
40 /* Is the boot debugger enabled? */
42 {
43 /* Nothing to pull */
45 }
46
47 /* TODO */
48 EfiPrintf(L"Todo\r\n");
50}
VOID EfiPrintf(_In_ PWCHAR Format,...)
Definition: firmware.c:126
BOOLEAN BlBdDebuggerEnabled(VOID)
Definition: debug.c:53
#define STATUS_DEBUGGER_INACTIVE
Definition: debugger.c:30
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
#define L(x)
Definition: ntvdm.h:50

Referenced by ImgpOpenFile().

◆ BlStatusError()

VOID BlStatusError ( _In_ ULONG  ErrorCode,
_In_ ULONG  Parameter1,
_In_ ULONG_PTR  Parameter2,
_In_ ULONG_PTR  Parameter3,
_In_ ULONG_PTR  Parameter4 
)

Definition at line 121 of file debug.c.

128{
130
131 /* Is this a non-boot error? */
132 if (ErrorCode != 1)
133 {
134 /* Is one already ongoing? */
136 {
137 /* Do we have a custom error handler registered? */
139 {
140 /* Call it, making sure to avoid recursion */
143 Parameter1,
144 Parameter2,
145 Parameter3,
146 Parameter4);
148
149 /* If the error handler consumed the error, we're done */
150 if (NT_SUCCESS(Status))
151 {
152 return;
153 }
154 }
155 }
156 }
157
158 /* Check if the boot debugger is enabled */
160 {
161 /* Print out the fatal error */
162 BlStatusPrint(L"\n"
163 L"*** Fatal Error 0x%08x :\n"
164 L" (0x%p, 0x%p, 0x%p, 0x%p)\n"
165 L"\n",
166 ErrorCode,
167 Parameter1,
168 Parameter2,
169 Parameter3,
170 Parameter4);
171
172 /* Issue a breakpoint */
173 __debugbreak();
174 }
175}
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN BlpStatusErrorInProgress
Definition: debug.c:19
PBL_STATUS_ERROR_HANDLER BlpStatusErrorHandler
Definition: debug.c:20
VOID BlStatusPrint(_In_ PCWCH Format,...)
Definition: debug.c:75
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:25
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436

Referenced by BmFatalErrorEx().

◆ BlStatusPrint()

VOID BlStatusPrint ( _In_ PCWCH  Format,
  ... 
)

Definition at line 75 of file debug.c.

79{
82 va_list va;
84
85 va_start(va, Format);
86
87 /* Check if the boot debugger is enabled */
89#if DBG
90 || TRUE
91#endif
92 )
93 {
94 /* Print the string out into a buffer */
95 if (vswprintf(BlScratchBuffer, Format, va) > 0)
96 {
97#if DBG
99 EfiPrintf(L"\r\n");
100#endif
101 /* Make it a UNICODE_STRING */
103
104 /* Then convert it into an ANSI_STRING */
105 AnsiString.Length = 0;
106 AnsiString.MaximumLength = sizeof(AnsiBuffer);
107 AnsiString.Buffer = AnsiBuffer;
109 if (NT_SUCCESS(Status))
110 {
111 /* Print it out to the debugger if that worked */
112 DbgPrint(AnsiString.Buffer);
113 }
114 }
115 }
116
117 va_end(va);
118}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
WCHAR BlScratchBuffer[8192]
Definition: firmware.c:39
CHAR AnsiBuffer[1024]
Definition: debug.c:15
@ AnsiString
Definition: dnslib.h:19
#define DbgPrint
Definition: hal.h:12
static _Check_return_opt_ int __cdecl vswprintf(_Out_writes_z_(_SizeInWords) wchar_t *_DstBuf, _In_ size_t _SizeInWords, _In_z_ _Printf_format_string_ const wchar_t *_Format, va_list _ArgList)
Definition: stdio.h:977
#define DBG(x)
Definition: moztest.c:12
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

Referenced by BiEnumerateSubObjectElements(), BlStatusError(), BmFatalErrorEx(), BmFwMemoryInitialize(), MmHapReportHeapCorruption(), OslAbortBoot(), and OslFatalErrorEx().

Variable Documentation

◆ AnsiBuffer

CHAR AnsiBuffer[1024]

◆ BdArchBlockDebuggerOperation

BOOLEAN BdArchBlockDebuggerOperation

Definition at line 18 of file debug.c.

Referenced by BdDebuggerInitialized().

◆ BdDebuggerNotPresent

BOOLEAN BdDebuggerNotPresent

Definition at line 16 of file debug.c.

Referenced by BlBdDebuggerEnabled(), and BlImgLoadBootApplication().

◆ BdSubsystemInitialized

BOOLEAN BdSubsystemInitialized

Definition at line 17 of file debug.c.

Referenced by BdDebuggerInitialized().

◆ BlpStatusErrorHandler

PBL_STATUS_ERROR_HANDLER BlpStatusErrorHandler

Definition at line 20 of file debug.c.

Referenced by BlStatusError(), and OslPrepareTarget().

◆ BlpStatusErrorInProgress

BOOLEAN BlpStatusErrorInProgress

Definition at line 19 of file debug.c.

Referenced by BlStatusError().