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