forked from OSchip/llvm-project
Fix after c25938d
My refactor caused some changes in error reporting that TestAddDsymCommand.py was checking, so this restores some of the changes to preserve the old behavior and to un-xfail the affected test. Differential Revision: https://reviews.llvm.org/D74001
This commit is contained in:
parent
361ba3ad1f
commit
fb0d2d455f
|
@ -22,7 +22,6 @@ class AddDsymCommandCase(TestBase):
|
|||
self.teardown_hook_added = False
|
||||
|
||||
@no_debug_info_test
|
||||
@expectedFailureDarwin('until AdrianM or I find a fix for his 2020-02-03 CommandObjectTarget change')
|
||||
def test_add_dsym_command_with_error(self):
|
||||
"""Test that the 'add-dsym' command informs the user about failures."""
|
||||
|
||||
|
|
|
@ -4119,23 +4119,6 @@ protected:
|
|||
target->GetImages().FindModules(module_spec, matching_modules);
|
||||
}
|
||||
|
||||
if (matching_modules.IsEmpty()) {
|
||||
StreamString ss_symfile_uuid;
|
||||
if (module_spec.GetUUID().IsValid()) {
|
||||
ss_symfile_uuid << " (";
|
||||
module_spec.GetUUID().Dump(&ss_symfile_uuid);
|
||||
ss_symfile_uuid << ')';
|
||||
}
|
||||
result.AppendErrorWithFormat(
|
||||
"symbol file '%s'%s does not match any existing module%s\n",
|
||||
symfile_path, ss_symfile_uuid.GetData(),
|
||||
!llvm::sys::fs::is_regular_file(symbol_fspec.GetPath())
|
||||
? "\n please specify the full path to the symbol file"
|
||||
: "");
|
||||
result.SetStatus(eReturnStatusFailed);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (matching_modules.GetSize() > 1) {
|
||||
result.AppendErrorWithFormat("multiple modules match symbol file '%s', "
|
||||
"use the --uuid option to resolve the "
|
||||
|
@ -4145,7 +4128,7 @@ protected:
|
|||
return false;
|
||||
}
|
||||
|
||||
assert(matching_modules.GetSize() == 1);
|
||||
if (matching_modules.GetSize() == 1) {
|
||||
ModuleSP module_sp(matching_modules.GetModuleAtIndex(0));
|
||||
|
||||
// The module has not yet created its symbol vendor, we can just give
|
||||
|
@ -4155,22 +4138,9 @@ protected:
|
|||
|
||||
SymbolFile *symbol_file =
|
||||
module_sp->GetSymbolFile(true, &result.GetErrorStream());
|
||||
if (!symbol_file) {
|
||||
result.AppendErrorWithFormat("symbol file '%s' could not be loaded\n",
|
||||
symfile_path);
|
||||
result.SetStatus(eReturnStatusFailed);
|
||||
module_sp->SetSymbolFileFileSpec(FileSpec());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (symbol_file) {
|
||||
ObjectFile *object_file = symbol_file->GetObjectFile();
|
||||
if (!object_file || object_file->GetFileSpec() != symbol_fspec) {
|
||||
result.AppendError("the object file could not be loaded\n");
|
||||
result.SetStatus(eReturnStatusFailed);
|
||||
module_sp->SetSymbolFileFileSpec(FileSpec());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (object_file && object_file->GetFileSpec() == symbol_fspec) {
|
||||
// Provide feedback that the symfile has been successfully added.
|
||||
const FileSpec &module_fs = module_sp->GetFileSpec();
|
||||
result.AppendMessageWithFormat(
|
||||
|
@ -4204,6 +4174,26 @@ protected:
|
|||
result.SetStatus(eReturnStatusSuccessFinishResult);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Clear the symbol file spec if anything went wrong
|
||||
module_sp->SetSymbolFileFileSpec(FileSpec());
|
||||
}
|
||||
|
||||
StreamString ss_symfile_uuid;
|
||||
if (module_spec.GetUUID().IsValid()) {
|
||||
ss_symfile_uuid << " (";
|
||||
module_spec.GetUUID().Dump(&ss_symfile_uuid);
|
||||
ss_symfile_uuid << ')';
|
||||
}
|
||||
result.AppendErrorWithFormat(
|
||||
"symbol file '%s'%s does not match any existing module%s\n",
|
||||
symfile_path, ss_symfile_uuid.GetData(),
|
||||
!llvm::sys::fs::is_regular_file(symbol_fspec.GetPath())
|
||||
? "\n please specify the full path to the symbol file"
|
||||
: "");
|
||||
result.SetStatus(eReturnStatusFailed);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
||||
Target *target = m_exe_ctx.GetTargetPtr();
|
||||
|
|
Loading…
Reference in New Issue