From 698712556460484ce67ae3323703aca0116c7b1d Mon Sep 17 00:00:00 2001 From: Jaroslav Tulach Date: Tue, 20 Aug 2024 14:22:03 +0200 Subject: [PATCH] Call it METHOD_BREAKPOINT_OPTION --- .../src/main/java/org/enso/common/ContextFactory.java | 2 +- .../main/java/org/enso/common/DebugServerInfo.java | 2 +- .../instrument/ReplDebuggerInstrument.java | 11 +++++++---- .../test/instrument/DebugServerInspectTest.java | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/engine/common/src/main/java/org/enso/common/ContextFactory.java b/engine/common/src/main/java/org/enso/common/ContextFactory.java index fcc0fff8d95c..da53df9e0dce 100644 --- a/engine/common/src/main/java/org/enso/common/ContextFactory.java +++ b/engine/common/src/main/java/org/enso/common/ContextFactory.java @@ -184,7 +184,7 @@ public Context build() { .err(err) .in(in); if (checkForWarnings != null) { - builder.option(DebugServerInfo.FN_OPTION, checkForWarnings); + builder.option(DebugServerInfo.METHOD_BREAKPOINT_OPTION, checkForWarnings); } if (enableDebugServer) { builder.option(DebugServerInfo.ENABLE_OPTION, "true"); diff --git a/engine/common/src/main/java/org/enso/common/DebugServerInfo.java b/engine/common/src/main/java/org/enso/common/DebugServerInfo.java index 50b191c26287..184181edb647 100644 --- a/engine/common/src/main/java/org/enso/common/DebugServerInfo.java +++ b/engine/common/src/main/java/org/enso/common/DebugServerInfo.java @@ -8,5 +8,5 @@ private DebugServerInfo() { public static final String URI = "enso://debug-server"; public static final String INSTRUMENT_NAME = "enso-debug-server"; public static final String ENABLE_OPTION = INSTRUMENT_NAME + ".enable"; - public static final String FN_OPTION = INSTRUMENT_NAME + ".fn"; + public static final String METHOD_BREAKPOINT_OPTION = INSTRUMENT_NAME + ".method-break-point"; } diff --git a/engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/ReplDebuggerInstrument.java b/engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/ReplDebuggerInstrument.java index bf0e175737bf..46efd90482e8 100644 --- a/engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/ReplDebuggerInstrument.java +++ b/engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/ReplDebuggerInstrument.java @@ -60,8 +60,8 @@ public final class ReplDebuggerInstrument extends TruffleInstrument { /** Option for {@link DebugServerInfo#ENABLE_OPTION} */ private static final OptionKey ENABLE_OPTION = new OptionKey<>(false); - /** Option for {@link DebugServerInfo#FN_OPTION} */ - private static final OptionKey FN_OPTION = new OptionKey<>(""); + /** * Option for {@link DebugServerInfo#METHOD_BREAKPOINT_OPTION} */ + private static final OptionKey METHOD_BREAKPOINT_OPTION = new OptionKey<>(""); /** * Called by Truffle when this instrument is installed. @@ -85,7 +85,7 @@ protected void onCreate(Env env) { filter = SourceSectionFilter.newBuilder().tagIs(DebuggerTags.AlwaysHalt.class).build(); env.getInstrumenter().attachExecutionEventFactory(filter, factory); } - if (env.getOptions().get(FN_OPTION) instanceof String replMethodName + if (env.getOptions().get(METHOD_BREAKPOINT_OPTION) instanceof String replMethodName && !replMethodName.isEmpty()) { factory = new AtTheEndOfMethod(handler, env); @@ -118,7 +118,10 @@ protected void onCreate(Env env) { protected OptionDescriptors getOptionDescriptors() { var options = new ArrayList(); options.add(OptionDescriptor.newBuilder(ENABLE_OPTION, DebugServerInfo.ENABLE_OPTION).build()); - options.add(OptionDescriptor.newBuilder(FN_OPTION, DebugServerInfo.FN_OPTION).build()); + options.add( + OptionDescriptor.newBuilder( + METHOD_BREAKPOINT_OPTION, DebugServerInfo.METHOD_BREAKPOINT_OPTION) + .build()); return OptionDescriptors.create(options); } diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/instrument/DebugServerInspectTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/instrument/DebugServerInspectTest.java index 9c2602478b97..41a9fc71f2e8 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/instrument/DebugServerInspectTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/instrument/DebugServerInspectTest.java @@ -27,7 +27,7 @@ public class DebugServerInspectTest { @BeforeClass public static void initContext() throws Exception { var b = ContextUtils.defaultContextBuilder().out(out).err(err); - b.option(DebugServerInfo.FN_OPTION, "ScriptTest.inspect"); + b.option(DebugServerInfo.METHOD_BREAKPOINT_OPTION, "ScriptTest.inspect"); ctx = b.build(); }