зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1362861 - Pass the correct arch to nm on macOS. r=dthayer,kmag
MozReview-Commit-ID: C8vfSUu8dM8 --HG-- extra : rebase_source : a7bf559a4093dd9a0447e195dd3e8dccd67619df
This commit is contained in:
Родитель
714fbbd92f
Коммит
80e77833bc
|
@ -136,11 +136,13 @@ async function spawnProcess(name, cmdArgs, processData, stdin = null) {
|
|||
await readAllData(proc.stdout, processData);
|
||||
}
|
||||
|
||||
async function getSymbolsFromNM(path) {
|
||||
async function getSymbolsFromNM(path, arch) {
|
||||
const parser = new NMParser();
|
||||
|
||||
const args = [path];
|
||||
if (Services.appinfo.OS !== "Darwin") {
|
||||
if (Services.appinfo.OS === "Darwin") {
|
||||
args.unshift("-arch", arch);
|
||||
} else {
|
||||
// Mac's `nm` doesn't support the demangle option, so we have to
|
||||
// post-process the symbols with c++filt.
|
||||
args.unshift("--demangle");
|
||||
|
@ -209,8 +211,8 @@ function filePathForSymFileInObjDir(binaryPath, debugName, breakpadId) {
|
|||
const symbolCache = new Map();
|
||||
|
||||
function primeSymbolStore(libs) {
|
||||
for (const {debugName, breakpadId, path} of libs) {
|
||||
symbolCache.set(urlForSymFile(debugName, breakpadId), path);
|
||||
for (const {debugName, breakpadId, path, arch} of libs) {
|
||||
symbolCache.set(urlForSymFile(debugName, breakpadId), {path, arch});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -305,10 +307,10 @@ this.geckoProfiler = class extends ExtensionAPI {
|
|||
primeSymbolStore(Services.profiler.sharedLibraries);
|
||||
}
|
||||
|
||||
const path = symbolCache.get(urlForSymFile(debugName, breakpadId));
|
||||
const cachedLibInfo = symbolCache.get(urlForSymFile(debugName, breakpadId));
|
||||
|
||||
const symbolRules = Services.prefs.getCharPref(PREF_GET_SYMBOL_RULES, "localBreakpad,remoteBreakpad");
|
||||
const haveAbsolutePath = path && OS.Path.split(path).absolute;
|
||||
const haveAbsolutePath = cachedLibInfo && OS.Path.split(cachedLibInfo.path).absolute;
|
||||
|
||||
// We have multiple options for obtaining symbol information for the given
|
||||
// binary.
|
||||
|
@ -322,6 +324,7 @@ this.geckoProfiler = class extends ExtensionAPI {
|
|||
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
|
||||
|
@ -335,7 +338,11 @@ this.geckoProfiler = class extends ExtensionAPI {
|
|||
const url = urlForSymFile(debugName, breakpadId);
|
||||
return await parseSym({url});
|
||||
case "nm":
|
||||
return await getSymbolsFromNM(path);
|
||||
if (haveAbsolutePath) {
|
||||
const {path, arch} = cachedLibInfo;
|
||||
return await getSymbolsFromNM(path, arch);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch (e) {
|
||||
// Each of our options can go wrong for a variety of reasons, so on failure
|
||||
|
|
Загрузка…
Ссылка в новой задаче