Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion llvm/lib/ProfileData/MemProfReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,11 @@ Error RawMemProfReader::setupForSymbolization() {
ProfiledTextSegmentEnd = Entry.End;
}
}
assert(NumMatched != 0 && "No matching executable segments in segment info.");
if (NumMatched == 0)
return make_error<StringError>(
Twine("No matching executable segments found in binary ") +
Binary.getBinary()->getFileName(),
inconvertibleErrorCode());
assert((PreferredTextSegmentAddress == 0 ||
(PreferredTextSegmentAddress == ProfiledTextSegmentStart)) &&
"Expect text segment address to be 0 or equal to profiled text "
Expand Down
6 changes: 6 additions & 0 deletions llvm/test/tools/llvm-profdata/memprof-buildid.test
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ CHECK: Build ID: [[ID:[[:xdigit:]]+]]

COM: Then match it with the profdata output.
CHECK-COUNT-1: BuildId: {{.*}}[[ID]]

Test error message when profile build id does not match build id in a different binary.
RUN: not llvm-profdata show --memory %p/Inputs/buildid.memprofraw --profiled-binary %p/Inputs/basic.memprofexe -o - 2>&1 | FileCheck %s -check-prefix=BUILDID-NOT-MATCH
RUN: not llvm-profdata merge %p/Inputs/buildid.memprofraw %p/Inputs/basic.memprofraw --profiled-binary %p/Inputs/basic.memprofexe -o %t4.prof 2>&1 | FileCheck %s -check-prefix=BUILDID-NOT-MATCH

BUILDID-NOT-MATCH: No matching executable segments found in binary
Loading