[PATCH] D147652: [symbolizer] Check existence of input file in GNU mode

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 16:45:55 PDT 2023


dblaikie added a comment.

In D147652#4314914 <https://reviews.llvm.org/D147652#4314914>, @sepavloff wrote:

> In D147652#4311166 <https://reviews.llvm.org/D147652#4311166>, @dblaikie wrote:
>
>>> This complexity is caused by the fact that in native mode llvm-symbolizer can read binary file name from input stream. In this mode wrong input file is not a reason to stop working - the next data in stdin can query about different file. This is why llvm-symbolizer opens input file late, after it reads input stream.
>>
>> Perhaps the APIs could be restructured such that the file is opened, then queries run on it - then in the addr2line mode, we could open the file once, then parse and run queries, and in the llvm-symbolizer mode we could parse, open file, run query?
>
> Actually llvm-symbolizer works in this way with this patch. When input file is tested for existence, `findBinaryFile` calls `getOrCreateModuleInfo`, which stores the file information in `LLVMSymbolizer::Modules`. When later on `getOrCreateModuleInfo` is called again in the address translation loop, the file information is taken from the cache. So the call to `findBinaryFile` works as a module prefetch. No performance or memory penalty.

Ah, fair enough - the indirection's a bit awkward (spooky action at a distance, etc) - but at least satisfies me on the "don't do two correlated file options/expect one result to haev any meaning for a later independent operation".


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147652/new/

https://reviews.llvm.org/D147652



More information about the llvm-commits mailing list