Add an option to the tickprocessor to specify the directory for lib lookup

This is usefull when generating a profile on one architecture and analyzing it
on another architecture or system version.

Review URL: https://chromiumcodereview.appspot.com/10704128

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12089 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent f71de19a
// Copyright 2009 the V8 project authors. All rights reserved. // Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -50,7 +50,7 @@ if (params.snapshotLogFileName) { ...@@ -50,7 +50,7 @@ if (params.snapshotLogFileName) {
snapshotLogProcessor.processLogFile(params.snapshotLogFileName); snapshotLogProcessor.processLogFile(params.snapshotLogFileName);
} }
var tickProcessor = new TickProcessor( var tickProcessor = new TickProcessor(
new (entriesProviders[params.platform])(params.nm), new (entriesProviders[params.platform])(params.nm, params.targetRootFS),
params.separateIc, params.separateIc,
params.callGraphSize, params.callGraphSize,
params.ignoreUnknown, params.ignoreUnknown,
......
// Copyright 2009 the V8 project authors. All rights reserved. // Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -608,10 +608,11 @@ CppEntriesProvider.prototype.parseNextLine = function() { ...@@ -608,10 +608,11 @@ CppEntriesProvider.prototype.parseNextLine = function() {
}; };
function UnixCppEntriesProvider(nmExec) { function UnixCppEntriesProvider(nmExec, targetRootFS) {
this.symbols = []; this.symbols = [];
this.parsePos = 0; this.parsePos = 0;
this.nmExec = nmExec; this.nmExec = nmExec;
this.targetRootFS = targetRootFS;
this.FUNC_RE = /^([0-9a-fA-F]{8,16}) ([0-9a-fA-F]{8,16} )?[tTwW] (.*)$/; this.FUNC_RE = /^([0-9a-fA-F]{8,16}) ([0-9a-fA-F]{8,16} )?[tTwW] (.*)$/;
}; };
inherits(UnixCppEntriesProvider, CppEntriesProvider); inherits(UnixCppEntriesProvider, CppEntriesProvider);
...@@ -619,6 +620,7 @@ inherits(UnixCppEntriesProvider, CppEntriesProvider); ...@@ -619,6 +620,7 @@ inherits(UnixCppEntriesProvider, CppEntriesProvider);
UnixCppEntriesProvider.prototype.loadSymbols = function(libName) { UnixCppEntriesProvider.prototype.loadSymbols = function(libName) {
this.parsePos = 0; this.parsePos = 0;
libName = this.targetRootFS + libName;
try { try {
this.symbols = [ this.symbols = [
os.system(this.nmExec, ['-C', '-n', '-S', libName], -1, -1), os.system(this.nmExec, ['-C', '-n', '-S', libName], -1, -1),
...@@ -656,8 +658,8 @@ UnixCppEntriesProvider.prototype.parseNextLine = function() { ...@@ -656,8 +658,8 @@ UnixCppEntriesProvider.prototype.parseNextLine = function() {
}; };
function MacCppEntriesProvider(nmExec) { function MacCppEntriesProvider(nmExec, targetRootFS) {
UnixCppEntriesProvider.call(this, nmExec); UnixCppEntriesProvider.call(this, nmExec, targetRootFS);
// Note an empty group. It is required, as UnixCppEntriesProvider expects 3 groups. // Note an empty group. It is required, as UnixCppEntriesProvider expects 3 groups.
this.FUNC_RE = /^([0-9a-fA-F]{8,16}) ()[iItT] (.*)$/; this.FUNC_RE = /^([0-9a-fA-F]{8,16}) ()[iItT] (.*)$/;
}; };
...@@ -666,6 +668,7 @@ inherits(MacCppEntriesProvider, UnixCppEntriesProvider); ...@@ -666,6 +668,7 @@ inherits(MacCppEntriesProvider, UnixCppEntriesProvider);
MacCppEntriesProvider.prototype.loadSymbols = function(libName) { MacCppEntriesProvider.prototype.loadSymbols = function(libName) {
this.parsePos = 0; this.parsePos = 0;
libName = this.targetRootFS + libName;
try { try {
this.symbols = [os.system(this.nmExec, ['-n', '-f', libName], -1, -1), '']; this.symbols = [os.system(this.nmExec, ['-n', '-f', libName], -1, -1), ''];
} catch (e) { } catch (e) {
...@@ -675,7 +678,8 @@ MacCppEntriesProvider.prototype.loadSymbols = function(libName) { ...@@ -675,7 +678,8 @@ MacCppEntriesProvider.prototype.loadSymbols = function(libName) {
}; };
function WindowsCppEntriesProvider() { function WindowsCppEntriesProvider(_ignored_nmExec, targetRootFS) {
this.targetRootFS = targetRootFS;
this.symbols = ''; this.symbols = '';
this.parsePos = 0; this.parsePos = 0;
}; };
...@@ -698,6 +702,7 @@ WindowsCppEntriesProvider.EXE_IMAGE_BASE = 0x00400000; ...@@ -698,6 +702,7 @@ WindowsCppEntriesProvider.EXE_IMAGE_BASE = 0x00400000;
WindowsCppEntriesProvider.prototype.loadSymbols = function(libName) { WindowsCppEntriesProvider.prototype.loadSymbols = function(libName) {
libName = this.targetRootFS + libName;
var fileNameFields = libName.match(WindowsCppEntriesProvider.FILENAME_RE); var fileNameFields = libName.match(WindowsCppEntriesProvider.FILENAME_RE);
if (!fileNameFields) return; if (!fileNameFields) return;
var mapFileName = fileNameFields[1] + '.map'; var mapFileName = fileNameFields[1] + '.map';
...@@ -785,6 +790,8 @@ function ArgumentsProcessor(args) { ...@@ -785,6 +790,8 @@ function ArgumentsProcessor(args) {
'Specify that we are running on Mac OS X platform'], 'Specify that we are running on Mac OS X platform'],
'--nm': ['nm', 'nm', '--nm': ['nm', 'nm',
'Specify the \'nm\' executable to use (e.g. --nm=/my_dir/nm)'], 'Specify the \'nm\' executable to use (e.g. --nm=/my_dir/nm)'],
'--target': ['targetRootFS', '',
'Specify the target root directory for cross environment'],
'--snapshot-log': ['snapshotLogFileName', 'snapshot.log', '--snapshot-log': ['snapshotLogFileName', 'snapshot.log',
'Specify snapshot log file to use (e.g. --snapshot-log=snapshot.log)'] 'Specify snapshot log file to use (e.g. --snapshot-log=snapshot.log)']
}; };
...@@ -804,6 +811,7 @@ ArgumentsProcessor.DEFAULTS = { ...@@ -804,6 +811,7 @@ ArgumentsProcessor.DEFAULTS = {
callGraphSize: 5, callGraphSize: 5,
ignoreUnknown: false, ignoreUnknown: false,
separateIc: false, separateIc: false,
targetRootFS: '',
nm: 'nm' nm: 'nm'
}; };
......
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