コード例 #1
0
ファイル: IdaFrontend.cpp プロジェクト: Berrrry/snowman
void IdaFrontend::createSections(core::image::Image *image) {
    for (int i = 0; i < get_segm_qty(); i++) {
        segment_t *idaSegment = getnseg(i);

        assert(idaSegment != NULL);

        char segName[MAXSTR];
        ssize_t segNameSize = get_segm_name(idaSegment, segName, sizeof(segName) - 1);
        if(segNameSize < 0) {
            segName[0] = '\0';
        } else if(segNameSize > 0 && segName[0] == '_') {
            segName[0] = '.';
        }

        auto section = std::make_unique<core::image::Section>(
            segName,
            checked_cast<ByteAddr>(idaSegment->startEA),
            checked_cast<ByteSize>(idaSegment->size())
        );

        section->setReadable(idaSegment->perm & SEGPERM_READ);
        section->setWritable(idaSegment->perm & SEGPERM_WRITE);
        section->setExecutable(idaSegment->perm & SEGPERM_EXEC);
        section->setCode(idaSegment->type == SEG_CODE);
        section->setData(idaSegment->type == SEG_DATA);
        section->setBss(idaSegment->type == SEG_BSS);
        section->setAllocated(section->isCode() || section->isData() || section->isBss());
        section->setExternalByteSource(std::make_unique<IdaByteSource>());

        image->addSection(std::move(section));
    }
}
コード例 #2
0
//==============================================================================
AztecDVBR_Matrix::~AztecDVBR_Matrix(){

   if (isAllocated()) {
      delete [] Amat_->val;
      delete [] Amat_->bindx;
      delete [] Amat_->rpntr;
      delete [] Amat_->bpntr;
      delete [] Amat_->indx;

      delete [] remoteInds_;
      delete [] remoteBlockSizes_;

      setAllocated(false);
   }

   if (isLoaded()) {
      free(Amat_->cpntr);
      free(external_);
      free(extern_index_);
      free(update_index_);
      free(data_org_);
      delete [] orderingUpdate_;

      setLoaded(false);
   }

   delete [] nnzPerRow_;
   localNNZ_ = 0;

   AZ_matrix_destroy(&Amat_);
   Amat_ = NULL;
}
コード例 #3
0
//==============================================================================
void AztecDVBR_Matrix::allocate(int* numNzBlks, int* blkColInds) {
//
// This function builds the structure of the matrix. i.e., does the
// memory allocation, etc.
//

   //calculate the bpntr array, which holds info about the number of
   //nonzero blocks per row.
   calcBpntr(numNzBlks);

   //we can now get the total number of nonzero blocks from the last
   //entry in bpntr.
   int totalNumNzBlks = Amat_->bpntr[N_update_];

   //now we can set the bindx array, which holds block column indices.
   setBindx(totalNumNzBlks, blkColInds);

   //and now we're ready to allocate and fill the indx array, which
   //holds info on the number of point entries in each nonzero block.
   calcIndx(totalNumNzBlks);

   //the last thing we need to do is allocate and initialize the val array.
   Amat_->val = new double[localNNZ_];

   for(int i=0; i<localNNZ_; i++) {
      Amat_->val[i] = 0.0;
   }

   setAllocated(true);
   return;
}
コード例 #4
0
ファイル: Block.hpp プロジェクト: DavidGosselin/Allocator
 Metadata(std::size_t length)
 {
   setLength(length);
   setAllocated(false);
 }