public async Task LoadBinary_FailedToAddModuleAsync() { mockTarget.AddModule(PATH_IN_STORE, null, UUID.ToString()).Returns((SbModule)null); var module = placeholderModule; bool ok; (module, ok) = await binaryLoader.LoadBinaryAsync(module, searchLog); Assert.False(ok); Assert.AreSame(module, placeholderModule); StringAssert.Contains(ErrorStrings.FailedToLoadBinary(PATH_IN_STORE), searchLog.ToString()); }
bool TryPreloadModule(RemoteTarget lldbTarget, TextWriter searchLog, DumpModule module) { string moduleOriginPath = Path.GetDirectoryName(module.Path); string moduleName = Path.GetFileName(module.Path); string modulePath = _taskContext.Factory.Run(() => { return(_moduleFileFinder.FindFileAsync(moduleName, module.Id, false, searchLog)); }); if (!string.IsNullOrWhiteSpace(modulePath)) { var sbModule = lldbTarget.AddModule(modulePath, "", module.Id.ToUUIDString()); Trace.WriteLine($"Full dump load: found module {moduleName} with id {module.Id} " + $"by path {modulePath}. Module preloaded: {sbModule != null}"); if (sbModule?.SetPlatformFileSpec(moduleOriginPath, moduleName) == true) { Trace.WriteLine($"Full dump load: module {moduleName} path set to " + $"{moduleOriginPath}."); _moduleSearchLogHolder.SetSearchLog(sbModule, searchLog.ToString()); return(true); } } return(false); }
public override Task <AddModuleResponse> AddModule(AddModuleRequest request, ServerCallContext context) { RemoteTarget target = GrpcLookupUtils.GetTarget(request.Target, _targetStore); var response = new AddModuleResponse(); SbModule module = target.AddModule(request.Path, request.Triple, request.Uuid); if (module != null) { response.Module = new GrpcSbModule { Id = _moduleStore.AddObject(module) }; } return(Task.FromResult(response)); }
SbModule AddModule(string binaryPath, string id, TextWriter searchLog) { var newModule = lldbTarget.AddModule(binaryPath, null, id); if (newModule == null) { searchLog.WriteLine(ErrorStrings.FailedToLoadBinary(binaryPath)); Trace.WriteLine(ErrorStrings.FailedToLoadBinary(binaryPath)); return(null); } searchLog.WriteLine("Binary loaded successfully."); Trace.WriteLine($"Successfully loaded binary '{binaryPath}'."); return(newModule); }