@@ -420,13 +420,11 @@ function UnixCppEntriesProvider(nmExec) {
420
420
this . symbols = [ ] ;
421
421
this . parsePos = 0 ;
422
422
this . nmExec = nmExec ;
423
+ this . FUNC_RE = / ^ ( [ 0 - 9 a - f A - F ] { 8 } ) [ t T w W ] ( .* ) $ / ;
423
424
} ;
424
425
inherits ( UnixCppEntriesProvider , CppEntriesProvider ) ;
425
426
426
427
427
- UnixCppEntriesProvider . FUNC_RE = / ^ ( [ 0 - 9 a - f A - F ] { 8 } ) [ t T w W ] ( .* ) $ / ;
428
-
429
-
430
428
UnixCppEntriesProvider . prototype . loadSymbols = function ( libName ) {
431
429
this . parsePos = 0 ;
432
430
try {
@@ -454,11 +452,29 @@ UnixCppEntriesProvider.prototype.parseNextLine = function() {
454
452
455
453
var line = this . symbols [ 0 ] . substring ( this . parsePos , lineEndPos ) ;
456
454
this . parsePos = lineEndPos + 1 ;
457
- var fields = line . match ( UnixCppEntriesProvider . FUNC_RE ) ;
455
+ var fields = line . match ( this . FUNC_RE ) ;
458
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 - 9 a - f A - F ] { 8 } ) [ i I t T ] ( .* ) $ / ;
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
478
function WindowsCppEntriesProvider ( ) {
463
479
this . symbols = '' ;
464
480
this . parsePos = 0 ;
@@ -538,6 +554,8 @@ function ArgumentsProcessor(args) {
538
554
'Specify that we are running on *nix platform' ] ,
539
555
'--windows' : [ 'platform' , 'windows' ,
540
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
559
'--nm' : [ 'nm' , 'nm' ,
542
560
'Specify the \'nm\' executable to use (e.g. --nm=/my_dir/nm)' ]
543
561
} ;
0 commit comments