diff --git a/browser/components/extensions/parent/ext-geckoProfiler.js b/browser/components/extensions/parent/ext-geckoProfiler.js index 4f90a6ebe9f0..3d90785d1254 100644 --- a/browser/components/extensions/parent/ext-geckoProfiler.js +++ b/browser/components/extensions/parent/ext-geckoProfiler.js @@ -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; }