Beispiel #1
0
void LLVMGetLineInfoForAddressRange(LLVMObjectFileRef O, uint64_t Address, uint64_t Size, int* OutSize, uint64_t** Out) {
  DIContext* ctx = DIContext::getDWARFContext(*(unwrap(O)->getBinary()));
  DILineInfoTable lineTable = ctx->getLineInfoForAddressRange(Address, Size);
  *OutSize = lineTable.size();
  *Out = NULL;
  if (lineTable.size() > 0) {
    *Out = (uint64_t*) calloc(lineTable.size() * 2, sizeof(uint64_t));
    for (int i = 0; i < lineTable.size(); i++) {
      std::pair<uint64_t, DILineInfo> p = lineTable[i];
      (*Out)[i * 2] = p.first;
      (*Out)[i * 2 + 1] = p.second.Line;
    }
  }
}