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.
- checksums.yaml +4 -4
- data/lib/rubygems_plugin.rb +38 -28
- data/lib/setup +39 -26
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f161edd302be777d8c790dce56a7b7aad461d6d599cd57e76e3ffa8e16555e39
|
4
|
+
data.tar.gz: 3cb0a40372b4b738b086a5c1976b07b526d4e49a97c7cc5700e3a86e4ea7a813
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89a2fd64f0f9884da3c3bf868de9940ca20b0970530357f232c125d6a2be42630cd49de6a53b8d7d546df47b5938af93705953bd835064f9b576aa24361cc6d0
|
7
|
+
data.tar.gz: 32aaf1d1ba6a2b5aec3ca99ca0d6f9face9fb9a100d6109f1dd3a2dedcc3f5be7fca0571b49da723a1d835c6be326cd850b11041f275cd35273b2cd0740c3657
|
data/lib/rubygems_plugin.rb
CHANGED
@@ -1,45 +1,51 @@
|
|
1
1
|
|
2
2
|
require 'pathname'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
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?(
|
14
|
-
f=File.new(
|
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?
|
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
|
27
|
+
f.puts Commond_str_subclass
|
25
28
|
f.close
|
26
29
|
end
|
27
30
|
else
|
28
|
-
f=File.new(
|
31
|
+
f=File.new(Lldb_init_path_subclass,"w+")
|
29
32
|
f.puts ''
|
30
|
-
f.puts
|
33
|
+
f.puts Commond_str_subclass
|
31
34
|
f.close
|
32
35
|
end
|
33
|
-
File.chmod(
|
36
|
+
File.chmod(0775,Lldb_init_path_subclass)
|
34
37
|
|
35
|
-
|
36
|
-
|
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
|
-
|
41
|
+
|
42
|
+
File.chmod(0775,Lldb_source_path_subclass)
|
43
|
+
|
40
44
|
scriptPath = File.dirname(Pathname.new(__FILE__).realpath)
|
41
|
-
File.
|
42
|
-
|
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(
|
62
|
-
f = File.new(
|
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?
|
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(
|
72
|
-
File.rename
|
73
|
-
File.chmod(0664,
|
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
|
79
|
-
|
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?(
|
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:
|
5
|
-
print ("Usage:")#line:
|
6
|
-
print (" subclass superclass_name eg:subclass NSObject")#line:
|
7
|
-
pass #line:
|
8
|
-
def process (
|
9
|
-
|
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:@"'''+
|
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
|
-
|
56
|
+
|
57
|
+
NSMutableString * separationSpace = [[NSMutableString alloc]init];
|
55
58
|
for (int i = 0; i < level; ++i) {
|
56
|
-
[
|
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("
|
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("
|
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("
|
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:
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
print (
|
81
|
-
def helloworld (
|
82
|
-
if
|
83
|
-
help ()#line:
|
84
|
-
else :#line:
|
85
|
-
process (
|
86
|
-
def
|
87
|
-
|
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.
|
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-
|
11
|
+
date: 2021-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: An plugin of LLDB.
|
14
14
|
email:
|