Ejemplo n.º 1
0
void check_opnd(opnd_t opnd, void *pc, int read, void *drcontext,
		dr_mcontext_t *mctx, void *prev_pc)
{
  if (opnd_is_memory_reference(opnd) && opnd_is_base_disp(opnd))
    add_hit(pc, opnd_size_in_bytes(opnd_get_size(opnd)),
	    opnd_get_disp(opnd) + (void *)reg_get_value(opnd_get_base(opnd),
						       mctx),
	    read, drcontext, prev_pc);
  else if (opnd_is_memory_reference(opnd) && opnd_get_addr(opnd))
    add_hit(pc, opnd_size_in_bytes(opnd_get_size(opnd)), opnd_get_addr(opnd),
	    read, drcontext, prev_pc);
  // for now no other kind of memory reference was noticed to access heap data
  else if (opnd_is_memory_reference(opnd))
    dr_printf("need to implem other memory ref\n");
}
Ejemplo n.º 2
0
//#############################################################################
double* TrTrackA::PredictionStraightLine(TrRecHitR* phit){
      if (!phit) return NULL;
      TrHitA* myhit = add_hit(phit);
      double* result = PredictionStraightLine(myhit);
      del_hit(myhit);
      return result;
}
Ejemplo n.º 3
0
static tree_struct*
find_in_tree(index_struct *idx, char *suffix, tree_struct *tree)
{
  if(tree == NULL) return NULL;
  
  if(suffix[0] == 0) return tree;
  
  if(tree->tree_type == WORD_TREE){
    
    tree_struct * new_tree = tree->tree_subtrees[ (int) suffix[0]];
    return find_in_tree(idx, suffix+1, new_tree);
  
  } else {
    array_struct * array = (array_struct*) tree;
    
    int nprefixes = array->array_nprefixes;
    int nsuffixes = array->array_nsuffixes;
    int suffix_len = strlen(suffix);
    int i;
    hits_struct *all_hits;    

    nhits = 0;
    
    for(i=0; i<nprefixes; i++){
      char *word = array->array_suffixes[i].suffix_word;
      if(!strncmp(suffix, word, suffix_len)){
        add_hit(array->array_suffixes[i].suffix_num);
      }
    }
    for(i=0; i<nsuffixes; i++){
      char *word = array->array_suffixes[MAX_LINEAR_SEARCH+i].suffix_word;
      if(!strncmp(suffix, word, suffix_len)){
        add_hit(array->array_suffixes[MAX_LINEAR_SEARCH+i].suffix_num);
      }
    }
    if(nhits == 0) return NULL;
    all_hits = index_alloc(sizeof(hits_struct) + sizeof(int) * nhits);
    all_hits->hits_type = WORD_HITS;
    all_hits->hits_nbr = nhits;
    memcpy(all_hits->hits_words, hits, nhits * sizeof(int));
    return (tree_struct*) all_hits;
  }
}
Ejemplo n.º 4
0
//#############################################################################
double* TrTrackA::PredictionStraightLine(double* coo, double* ecoo, double* bfield) {
      TrHitA* myhit = add_hit(coo, ecoo, bfield);
      double* result = PredictionStraightLine(myhit);
      del_hit(myhit);
      return result;
}