| 634 | } // namespace |
| 635 | |
| 636 | extern "C" void gdb_on_attach(bool attached) |
| 637 | { |
| 638 | debug_i("GdbAttach(%d)", attached); |
| 639 | if(attached) { |
| 640 | // Open a log file on the host to demonstrate use of GdbFileStream |
| 641 | logFile.open(F(LOG_FILENAME), File::WriteOnly | File::Create); |
| 642 | debug_i("open log %d", logFile.getLastError()); |
| 643 | logFile.println(); |
| 644 | |
| 645 | logFile.println(_F("\r\n=== OPENED ===")); |
| 646 | gdb_timeval_t tv; |
| 647 | gdb_syscall_gettimeofday(&tv, nullptr); |
| 648 | logFile.println(DateTime(tv.tv_sec).toFullDateTimeString()); |
| 649 | |
| 650 | // Start interacting with GDB |
| 651 | if(!consoleOffRequested) { |
| 652 | readConsole(); |
| 653 | } |
| 654 | } else { |
| 655 | // Note: GDB is already detached so underlying call to gdb_syscall_close() will fail silently |
| 656 | logFile.close(); |
| 657 | } |
| 658 | } |
| 659 | |
| 660 | void GDB_IRAM_ATTR init() |
| 661 | { |
nothing calls this directly
no test coverage detected