SerialDebug icon indicating copy to clipboard operation
SerialDebug copied to clipboard

Moving towards subset of GDB as a serial-line protocol?

Open phrxmd opened this issue 6 years ago • 6 comments

The library is great and does a good job of providing logging and a basic debugger over the serial line. I would love to see this become more full-featured in the future - some other common debugging features might be easy to implement, such as breakpoints.

That said, I think it would be convenient if the command protocol for debugging was following a subset of the GDB protocol (maybe optional using a #define). The GDB protocol is super-simple, based around single-letter commands much similar to what you are already doing now. That way one could reuse the various host development tools made around gdb. Of course it would never be the whole range of everything that gdb does, but even a subset would be useful.

phrxmd avatar Jan 23 '19 12:01 phrxmd

Hi phrxmd, I am glad that you like this. A question: I am use GDB with ESP32, but I always need extra USB hardware, compatible with openocd, how us do it, if the purpose of this libray, is debug wireless ?

I made one library, to improve USB debugging in Arduino, without extra hardware:

https://github.com/JoaoLopesF/SerialDebug

In future, I add this resources to RemoteDebug.

Your help is very good to improve more the RemoteDebug.

Thanks a lot

JoaoLopesF avatar Jan 23 '19 15:01 JoaoLopesF

Hi @JoaoLopesF, and thanks again for your good work! Yeah, I had SerialDebug in mind, that's why I'm commenting here :) RemoteDebug is a different story altogether.

The GDB protocol is just a simple protocol with a basic extensible command set. It's what debugging software uses to interface with OpenOCD. Having GDB access to SerialDebug over the serial link wouldn't give all the low-level access you get with JTAG hardware. But it would allow reusing your existing debugging tools for the basic debugging functions in SerialDebug gets you.

phrxmd avatar Jan 23 '19 18:01 phrxmd

Hi @phrxmd, I will research on it, but I see a problem: map of memory for objects, in ESP32 it is done reading the elf binary file, but how do it without openocd ? And I will implement the debugger of SerialDebug on RemoteDebug. Tks

JoaoLopesF avatar Jan 24 '19 14:01 JoaoLopesF

Hi @JoaoLopesF, I think that's why it's going to be a subset, making available only what is accessible from the program logic itself, but using the same command interface - the GDB protocol is just a set of basic commands in plain text over a serial line and not all of them have to be supported right away.

phrxmd avatar Jan 24 '19 16:01 phrxmd

@phrxmd, You have any sample of GDB working?

JoaoLopesF avatar Jan 24 '19 19:01 JoaoLopesF

@JoaoLopesF sorry for the late reply, it seems like I missed your answer here.

Here are a few samples and tutorials of remote GDB use from various contexts:

There is also a bit of documentation in implementing the server side of the GDB remote server protocol in various OSes:

phrxmd avatar Feb 08 '19 10:02 phrxmd