Two requested changes to tick processor.
authormikhail.naganov@gmail.com <mikhail.naganov@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Sat, 20 Jun 2009 12:54:02 +0000 (12:54 +0000)
committermikhail.naganov@gmail.com <mikhail.naganov@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Sat, 20 Jun 2009 12:54:02 +0000 (12:54 +0000)
1. If D8_PATH isn't specified, first try to locate 'd8' shell in path,
   and if not found, fallback to the one in tools_path/..
2. Add '--nm=<nm_exec>' parameter to specify 'nm' executable to use.

Review URL: http://codereview.chromium.org/132021

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2225 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

tools/linux-tick-processor
tools/tickprocessor.js

index 2de988c..c5130ff 100755 (executable)
@@ -1,12 +1,20 @@
 #!/bin/sh
 
 tools_path=`cd $(dirname "$0");pwd`
+if [ ! "$D8_PATH" ]; then
+  d8_public=`which d8`
+  if [ $d8_public ]; then D8_PATH=$(dirname "$d8_public"); fi
+fi
 [ "$D8_PATH" ] || D8_PATH=$tools_path/..
 d8_exec=$D8_PATH/d8
 
+if [ "$1" == "--no-build" ]; then
+  shift
+else
 # compile d8 if it doesn't exist, assuming this script
 # resides in the repository.
-[ -x $d8_exec ] || scons -j4 -C $D8_PATH -Y $tools_path/.. d8
+  [ -x $d8_exec ] || scons -j4 -C $D8_PATH -Y $tools_path/.. d8
+fi
 
 # nm spits out 'no symbols found' messages to stderr.
 $d8_exec $tools_path/splaytree.js $tools_path/codemap.js \
index 63c69ac..4afc69f 100644 (file)
@@ -412,9 +412,10 @@ CppEntriesProvider.prototype.parseNextLine = function() {
 };
 
 
-function UnixCppEntriesProvider() {
+function UnixCppEntriesProvider(nmExec) {
   this.symbols = [];
   this.parsePos = 0;
+  this.nmExec = nmExec;
 };
 inherits(UnixCppEntriesProvider, CppEntriesProvider);
 
@@ -426,8 +427,8 @@ UnixCppEntriesProvider.prototype.loadSymbols = function(libName) {
   this.parsePos = 0;
   try {
     this.symbols = [
-      os.system('nm', ['-C', '-n', libName], -1, -1),
-      os.system('nm', ['-C', '-n', '-D', libName], -1, -1)
+      os.system(this.nmExec, ['-C', '-n', libName], -1, -1),
+      os.system(this.nmExec, ['-C', '-n', '-D', libName], -1, -1)
     ];
   } catch (e) {
     // If the library cannot be found on this system let's not panic.
@@ -525,7 +526,8 @@ function processArguments(args) {
     platform: 'unix',
     stateFilter: null,
     ignoreUnknown: false,
-    separateIc: false
+    separateIc: false,
+    nm: 'nm'
   };
   var argsDispatch = {
     '-j': ['stateFilter', TickProcessor.VmStates.JS,
@@ -545,7 +547,9 @@ function processArguments(args) {
     '--unix': ['platform', 'unix',
         'Specify that we are running on *nix platform'],
     '--windows': ['platform', 'windows',
-        'Specify that we are running on Windows platform']
+        'Specify that we are running on Windows platform'],
+    '--nm': ['nm', 'nm',
+        'Specify the \'nm\' executable to use (e.g. --nm=/my_dir/nm)']
   };
   argsDispatch['--js'] = argsDispatch['-j'];
   argsDispatch['--gc'] = argsDispatch['-g'];
@@ -577,9 +581,15 @@ function processArguments(args) {
       break;
     }
     args.shift();
+    var userValue = null;
+    var eqPos = arg.indexOf('=');
+    if (eqPos != -1) {
+      userValue = arg.substr(eqPos + 1);
+      arg = arg.substr(0, eqPos);
+    }
     if (arg in argsDispatch) {
       var dispatch = argsDispatch[arg];
-      result[dispatch[0]] = dispatch[1];
+      result[dispatch[0]] = userValue == null ? dispatch[1] : userValue;
     } else {
       printUsageAndExit();
     }
@@ -594,7 +604,7 @@ function processArguments(args) {
 
 var params = processArguments(arguments);
 var tickProcessor = new TickProcessor(
-    params.platform == 'unix' ? new UnixCppEntriesProvider() :
+    params.platform == 'unix' ? new UnixCppEntriesProvider(params.nm) :
         new WindowsCppEntriesProvider(),
     params.separateIc,
     params.ignoreUnknown,