2016-05-30 08:55:32 +00:00
|
|
|
// Copyright 2016 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2020-09-28 14:52:35 +00:00
|
|
|
import { WebInspector } from "./sourcemap.mjs";
|
2020-09-28 13:50:56 +00:00
|
|
|
import {
|
2020-09-28 14:52:35 +00:00
|
|
|
CppProcessor, ArgumentsProcessor, UnixCppEntriesProvider,
|
2020-09-28 13:50:56 +00:00
|
|
|
WindowsCppEntriesProvider, MacCppEntriesProvider
|
|
|
|
} from "./dumpcpp.mjs";
|
|
|
|
|
2016-05-30 08:55:32 +00:00
|
|
|
// Dump C++ symbols of shared library if possible
|
|
|
|
|
|
|
|
function processArguments(args) {
|
2020-11-10 11:47:40 +00:00
|
|
|
const processor = new ArgumentsProcessor(args);
|
2016-05-30 08:55:32 +00:00
|
|
|
if (processor.parse()) {
|
|
|
|
return processor.result();
|
|
|
|
} else {
|
|
|
|
processor.printUsageAndExit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function initSourceMapSupport() {
|
|
|
|
// Pull dev tools source maps into our name space.
|
|
|
|
SourceMap = WebInspector.SourceMap;
|
|
|
|
|
|
|
|
// Overwrite the load function to load scripts synchronously.
|
|
|
|
SourceMap.load = function(sourceMapURL) {
|
2020-11-10 11:47:40 +00:00
|
|
|
const content = readFile(sourceMapURL);
|
|
|
|
const sourceMapObject = (JSON.parse(content));
|
2016-05-30 08:55:32 +00:00
|
|
|
return new SourceMap(sourceMapURL, sourceMapObject);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-11-10 11:47:40 +00:00
|
|
|
const entriesProviders = {
|
2016-05-30 08:55:32 +00:00
|
|
|
'unix': UnixCppEntriesProvider,
|
|
|
|
'windows': WindowsCppEntriesProvider,
|
|
|
|
'mac': MacCppEntriesProvider
|
|
|
|
};
|
|
|
|
|
2020-11-10 11:47:40 +00:00
|
|
|
const params = processArguments(arguments);
|
|
|
|
let sourceMap = null;
|
2016-05-30 08:55:32 +00:00
|
|
|
if (params.sourceMap) {
|
|
|
|
initSourceMapSupport();
|
|
|
|
sourceMap = SourceMap.load(params.sourceMap);
|
|
|
|
}
|
|
|
|
|
2020-11-10 11:47:40 +00:00
|
|
|
const cppProcessor = new CppProcessor(
|
2019-05-24 11:23:39 +00:00
|
|
|
new (entriesProviders[params.platform])(params.nm, params.targetRootFS,
|
|
|
|
params.apkEmbeddedLibrary),
|
2016-05-30 08:55:32 +00:00
|
|
|
params.timedRange, params.pairwiseTimedRange);
|
|
|
|
cppProcessor.processLogFile(params.logFileName);
|
|
|
|
cppProcessor.dumpCppSymbols();
|