tduehr-ragweed 0.1.5 → 0.1.6
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.
- data/History.txt +4 -0
- data/examples/hittracertux.rb +2 -1
- data/examples/tux-example.rb +8 -7
- data/lib/ragweed.rb +1 -1
- data/lib/ragweed/debuggertux.rb +7 -7
- data/lib/ragweed/rasm.rb +1 -1
- data/lib/ragweed/utils.rb +5 -4
- data/lib/ragweed/wrap32.rb +1 -1
- data/lib/ragweed/wraposx.rb +1 -1
- data/lib/ragweed/wraposx/region_info.rb +0 -1
- data/lib/ragweed/wraposx/thread_info.rb +14 -2
- data/lib/ragweed/wraptux.rb +1 -1
- data/lib/ragweed/wraptux/threads.rb +6 -2
- metadata +1 -1
data/History.txt
CHANGED
data/examples/hittracertux.rb
CHANGED
data/examples/tux-example.rb
CHANGED
@@ -3,21 +3,22 @@
|
|
3
3
|
## Simple example of attaching to a process and letting it run
|
4
4
|
|
5
5
|
require 'pp'
|
6
|
+
require 'ragweed'
|
6
7
|
require 'debuggertux'
|
7
8
|
include Ragweed
|
8
9
|
|
9
|
-
pid = Debuggertux.find_by_regex(/gcalctool/)
|
10
|
+
pid = Ragweed::Debuggertux.find_by_regex(/gcalctool/)
|
10
11
|
|
11
|
-
begin
|
12
|
-
t = Debuggertux.
|
12
|
+
#begin
|
13
|
+
t = Ragweed::Debuggertux.threads(pid)
|
13
14
|
puts "Which thread do you want to attach to?"
|
14
15
|
t.each do |h| puts h end
|
15
16
|
pid = STDIN.gets.chomp.to_i
|
16
17
|
|
17
|
-
d = Debuggertux.new(pid)
|
18
|
+
d = Ragweed::Debuggertux.new(pid)
|
18
19
|
d.attach
|
19
20
|
d.continue
|
20
21
|
catch(:throw) { d.loop }
|
21
|
-
rescue
|
22
|
-
puts "Maybe your PID is wrong?"
|
23
|
-
end
|
22
|
+
#rescue
|
23
|
+
# puts "Maybe your PID is wrong?"
|
24
|
+
#end
|
data/lib/ragweed.rb
CHANGED
data/lib/ragweed/debuggertux.rb
CHANGED
@@ -112,13 +112,6 @@ class Ragweed::Debuggertux
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
-
## Return an array of thread PIDs
|
116
|
-
def self.get_thread_pids(pid)
|
117
|
-
a = Dir.entries("/proc/#{pid}/task/")
|
118
|
-
a.delete_if do |x| x == '.' end
|
119
|
-
a.delete_if do |x| x == '..' end
|
120
|
-
end
|
121
|
-
|
122
115
|
def install_bps
|
123
116
|
@breakpoints.each do |k,v|
|
124
117
|
v.install
|
@@ -254,6 +247,13 @@ class Ragweed::Debuggertux
|
|
254
247
|
end
|
255
248
|
end
|
256
249
|
|
250
|
+
## Return an array of thread PIDs
|
251
|
+
def self.threads(pid)
|
252
|
+
a = Dir.entries("/proc/#{pid}/task/")
|
253
|
+
a.delete_if do |x| x == '.' end
|
254
|
+
a.delete_if do |x| x == '..' end
|
255
|
+
end
|
256
|
+
|
257
257
|
## Gets the registers for the given process
|
258
258
|
def get_registers
|
259
259
|
size = Wraptux::SIZEOFLONG * 17
|
data/lib/ragweed/rasm.rb
CHANGED
data/lib/ragweed/utils.rb
CHANGED
@@ -17,10 +17,6 @@ class Object
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
def pbpaste
|
21
|
-
`pbpaste`
|
22
|
-
end if RUBY_PLATFORM =~ /darwin/
|
23
|
-
|
24
20
|
## This is from Topher Cyll's Stupd IRB tricks
|
25
21
|
def mymethods
|
26
22
|
(self.methods - self.class.superclass.methods).sort
|
@@ -40,6 +36,11 @@ class String
|
|
40
36
|
def shift_l16; shift(2).to_l16; end
|
41
37
|
def shift_b16; shift(2).to_b16; end
|
42
38
|
def shift_u8; shift(1).to_u8; end
|
39
|
+
|
40
|
+
def shift(count=1)
|
41
|
+
return self if count == 0
|
42
|
+
slice! 0..(count-1)
|
43
|
+
end
|
43
44
|
end
|
44
45
|
|
45
46
|
class Integer
|
data/lib/ragweed/wrap32.rb
CHANGED
data/lib/ragweed/wraposx.rb
CHANGED
@@ -50,7 +50,6 @@ class Ragweed::Wraposx::RegionInfo
|
|
50
50
|
# (re)loads the data from str
|
51
51
|
def refresh(str)
|
52
52
|
fields = self.class.const_get :FIELDS
|
53
|
-
# pp self.class
|
54
53
|
if str and not str.empty?
|
55
54
|
str.unpack(fields.map {|x| x[1]}.join("")).each_with_index do |val, i|
|
56
55
|
raise "i is nil" if i.nil?
|
@@ -1,5 +1,17 @@
|
|
1
1
|
module Ragweed; end
|
2
2
|
module Ragweed::Wraposx::ThreadInfo
|
3
|
+
class << self
|
4
|
+
#factory method to get a ThreadInfo variant
|
5
|
+
def self.get(flavor,tid)
|
6
|
+
found = false
|
7
|
+
klass = self.constants.detect{|c| con = self.const_get(c); con.kind_of?(Class) && (flavor == con.const_get(:FLAVOR))}
|
8
|
+
if klass.nil?
|
9
|
+
raise Ragwed::Wraposx::KErrno::INVALID_ARGUMENT
|
10
|
+
else
|
11
|
+
klass.get(tid)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
3
15
|
|
4
16
|
# info interfaces
|
5
17
|
BASIC_INFO = 3 #basic information
|
@@ -58,7 +70,7 @@ module Ragweed::Wraposx::ThreadInfo
|
|
58
70
|
"#{f[0]}=#{send(f[0]).to_s}"
|
59
71
|
end.join(", ")
|
60
72
|
end
|
61
|
-
"#<#{self.class} #{body.call}>"
|
73
|
+
"#<#{self.class.name.split('::').last(2).join('::')} #{body.call}>"
|
62
74
|
end
|
63
75
|
|
64
76
|
def self.get(t)
|
@@ -91,7 +103,7 @@ module Ragweed::Wraposx::ThreadInfo
|
|
91
103
|
|
92
104
|
attr_accessor :user_time
|
93
105
|
attr_accessor :system_time
|
94
|
-
alias_method :__refresh :refresh
|
106
|
+
alias_method :__refresh, :refresh
|
95
107
|
(FIELDS = [ [:user_time_s, "I"],
|
96
108
|
[:user_time_us, "I"],
|
97
109
|
[:system_time_s, "I"],
|
data/lib/ragweed/wraptux.rb
CHANGED