From 009b9105f0bdc29dcd5cab109e704e40c43e9f76 Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Fri, 2 Dec 2022 18:24:13 +0900 Subject: [PATCH] use `TOPLEVEL_BINDING` if no binding Configuration with `~/.rdbgrc` it is possible that the `current_frame` is nil. This patch uses `TOPLEVEL_BINDING` for such cases. --- lib/debug/thread_client.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/debug/thread_client.rb b/lib/debug/thread_client.rb index a35eedf42..994e6a36f 100644 --- a/lib/debug/thread_client.rb +++ b/lib/debug/thread_client.rb @@ -427,7 +427,7 @@ def frame_eval_core src, b, binding_location: false def frame_eval src, re_raise: false, binding_location: false @success_last_eval = false - b = current_frame.eval_binding + b = current_frame&.eval_binding || TOPLEVEL_BINDING special_local_variables current_frame do |name, var| b.local_variable_set(name, var) if /\%/ !~ name @@ -810,7 +810,7 @@ def make_breakpoint args case args.first when :method klass_name, op, method_name, cond, cmd, path = args[1..] - bp = MethodBreakpoint.new(current_frame.eval_binding, klass_name, op, method_name, cond: cond, command: cmd, path: path) + bp = MethodBreakpoint.new(current_frame&.eval_binding || TOPLEVEL_BINDING, klass_name, op, method_name, cond: cond, command: cmd, path: path) begin bp.enable rescue NameError => e