Bug 1461056 - Remove haveAbsolutePath and tweak some error messages. r=dthayer

MozReview-Commit-ID: IyQIyNaKBy3

--HG--
extra : rebase_source : 308314603b45ffe171e2da80353393eda9e8930e
This commit is contained in:
Markus Stange 2018-05-14 16:03:24 -04:00
Родитель 67de46aff0
Коммит 97e9567f12
1 изменённых файлов: 37 добавлений и 35 удалений

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

@ -392,55 +392,57 @@ this.geckoProfiler = class extends ExtensionAPI {
}
const cachedLibInfo = symbolCache.get(`${debugName}/${breakpadId}`);
if (!cachedLibInfo) {
throw new Error(
`The library ${debugName} ${breakpadId} is not in the Services.profiler.sharedLibraries list, ` +
"so the local path for it is not known and symbols for it can not be obtained. " +
"This usually happens if a content process uses a library that's not used in the parent " +
"process - Services.profiler.sharedLibraries only knows about libraries in the parent process.");
}
const {path, debugPath, arch} = cachedLibInfo;
if (!OS.Path.split(path).absolute) {
throw new Error(
`Services.profiler.sharedLibraries did not contain an absolute path for the library ${debugName} ${breakpadId}, ` +
"so symbols for this library can not be obtained.");
}
const symbolRules = Services.prefs.getCharPref(PREF_GET_SYMBOL_RULES, "localBreakpad");
const haveAbsolutePath = cachedLibInfo && OS.Path.split(cachedLibInfo.path).absolute;
// We have multiple options for obtaining symbol information for the given
// binary.
// "localBreakpad" - Use existing symbol dumps stored in the object directory of a local
// Firefox build, generated using `mach buildsymbols` [requires path]
// "nm" - Use the command line tool `nm` [linux/mac only, requires path]
// "dump_syms.exe" - Use the tool dump_syms.exe from the object directory [Windows
// only, requires path]
// Firefox build, generated using `mach buildsymbols`
// "nm" - Use the command line tool `nm` [linux/mac only]
// "dump_syms.exe" - Use the tool dump_syms.exe from the object directory [Windows only]
for (const rule of symbolRules.split(",")) {
try {
switch (rule) {
case "localBreakpad":
if (haveAbsolutePath) {
const {path} = cachedLibInfo;
const filepath = filePathForSymFileInObjDir(path, debugName, breakpadId);
if (filepath) {
// NOTE: here and below, "return await" is used to ensure we catch any
// errors in the promise. A simple return would give the error to the
// caller.
return await parseSym({filepath});
}
const filepath = filePathForSymFileInObjDir(path, debugName, breakpadId);
if (filepath) {
// NOTE: here and below, "return await" is used to ensure we catch any
// errors in the promise. A simple return would give the error to the
// caller.
return await parseSym({filepath});
}
break;
case "nm":
if (haveAbsolutePath) {
const {path, arch} = cachedLibInfo;
return await getSymbolsFromNM(path, arch);
}
break;
return await getSymbolsFromNM(path, arch);
case "dump_syms.exe":
if (haveAbsolutePath) {
const {path, debugPath} = cachedLibInfo;
let dumpSymsPath = dumpSymsPathInObjDir(path);
if (!dumpSymsPath && previouslySuccessfulDumpSymsPath) {
// We may be able to dump symbol for system libraries
// (which are outside the object directory, and for
// which dumpSymsPath will be null) using dump_syms.exe.
// If we know that dump_syms.exe exists, try it.
dumpSymsPath = previouslySuccessfulDumpSymsPath;
}
if (dumpSymsPath) {
const result =
await getSymbolsUsingWindowsDumpSyms(dumpSymsPath, debugPath);
previouslySuccessfulDumpSymsPath = dumpSymsPath;
return result;
}
let dumpSymsPath = dumpSymsPathInObjDir(path);
if (!dumpSymsPath && previouslySuccessfulDumpSymsPath) {
// We may be able to dump symbol for system libraries
// (which are outside the object directory, and for
// which dumpSymsPath will be null) using dump_syms.exe.
// If we know that dump_syms.exe exists, try it.
dumpSymsPath = previouslySuccessfulDumpSymsPath;
}
if (dumpSymsPath) {
const result =
await getSymbolsUsingWindowsDumpSyms(dumpSymsPath, debugPath);
previouslySuccessfulDumpSymsPath = dumpSymsPath;
return result;
}
break;
}