News for hackers. Stuff that matters.
Re:GDB 8.1 Released by jburgess777 on Wednesday January 31, 2018 @05:02PM (#16277953)
Something like this is already supported by the GDB "remote" protocol:

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

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_pge13587870...

Re:GDB 8.1 Released by kazinator on Wednesday January 31, 2018 @05:46PM (#16278251)
So 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-Packe...

The program could generate custom notifications.