ileitch-hijack 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -4
- data/lib/hijack/gdb.rb +28 -5
- data/test/app.rb +7 -0
- data/test/gc.rb +14 -0
- data/test/test.rb +17 -0
- metadata +5 -3
data/README.rdoc
CHANGED
@@ -8,7 +8,7 @@ Hijack uses DRb over a unix socket file, so you need to be on the same machine a
|
|
8
8
|
|
9
9
|
== WARNING
|
10
10
|
|
11
|
-
Hijack is new code, I'd think twice about trying it out on your critical production systems. I'd love to get some feedback though so if you have any staging systems to try it out on then please do
|
11
|
+
Hijack is new code, I'd think twice about trying it out on your critical production systems. I'd love to get some feedback though so if you have any development or staging systems to try it out on then please do!
|
12
12
|
|
13
13
|
== Using Hijack
|
14
14
|
|
@@ -113,12 +113,12 @@ Instead of pasting your code into hijack, you can pass hijack the -e option at s
|
|
113
113
|
|
114
114
|
== Process Output
|
115
115
|
|
116
|
-
By default hijack will forward your process output to the hijack client. This can get a little messy if your trying to
|
116
|
+
By default hijack will forward your process output to the hijack client. This can get a little messy if your trying to write code at the same time as the target process writes to STDOUT/STDERR. You can mute and unmute the process with:
|
117
117
|
|
118
118
|
>> hijack_mute
|
119
|
-
|
119
|
+
=> true
|
120
120
|
>> hijack_unmute
|
121
|
-
|
121
|
+
=> true
|
122
122
|
|
123
123
|
== Process Mirroring
|
124
124
|
|
data/lib/hijack/gdb.rb
CHANGED
@@ -15,20 +15,43 @@ module Hijack
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def eval(cmd)
|
18
|
+
set_trap_pending
|
19
|
+
set_breakpoint
|
20
|
+
continue
|
21
|
+
clear_breakpoint
|
18
22
|
call("(void)rb_eval_string(#{cmd.strip.gsub(/"/, '\"').inspect})")
|
19
23
|
end
|
20
24
|
|
21
25
|
def detach
|
22
|
-
|
23
|
-
|
24
|
-
@gdb.puts('quit')
|
26
|
+
exec('detach')
|
27
|
+
exec('quit')
|
25
28
|
@gdb.close
|
26
29
|
end
|
27
30
|
|
28
31
|
protected
|
32
|
+
def set_trap_pending
|
33
|
+
exec("set variable (int)rb_trap_pending=1")
|
34
|
+
end
|
35
|
+
|
36
|
+
def set_breakpoint
|
37
|
+
exec("break rb_trap_exec")
|
38
|
+
end
|
39
|
+
|
40
|
+
def clear_breakpoint
|
41
|
+
exec("clear rb_trap_exec")
|
42
|
+
end
|
43
|
+
|
44
|
+
def continue
|
45
|
+
exec('continue')
|
46
|
+
end
|
47
|
+
|
29
48
|
def call(cmd)
|
30
|
-
|
31
|
-
|
49
|
+
exec("call #{cmd}")
|
50
|
+
end
|
51
|
+
|
52
|
+
def exec(str)
|
53
|
+
puts("(gdb) #{str}") if @verbose
|
54
|
+
@gdb.puts(str)
|
32
55
|
wait
|
33
56
|
end
|
34
57
|
|
data/test/app.rb
ADDED
data/test/gc.rb
ADDED
data/test/test.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ileitch-hijack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Leitch
|
@@ -34,9 +34,11 @@ files:
|
|
34
34
|
- lib/hijack/workspace.rb
|
35
35
|
- examples/rails_dispatcher.rb
|
36
36
|
- bin/hijack
|
37
|
+
- test/app.rb
|
38
|
+
- test/gc.rb
|
39
|
+
- test/test.rb
|
37
40
|
has_rdoc: true
|
38
41
|
homepage: http://github.com/ileitch/hijack
|
39
|
-
licenses:
|
40
42
|
post_install_message:
|
41
43
|
rdoc_options: []
|
42
44
|
|
@@ -57,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
59
|
requirements: []
|
58
60
|
|
59
61
|
rubyforge_project:
|
60
|
-
rubygems_version: 1.
|
62
|
+
rubygems_version: 1.2.0
|
61
63
|
signing_key:
|
62
64
|
specification_version: 2
|
63
65
|
summary: Provides an irb session to an existing ruby process.
|