[PATCH] D95609: [llvm-symbolizer] - Fix the crash in GNU output style with --no-inlines and missing input file.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 12:05:42 PST 2021


MaskRay added a comment.

Perhaps clarify the description as following (I had had trouble understanding it until I debugged it).

If the input file is not present, the following code will crash if there are two or more input addresses.

  auto ResOrErr = Symbolizer.symbolizeInlinedCode(
    ModuleName, {Offset, object::SectionedAddress::UndefSection});
  Printer << (error(ResOrErr) ? DILineInfo() : ResOrErr.get().getFrame(0));

For the first address, `symbolizeInlinedCode` returns an error.
For the second address, `symbolizeInlinedCode` returns an empty result (not an error) and `.getFrame(0)` will crash.

I thought about whether non-first runs should return an error as well, but then I realized that the error cannot be easily serialized and stored, so returning an empty result should be fine.


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

https://reviews.llvm.org/D95609



More information about the llvm-commits mailing list