MCPcopy Create free account
hub / github.com/SmingHub/Sming / gdb_on_attach

Function gdb_on_attach

samples/LiveDebug/app/application.cpp:636–658  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

634} // namespace
635
636extern "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
660void GDB_IRAM_ATTR init()
661{

Callers

nothing calls this directly

Calls 9

gdb_syscall_gettimeofdayFunction · 0.85
DateTimeClass · 0.85
readConsoleFunction · 0.85
getLastErrorMethod · 0.80
printlnMethod · 0.80
toFullDateTimeStringMethod · 0.80
FFunction · 0.50
openMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected