MCPcopy Create free account
hub / github.com/DFHack/dfhack / find_child_hosts

Method find_child_hosts

library/VTableInterpose.cpp:343–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341}
342
343bool VMethodInterposeLinkBase::find_child_hosts(const virtual_identity *cur, void *vmptr)
344{
345 auto &children = cur->getChildren();
346 bool found = false;
347
348 for (const auto& child_ : children) {
349 auto child = dynamic_cast<const virtual_identity*>(child_);
350
351 if (!child) continue;
352
353 auto base = get_first_interpose(child);
354
355 if (base)
356 {
357 assert(base->prev == NULL);
358
359 if (base->saved_chain != vmptr)
360 continue;
361
362 child_next.insert(base);
363 found = true;
364 }
365 else if (child->vtable_ptr())
366 {
367 void *cptr = child->get_vmethod_ptr(vmethod_idx);
368 if (cptr != vmptr)
369 continue;
370
371 child_hosts.insert(child);
372 found = true;
373
374 find_child_hosts(child, vmptr);
375 }
376 else
377 {
378 // If this vtable is not known, but any of the children
379 // have the same vmethod, this one definitely does too
380 if (find_child_hosts(child, vmptr))
381 {
382 child_hosts.insert(child);
383 found = true;
384 }
385 }
386 }
387
388 return found;
389}
390
391void VMethodInterposeLinkBase::on_host_delete(const virtual_identity *from)
392{

Callers

nothing calls this directly

Calls 2

insertMethod · 0.45
get_vmethod_ptrMethod · 0.45

Tested by

no test coverage detected