<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/118637>118637</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
GSYM: lookup functionality is lacking for decoded FunctionInfo
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
itrofimow
</td>
</tr>
</table>
<pre>
`GsymReader` has a very convenient `lookup(uint64_t Addr)` method, which is an excellent utility for one off lookup, but doesn't suit repeated lookups that well due to it parsing `FunctionInfo` over and over again.
Documentation gives a hint that `getFunctionInfo`/`getFunctionInfoAtIndex` could be used instead:
```
/// This should be called when a client will store a copy of the complete
/// FunctionInfo for a given address. For one off lookups, use the lookup()
/// function below.
///
/// Symbolication server processes might want to parse the entire function
/// info for a given address and cache it if the process stays around to
/// service many symbolication addresses, like for parsing profiling
/// information.
```
, however there is no functionality to easily lookup an address in the resulting `FunctionInfo` (it only has a static `lookup` version, which parses `FunctionInfo` data stream).
I think `llvm::Expected<LookupResult> FunctionInfo::lookup(uint64_t Addr) const` could be a welcome addition, so one doesn't have to dig into `static lookup` implementation to actually use `FunctionInfo` returned from `GsymReader::getFunctionInfo` for symbolization.
I've managed to piece together what I believe to be a correct implementation of `FunctionInfo::lookup(uint64 Addr)`, should I try to upstream it?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0Vc1u4zgTfBr60hhDpmw5PujgLzMeGPj2MrOXPS1osiX1hiINsmVH-_QLUsqPnQQQkEAmq6urq1oqRmodYi02_xOb7ws1cOdDTRx8Q72_Lk7ejLWoip9x7H-hMhhEVUCnIii4YBhBe3dBR-gYRFVY75-Gs5APAzmu1n8z7I0JQu7SrR6580bIR7h2pDugCMoBPmu0Nt0fmCzxCI0P4B2Cbxp4AXyE08BgPEYn5JYhDsQQ8IyK0cynInCnGK5oLZgBgT0Qw1mFSK5N7A6D00zeHV3jE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