Class: Hijack::GDB
- Inherits:
-
Object
- Object
- Hijack::GDB
- Defined in:
- lib/hijack/gdb.rb
Instance Method Summary collapse
- #attached_to_ruby_process? ⇒ Boolean
- #detach ⇒ Object
- #eval(cmd) ⇒ Object
-
#initialize(pid) ⇒ GDB
constructor
A new instance of GDB.
Constructor Details
#initialize(pid) ⇒ GDB
Returns a new instance of GDB.
5 6 7 8 9 10 |
# File 'lib/hijack/gdb.rb', line 5 def initialize(pid) @verbose = Hijack.[:gdb_debug] exec_path = File.join(Config::CONFIG['bindir'], Config::CONFIG['RUBY_INSTALL_NAME'] + Config::CONFIG['EXEEXT']) @gdb = IO.popen("gdb -q #{exec_path} #{pid} 2>&1", 'r+') wait end |
Instance Method Details
#attached_to_ruby_process? ⇒ Boolean
12 13 14 15 |
# File 'lib/hijack/gdb.rb', line 12 def attached_to_ruby_process? # TODO: Implement me true end |
#detach ⇒ Object
21 22 23 24 25 26 |
# File 'lib/hijack/gdb.rb', line 21 def detach @gdb.puts('detach') wait @gdb.puts('quit') @gdb.close end |
#eval(cmd) ⇒ Object
17 18 19 |
# File 'lib/hijack/gdb.rb', line 17 def eval(cmd) call("(void)rb_eval_string(#{cmd.strip.gsub(/"/, '\"').inspect})") end |