Skip to content

Commit c228452

Browse files
committed
DebugInfo fix file association for corner case
If line gets successfully retrieved from subrange instead of primaryrange get file index from the subrange since the line might be from a different file for inlined methods.
1 parent da57be0 commit c228452

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/elf/dwarf/DwarfLineSectionImpl.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,18 @@ private int writeLineNumberTable(DebugContext context, ClassEntry classEntry, by
448448
*/
449449
long line = primaryRange.getLine();
450450
if (line < 0 && primaryEntry.getSubranges().size() > 0) {
451-
line = primaryEntry.getSubranges().get(0).getLine();
451+
final Range subRange = primaryEntry.getSubranges().get(0);
452+
line = subRange.getLine();
453+
/*
454+
* If line gets successfully retrieved from subrange get file index from there since
455+
* the line might be from a different file for inlined methods
456+
*/
457+
if (line > 0) {
458+
FileEntry subFileEntry = subRange.getFileEntry();
459+
if (subFileEntry != null) {
460+
fileIdx = classEntry.localFilesIdx(subFileEntry);
461+
}
462+
}
452463
}
453464
if (line < 0) {
454465
line = 0;

0 commit comments

Comments
 (0)