From 67cc5c201bcbef1d4abe02c966fdd1c35fc583c2 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 3 Jan 2023 14:00:09 +0100 Subject: [PATCH] `TrackNodeSourcePosition` only with `-O0`. --- .../src/com/oracle/svm/core/SubstrateOptions.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java index e7a3cd914fbe..fff27d27a501 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java @@ -26,7 +26,6 @@ import static com.oracle.svm.core.option.RuntimeOptionKey.RuntimeOptionKeyFlag.Immutable; import static com.oracle.svm.core.option.RuntimeOptionKey.RuntimeOptionKeyFlag.RelevantForCompilationIsolates; -import static org.graalvm.compiler.core.common.GraalOptions.TrackNodeSourcePosition; import static org.graalvm.compiler.core.common.SpectrePHTMitigations.None; import static org.graalvm.compiler.core.common.SpectrePHTMitigations.Options.SpectrePHTBarriers; import static org.graalvm.compiler.options.OptionType.Debug; @@ -203,6 +202,8 @@ public enum OptimizationLevel { @Override protected void onValueUpdate(EconomicMap, Object> values, String oldValue, String newValue) { OptimizationLevel newLevel = parseOptimizationLevel(newValue); + // `-g -O0` is recommended for a better debugging experience + GraalOptions.TrackNodeSourcePosition.update(values, newLevel == OptimizationLevel.O0); SubstrateOptions.IncludeNodeSourcePositions.update(values, newLevel == OptimizationLevel.O0); SubstrateOptions.SourceLevelDebug.update(values, newLevel == OptimizationLevel.O0); SubstrateOptions.AOTTrivialInline.update(values, newLevel != OptimizationLevel.O0); @@ -644,8 +645,6 @@ protected void onValueUpdate(EconomicMap, Object> values, Integer o }; public static void defaultDebugInfoValueUpdateHandler(EconomicMap, Object> values, Integer newValue) { - /* Force update of TrackNodeSourcePosition */ - TrackNodeSourcePosition.update(values, newValue > 0); if (OS.WINDOWS.isCurrent()) { /* Keep symbols on Windows. The symbol table is part of the pdb-file. */ DeleteLocalSymbols.update(values, newValue == 0);