Skip to content

Commit 1c651c8

Browse files
committed
Fix problems with debug info test script due to variation in inlining.
1 parent 017a209 commit 1c651c8

File tree

2 files changed

+32
-16
lines changed

2 files changed

+32
-16
lines changed

substratevm/mx.substratevm/testhello.py

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,8 @@ def test():
458458
# As a result the breakpoint will be set at all println overrides.
459459
# expect "Breakpoint 1 at 0x[0-9a-f]+: java.io.PrintStream::println. ([0-9]+ locations)""
460460
exec_string = execute("break java.io.PrintStream::println")
461+
# we cannot be sure how much inlining will happen so we
462+
# specify a pattern for the number of locations
461463
rexp = r"Breakpoint %s at %s: java\.io\.PrintStream::println\. \(%s locations\)"%(digits_pattern, address_pattern, digits_pattern)
462464
checker = Checker('break println', rexp)
463465
checker.check(exec_string, skip_fails=False)
@@ -620,43 +622,55 @@ def test():
620622

621623
execute("delete breakpoints")
622624
exec_string = execute("break Hello.java:173")
623-
rexp = r"Breakpoint %s at %s: Hello\.java:173\. \(2 locations\)"%(digits_pattern, address_pattern)
625+
# we cannot be sure how much inlining will happen so we
626+
# specify a pattern for the number of locations
627+
rexp = r"Breakpoint %s at %s: Hello\.java:173\. \(%s locations\)"%(digits_pattern, address_pattern, digits_pattern)
624628
checker = Checker('break Hello.java:173', rexp)
625629
checker.check(exec_string)
626630

627631
execute("continue")
628632
exec_string = execute("backtrace 14")
633+
# we cannot be sure exactly how much inlining happens
634+
# which means the format of the frame display may vary from
635+
# one build to the next. so we use a generic match after the
636+
# first two pairs.
629637
rexp = [r"#0%shello\.Hello::inlineTo\(int\) %s at hello/Hello\.java:173"%(spaces_pattern, arg_values_pattern),
630638
r"#1%s%s in hello\.Hello::inlineHere %s at hello/Hello\.java:165"%(spaces_pattern, address_pattern, arg_values_pattern),
631639
r"#2%shello\.Hello::inlineTo\(int\) %s at hello/Hello\.java:171"%(spaces_pattern, arg_values_pattern),
632640
r"#3%s%s in hello\.Hello::inlineHere %s at hello/Hello\.java:165"%(spaces_pattern, address_pattern, arg_values_pattern),
633-
r"#4%shello\.Hello::inlineTo\(int\) %s at hello/Hello\.java:171"%(spaces_pattern, arg_values_pattern),
634-
r"#5%s%s in hello\.Hello::inlineHere %s at hello/Hello\.java:165"%(spaces_pattern, address_pattern, arg_values_pattern),
635-
r"#6%shello\.Hello::inlineTo\(int\) %s at hello/Hello\.java:171"%(spaces_pattern, arg_values_pattern),
636-
r"#7%s%s in hello\.Hello::inlineHere %s at hello/Hello\.java:165"%(spaces_pattern, address_pattern, arg_values_pattern),
637-
r"#8%shello\.Hello::inlineTo\(int\) %s at hello/Hello\.java:171"%(spaces_pattern, arg_values_pattern),
638-
r"#9%s%s in hello\.Hello::inlineHere %s at hello/Hello\.java:165"%(spaces_pattern, address_pattern, arg_values_pattern),
639-
r"#10%shello\.Hello::inlineTo %s at hello/Hello\.java:171"%(spaces_pattern, arg_values_pattern),
640-
r"#11%shello\.Hello::inlineHere %s at hello/Hello\.java:165"%(spaces_pattern, arg_values_pattern),
641+
r"#4%shello\.Hello::inlineTo%s at hello/Hello\.java:171"%(wildcard_pattern, wildcard_pattern),
642+
r"#5%shello\.Hello::inlineHere%s at hello/Hello\.java:165"%(wildcard_pattern, wildcard_pattern),
643+
r"#6%shello\.Hello::inlineTo%s at hello/Hello\.java:171"%(wildcard_pattern, wildcard_pattern),
644+
r"#7%shello\.Hello::inlineHere%s at hello/Hello\.java:165"%(wildcard_pattern, wildcard_pattern),
645+
r"#8%shello\.Hello::inlineTo%s at hello/Hello\.java:171"%(wildcard_pattern, wildcard_pattern),
646+
r"#9%shello\.Hello::inlineHere%s at hello/Hello\.java:165"%(wildcard_pattern, wildcard_pattern),
647+
r"#10%shello\.Hello::inlineTo%s at hello/Hello\.java:171"%(wildcard_pattern, wildcard_pattern),
648+
r"#11%shello\.Hello::inlineHere%s at hello/Hello\.java:165"%(wildcard_pattern, wildcard_pattern),
641649
r"#12%shello\.Hello::inlineFrom \(\) at hello/Hello\.java:146"%(spaces_pattern),
642650
r"#13%shello\.Hello::main\(java\.lang\.String\[\] \*\) %s at hello/Hello\.java:94"%(spaces_pattern, arg_values_pattern)]
643651
checker = Checker('backtrace in recursive inlineTo', rexp)
644652
checker.check(exec_string, skip_fails=False)
645653

646654
execute("delete breakpoints")
647655
exec_string = execute("break Hello.java:179")
648-
rexp = r"Breakpoint %s at %s: file hello/Hello\.java, line 179\."%(digits_pattern, address_pattern)
649-
checker = Checker('break Hello.java:178', rexp)
656+
# we cannot be sure how much inlining will happen so we
657+
# specify a pattern for the number of locations
658+
rexp = r"Breakpoint %s at %s: Hello\.java:179\. \(%s locations\)"%(digits_pattern, address_pattern, digits_pattern)
659+
checker = Checker('break Hello.java:179', rexp)
650660
checker.check(exec_string)
651661

652662
execute("continue 5")
653663
exec_string = execute("backtrace 8")
664+
# we cannot be sure exactly how much inlining happens
665+
# which means the format of the frame display may vary from
666+
# one build to the next. so we use a generic match after the
667+
# first two.
654668
rexp = [r"#0%shello\.Hello::inlineTailRecursion\(int\) %s at hello/Hello\.java:179"%(spaces_pattern, arg_values_pattern),
655669
r"#1%s%s in hello\.Hello::inlineTailRecursion\(int\) %s at hello/Hello\.java:182"%(spaces_pattern, address_pattern, arg_values_pattern),
656-
r"#2%s%s in hello\.Hello::inlineTailRecursion\(int\) %s at hello/Hello\.java:182"%(spaces_pattern, address_pattern, arg_values_pattern),
657-
r"#3%s%s in hello\.Hello::inlineTailRecursion\(int\) %s at hello/Hello\.java:182"%(spaces_pattern, address_pattern, arg_values_pattern),
658-
r"#4%s%s in hello\.Hello::inlineTailRecursion\(int\) %s at hello/Hello\.java:182"%(spaces_pattern, address_pattern, arg_values_pattern),
659-
r"#5%s%s in hello\.Hello::inlineTailRecursion %s at hello/Hello\.java:182"%(spaces_pattern, address_pattern, arg_values_pattern),
670+
r"#2%shello\.Hello::inlineTailRecursion%s at hello/Hello\.java:182"%(wildcard_pattern, wildcard_pattern),
671+
r"#3%shello\.Hello::inlineTailRecursion%s at hello/Hello\.java:182"%(wildcard_pattern, wildcard_pattern),
672+
r"#4%shello\.Hello::inlineTailRecursion%s at hello/Hello\.java:182"%(wildcard_pattern, wildcard_pattern),
673+
r"#5%shello\.Hello::inlineTailRecursion%s at hello/Hello\.java:182"%(wildcard_pattern, wildcard_pattern),
660674
r"#6%shello\.Hello::inlineFrom \(\) at hello/Hello\.java:147"%(spaces_pattern),
661675
r"#7%shello\.Hello::main\(java\.lang\.String\[\] \*\) %s at hello/Hello\.java:94"%(spaces_pattern, arg_values_pattern)]
662676
checker = Checker('backtrace in recursive inlineTo', rexp)
@@ -730,6 +744,8 @@ def test():
730744
execute("delete breakpoints");
731745

732746
exec_string = execute("break hello.Hello::inlineReceiveConstants")
747+
# we cannot be sure how much inlining will happen so we
748+
# specify a pattern for the number of locations
733749
rexp = r"Breakpoint %s at %s: hello\.Hello::inlineReceiveConstants\. \(%s locations\)"%(digits_pattern, address_pattern, digits_pattern)
734750
checker = Checker('break hello.Hello::inlineReceiveConstants', rexp)
735751
checker.check(exec_string)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1417,7 +1417,7 @@ private NativeImageDebugLocationInfo createBadLeafLocationInfo(FrameNode node, N
14171417
int endPos = node.getEndPos() + 1;
14181418
NativeImageDebugLocationInfo locationInfo = new NativeImageDebugLocationInfo(callerPos, startPos, endPos, null, framesize);
14191419
debugContext.log(DebugContext.DETAILED_LEVEL, "Embed leaf Location Info : %s depth %d (%d, %d)", locationInfo.name(), locationInfo.depth(), locationInfo.addressLo(),
1420-
locationInfo.addressHi() - 1);
1420+
locationInfo.addressHi() - 1);
14211421
return locationInfo;
14221422
}
14231423

0 commit comments

Comments
 (0)