1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[llvm-objdump][MachO] Fix error reporting after r350848 and r350849

llvm-svn: 350851
This commit is contained in:
Francis Visoiu Mistrih 2019-01-10 17:36:54 +00:00
parent 9dbec100d3
commit 92f3fd2a98
2 changed files with 7 additions and 6 deletions

View File

@ -9,8 +9,7 @@ RUN: not llvm-objdump -macho -disassemble -g -dsym=%s %p/Inputs/bind.macho-x86_6
UNKNOWN_FILE_TYPE_DSYM: {{.*}}llvm-objdump: error:
RUN: not llvm-objdump -macho -disassemble -g -dsym=%p/missing-dsym %p/Inputs/bind.macho-x86_64 2>&1 | FileCheck %s -check-prefix=NO_SUCH_FILE_DSYM
NO_SUCH_FILE_DSYM: error: {{.*}}missing-dsym:
NO_SUCH_FILE_DSYM: error: '{{.*}}missing-dsym':
RUN: not llvm-objdump -macho -disassemble -g -dsym=%s %p/Inputs/bind.macho-x86_64 2>&1 | FileCheck %s -check-prefix=UNKNOWN_FILE_TYPE_DSYM_MSG
UNKNOWN_FILE_TYPE_DSYM_MSG: {{.*}}llvm-objdump: error:
UNKNOWN_FILE_TYPE_DSYM_MSG-NOT: bind.macho-x86_64
UNKNOWN_FILE_TYPE_DSYM_MSG: error: '{{.*}}.test'

View File

@ -6970,15 +6970,17 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrErr =
MemoryBuffer::getFileOrSTDIN(DSYMFile);
if (std::error_code EC = BufOrErr.getError()) {
WithColor::error(errs(), "llvm-objdump")
<< DSYMFile << ": " << EC.message() << '\n';
report_error(DSYMFile, errorCodeToError(EC));
return;
}
Expected<std::unique_ptr<MachOObjectFile>> DbgObjCheck =
ObjectFile::createMachOObjectFile(BufOrErr.get()->getMemBufferRef());
if (Error E = DbgObjCheck.takeError())
if (Error E = DbgObjCheck.takeError()) {
report_error(DSYMFile, std::move(E));
return;
}
DbgObj = DbgObjCheck.get().release();
// We need to keep the file alive, because we're replacing DbgObj with it.