subclass_lldb 0.0.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rubygems_plugin.rb +15 -5
  3. data/lib/setup +39 -26
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6c7a629c51a2fd748ae046602e8fe69c9a6eb51c3c280b9571e64b9f4ff4608
4
- data.tar.gz: 944f0028d854bcf7931a0e29e8629fa54a1f29f0da57646c15c62c15deff538b
3
+ metadata.gz: 162a16812ef22ef82242d2b7311772f34254e65ad6920cf84389679fc0dc77d0
4
+ data.tar.gz: 96b24a6620b7e6c67bf937cf655737e95485284fe337bfe59c902c36756e4f12
5
5
  SHA512:
6
- metadata.gz: 3aea680606ab18946dbc7dd05d5f046b7775d0df301c4662d5970c4a060f272eab637cebd3ce0dfe893e12a3f085300799f9717d8a885e8812a797a201b05de5
7
- data.tar.gz: d25434a1f56334c64103737c8eb00f111752f77f8df77ff493db79c4b3437acb87c8711c730890684766683185c3147b9ad2f7c04bf5e6d3d4258d63e3c09e00
6
+ metadata.gz: da8cdf3d3c5095047f854c31d8d8fa688075a0ce2c72d08ae593730d16dbecdb6a4a3df4c9af09cddf5f6b31ca14fa2bd76f04b406d91ac96fe2cbc3040e3b73
7
+ data.tar.gz: 4dedfb2c56795bce082c06ce61f72c832174190bae6f37de859a3f83f99417eba66812a0b959a566d824abaf3885fbc9905b6307214237955fe009716653710f
@@ -7,7 +7,10 @@ Lldb_source_path = File.expand_path('~')+'/.subclass_lldb'
7
7
  Lldb_file_path = File.expand_path('~')+'/.subclass_lldb/subclass_lldb.py'
8
8
  Commond_str = 'command script import '+Lldb_file_path
9
9
 
10
- Gem.post_install do
10
+ Gem.post_install do |installer|
11
+ if installer.spec.name != "subclass_lldb"
12
+ return
13
+ end
11
14
 
12
15
  # 配置 .lldbinit
13
16
  if File.exist?(Lldb_init_path)
@@ -30,16 +33,19 @@ Gem.post_install do
30
33
  f.puts Commond_str
31
34
  f.close
32
35
  end
33
- File.chmod(0664,Lldb_init_path)
36
+ File.chmod(0775,Lldb_init_path)
34
37
 
35
- # 配置执行脚本
36
38
  if !File.exist?(Lldb_source_path)
37
39
  Dir.mkdir(Lldb_source_path)
38
40
  end
41
+
39
42
  File.chmod(0775,Lldb_source_path)
43
+
40
44
  scriptPath = File.dirname(Pathname.new(__FILE__).realpath)
41
- File.rename scriptPath+'/setup', Lldb_file_path
42
- File.chmod(0775,Lldb_file_path)
45
+ if File.exist?(scriptPath+'/setup')
46
+ File.rename scriptPath+'/setup', Lldb_file_path
47
+ File.chmod(0775,Lldb_file_path)
48
+ end
43
49
 
44
50
  puts "Please use the subclass command in your Xcode LLDB."
45
51
  end
@@ -75,6 +81,10 @@ def remove_file()
75
81
  end
76
82
 
77
83
  Gem.post_uninstall do
84
+ if installer.spec.name != "subclass_lldb"
85
+ return
86
+ end
87
+
78
88
  if File.exist?(Lldb_source_path)
79
89
  remove_dir(Lldb_source_path)
80
90
  end
data/lib/setup CHANGED
@@ -1,12 +1,12 @@
1
1
  # !/usr/bin/env python3
2
2
  import lldb #line:5
3
3
  import re #line:6
4
- def help ():#line:8
5
- print ("Usage:")#line:9
6
- print (" isource superclass eg:isource NSObject")#line:10
7
- pass #line:11
8
- def process (OO000O00OOO000O00 ):#line:13
9
- OO00OO0OO00OOO0OO =r'''
4
+ def help ():#line:50
5
+ print ("Usage:")#line:51
6
+ print (" subclass superclass_name eg:subclass NSObject")#line:52
7
+ pass #line:53
8
+ def process (OOOOOO0O00O0OO00O ):#line:55
9
+ OOO00OO000OO00OO0 =r'''
10
10
  @import <dlfcn.h>;
11
11
  @import <objc/runtime.h>;
12
12
  @import Foundation;
@@ -19,9 +19,10 @@ def process (OO000O00OOO000O00 ):#line:13
19
19
  classes = (const char **)objc_copyClassNamesForImage(info.dli_fname, &count);
20
20
 
21
21
  NSInteger level = 0;//继承层级
22
+ NSInteger backLevel = 0;//继承层级
22
23
  NSMutableDictionary * visited_class = [[NSMutableDictionary alloc]init];
23
24
  NSMutableArray * class_stack = [[NSMutableArray alloc] init];
24
- [class_stack addObject:@"'''+OO000O00OOO000O00 +'''"];
25
+ [class_stack addObject:@"'''+OOOOOO0O00O0OO00O +'''"];
25
26
  BOOL isPrint = NO;
26
27
  printf("\\n");
27
28
  while (true) {
@@ -48,22 +49,33 @@ def process (OO000O00OOO000O00 ):#line:13
48
49
  } else {
49
50
  [class_stack removeObjectAtIndex:0];
50
51
  level -= 1;
52
+ backLevel += 1;
51
53
  }
52
54
 
53
55
  } else {
54
- NSMutableString * separation = [[NSMutableString alloc]init];
56
+
57
+ NSMutableString * separationSpace = [[NSMutableString alloc]init];
55
58
  for (int i = 0; i < level; ++i) {
56
- [separation appendString:@"----"];
59
+ [separationSpace appendString:@" |"];
60
+ }
61
+
62
+ NSMutableString * backLevelSpace = [[NSMutableString alloc]init];
63
+ for (int i = 0; i < backLevel-1; ++i) {
64
+ [backLevelSpace appendString:@" |"];
57
65
  }
66
+
67
+ backLevel = 0;
68
+
58
69
  if (isPrint == YES) {
59
- printf("|\\n");
70
+ printf("|%s%s\\n",(char *)[[separationSpace copy] UTF8String],(char *)[[backLevelSpace copy] UTF8String]);
60
71
  }
61
72
  NSString * temp = (NSString*)NSStringFromClass((Class)class_getSuperclass(NSClassFromString(current_class)));
62
73
  if (temp.length > 0) {
63
- printf("|--%s%s : %s (L%s) \\n",(char *)[[separation copy] UTF8String],(char *)[current_class UTF8String],(char *)[temp UTF8String],(char *)[[NSString stringWithFormat:@"%ld",(long)level] UTF8String]);
74
+ printf("|%s----%s : %s (L%s) \\n",(char *)[[separationSpace copy] UTF8String],(char *)[current_class UTF8String],(char *)[temp UTF8String],(char *)[[NSString stringWithFormat:@"%ld",(long)level] UTF8String]);
64
75
  } else {
65
- printf("|--%s%s (L%s) \\n",(char *)[[separation copy] UTF8String],(char *)[current_class UTF8String],(char *)[[NSString stringWithFormat:@"%ld",(long)level] UTF8String]);
76
+ printf("|----%s (L%s) \\n",(char *)[current_class UTF8String],(char *)[[NSString stringWithFormat:@"%ld",(long)level] UTF8String]);
66
77
  }
78
+
67
79
  isPrint = YES;
68
80
  [visited_class setObject:@1 forKey:current_class];
69
81
  }
@@ -71,17 +83,18 @@ def process (OO000O00OOO000O00 ):#line:13
71
83
  break;
72
84
  }
73
85
  }
74
- '''#line:79
75
- O0OO0O000O000O00O =lldb .debugger .GetCommandInterpreter ()#line:81
76
- OO000O0O0O0O0O0O0 =lldb .SBCommandReturnObject ()#line:82
77
- O0OO0O000O000O00O .HandleCommand ('expression -lobjc -O -- '+OO00OO0OO00OOO0OO ,OO000O0O0O0O0O0O0 )#line:84
78
- OOO00OOO0000O00O0 =OO000O0O0O0O0O0O0 .GetOutput ()#line:85
79
- OOO00000O0OOO00OO =re .search ('error',OOO00OOO0000O00O0 )#line:86
80
- print (OO000O0O0O0O0O0O0 .GetError ())#line:87
81
- def helloworld (OOOOO0O0OO0OOO00O ,OOOOO00OO00O000OO ,O0000OOO0O0OOOOO0 ,O00O0O00O00OOOO00 ):#line:90
82
- if OOOOO00OO00O000OO ==None or OOOOO00OO00O000OO =='-h':#line:92
83
- help ()#line:93
84
- else :#line:94
85
- process (OOOOO00OO00O000OO )#line:95
86
- def __OOO00OOO00O00O00O (OO000OOO0O000O0OO ,OOOOO0OOOOOOOOO00 ):#line:98
87
- OO000OOO0O000O0OO .HandleCommand ("command script add -f subclass_lldb.helloworld subclass")#line:99
86
+ '''#line:133
87
+ OO00OOOO00OOO0000 =lldb .debugger .GetCommandInterpreter ()#line:135
88
+ OO00000OOO0OOOO00 =lldb .SBCommandReturnObject ()#line:136
89
+ OO00OOOO00OOO0000 .HandleCommand ('expression -lobjc -O -- '+OOO00OO000OO00OO0 ,OO00000OOO0OOOO00 )#line:138
90
+ OOO0O00OOOO0OO0OO =OO00000OOO0OOOO00 .GetOutput ()#line:139
91
+ OO000000O0O000O0O =re .search ('error',OOO0O00OOOO0OO0OO )#line:140
92
+ print (OO00000OOO0OOOO00 .GetError ())#line:141
93
+ def helloworld (O00O0OOO00O0O000O ,O0OO0OOOO00OO0O00 ,OOOOO0OOO0OO00OOO ,OOOO00000OO0O0000 ):#line:144
94
+ if O0OO0OOOO00OO0O00 ==None or O0OO0OOOO00OO0O00 =='-h':#line:146
95
+ help ()#line:147
96
+ else :#line:148
97
+ process (O0OO0OOOO00OO0O00 )#line:149
98
+ def __O00OO0O0OO00O0O00 (OOO00OO00000OOO00 ,OOO0OOO0OO0000000 ):#line:152
99
+ print ("__lldb_init_module")#line:153
100
+ OOO00OO00000OOO00 .HandleCommand ("command script add -f subclass_lldb.helloworld subclass")#line:155
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subclass_lldb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ningyuan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-15 00:00:00.000000000 Z
11
+ date: 2021-06-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: An plugin of LLDB.
14
14
  email: