forked from OSchip/llvm-project
[llvm-objdump][MachO] Fix error reporting after r350848 and r350849
llvm-svn: 350851
This commit is contained in:
parent
4d8c8fe62e
commit
b8819dc1e3
|
@ -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'
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue