[Tools] Add support to tickprocessor to symbolize libraries embedded in APKs
On Android we load the native library directly from the APK. As such, we need to convert symbols from the mapped APK to the underlying .so when symbolizing the ticks. This CL adds a --apk-embedded-library argument to tick processor to enable specifying which unstripped library file was embeded in the APK and enable symbolizing. Change-Id: Ic992825b831f984a1217eed71847bdb158eb992b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1627546 Commit-Queue: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Cr-Commit-Position: refs/heads/master@{#61902}
This commit is contained in:
parent
734c1456d9
commit
201c50951d
@ -39,7 +39,8 @@ if (params.sourceMap) {
|
||||
}
|
||||
|
||||
var cppProcessor = new CppProcessor(
|
||||
new (entriesProviders[params.platform])(params.nm, params.targetRootFS),
|
||||
new (entriesProviders[params.platform])(params.nm, params.targetRootFS,
|
||||
params.apkEmbeddedLibrary),
|
||||
params.timedRange, params.pairwiseTimedRange);
|
||||
cppProcessor.processLogFile(params.logFileName);
|
||||
cppProcessor.dumpCppSymbols();
|
||||
|
@ -100,7 +100,7 @@ function run(args) {
|
||||
var profile = "";
|
||||
print = function(text) { profile += text + "\n"; };
|
||||
// Dummy entries provider, as we cannot call nm.
|
||||
var entriesProvider = new UnixCppEntriesProvider("", "");
|
||||
var entriesProvider = new UnixCppEntriesProvider("", "", "");
|
||||
var targetRootFS = "";
|
||||
var separateIc = false;
|
||||
var callGraphSize = 5;
|
||||
|
@ -89,6 +89,7 @@ function start_process() {
|
||||
ignoreUnknown: false,
|
||||
separateIc: true,
|
||||
targetRootFS: '',
|
||||
apkEmbeddedLibrary: '',
|
||||
nm: 'nm'
|
||||
};
|
||||
|
||||
@ -100,7 +101,7 @@ function start_process() {
|
||||
|
||||
var tickProcessor = new TickProcessor(
|
||||
new (entriesProviders[DEFAULTS.platform])(
|
||||
DEFAULTS.nm, DEFAULTS.targetRootFS),
|
||||
DEFAULTS.nm, DEFAULTS.targetRootFS, DEFAULTS.apkEmbeddedLibrary),
|
||||
DEFAULTS.separateIc, DEFAULTS.callGraphSize,
|
||||
DEFAULTS.ignoreUnknown, DEFAULTS.stateFilter);
|
||||
|
||||
|
@ -62,7 +62,8 @@ if (params.sourceMap) {
|
||||
sourceMap = SourceMap.load(params.sourceMap);
|
||||
}
|
||||
var tickProcessor = new TickProcessor(
|
||||
new (entriesProviders[params.platform])(params.nm, params.targetRootFS),
|
||||
new (entriesProviders[params.platform])(params.nm, params.targetRootFS,
|
||||
params.apkEmbeddedLibrary),
|
||||
params.separateIc,
|
||||
params.separateBytecodes,
|
||||
params.separateBuiltins,
|
||||
|
@ -685,11 +685,12 @@ CppEntriesProvider.prototype.parseNextLine = function() {
|
||||
};
|
||||
|
||||
|
||||
function UnixCppEntriesProvider(nmExec, targetRootFS) {
|
||||
function UnixCppEntriesProvider(nmExec, targetRootFS, apkEmbeddedLibrary) {
|
||||
this.symbols = [];
|
||||
this.parsePos = 0;
|
||||
this.nmExec = nmExec;
|
||||
this.targetRootFS = targetRootFS;
|
||||
this.apkEmbeddedLibrary = apkEmbeddedLibrary;
|
||||
this.FUNC_RE = /^([0-9a-fA-F]{8,16}) ([0-9a-fA-F]{8,16} )?[tTwW] (.*)$/;
|
||||
};
|
||||
inherits(UnixCppEntriesProvider, CppEntriesProvider);
|
||||
@ -697,6 +698,9 @@ inherits(UnixCppEntriesProvider, CppEntriesProvider);
|
||||
|
||||
UnixCppEntriesProvider.prototype.loadSymbols = function(libName) {
|
||||
this.parsePos = 0;
|
||||
if (this.apkEmbeddedLibrary && libName.endsWith('.apk')) {
|
||||
libName = this.apkEmbeddedLibrary;
|
||||
}
|
||||
libName = this.targetRootFS + libName;
|
||||
try {
|
||||
this.symbols = [
|
||||
@ -735,8 +739,8 @@ UnixCppEntriesProvider.prototype.parseNextLine = function() {
|
||||
};
|
||||
|
||||
|
||||
function MacCppEntriesProvider(nmExec, targetRootFS) {
|
||||
UnixCppEntriesProvider.call(this, nmExec, targetRootFS);
|
||||
function MacCppEntriesProvider(nmExec, targetRootFS, apkEmbeddedLibrary) {
|
||||
UnixCppEntriesProvider.call(this, nmExec, targetRootFS, apkEmbeddedLibrary);
|
||||
// Note an empty group. It is required, as UnixCppEntriesProvider expects 3 groups.
|
||||
this.FUNC_RE = /^([0-9a-fA-F]{8,16})() (.*)$/;
|
||||
};
|
||||
@ -758,7 +762,8 @@ MacCppEntriesProvider.prototype.loadSymbols = function(libName) {
|
||||
};
|
||||
|
||||
|
||||
function WindowsCppEntriesProvider(_ignored_nmExec, targetRootFS) {
|
||||
function WindowsCppEntriesProvider(_ignored_nmExec, targetRootFS,
|
||||
_ignored_apkEmbeddedLibrary) {
|
||||
this.targetRootFS = targetRootFS;
|
||||
this.symbols = '';
|
||||
this.parsePos = 0;
|
||||
@ -882,6 +887,8 @@ class ArgumentsProcessor extends BaseArgumentsProcessor {
|
||||
'Specify the \'nm\' executable to use (e.g. --nm=/my_dir/nm)'],
|
||||
'--target': ['targetRootFS', '',
|
||||
'Specify the target root directory for cross environment'],
|
||||
'--apk-embedded-library': ['apkEmbeddedLibrary', '',
|
||||
'Specify the path of the embedded library for Android traces'],
|
||||
'--range': ['range', 'auto,auto',
|
||||
'Specify the range limit as [start],[end]'],
|
||||
'--distortion': ['distortion', 0,
|
||||
|
Loading…
Reference in New Issue
Block a user