Skip to content

Commit 6146963

Browse files
dominikmascherbauerolpaw
authored andcommitted
[GR-56599] Create type units for types during debuginfo generation for referencing across multiple debug info files.
PullRequest: graal/18464
2 parents 4a8e2b1 + c64fc03 commit 6146963

28 files changed

+1856
-1384
lines changed

substratevm/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ At runtime, premain runtime options are set along with main class' arguments in
1010
The warning is planned to be replaced by an error in GraalVM for JDK 25.
1111
* (GR-48384) Added a GDB Python script (`gdb-debughelpers.py`) to improve the Native Image debugging experience.
1212
* (GR-49517) Add support for emitting Windows x64 unwind info. This enables stack walking in native tooling such as debuggers and profilers.
13+
* (GR-56599) Update native image debuginfo from DWARF4 to DWARF5 and store type information for debugging in DWARF type units.
1314
* (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.
1415
* (GR-57384) Preserve the origin of a resource included in a native image. The information is included in the report produced by -H:+GenerateEmbeddedResourcesFile.
1516
* (GR-58000) Support for `GetStringUTFLengthAsLong` added in JNI_VERSION_24 ([JDK-8328877](https://bugs.openjdk.org/browse/JDK-8328877))

substratevm/mx.substratevm/suite.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -796,10 +796,10 @@
796796
"cflags": ["-Zi", "-O2", "-D_LITTLE_ENDIAN"],
797797
},
798798
"linux": {
799-
"cflags": ["-g", "-gdwarf-4", "-fPIC", "-O2", "-D_LITTLE_ENDIAN", "-ffunction-sections", "-fdata-sections", "-fvisibility=hidden", "-D_FORTIFY_SOURCE=0"],
799+
"cflags": ["-g", "-gdwarf-5", "-fPIC", "-O2", "-D_LITTLE_ENDIAN", "-ffunction-sections", "-fdata-sections", "-fvisibility=hidden", "-D_FORTIFY_SOURCE=0"],
800800
},
801801
"<others>": {
802-
"cflags": ["-g", "-gdwarf-4", "-fPIC", "-O2", "-D_LITTLE_ENDIAN", "-ffunction-sections", "-fdata-sections", "-fvisibility=hidden", "-D_FORTIFY_SOURCE=0"],
802+
"cflags": ["-g", "-gdwarf-5", "-fPIC", "-O2", "-D_LITTLE_ENDIAN", "-ffunction-sections", "-fdata-sections", "-fvisibility=hidden", "-D_FORTIFY_SOURCE=0"],
803803
},
804804
},
805805
"jacoco" : "exclude",
@@ -857,7 +857,7 @@
857857
"cflags": ["-g", "-fPIC", "-O2", "-ffunction-sections", "-fdata-sections", "-fvisibility=hidden"],
858858
},
859859
"linux": {
860-
"cflags": ["-g", "-gdwarf-4", "-fPIC", "-O2", "-ffunction-sections", "-fdata-sections", "-fvisibility=hidden", "-D_FORTIFY_SOURCE=0", "-D_GNU_SOURCE"],
860+
"cflags": ["-g", "-gdwarf-5", "-fPIC", "-O2", "-ffunction-sections", "-fdata-sections", "-fvisibility=hidden", "-D_FORTIFY_SOURCE=0", "-D_GNU_SOURCE"],
861861
},
862862
"<others>": {
863863
"ignore": "only darwin and linux are supported",

substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/ArrayTypeEntry.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugArrayTypeInfo;
3030
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
3131
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind;
32-
import jdk.vm.ci.meta.ResolvedJavaType;
32+
3333
import jdk.graal.compiler.debug.DebugContext;
34+
import jdk.vm.ci.meta.ResolvedJavaType;
3435

3536
public class ArrayTypeEntry extends StructureTypeEntry {
3637
private TypeEntry elementType;

substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/ClassEntry.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,11 @@
3030
import java.util.List;
3131
import java.util.stream.Stream;
3232

33+
import org.graalvm.collections.EconomicMap;
34+
3335
import com.oracle.objectfile.debugentry.range.PrimaryRange;
3436
import com.oracle.objectfile.debugentry.range.Range;
3537
import com.oracle.objectfile.debugentry.range.SubRange;
36-
import jdk.vm.ci.meta.ResolvedJavaMethod;
37-
import jdk.vm.ci.meta.ResolvedJavaType;
38-
import org.graalvm.collections.EconomicMap;
39-
import jdk.graal.compiler.debug.DebugContext;
40-
4138
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugFieldInfo;
4239
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugFrameSizeChange;
4340
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugInstanceTypeInfo;
@@ -47,6 +44,10 @@
4744
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
4845
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind;
4946

47+
import jdk.graal.compiler.debug.DebugContext;
48+
import jdk.vm.ci.meta.ResolvedJavaMethod;
49+
import jdk.vm.ci.meta.ResolvedJavaType;
50+
5051
/**
5152
* Track debug info associated with a Java class.
5253
*/

substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/DebugInfoBase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,8 +737,8 @@ public String getCachePath() {
737737
return cachePath;
738738
}
739739

740-
public boolean isHubClassEntry(ClassEntry classEntry) {
741-
return classEntry.getTypeName().equals(DwarfDebugInfo.HUB_TYPE_NAME);
740+
public boolean isHubClassEntry(StructureTypeEntry typeEntry) {
741+
return typeEntry.getTypeName().equals(DwarfDebugInfo.HUB_TYPE_NAME);
742742
}
743743

744744
public ClassEntry getHubClassEntry() {

substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/EnumClassEntry.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@
2626

2727
package com.oracle.objectfile.debugentry;
2828

29-
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
3029
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugEnumTypeInfo;
30+
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
3131
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind;
32+
3233
import jdk.graal.compiler.debug.DebugContext;
3334

3435
public class EnumClassEntry extends ClassEntry {

substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/ForeignTypeEntry.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@
2727
package com.oracle.objectfile.debugentry;
2828

2929
import com.oracle.objectfile.debuginfo.DebugInfoProvider;
30-
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
3130
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugForeignTypeInfo;
32-
import jdk.vm.ci.meta.ResolvedJavaType;
31+
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
32+
3333
import jdk.graal.compiler.debug.DebugContext;
34+
import jdk.vm.ci.meta.ResolvedJavaType;
3435

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

61+
/*
62+
* When we process a foreign pointer type for the .debug_info section we want to reuse its type
63+
* signature. After sizing the .debug_info the layout type signature contains the type signature
64+
* of the type this foreign pointer points to.
65+
*/
66+
public void setLayoutTypeSignature(long typeSignature) {
67+
this.layoutTypeSignature = typeSignature;
68+
}
69+
6070
@Override
6171
public void addDebugInfo(DebugInfoBase debugInfoBase, DebugTypeInfo debugTypeInfo, DebugContext debugContext) {
6272
assert debugTypeInfo instanceof DebugForeignTypeInfo;

substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/HeaderTypeEntry.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626

2727
package com.oracle.objectfile.debugentry;
2828

29-
import jdk.graal.compiler.debug.DebugContext;
30-
3129
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugHeaderTypeInfo;
3230
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
3331
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind;
3432

33+
import jdk.graal.compiler.debug.DebugContext;
34+
3535
public class HeaderTypeEntry extends StructureTypeEntry {
3636

3737
public HeaderTypeEntry(String typeName, int size) {

substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/InterfaceClassEntry.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@
2626

2727
package com.oracle.objectfile.debugentry;
2828

29+
import java.util.ArrayList;
30+
import java.util.List;
31+
import java.util.stream.Stream;
32+
2933
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugInterfaceTypeInfo;
3034
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
3135
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind;
32-
import jdk.graal.compiler.debug.DebugContext;
3336

34-
import java.util.ArrayList;
35-
import java.util.List;
36-
import java.util.stream.Stream;
37+
import jdk.graal.compiler.debug.DebugContext;
3738

3839
public class InterfaceClassEntry extends ClassEntry {
3940
private final List<ClassEntry> implementors;

substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/PrimitiveTypeEntry.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@
2626

2727
package com.oracle.objectfile.debugentry;
2828

29+
import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugPrimitiveTypeInfo.FLAG_INTEGRAL;
30+
import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugPrimitiveTypeInfo.FLAG_NUMERIC;
31+
import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugPrimitiveTypeInfo.FLAG_SIGNED;
32+
2933
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugPrimitiveTypeInfo;
3034
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
3135
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind;
32-
import jdk.graal.compiler.debug.DebugContext;
3336

34-
import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugPrimitiveTypeInfo.FLAG_INTEGRAL;
35-
import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugPrimitiveTypeInfo.FLAG_NUMERIC;
36-
import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugPrimitiveTypeInfo.FLAG_SIGNED;
37+
import jdk.graal.compiler.debug.DebugContext;
3738

3839
public class PrimitiveTypeEntry extends TypeEntry {
3940
private char typeChar;

0 commit comments

Comments
 (0)