diff --git a/ddprof-lib/src/main/cpp/flightRecorder.cpp b/ddprof-lib/src/main/cpp/flightRecorder.cpp index 57751c3590..98455483d8 100644 --- a/ddprof-lib/src/main/cpp/flightRecorder.cpp +++ b/ddprof-lib/src/main/cpp/flightRecorder.cpp @@ -1726,7 +1726,7 @@ int Recording::writeCpool(Buffer *buf, int *count_offset_in_cpool) { void Recording::writeFrameTypes(Buffer *buf) { buf->putVar32(T_FRAME_TYPE); - buf->putVar32(7); + buf->putVar32(8); buf->putVar32(FRAME_INTERPRETED); buf->putUtf8("Interpreted"); buf->putVar32(FRAME_JIT_COMPILED); @@ -1741,6 +1741,8 @@ void Recording::writeFrameTypes(Buffer *buf) { buf->putUtf8("Kernel"); buf->putVar32(FRAME_C1_COMPILED); buf->putUtf8("C1 compiled"); + buf->putVar32(FRAME_NATIVE_REMOTE); + buf->putUtf8("Native (remote)"); flushIfNeeded(buf); } diff --git a/ddprof-test/src/test/java/com/datadoghq/profiler/JfrFrame.java b/ddprof-test/src/test/java/com/datadoghq/profiler/JfrFrame.java index 37da36ad22..8f346b1a90 100644 --- a/ddprof-test/src/test/java/com/datadoghq/profiler/JfrFrame.java +++ b/ddprof-test/src/test/java/com/datadoghq/profiler/JfrFrame.java @@ -45,6 +45,14 @@ public String methodDescriptor() { return method != null ? symbolString(method.get("descriptor")) : null; } + /** + * The frame's {@code jdk.types.FrameType} description (e.g. {@code "Native (remote)"}), or + * {@code null} if the frame type has no entry in the constant pool. + */ + public String typeDescription() { + return symbolString(value.get("type")); + } + /** The full name (e.g. {@code java.lang.String}) of the method's declaring type, or {@code null}. */ @SuppressWarnings("unchecked") public String className() { diff --git a/ddprof-test/src/test/java/com/datadoghq/profiler/cpu/RemoteSymbolicationTest.java b/ddprof-test/src/test/java/com/datadoghq/profiler/cpu/RemoteSymbolicationTest.java index de6d18841a..cd3e53c5a3 100644 --- a/ddprof-test/src/test/java/com/datadoghq/profiler/cpu/RemoteSymbolicationTest.java +++ b/ddprof-test/src/test/java/com/datadoghq/profiler/cpu/RemoteSymbolicationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025, Datadog, Inc. + * Copyright 2025, 2026, Datadog, Inc. * SPDX-License-Identifier: Apache-2.0 */ @@ -18,6 +18,7 @@ import com.datadoghq.profiler.JfrEvents; import com.datadoghq.profiler.JfrFrame; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; /** @@ -121,6 +122,10 @@ public void testRemoteSymbolicationEnabled(@CStack String cstack) throws Excepti testLibFrameCount++; foundTestLibFrame = true; + // Regression: FRAME_NATIVE_REMOTE must have a label in the FrameType constant pool + assertEquals("Native (remote)", frame.typeDescription(), + "Remote frame type is missing from the jdk.types.FrameType constant pool"); + // Print first remote frame for debugging if (printCount == 0) { System.out.println("=== First remote symbolication frame ==="); @@ -171,4 +176,4 @@ public void testRemoteSymbolicationEnabled(@CStack String cstack) throws Excepti protected String getProfilerCommand() { return "cpu=10ms,remotesym=true"; } -} \ No newline at end of file +}