Skip to content

Commit dddcdb2

Browse files
Changes based on feedback
1 parent da7b49d commit dddcdb2

File tree

27 files changed

+214
-137
lines changed

27 files changed

+214
-137
lines changed

substratevm/mx.substratevm/mx_substratevm.py

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,20 @@ def build_debug_test(variant_name, image_name, extra_args):
10451045
mx.run([os.environ.get('GDB_BIN', 'gdb'), '--nx', '-q', '-iex', 'set pagination off', '-ex', 'python "ISOLATES=True"', '-x', testhello_py, hello_binary])
10461046

10471047

1048+
def gdb_base_command(logfile, autoload_path):
1049+
return [
1050+
os.environ.get('GDB_BIN', 'gdb'),
1051+
'--nx',
1052+
'-q', # do not print the introductory and copyright messages
1053+
'-iex', 'set pagination off', # messages from enabling logging could already cause pagination, so this must be done first
1054+
'-iex', 'set logging redirect on',
1055+
'-iex', 'set logging overwrite off',
1056+
'-iex', f"set logging file {logfile}",
1057+
'-iex', 'set logging enabled on',
1058+
'-iex', f"set auto-load safe-path {autoload_path}",
1059+
]
1060+
1061+
10481062
def _gdbdebughelperstest(native_image, path, with_isolates_only, args):
10491063

10501064
# ====== check gdb version ======
@@ -1094,15 +1108,6 @@ def _gdbdebughelperstest(native_image, path, with_isolates_only, args):
10941108
'com.oracle.svm.test.debug.helper.ClassLoaderTest'
10951109
]
10961110

1097-
gdb_args = [
1098-
os.environ.get('GDB_BIN', 'gdb'),
1099-
'--nx',
1100-
'-q', # do not print the introductory and copyright messages
1101-
'-iex', 'set pagination off', # messages from enabling logging could already cause pagination, so this must be done first
1102-
'-iex', 'set logging redirect on',
1103-
'-iex', 'set logging overwrite off',
1104-
]
1105-
11061111
def run_debug_test(image_name: str, testfile: str, source_path: str, with_isolates: bool = True,
11071112
build_cinterfacetutorial: bool = False, extra_args: list = None,
11081113
skip_build: bool = False) -> int:
@@ -1155,10 +1160,7 @@ def run_debug_test(image_name: str, testfile: str, source_path: str, with_isolat
11551160
if mx.get_os() == 'linux':
11561161
logfile = join(path, pathlib.Path(testfile).stem + ('' if with_isolates else '_no_isolates') + '.log')
11571162
os.environ.update({'gdb_logfile': logfile})
1158-
gdb_command = gdb_args + [
1159-
'-iex', f"set logging file {logfile}",
1160-
'-iex', 'set logging enabled on',
1161-
'-iex', f"set auto-load safe-path {join(build_dir, 'gdb-debughelpers.py')}",
1163+
gdb_command = gdb_base_command(logfile, join(build_dir, 'gdb-debughelpers.py')) + [
11621164
'-x', testfile, join(build_dir, image_name)
11631165
]
11641166
# unittest may result in different exit code, nonZeroIsFatal ensures that we can go on with other test
@@ -1200,15 +1202,6 @@ def _runtimedebuginfotest(native_image, output_path, with_isolates_only, args=No
12001202
test_runtime_deopt_py = join(test_python_source_dir, 'test_runtime_deopt.py')
12011203
testdeopt_js = join(suite.dir, 'mx.substratevm', 'testdeopt.js')
12021204

1203-
gdb_args = [
1204-
os.environ.get('GDB_BIN', 'gdb'),
1205-
'--nx',
1206-
'-q', # do not print the introductory and copyright messages
1207-
'-iex', "set pagination off", # messages from enabling logging could already cause pagination, so this must be done first
1208-
'-iex', "set logging redirect on",
1209-
'-iex', "set logging overwrite off",
1210-
]
1211-
12121205
# clean / create output directory
12131206
if exists(output_path):
12141207
mx.rmtree(output_path)
@@ -1237,10 +1230,7 @@ def _runtimedebuginfotest(native_image, output_path, with_isolates_only, args=No
12371230

12381231
logfile = join(output_path, 'test_runtime_compilation.log')
12391232
os.environ.update({'gdb_logfile': logfile})
1240-
gdb_command = gdb_args + [
1241-
'-iex', f"set logging file {logfile}",
1242-
'-iex', "set logging enabled on",
1243-
'-iex', f"set auto-load safe-path {join(output_path, 'gdb-debughelpers.py')}",
1233+
gdb_command = gdb_base_command(logfile, join(output_path, 'gdb-debughelpers.py')) + [
12441234
'-x', test_runtime_compilation_py, runtime_compile_binary
12451235
]
12461236
# unittest may result in different exit code, nonZeroIsFatal ensures that we can go on with other test
@@ -1259,10 +1249,7 @@ def run_js_test(eager: bool = False):
12591249
js_launcher = get_js_launcher(jslib)
12601250
logfile = join(output_path, 'test_runtime_deopt_' + ('eager' if eager else 'lazy') + '.log')
12611251
os.environ.update({'gdb_logfile': logfile})
1262-
gdb_command = gdb_args + [
1263-
'-iex', f"set logging file {logfile}",
1264-
'-iex', "set logging enabled on",
1265-
'-iex', f"set auto-load safe-path {join(output_path, 'gdb-debughelpers.py')}",
1252+
gdb_command = gdb_base_command(logfile, join(output_path, 'gdb-debughelpers.py')) + [
12661253
'-x', test_runtime_deopt_py, '--args', js_launcher, testdeopt_js
12671254
]
12681255
# unittest may result in different exit code, nonZeroIsFatal ensures that we can go on with other test

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

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

2727
package com.oracle.objectfile.debugentry;
2828

29-
public class ArrayTypeEntry extends StructureTypeEntry {
29+
public final class ArrayTypeEntry extends StructureTypeEntry {
3030
private final TypeEntry elementType;
3131
private final LoaderEntry loader;
3232

@@ -43,6 +43,6 @@ public TypeEntry getElementType() {
4343
}
4444

4545
public String getLoaderId() {
46-
return (loader != null ? loader.loaderId() : "");
46+
return loader.loaderId();
4747
}
4848
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
/**
3838
* Track debug info associated with a Java class.
3939
*/
40-
public class ClassEntry extends StructureTypeEntry {
40+
public sealed class ClassEntry extends StructureTypeEntry permits EnumClassEntry, InterfaceClassEntry {
4141
/**
4242
* Details of this class's superclass.
4343
*/
@@ -242,7 +242,7 @@ public int getDirIdx(DirEntry dir) {
242242
}
243243

244244
public String getLoaderId() {
245-
return (loader != null ? loader.loaderId() : "");
245+
return loader.loaderId();
246246
}
247247

248248
/**

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,6 @@ public void installDebugInfo(DebugInfoProvider debugInfoProvider) {
252252

253253
stringTable = new StringTable();
254254
lineStringTable = new StringTable();
255-
/* Ensure we have a null string at the start of the string table. */
256-
uniqueDebugString("");
257-
uniqueDebugLineString("");
258255
/* Create the cachePath string entry which serves as base directory for source files */
259256
cachePath = uniqueDebugString(debugInfoProvider.cachePath());
260257
uniqueDebugLineString(debugInfoProvider.cachePath());
@@ -282,8 +279,6 @@ public void installDebugInfo(DebugInfoProvider debugInfoProvider) {
282279
case FOREIGN_METHOD_LIST_TYPE -> foreignMethodListClassEntry = classEntry;
283280
}
284281
}
285-
default -> {
286-
}
287282
}
288283
});
289284
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
package com.oracle.objectfile.debugentry;
2828

29-
public class EnumClassEntry extends ClassEntry {
29+
public final class EnumClassEntry extends ClassEntry {
3030

3131
// The typedef name if this is a representation of a c enum type
3232
private final String typedefName;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
package com.oracle.objectfile.debugentry;
2727

28-
public class ForeignStructTypeEntry extends StructureTypeEntry {
28+
public final class ForeignStructTypeEntry extends StructureTypeEntry {
2929

3030
private final String typedefName;
3131
private final ForeignStructTypeEntry parent;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
package com.oracle.objectfile.debugentry;
2828

29-
public class HeaderTypeEntry extends StructureTypeEntry {
29+
public final class HeaderTypeEntry extends StructureTypeEntry {
3030

3131
private FieldEntry hubField;
3232

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import java.util.List;
3131
import java.util.concurrent.ConcurrentSkipListSet;
3232

33-
public class InterfaceClassEntry extends ClassEntry {
33+
public final class InterfaceClassEntry extends ClassEntry {
3434
private final ConcurrentSkipListSet<ClassEntry> implementors;
3535

3636
public InterfaceClassEntry(String typeName, int size, long classOffset, long typeSignature,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
package com.oracle.objectfile.debugentry;
2727

28-
public class PointerToTypeEntry extends TypeEntry {
28+
public final class PointerToTypeEntry extends TypeEntry {
2929
private TypeEntry pointerTo;
3030

3131
public PointerToTypeEntry(String typeName, int size, long classOffset, long typeSignature, TypeEntry pointerTo) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
import jdk.vm.ci.meta.JavaKind;
3030

31-
public class PrimitiveTypeEntry extends TypeEntry {
31+
public final class PrimitiveTypeEntry extends TypeEntry {
3232

3333
private final int bitCount;
3434
private final boolean isNumericInteger;

0 commit comments

Comments
 (0)