Skip to content

Commit bf169b7

Browse files
Incorporate feedback
1 parent e37702e commit bf169b7

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed

substratevm/mx.substratevm/mx_substratevm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,16 +1069,16 @@ def build_layer(layer_path, layer_args):
10691069
'-o', join(app_layer_path, app_layer_name),
10701070
# We do not want to step into class initializer, so initialize everything at build time.
10711071
'--initialize-at-build-time=hello',
1072-
'hello.Hello'
1072+
'hello.Hello',
10731073
] + svm_experimental_options([
10741074
f'-H:LayerUse={join(base_layer_path, base_layer_name)}.nil',
1075+
f'-H:LinkerRPath={base_layer_path}'
10751076
]))
10761077

10771078
# prepare environment
10781079
env = os.environ.copy()
10791080
env['debuginfotest_isolates'] = 'yes'
10801081
env['debuginfotest_layered'] = 'yes'
1081-
env['LD_LIBRARY_PATH'] = base_layer_path
10821082

10831083
# fetch python test file
10841084
testhello_py = join(sourcepath, 'gdb-tests', 'testhello.py')

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageDebugInfoProvider.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,14 +589,14 @@ private void processFieldEntries(HostedType type, StructureTypeEntry structureTy
589589
}
590590

591591
for (ResolvedJavaField field : type.getStaticFields()) {
592-
assert field instanceof HostedField;
592+
HostedField hField = (HostedField) field;
593593
/*
594594
* If we are in a layered build only add debug info for a static field if it is
595595
* installed in the current layer.
596596
*/
597597
if (!ImageLayerBuildingSupport.buildingImageLayer() ||
598-
(((HostedField) field).hasInstalledLayerNum() && DynamicImageLayerInfo.getCurrentLayerNumber() == StaticFieldsSupport.getInstalledLayerNum(field))) {
599-
structureTypeEntry.addField(createFieldEntry((HostedField) field, structureTypeEntry));
598+
(hField.hasInstalledLayerNum() && DynamicImageLayerInfo.getCurrentLayerNumber() == hField.getInstalledLayerNum())) {
599+
structureTypeEntry.addField(createFieldEntry(hField, structureTypeEntry));
600600
}
601601
}
602602
}

substratevm/src/com.oracle.svm.test.debug/src/com/oracle/svm/test/debug/helper/PrettyPrinterTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,17 @@ static void testLambda(Function<String, String> lambda) {
154154
lambda.apply("test");
155155
}
156156

157+
@NeverInline("Prevent constant folding")
158+
private static boolean alwaysFalse() {
159+
return false;
160+
}
161+
157162
@SuppressWarnings("unused")
158163
@NeverInline("For testing purposes")
159164
static void testClassType(Class<?> clazz, Holder dyn) {
165+
if (alwaysFalse()) {
166+
staticHolder = null; // Prevent constant folding of staticHolder.
167+
}
160168
blackhole(clazz, dyn, staticHolder.c, staticHolder.o);
161169
}
162170

@@ -197,6 +205,5 @@ public static void main(String[] args) {
197205

198206
testLambda(str -> str);
199207
testClassType(String.class, new Holder(String.class, String.class));
200-
staticHolder = null;
201208
}
202209
}

substratevm/src/com.oracle.svm.test.debug/src/gdb-tests/test_cinterface.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,27 @@ def test_auto_reload(self):
100100
self.assertIn('SubstrateVM FrameFilter', exec_string)
101101

102102

103+
class TestSVMFrameDecorator(unittest.TestCase):
104+
@classmethod
105+
def setUp(cls):
106+
cls.maxDiff = None
107+
set_up_test()
108+
gdb_start()
109+
set_up_gdb_debughelpers()
110+
111+
@classmethod
112+
def tearDown(cls):
113+
gdb_delete_breakpoints()
114+
gdb_kill()
115+
116+
def test_object_file_names_in_backtrace(self):
117+
gdb_set_breakpoint("com.oracle.svm.tutorial.CInterfaceTutorial::releaseData")
118+
gdb_continue()
119+
backtrace = gdb_execute("backtrace")
120+
self.assertIn('in cinterfacetutorial', backtrace)
121+
self.assertIn('in libcinterfacetutorial.so', backtrace)
122+
123+
103124
class TestCInterface(unittest.TestCase):
104125
@classmethod
105126
def setUp(cls):

0 commit comments

Comments
 (0)