コード例 #1
0
ファイル: frame.C プロジェクト: cuviper/dyninst
void Frame::setNameValue() const {
  if (name_val_set == nv_set || name_val_set == nv_err)
    return;
  
  if (!walker) {
    setLastError(err_nosymlookup, "No Walker object was associated with this frame");
    sw_printf("[%s:%u] - Error, No walker found.\n", FILE__, __LINE__);
    name_val_set = nv_err;
    return;
  }
  
  SymbolLookup *lookup = walker->getSymbolLookup();
  if (!lookup) {
    setLastError(err_nosymlookup, "No SymbolLookup object was associated with the Walker");
    sw_printf("[%s:%u] - Error, No symbol lookup found.\n", FILE__, __LINE__);
    name_val_set = nv_err;
    return;
  }
  
  bool result = lookup->lookupAtAddr(getRA(), sym_name, sym_value);
  if (!result) {
    sw_printf("[%s:%u] - Error, returned by lookupAtAddr().\n", FILE__, __LINE__);
    name_val_set = nv_err;
  }
  
  sw_printf("[%s:%u] - Successfully looked up symbol for frame %p\n",
	    FILE__, __LINE__, this);
  
  name_val_set = nv_set;
}
コード例 #2
0
ファイル: frame.C プロジェクト: dyninst/dyninst
void Frame::setNameValue() const {
  if (name_val_set == nv_set || name_val_set == nv_err)
    return;
  
  if (!walker) {
    setLastError(err_nosymlookup, "No Walker object was associated with this frame");
    sw_printf("[%s:%u] - Error, No walker found.\n", FILE__, __LINE__);
    name_val_set = nv_err;
    return;
  }
  
  SymbolLookup *lookup = walker->getSymbolLookup();
  if (!lookup) {
    setLastError(err_nosymlookup, "No SymbolLookup object was associated with the Walker");
    sw_printf("[%s:%u] - Error, No symbol lookup found.\n", FILE__, __LINE__);
    name_val_set = nv_err;
    return;
  }
  // Here we lookup return address minus 1 to handle the following special case:
  //
  // Suppose A calls B and B is a non-returnning function, and the call to B in A
  // is the last instruction of A. Then the compiler may generate code where 
  // another function C is immediately after A. In such case, the return address
  // will be the entry address of C. And if we look up function by the return
  // address, we will get C rather than A. 
  bool result = lookup->lookupAtAddr(getRA() - 1, sym_name, sym_value);
  if (!result) {
    sw_printf("[%s:%u] - Error, returned by lookupAtAddr().\n", FILE__, __LINE__);
    name_val_set = nv_err;
  }
  
  sw_printf("[%s:%u] - Successfully looked up symbol for frame %p\n",
	    FILE__, __LINE__, this);
  
  name_val_set = nv_set;
}