Class: Byebug::MimickBye

Inherits:
Interface
  • Object
show all
Defined in:
lib/shoes/debugger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shoesobj) ⇒ MimickBye

shoesobj is the Shoes.App of the Debugger window



13
14
15
16
17
18
19
# File 'lib/shoes/debugger.rb', line 13

def initialize shoesobj  
  super()
  @input = shoesobj
  @output = shoesobj
  @error = shoesobj
  @cmdl = ""
end

Instance Attribute Details

#cmdlObject

Returns the value of attribute cmdl.



10
11
12
# File 'lib/shoes/debugger.rb', line 10

def cmdl
  @cmdl
end

Instance Method Details

#closeObject



31
32
33
34
35
# File 'lib/shoes/debugger.rb', line 31

def close
  #output.close
rescue IOError
  errmsg('Error closing the interface...')
end

#confirm(prompt) ⇒ Object



26
27
28
29
# File 'lib/shoes/debugger.rb', line 26

def confirm(prompt)
  $stderr.puts "confirm_command #{prompt}"
  super("#{prompt}")
end


42
43
44
45
# File 'lib/shoes/debugger.rb', line 42

def print(message)
  $stderr.puts "print: #{message}"
  @output.write_string message
end

#puts(message) ⇒ Object



37
38
39
40
# File 'lib/shoes/debugger.rb', line 37

def puts(message)
  $stderr.puts "puts: #{message}"
  @output.write_string message
end

#read_command(prompt) ⇒ Object



21
22
23
24
# File 'lib/shoes/debugger.rb', line 21

def read_command(prompt)
  $stderr.puts "read_command #{prompt}"
  super("#{prompt}")
end

#readline(prompt) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/shoes/debugger.rb', line 47

def readline(prompt)
  @output.write_string(prompt)
  # wait for input
  result = ''
  $stderr.puts "W-Thr: #{Thread.current.inspect}"
  $stderr.puts "B-Thr: #{@input.byethr.inspect}"
  $stderr.puts "W-MTX: #{@input.gets_mutex.object_id}"
  $stderr.puts "W-CV: #{@input.gets_cv.object_id}"
  @input.gets_mutex.synchronize {
    $stderr.puts "waiting for signal"  
    @input.gets_cv.wait(@input.gets_mutex) #hangs Shoes_thread doesn't wake up
    result = String.new(@cmdl)
    $stderr.puts "back from read_line #{result}"
  }
  fail IOError unless result
  return result.chomp
end