Skip to content

Commit 328ad90

Browse files
committed
Ensure fileEntry is in localFilesIndex of corresponding ClassEntry
1 parent cb0af77 commit 328ad90

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,11 @@ public MethodEntry ensureMethodEntryForDebugRangeInfo(DebugRangeInfo debugRangeI
351351
MethodEntry methodEntry = methodIterator.next();
352352
int comparisonResult = methodEntry.compareTo(debugRangeInfo.symbolNameForMethod());
353353
if (comparisonResult == 0) {
354-
methodEntry.setInRange(debugInfoBase, debugRangeInfo);
354+
methodEntry.setInRangeAndUpdateFileEntry(debugInfoBase, debugRangeInfo);
355+
if (methodEntry.fileEntry != null) {
356+
/* Ensure that the methodEntry's fileEntry is present in the localsFileIndex */
357+
indexLocalFileEntry(methodEntry.fileEntry);
358+
}
355359
return methodEntry;
356360
} else if (comparisonResult > 0) {
357361
methodIterator.previous();

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,29 @@ public boolean isInRange() {
9191
return isInRange;
9292
}
9393

94-
public void setInRange(DebugInfoBase debugInfoBase, DebugRangeInfo debugRangeInfo) {
94+
/**
95+
* Sets {@code isInRange} and ensures that the {@code fileEntry} is up to date. If the
96+
* MethodEntry was added by traversing the DeclaredMethods of a Class its fileEntry will point
97+
* to the original source file, thus it will be wrong for substituted methods. As a result when
98+
* setting a MethodEntry as isInRange we also make sure that its fileEntry reflects the file
99+
* info associated with the corresponding Range.
100+
*
101+
* @param debugInfoBase
102+
* @param debugRangeInfo
103+
*/
104+
public void setInRangeAndUpdateFileEntry(DebugInfoBase debugInfoBase, DebugRangeInfo debugRangeInfo) {
95105
if (isInRange) {
96106
assert fileEntry == debugInfoBase.ensureFileEntry(debugRangeInfo);
97107
return;
98108
}
109+
isInRange = true;
99110
/*
100111
* If the MethodEntry was added by traversing the DeclaredMethods of a Class its fileEntry
101112
* will point to the original source file, thus it will be wrong for substituted methods. As
102113
* a result when setting a MethodEntry as isInRange we also make sure that its fileEntry
103114
* reflects the file info associated with the corresponding Range.
104115
*/
105116
fileEntry = debugInfoBase.ensureFileEntry(debugRangeInfo);
106-
isInRange = true;
107117
}
108118

109119
public String getSymbolName() {

0 commit comments

Comments
 (0)