Skip to content

Commit

Permalink
Make -g an alias for -H:GenerateDebugInfo=2
Browse files Browse the repository at this point in the history
  • Loading branch information
olpaw authored and zakkak committed Jul 7, 2020
1 parent a12d97c commit b7ebe17
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public class SubstrateOptions {
public static final String IMAGE_CLASSPATH_PREFIX = "-imagecp";
public static final String WATCHPID_PREFIX = "-watchpid";
private static ValueUpdateHandler optimizeValueUpdateHandler;
private static ValueUpdateHandler debugInfoValueUpdateHandler = SubstrateOptions::defaultDebugInfoValueUpdateHandler;

@Option(help = "Show available options based on comma-separated option-types (allowed categories: User, Expert, Debug).")//
public static final OptionKey<String> PrintFlags = new OptionKey<>(null);
Expand All @@ -114,6 +115,10 @@ public static void setOptimizeValueUpdateHandler(ValueUpdateHandler updateHandle
SubstrateOptions.optimizeValueUpdateHandler = updateHandler;
}

public static void setDebugInfoValueUpdateHandler(ValueUpdateHandler updateHandler) {
SubstrateOptions.debugInfoValueUpdateHandler = updateHandler;
}

@Option(help = "Track NodeSourcePositions during runtime-compilation")//
public static final HostedOptionKey<Boolean> IncludeNodeSourcePositions = new HostedOptionKey<>(false);

Expand Down Expand Up @@ -456,16 +461,22 @@ public static int codeAlignment() {
@Option(help = "Populate reference queues in a separate thread rather than after a garbage collection.", type = OptionType.Expert) //
public static final HostedOptionKey<Boolean> UseReferenceHandlerThread = new HostedOptionKey<>(false);

@APIOption(name = "-g", fixedValue = "2", customHelp = "generate debugging information")//
@Option(help = "Insert debug info into the generated native image or library")//
public static final HostedOptionKey<Integer> GenerateDebugInfo = new HostedOptionKey<Integer>(0) {
@Override
protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, Integer oldValue, Integer newValue) {
// force update of TrackNodeSourcePosition
if (newValue > 0 && !Boolean.TRUE.equals(values.get(TrackNodeSourcePosition))) {
TrackNodeSourcePosition.update(values, true);
}
debugInfoValueUpdateHandler.onValueUpdate(values, oldValue, newValue);
}
};

private static void defaultDebugInfoValueUpdateHandler(EconomicMap<OptionKey<?>, Object> values, Integer oldValue, Integer newValue) {
// force update of TrackNodeSourcePosition
if (newValue > 0 && !Boolean.TRUE.equals(values.get(TrackNodeSourcePosition))) {
TrackNodeSourcePosition.update(values, true);
}
}

@Option(help = "Search path for source files for Application or GraalVM classes (list of comma-separated directories or jar files)")//
public static final HostedOptionKey<String[]> DebugInfoSourceSearchPath = new HostedOptionKey<String[]>(null) {
};
Expand Down

0 comments on commit b7ebe17

Please sign in to comment.