Improve logging of vtable interpose errors

develop
lethosor 2016-05-11 17:52:10 -04:00
parent 38051a5a48
commit ed81be16b3
1 changed files with 6 additions and 0 deletions

@ -24,6 +24,7 @@ distribution.
#include "Internal.h"
#include <iostream>
#include <string>
#include <vector>
#include <map>
@ -414,7 +415,11 @@ bool VMethodInterposeLinkBase::apply(bool enable)
if (is_applied())
return true;
if (!host->vtable_ptr)
{
std::cerr << "VMethodInterposeLinkBase::apply(" << enable << "): " << name()
<< ": no vtable pointer: " << host->getName() << endl;
return false;
}
// Retrieve the current vtable entry
VMethodInterposeLinkBase *old_link = host->interpose_list[vmethod_idx];
@ -440,6 +445,7 @@ bool VMethodInterposeLinkBase::apply(bool enable)
}
else if (!host->set_vmethod_ptr(patcher, vmethod_idx, interpose_method))
{
std::cerr << "VMethodInterposeLinkBase::apply(" << enable << "): " << name() << ": set_vmethod_ptr failed" << endl;
set_chain(NULL);
return false;
}