Hi Andreas,
It's encouraging to see your reply.
I'm tring the member methods and factories but they failed.
I put my test code into the function body of
void CDebugger::LineCallback(asIScriptContext *ctx)
since I don't know if the running context is dependent.
You can test line 38 of script.as, this is the method() function of class Test. In this test, the FindNextLineWithCode function will always fail due to the condition failure
scriptData == 0
in FindNextLineWithCode function.
Here is my testing code
int currentLine = ctx->GetLineNumber(0, 0, &file);
if (currentLine == 38)
{
int i = 0; // put a breakpoint here test, line 38 is "void Test::method()"
}
std::cout << "current line: " << currentLine << std::endl;
asIScriptModule* module = engine_->GetModule("script");
if (!module)
return;
// all functions from the object types
std::vector<asIScriptFunction*> allFunctions;
// for each object type
for (size_t i = 0, objectTypeCount = module->GetObjectTypeCount(); i < objectTypeCount; ++i)
{
asITypeInfo* objectType = module->GetObjectTypeByIndex(i);
assert(objectType);
if (!objectType)
continue;
// member methods
for (size_t j = 0, methodCount = objectType->GetMethodCount(); j < methodCount; ++j)
{
asIScriptFunction* func = objectType->GetMethodByIndex(j);
assert(func);
if (func)
{
std::cout << objectType->GetName() << "::" << func->GetName() << std::endl;
allFunctions.push_back(func);
}
}
// factories
for (size_t j = 0, factoryCount = objectType->GetFactoryCount(); j < factoryCount; ++j)
{
asIScriptFunction* func = objectType->GetFactoryByIndex(j);
if (func)
{
std::cout << objectType->GetName() << "::" << func->GetName() << std::endl;
allFunctions.push_back(func);
}
}
}
// check every functions
for (size_t i = 0; i < allFunctions.size(); ++i)
{
asIScriptFunction* func = allFunctions[i];
assert(func);
std::cout << func->GetName();
static int lineNum = 38;
int actualLine = func->FindNextLineWithCode(lineNum);
std::cout << ", line=" << actualLine << std::endl; // *** in my test, actualLine is always -1 ***
}
Cheers!