subclass_lldb 0.0.5 → 0.2.1

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 +38 -28
  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: 49821ae864f36e5147ef890b8d651aff9ccf4063fc3220b74532d5e67644a00f
4
- data.tar.gz: 409e87aecf75da0dafcde76279de708280171fe051083ce271952b086d03f85f
3
+ metadata.gz: f161edd302be777d8c790dce56a7b7aad461d6d599cd57e76e3ffa8e16555e39
4
+ data.tar.gz: 3cb0a40372b4b738b086a5c1976b07b526d4e49a97c7cc5700e3a86e4ea7a813
5
5
  SHA512:
6
- metadata.gz: 3b92a0c3e3ef7bff8c8f2842e4e1818d56c4409953fb251dbb84eae14ab72368d37afcb368880abef713cfab0c88909ab6134b11d806ba76c7ab0ef9f39238f5
7
- data.tar.gz: 68c094945c68e8b0ba3967ebf623611a1eccbf6497f7afc2243e07a8198e719b6b171be14a09dd02e6ec94ee97282ea6ec08dde2d768239d771005c37eb23157
6
+ metadata.gz: 89a2fd64f0f9884da3c3bf868de9940ca20b0970530357f232c125d6a2be42630cd49de6a53b8d7d546df47b5938af93705953bd835064f9b576aa24361cc6d0
7
+ data.tar.gz: 32aaf1d1ba6a2b5aec3ca99ca0d6f9face9fb9a100d6109f1dd3a2dedcc3f5be7fca0571b49da723a1d835c6be326cd850b11041f275cd35273b2cd0740c3657
@@ -1,45 +1,51 @@
1
1
 
2
2
  require 'pathname'
3
3
 
4
- Lldb_init_path = File.expand_path('~')+'/.lldbinit'
5
- Lldb_init_path_temp = File.expand_path('~')+'/.lldbinit_temp'
6
- Lldb_source_path = File.expand_path('~')+'/.subclass_lldb'
7
- Lldb_file_path = File.expand_path('~')+'/.subclass_lldb/subclass_lldb.py'
8
- Commond_str = 'command script import '+Lldb_file_path
4
+ Lldb_init_path_subclass = File.expand_path('~')+'/.lldbinit'
5
+ Lldb_init_path_temp_subclass = File.expand_path('~')+'/.lldbinit_temp'
6
+ Lldb_source_path_subclass = File.expand_path('~')+'/.subclass_lldb'
7
+ Lldb_file_path_subclass = File.expand_path('~')+'/.subclass_lldb/subclass_lldb.py'
8
+ Commond_str_subclass = 'command script import '+Lldb_file_path_subclass
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
- if File.exist?(Lldb_init_path)
14
- f=File.new(Lldb_init_path,"a+")
16
+ if File.exist?(Lldb_init_path_subclass)
17
+ f=File.new(Lldb_init_path_subclass,"a+")
15
18
  data = f.readlines
16
19
  isExist = false
17
20
  data.each do |d|
18
- if d.chomp.include?Commond_str
21
+ if d.chomp.include?Commond_str_subclass
19
22
  isExist = true
20
23
  end
21
24
  end
22
25
  if isExist == false
23
26
  f.puts ''
24
- f.puts Commond_str
27
+ f.puts Commond_str_subclass
25
28
  f.close
26
29
  end
27
30
  else
28
- f=File.new(Lldb_init_path,"w+")
31
+ f=File.new(Lldb_init_path_subclass,"w+")
29
32
  f.puts ''
30
- f.puts Commond_str
33
+ f.puts Commond_str_subclass
31
34
  f.close
32
35
  end
33
- File.chmod(0664,Lldb_init_path)
36
+ File.chmod(0775,Lldb_init_path_subclass)
34
37
 
35
- # 配置执行脚本
36
- if !File.exist?(Lldb_source_path)
37
- Dir.mkdir(Lldb_source_path)
38
+ if !File.exist?(Lldb_source_path_subclass)
39
+ Dir.mkdir(Lldb_source_path_subclass)
38
40
  end
39
- File.chmod(0775,Lldb_source_path)
41
+
42
+ File.chmod(0775,Lldb_source_path_subclass)
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_subclass
47
+ File.chmod(0775,Lldb_file_path_subclass)
48
+ end
43
49
 
44
50
  puts "Please use the subclass command in your Xcode LLDB."
45
51
  end
@@ -58,28 +64,32 @@ def remove_dir(path)
58
64
  end
59
65
 
60
66
  def remove_file()
61
- f_temp = File.new(Lldb_init_path_temp,"w")
62
- f = File.new(Lldb_init_path, 'r')
67
+ f_temp = File.new(Lldb_init_path_temp_subclass,"w")
68
+ f = File.new(Lldb_init_path_subclass, 'r')
63
69
  f.each do |line|
64
- if !line.chomp.include?Commond_str
70
+ if !line.chomp.include?Commond_str_subclass
65
71
  f_temp.puts line
66
72
  end
67
73
  end
68
74
  f.close
69
75
  f_temp.close
70
76
 
71
- File.delete(Lldb_init_path)
72
- File.rename Lldb_init_path_temp, Lldb_init_path
73
- File.chmod(0664,Lldb_init_path)
77
+ File.delete(Lldb_init_path_subclass)
78
+ File.rename Lldb_init_path_temp_subclass, Lldb_init_path_subclass
79
+ File.chmod(0664,Lldb_init_path_subclass)
74
80
 
75
81
  end
76
82
 
77
83
  Gem.post_uninstall do
78
- if File.exist?(Lldb_source_path)
79
- remove_dir(Lldb_source_path)
84
+ if installer.spec.name != "subclass_lldb"
85
+ return
86
+ end
87
+
88
+ if File.exist?(Lldb_source_path_subclass)
89
+ remove_dir(Lldb_source_path_subclass)
80
90
  end
81
91
 
82
- if File.exist?(Lldb_init_path)
92
+ if File.exist?(Lldb_init_path_subclass)
83
93
  remove_file()
84
94
  end
85
95
 
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 (" subclass superclass_name eg:subclass NSObject")#line:10
7
- pass #line:11
8
- def process (OO0OOO00O00000OOO ):#line:13
9
- O0OO0OOO00O00000O =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 (OO0OOO00O00000OOO ):#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:@"'''+OO0OOO00O00000OOO +'''"];
25
+ [class_stack addObject:@"'''+OOOOOO0O00O0OO00O +'''"];
25
26
  BOOL isPrint = NO;
26
27
  printf("\\n");
27
28
  while (true) {
@@ -48,22 +49,33 @@ def process (OO0OOO00O00000OOO ):#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 (OO0OOO00O00000OOO ):#line:13
71
83
  break;
72
84
  }
73
85
  }
74
- '''#line:79
75
- O0O0O0O0O00OOOO00 =lldb .debugger .GetCommandInterpreter ()#line:81
76
- O0O0O0OOOO0OO0OOO =lldb .SBCommandReturnObject ()#line:82
77
- O0O0O0O0O00OOOO00 .HandleCommand ('expression -lobjc -O -- '+O0OO0OOO00O00000O ,O0O0O0OOOO0OO0OOO )#line:84
78
- O0OOO00O0OO0O0000 =O0O0O0OOOO0OO0OOO .GetOutput ()#line:85
79
- OOOOO000OO00OO000 =re .search ('error',O0OOO00O0OO0O0000 )#line:86
80
- print (O0O0O0OOOO0OO0OOO .GetError ())#line:87
81
- def helloworld (O00OO0O000O0000O0 ,OO0OOO000000O00OO ,OO0OOO0000OO000OO ,O0OOOO00O00O0O0O0 ):#line:90
82
- if OO0OOO000000O00OO ==None or OO0OOO000000O00OO =='-h':#line:92
83
- help ()#line:93
84
- else :#line:94
85
- process (OO0OOO000000O00OO )#line:95
86
- def __O000OO00000OOO0OO (OO000OOO0O00O0OO0 ,OOOOO00000OOO00O0 ):#line:98
87
- OO000OOO0O00O0OO0 .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.5
4
+ version: 0.2.1
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-16 00:00:00.000000000 Z
11
+ date: 2021-06-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: An plugin of LLDB.
14
14
  email: