1// Copyright 2017 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
5function processArguments(args) {
6  var processor = new ArgumentsProcessor(args);
7  if (processor.parse()) {
8    return processor.result();
9  } else {
10    processor.printUsageAndExit();
11  }
12}
13
14function initSourceMapSupport() {
15  // Pull dev tools source maps  into our name space.
16  SourceMap = WebInspector.SourceMap;
17
18  // Overwrite the load function to load scripts synchronously.
19  SourceMap.load = function(sourceMapURL) {
20    var content = readFile(sourceMapURL);
21    var sourceMapObject = (JSON.parse(content));
22    return new SourceMap(sourceMapURL, sourceMapObject);
23  };
24}
25
26var params = processArguments(arguments);
27var sourceMap = null;
28if (params.sourceMap) {
29  initSourceMapSupport();
30  sourceMap = SourceMap.load(params.sourceMap);
31}
32var parseProcessor = new ParseProcessor();
33parseProcessor.processLogFile(params.logFileName);
34