assert.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*++
  2. Copyright (c) 2012 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. assert.c
  5. Abstract:
  6. This module implements assertions for the kernel runtime library.
  7. Author:
  8. Evan Green 25-Jul-2012
  9. Environment:
  10. Kernel
  11. --*/
  12. //
  13. // ------------------------------------------------------------------- Includes
  14. //
  15. #include "rtlp.h"
  16. #include <minoca/kernel/arch.h>
  17. #include <minoca/kernel/hmod.h>
  18. #include <minoca/kernel/kdebug.h>
  19. //
  20. // ---------------------------------------------------------------- Definitions
  21. //
  22. //
  23. // ----------------------------------------------- Internal Function Prototypes
  24. //
  25. //
  26. // ------------------------------------------------------ Data Type Definitions
  27. //
  28. //
  29. // -------------------------------------------------------------------- Globals
  30. //
  31. //
  32. // ------------------------------------------------------------------ Functions
  33. //
  34. RTL_API
  35. VOID
  36. RtlRaiseAssertion (
  37. PSTR Expression,
  38. PSTR SourceFile,
  39. ULONG SourceLine
  40. )
  41. /*++
  42. Routine Description:
  43. This routine raises an assertion failure exception. If a debugger is
  44. connected, it will attempt to connect to the debugger.
  45. Arguments:
  46. Expression - Supplies the string containing the expression that failed.
  47. SourceFile - Supplies the string describing the source file of the failure.
  48. SourceLine - Supplies the source line number of the failure.
  49. Return Value:
  50. None.
  51. --*/
  52. {
  53. RtlDebugPrint("\n\n *** Assertion Failure: %s\n *** File: %s, Line %d\n\n",
  54. Expression,
  55. SourceFile,
  56. SourceLine);
  57. RtlDebugService(EXCEPTION_ASSERTION_FAILURE, NULL);
  58. return;
  59. }
  60. //
  61. // --------------------------------------------------------- Internal Functions
  62. //