diff --git a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/DebugInfoBase.java b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/DebugInfoBase.java index 4d814307c185..bd103069e35f 100644 --- a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/DebugInfoBase.java +++ b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/DebugInfoBase.java @@ -299,6 +299,7 @@ public void installDebugInfo(DebugInfoProvider debugInfoProvider) { Path filePath = debugTypeInfo.filePath(); addTypeEntry(idType, typeName, fileName, filePath, byteSize, typeKind); })); + debugInfoProvider.recordActivity(); /* Now we can cross reference static and instance field details. */ debugInfoProvider.typeInfoProvider().forEach(debugTypeInfo -> debugTypeInfo.debugContext((debugContext) -> { @@ -310,6 +311,7 @@ public void installDebugInfo(DebugInfoProvider debugInfoProvider) { TypeEntry typeEntry = (idType != null ? lookupTypeEntry(idType) : lookupHeaderType()); typeEntry.addDebugInfo(this, debugTypeInfo, debugContext); })); + debugInfoProvider.recordActivity(); debugInfoProvider.codeInfoProvider().forEach(debugCodeInfo -> debugCodeInfo.debugContext((debugContext) -> { /* @@ -335,6 +337,7 @@ public void installDebugInfo(DebugInfoProvider debugInfoProvider) { */ EconomicMap subRangeIndex = EconomicMap.create(); debugCodeInfo.locationInfoProvider().forEach(debugLocationInfo -> addSubrange(debugLocationInfo, primaryRange, classEntry, subRangeIndex, debugContext)); + debugInfoProvider.recordActivity(); })); debugInfoProvider.dataInfoProvider().forEach(debugDataInfo -> debugDataInfo.debugContext((debugContext) -> { diff --git a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debuginfo/DebugInfoProvider.java b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debuginfo/DebugInfoProvider.java index c3a2f489907a..aa1a052fdd62 100644 --- a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debuginfo/DebugInfoProvider.java +++ b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debuginfo/DebugInfoProvider.java @@ -444,4 +444,6 @@ enum Type { Stream dataInfoProvider(); Path getCachePath(); + + void recordActivity(); } diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageDebugInfoFeature.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageDebugInfoFeature.java index f44aa4c290af..1a6bba796c13 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageDebugInfoFeature.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageDebugInfoFeature.java @@ -107,7 +107,8 @@ public void beforeImageWrite(BeforeImageWriteAccess access) { var accessImpl = (FeatureImpl.BeforeImageWriteAccessImpl) access; var image = accessImpl.getImage(); var debugContext = new DebugContext.Builder(HostedOptionValues.singleton(), new GraalDebugHandlersFactory(GraalAccess.getOriginalSnippetReflection())).build(); - DebugInfoProvider provider = new NativeImageDebugInfoProvider(debugContext, image.getCodeCache(), image.getHeap(), image.getNativeLibs(), accessImpl.getHostedMetaAccess()); + DebugInfoProvider provider = new NativeImageDebugInfoProvider(debugContext, image.getCodeCache(), image.getHeap(), image.getNativeLibs(), accessImpl.getHostedMetaAccess(), + accessImpl.getImageClassLoader().watchdog::recordActivity); var objectFile = image.getObjectFile(); objectFile.installDebugInfo(provider); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageDebugInfoProvider.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageDebugInfoProvider.java index 8727e15e7326..e85a04c7ceda 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageDebugInfoProvider.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageDebugInfoProvider.java @@ -119,8 +119,9 @@ class NativeImageDebugInfoProvider extends NativeImageDebugInfoProviderBase implements DebugInfoProvider { private final DebugContext debugContext; private final Set allOverrides; + private final Runnable heartbeatCallback; - NativeImageDebugInfoProvider(DebugContext debugContext, NativeImageCodeCache codeCache, NativeImageHeap heap, NativeLibraries nativeLibs, HostedMetaAccess metaAccess) { + NativeImageDebugInfoProvider(DebugContext debugContext, NativeImageCodeCache codeCache, NativeImageHeap heap, NativeLibraries nativeLibs, HostedMetaAccess metaAccess, Runnable heartbeatCallback) { super(codeCache, heap, nativeLibs, metaAccess); this.debugContext = debugContext; /* Calculate the set of all HostedMethods that are overrides. */ @@ -129,6 +130,7 @@ class NativeImageDebugInfoProvider extends NativeImageDebugInfoProviderBase impl .flatMap(m -> Arrays.stream(m.getImplementations()) .filter(Predicate.not(m::equals))) .collect(Collectors.toSet()); + this.heartbeatCallback = heartbeatCallback; } @Override @@ -2704,4 +2706,9 @@ private boolean acceptObjectInfo(ObjectInfo objectInfo) { private DebugDataInfo createDebugDataInfo(ObjectInfo objectInfo) { return new NativeImageDebugDataInfo(objectInfo); } + + @Override + public void recordActivity() { + heartbeatCallback.run(); + } }