gdbserver inside radare2

May 31, 2017

If you’re reading this, I hope you know what GDB (the GNU Debugger) is. If not, do glance through the wikipedia article for a basic idea. GDB is a debugger, which is a piece of software that lets us look at and step through a program while it is running. That helps because the behavious of a running program might be different from what it looks like under static examination, i.e. looking at the executable file. Plus, it also helps figure out subtle bugs in your software, hence the term “debugger”.

Now GDB has a remote debugging mode, where one can run the debugger as a server on the target, connect to it remotely (over ethernet, serial ports, etc.), and issue debugger commands. For this, GDB defines a remote serial protocol (RSP). So, any debugging front-end can implement the client side of this protocol, connect to a gdbserver, and use it for debugging. radare2 has such an implementation of the client-side protocol, atleast a partial one, which already supports all basic commands. There are quite a few bugs in it though, and also features which need to be implemented.

Now my GSoC project is the implementation of a gdbserver inside radare2. So how this works is, radare2 already has its own internal debugger. Now, we want remote instances of debugger clients be able to connect to radare2 using the GDB RSP, and use it as a debugging backend. Plus, this will help in the testing and development of radare2’s own GDB client implementation, by testing them both against each other. I’ll be working on the client too, improving it as the implementation of the server comes along.

I’ve already sent in a few pull requests regarding GDB remote debugging, here and here. There’s still a lot more work to do, though, so I’d better get down to it.