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.

593 lines
21 KiB

  1. //DBUG.DLL main header
  2. #ifndef DBUG_H
  3. #define DBUG_H
  4. #define DllExport __declspec(dllexport)
  5. #define DllImport __declspec(dllimport)
  6. //USERDBUG is defined by users who want to use IMallocSpy
  7. //but not the rest of the stuff in here.
  8. #ifdef USERDBUG
  9. #if defined(DEBUG) || defined(_DEBUG)
  10. #ifdef __cplusplus
  11. extern "C"
  12. {
  13. DllImport BOOL WINAPI InstallIMallocSpy(void);
  14. DllImport void WINAPI RemoveIMallocSpy(BOOL fCheck);
  15. DllImport void WINAPI IMallocSpyReport(void);
  16. }
  17. #else
  18. DllImport BOOL WINAPI InstallIMallocSpy(void);
  19. DllImport void WINAPI RemoveIMallocSpy(BOOL fCheck);
  20. DllImport void WINAPI IMallocSpyReport(void);
  21. #endif //_cplusplus
  22. //Macros for Install/Remove IMallocSpy
  23. #define INSTALLIMALLOCSPY() InstallIMallocSpy()
  24. #define REMOVEIMALLOCSPY(f) RemoveIMallocSpy(f)
  25. #define IMALLOCSPYREPORT() IMallocSpyReport()
  26. #else
  27. #define INSTALLIMALLOCSPY()
  28. #define REMOVEIMALLOCSPY(f)
  29. #define IMALLOCSPYREPORT()
  30. #endif //DEBUG
  31. #else //USERDBUG
  32. //
  33. //This is stuff from dbugit.h that is here for compatibility
  34. //with existing code.
  35. //
  36. #if defined(DEBUG) || defined(MEMCHECK) || defined(_DEBUG) || defined(_RELEASE_ASSERTS_)
  37. typedef struct _assertfile
  38. {
  39. char *szFile;
  40. INT ifte;
  41. } ASSERTFILE;
  42. #if !defined(MACPORT)
  43. #define ASSERTDATA static char _szFile[] = __FILE__; \
  44. static ASSERTFILE _asfile = {_szFile, -1};
  45. #else
  46. #ifdef AssertData // Mso's version of AssertData to work with its asserts.
  47. #define ASSERTDATA AssertData
  48. #else
  49. need to include msodebug.h before DBUG32.h
  50. #endif
  51. #endif
  52. #else // DEBUG || MEMCHECK
  53. #define ASSERTDATA
  54. #endif // DEBUG || MEMCHECK, else
  55. #if defined(DEBUG) || defined(_DEBUG) || defined(_RELEASE_ASSERTS_)
  56. #define FFromTag FALSE
  57. //TODO this isn't used and references should be removed.
  58. extern BOOL fInAssert;
  59. #endif
  60. //
  61. //This is new stuff for dbug32.dll
  62. //
  63. #if !defined(PEGASUS) && !defined(MACPORT) && (defined(DEBUG) || defined(_DEBUG) || defined(_RELEASE_ASSERTS_))
  64. //macport change until dbug32 accessed
  65. //we are also not doing this for WinCE right now
  66. //#if defined(DEBUG) || defined(_DEBUG) //orig code
  67. //This is the buffer length used for building messages
  68. #define MAXDEBUGSTRLEN (MAX_PATH + MAX_PATH)
  69. #ifndef _RELEASE_ASSERTS_
  70. //The following constants are used to specify and interpret
  71. //packed values in the DWORD flags parameter passed to TraceMsg.
  72. //Each of these is held in a 4-bit field in the DWORD.
  73. //Subsystem field values
  74. #define TRCSUBSYSNONE 0x0
  75. #define TRCSUBSYSDISP 0x1
  76. #define TRCSUBSYSWRAP 0x2
  77. #define TRCSUBSYSEDIT 0x3
  78. #define TRCSUBSYSTS 0x4
  79. #define TRCSUBSYSTOM 0x5
  80. #define TRCSUBSYSOLE 0x6
  81. #define TRCSUBSYSBACK 0x7
  82. #define TRCSUBSYSSEL 0x8
  83. #define TRCSUBSYSHOST 0x9
  84. #define TRCSUBSYSDTE 0xa
  85. #define TRCSUBSYSUNDO 0xb
  86. #define TRCSUBSYSRANG 0xc
  87. #define TRCSUBSYSUTIL 0xd
  88. #define TRCSUBSYSNOTM 0xe
  89. #define TRCSUBSYSRTFR 0xf
  90. #define TRCSUBSYSRTFW 0x10
  91. #define TRCSUBSYSPRT 0x11
  92. #define TRCSUBSYSFE 0x12
  93. #define TRCSUBSYSFONT 0x13
  94. //Severity field values
  95. #define TRCSEVNONE 0x0
  96. #define TRCSEVWARN 0x1
  97. #define TRCSEVERR 0x2
  98. #define TRCSEVASSERT 0x3
  99. #define TRCSEVINFO 0x4
  100. #define TRCSEVMEM 0x5
  101. //Scope field values
  102. #define TRCSCOPENONE 0x0
  103. #define TRCSCOPEEXTERN 0x1
  104. #define TRCSCOPEINTERN 0x2
  105. //Data field values
  106. #define TRCDATANONE 0x0
  107. #define TRCDATAHRESULT 0x1
  108. #define TRCDATASTRING 0x2
  109. #define TRCDATAPARAM 0x3
  110. #define TRCDATADEFAULT 0x4
  111. //Debug option flags. See the macros in this header for setting and testing
  112. //these option flags.
  113. #define OPTUSEDEFAULTS 0x00000001 //Use defaults from win.ini
  114. //(used only with InitDebugServices).
  115. #define OPTHEAPVALON 0x00000002 //Heap validation for all traces
  116. #define OPTHEAPVALEXT 0x00000004 //Heap validation for external traces only
  117. #define OPTLOGGINGON 0x00000008 //Logging of trace output
  118. #define OPTVERBOSEON 0x00000010 //Subsys, Scope & PID/TID
  119. #define OPTINFOON 0x00000020 //Informational messages
  120. #define OPTTRACEON 0x00000040 //All function tracing on
  121. #define OPTTRACEEXT 0x00000080 //Function tracing only for external functions
  122. #define OPTMEMORYON 0x00000100 //Memory alloc/free tracing on
  123. //The following options allow tracing to be enabled for one or more
  124. //specific subsystems. If OPTTRACEON is set, these will have no effect.
  125. //if OPTTRACEEXT is set, they will enable tracing for all functions in
  126. //the designated subsystem in addition to external functions.
  127. //The SETOPT and ISOPTSET macros should be used for setting and checking
  128. //these options. INITDEBUGSERVICES can also be used.
  129. #define OPTTRACEDISP 0x00001000 //Function tracing for Display subsystem
  130. #define OPTTRACEWRAP 0x00002000 //Function tracing for Wrapper subsystem
  131. #define OPTTRACEEDIT 0x00004000 //Function tracing for Edit subsystem
  132. #define OPTTRACETS 0x00008000 //Function tracing for TextServices subsystem
  133. #define OPTTRACETOM 0x00010000 //Function tracing for TOM subsystem
  134. #define OPTTRACEOLE 0x00020000 //Function tracing for OLE support subsystem
  135. #define OPTTRACEBACK 0x00040000 //Function tracing for Backing Store subsystem
  136. #define OPTTRACESEL 0x00080000 //Function tracing for Selection subsystem
  137. #define OPTTRACEHOST 0x00100000 //Function tracing for WinHost subsystem
  138. #define OPTTRACEDTE 0x00200000 //Function tracing for DataXfer subsystem
  139. #define OPTTRACEUNDO 0x00400000 //Function tracing for Muli-undo subsystem
  140. #define OPTTRACERANG 0x00800000 //Function tracing for Range subsystem
  141. #define OPTTRACEUTIL 0x01000000 //Function tracing for Utility subsystem
  142. #define OPTTRACENOTM 0x02000000 //Function tracing for Notification Mgr subsystem
  143. #define OPTTRACERTFR 0x04000000 //Function tracing for RTF reader subsystem
  144. #define OPTTRACERTFW 0x08000000 //Function tracing for RTF writer subsystem
  145. #define OPTTRACEPRT 0x10000000 //Function tracing for Printing subsystem
  146. #define OPTTRACEFE 0x20000000 //Function tracing for Far East subsystem
  147. #define OPTTRACEFONT 0x40000000 //Function tracing for Font Cache
  148. //Union for handling tracing flags
  149. //This union is used to decode the
  150. //packed DWORD passed to TraceMsg.
  151. typedef union
  152. {
  153. struct
  154. {
  155. unsigned uData2 :4;
  156. unsigned uData1 :4;
  157. unsigned uScope :4;
  158. unsigned uSeverity :4;
  159. unsigned uSubSystem :8;
  160. unsigned uUnused1 :4;
  161. unsigned uUnused2 :4;
  162. } fields;
  163. DWORD dw;
  164. } TrcFlags;
  165. //Exported classes and functions.
  166. //Generally, these should not be used directly by the user.
  167. //They should be used via the macros defined in this header.
  168. //This helps to ensure that the parameter lists are well
  169. //formed and keeps references to them from showing up in
  170. //in non-debug builds.
  171. //This class is used to implement the function Entry/Exit
  172. //tracing. By declaring it on the stack at the beginning
  173. //of a function, Entry and Exit messages are automatically
  174. //generated by the constructor and destructor.
  175. class DllExport CTrace
  176. {
  177. public:
  178. CTrace(DWORD, DWORD, DWORD, LPSTR);
  179. ~CTrace();
  180. private:
  181. TrcFlags trcf;
  182. char szFileName[MAXDEBUGSTRLEN];
  183. char szFuncName[80];
  184. };
  185. DllImport DWORD dwDebugOptions;
  186. DllImport void WINAPI SetLogging(BOOL);
  187. DllImport void WINAPI Tracef(DWORD, LPSTR szFmt, ...);
  188. DllImport void WINAPI TraceError(LPSTR sz, LONG sc);
  189. extern "C"
  190. {
  191. DllImport BOOL WINAPI InstallIMallocSpy(void);
  192. DllImport void WINAPI RemoveIMallocSpy(BOOL fCheck);
  193. DllImport void WINAPI IMallocSpyReport(void);
  194. DllImport void WINAPI TrackBlock(void *pMem);
  195. }
  196. #endif //!_RELEASE_ASSERTS_
  197. typedef BOOL (CALLBACK * PFNASSERTHOOK)(LPSTR, LPSTR, int*);
  198. typedef BOOL (CALLBACK * PFNTRACEHOOK)(DWORD*, DWORD*, DWORD*, LPSTR, int*);
  199. DllImport PFNTRACEHOOK pfnTrace;
  200. DllImport PFNASSERTHOOK pfnAssert;
  201. DllImport void WINAPI Dbug32AssertSzFn(LPSTR, LPSTR, int);
  202. DllImport void WINAPI TraceMsg(DWORD, DWORD, DWORD, LPSTR, int);
  203. DllImport void WINAPI InitDebugServices(DWORD, PFNASSERTHOOK, PFNTRACEHOOK);
  204. //Assert based on boolean f.
  205. #ifndef Assert
  206. #define Assert(f) AssertSz((f), NULL)
  207. #endif
  208. //Assert based on boolean f in debug, resolve to f in non-debug.
  209. #ifndef SideAssert
  210. #define SideAssert(f) AssertSz((f), NULL)
  211. #endif
  212. //Assert based on boolean f and use string sz in assert message.
  213. #ifndef AssertSz
  214. #define AssertSz(f, sz) (!(f) ? Dbug32AssertSzFn(sz, __FILE__, __LINE__) : 0);
  215. #endif
  216. //Set an assert or trace hook function. The function specified will be called
  217. //before the default functionality executes. Pointers to all parameters are passed
  218. //to the hook to allow it to modify them. If the hook function returns false,
  219. //default functionality is terminated. If the hook function returns true, default
  220. //functionality continues with the potentially modified parameters. pfn can
  221. //be NULL (default functionality only).
  222. #define SETASSERTFN(pfn) (pfnAssert = (pfn))
  223. #ifndef _RELEASE_ASSERTS_
  224. //Assert only on debug builds, not on _RELEASE_ASSERTS_ builds
  225. //This is for asserts that contain debug only code
  226. #ifndef AssertNr
  227. #define AssertNr(f) AssertSz((f), NULL)
  228. #endif
  229. #ifndef AssertNrSz
  230. #define AssertNrSz(f, sz) (!(f) ? Dbug32AssertSzFn(sz, __FILE__, __LINE__) : 0);
  231. #endif
  232. //This is a utility macro for internal use. The user should not need this.
  233. #define MAKEFLAGS(ss, sv, sc, d1, d2) ((ss << 16) + (sv << 12) + (sc << 8)\
  234. + (d1 << 4) + (d2))
  235. //The following macros provide access to the debug services in this dll.
  236. //Assert macros pop a dialog. Trace macros output to debug output and
  237. //logfile if enabled.
  238. //Macro for InitDebugServices
  239. #define INITDEBUGSERVICES(f, pfnA, pfnT) InitDebugServices(f, pfnA, pfnT)
  240. //Macros for Install/Remove IMallocSpy
  241. #define INSTALLIMALLOCSPY() InstallIMallocSpy()
  242. #define REMOVEIMALLOCSPY(f) RemoveIMallocSpy(f)
  243. #define IMALLOCSPYREPORT() IMallocSpyReport()
  244. //Macro for TraceError
  245. #define TRACEERRSZSC(sz, sc) TraceError(sz, sc)
  246. //Warning based on GetLastError or default message if no last error.
  247. #define TRACEWARN TraceMsg(MAKEFLAGS(TRCSUBSYSNONE, TRCSEVWARN,\
  248. TRCSCOPENONE, TRCDATADEFAULT, TRCDATANONE),\
  249. (DWORD)0, (DWORD)0, __FILE__, __LINE__)
  250. //Error based on GetLastError or default message if no last error.
  251. #define TRACEERROR TraceMsg(MAKEFLAGS(TRCSUBSYSNONE, TRCSEVERR,\
  252. TRCSCOPENONE, TRCDATADEFAULT, TRCDATANONE),\
  253. (DWORD)0, (DWORD)0, __FILE__, __LINE__)
  254. //Warning based on HRESULT hr
  255. #define TRACEWARNHR(hr) TraceMsg(MAKEFLAGS(TRCSUBSYSNONE, TRCSEVWARN,\
  256. TRCSCOPENONE, TRCDATAHRESULT, TRCDATANONE),\
  257. (DWORD)(hr), (DWORD)0, __FILE__, __LINE__)
  258. //Test for a failure HR && warn
  259. #define TESTANDTRACEHR(hr) if( hr < 0 ) { TRACEWARNHR(hr); }
  260. //Error based on HRESULT hr
  261. #define TRACEERRORHR(hr) TraceMsg(MAKEFLAGS(TRCSUBSYSNONE, TRCSEVERR,\
  262. TRCSCOPENONE, TRCDATAHRESULT, TRCDATANONE),\
  263. (DWORD)(hr), (DWORD)0, __FILE__, __LINE__)
  264. //Warning using string sz
  265. #define TRACEWARNSZ(sz) TraceMsg(MAKEFLAGS(TRCSUBSYSNONE, TRCSEVWARN,\
  266. TRCSCOPENONE, TRCDATASTRING, TRCDATANONE),\
  267. (DWORD)(sz), (DWORD)0, __FILE__, __LINE__)
  268. //Error using string sz
  269. #define TRACEERRORSZ(sz) TraceMsg(MAKEFLAGS(TRCSUBSYSNONE, TRCSEVERR,\
  270. TRCSCOPENONE, TRCDATASTRING, TRCDATANONE),\
  271. (DWORD)(sz), (DWORD)0, __FILE__, __LINE__)
  272. //Error using string sz
  273. #define TRACEINFOSZ(sz) TraceMsg(MAKEFLAGS(TRCSUBSYSNONE, TRCSEVINFO,\
  274. TRCSCOPENONE, TRCDATASTRING, TRCDATANONE),\
  275. (DWORD)(sz), (DWORD)0, __FILE__, __LINE__)
  276. //Initiate tracing. This declares an instance of the CTtrace class
  277. //on the stack. Subsystem (ss), Scope (sc), and the function name
  278. //(sz) must be specifed. ss and sc are specified using the macros
  279. //defined in this header (i.e. - TRCSUBSYSTOM, TRCSCOPEEXTERN, etc.).
  280. //sz can be a static string.
  281. #define TRACEBEGIN(ss, sc, sz) CTrace trc(MAKEFLAGS((ss), TRCSEVNONE,\
  282. (sc), TRCDATASTRING, TRCDATANONE),\
  283. (DWORD)(sz), (DWORD)0, __FILE__)
  284. //Same as TRACEBEGIN but it takes the additional param which is interpreted
  285. //by TraceMsg as a Text Message request.
  286. #define TRACEBEGINPARAM(ss, sc, sz, param) \
  287. CTrace trc(MAKEFLAGS((ss), TRCSEVNONE,\
  288. (sc), TRCDATASTRING, TRCDATAPARAM),\
  289. (DWORD)(sz), (DWORD)(param), __FILE__)
  290. //Set Heap Validation for all traces to on (f = TRUE) or off (f = FALSE).
  291. //If this is set to "on", OPTHEAPVALEXT is ignored.
  292. #define SETHEAPVAL(f) ((f) ? (dwDebugOptions |= OPTHEAPVALON) :\
  293. (dwDebugOptions &= ~OPTHEAPVALON))
  294. //Set Heap Validation for EXTERNAL scope calls only to on (f = TRUE)
  295. //or off (f = FALSE). This is only effective if OPTHEAPVALON has not
  296. //been set.
  297. #define SETHEAPVALEXT(f) ((f) ? (dwDebugOptions |= OPTHEAPVALEXT) :\
  298. (dwDebugOptions &= ~OPTHEAPVALEXT))
  299. //Set logging to on (f = TRUE) or off (f = FALSE)
  300. #define SETLOGGING(f) SetLogging(f)
  301. //Set output of process & thread IDs to on (f = TRUE) or off (f = FALSE)
  302. #define SETVERBOSE(f) ((f) ? (dwDebugOptions |= OPTVERBOSEON) :\
  303. (dwDebugOptions &= ~OPTVERBOSEON))
  304. //Set information messages to on (f = TRUE) or off (f = FALSE)
  305. #define SETINFO(f) ((f) ? (dwDebugOptions |= OPTINFOON) :\
  306. (dwDebugOptions &= ~OPTINFOON))
  307. //Set information messages to on (f = TRUE) or off (f = FALSE)
  308. #define SETMEMORY(f) ((f) ? (dwDebugOptions |= OPTMEMORYON) :\
  309. (dwDebugOptions &= ~OPTMEMORYON))
  310. //Set tracing for all functions to on (f = TRUE) or off (f = FALSE).
  311. //If this is set to "on", external and subsystem level tracing
  312. //has no effect since all function traces are enabled. If it is off,
  313. //external and subsystem level tracing remain in whatever state they
  314. //have been set to.
  315. #define SETTRACING(f) ((f) ? (dwDebugOptions |= OPTTRACEON) :\
  316. (dwDebugOptions &= ~OPTTRACEON))
  317. //Set tracing for EXTERNAL scope calls only to on (f = TRUE)
  318. //or off (f = FALSE). This is only effective if OPTTRACEON has not
  319. //been set.
  320. #define SETTRACEEXT(f) ((f) ? (dwDebugOptions |= OPTTRACEEXT) :\
  321. (dwDebugOptions &= ~OPTTRACEEXT))
  322. //This macro turns all function tracing off.
  323. #define SETALLTRACEOFF (dwDebugOptions &= ~(OPTTRACEEXT | OPTTRACEON | 0xfffff000))
  324. //This macro sets a given option or options (if they are or'ed together)
  325. //to on (f = TRUE), or off (f = FALSE). It cannot be used to set logging.
  326. #define SETOPT(opt, f) ((f) ? (dwDebugOptions |= (opt)) :\
  327. (dwDebugOptions &= (~(opt))))
  328. //This macro determines the state of a given option.
  329. #define ISOPTSET(opt) ((opt) & dwDebugOptions)
  330. //Set an assert or trace hook function. The function specified will be called
  331. //before the default functionality executes. Pointers to all parameters are passed
  332. //to the hook to allow it to modify them. If the hook function returns false,
  333. //default functionality is terminated. If the hook function returns true, default
  334. //functionality continues with the potentially modified parameters. pfn can
  335. //be NULL (default functionality only).
  336. #define SETTRACEFN(pfn) (pfnTrace = (pfn))
  337. //The following option tests are explicitly defined for convenience.
  338. #define fHeapVal (OPTHEAPVALON & dwDebugOptions)
  339. #define fHeapValExt (OPTHEAPVALEXT & dwDebugOptions)
  340. #define fLogging (OPTLOGGINGON & dwDebugOptions)
  341. #define fVerbose (OPTVERBOSEON & dwDebugOptions)
  342. #define fInfo (OPTINFOON & dwDebugOptions)
  343. #define fMemory (OPTMEMORYON & dwDebugOptions)
  344. #define fTrace (OPTTRACEON & dwDebugOptions)
  345. #define fTraceExt (OPTTRACEEXT & dwDebugOptions)
  346. //IMallocSpy
  347. class CImpIMallocSpy : public IMallocSpy
  348. {
  349. private:
  350. ULONG m_cRef;
  351. public:
  352. ULONG m_cAlloc;
  353. CImpIMallocSpy (void);
  354. ~CImpIMallocSpy (void);
  355. //IUnknown members.
  356. STDMETHODIMP QueryInterface (REFIID riid, LPVOID * ppUnk);
  357. STDMETHODIMP_(ULONG) AddRef (void);
  358. STDMETHODIMP_(ULONG) Release (void);
  359. //IMallocSpy members
  360. STDMETHODIMP_(ULONG) PreAlloc (ULONG cbRequest);
  361. STDMETHODIMP_(void *) PostAlloc (void * pActual);
  362. STDMETHODIMP_(void *) PreFree (void * pRequest, BOOL fSpyed);
  363. STDMETHODIMP_(void) PostFree (BOOL fSpyed);
  364. STDMETHODIMP_(ULONG) PreRealloc (void * pRequest,
  365. ULONG cbRequest,
  366. void ** ppNewRequest,
  367. BOOL fSpyed);
  368. STDMETHODIMP_(void *) PostRealloc (void * pActual, BOOL fSpyed);
  369. STDMETHODIMP_(void *) PreGetSize (void * pRequest, BOOL fSpyed);
  370. STDMETHODIMP_(ULONG) PostGetSize (ULONG cbActual, BOOL fSpyed);
  371. STDMETHODIMP_(void *) PreDidAlloc (void * pRequest, BOOL fSpyed);
  372. STDMETHODIMP_(BOOL) PostDidAlloc (void * pRequest, BOOL fSpyed,
  373. BOOL fActual);
  374. STDMETHODIMP_(void) PreHeapMinimize (void);
  375. STDMETHODIMP_(void) PostHeapMinimize (void);
  376. // memory tracing stuff
  377. public:
  378. void MemoryReport(void) { _memlist.Report(); }
  379. public:
  380. class CMemTagList
  381. {
  382. public:
  383. CMemTagList() : _dwAllocId(0), _pmemtHead(NULL) {}
  384. ~CMemTagList();
  385. void Add(void *pv); // add a memory alloc tag to the list for alloc @ pv
  386. void Remove(void *pv); // remove the memory alloc tag for alloc @ pv
  387. void Report(void); // report on un-deallocated memory blocks
  388. private:
  389. struct MemTag
  390. {
  391. void *_pvLoc;
  392. DWORD _dwId;
  393. MemTag *_pmemtNext;
  394. // rewrite these if you want to use a different allocator to
  395. // maintain the memory allocation tag list
  396. #if 0
  397. void *operator new(size_t stSize)
  398. { return ::operator new(stSize); }
  399. void operator delete(void *pv) { ::operator delete(pv); }
  400. #endif
  401. };
  402. DWORD _dwAllocId;
  403. MemTag *_pmemtHead;
  404. } _memlist;
  405. };
  406. #else //_RELEASE_ASSERTS_
  407. //Functions not used by release build with asserts
  408. #ifndef AssertNr
  409. #define AssertNr(f)
  410. #endif
  411. #ifndef AssertNrSz
  412. #define AssertNrSz(f, sz)
  413. #endif
  414. #define Tracef ;/##/
  415. #define INSTALLIMALLOCSPY()
  416. #define REMOVEIMALLOCSPY(f)
  417. #define IMALLOCSPYREPORT()
  418. #define TRACEERRSZSC(sz, sc)
  419. #define TRACEWARN
  420. #define TRACEERROR
  421. #define TRACEWARNHR(hr)
  422. #define TESTANDTRACEHR(hr)
  423. #define TRACEERRORHR(hr)
  424. #define TRACEWARNSZ(sz)
  425. #define TRACEERRORSZ(sz)
  426. #define TRACEINFOSZ(sz)
  427. #define TRACEBEGIN(ss, sc, sz)
  428. #define TRACEBEGINPARAM(ss, sc, sz, param)
  429. #define SETHEAPVAL(f)
  430. #define SETHEAPVALEXT(f)
  431. #define SETLOGGING(f)
  432. #define SETVERBOSE(f)
  433. #define SETINFO(f)
  434. #define SETMEMORY(f)
  435. #define SETTRACING(f)
  436. #define SETTRACEEXT(f)
  437. #define SETALLTRACEOFF
  438. #define SETOPT(opt, f)
  439. #define ISOPTSET(opt)
  440. #define SETTRACEFN(pfn)
  441. #define TraceError(_sz, _sc) // MACPORT ADDED THIS - TraceError
  442. #endif //_RELEASE_ASSERTS_
  443. #else //DEBUG,_RELEASE_ASSERTS_
  444. #define Tracef ;/##/
  445. #define INITDEBUGSERVICES(f, pfnA, pfnT)
  446. #define INSTALLIMALLOCSPY()
  447. #define REMOVEIMALLOCSPY(f)
  448. #define IMALLOCSPYREPORT()
  449. #define TRACEERRSZSC(sz, sc)
  450. #ifndef Assert
  451. #define Assert(f)
  452. #endif
  453. #ifndef SideAssert
  454. #define SideAssert(f) (f)
  455. #endif
  456. #ifndef AssertSz
  457. #define AssertSz(f, sz)
  458. #endif
  459. #ifndef AssertNr
  460. #define AssertNr(f)
  461. #endif
  462. #ifndef AssertNrSz
  463. #define AssertNrSz(f, sz)
  464. #endif
  465. #define TRACEWARN
  466. #define TRACEERROR
  467. #define TRACEWARNHR(hr)
  468. #define TESTANDTRACEHR(hr)
  469. #define TRACEERRORHR(hr)
  470. #define TRACEWARNSZ(sz)
  471. #define TRACEERRORSZ(sz)
  472. #define TRACEINFOSZ(sz)
  473. #define TRACEBEGIN(ss, sc, sz)
  474. #define TRACEBEGINPARAM(ss, sc, sz, param)
  475. #define SETHEAPVAL(f)
  476. #define SETHEAPVALEXT(f)
  477. #define SETLOGGING(f)
  478. #define SETVERBOSE(f)
  479. #define SETINFO(f)
  480. #define SETMEMORY(f)
  481. #define SETTRACING(f)
  482. #define SETTRACEEXT(f)
  483. #define SETALLTRACEOFF
  484. #define SETOPT(opt, f)
  485. #define ISOPTSET(opt)
  486. #define SETASSERTFN(pfn)
  487. #define SETTRACEFN(pfn)
  488. // debugging for Mac, maybe someday we'll convert dbug32.dll to run on Macs, for now, use Mso debuggin stuff.
  489. #ifdef MACPORTMsoTrace
  490. #if defined(DEBUG) || defined(_DEBUG) // For Mac, MsoTraceSz writes to trace.txt, a file, and is slow
  491. #undef TRACEBEGIN // because of constant vol flushing, but if you need it turned on...
  492. #define TRACEBEGIN(ss, sc, sz) MsoTraceSz(sz)
  493. #endif
  494. #endif
  495. #define Dbug32AssertSzFn(sz, __FILE__, __LINE__) // MACPORT ADDED THIS - Dbug32AssertSzFn
  496. #define TraceError(_sz, _sc) // MACPORT ADDED THIS - TraceError
  497. #endif //DEBUG
  498. #endif //USERDBUG
  499. #endif //DBUG_H