From 4fe04c323ca55f2111cd5d013b33bee925ebc326 Mon Sep 17 00:00:00 2001 From: igvk <> Date: Sun, 8 Sep 2024 23:46:32 +0300 Subject: [PATCH] scope of sections shouldn't be limited to processSections --- src_cpp/src_pdb/pdb/pdb_creator.cpp | 10 +++++----- src_cpp/src_pdb/pdb/pdb_creator.h | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src_cpp/src_pdb/pdb/pdb_creator.cpp b/src_cpp/src_pdb/pdb/pdb_creator.cpp index 02a31c4..56b0dc9 100644 --- a/src_cpp/src_pdb/pdb/pdb_creator.cpp +++ b/src_cpp/src_pdb/pdb/pdb_creator.cpp @@ -181,19 +181,19 @@ namespace FakePDB::PDB { bool PdbCreator::processSections(Data::DB& ida_db) { auto &DbiBuilder = _pdbBuilder.getDbiBuilder(); + _sections.clear(); // Add Section Map stream. - std::vector sections; for (const auto& segment : ida_db.Segments()) { - sections.push_back(segment.toLLVM()); + _sections.push_back(segment.toLLVM()); } - DbiBuilder.createSectionMap(sections); + DbiBuilder.createSectionMap(_sections); // Add COFF section header stream. auto sectionsTable = llvm::ArrayRef( - reinterpret_cast(sections.data()), - sections.size()*sizeof(llvm::object::coff_section)); + reinterpret_cast(_sections.data()), + _sections.size()*sizeof(llvm::object::coff_section)); if (DbiBuilder.addDbgStream(llvm::pdb::DbgHeaderType::SectionHdr, sectionsTable)) { return false; diff --git a/src_cpp/src_pdb/pdb/pdb_creator.h b/src_cpp/src_pdb/pdb/pdb_creator.h index f177c27..6b32cbc 100644 --- a/src_cpp/src_pdb/pdb/pdb_creator.h +++ b/src_cpp/src_pdb/pdb/pdb_creator.h @@ -50,5 +50,6 @@ namespace FakePDB::PDB { llvm::BumpPtrAllocator _allocator; llvm::pdb::PDBFileBuilder _pdbBuilder; + std::vector _sections; }; }