Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions substratevm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ At runtime, premain runtime options are set along with main class' arguments in
The warning is planned to be replaced by an error in GraalVM for JDK 25.
* (GR-48384) Added a GDB Python script (`gdb-debughelpers.py`) to improve the Native Image debugging experience.
* (GR-49517) Add support for emitting Windows x64 unwind info. This enables stack walking in native tooling such as debuggers and profilers.
* (GR-56599) Update native image debuginfo from DWARF4 to DWARF5 and store type information for debugging in DWARF type units.
* (GR-56601) Together with Red Hat, we added experimental support for `jcmd` on Linux and macOS. Add `--enable-monitoring=jcmd` to your build arguments to try it out.
* (GR-57384) Preserve the origin of a resource included in a native image. The information is included in the report produced by -H:+GenerateEmbeddedResourcesFile.
* (GR-58000) Support for `GetStringUTFLengthAsLong` added in JNI_VERSION_24 ([JDK-8328877](https://bugs.openjdk.org/browse/JDK-8328877))
Expand Down
6 changes: 3 additions & 3 deletions substratevm/mx.substratevm/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,10 +795,10 @@
"cflags": ["-Zi", "-O2", "-D_LITTLE_ENDIAN"],
},
"linux": {
"cflags": ["-g", "-gdwarf-4", "-fPIC", "-O2", "-D_LITTLE_ENDIAN", "-ffunction-sections", "-fdata-sections", "-fvisibility=hidden", "-D_FORTIFY_SOURCE=0"],
"cflags": ["-g", "-gdwarf-5", "-fPIC", "-O2", "-D_LITTLE_ENDIAN", "-ffunction-sections", "-fdata-sections", "-fvisibility=hidden", "-D_FORTIFY_SOURCE=0"],
},
"<others>": {
"cflags": ["-g", "-gdwarf-4", "-fPIC", "-O2", "-D_LITTLE_ENDIAN", "-ffunction-sections", "-fdata-sections", "-fvisibility=hidden", "-D_FORTIFY_SOURCE=0"],
"cflags": ["-g", "-gdwarf-5", "-fPIC", "-O2", "-D_LITTLE_ENDIAN", "-ffunction-sections", "-fdata-sections", "-fvisibility=hidden", "-D_FORTIFY_SOURCE=0"],
},
},
"jacoco" : "exclude",
Expand Down Expand Up @@ -856,7 +856,7 @@
"cflags": ["-g", "-fPIC", "-O2", "-ffunction-sections", "-fdata-sections", "-fvisibility=hidden"],
},
"linux": {
"cflags": ["-g", "-gdwarf-4", "-fPIC", "-O2", "-ffunction-sections", "-fdata-sections", "-fvisibility=hidden", "-D_FORTIFY_SOURCE=0", "-D_GNU_SOURCE"],
"cflags": ["-g", "-gdwarf-5", "-fPIC", "-O2", "-ffunction-sections", "-fdata-sections", "-fvisibility=hidden", "-D_FORTIFY_SOURCE=0", "-D_GNU_SOURCE"],
},
"<others>": {
"ignore": "only darwin and linux are supported",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugArrayTypeInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind;
import jdk.vm.ci.meta.ResolvedJavaType;

import jdk.graal.compiler.debug.DebugContext;
import jdk.vm.ci.meta.ResolvedJavaType;

public class ArrayTypeEntry extends StructureTypeEntry {
private TypeEntry elementType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,11 @@
import java.util.List;
import java.util.stream.Stream;

import org.graalvm.collections.EconomicMap;

import com.oracle.objectfile.debugentry.range.PrimaryRange;
import com.oracle.objectfile.debugentry.range.Range;
import com.oracle.objectfile.debugentry.range.SubRange;
import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.meta.ResolvedJavaType;
import org.graalvm.collections.EconomicMap;
import jdk.graal.compiler.debug.DebugContext;

import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugFieldInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugFrameSizeChange;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugInstanceTypeInfo;
Expand All @@ -47,6 +44,10 @@
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind;

import jdk.graal.compiler.debug.DebugContext;
import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.meta.ResolvedJavaType;

/**
* Track debug info associated with a Java class.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -737,8 +737,8 @@ public String getCachePath() {
return cachePath;
}

public boolean isHubClassEntry(ClassEntry classEntry) {
return classEntry.getTypeName().equals(DwarfDebugInfo.HUB_TYPE_NAME);
public boolean isHubClassEntry(StructureTypeEntry typeEntry) {
return typeEntry.getTypeName().equals(DwarfDebugInfo.HUB_TYPE_NAME);
}

public ClassEntry getHubClassEntry() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@

package com.oracle.objectfile.debugentry;

import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugEnumTypeInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind;

import jdk.graal.compiler.debug.DebugContext;

public class EnumClassEntry extends ClassEntry {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
package com.oracle.objectfile.debugentry;

import com.oracle.objectfile.debuginfo.DebugInfoProvider;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugForeignTypeInfo;
import jdk.vm.ci.meta.ResolvedJavaType;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;

import jdk.graal.compiler.debug.DebugContext;
import jdk.vm.ci.meta.ResolvedJavaType;

public class ForeignTypeEntry extends ClassEntry {
private static final int FLAG_WORD = 1 << 0;
Expand All @@ -57,6 +58,15 @@ public DebugInfoProvider.DebugTypeInfo.DebugTypeKind typeKind() {
return DebugInfoProvider.DebugTypeInfo.DebugTypeKind.FOREIGN;
}

/*
* When we process a foreign pointer type for the .debug_info section we want to reuse its type
* signature. After sizing the .debug_info the layout type signature contains the type signature
* of the type this foreign pointer points to.
*/
public void setLayoutTypeSignature(long typeSignature) {
this.layoutTypeSignature = typeSignature;
}

@Override
public void addDebugInfo(DebugInfoBase debugInfoBase, DebugTypeInfo debugTypeInfo, DebugContext debugContext) {
assert debugTypeInfo instanceof DebugForeignTypeInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@

package com.oracle.objectfile.debugentry;

import jdk.graal.compiler.debug.DebugContext;

import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugHeaderTypeInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind;

import jdk.graal.compiler.debug.DebugContext;

public class HeaderTypeEntry extends StructureTypeEntry {

public HeaderTypeEntry(String typeName, int size) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@

package com.oracle.objectfile.debugentry;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugInterfaceTypeInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind;
import jdk.graal.compiler.debug.DebugContext;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
import jdk.graal.compiler.debug.DebugContext;

public class InterfaceClassEntry extends ClassEntry {
private final List<ClassEntry> implementors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@

package com.oracle.objectfile.debugentry;

import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugPrimitiveTypeInfo.FLAG_INTEGRAL;
import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugPrimitiveTypeInfo.FLAG_NUMERIC;
import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugPrimitiveTypeInfo.FLAG_SIGNED;

import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugPrimitiveTypeInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind;
import jdk.graal.compiler.debug.DebugContext;

import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugPrimitiveTypeInfo.FLAG_INTEGRAL;
import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugPrimitiveTypeInfo.FLAG_NUMERIC;
import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugPrimitiveTypeInfo.FLAG_SIGNED;
import jdk.graal.compiler.debug.DebugContext;

public class PrimitiveTypeEntry extends TypeEntry {
private char typeChar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@

package com.oracle.objectfile.debugentry;

import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugFieldInfo;
import jdk.vm.ci.meta.ResolvedJavaType;
import jdk.graal.compiler.debug.DebugContext;

import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

import com.oracle.objectfile.debuginfo.DebugInfoProvider;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugFieldInfo;
import com.oracle.objectfile.elf.dwarf.DwarfDebugInfo;

import jdk.graal.compiler.debug.DebugContext;
import jdk.vm.ci.meta.ResolvedJavaType;

/**
* An intermediate type that provides behaviour for managing fields. This unifies code for handling
* header structures and Java instance and array classes that both support data members.
Expand All @@ -45,9 +48,21 @@ public abstract class StructureTypeEntry extends TypeEntry {
*/
protected final List<FieldEntry> fields;

/**
* The type signature of this types' layout. The layout of a type contains debug info of fields
* and methods of a type, which is needed for representing the class hierarchy. The super type
* entry in the debug info needs to directly contain the type info instead of a pointer.
*/
protected long layoutTypeSignature;

public StructureTypeEntry(String typeName, int size) {
super(typeName, size);
this.fields = new ArrayList<>();
this.layoutTypeSignature = 0;
}

public long getLayoutTypeSignature() {
return layoutTypeSignature;
}

public Stream<FieldEntry> fields() {
Expand Down Expand Up @@ -118,4 +133,15 @@ String memberModifiers(int modifiers) {

return builder.toString();
}

@Override
public void addDebugInfo(@SuppressWarnings("unused") DebugInfoBase debugInfoBase, DebugInfoProvider.DebugTypeInfo debugTypeInfo, @SuppressWarnings("unused") DebugContext debugContext) {
super.addDebugInfo(debugInfoBase, debugTypeInfo, debugContext);
// header type does not have a separate layout type
if (this instanceof HeaderTypeEntry) {
this.layoutTypeSignature = typeSignature;
} else {
this.layoutTypeSignature = debugTypeInfo.typeSignature(DwarfDebugInfo.LAYOUT_PREFIX);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@

package com.oracle.objectfile.debugentry;

import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind;
import jdk.graal.compiler.debug.DebugContext;

import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind.ARRAY;
import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind.ENUM;
import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind.FOREIGN;
Expand All @@ -38,12 +34,29 @@
import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind.INTERFACE;
import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind.PRIMITIVE;

import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind;
import com.oracle.objectfile.elf.dwarf.DwarfDebugInfo;

import jdk.graal.compiler.debug.DebugContext;

public abstract class TypeEntry {
/**
* The name of this type.
*/
protected final String typeName;

/**
* The type signature of this type. This is a pointer to the underlying layout of the type.
*/
protected long typeSignature;

/**
* The type signature for the compressed type. This points to the compressed layout which
* resolves oops to the actual address of an instances.
*/
protected long typeSignatureForCompressed;

/**
* The offset of the java.lang.Class instance for this class in the image heap or -1 if no such
* object exists.
Expand All @@ -59,6 +72,16 @@ protected TypeEntry(String typeName, int size) {
this.typeName = typeName;
this.size = size;
this.classOffset = -1;
this.typeSignature = 0;
this.typeSignatureForCompressed = 0;
}

public long getTypeSignature() {
return typeSignature;
}

public long getTypeSignatureForCompressed() {
return typeSignatureForCompressed;
}

public long getClassOffset() {
Expand Down Expand Up @@ -127,5 +150,12 @@ public boolean isStructure() {
public void addDebugInfo(@SuppressWarnings("unused") DebugInfoBase debugInfoBase, DebugTypeInfo debugTypeInfo, @SuppressWarnings("unused") DebugContext debugContext) {
/* Record the location of the Class instance in the heap if there is one */
this.classOffset = debugTypeInfo.classOffset();
this.typeSignature = debugTypeInfo.typeSignature("");
// primitives, header and foreign types are never stored compressed
if (!debugInfoBase.useHeapBase() || this instanceof PrimitiveTypeEntry || this instanceof HeaderTypeEntry || this instanceof ForeignTypeEntry) {
this.typeSignatureForCompressed = typeSignature;
} else {
this.typeSignatureForCompressed = debugTypeInfo.typeSignature(DwarfDebugInfo.COMPRESSED_PREFIX);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ public String toString() {
*/
String typeName();

/**
* @return a 64bit type signature to uniquely identify the type
*/
long typeSignature(String prefix);

DebugTypeKind typeKind();

/**
Expand Down
Loading