3 ms·
Something like this is already supported by the GDB "remote" protocol: https://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.html https://sourceware.org/gd
by jburgess777 9y ago
Something like this is already supported by the GDB "remote" protocol:
https://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.html https://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.ht...
In your program you would probably need to link in some code to implement the protocol, like the GDB remote stub:
https://sourceware.org/gdb/onlinedocs/gdb/Remote-Stub.html https://sourceware.org/gdb/onlinedocs/gdb/Remote-Stub.html
Qemu and Valgrind both implement their own gdb stubs.
For ARM targets, there is a similar feature named "semihosting":
http://www.keil.com/support/man/docs/armcc/armcc_pge1358787046598.htm http://www.keil.com/support/man/docs/armcc/armcc_pge13587870...
- kazinator 9y agoSo that's a different approach: integrate a remote debugging GDB server into the program (could be a shared lib that is dlopen-ed, by the way). Then that server is always used, even in a local session. The server is deeply integrated into the program, taking advantage of the protocol to communicate between application code and the debugging client. It sounds promising. A particularly interesting area is events: https://sourceware.org/gdb/onlinedocs/gdb/Notification-Packets.html#Notification-Packets https://sourceware.org/gdb/onlinedocs/gdb/Notification-Packe... The program could generate custom notifications.