Path: blob/main/contrib/llvm-project/llvm/lib/ObjectYAML/MinidumpYAML.cpp
35233 views
//===- MinidumpYAML.cpp - Minidump YAMLIO implementation ------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "llvm/ObjectYAML/MinidumpYAML.h"9#include "llvm/Support/Allocator.h"1011using namespace llvm;12using namespace llvm::MinidumpYAML;13using namespace llvm::minidump;1415/// Perform an optional yaml-mapping of an endian-aware type EndianType. The16/// only purpose of this function is to avoid casting the Default value to the17/// endian type;18template <typename EndianType>19static inline void mapOptional(yaml::IO &IO, const char *Key, EndianType &Val,20typename EndianType::value_type Default) {21IO.mapOptional(Key, Val, EndianType(Default));22}2324/// Yaml-map an endian-aware type EndianType as some other type MapType.25template <typename MapType, typename EndianType>26static inline void mapRequiredAs(yaml::IO &IO, const char *Key,27EndianType &Val) {28MapType Mapped = static_cast<typename EndianType::value_type>(Val);29IO.mapRequired(Key, Mapped);30Val = static_cast<typename EndianType::value_type>(Mapped);31}3233/// Perform an optional yaml-mapping of an endian-aware type EndianType as some34/// other type MapType.35template <typename MapType, typename EndianType>36static inline void mapOptionalAs(yaml::IO &IO, const char *Key, EndianType &Val,37MapType Default) {38MapType Mapped = static_cast<typename EndianType::value_type>(Val);39IO.mapOptional(Key, Mapped, Default);40Val = static_cast<typename EndianType::value_type>(Mapped);41}4243namespace {44/// Return the appropriate yaml Hex type for a given endian-aware type.45template <typename EndianType> struct HexType;46template <> struct HexType<support::ulittle16_t> { using type = yaml::Hex16; };47template <> struct HexType<support::ulittle32_t> { using type = yaml::Hex32; };48template <> struct HexType<support::ulittle64_t> { using type = yaml::Hex64; };49} // namespace5051/// Yaml-map an endian-aware type as an appropriately-sized hex value.52template <typename EndianType>53static inline void mapRequiredHex(yaml::IO &IO, const char *Key,54EndianType &Val) {55mapRequiredAs<typename HexType<EndianType>::type>(IO, Key, Val);56}5758/// Perform an optional yaml-mapping of an endian-aware type as an59/// appropriately-sized hex value.60template <typename EndianType>61static inline void mapOptionalHex(yaml::IO &IO, const char *Key,62EndianType &Val,63typename EndianType::value_type Default) {64mapOptionalAs<typename HexType<EndianType>::type>(IO, Key, Val, Default);65}6667Stream::~Stream() = default;6869Stream::StreamKind Stream::getKind(StreamType Type) {70switch (Type) {71case StreamType::Exception:72return StreamKind::Exception;73case StreamType::MemoryInfoList:74return StreamKind::MemoryInfoList;75case StreamType::MemoryList:76return StreamKind::MemoryList;77case StreamType::ModuleList:78return StreamKind::ModuleList;79case StreamType::SystemInfo:80return StreamKind::SystemInfo;81case StreamType::LinuxCPUInfo:82case StreamType::LinuxProcStatus:83case StreamType::LinuxLSBRelease:84case StreamType::LinuxCMDLine:85case StreamType::LinuxMaps:86case StreamType::LinuxProcStat:87case StreamType::LinuxProcUptime:88return StreamKind::TextContent;89case StreamType::ThreadList:90return StreamKind::ThreadList;91default:92return StreamKind::RawContent;93}94}9596std::unique_ptr<Stream> Stream::create(StreamType Type) {97StreamKind Kind = getKind(Type);98switch (Kind) {99case StreamKind::Exception:100return std::make_unique<ExceptionStream>();101case StreamKind::MemoryInfoList:102return std::make_unique<MemoryInfoListStream>();103case StreamKind::MemoryList:104return std::make_unique<MemoryListStream>();105case StreamKind::ModuleList:106return std::make_unique<ModuleListStream>();107case StreamKind::RawContent:108return std::make_unique<RawContentStream>(Type);109case StreamKind::SystemInfo:110return std::make_unique<SystemInfoStream>();111case StreamKind::TextContent:112return std::make_unique<TextContentStream>(Type);113case StreamKind::ThreadList:114return std::make_unique<ThreadListStream>();115}116llvm_unreachable("Unhandled stream kind!");117}118119void yaml::ScalarBitSetTraits<MemoryProtection>::bitset(120IO &IO, MemoryProtection &Protect) {121#define HANDLE_MDMP_PROTECT(CODE, NAME, NATIVENAME) \122IO.bitSetCase(Protect, #NATIVENAME, MemoryProtection::NAME);123#include "llvm/BinaryFormat/MinidumpConstants.def"124}125126void yaml::ScalarBitSetTraits<MemoryState>::bitset(IO &IO, MemoryState &State) {127#define HANDLE_MDMP_MEMSTATE(CODE, NAME, NATIVENAME) \128IO.bitSetCase(State, #NATIVENAME, MemoryState::NAME);129#include "llvm/BinaryFormat/MinidumpConstants.def"130}131132void yaml::ScalarBitSetTraits<MemoryType>::bitset(IO &IO, MemoryType &Type) {133#define HANDLE_MDMP_MEMTYPE(CODE, NAME, NATIVENAME) \134IO.bitSetCase(Type, #NATIVENAME, MemoryType::NAME);135#include "llvm/BinaryFormat/MinidumpConstants.def"136}137138void yaml::ScalarEnumerationTraits<ProcessorArchitecture>::enumeration(139IO &IO, ProcessorArchitecture &Arch) {140#define HANDLE_MDMP_ARCH(CODE, NAME) \141IO.enumCase(Arch, #NAME, ProcessorArchitecture::NAME);142#include "llvm/BinaryFormat/MinidumpConstants.def"143IO.enumFallback<Hex16>(Arch);144}145146void yaml::ScalarEnumerationTraits<OSPlatform>::enumeration(IO &IO,147OSPlatform &Plat) {148#define HANDLE_MDMP_PLATFORM(CODE, NAME) \149IO.enumCase(Plat, #NAME, OSPlatform::NAME);150#include "llvm/BinaryFormat/MinidumpConstants.def"151IO.enumFallback<Hex32>(Plat);152}153154void yaml::ScalarEnumerationTraits<StreamType>::enumeration(IO &IO,155StreamType &Type) {156#define HANDLE_MDMP_STREAM_TYPE(CODE, NAME) \157IO.enumCase(Type, #NAME, StreamType::NAME);158#include "llvm/BinaryFormat/MinidumpConstants.def"159IO.enumFallback<Hex32>(Type);160}161162void yaml::MappingTraits<CPUInfo::ArmInfo>::mapping(IO &IO,163CPUInfo::ArmInfo &Info) {164mapRequiredHex(IO, "CPUID", Info.CPUID);165mapOptionalHex(IO, "ELF hwcaps", Info.ElfHWCaps, 0);166}167168namespace {169template <std::size_t N> struct FixedSizeHex {170FixedSizeHex(uint8_t (&Storage)[N]) : Storage(Storage) {}171172uint8_t (&Storage)[N];173};174} // namespace175176namespace llvm {177namespace yaml {178template <std::size_t N> struct ScalarTraits<FixedSizeHex<N>> {179static void output(const FixedSizeHex<N> &Fixed, void *, raw_ostream &OS) {180OS << toHex(ArrayRef(Fixed.Storage));181}182183static StringRef input(StringRef Scalar, void *, FixedSizeHex<N> &Fixed) {184if (!all_of(Scalar, isHexDigit))185return "Invalid hex digit in input";186if (Scalar.size() < 2 * N)187return "String too short";188if (Scalar.size() > 2 * N)189return "String too long";190copy(fromHex(Scalar), Fixed.Storage);191return "";192}193194static QuotingType mustQuote(StringRef S) { return QuotingType::None; }195};196} // namespace yaml197} // namespace llvm198void yaml::MappingTraits<CPUInfo::OtherInfo>::mapping(199IO &IO, CPUInfo::OtherInfo &Info) {200FixedSizeHex<sizeof(Info.ProcessorFeatures)> Features(Info.ProcessorFeatures);201IO.mapRequired("Features", Features);202}203204namespace {205/// A type which only accepts strings of a fixed size for yaml conversion.206template <std::size_t N> struct FixedSizeString {207FixedSizeString(char (&Storage)[N]) : Storage(Storage) {}208209char (&Storage)[N];210};211} // namespace212213namespace llvm {214namespace yaml {215template <std::size_t N> struct ScalarTraits<FixedSizeString<N>> {216static void output(const FixedSizeString<N> &Fixed, void *, raw_ostream &OS) {217OS << StringRef(Fixed.Storage, N);218}219220static StringRef input(StringRef Scalar, void *, FixedSizeString<N> &Fixed) {221if (Scalar.size() < N)222return "String too short";223if (Scalar.size() > N)224return "String too long";225copy(Scalar, Fixed.Storage);226return "";227}228229static QuotingType mustQuote(StringRef S) { return needsQuotes(S); }230};231} // namespace yaml232} // namespace llvm233234void yaml::MappingTraits<CPUInfo::X86Info>::mapping(IO &IO,235CPUInfo::X86Info &Info) {236FixedSizeString<sizeof(Info.VendorID)> VendorID(Info.VendorID);237IO.mapRequired("Vendor ID", VendorID);238239mapRequiredHex(IO, "Version Info", Info.VersionInfo);240mapRequiredHex(IO, "Feature Info", Info.FeatureInfo);241mapOptionalHex(IO, "AMD Extended Features", Info.AMDExtendedFeatures, 0);242}243244void yaml::MappingTraits<MemoryInfo>::mapping(IO &IO, MemoryInfo &Info) {245mapRequiredHex(IO, "Base Address", Info.BaseAddress);246mapOptionalHex(IO, "Allocation Base", Info.AllocationBase, Info.BaseAddress);247mapRequiredAs<MemoryProtection>(IO, "Allocation Protect",248Info.AllocationProtect);249mapOptionalHex(IO, "Reserved0", Info.Reserved0, 0);250mapRequiredHex(IO, "Region Size", Info.RegionSize);251mapRequiredAs<MemoryState>(IO, "State", Info.State);252mapOptionalAs<MemoryProtection>(IO, "Protect", Info.Protect,253Info.AllocationProtect);254mapRequiredAs<MemoryType>(IO, "Type", Info.Type);255mapOptionalHex(IO, "Reserved1", Info.Reserved1, 0);256}257258void yaml::MappingTraits<VSFixedFileInfo>::mapping(IO &IO,259VSFixedFileInfo &Info) {260mapOptionalHex(IO, "Signature", Info.Signature, 0);261mapOptionalHex(IO, "Struct Version", Info.StructVersion, 0);262mapOptionalHex(IO, "File Version High", Info.FileVersionHigh, 0);263mapOptionalHex(IO, "File Version Low", Info.FileVersionLow, 0);264mapOptionalHex(IO, "Product Version High", Info.ProductVersionHigh, 0);265mapOptionalHex(IO, "Product Version Low", Info.ProductVersionLow, 0);266mapOptionalHex(IO, "File Flags Mask", Info.FileFlagsMask, 0);267mapOptionalHex(IO, "File Flags", Info.FileFlags, 0);268mapOptionalHex(IO, "File OS", Info.FileOS, 0);269mapOptionalHex(IO, "File Type", Info.FileType, 0);270mapOptionalHex(IO, "File Subtype", Info.FileSubtype, 0);271mapOptionalHex(IO, "File Date High", Info.FileDateHigh, 0);272mapOptionalHex(IO, "File Date Low", Info.FileDateLow, 0);273}274275void yaml::MappingTraits<ModuleListStream::entry_type>::mapping(276IO &IO, ModuleListStream::entry_type &M) {277mapRequiredHex(IO, "Base of Image", M.Entry.BaseOfImage);278mapRequiredHex(IO, "Size of Image", M.Entry.SizeOfImage);279mapOptionalHex(IO, "Checksum", M.Entry.Checksum, 0);280mapOptional(IO, "Time Date Stamp", M.Entry.TimeDateStamp, 0);281IO.mapRequired("Module Name", M.Name);282IO.mapOptional("Version Info", M.Entry.VersionInfo, VSFixedFileInfo());283IO.mapRequired("CodeView Record", M.CvRecord);284IO.mapOptional("Misc Record", M.MiscRecord, yaml::BinaryRef());285mapOptionalHex(IO, "Reserved0", M.Entry.Reserved0, 0);286mapOptionalHex(IO, "Reserved1", M.Entry.Reserved1, 0);287}288289static void streamMapping(yaml::IO &IO, RawContentStream &Stream) {290IO.mapOptional("Content", Stream.Content);291IO.mapOptional("Size", Stream.Size, Stream.Content.binary_size());292}293294static std::string streamValidate(RawContentStream &Stream) {295if (Stream.Size.value < Stream.Content.binary_size())296return "Stream size must be greater or equal to the content size";297return "";298}299300void yaml::MappingTraits<MemoryListStream::entry_type>::mapping(301IO &IO, MemoryListStream::entry_type &Range) {302MappingContextTraits<MemoryDescriptor, yaml::BinaryRef>::mapping(303IO, Range.Entry, Range.Content);304}305306static void streamMapping(yaml::IO &IO, MemoryInfoListStream &Stream) {307IO.mapRequired("Memory Ranges", Stream.Infos);308}309310static void streamMapping(yaml::IO &IO, MemoryListStream &Stream) {311IO.mapRequired("Memory Ranges", Stream.Entries);312}313314static void streamMapping(yaml::IO &IO, ModuleListStream &Stream) {315IO.mapRequired("Modules", Stream.Entries);316}317318static void streamMapping(yaml::IO &IO, SystemInfoStream &Stream) {319SystemInfo &Info = Stream.Info;320IO.mapRequired("Processor Arch", Info.ProcessorArch);321mapOptional(IO, "Processor Level", Info.ProcessorLevel, 0);322mapOptional(IO, "Processor Revision", Info.ProcessorRevision, 0);323IO.mapOptional("Number of Processors", Info.NumberOfProcessors, 0);324IO.mapOptional("Product type", Info.ProductType, 0);325mapOptional(IO, "Major Version", Info.MajorVersion, 0);326mapOptional(IO, "Minor Version", Info.MinorVersion, 0);327mapOptional(IO, "Build Number", Info.BuildNumber, 0);328IO.mapRequired("Platform ID", Info.PlatformId);329IO.mapOptional("CSD Version", Stream.CSDVersion, "");330mapOptionalHex(IO, "Suite Mask", Info.SuiteMask, 0);331mapOptionalHex(IO, "Reserved", Info.Reserved, 0);332switch (static_cast<ProcessorArchitecture>(Info.ProcessorArch)) {333case ProcessorArchitecture::X86:334case ProcessorArchitecture::AMD64:335IO.mapOptional("CPU", Info.CPU.X86);336break;337case ProcessorArchitecture::ARM:338case ProcessorArchitecture::ARM64:339case ProcessorArchitecture::BP_ARM64:340IO.mapOptional("CPU", Info.CPU.Arm);341break;342default:343IO.mapOptional("CPU", Info.CPU.Other);344break;345}346}347348static void streamMapping(yaml::IO &IO, TextContentStream &Stream) {349IO.mapOptional("Text", Stream.Text);350}351352void yaml::MappingContextTraits<MemoryDescriptor, yaml::BinaryRef>::mapping(353IO &IO, MemoryDescriptor &Memory, BinaryRef &Content) {354mapRequiredHex(IO, "Start of Memory Range", Memory.StartOfMemoryRange);355IO.mapRequired("Content", Content);356}357358void yaml::MappingTraits<ThreadListStream::entry_type>::mapping(359IO &IO, ThreadListStream::entry_type &T) {360mapRequiredHex(IO, "Thread Id", T.Entry.ThreadId);361mapOptionalHex(IO, "Suspend Count", T.Entry.SuspendCount, 0);362mapOptionalHex(IO, "Priority Class", T.Entry.PriorityClass, 0);363mapOptionalHex(IO, "Priority", T.Entry.Priority, 0);364mapOptionalHex(IO, "Environment Block", T.Entry.EnvironmentBlock, 0);365IO.mapRequired("Context", T.Context);366IO.mapRequired("Stack", T.Entry.Stack, T.Stack);367}368369static void streamMapping(yaml::IO &IO, ThreadListStream &Stream) {370IO.mapRequired("Threads", Stream.Entries);371}372373static void streamMapping(yaml::IO &IO, MinidumpYAML::ExceptionStream &Stream) {374mapRequiredHex(IO, "Thread ID", Stream.MDExceptionStream.ThreadId);375IO.mapRequired("Exception Record", Stream.MDExceptionStream.ExceptionRecord);376IO.mapRequired("Thread Context", Stream.ThreadContext);377}378379void yaml::MappingTraits<minidump::Exception>::mapping(380yaml::IO &IO, minidump::Exception &Exception) {381mapRequiredHex(IO, "Exception Code", Exception.ExceptionCode);382mapOptionalHex(IO, "Exception Flags", Exception.ExceptionFlags, 0);383mapOptionalHex(IO, "Exception Record", Exception.ExceptionRecord, 0);384mapOptionalHex(IO, "Exception Address", Exception.ExceptionAddress, 0);385mapOptional(IO, "Number of Parameters", Exception.NumberParameters, 0);386387for (size_t Index = 0; Index < Exception.MaxParameters; ++Index) {388SmallString<16> Name("Parameter ");389Twine(Index).toVector(Name);390support::ulittle64_t &Field = Exception.ExceptionInformation[Index];391392if (Index < Exception.NumberParameters)393mapRequiredHex(IO, Name.c_str(), Field);394else395mapOptionalHex(IO, Name.c_str(), Field, 0);396}397}398399void yaml::MappingTraits<std::unique_ptr<Stream>>::mapping(400yaml::IO &IO, std::unique_ptr<MinidumpYAML::Stream> &S) {401StreamType Type;402if (IO.outputting())403Type = S->Type;404IO.mapRequired("Type", Type);405406if (!IO.outputting())407S = MinidumpYAML::Stream::create(Type);408switch (S->Kind) {409case MinidumpYAML::Stream::StreamKind::Exception:410streamMapping(IO, llvm::cast<MinidumpYAML::ExceptionStream>(*S));411break;412case MinidumpYAML::Stream::StreamKind::MemoryInfoList:413streamMapping(IO, llvm::cast<MemoryInfoListStream>(*S));414break;415case MinidumpYAML::Stream::StreamKind::MemoryList:416streamMapping(IO, llvm::cast<MemoryListStream>(*S));417break;418case MinidumpYAML::Stream::StreamKind::ModuleList:419streamMapping(IO, llvm::cast<ModuleListStream>(*S));420break;421case MinidumpYAML::Stream::StreamKind::RawContent:422streamMapping(IO, llvm::cast<RawContentStream>(*S));423break;424case MinidumpYAML::Stream::StreamKind::SystemInfo:425streamMapping(IO, llvm::cast<SystemInfoStream>(*S));426break;427case MinidumpYAML::Stream::StreamKind::TextContent:428streamMapping(IO, llvm::cast<TextContentStream>(*S));429break;430case MinidumpYAML::Stream::StreamKind::ThreadList:431streamMapping(IO, llvm::cast<ThreadListStream>(*S));432break;433}434}435436std::string yaml::MappingTraits<std::unique_ptr<Stream>>::validate(437yaml::IO &IO, std::unique_ptr<MinidumpYAML::Stream> &S) {438switch (S->Kind) {439case MinidumpYAML::Stream::StreamKind::RawContent:440return streamValidate(cast<RawContentStream>(*S));441case MinidumpYAML::Stream::StreamKind::Exception:442case MinidumpYAML::Stream::StreamKind::MemoryInfoList:443case MinidumpYAML::Stream::StreamKind::MemoryList:444case MinidumpYAML::Stream::StreamKind::ModuleList:445case MinidumpYAML::Stream::StreamKind::SystemInfo:446case MinidumpYAML::Stream::StreamKind::TextContent:447case MinidumpYAML::Stream::StreamKind::ThreadList:448return "";449}450llvm_unreachable("Fully covered switch above!");451}452453void yaml::MappingTraits<Object>::mapping(IO &IO, Object &O) {454IO.mapTag("!minidump", true);455mapOptionalHex(IO, "Signature", O.Header.Signature, Header::MagicSignature);456mapOptionalHex(IO, "Version", O.Header.Version, Header::MagicVersion);457mapOptionalHex(IO, "Flags", O.Header.Flags, 0);458IO.mapRequired("Streams", O.Streams);459}460461Expected<std::unique_ptr<Stream>>462Stream::create(const Directory &StreamDesc, const object::MinidumpFile &File) {463StreamKind Kind = getKind(StreamDesc.Type);464switch (Kind) {465case StreamKind::Exception: {466Expected<const minidump::ExceptionStream &> ExpectedExceptionStream =467File.getExceptionStream();468if (!ExpectedExceptionStream)469return ExpectedExceptionStream.takeError();470Expected<ArrayRef<uint8_t>> ExpectedThreadContext =471File.getRawData(ExpectedExceptionStream->ThreadContext);472if (!ExpectedThreadContext)473return ExpectedThreadContext.takeError();474return std::make_unique<ExceptionStream>(*ExpectedExceptionStream,475*ExpectedThreadContext);476}477case StreamKind::MemoryInfoList: {478if (auto ExpectedList = File.getMemoryInfoList())479return std::make_unique<MemoryInfoListStream>(*ExpectedList);480else481return ExpectedList.takeError();482}483case StreamKind::MemoryList: {484auto ExpectedList = File.getMemoryList();485if (!ExpectedList)486return ExpectedList.takeError();487std::vector<MemoryListStream::entry_type> Ranges;488for (const MemoryDescriptor &MD : *ExpectedList) {489auto ExpectedContent = File.getRawData(MD.Memory);490if (!ExpectedContent)491return ExpectedContent.takeError();492Ranges.push_back({MD, *ExpectedContent});493}494return std::make_unique<MemoryListStream>(std::move(Ranges));495}496case StreamKind::ModuleList: {497auto ExpectedList = File.getModuleList();498if (!ExpectedList)499return ExpectedList.takeError();500std::vector<ModuleListStream::entry_type> Modules;501for (const Module &M : *ExpectedList) {502auto ExpectedName = File.getString(M.ModuleNameRVA);503if (!ExpectedName)504return ExpectedName.takeError();505auto ExpectedCv = File.getRawData(M.CvRecord);506if (!ExpectedCv)507return ExpectedCv.takeError();508auto ExpectedMisc = File.getRawData(M.MiscRecord);509if (!ExpectedMisc)510return ExpectedMisc.takeError();511Modules.push_back(512{M, std::move(*ExpectedName), *ExpectedCv, *ExpectedMisc});513}514return std::make_unique<ModuleListStream>(std::move(Modules));515}516case StreamKind::RawContent:517return std::make_unique<RawContentStream>(StreamDesc.Type,518File.getRawStream(StreamDesc));519case StreamKind::SystemInfo: {520auto ExpectedInfo = File.getSystemInfo();521if (!ExpectedInfo)522return ExpectedInfo.takeError();523auto ExpectedCSDVersion = File.getString(ExpectedInfo->CSDVersionRVA);524if (!ExpectedCSDVersion)525return ExpectedInfo.takeError();526return std::make_unique<SystemInfoStream>(*ExpectedInfo,527std::move(*ExpectedCSDVersion));528}529case StreamKind::TextContent:530return std::make_unique<TextContentStream>(531StreamDesc.Type, toStringRef(File.getRawStream(StreamDesc)));532case StreamKind::ThreadList: {533auto ExpectedList = File.getThreadList();534if (!ExpectedList)535return ExpectedList.takeError();536std::vector<ThreadListStream::entry_type> Threads;537for (const Thread &T : *ExpectedList) {538auto ExpectedStack = File.getRawData(T.Stack.Memory);539if (!ExpectedStack)540return ExpectedStack.takeError();541auto ExpectedContext = File.getRawData(T.Context);542if (!ExpectedContext)543return ExpectedContext.takeError();544Threads.push_back({T, *ExpectedStack, *ExpectedContext});545}546return std::make_unique<ThreadListStream>(std::move(Threads));547}548}549llvm_unreachable("Unhandled stream kind!");550}551552Expected<Object> Object::create(const object::MinidumpFile &File) {553std::vector<std::unique_ptr<Stream>> Streams;554Streams.reserve(File.streams().size());555for (const Directory &StreamDesc : File.streams()) {556auto ExpectedStream = Stream::create(StreamDesc, File);557if (!ExpectedStream)558return ExpectedStream.takeError();559Streams.push_back(std::move(*ExpectedStream));560}561return Object(File.header(), std::move(Streams));562}563564565