Bug 948621 (part 1) - DMD: Handle arbitrary PC values in stack frames. r=iacobcatalin.

DONTBUILD because NPOTB

--HG--
extra : rebase_source : 63a30251498dc5e5df2952a468f46ada8598e03e
This commit is contained in:
Nicholas Nethercote 2013-12-15 13:47:11 -08:00
parent cb0b986088
commit 6d00ee88e5

View File

@ -600,18 +600,17 @@ class LocationService
struct Entry
{
static const void* const kUnused;
const void* mPc; // if mPc==kUnused, the entry is unused
const void* mPc;
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;
char* mFileName; // owned by the Entry; may be null
unsigned long mLineNo;
uint32_t mLineNo:31;
uint32_t mInUse:1; // is the entry used?
Entry()
: mPc(kUnused), mFunction(nullptr), mLibrary(nullptr), mLOffset(0), mFileName(nullptr), mLineNo(0)
: mPc(0), mFunction(nullptr), mLibrary(nullptr), mLOffset(0), mFileName(nullptr), mLineNo(0), mInUse(0)
{}
~Entry()
@ -639,6 +638,8 @@ class LocationService
mLibrary = aLibrary;
mLOffset = aLOffset;
mLineNo = aLineNo;
mInUse = 1;
}
size_t SizeOfExcludingThis() {
@ -675,8 +676,7 @@ public:
MOZ_ASSERT(index < kNumEntries);
Entry& entry = mEntries[index];
MOZ_ASSERT(aPc != Entry::kUnused);
if (entry.mPc != aPc) {
if (!entry.mInUse || entry.mPc != aPc) {
mNumCacheMisses++;
// NS_DescribeCodeAddress can (on Linux) acquire a lock inside
@ -753,7 +753,7 @@ public:
{
size_t n = 0;
for (size_t i = 0; i < kNumEntries; i++) {
if (mEntries[i].mPc != Entry::kUnused) {
if (mEntries[i].mInUse) {
n++;
}
}
@ -764,10 +764,6 @@ 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
//---------------------------------------------------------------------------