Commit d380c9a6 authored by Pierre Langlois's avatar Pierre Langlois Committed by V8 LUCI CQ

[tools][system-analyzer] Add support for apkEmbeddedLibrary and targetRootFS

The system analyzer relies on server-side processing to symbolize C++
addresses, using lws-middleware.js:

    ws --stack system-analyzer/lws-middleware.js lws-static cors

This does not work on Android however, given the log file refers to the
stripped apk file rather than the unstripped libchrome.so binary. This
CL adds the --apk-embedded-library option to the middleware script to
make this work:

    ws --stack system-analyzer/lws-middleware.js lws-static cors  \
        --apk-embedded-library=/path/to/out/android/lib.unstripped/libchrome.so

Also, for completeness, add the --target option to set targetRootFS.

Bug: v8:10644
Change-Id: I7bb73adf49e3af8eaa88a5e2c81ec913023ac1a9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3823133
Commit-Queue: Pierre Langlois <pierre.langlois@arm.com>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82359}
parent d55c644e
......@@ -19,13 +19,35 @@ class Symbolizer {
this.objdumpExec = 'objdump';
}
optionDefinitions() {
return [
{
name: 'apk-embedded-library',
type: String,
description:
'Specify the path of the embedded library for Android traces',
},
{
name: 'target',
type: String,
description: 'Specify the target root directory for cross environment',
}
]
}
middleware(config) {
return async (ctx, next) => {
if (ctx.path == '/v8/loadVMSymbols') {
await this.parseVMSymbols(ctx)
} else if (ctx.path == '/v8/info/platform') {
ctx.response.type = 'text';
ctx.response.body = process.platform;
ctx.response.type = 'json';
ctx.response.body = JSON.stringify({
'name': process.platform,
'nmExec': this.nmExec,
'objdumpExec': this.objdumpExec,
'targetRootFS': config.target,
'apkEmbeddedLibrary': config.apkEmbeddedLibrary
});
}
await next();
}
......
......@@ -325,19 +325,25 @@ export class Processor extends LogReader {
async _setupCppEntriesProvider() {
// Probe the local symbol server for the platform:
const url = new URL('http://localhost:8000/v8/info/platform')
let platform = 'linux'
let platform = {name: 'linux'};
try {
const response = await fetch(url, {timeout: 1});
platform = await response.text();
if (response.status == 404) {
throw new Error(
`Local symbol server returned 404: ${await response.text()}`);
}
platform = await response.json();
} catch (e) {
console.warn(`Local symbol server is not running on ${url}`);
console.warn(e);
}
if (platform === 'darwin') {
this._cppEntriesProvider = new RemoteMacOSCppEntriesProvider();
} else {
this._cppEntriesProvider = new RemoteLinuxCppEntriesProvider();
let CppEntriesProvider = RemoteLinuxCppEntriesProvider;
if (platform.name === 'darwin') {
CppEntriesProvider = RemoteMacOSCppEntriesProvider;
}
this._cppEntriesProvider = new CppEntriesProvider(
platform.nmExec, platform.objdumpExec, platform.targetRootFS,
platform.apkEmbeddedLibrary);
}
processCodeCreation(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment