newRegs[i].I = CPUReadMemory(regs[state->cfaRegister].I +
newRegs[i].I = elfReadMemory(regs[state->cfaRegister].I +
void elfPrintCallChain(u32 address){  int count = 1;  reg_pair regs[15];  reg_pair newRegs[15];  memcpy(&regs[0], &reg[0], sizeof(reg_pair) * 15);    while(count < 20) {    char *addr = elfGetAddressSymbol(address);    if(*addr == 0)      addr = "???";        printf("%08x %s\n", address, addr);        ELFfde *fde = elfGetFde(address);        if(fde == NULL) {      break;    }        ELFFrameState *state = elfGetFrameState(fde, address);        if(!state) {      break;    }        if(state->cfaMode == CFA_REG_OFFSET) {      memcpy(&newRegs[0], &regs[0], sizeof(reg_pair) * 15);            u32 addr = 0;      for(int i = 0; i < 15; i++) {        ELFFrameStateRegister *r = &state->registers.          regs[i];                switch(r->mode) {        case REG_NOT_SET:          newRegs[i].I = regs[i].I;          break;        case REG_OFFSET:          newRegs[i].I = CPUReadMemory(regs[state->cfaRegister].I +                                       state->cfaOffset +                                       r->offset);          break;        case REG_REGISTER:          newRegs[i].I = regs[r->reg].I;          break;        default:          printf("Unknown register mode: %d\n", r->mode);          break;        }      }      memcpy(regs, newRegs, sizeof(reg_pair)*15);      addr = newRegs[14].I;      addr &= 0xfffffffe;      address = addr;      count++;    } else {      printf("CFA not set\n");      break;    }    if(state->registers.previous) {      ELFFrameStateRegisters *prev = state->registers.previous;      while(prev) {        ELFFrameStateRegisters *p = prev->previous;        free(prev);        prev = p;      }    }    free(state);  }}