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.
@@ -1,3 +1,7 @@
1
+ == 0.1.6 / 2009-07-13
2
+
3
+ * bug fixes and API work
4
+
1
5
  == 0.1.5 / 2009-06-18
2
6
 
3
7
  * more bug fixes
@@ -1,9 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'ragweed'
3
4
  require 'debuggertux'
4
5
  require 'pp'
5
6
  require 'irb'
6
- include Ragweed
7
+ #include Ragweed
7
8
 
8
9
  filename = ARGV[0]
9
10
  pid = ARGV[1].to_i
@@ -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.get_thread_pids(pid)
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
@@ -2,7 +2,7 @@
2
2
  module Ragweed
3
3
 
4
4
  # :stopdoc:
5
- VERSION = '0.1.5'
5
+ VERSION = '0.1.6'
6
6
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
7
7
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
8
8
  # :startdoc:
@@ -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
@@ -5,7 +5,7 @@ module Ragweed; end
5
5
  module Ragweed::Rasm
6
6
 
7
7
  # :stopdoc:
8
- VERSION = '0.1.5'
8
+ VERSION = '0.1.6'
9
9
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
10
10
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
11
11
  # :startdoc:
@@ -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
@@ -5,7 +5,7 @@ module Ragweed; end
5
5
  module Ragweed::Wrap32
6
6
 
7
7
  # :stopdoc:
8
- VERSION = '0.1.5'
8
+ VERSION = '0.1.6'
9
9
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
10
10
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
11
11
  # :startdoc:
@@ -5,7 +5,7 @@ module Ragweed; end
5
5
  module Ragweed::Wraposx
6
6
 
7
7
  # :stopdoc:
8
- VERSION = '0.1.5'
8
+ VERSION = '0.1.6'
9
9
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
10
10
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
11
11
  # :startdoc:
@@ -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"],
@@ -5,7 +5,7 @@ module Ragweed; end
5
5
  module Ragweed::Wraptux
6
6
 
7
7
  # :stopdoc:
8
- VERSION = '0.1.5'
8
+ VERSION = '0.1.6'
9
9
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
10
10
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
11
11
  # :startdoc:
@@ -1,3 +1,7 @@
1
- #include Ragweed
1
+ ## New 'ThreadInfo' sub module
2
+ ## so Wraptux matches the API
3
+ module Ragweed; end
4
+ module Ragweed::Wraptux; end
2
5
 
3
- # Todo :)
6
+ module Ragweed::Wraptux::ThreadInfo
7
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tduehr-ragweed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - tduehr, tqbf, struct