Jump to content
  • Advertisement

hobbydev

Member
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

106 Neutral

About hobbydev

  • Rank
    Newbie

Personal Information

  • Interests
    |programmer|
  1. hobbydev

    [Debugger] Determine a breakpoint line is valid

    I had a quick test for the way you suggested, it works! Please have a look at class methods and factories and my testing code as my previous reply.       Thank you very much!
  2. hobbydev

    [Debugger] Determine a breakpoint line is valid

    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!
  3. hobbydev

    [Debugger] Determine a breakpoint line is valid

    Hi Andreas, I've tried the approach, and it works well for functions. However, it's not working for ObjectType methods or global variables. (e.g. Test::method() or string g_str = getDefaultString(); of script.as from asrun sample) If there is answer, please let me know. Thank you very much! :ph34r:
  4. hobbydev

    [Debugger] Determine a breakpoint line is valid

    Thank you Andreas! I will have a try! :D
  5. hobbydev

    [Debugger] Determine a breakpoint line is valid

    Is FindNextLineWithCode of a function still avaible even the code is not running inside this function?
  6. Hi guys, I would like to know if a breakpoint set on certain line is valid before it actually being hit. I'm currently do some debugging implementation. e.g. user set the breakpoints and after launching the script, some of the invalid breakpoints shown as invalid in the GUI (i.e. they are not inside of any functions). I have studied the official debugger add-on and it has CheckBreakPoint function which checks the breakpoints when the code runs to the line, however, I really want to know if this line is valid or should be moved to some near line BEFORE it gets hit.   Do you have any ideas? Cheers!
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!