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

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 02:17:24 PDT 2023


sepavloff added a comment.

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.


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