diff --git a/lib/pry-debugger/breakpoints.rb b/lib/pry-debugger/breakpoints.rb index bb1737d7a..17d9235d0 100644 --- a/lib/pry-debugger/breakpoints.rb +++ b/lib/pry-debugger/breakpoints.rb @@ -10,11 +10,15 @@ module Breakpoints # Add a new breakpoint. def add(file, line, expression = nil) - raise ArgumentError, 'Invalid file!' unless File.exist?(file) + if !File.exist?(file) && file != Pry.eval_path + raise ArgumentError, 'Invalid file!' unless File.exist?(file) + end validate_expression expression Pry.processor.debugging = true - Debugger.add_breakpoint(File.expand_path(file), line, expression) + + path = file == Pry.eval_path ? file : File.expand_path(file) + Debugger.add_breakpoint(path, line, expression) end # Change the conditional expression for a breakpoint.