[llvm-profgen] Parse hex address suffixes in perf scripts (#219268)
DSO/library names (e.g. ` [unknown]`, ` [libc.so.6]`) are appended to
call stack addresses in perf scripts with perf5 . This causes
`parseAddress` to fail because `getAsInteger` expects the entire input
string to be the integer representation.
Fix this by using `take_while` to strip trailing whitespace/non-hex
suffixes from the address token inside `parseAddress`. To prevent LBR
lines from being mistakenly consumed as call stack entries in
`checkPerfScriptType`'s detection loop, we add an explicit check to stop
when an LBR line is encountered.
Added a new test case `callstack-dso-suffix.test` verifying correct
parsing with different types of suffixes.
GitOrigin-RevId: 033a7f87009de29c57acadeaf5e606aa025d51f9
3 files changed