ReactOS 0.4.16-dev-2498-g8632030
debug.c File Reference
#include <freeldr.h>
#include <debug.h>
Include dependency graph for debug.c:

Go to the source code of this file.

Functions

VOID DebugInit (_In_ PCSTR DebugString)
 
ULONG DbgPrint (PCCH Format,...)
 
VOID DbgPrint2 (ULONG Mask, ULONG Level, const char *File, ULONG Line, char *Format,...)
 
VOID DebugDumpBuffer (ULONG Mask, PVOID Buffer, ULONG Length)
 
VOID DbgParseDebugChannels (PCHAR Value)
 
ULONG MsgBoxPrint (const char *Format,...)
 
DECLSPEC_NORETURN VOID NTAPI KeBugCheckEx (IN ULONG BugCheckCode, IN ULONG_PTR BugCheckParameter1, IN ULONG_PTR BugCheckParameter2, IN ULONG_PTR BugCheckParameter3, IN ULONG_PTR BugCheckParameter4)
 
VOID NTAPI RtlAssert (IN PVOID FailedAssertion, IN PVOID FileName, IN ULONG LineNumber, IN PCHAR Message OPTIONAL)
 

Variables

charBugCodeStrings []
 
ULONG_PTR BugCheckInfo [5]
 

Function Documentation

◆ DbgParseDebugChannels()

VOID DbgParseDebugChannels ( PCHAR  Value)

Definition at line 445 of file debug.c.

446{
448}
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

◆ DbgPrint()

ULONG DbgPrint ( PCCH  Format,
  ... 
)

Definition at line 419 of file debug.c.

420{
422 return 0;
423}

◆ DbgPrint2()

VOID DbgPrint2 ( ULONG  Mask,
ULONG  Level,
const char File,
ULONG  Line,
char Format,
  ... 
)

Definition at line 426 of file debug.c.

427{
433}
Definition: File.h:16
unsigned int Mask
Definition: fpcontrol.c:82
Definition: ncftp.h:79
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:56

◆ DebugDumpBuffer()

VOID DebugDumpBuffer ( ULONG  Mask,
PVOID  Buffer,
ULONG  Length 
)

Definition at line 436 of file debug.c.

437{
441}
Definition: bufpool.h:45
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102

◆ DebugInit()

VOID DebugInit ( _In_ PCSTR  DebugString)

Definition at line 412 of file debug.c.

414{
416}
static CCHAR DebugString[256]
Definition: settings.c:16

◆ KeBugCheckEx()

DECLSPEC_NORETURN VOID NTAPI KeBugCheckEx ( IN ULONG  BugCheckCode,
IN ULONG_PTR  BugCheckParameter1,
IN ULONG_PTR  BugCheckParameter2,
IN ULONG_PTR  BugCheckParameter3,
IN ULONG_PTR  BugCheckParameter4 
)

Definition at line 485 of file debug.c.

491{
492 char Buffer[70];
493
495 "*** STOP: 0x%08lX (0x%p,0x%p,0x%p,0x%p)",
496 BugCheckCode,
497 (PVOID)BugCheckParameter1,
498 (PVOID)BugCheckParameter2,
499 (PVOID)BugCheckParameter3,
500 (PVOID)BugCheckParameter4);
501
503 ASSERT(FALSE);
504 for (;;);
505}
VOID UiMessageBoxCritical(_In_ PCSTR MessageText)
Definition: ui.c:372
#define FALSE
Definition: types.h:117
#define ASSERT(a)
Definition: mode.c:44
#define sprintf
Definition: sprintf.c:45

Referenced by _Acquires_nonreentrant_lock_(), _Function_class_(), _IRQL_requires_max_(), _IRQL_requires_min_(), _Releases_nonreentrant_lock_(), ClasspReleaseQueue(), CmGetSystemControlValues(), CmGetSystemDriverList(), CmInitSystem1(), CmpHiveRootSecurityDescriptor(), CmpInitializeCache(), CmpInitializeHiveList(), CmpInitializeSystemHive(), CmpSecurityMethod(), CmpValueToData(), CODE_SEG(), DceCreateDisplayDC(), DoCrashCommand(), ExAllocatePoolWithTag(), ExFreePoolWithTag(), ExpCheckPoolAllocation(), ExpCheckPoolHeader(), ExpCheckPoolIrqlLevel(), ExpCheckPoolLinks(), ExpCreateSystemRootLink(), ExpInitializeExecutive(), ExpInitializeWorkerThreads(), ExpInitNls(), ExpLoadInitialProcess(), ExpSystemErrorHandler(), ExpWorkerThreadEntryPoint(), ExQueueWorkItem(), ExReleaseResourceForThreadLite(), ExReturnPoolQuota(), ExSetResourceOwnerPointer(), FsRtlWorkerThread(), HalInitSystem(), HaliReadMPConfigTable(), HalpAcpiTableCacheInit(), HalpAllocateArray(), HalpCopyBufferMap(), HalpReportResourceUsage(), InitializePool(), IoAssignResources(), IoCancelFileOpen(), IoCancelIrp(), IofCallDriver(), IofCompleteRequest(), IoInvalidateDeviceRelations(), IoInvalidateDeviceState(), IopInitializePlugPlayServices(), IopMarkBootPartition(), IopMountVolume(), IopParseDevice(), IopStartRamdisk(), IoReportTargetDeviceChange(), IoReportTargetDeviceChangeAsynchronous(), IoSynchronousInvalidateDeviceRelations(), KeAcquireInStackQueuedSpinLockAtDpcLevel(), KeAcquireSpinLockAtDpcLevel(), KeAttachProcess(), KefAcquireSpinLockAtDpcLevel(), KefReleaseSpinLockFromDpcLevel(), KeRaiseIrqlToSynchLevel(), KeReleaseInStackQueuedSpinLockFromDpcLevel(), KeReleaseSpinLockFromDpcLevel(), KeRemoveQueue(), KeRestoreFloatingPointState(), KeRundownThread(), KeStackAttachProcess(), KeTryToAcquireSpinLockAtDpcLevel(), KiDeliverApc(), KiDispatchException(), KiEspToTrapFrame(), KiExitSystemCallDebugChecks(), KiInitializeKernel(), KiInitMachineDependent(), KiSwapContextExit(), KiSwapContextResume(), KiSystemService(), KiUserModeCallout(), KiVerifyCpuFeatures(), MiDecrementReferenceCount(), MiDecrementShareCount(), MiDeletePte(), MiFreeContiguousMemory(), MiInitializePfn(), MiInitializePfnAndMakePteValid(), MiInitializeSessionIds(), MiInsertPageInList(), MiMakeSystemAddressValid(), MiMakeSystemAddressValidPfn(), MiMapPfnDatabase(), MiniResetComplete(), MiRemoveFromSystemSpace(), MiSpecialPoolCheckPattern(), MmAccessFaultSectionView(), MmAllocateSpecialPool(), MmArmAccessFault(), MmArmInitSystem(), MmCommitSessionMappedView(), MmCreatePageFileMapping(), MmDeletePageFileMapping(), MmDeterminePoolType(), MmFreePagesFromMdl(), MmFreeSpecialPool(), MmMapLockedPagesSpecifyCache(), MmMapLockedPagesWithReservedMapping(), MmPageOutPhysicalAddress(), MmUnmapReservedMapping(), MmZeroPageThread(), MupDereferenceVcb(), Mx::MxBugCheckEx(), MxGetNextPage(), NdisIPnPStartDevice(), NdisMAllocateSharedMemory(), NtUserInitialize(), ObpCloseHandle(), ObpCloseHandleTableEntry(), PciAddDevice(), Phase1InitializationDiscard(), PiInitializeDevNode(), PopShutdownSystem(), PoShutdownBugCheck(), PsInitSystem(), PsLocateSystemDll(), PspCatchCriticalBreak(), PspExitThread(), PspInitializeSystemDll(), PspReturnProcessQuotaSpecifiedPool(), PspUnhandledExceptionInSystemThread(), RxAssert(), SeDefaultObjectMethod(), SeInitSystem(), USBPORT_FindUrbInIrpTable(), USBPORT_InsertIrpInTable(), USBPORT_SplitBulkInterruptTransfer(), USBPORT_SplitTransfer(), USBPORT_Unload(), UserInitialize(), vfatInitFcb(), and xHalTranslateBusAddress().

◆ MsgBoxPrint()

ULONG MsgBoxPrint ( const char Format,
  ... 
)

Definition at line 453 of file debug.c.

454{
455 va_list ap;
456 CHAR Buffer[512];
458
460
461 /* Construct a string */
462 Length = _vsnprintf(Buffer, 512, Format, ap);
463
464 /* Check if we went past the buffer */
465 if (Length == MAXULONG)
466 {
467 /* Terminate it if we went over-board */
468 Buffer[sizeof(Buffer) - 1] = '\n';
469
470 /* Put maximum */
471 Length = sizeof(Buffer);
472 }
473
474 /* Show it as a message box */
476
477 /* Cleanup and exit */
478 va_end(ap);
479 return 0;
480}
VOID UiMessageBox(_In_ PCSTR Format,...)
Definition: ui.c:359
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
char * va_list
Definition: vadefs.h:50
#define MAXULONG
Definition: typedefs.h:251
uint32_t ULONG
Definition: typedefs.h:59
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36
#define _vsnprintf
Definition: xmlstorage.h:202
char CHAR
Definition: xmlstorage.h:175

◆ RtlAssert()

VOID NTAPI RtlAssert ( IN PVOID  FailedAssertion,
IN PVOID  FileName,
IN ULONG  LineNumber,
IN PCHAR Message  OPTIONAL 
)

Definition at line 509 of file debug.c.

513{
515
516 if (Message)
517 {
518 Format = "Assertion \'%s\' failed at %s line %lu: %s\n";
519
521 (PCHAR)FailedAssertion,
524 Message);
525
528 Format,
529 (PCHAR)FailedAssertion,
532 Message);
533 }
534 else
535 {
536 Format = "Assertion \'%s\' failed at %s line %lu\n";
537
539 (PCHAR)FailedAssertion,
541 LineNumber);
542
545 Format,
546 (PCHAR)FailedAssertion,
548 LineNumber);
549 }
550
552}
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 LineNumber
Definition: acpixf.h:1220
DECLSPEC_NORETURN VOID FrLdrBugCheckWithMessage(ULONG BugCode, PCHAR File, ULONG Line, PCSTR Format,...)
Definition: debug.c:30
@ ASSERT_FAILURE
Definition: debug.h:159
static const WCHAR Message[]
Definition: register.c:74
#define DbgPrint
Definition: hal.h:12
const char * PCSTR
Definition: typedefs.h:52
char * PCHAR
Definition: typedefs.h:51
NTSYSAPI void WINAPI DbgBreakPoint(void)

Referenced by USBPORT_AssertFailure().

Variable Documentation

◆ BugCheckInfo

ULONG_PTR BugCheckInfo[5]

Definition at line 566 of file debug.c.

Referenced by FrLdrBugCheckEx().

◆ BugCodeStrings

char* BugCodeStrings[]
Initial value:
=
{
"TEST_BUGCHECK",
"MISSING_HARDWARE_REQUIREMENTS",
"FREELDR_IMAGE_CORRUPTION",
"MEMORY_INIT_FAILURE",
"ASSERT_FAILURE",
}

Definition at line 554 of file debug.c.

Referenced by FrLdrBugCheckEx(), and FrLdrBugCheckWithMessage().