Skip to content

Commit 201c509

Browse files
rmcilroyCommit Bot
authored andcommitted
[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 <[email protected]> Reviewed-by: Jaroslav Sevcik <[email protected]> Cr-Commit-Position: refs/heads/master@{#61902}
1 parent 734c145 commit 201c509

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

tools/dumpcpp-driver.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ if (params.sourceMap) {
3939
}
4040

4141
var cppProcessor = new CppProcessor(
42-
new (entriesProviders[params.platform])(params.nm, params.targetRootFS),
42+
new (entriesProviders[params.platform])(params.nm, params.targetRootFS,
43+
params.apkEmbeddedLibrary),
4344
params.timedRange, params.pairwiseTimedRange);
4445
cppProcessor.processLogFile(params.logFileName);
4546
cppProcessor.dumpCppSymbols();

tools/profviz/worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function run(args) {
100100
var profile = "";
101101
print = function(text) { profile += text + "\n"; };
102102
// Dummy entries provider, as we cannot call nm.
103-
var entriesProvider = new UnixCppEntriesProvider("", "");
103+
var entriesProvider = new UnixCppEntriesProvider("", "", "");
104104
var targetRootFS = "";
105105
var separateIc = false;
106106
var callGraphSize = 5;

tools/tick-processor.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
ignoreUnknown: false,
9090
separateIc: true,
9191
targetRootFS: '',
92+
apkEmbeddedLibrary: '',
9293
nm: 'nm'
9394
};
9495

@@ -100,7 +101,7 @@
100101

101102
var tickProcessor = new TickProcessor(
102103
new (entriesProviders[DEFAULTS.platform])(
103-
DEFAULTS.nm, DEFAULTS.targetRootFS),
104+
DEFAULTS.nm, DEFAULTS.targetRootFS, DEFAULTS.apkEmbeddedLibrary),
104105
DEFAULTS.separateIc, DEFAULTS.callGraphSize,
105106
DEFAULTS.ignoreUnknown, DEFAULTS.stateFilter);
106107

tools/tickprocessor-driver.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ if (params.sourceMap) {
6262
sourceMap = SourceMap.load(params.sourceMap);
6363
}
6464
var tickProcessor = new TickProcessor(
65-
new (entriesProviders[params.platform])(params.nm, params.targetRootFS),
65+
new (entriesProviders[params.platform])(params.nm, params.targetRootFS,
66+
params.apkEmbeddedLibrary),
6667
params.separateIc,
6768
params.separateBytecodes,
6869
params.separateBuiltins,

tools/tickprocessor.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -685,18 +685,22 @@ CppEntriesProvider.prototype.parseNextLine = function() {
685685
};
686686

687687

688-
function UnixCppEntriesProvider(nmExec, targetRootFS) {
688+
function UnixCppEntriesProvider(nmExec, targetRootFS, apkEmbeddedLibrary) {
689689
this.symbols = [];
690690
this.parsePos = 0;
691691
this.nmExec = nmExec;
692692
this.targetRootFS = targetRootFS;
693+
this.apkEmbeddedLibrary = apkEmbeddedLibrary;
693694
this.FUNC_RE = /^([0-9a-fA-F]{8,16}) ([0-9a-fA-F]{8,16} )?[tTwW] (.*)$/;
694695
};
695696
inherits(UnixCppEntriesProvider, CppEntriesProvider);
696697

697698

698699
UnixCppEntriesProvider.prototype.loadSymbols = function(libName) {
699700
this.parsePos = 0;
701+
if (this.apkEmbeddedLibrary && libName.endsWith('.apk')) {
702+
libName = this.apkEmbeddedLibrary;
703+
}
700704
libName = this.targetRootFS + libName;
701705
try {
702706
this.symbols = [
@@ -735,8 +739,8 @@ UnixCppEntriesProvider.prototype.parseNextLine = function() {
735739
};
736740

737741

738-
function MacCppEntriesProvider(nmExec, targetRootFS) {
739-
UnixCppEntriesProvider.call(this, nmExec, targetRootFS);
742+
function MacCppEntriesProvider(nmExec, targetRootFS, apkEmbeddedLibrary) {
743+
UnixCppEntriesProvider.call(this, nmExec, targetRootFS, apkEmbeddedLibrary);
740744
// Note an empty group. It is required, as UnixCppEntriesProvider expects 3 groups.
741745
this.FUNC_RE = /^([0-9a-fA-F]{8,16})() (.*)$/;
742746
};
@@ -758,7 +762,8 @@ MacCppEntriesProvider.prototype.loadSymbols = function(libName) {
758762
};
759763

760764

761-
function WindowsCppEntriesProvider(_ignored_nmExec, targetRootFS) {
765+
function WindowsCppEntriesProvider(_ignored_nmExec, targetRootFS,
766+
_ignored_apkEmbeddedLibrary) {
762767
this.targetRootFS = targetRootFS;
763768
this.symbols = '';
764769
this.parsePos = 0;
@@ -882,6 +887,8 @@ class ArgumentsProcessor extends BaseArgumentsProcessor {
882887
'Specify the \'nm\' executable to use (e.g. --nm=/my_dir/nm)'],
883888
'--target': ['targetRootFS', '',
884889
'Specify the target root directory for cross environment'],
890+
'--apk-embedded-library': ['apkEmbeddedLibrary', '',
891+
'Specify the path of the embedded library for Android traces'],
885892
'--range': ['range', 'auto,auto',
886893
'Specify the range limit as [start],[end]'],
887894
'--distortion': ['distortion', 0,

0 commit comments

Comments
 (0)