static void ccpnode_read(FILE *fd, const ccplt *lt, ccpnode *c) {
  c->cidx         = uint32_read(fd);
  clone_read(fd, &c->generator);
  clone_read(fd, &c->clone);
  c->pidx_begin   = uint32_read(fd);
  c->num_children = lt->pred_num->uniq_sz - c->pidx_begin;
  /* c->num_children = uint64_read(fd); */
  c->children     = malloc(c->num_children * sizeof(class_idx)); 
  assert(c->children != NULL);
  for(class_idx *child_idx = c->children; child_idx < c->children + c->num_children; ++child_idx) {
    *child_idx = uint32_read(fd);
  }
  hashtable_insert(lt->ht, &c->clone, c);
}
Exemple #2
0
uint64
elf_get_value(void* elf, void* ptr, unsigned off32, unsigned size32, unsigned off64, unsigned size64) {
  uint8* base = elf;
  uint8* p = ptr;
  unsigned off, size;
  uint64 ret = 0;
  if(ELF_32(base)) {
    off = off32;
    size = size32;
  } else {
    off = off64;
    size = size64;
  }
  switch(size) {
    case 8: ret = uint64_read((const char*)&p[off]); break;
    case 4: ret = uint32_read((const char*)&p[off]); break;
    case 2: ret = uint16_read((const char*)&p[off]); break;
    case 1: ret = p[off]; break;
  }
  return ret;
}