| 1315 | } |
| 1316 | |
| 1317 | uintptr_t ElfScannerMgr::findRemoteSymbol(const std::string &local_sym_name, uintptr_t local_sym_addr) |
| 1318 | { |
| 1319 | if (!_pMem || local_sym_name.empty() || !local_sym_addr) |
| 1320 | return 0; |
| 1321 | |
| 1322 | ElfScanner r_lib{}; |
| 1323 | KittyMemoryEx::ProcMap l_lib{}; |
| 1324 | |
| 1325 | l_lib = KittyMemoryEx::getAddressMap(getpid(), local_sym_addr); |
| 1326 | if (l_lib.isValid()) |
| 1327 | r_lib = findElf(l_lib.pathname); |
| 1328 | |
| 1329 | if (!r_lib.isValid()) |
| 1330 | { |
| 1331 | KITTY_LOGD("KittyInjector: Failed to find %s, remote lib not found.", local_sym_name.c_str()); |
| 1332 | return 0; |
| 1333 | } |
| 1334 | |
| 1335 | uintptr_t remote_address = r_lib.findSymbol(local_sym_name); |
| 1336 | |
| 1337 | // fallback |
| 1338 | if (!remote_address) |
| 1339 | remote_address = local_sym_addr - l_lib.startAddress + r_lib.base(); |
| 1340 | |
| 1341 | return remote_address; |
| 1342 | } |
| 1343 | |
| 1344 | #ifdef __ANDROID__ |
| 1345 | LinkerScannerMgr::LinkerScannerMgr(IKittyMemOp *pMem, uintptr_t linkerBase) : ElfScanner(pMem, linkerBase) |
no test coverage detected