Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
1.9 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. debug.c
  5. Abstract:
  6. Various helpful debugging functions
  7. Author:
  8. Based on code by Mike Tsang (MikeTs)
  9. Stephane Plante (Splante)
  10. Environment:
  11. User mode only
  12. Revision History:
  13. --*/
  14. #include "pch.h"
  15. ULONG globalDebugIndentLevel = 0;
  16. ULONG globalVerbosityLevel = 0;
  17. VOID
  18. CDECL
  19. DebugEnterProcedure(
  20. ULONG VerbosityLevel,
  21. PCCHAR Format,
  22. ...
  23. )
  24. /*++
  25. Routine Description:
  26. This routine handles displaying of information when a procedure is
  27. entered
  28. Arguments:
  29. Verbosity - We have to be at this verbosity level to display a string
  30. Format - String to print
  31. ... - Arguments
  32. Return Value:
  33. None
  34. --*/
  35. {
  36. ULONG i;
  37. va_list marker;
  38. if (VerbosityLevel <= globalVerbosityLevel) {
  39. for (i = 0 ; i < globalDebugIndentLevel ; i++) {
  40. fprintf( stderr, "| ");
  41. }
  42. va_start( marker, Format );
  43. vfprintf( stderr, Format, marker );
  44. fflush( stderr );
  45. va_end ( marker );
  46. }
  47. globalDebugIndentLevel++;
  48. }
  49. VOID
  50. CDECL
  51. DebugExitProcedure(
  52. ULONG VerbosityLevel,
  53. PCCHAR Format,
  54. ...
  55. )
  56. /*++
  57. Routine Description:
  58. This routine handles displaying of information when a procedure is
  59. exited
  60. Arguments:
  61. Verbosity - We have to be at this verbosity level to display a string
  62. Format - String to print
  63. ... - Arguments
  64. Return Value:
  65. None
  66. --*/
  67. {
  68. ULONG i;
  69. va_list marker;
  70. globalDebugIndentLevel--;
  71. if (VerbosityLevel <= globalVerbosityLevel) {
  72. for (i = 0 ; i < globalDebugIndentLevel ; i++) {
  73. fprintf( stderr, "| ");
  74. }
  75. va_start( marker, Format );
  76. vfprintf( stderr, Format, marker );
  77. fflush( stderr );
  78. va_end ( marker );
  79. }
  80. }