File tree 1 file changed +37
-0
lines changed
1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* parser symbols files from xcode */
2
+ const mapFileName = "r2.map" ;
3
+
4
+ function filterFlag ( symName ) {
5
+ return "sym." + symName . replace ( / [ ^ a - z A - Z 0 - 9 ] / g, '_' ) ;
6
+ }
7
+
8
+ function loadFlagsFromSymbols ( fileName ) {
9
+ const script = [ ] ;
10
+ const lines = r2 . syscmds ( "xcrun symbols " + fileName ) . split ( "\n" ) ;
11
+ for ( const line of lines ) {
12
+ if ( line . indexOf ( "0x" ) !== - 1 ) {
13
+ if ( line . indexOf ( "FUNC" ) !== - 1 ) {
14
+ const adr = line . indexOf ( "(" ) ;
15
+ const beg = line . indexOf ( ")" ) ;
16
+ const end = line . indexOf ( "[" ) ;
17
+ if ( beg !== - 1 && end !== - 1 && adr !== - 1 ) {
18
+ const addr = line . substr ( 0 , adr ) . trim ( ) ;
19
+ const name = line . substr ( beg , end - beg ) . trim ( ) ;
20
+ script . push ( "'f " + name + " = " + addr ) ;
21
+ }
22
+ } else {
23
+ const adr = line . indexOf ( "(" ) ;
24
+ const beg = line . indexOf ( ")" ) ;
25
+ if ( beg !== - 1 && adr !== - 1 ) {
26
+ const addr = line . substr ( 0 , adr ) . trim ( ) ;
27
+ const file = line . substr ( adr ) . trim ( ) ;
28
+ script . push ( "'CL " + addr + " = " + file ) ;
29
+ }
30
+ }
31
+ }
32
+ }
33
+ return script ;
34
+ }
35
+
36
+ loadFlagsFromSymbols ( mapFileName ) . map ( r2 . cmd ) ;
37
+
You can’t perform that action at this time.
0 commit comments