mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 825701 - Use v3 to report hangs. r=vladan.
This commit is contained in:
parent
8304fb5ac1
commit
d4a29482b0
@ -34,11 +34,7 @@ public:
|
||||
{
|
||||
// The file name, /foo/bar/libxul.so for example.
|
||||
std::string mName;
|
||||
|
||||
// Windows specific fields. On other platforms they are 0/empty.
|
||||
int mPdbAge;
|
||||
std::string mPdbSignature;
|
||||
std::string mPdbName;
|
||||
std::string mBreakpadId;
|
||||
|
||||
bool operator==(const Module& other) const;
|
||||
};
|
||||
|
@ -1464,28 +1464,12 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// "PDB Age" identifier
|
||||
val = INT_TO_JSVAL(module.mPdbAge);
|
||||
if (!JS_SetElement(cx, moduleInfoArray, index++, &val)) {
|
||||
// Module breakpad identifier
|
||||
JSString *id = JS_NewStringCopyZ(cx, module.mBreakpadId.c_str());
|
||||
if (!id) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// "PDB Signature" GUID
|
||||
str = JS_NewStringCopyZ(cx, module.mPdbSignature.c_str());
|
||||
if (!str) {
|
||||
return nullptr;
|
||||
}
|
||||
val = STRING_TO_JSVAL(str);
|
||||
if (!JS_SetElement(cx, moduleInfoArray, index++, &val)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Name of associated PDB file
|
||||
str = JS_NewStringCopyZ(cx, module.mPdbName.c_str());
|
||||
if (!str) {
|
||||
return nullptr;
|
||||
}
|
||||
val = STRING_TO_JSVAL(str);
|
||||
val = STRING_TO_JSVAL(id);
|
||||
if (!JS_SetElement(cx, moduleInfoArray, index++, &val)) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -2137,9 +2121,7 @@ void ProcessedStack::Clear() {
|
||||
|
||||
bool ProcessedStack::Module::operator==(const Module& aOther) const {
|
||||
return mName == aOther.mName &&
|
||||
mPdbAge == aOther.mPdbAge &&
|
||||
mPdbSignature == aOther.mPdbSignature &&
|
||||
mPdbName == aOther.mPdbName;
|
||||
mBreakpadId == aOther.mBreakpadId;
|
||||
}
|
||||
|
||||
struct StackFrame
|
||||
@ -2242,21 +2224,8 @@ GetStackAndModules(const std::vector<uintptr_t>& aPCs)
|
||||
const SharedLibrary &info = rawModules.GetEntry(i);
|
||||
ProcessedStack::Module module = {
|
||||
info.GetName(),
|
||||
#ifdef XP_WIN
|
||||
info.GetPdbAge(),
|
||||
"", // mPdbSignature
|
||||
info.GetPdbName(),
|
||||
#else
|
||||
0, // mPdbAge
|
||||
"", // mPdbSignature
|
||||
"" // mPdbName
|
||||
#endif
|
||||
info.GetBreakpadId()
|
||||
};
|
||||
#ifdef XP_WIN
|
||||
char guidString[NSID_LENGTH] = { 0 };
|
||||
info.GetPdbSignature().ToProvidedString(guidString);
|
||||
module.mPdbSignature = guidString;
|
||||
#endif
|
||||
Ret.AddModule(module);
|
||||
}
|
||||
#endif
|
||||
|
@ -333,7 +333,7 @@ let ChromeHangs = {
|
||||
let memoryMap = hangs.memoryMap;
|
||||
let stacks = hangs.stacks;
|
||||
let request = {"memoryMap" : memoryMap, "stacks" : stacks,
|
||||
"version" : 2};
|
||||
"version" : 3};
|
||||
let requestJSON = JSON.stringify(request);
|
||||
|
||||
this.symbolRequest = XMLHttpRequest();
|
||||
|
@ -73,10 +73,28 @@ AddSharedLibraryInfoToStream(std::ostream& aStream, const SharedLibrary& aLib)
|
||||
aStream << ",\"end\":" << aLib.GetEnd();
|
||||
aStream << ",\"offset\":" << aLib.GetOffset();
|
||||
aStream << ",\"name\":\"" << aLib.GetName() << "\"";
|
||||
const std::string &breakpadId = aLib.GetBreakpadId();
|
||||
aStream << ",\"breakpadId\":\"" << breakpadId << "\"";
|
||||
#ifdef XP_WIN
|
||||
aStream << ",\"pdbSignature\":\"" << aLib.GetPdbSignature().ToString() << "\"";
|
||||
aStream << ",\"pdbAge\":" << aLib.GetPdbAge();
|
||||
aStream << ",\"pdbName\":\"" << aLib.GetPdbName() << "\"";
|
||||
// FIXME: remove this XP_WIN code when the profiler plugin has switched to
|
||||
// using breakpadId.
|
||||
std::string pdbSignature = breakpadId.substr(0, 32);
|
||||
std::string pdbAgeStr = breakpadId.substr(32, breakpadId.size() - 1);
|
||||
|
||||
std::stringstream stream;
|
||||
stream << std::hex << pdbAgeStr;
|
||||
unsigned pdbAge;
|
||||
stream >> pdbAge;
|
||||
|
||||
#ifdef DEBUG
|
||||
std::ostringstream oStream;
|
||||
oStream << pdbSignature << std::hex << pdbAge;
|
||||
MOZ_ASSERT(breakpadId == oStream.str());
|
||||
#endif
|
||||
|
||||
aStream << ",\"pdbSignature\":\"" << pdbSignature << "\"";
|
||||
aStream << ",\"pdbAge\":" << pdbAge;
|
||||
aStream << ",\"pdbName\":\"" << aLib.GetName() << "\"";
|
||||
#endif
|
||||
aStream << "}";
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ int dl_iterate_callback(struct dl_phdr_info *dl_info, size_t size, void *data)
|
||||
if (end > libEnd)
|
||||
libEnd = end;
|
||||
}
|
||||
SharedLibrary shlib(libStart, libEnd, 0, dl_info->dlpi_name);
|
||||
SharedLibrary shlib(libStart, libEnd, 0, "", dl_info->dlpi_name);
|
||||
info.AddSharedLibrary(shlib);
|
||||
|
||||
return 0;
|
||||
@ -120,7 +120,7 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
|
||||
if (strcmp(name, "/dev/ashmem/dalvik-jit-code-cache") != 0)
|
||||
continue;
|
||||
#endif
|
||||
SharedLibrary shlib(start, end, offset, name);
|
||||
SharedLibrary shlib(start, end, offset, "", name);
|
||||
info.AddSharedLibrary(shlib);
|
||||
if (count > 10000) {
|
||||
LOG("Get maps failed");
|
||||
|
@ -65,7 +65,8 @@ void addSharedLibrary(const platform_mach_header* header, char *name, SharedLibr
|
||||
if (!strcmp(seg->segname, "__TEXT")) {
|
||||
size = seg->vmsize;
|
||||
unsigned long long start = reinterpret_cast<unsigned long long>(header);
|
||||
info.AddSharedLibrary(SharedLibrary(start, start+seg->vmsize, 0, name));
|
||||
info.AddSharedLibrary(SharedLibrary(start, start+seg->vmsize, 0,
|
||||
"", name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <windows.h>
|
||||
#include <tlhelp32.h>
|
||||
#include <dbghelp.h>
|
||||
#include <sstream>
|
||||
|
||||
#include "shared-libraries.h"
|
||||
#include "nsWindowsHelpers.h"
|
||||
@ -75,6 +76,11 @@ static bool GetPdbInfo(uintptr_t aStart, nsID& aSignature, uint32_t& aAge, char*
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool IsDashOrBraces(char c)
|
||||
{
|
||||
return c == '-' || c == '{' || c == '}';
|
||||
}
|
||||
|
||||
SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
|
||||
{
|
||||
SharedLibraryInfo sharedLibraryInfo;
|
||||
@ -106,13 +112,20 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
|
||||
sizeof(vmemInfo) == VirtualQuery(module.modBaseAddr, &vmemInfo, sizeof(vmemInfo)) &&
|
||||
vmemInfo.State == MEM_COMMIT &&
|
||||
GetPdbInfo((uintptr_t)module.modBaseAddr, pdbSig, pdbAge, &pdbName)) {
|
||||
std::ostringstream stream;
|
||||
stream << pdbSig.ToString() << std::hex << pdbAge;
|
||||
std::string breakpadId = stream.str();
|
||||
std::string::iterator end =
|
||||
std::remove_if(breakpadId.begin(), breakpadId.end(), IsDashOrBraces);
|
||||
breakpadId.erase(end, breakpadId.end());
|
||||
std::transform(breakpadId.begin(), breakpadId.end(),
|
||||
breakpadId.begin(), toupper);
|
||||
|
||||
SharedLibrary shlib((uintptr_t)module.modBaseAddr,
|
||||
(uintptr_t)module.modBaseAddr+module.modBaseSize,
|
||||
0, // DLLs are always mapped at offset 0 on Windows
|
||||
pdbSig,
|
||||
pdbAge,
|
||||
pdbName,
|
||||
module.szModule);
|
||||
breakpadId,
|
||||
pdbName);
|
||||
sharedLibraryInfo.AddSharedLibrary(shlib);
|
||||
}
|
||||
FreeLibrary(handleLock); // ok to free null handles
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <mozilla/StandardInteger.h>
|
||||
@ -24,20 +25,12 @@ public:
|
||||
SharedLibrary(unsigned long aStart,
|
||||
unsigned long aEnd,
|
||||
unsigned long aOffset,
|
||||
#ifdef XP_WIN
|
||||
nsID aPdbSignature,
|
||||
unsigned long aPdbAge,
|
||||
const char *aPdbName,
|
||||
#endif
|
||||
const std::string &aBreakpadId,
|
||||
const char *aName)
|
||||
: mStart(aStart)
|
||||
, mEnd(aEnd)
|
||||
, mOffset(aOffset)
|
||||
#ifdef XP_WIN
|
||||
, mPdbSignature(aPdbSignature)
|
||||
, mPdbAge(aPdbAge)
|
||||
, mPdbName(strdup(aPdbName))
|
||||
#endif
|
||||
, mBreakpadId(aBreakpadId)
|
||||
, mName(strdup(aName))
|
||||
{}
|
||||
|
||||
@ -45,11 +38,7 @@ public:
|
||||
: mStart(aEntry.mStart)
|
||||
, mEnd(aEntry.mEnd)
|
||||
, mOffset(aEntry.mOffset)
|
||||
#ifdef XP_WIN
|
||||
, mPdbSignature(aEntry.mPdbSignature)
|
||||
, mPdbAge(aEntry.mPdbAge)
|
||||
, mPdbName(strdup(aEntry.mPdbName))
|
||||
#endif
|
||||
, mBreakpadId(aEntry.mBreakpadId)
|
||||
, mName(strdup(aEntry.mName))
|
||||
{}
|
||||
|
||||
@ -61,13 +50,7 @@ public:
|
||||
mStart = aEntry.mStart;
|
||||
mEnd = aEntry.mEnd;
|
||||
mOffset = aEntry.mOffset;
|
||||
#ifdef XP_WIN
|
||||
mPdbSignature = aEntry.mPdbSignature;
|
||||
mPdbAge = aEntry.mPdbAge;
|
||||
if (mPdbName)
|
||||
free(mPdbName);
|
||||
mPdbName = strdup(aEntry.mPdbName);
|
||||
#endif
|
||||
mBreakpadId = aEntry.mBreakpadId;
|
||||
if (mName)
|
||||
free(mName);
|
||||
mName = strdup(aEntry.mName);
|
||||
@ -76,25 +59,15 @@ public:
|
||||
|
||||
bool operator==(const SharedLibrary& other) const
|
||||
{
|
||||
bool equal = ((mStart == other.mStart) &&
|
||||
(mEnd == other.mEnd) &&
|
||||
(mOffset == other.mOffset) &&
|
||||
(mName && other.mName && (strcmp(mName, other.mName) == 0)));
|
||||
#ifdef XP_WIN
|
||||
equal = equal &&
|
||||
(mPdbSignature.Equals(other.mPdbSignature)) &&
|
||||
(mPdbAge == other.mPdbAge) &&
|
||||
(mPdbName && other.mPdbName && (strcmp(mPdbName, other.mPdbName) == 0));
|
||||
#endif
|
||||
return equal;
|
||||
return (mStart == other.mStart) &&
|
||||
(mEnd == other.mEnd) &&
|
||||
(mOffset == other.mOffset) &&
|
||||
(mName && other.mName && (strcmp(mName, other.mName) == 0)) &&
|
||||
(mBreakpadId == other.mBreakpadId);
|
||||
}
|
||||
|
||||
~SharedLibrary()
|
||||
{
|
||||
#ifdef XP_WIN
|
||||
free(mPdbName);
|
||||
mPdbName = NULL;
|
||||
#endif
|
||||
free(mName);
|
||||
mName = NULL;
|
||||
}
|
||||
@ -102,11 +75,7 @@ public:
|
||||
uintptr_t GetStart() const { return mStart; }
|
||||
uintptr_t GetEnd() const { return mEnd; }
|
||||
uintptr_t GetOffset() const { return mOffset; }
|
||||
#ifdef XP_WIN
|
||||
nsID GetPdbSignature() const { return mPdbSignature; }
|
||||
uint32_t GetPdbAge() const { return mPdbAge; }
|
||||
char* GetPdbName() const { return mPdbName; }
|
||||
#endif
|
||||
const std::string &GetBreakpadId() const { return mBreakpadId; }
|
||||
char* GetName() const { return mName; }
|
||||
|
||||
private:
|
||||
@ -115,12 +84,7 @@ private:
|
||||
uintptr_t mStart;
|
||||
uintptr_t mEnd;
|
||||
uintptr_t mOffset;
|
||||
#ifdef XP_WIN
|
||||
// Windows-specific PDB file identifiers
|
||||
nsID mPdbSignature;
|
||||
uint32_t mPdbAge;
|
||||
char *mPdbName;
|
||||
#endif
|
||||
std::string mBreakpadId;
|
||||
char *mName;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user