class Byebug::TraceCommand

def execute

def execute
  var = @match[1]
  if global_variables.include?("$#{var}".to_sym)
    if @match[2] && @match[2] !~ /(:?no)?stop/
      errmsg "expecting \"stop\" or \"nostop\"; got \"#{@match[2]}\""
    else
      dbg_cmd = if @match[2] && @match[2] !~ /nostop/
                  'byebug(1, false)'
                else
                  ''
                end
    end
    eval("trace_var(:\"\$#{var}\") do |val|
            puts \"traced global variable '#{var}' has value '\#{val}'\"
            #{dbg_cmd}
          end")
    puts "Tracing global variable \"#{var}\"."
  else
    errmsg "'#{var}' is not a global variable."
  end
end