Source code of Windows XP (NT5)
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.

82 lines
3.4 KiB

  1. /* asmdebug.h -- include file for microsoft 80x86 assembler
  2. **
  3. ** microsoft (r) macro assembler
  4. ** copyright (c) microsoft corp 1986. all rights reserved
  5. **
  6. ** randy nevin
  7. */
  8. /*** Output debugging information
  9. * Ross Garmoe
  10. * Copyright Microsoft Corporation, 1983
  11. * September 27, 9 1983
  12. *
  13. * This package was developed using concepts originally developed by
  14. * Mark Zibokowski for the C version of the z editor.
  15. *
  16. * The following set of macros output debugging information to the
  17. * debugging file 'd_df'. Output of debugging information is controlled
  18. * by compile time conditionals and flags set by execution time switches.
  19. * If the symbol DEBUG is defined at compile time, the macros are
  20. * compiled to generate debugging information. If DEBUG is not defined,
  21. * then the macros are not compiled. At execution time, the value of
  22. * the variable 'd_debug' is compared with the value of the defined symbol
  23. * DEBFLAG and if any bits match, debugging information is written.
  24. * If debugging information is to be written, the information level
  25. * specified in the macro is checked against the level specified at run
  26. * time and information is written only if the compile level is less than
  27. * the level specified at run time.
  28. *
  29. * The macros are used as follows:
  30. *
  31. * Define the global variables 'd_debug', 'd_dlevel', 'd_indent' and 'd_sindent'
  32. * as integers and 'd_df' as a pointer to FILE. In the argument processing
  33. * routine set the value of 'd_debug' and 'd_dlevel' and open the trace output
  34. * file and point to it with the variable 'd_df'. 'd_debug' , 'd_dlevel' and
  35. * 'd_indent' must be intialized to zero.
  36. *
  37. * In any file of the program which is to produce debugging output,
  38. * include this file 'debug.h' and define the selection symbol DEBFLAG.
  39. *
  40. * #include debug.h
  41. * #define DEBFLAG value
  42. *
  43. * Then for any function which is to produce debug output include the
  44. * following sets of macro calls.
  45. *
  46. * At fuction entry:
  47. *
  48. * INDEBUG;
  49. * DEBOUT (level, ( fprintf argument string ));
  50. *
  51. * At all function exits:
  52. *
  53. * DEBOUT (level, ( fprintf argument string ));
  54. * OUTDEBUG;
  55. *
  56. * At other points of interest:
  57. *
  58. * DEBOUT (level, ( fprintf argument string ));
  59. *
  60. * Note: For the entry and exit points, the DEBOUT ((...)); string
  61. * is optional. The INDEBUG and OUTDEBUG macros control the
  62. * indentation of the debug output to show the nesting levels of
  63. * function calls
  64. * Note: The fprintf argument string is of the form:
  65. * d_df, "format", arg1, arg2,..., argn
  66. */
  67. #ifdef DEBUG
  68. # define INDEBUG if(d_debug&DEBFLAG)d_indent++
  69. # define DEBOUT(l,z) if(d_debug&DEBFLAG&&l<=d_dlevel)\
  70. {for(d_sindent=d_indent;d_sindent;d_sindent--)fprintf(d_df," ");\
  71. fprintf z ;}else
  72. # define OUTDEBUG if(d_debug&DEBFLAG)d_indent--
  73. extern long d_debug, d_dlevel, d_indent; /* debugging flags */
  74. extern long d_sindent; /* indentation printing temporary */
  75. extern FILE *d_df; /* pointer to debug output file */
  76. #else
  77. # define INDEBUG
  78. # define DEBOUT(l,z)
  79. # define OUTDEBUG
  80. #endif