13 #ifndef mozilla_IntentionalCrash_h
14 #define mozilla_IntentionalCrash_h
19 NoteIntentionalCrash(const char* processType
)
21 char* f
= getenv("XPCOM_MEM_BLOAT_LOG");
22 fprintf(stderr
, "XPCOM_MEM_BLOAT_LOG: %s\n", f
);
26 std::string
bloatLog(f
);
29 if (bloatLog
.size() >= 4 &&
30 0 == bloatLog
.compare(bloatLog
.size() - 4, 4, ".log", 4)) {
32 bloatLog
.erase(bloatLog
.size() - 4, 4);
35 std::ostringstream bloatName
;
36 bloatName
<< bloatLog
<< "_" << processType
<< "_pid" << getpid();
40 fprintf(stderr
, "Writing to log: %s\n", bloatName
.str().c_str());
42 FILE* processfd
= fopen(bloatName
.str().c_str(), "a");
43 fprintf(processfd
, "==> process %d will purposefully crash\n", getpid());
47 } // namespace mozilla
49 #endif // mozilla_IntentionalCrash_h