Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Side by Side Diff: tools/tickprocessor.js

Issue 155437: Implement shared libraries logging on Mac OS X, added required support in Tick Processor. (Closed)
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 413
414 CppEntriesProvider.prototype.parseNextLine = function() { 414 CppEntriesProvider.prototype.parseNextLine = function() {
415 return false; 415 return false;
416 }; 416 };
417 417
418 418
419 function UnixCppEntriesProvider(nmExec) { 419 function UnixCppEntriesProvider(nmExec) {
420 this.symbols = []; 420 this.symbols = [];
421 this.parsePos = 0; 421 this.parsePos = 0;
422 this.nmExec = nmExec; 422 this.nmExec = nmExec;
423 this.FUNC_RE = /^([0-9a-fA-F]{8}) [tTwW] (.*)$/;
423 }; 424 };
424 inherits(UnixCppEntriesProvider, CppEntriesProvider); 425 inherits(UnixCppEntriesProvider, CppEntriesProvider);
425 426
426 427
427 UnixCppEntriesProvider.FUNC_RE = /^([0-9a-fA-F]{8}) [tTwW] (.*)$/;
428
429
430 UnixCppEntriesProvider.prototype.loadSymbols = function(libName) { 428 UnixCppEntriesProvider.prototype.loadSymbols = function(libName) {
431 this.parsePos = 0; 429 this.parsePos = 0;
432 try { 430 try {
433 this.symbols = [ 431 this.symbols = [
434 os.system(this.nmExec, ['-C', '-n', libName], -1, -1), 432 os.system(this.nmExec, ['-C', '-n', libName], -1, -1),
435 os.system(this.nmExec, ['-C', '-n', '-D', libName], -1, -1) 433 os.system(this.nmExec, ['-C', '-n', '-D', libName], -1, -1)
436 ]; 434 ];
437 } catch (e) { 435 } catch (e) {
438 // If the library cannot be found on this system let's not panic. 436 // If the library cannot be found on this system let's not panic.
439 this.symbols = ['', '']; 437 this.symbols = ['', ''];
440 } 438 }
441 }; 439 };
442 440
443 441
444 UnixCppEntriesProvider.prototype.parseNextLine = function() { 442 UnixCppEntriesProvider.prototype.parseNextLine = function() {
445 if (this.symbols.length == 0) { 443 if (this.symbols.length == 0) {
446 return false; 444 return false;
447 } 445 }
448 var lineEndPos = this.symbols[0].indexOf('\n', this.parsePos); 446 var lineEndPos = this.symbols[0].indexOf('\n', this.parsePos);
449 if (lineEndPos == -1) { 447 if (lineEndPos == -1) {
450 this.symbols.shift(); 448 this.symbols.shift();
451 this.parsePos = 0; 449 this.parsePos = 0;
452 return this.parseNextLine(); 450 return this.parseNextLine();
453 } 451 }
454 452
455 var line = this.symbols[0].substring(this.parsePos, lineEndPos); 453 var line = this.symbols[0].substring(this.parsePos, lineEndPos);
456 this.parsePos = lineEndPos + 1; 454 this.parsePos = lineEndPos + 1;
457 var fields = line.match(UnixCppEntriesProvider.FUNC_RE); 455 var fields = line.match(this.FUNC_RE);
458 return fields ? { name: fields[2], start: parseInt(fields[1], 16) } : null; 456 return fields ? { name: fields[2], start: parseInt(fields[1], 16) } : null;
459 }; 457 };
460 458
461 459
460 function MacCppEntriesProvider(nmExec) {
461 UnixCppEntriesProvider.call(this, nmExec);
462 this.FUNC_RE = /^([0-9a-fA-F]{8}) [iItT] (.*)$/;
463 };
464 inherits(MacCppEntriesProvider, UnixCppEntriesProvider);
465
466
467 MacCppEntriesProvider.prototype.loadSymbols = function(libName) {
468 this.parsePos = 0;
469 try {
470 this.symbols = [os.system(this.nmExec, ['-n', '-f', libName], -1, -1), ''];
471 } catch (e) {
472 // If the library cannot be found on this system let's not panic.
473 this.symbols = '';
474 }
475 };
476
477
462 function WindowsCppEntriesProvider() { 478 function WindowsCppEntriesProvider() {
463 this.symbols = ''; 479 this.symbols = '';
464 this.parsePos = 0; 480 this.parsePos = 0;
465 }; 481 };
466 inherits(WindowsCppEntriesProvider, CppEntriesProvider); 482 inherits(WindowsCppEntriesProvider, CppEntriesProvider);
467 483
468 484
469 WindowsCppEntriesProvider.FILENAME_RE = /^(.*)\.exe$/; 485 WindowsCppEntriesProvider.FILENAME_RE = /^(.*)\.exe$/;
470 486
471 487
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 '-e': ['stateFilter', TickProcessor.VmStates.EXTERNAL, 547 '-e': ['stateFilter', TickProcessor.VmStates.EXTERNAL,
532 'Show only ticks from EXTERNAL VM state'], 548 'Show only ticks from EXTERNAL VM state'],
533 '--ignore-unknown': ['ignoreUnknown', true, 549 '--ignore-unknown': ['ignoreUnknown', true,
534 'Exclude ticks of unknown code entries from processing'], 550 'Exclude ticks of unknown code entries from processing'],
535 '--separate-ic': ['separateIc', true, 551 '--separate-ic': ['separateIc', true,
536 'Separate IC entries'], 552 'Separate IC entries'],
537 '--unix': ['platform', 'unix', 553 '--unix': ['platform', 'unix',
538 'Specify that we are running on *nix platform'], 554 'Specify that we are running on *nix platform'],
539 '--windows': ['platform', 'windows', 555 '--windows': ['platform', 'windows',
540 'Specify that we are running on Windows platform'], 556 'Specify that we are running on Windows platform'],
557 '--mac': ['platform', 'mac',
558 'Specify that we are running on Mac OS X platform'],
541 '--nm': ['nm', 'nm', 559 '--nm': ['nm', 'nm',
542 'Specify the \'nm\' executable to use (e.g. --nm=/my_dir/nm)'] 560 'Specify the \'nm\' executable to use (e.g. --nm=/my_dir/nm)']
543 }; 561 };
544 this.argsDispatch_['--js'] = this.argsDispatch_['-j']; 562 this.argsDispatch_['--js'] = this.argsDispatch_['-j'];
545 this.argsDispatch_['--gc'] = this.argsDispatch_['-g']; 563 this.argsDispatch_['--gc'] = this.argsDispatch_['-g'];
546 this.argsDispatch_['--compiler'] = this.argsDispatch_['-c']; 564 this.argsDispatch_['--compiler'] = this.argsDispatch_['-c'];
547 this.argsDispatch_['--other'] = this.argsDispatch_['-o']; 565 this.argsDispatch_['--other'] = this.argsDispatch_['-o'];
548 this.argsDispatch_['--external'] = this.argsDispatch_['-e']; 566 this.argsDispatch_['--external'] = this.argsDispatch_['-e'];
549 }; 567 };
550 568
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { 631 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) {
614 synonims.push(synArg); 632 synonims.push(synArg);
615 delete this.argsDispatch_[synArg]; 633 delete this.argsDispatch_[synArg];
616 } 634 }
617 } 635 }
618 print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]); 636 print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]);
619 } 637 }
620 quit(2); 638 quit(2);
621 }; 639 };
622 640
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698