Home | History | Annotate | Download | only in tools
      1 // Copyright 2016 the V8 project authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // Dump C++ symbols of shared library if possible
      6 
      7 function processArguments(args) {
      8   var processor = new ArgumentsProcessor(args);
      9   if (processor.parse()) {
     10     return processor.result();
     11   } else {
     12     processor.printUsageAndExit();
     13   }
     14 }
     15 
     16 function initSourceMapSupport() {
     17   // Pull dev tools source maps into our name space.
     18   SourceMap = WebInspector.SourceMap;
     19 
     20   // Overwrite the load function to load scripts synchronously.
     21   SourceMap.load = function(sourceMapURL) {
     22     var content = readFile(sourceMapURL);
     23     var sourceMapObject = (JSON.parse(content));
     24     return new SourceMap(sourceMapURL, sourceMapObject);
     25   };
     26 }
     27 
     28 var entriesProviders = {
     29   'unix': UnixCppEntriesProvider,
     30   'windows': WindowsCppEntriesProvider,
     31   'mac': MacCppEntriesProvider
     32 };
     33 
     34 var params = processArguments(arguments);
     35 var sourceMap = null;
     36 if (params.sourceMap) {
     37   initSourceMapSupport();
     38   sourceMap = SourceMap.load(params.sourceMap);
     39 }
     40 
     41 var cppProcessor = new CppProcessor(
     42   new (entriesProviders[params.platform])(params.nm, params.targetRootFS),
     43   params.timedRange, params.pairwiseTimedRange);
     44 cppProcessor.processLogFile(params.logFileName);
     45 cppProcessor.dumpCppSymbols();
     46