| 313 | } |
| 314 | |
| 315 | bool CDebugger::InterpretCommand(const string &cmd, asIScriptContext *ctx) |
| 316 | { |
| 317 | if( cmd.length() == 0 ) return true; |
| 318 | |
| 319 | switch( cmd[0] ) |
| 320 | { |
| 321 | case 'c': |
| 322 | m_action = CONTINUE; |
| 323 | break; |
| 324 | |
| 325 | case 's': |
| 326 | m_action = STEP_INTO; |
| 327 | break; |
| 328 | |
| 329 | case 'n': |
| 330 | m_action = STEP_OVER; |
| 331 | m_lastCommandAtStackLevel = ctx ? ctx->GetCallstackSize() : 1; |
| 332 | break; |
| 333 | |
| 334 | case 'o': |
| 335 | m_action = STEP_OUT; |
| 336 | m_lastCommandAtStackLevel = ctx ? ctx->GetCallstackSize() : 0; |
| 337 | break; |
| 338 | |
| 339 | case 'b': |
| 340 | { |
| 341 | // Set break point |
| 342 | size_t p = cmd.find_first_not_of(" \t", 1); |
| 343 | size_t div = cmd.find(':'); |
| 344 | if( div != string::npos && div > 2 && p > 1 ) |
| 345 | { |
| 346 | string file = cmd.substr(2, div-2); |
| 347 | string line = cmd.substr(div+1); |
| 348 | |
| 349 | int nbr = atoi(line.c_str()); |
| 350 | |
| 351 | AddFileBreakPoint(file, nbr); |
| 352 | } |
| 353 | else if( div == string::npos && p != string::npos && p > 1 ) |
| 354 | { |
| 355 | string func = cmd.substr(p); |
| 356 | |
| 357 | AddFuncBreakPoint(func); |
| 358 | } |
| 359 | else |
| 360 | { |
| 361 | Output("Incorrect format for setting break point, expected one of:\n" |
| 362 | " b <file name>:<line number>\n" |
| 363 | " b <function name>\n"); |
| 364 | } |
| 365 | } |
| 366 | // take more commands |
| 367 | return false; |
| 368 | |
| 369 | case 'r': |
| 370 | { |
| 371 | // Remove break point |
| 372 | size_t p = cmd.find_first_not_of(" \t", 1); |