class DEBUGGER__::ThreadClient

def frame_eval src, re_raise: false, binding_location: false

def frame_eval src, re_raise: false, binding_location: false
  @success_last_eval = false
  b = current_frame&.eval_binding || TOPLEVEL_BINDING
  special_local_variables current_frame do |name, var|
    b.local_variable_set(name, var) if /\%/ !~ name
  end
  result = frame_eval_core(src, b, binding_location: binding_location)
  @success_last_eval = true
  result
rescue SystemExit
  raise
rescue Exception => e
  return yield(e) if block_given?
  puts "eval error: #{e}"
  e.backtrace_locations&.each do |loc|
    break if loc.path == __FILE__
    puts "  #{loc}"
  end
  raise if re_raise
end