| 631 | } |
| 632 | |
| 633 | std::string Debugger::GetFile(lua_Debug *ar) const { |
| 634 | if (!currentL) { |
| 635 | return ""; |
| 636 | } |
| 637 | |
| 638 | auto L = currentL; |
| 639 | |
| 640 | const char *file = getDebugSource(ar); |
| 641 | if (getDebugCurrentLine(ar) < 0) |
| 642 | return file; |
| 643 | if (strlen(file) > 0 && file[0] == '@') |
| 644 | file++; |
| 645 | lua_pushcclosure(L, FixPath, 0); |
| 646 | lua_pushstring(L, file); |
| 647 | const int result = lua_pcall(L, 1, 1, 0); |
| 648 | if (result == LUA_OK) { |
| 649 | const auto p = lua_tostring(L, -1); |
| 650 | lua_pop(L, 1); |
| 651 | if (p) { |
| 652 | return p; |
| 653 | } |
| 654 | } |
| 655 | // todo: handle error |
| 656 | return file; |
| 657 | } |
| 658 | |
| 659 | void Debugger::HandleBreak() { |
| 660 | // to be on the safe side, hook it again |
nothing calls this directly
no test coverage detected