Bug 836054 - DMD: Handle stack entries with PC of 0x0. r=jlebar.

--HG--
rename : accessible/src/base/EventQueue.cpp => accessible/src/base/NotificationController.cpp
rename : accessible/src/base/EventQueue.h => accessible/src/base/NotificationController.h
rename : dom/browser-element/BrowserElementParent.jsm => dom/browser-element/BrowserElementParent.js
rename : testing/modules/AppInfo.jsm => services/healthreport/modules-testing/utils.jsm
extra : rebase_source : a9b8cc73c22c889dd3973bb411a075a7e7d1e954
This commit is contained in:
Nicholas Nethercote 2013-02-03 20:15:10 -08:00
parent c688a640e8
commit 5497077f63

View File

@ -601,14 +601,16 @@ class LocationService
struct Entry
{
const void* mPc; // the entry is unused if this is null
static const void* const kUnused;
const void* mPc; // if mPc==kUnused, the entry is unused
char* mFunction; // owned by the Entry; may be null
const char* mLibrary; // owned by mLibraryStrings; never null
// in a non-empty entry is in use
ptrdiff_t mLOffset;
Entry()
: mPc(nullptr), mFunction(nullptr), mLibrary(nullptr), mLOffset(0)
: mPc(kUnused), mFunction(nullptr), mLibrary(nullptr), mLOffset(0)
{}
~Entry()
@ -665,7 +667,7 @@ public:
MOZ_ASSERT(index < kNumEntries);
Entry& entry = mEntries[index];
MOZ_ASSERT(aPc); // important, because null represents an empty entry
MOZ_ASSERT(aPc != Entry::kUnused);
if (entry.mPc != aPc) {
mNumCacheMisses++;
@ -732,7 +734,7 @@ public:
{
size_t n = 0;
for (size_t i = 0; i < kNumEntries; i++) {
if (mEntries[i].mPc) {
if (mEntries[i].mPc != Entry::kUnused) {
n++;
}
}
@ -743,6 +745,10 @@ public:
size_t NumCacheMisses() const { return mNumCacheMisses; }
};
// We can't use 0 because that sometimes shows up as a PC in stack traces.
const void* const LocationService::Entry::kUnused =
reinterpret_cast<const void* const>(intptr_t(-1));
//---------------------------------------------------------------------------
// Stack traces
//---------------------------------------------------------------------------