Bug 1049068 - Part 1: Remove callstack printing. r=froydnj

--HG--
extra : rebase_source : 3f672ee2c07ca17721543e61b010dc000ff4d9a1
This commit is contained in:
Eric Rahm 2014-08-08 11:43:19 -07:00
parent a3eba4accf
commit 05f6577110
3 changed files with 8 additions and 29 deletions

View File

@ -40,14 +40,10 @@ BlockingResourceBase::DDT* BlockingResourceBase::sDeadlockDetector;
bool
BlockingResourceBase::DeadlockDetectorEntry::Print(
const DDT::ResourceAcquisition& aFirstSeen,
nsACString& aOut,
bool aPrintFirstSeenCx) const
nsACString& aOut) const
{
CallStack lastAcquisition = mAcquisitionContext; // RACY, but benign
bool maybeCurrentlyAcquired = (CallStack::kNone != lastAcquisition);
CallStack printAcquisition =
(aPrintFirstSeenCx || !maybeCurrentlyAcquired) ?
aFirstSeen.mCallContext : lastAcquisition;
fprintf(stderr, "--- %s : %s",
kResourceTypeName[mType], mName);
@ -61,7 +57,7 @@ BlockingResourceBase::DeadlockDetectorEntry::Print(
}
fputs(" calling context\n", stderr);
printAcquisition.Print(stderr);
fputs(" [stack trace unavailable]\n", stderr);
return maybeCurrentlyAcquired;
}
@ -167,7 +163,7 @@ BlockingResourceBase::Release()
} else {
// not an error, but makes code hard to reason about.
NS_WARNING("Resource acquired at calling context\n");
mDDEntry->mAcquisitionContext.Print(stderr);
NS_WARNING(" [stack trace unavailable]\n");
NS_WARNING("\nis being released in non-LIFO order; why?");
// remove this resource from wherever it lives in the chain
@ -215,7 +211,7 @@ BlockingResourceBase::PrintCycle(const DDT::ResourceAcquisitionArray* aCycle,
fputs("\n=== Cycle completed at\n", stderr);
aOut += "Cycle completed at\n";
it->mResource->Print(*it, aOut, true);
it->mResource->Print(*it, aOut);
return maybeImminent;
}
@ -269,8 +265,8 @@ ReentrantMonitor::Enter()
if (br == this) {
NS_WARNING(
"Re-entering ReentrantMonitor after acquiring other resources.\n"
"At calling context\n");
GetAcquisitionContext().Print(stderr);
"At calling context\n"
" [stack trace unavailable]\n");
// show the caller why this is potentially bad
CheckAcquire(callContext);

View File

@ -103,9 +103,7 @@ private:
* acquisition context is printed and true is returned.
* Otherwise, we print the context from |aFirstSeen|, the
* first acquisition from which the code calling |Print()|
* became interested in us, and return false. |Print()| can
* be forced to print the context from |aFirstSeen| regardless
* by passing |aPrintFirstSeenCx=true|.
* became interested in us, and return false.
*
* *NOT* thread safe. Reads |mAcquisitionContext| without
* synchronization, but this will not cause correctness
@ -116,8 +114,7 @@ private:
* only some info is written into |aOut|
*/
bool Print(const DDT::ResourceAcquisition& aFirstSeen,
nsACString& aOut,
bool aPrintFirstSeenCx = false) const;
nsACString& aOut) const;
/**
* mName

View File

@ -77,20 +77,6 @@ public:
return mCallStack != aOther.mCallStack;
}
// FIXME bug 456272: if this is split off,
// NS_TraceMallocPrintStackTrace should be modified to print into
// an nsACString
void Print(FILE* aFile) const
{
#ifdef NS_TRACE_MALLOC
if (this != &kNone && mCallStack) {
NS_TraceMallocPrintStackTrace(aFile, mCallStack);
return;
}
#endif
fputs(" [stack trace unavailable]\n", aFile);
}
/** The "null" callstack. */
static const CallStack kNone;
};