Adding pure.h pure_api.c to the build. bug#16695

This commit is contained in:
warren%netscape.com 1999-10-29 03:26:50 +00:00
Родитель 4406d6612d
Коммит 5a5994f0bb
4 изменённых файлов: 269 добавлений и 0 удалений

Просмотреть файл

@ -39,6 +39,7 @@ EXPORTS = \
nsWeakReference.h \
nsWeakPtr.h \
nscore.h \
pure.h \
$(NULL)
XPIDL_MODULE = xpcom_base
@ -83,6 +84,9 @@ CPP_OBJS = \
!ifdef GC_LEAK_DETECTOR
.\$(OBJDIR)\nsGarbageCollector.obj \
.\$(OBJDIR)\nsLeakDetector.obj \
!endif
!ifdef MOZ_DEBUG
.\$(OBJDIR)\pure_api.obj \
!endif
$(NULL)

135
xpcom/base/pure.h Normal file
Просмотреть файл

@ -0,0 +1,135 @@
/*
* Header file of Pure API function declarations.
*
* Explicitly no copyright.
* You may recompile and redistribute these definitions as required.
*
* Version 1.0
*/
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
#define PURE_H_VERSION 1
//////////////////////////////
// API's Specific to Purify //
//////////////////////////////
// TRUE when Purify is running.
int __cdecl PurifyIsRunning(void) ;
//
// Print a string to the viewer.
//
int __cdecl PurePrintf(const char *fmt, ...) ;
int __cdecl PurifyPrintf(const char *fmt, ...) ;
//
// Purify functions for leak and memory-in-use functionalty.
//
int __cdecl PurifyNewInuse(void) ;
int __cdecl PurifyAllInuse(void) ;
int __cdecl PurifyClearInuse(void) ;
int __cdecl PurifyNewLeaks(void) ;
int __cdecl PurifyAllLeaks(void) ;
int __cdecl PurifyClearLeaks(void) ;
//
// Purify functions for handle leakage.
//
int __cdecl PurifyAllHandlesInuse(void) ;
int __cdecl PurifyNewHandlesInuse(void) ;
//
// Functions that tell you about the state of memory.
//
int __cdecl PurifyDescribe(void *addr) ;
int __cdecl PurifyWhatColors(void *addr, int size) ;
//
// Functions to test the state of memory. If the memory is not
// accessable, an error is signaled just as if there were a memory
// reference and the function returns false.
//
int __cdecl PurifyAssertIsReadable(const void *addr, int size) ;
int __cdecl PurifyAssertIsWritable(const void *addr, int size) ;
//
// Functions to test the state of memory. If the memory is not
// accessable, these functions return false. No error is signaled.
//
int __cdecl PurifyIsReadable(const void *addr, int size) ;
int __cdecl PurifyIsWritable(const void *addr, int size) ;
int __cdecl PurifyIsInitialized(const void *addr, int size) ;
//
// Functions to set the state of memory.
//
void __cdecl PurifyMarkAsInitialized(void *addr, int size) ;
void __cdecl PurifyMarkAsUninitialized(void *addr, int size) ;
//
// Functions to do late detection of ABWs, FMWs, IPWs.
//
#define PURIFY_HEAP_CRT 0xfffffffe
#define PURIFY_HEAP_ALL 0xfffffffd
#define PURIFY_HEAP_BLOCKS_LIVE 0x80000000
#define PURIFY_HEAP_BLOCKS_DEFERRED_FREE 0x40000000
#define PURIFY_HEAP_BLOCKS_ALL (PURIFY_HEAP_BLOCKS_LIVE|PURIFY_HEAP_BLOCKS_DEFERRED_FREE)
int __cdecl PurifyHeapValidate(unsigned int hHeap, unsigned int dwFlags, const void *addr) ;
int __cdecl PurifySetLateDetectScanCounter(int counter);
int __cdecl PurifySetLateDetectScanInterval(int seconds);
////////////////////////////////
// API's Specific to Quantify //
////////////////////////////////
// TRUE when Quantify is running.
int __cdecl QuantifyIsRunning(void) ;
//
// Functions for controlling collection
//
int __cdecl QuantifyDisableRecordingData(void) ;
int __cdecl QuantifyStartRecordingData(void) ;
int __cdecl QuantifyStopRecordingData(void) ;
int __cdecl QuantifyClearData(void) ;
int __cdecl QuantifyIsRecordingData(void) ;
// Add a comment to the dataset
int __cdecl QuantifyAddAnnotation(char *) ;
// Save the current data, creating a "checkpoint" dataset
int __cdecl QuantifySaveData(void) ;
////////////////////////////////
// API's Specific to Coverage //
////////////////////////////////
// TRUE when Coverage is running.
int __cdecl CoverageIsRunning(void) ;
//
// Functions for controlling collection
//
int __cdecl CoverageDisableRecordingData(void) ;
int __cdecl CoverageStartRecordingData(void) ;
int __cdecl CoverageStopRecordingData(void) ;
int __cdecl CoverageClearData(void) ;
int __cdecl CoverageIsRecordingData(void) ;
// Add a comment to the dataset
int __cdecl CoverageAddAnnotation(char *) ;
// Save the current data, creating a "checkpoint" dataset
int __cdecl CoverageSaveData(void) ;
////////////////////////////////
// API's Specific to Purelock //
////////////////////////////////
// TRUE when Purelock is running.
int __cdecl PurelockIsRunning(void) ;
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif

126
xpcom/base/pure_api.c Normal file
Просмотреть файл

@ -0,0 +1,126 @@
/*
* Header file of Pure API function declarations.
*
* Explicitly no copyright.
* You may recompile and redistribute these definitions as required.
*
* NOTE1: In some situations when compiling with MFC, you should
* enable the setting 'Not using precompiled headers' in Visual C++
* to avoid a compiler diagnostic.
*
* NOTE2: This file works through the use of deep magic. Calls to functions
* in this file are replaced with calls into the OCI runtime system
* when an instrumented version of this program is run.
*
* NOTE3: The static vars avoidGy_n (where n is a unique number) are used
* to prevent optimizing the functions away when compiler option
* /Gy is set. This is needed so that NOTE2 works properly.
*/
static int avoidGy_1;
static int avoidGy_2;
static int avoidGy_3;
static int avoidGy_4;
static int avoidGy_5;
static int avoidGy_6;
static int avoidGy_7;
static int avoidGy_8;
static int avoidGy_9;
static int avoidGy_10;
static int avoidGy_11;
static int avoidGy_12;
static int avoidGy_13;
static int avoidGy_14;
static int avoidGy_15;
static int avoidGy_16;
static int avoidGy_17;
static int avoidGy_18;
static int avoidGy_19;
static int avoidGy_20;
static int avoidGy_21;
static int avoidGy_22;
static int avoidGy_23;
static int avoidGy_24;
static int avoidGy_25;
static int avoidGy_26;
static int avoidGy_27;
static int avoidGy_28;
static int avoidGy_29;
static int avoidGy_30;
static int avoidGy_31;
static int avoidGy_32;
static int avoidGy_33;
static int avoidGy_34;
static int avoidGy_35;
static int avoidGy_36;
static int avoidGy_37;
static int avoidGy_38;
static int avoidGy_39;
static int avoidGy_40;
static int avoidGy_41;
static int avoidGy_42;
static int avoidGy_43;
static int avoidGy_44;
static int avoidGy_45;
static int avoidGy_46;
static int avoidGy_47;
static int avoidGy_48;
static int avoidGy_49;
static int avoidGy_50;
static int avoidGy_51;
static int avoidGy_52;
static int avoidGy_53;
static int avoidGy_54;
static int avoidGy_55;
static int avoidGy_56;
static int avoidGy_57;
static int avoidGy_58;
static int avoidGy_59;
static int avoidGy_60;
static int avoidGy_PL_01;
__declspec(dllexport) int __cdecl PurePrintf(const char *fmt, ...) { avoidGy_1++; fmt; return 0; }
__declspec(dllexport) int __cdecl PurifyIsRunning(void) { avoidGy_2++; return 0; }
__declspec(dllexport) int __cdecl PurifyPrintf(const char *fmt, ...) { avoidGy_3++; fmt; return 0; }
__declspec(dllexport) int __cdecl PurifyNewInuse(void) { avoidGy_4++; return 0; }
__declspec(dllexport) int __cdecl PurifyAllInuse(void) { avoidGy_5++; return 0; }
__declspec(dllexport) int __cdecl PurifyClearInuse(void) { avoidGy_6++; return 0; }
__declspec(dllexport) int __cdecl PurifyNewLeaks(void) { avoidGy_7++; return 0; }
__declspec(dllexport) int __cdecl PurifyAllLeaks(void) { avoidGy_8++; return 0; }
__declspec(dllexport) int __cdecl PurifyClearLeaks(void) { avoidGy_9++; return 0; }
__declspec(dllexport) int __cdecl PurifyAllHandlesInuse(void) { avoidGy_10++; return 0; }
__declspec(dllexport) int __cdecl PurifyNewHandlesInuse(void) { avoidGy_11++; return 0; }
__declspec(dllexport) int __cdecl PurifyDescribe(void *addr) { avoidGy_12++; addr; return 0; }
__declspec(dllexport) int __cdecl PurifyWhatColors(void *addr, int size) { avoidGy_13++; addr; size; return 0; }
__declspec(dllexport) int __cdecl PurifyAssertIsReadable(const void *addr, int size) { avoidGy_14++; addr; size; return 1; }
__declspec(dllexport) int __cdecl PurifyAssertIsWritable(const void *addr, int size) { avoidGy_15++; addr; size; return 1; }
__declspec(dllexport) int __cdecl PurifyIsReadable(const void *addr, int size) { avoidGy_16++; addr; size; return 1; }
__declspec(dllexport) int __cdecl PurifyIsWritable(const void *addr, int size) { avoidGy_17++; addr; size; return 1; }
__declspec(dllexport) int __cdecl PurifyIsInitialized(const void *addr, int size) { avoidGy_18++; addr; size; return 1; }
__declspec(dllexport) int __cdecl PurifyRed(void *addr, int size) { avoidGy_19++; addr; size; return 0; }
__declspec(dllexport) int __cdecl PurifyGreen(void *addr, int size) { avoidGy_20++; addr; size; return 0; }
__declspec(dllexport) int __cdecl PurifyYellow(void *addr, int size) { avoidGy_21++; addr; size; return 0; }
__declspec(dllexport) int __cdecl PurifyBlue(void *addr, int size) { avoidGy_22++; addr; size; return 0; }
__declspec(dllexport) int __cdecl PurifyMarkAsInitialized(void *addr, int size) { avoidGy_23++; addr; size; return 0; }
__declspec(dllexport) int __cdecl PurifyMarkAsUninitialized(void *addr, int size) { avoidGy_24++; addr; size; return 0; }
__declspec(dllexport) int __cdecl PurifyMarkForTrap(void *addr, int size) { avoidGy_25++; addr; size; return 0; }
__declspec(dllexport) int __cdecl PurifyMarkForNoTrap(void *addr, int size) { avoidGy_26++; addr; size; return 0; }
__declspec(dllexport) int __cdecl PurifyHeapValidate(unsigned int hHeap, unsigned int dwFlags, const void *addr)
{ avoidGy_27++; hHeap; dwFlags; addr; return 1; }
__declspec(dllexport) int __cdecl PurifySetLateDetectScanCounter(int counter) { avoidGy_28++; counter; return 0; };
__declspec(dllexport) int __cdecl PurifySetLateDetectScanInterval(int seconds) { avoidGy_29++; seconds; return 0; };
__declspec(dllexport) int __cdecl CoverageIsRunning(void) { avoidGy_30++; return 0; }
__declspec(dllexport) int __cdecl CoverageDisableRecordingData(void) { avoidGy_31++; return 0; }
__declspec(dllexport) int __cdecl CoverageStartRecordingData(void) { avoidGy_32++; return 0; }
__declspec(dllexport) int __cdecl CoverageStopRecordingData(void) { avoidGy_33++; return 0; }
__declspec(dllexport) int __cdecl CoverageClearData(void) { avoidGy_34++; return 0; }
__declspec(dllexport) int __cdecl CoverageIsRecordingData(void) { avoidGy_35++; return 0; }
__declspec(dllexport) int __cdecl CoverageAddAnnotation(char *str) { avoidGy_36++; str; return 0; }
__declspec(dllexport) int __cdecl CoverageSaveData(void) { avoidGy_37++; return 0; }
__declspec(dllexport) int __cdecl QuantifyIsRunning(void) { avoidGy_42++; return 0; }
__declspec(dllexport) int __cdecl QuantifyDisableRecordingData(void) { avoidGy_43++; return 0; }
__declspec(dllexport) int __cdecl QuantifyStartRecordingData(void) { avoidGy_44++; return 0; }
__declspec(dllexport) int __cdecl QuantifyStopRecordingData(void) { avoidGy_45++; return 0; }
__declspec(dllexport) int __cdecl QuantifyClearData(void) { avoidGy_46++; return 0; }
__declspec(dllexport) int __cdecl QuantifyIsRecordingData(void) { avoidGy_47++; return 0; }
__declspec(dllexport) int __cdecl QuantifyAddAnnotation(char *str) { avoidGy_48++; str; return 0; }
__declspec(dllexport) int __cdecl QuantifySaveData(void) { avoidGy_49++; return 0; }
__declspec(dllexport) int __cdecl PurelockIsRunning(void) { avoidGy_PL_01++; return 0; }

Просмотреть файл

@ -49,6 +49,9 @@
#include "nsWeakReference.h"
#include "nsISizeOfHandler.h"
#include "nsTextFormater.h"
#ifdef DEBUG
#include "pure.h"
#endif
class dummyComparitor: public nsAVLNodeComparitor {
public:
@ -96,6 +99,7 @@ void XXXNeverCalled()
info->GetName(NULL);
#ifdef DEBUG
info->print(NULL);
PurePrintf(0);
#endif
XPTC_InvokeByIndex(NULL, 0, 0, NULL);
NS_NewFileSpec(NULL);