Bug 733792 - Leave original symbol addresses in the profile report. r=bgirard

This commit is contained in:
Markus Stange 2012-03-09 16:20:03 +01:00
Родитель 010a67b465
Коммит 16689fff7f
1 изменённых файлов: 4 добавлений и 58 удалений

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

@ -164,7 +164,6 @@ public:
, mEntrySize(aEntrySize) , mEntrySize(aEntrySize)
{ {
mEntries = new ProfileEntry[mEntrySize]; mEntries = new ProfileEntry[mEntrySize];
mNeedsSharedLibraryInfo = true;
} }
~Profile() ~Profile()
@ -252,12 +251,6 @@ public:
void ToString(StringBuilder &profile) void ToString(StringBuilder &profile)
{ {
if (mNeedsSharedLibraryInfo) {
// Can't be called from signal because
// getting the shared library information can call non-reentrant functions.
mSharedLibraryInfo = SharedLibraryInfo::GetInfoForSelf();
}
//XXX: this code is not thread safe and needs to be fixed //XXX: this code is not thread safe and needs to be fixed
int oldReadPos = mReadPos; int oldReadPos = mReadPos;
while (mReadPos != mLastFlushPos) { while (mReadPos != mLastFlushPos) {
@ -269,12 +262,6 @@ public:
void WriteProfile(FILE* stream) void WriteProfile(FILE* stream)
{ {
if (mNeedsSharedLibraryInfo) {
// Can't be called from signal because
// getting the shared library information can call non-reentrant functions.
mSharedLibraryInfo = SharedLibraryInfo::GetInfoForSelf();
}
//XXX: this code is not thread safe and needs to be fixed //XXX: this code is not thread safe and needs to be fixed
int oldReadPos = mReadPos; int oldReadPos = mReadPos;
while (mReadPos != mLastFlushPos) { while (mReadPos != mLastFlushPos) {
@ -284,11 +271,6 @@ public:
} }
mReadPos = oldReadPos; mReadPos = oldReadPos;
} }
SharedLibraryInfo& getSharedLibraryInfo()
{
return mSharedLibraryInfo;
}
private: private:
// Circular buffer 'Keep One Slot Open' implementation // Circular buffer 'Keep One Slot Open' implementation
// for simplicity // for simplicity
@ -297,8 +279,6 @@ private:
int mLastFlushPos; // points to the next entry since the last flush() int mLastFlushPos; // points to the next entry since the last flush()
int mReadPos; // points to the next entry we will read to int mReadPos; // points to the next entry we will read to
int mEntrySize; int mEntrySize;
bool mNeedsSharedLibraryInfo;
SharedLibraryInfo mSharedLibraryInfo;
}; };
class SaveProfileTask; class SaveProfileTask;
@ -570,54 +550,20 @@ string ProfileEntry::TagToString(Profile *profile)
snprintf(buff, 50, "%-40f", mTagFloat); snprintf(buff, 50, "%-40f", mTagFloat);
tag += string(1, mTagName) + string("-") + string(buff) + string("\n"); tag += string(1, mTagName) + string("-") + string(buff) + string("\n");
} else if (mTagName == 'l') { } else if (mTagName == 'l') {
bool found = false;
char tagBuff[1024]; char tagBuff[1024];
SharedLibraryInfo& shlibInfo = profile->getSharedLibraryInfo();
Address pc = mTagAddress; Address pc = mTagAddress;
// TODO Use binary sort (STL) snprintf(tagBuff, 1024, "l-%p\n", pc);
for (size_t i = 0; i < shlibInfo.GetSize(); i++) { tag += string(tagBuff);
SharedLibrary &e = shlibInfo.GetEntry(i);
if (pc > (Address)e.GetStart() && pc < (Address)e.GetEnd()) {
if (e.GetName()) {
found = true;
snprintf(tagBuff, 1024, "l-%s@%p\n", e.GetName(), pc - e.GetStart());
tag += string(tagBuff);
break;
}
}
}
if (!found) {
snprintf(tagBuff, 1024, "l-???@%p\n", pc);
tag += string(tagBuff);
}
} else { } else {
tag += string(1, mTagName) + string("-") + string(mTagData) + string("\n"); tag += string(1, mTagName) + string("-") + string(mTagData) + string("\n");
} }
#ifdef ENABLE_SPS_LEAF_DATA #ifdef ENABLE_SPS_LEAF_DATA
if (mLeafAddress) { if (mLeafAddress) {
bool found = false;
char tagBuff[1024]; char tagBuff[1024];
SharedLibraryInfo& shlibInfo = profile->getSharedLibraryInfo();
unsigned long pc = (unsigned long)mLeafAddress; unsigned long pc = (unsigned long)mLeafAddress;
// TODO Use binary sort (STL) snprintf(tagBuff, 1024, "l-%llu\n", pc);
for (size_t i = 0; i < shlibInfo.GetSize(); i++) { tag += string(tagBuff);
SharedLibrary &e = shlibInfo.GetEntry(i);
if (pc > e.GetStart() && pc < e.GetEnd()) {
if (e.GetName()) {
found = true;
snprintf(tagBuff, 1024, "l-%900s@%llu\n", e.GetName(), pc - e.GetStart());
tag += string(tagBuff);
break;
}
}
}
if (!found) {
snprintf(tagBuff, 1024, "l-???@%llu\n", pc);
tag += string(tagBuff);
}
} }
#endif #endif
return tag; return tag;