DropDbOp::DropDbOp(BufReader& log) : DurOp(JEntry::OpCode_DropDb) { unsigned long long reserved; log.read(reserved); log.read(reserved); log.readStr(_db); string reservedStr; log.readStr(reservedStr); }
FileCreatedOp::FileCreatedOp(BufReader& log) : DurOp(JEntry::OpCode_FileCreated) { unsigned long long reserved; log.read(reserved); log.read(reserved); log.read(_len); // size of file, not length of name string s; log.readStr(s); _p._p = s; }
Document Document::deserializeForSorter(BufReader& buf, const SorterDeserializeSettings&) { const int numElems = buf.read<int>(); MutableDocument doc(numElems); for (int i = 0; i < numElems; i++) { StringData name = buf.readCStr(); doc.addField(name, Value::deserializeForSorter(buf, Value::SorterDeserializeSettings())); } return doc.freeze(); }
Document Document::deserializeForSorter(BufReader& buf, const SorterDeserializeSettings&) { const int numElems = buf.read<int>(); MutableDocument doc(numElems); for (int i = 0; i < numElems; i++) { StringData name = buf.readCStr(); doc.addField(name, Value::deserializeForSorter(buf, Value::SorterDeserializeSettings())); } while (char marker = buf.read<char>()) { if (marker == char(DocumentStorage::MetaType::TEXT_SCORE) + 1) { doc.setTextScore(buf.read<double>()); } else if (marker == char(DocumentStorage::MetaType::RAND_VAL) + 1) { doc.setRandMetaField(buf.read<double>()); } else { uasserted(28744, "Unrecognized marker, unable to deserialize buffer"); } } return doc.freeze(); }
void EHSection::loadFDE(BufReader& reader, uint64_t endPos, CIE* cie) { FDE* fde = new FDE; fde->startAddress = reader.readDwarfPointer(cie->ptrEncoding); fde->length = reader.readDwarfPointer(cie->ptrEncoding); // if ptrEncoding is relative, then in context of length, it is still just a plain number if (*cie->augmentationString == 'z') fde->augmentationDataLength = reader.readLEB128(); else fde->augmentationDataLength = 0; if (strchr(cie->augmentationString, 'L') && cie->lsdaEncoding != 0xff) // DW_EH_PE_omit fde->lsdaPointer = reader.readDwarfPointer(cie->lsdaEncoding); uint64_t instructionsLength = endPos - reader.pos(); const uint8_t* data = reinterpret_cast<const uint8_t*>(reader.readBlock(instructionsLength)); fde->instructions.assign(data, data+instructionsLength); cie->fdes.push_back(fde); }
void EHSection::loadCIE(BufReader& reader, uint64_t endPos, uintptr_t location) { CIE* cie = new CIE; cie->start = reader.pos(); cie->version = reader.read(); cie->augmentationString = reader.readString(); cie->codeAlign = reader.readLEB128(); cie->dataAlign = reader.readLEB128(); if (cie->codeAlign != 1) { std::stringstream ss; ss << "Invalid code alignment: " << int(cie->codeAlign) << std::endl; delete cie; throw std::runtime_error(ss.str()); } if (cie->version == 1) cie->returnRegister = reader.read(); else if (cie->version == 3) cie->returnRegister = reader.readLEB128(); else { std::stringstream ss; ss << "Invalid CIE version: " << int(cie->version) << std::endl; delete cie; throw std::runtime_error(ss.str()); } cie->augmentationDataPresent = false; uint64_t augmentationDataLength, augmentationDataEnd; cie->lsdaEncoding = cie->ptrEncoding = 0xff; for (const char* augP = cie->augmentationString; *augP; augP++) { switch (*augP) { case 'z': cie->augmentationDataPresent = true; augmentationDataLength = reader.readULEB128(); augmentationDataEnd = reader.pos() + augmentationDataLength; break; case 'L': cie->lsdaEncoding = reader.read(); break; case 'R': cie->ptrEncoding = reader.read(); break; case 'P': { uint8_t persEncoding = reader.read(); cie->personality = reader.readDwarfPointer(persEncoding); break; } case 'S': break; default: { std::stringstream ss; ss << "Unsupported character in CIE augmentation string: " << *augP; delete cie; throw std::runtime_error(ss.str()); } } } reader.moveTo(augmentationDataEnd); uint64_t instructionsLength = endPos - reader.pos(); const uint8_t* data = reinterpret_cast<const uint8_t*>(reader.readBlock(instructionsLength)); cie->instructions.assign(data, data+instructionsLength); m_cies.push_back(cie); m_ciePositions[location] = cie; LOG << "Loaded a CIE at " << std::hex << location << std::dec << std::endl; }