Add line numbers to stacktraces in macos_x64/ios_x64 debug binaries (#2489)

This commit is contained in:
SvyatoslavScherbina
2018-12-24 17:05:27 +03:00
committed by Nikolay Igotti
parent 7de47bb1de
commit cfd6b80e6a
13 changed files with 258 additions and 16 deletions
@@ -44,7 +44,7 @@ fun sourceInfoString(owner: CValue<CSSymbolOwnerRef>, address: ULong): String? {
if (sourceInfo == null) return null
val filePath = CSSourceInfoGetPath(sourceInfo)?.toKString() ?: return null
val columnNumber = CSSourceInfoGetColumn(sourceInfo)
return "$filePath:${if (maybe) "~" else ""}$lineNumber:$columnNumber"
return "$filePath:${if (lineNumber == 0u) "<unknown>" else "${if (maybe) "~" else ""}$lineNumber:$columnNumber"}"
}
fun analyzeTrace(program: String, arch: String, input: Sequence<String>) {
@@ -67,7 +67,7 @@ fun analyzeTrace(program: String, arch: String, input: Sequence<String>) {
val address = this.location + offsetInFunction
val sourceInfo = sourceInfoString(owner, address)
if (sourceInfo != null) {
result = matcher.replaceFirst(line, "$atPart$functionName $sourceInfo")
result = matcher.replaceFirst(line, "$atPart$functionName + $offsetInFunction ($sourceInfo)")
}
}
}