This is an archive of the discontinued LLVM Phabricator instance.

[llvm-addr2line] Replace checkFileExists with getOrCreateModuleInfo
ClosedPublic

Authored by MaskRay on Jun 22 2023, 4:11 PM.

Details

Summary

GNU addr2line exits immediately if -e (default to a.out) specifies a file that
cannot be open or a directory. llvm-addr2line used to wait for input on if the
input file cannot be open and addresses are not specified in command line.
Replace the D147652 checkFileExists with getOrCreateModuleInfo to avoid
a separate sys::fs::status operation.

Diff Detail

Event Timeline

MaskRay created this revision.Jun 22 2023, 4:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2023, 4:11 PM
MaskRay requested review of this revision.Jun 22 2023, 4:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2023, 4:11 PM

Looks good, but I'm wondering if it would be just better for @sepavloff to integrate this change into their original patch, as that patch has a fair amount of useful discussion on it.

Regardless, I'd like @sepavloff to sign off on this.

llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
482
sepavloff accepted this revision.Jun 23 2023, 4:10 AM

The patch requires rebase because D147652 has committed, but the logic is clear and seems correct.

LGTM.

This revision is now accepted and ready to land.Jun 23 2023, 4:10 AM
MaskRay updated this revision to Diff 534001.Jun 23 2023, 10:01 AM
MaskRay retitled this revision from [llvm-addr2line] Exit early if the input file cannot be read to [llvm-addr2line] Replace checkFileExists with getOrCreateModuleInfo.
MaskRay edited the summary of this revision. (Show Details)

rebase to restore some code before D147652

MaskRay marked an inline comment as done.Jun 23 2023, 10:02 AM
This revision was landed with ongoing or failed builds.Jun 23 2023, 10:04 AM
This revision was automatically updated to reflect the committed changes.

Hi, on AIX we're getting the error: "The file was not recognized as a valid object file instead of the expected error"

Could you take a look please?

https://lab.llvm.org/buildbot/#/builders/214/builds/8134/steps/6/logs/FAIL__LLVM__input-file-err_test

Hi, on AIX we're getting the error: "The file was not recognized as a valid object file instead of the expected error"

It probably relates to https://reviews.llvm.org/D151567.

@sepavloff Thanks, that should address it