Skip to content

Commit

Permalink
Fix line numbers, fixes #6
Browse files Browse the repository at this point in the history
  • Loading branch information
parttimenerd committed Dec 1, 2023
1 parent 2b53935 commit f5ed64e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/kotlin/me/bechberger/jfrtofp/processor/Tables.kt
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ class FuncTableWrapper(val tables: Tables) {
resourcess.add(-1)
fileNames.add(null)
sourceUrls.add(tables.defaultUrl?.let { tables.getString(it) })
lineNumbers.add(-1)
index
}
}
Expand Down Expand Up @@ -361,7 +362,10 @@ class FrameTableWrapper(val tables: Tables) {
internal fun getFrame(
frame: RecordedFrame
): IndexIntoFrameTable {
val func = tables.getFunction(frame.method, frame.isJavaFrame, frame.lineNumber)
// we don't know the start line of the function from JFR
// so we use -1, to signal the profile viewer that it is invalid
// Related to https://github.com/parttimenerd/jfrtofp/issues/6
val func = tables.getFunction(frame.method, frame.isJavaFrame, -1)
val line = if (frame.lineNumber == -1) null else frame.lineNumber

return map.computeIfAbsent(func to line) {
Expand Down

0 comments on commit f5ed64e

Please sign in to comment.