Class: Hijack::GDB

Inherits:
Object
  • Object
show all
Defined in:
lib/hijack/gdb.rb

Instance Method Summary collapse

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)
  @pid = pid
  @verbose = Hijack.options[:debug]
  @exec_path = File.join(Config::CONFIG['bindir'], Config::CONFIG['RUBY_INSTALL_NAME'] + Config::CONFIG['EXEEXT'])
  attach_outside_gc
end

Instance Method Details

#eval(cmd) ⇒ Object



12
13
14
# File 'lib/hijack/gdb.rb', line 12

def eval(cmd)
  call("(void)rb_eval_string(#{cmd.strip.gsub(/"/, '\"').inspect})")
end

#quitObject



16
17
18
19
20
21
22
23
# File 'lib/hijack/gdb.rb', line 16

def quit
  return unless @gdb
  detach
  exec('quit')
  @backtrace = nil
  @gdb.close
  @gdb = nil
end