зеркало из https://github.com/mozilla/gecko-dev.git
Bug 830584 - Write and read the module id to/from the late writes file. r=vladan.
This commit is contained in:
Родитель
318e9647c7
Коммит
625d279602
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef XP_MACOS
|
||||
#ifdef XP_MACOSX
|
||||
#include <fstream>
|
||||
#endif
|
||||
|
||||
|
@ -1527,12 +1527,26 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
static bool
|
||||
IsValidBreakpadId(const std::string &breakpadId) {
|
||||
if (breakpadId.size() < 33) {
|
||||
return false;
|
||||
}
|
||||
for (unsigned i = 0, n = breakpadId.size(); i < n; ++i) {
|
||||
char c = breakpadId[i];
|
||||
if ((c < '0' || c > '9') && (c < 'A' || c > 'F')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Read a stack from the given file name. In case of any error, aStack is
|
||||
// unchanged.
|
||||
static void
|
||||
ReadStack(const char *aFileName, Telemetry::ProcessedStack &aStack)
|
||||
{
|
||||
#ifdef XP_MACOS
|
||||
#ifdef XP_MACOSX
|
||||
std::ifstream file(aFileName);
|
||||
|
||||
size_t numModules;
|
||||
|
@ -1548,17 +1562,26 @@ ReadStack(const char *aFileName, Telemetry::ProcessedStack &aStack)
|
|||
|
||||
Telemetry::ProcessedStack stack;
|
||||
for (size_t i = 0; i < numModules; ++i) {
|
||||
std::string breakpadId;
|
||||
file >> breakpadId;
|
||||
if (file.fail() || !IsValidBreakpadId(breakpadId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
char space = file.get();
|
||||
if (file.fail() || space != ' ') {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string moduleName;
|
||||
getline(file, moduleName);
|
||||
if (file.fail()) {
|
||||
if (file.fail() || moduleName[0] == ' ') {
|
||||
return;
|
||||
}
|
||||
|
||||
Telemetry::ProcessedStack::Module module = {
|
||||
moduleName,
|
||||
0, // mPdbAge
|
||||
"", // mPdbSignature
|
||||
"" // mPdbName
|
||||
breakpadId
|
||||
};
|
||||
stack.AddModule(module);
|
||||
}
|
||||
|
|
|
@ -115,7 +115,8 @@ bool ValidWriteAssert(bool ok)
|
|||
sha1Stream.Printf("%u\n", (unsigned)numModules);
|
||||
for (int i = 0; i < numModules; ++i) {
|
||||
Telemetry::ProcessedStack::Module module = stack.GetModule(i);
|
||||
sha1Stream.Printf("%s\n", module.mName.c_str());
|
||||
sha1Stream.Printf("%s %s\n", module.mBreakpadId.c_str(),
|
||||
module.mName.c_str());
|
||||
}
|
||||
|
||||
size_t numFrames = stack.GetStackSize();
|
||||
|
|
Загрузка…
Ссылка в новой задаче