[test][dwarfdump] add method to lookup by symbol name
This commit is contained in:
+2
-1
@@ -54,7 +54,8 @@ class ToolDriver(
|
||||
}
|
||||
|
||||
fun runDwarfDump(program: Path, vararg args:String = emptyArray(), processor:List<DwarfTag>.()->Unit) {
|
||||
val out = subprocess(DistProperties.dwarfDump, "${program}.dSYM/Contents/Resources/DWARF/${program.fileName}", *args).takeIf { it.process.exitValue() == 0 }?.stdout ?: error("${program}.dSYM/Contents/Resources/DWARF/${program.fileName}")
|
||||
val dwarfProcess = subprocess(DistProperties.dwarfDump, *args, "${program}.dSYM/Contents/Resources/DWARF/${program.fileName}")
|
||||
val out = dwarfProcess.takeIf { it.process.exitValue() == 0 }?.stdout ?: error(dwarfProcess.stderr)
|
||||
DwarfUtilParser().parse(StringReader(out)).tags.toList().processor()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -314,7 +314,7 @@ class DwarfUtilParser() {
|
||||
var currentAttribute: DwarfAttribute.Attribute? = null
|
||||
val currentAttributePayload = StringBuilder()
|
||||
companion object {
|
||||
val tagRegexp = Regex("^(0x[0-9a-f]{8}):\\ {3}(.*)$")
|
||||
val tagRegexp = Regex("^(0x[0-9a-f]{8}):\\ +([^\\ .]*)$")
|
||||
val attributeRegexp = Regex("^\\s+(DW_AT_[a-zA-Z0-9_]*)\\s+\\((.*)\\)$")
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -130,6 +130,7 @@ class ToolDriverHelper(private val driver: ToolDriver, private val root:Path) {
|
||||
private fun Path.compile(output: Path, vararg flags:String) = output.also{ driver.compile(this, it, *flags) }
|
||||
|
||||
fun Path.dwarfDumpLookup(address: Long, parser:List<DwarfTag>.() -> Unit) = driver.runDwarfDump(this, "-lookup", address.toString(), processor = parser)
|
||||
fun Path.dwarfDumpLookup(name: String, parser:List<DwarfTag>.() -> Unit) = driver.runDwarfDump(this, "-find", name, processor = parser)
|
||||
|
||||
|
||||
private fun String.feedOutput(output: String) = root.resolve(output).also {
|
||||
|
||||
Reference in New Issue
Block a user