Page 1 of 1

x64 C (or C++) compiler & debugger for realtime applications

Posted: Sat Dec 21, 2019 9:32 am
by rdos
So, are there any free C / C++ compilers for x64 (long mode) that have a lean libc that is not Posix compliant (and thus not enormous in size and effort to port to a new environment), which comes with a decent source-level debugger for Windows that can run over TCP/IP using a well-documented protocol? I don't need files or stdio, but having good math and possibly signal processing functions would be an advantage.

Re: x64 C (or C++) compiler & debugger for realtime applicat

Posted: Sat Dec 21, 2019 11:07 am
by Octocontrabass
GCC (or Clang) and GDB with your choice of frontend. On Windows, you might need run them with WSL, MSYS2, or Cygwin.

Compilers don't include a C library, that's separate. I'm not familiar with many different C libraries, but newlib looks like it has pretty good math functions. You might also want to check the list of C libraries here if you haven't already.

Re: x64 C (or C++) compiler & debugger for realtime applicat

Posted: Sat Dec 21, 2019 12:34 pm
by rdos
Octocontrabass wrote:GCC (or Clang) and GDB with your choice of frontend. On Windows, you might need run them with WSL, MSYS2, or Cygwin.

Compilers don't include a C library, that's separate. I'm not familiar with many different C libraries, but newlib looks like it has pretty good math functions. You might also want to check the list of C libraries here if you haven't already.
I've looked at GDB before, but it requires autoconf, building crosscompilers and a lot of other stuff too. I obviously cannot build gdbserver on RDOS since I cannot handle autoconf, and RDOS target is not supported in the GNU toolchain. This is the hopelessly difficult path that I rather not go down. Also note that Windows is not supported, and so you must use Cygwin, which cannot run the debugger in graphics mode.

There has to be a better solution than this....

Re: x64 C (or C++) compiler & debugger for realtime applicat

Posted: Sun Dec 22, 2019 4:09 am
by Octocontrabass
rdos wrote:I've looked at GDB before, but it requires autoconf, building crosscompilers and a lot of other stuff too.
This isn't difficult in WSL. It can be a bit more of a challenge in MSYS2 or Cygwin, since you may need to use patched tools.
rdos wrote:I obviously cannot build gdbserver on RDOS since I cannot handle autoconf, and RDOS target is not supported in the GNU toolchain.
The GDB protocol is well-defined, so you can make your own gdbserver replacement. Or, you could port a GDB stub, but those are designed for kernel and embedded debugging, so you'd need to make some modifications if you want to use it in ring 3.
rdos wrote:Also note that Windows is not supported, and so you must use Cygwin, which cannot run the debugger in graphics mode.
The very first frontend on the list from earlier (gdbgui) is browser-based, so GDB itself can run in Cygwin while you use a native browser.

Re: x64 C (or C++) compiler & debugger for realtime applicat

Posted: Sun Dec 22, 2019 5:45 am
by rdos
Octocontrabass wrote:
rdos wrote:I've looked at GDB before, but it requires autoconf, building crosscompilers and a lot of other stuff too.
This isn't difficult in WSL. It can be a bit more of a challenge in MSYS2 or Cygwin, since you may need to use patched tools.
rdos wrote:I obviously cannot build gdbserver on RDOS since I cannot handle autoconf, and RDOS target is not supported in the GNU toolchain.
The GDB protocol is well-defined, so you can make your own gdbserver replacement. Or, you could port a GDB stub, but those are designed for kernel and embedded debugging, so you'd need to make some modifications if you want to use it in ring 3.
rdos wrote:Also note that Windows is not supported, and so you must use Cygwin, which cannot run the debugger in graphics mode.
The very first frontend on the list from earlier (gdbgui) is browser-based, so GDB itself can run in Cygwin while you use a native browser.
That's a bit interesting. So then the primary issue becomes if I can compile & build a binary that is OS independent and then debug it in an "embedded" target with gdbgui? I suppose newlib for an embedded system can fix that, but the GNU environment requires specific targets that are implemented in all the tools. Maybe there is an embedded target that fulfills that?

Re: x64 C (or C++) compiler & debugger for realtime applicat

Posted: Wed Jan 22, 2020 11:00 am
by lmemsm
rdos wrote:
Octocontrabass wrote:GCC (or Clang) and GDB with your choice of frontend. On Windows, you might need run them with WSL, MSYS2, or Cygwin.

Compilers don't include a C library, that's separate. I'm not familiar with many different C libraries, but newlib looks like it has pretty good math functions. You might also want to check the list of C libraries here if you haven't already.
I've looked at GDB before, but it requires autoconf, building crosscompilers and a lot of other stuff too. I obviously cannot build gdbserver on RDOS since I cannot handle autoconf, and RDOS target is not supported in the GNU toolchain. This is the hopelessly difficult path that I rather not go down. Also note that Windows is not supported, and so you must use Cygwin, which cannot run the debugger in graphics mode.

There has to be a better solution than this....

This may not be useful, but I've built gdb on Windows (native not Cygwin) and on DOS with djgpp (older version of gcc/gdb). I built gdb with pdcurses so that the Text User Interface is available for a GUI (on Windows or DOS). I also investigated the possibility of running gdb with fldev at one point. (FLTK can be built using nano-x which can port to a wide variety of platforms including DOS.) If a configure file is already generated, you usually don't need autoconf, just bash and whatever tools the configure file needs. I've run across some older versions of gcc/gdb that can be built with just a makefile. I've also used CDetect on some projects to replace autoconf. It's not a one for one replacement, but I can usually code something in a day or two that does the same thing configure would do for a project and then autoconf and automake are no longer needed.

Re: x64 C (or C++) compiler & debugger for realtime applicat

Posted: Wed Jan 22, 2020 12:36 pm
by bzt
rdos wrote:I obviously cannot build gdbserver on RDOS since I cannot handle autoconf, and RDOS target is not supported in the GNU toolchain. This is the hopelessly difficult path that I rather not go down.
Well, if it's enough to debug RDOS running in a VM, then there's an easy way out: qemu has a built-in gdbserver, ready to use, no modification needed on your part. Just add "-S -s" to the command line.

For debugging on real hardware, you can implement your own version of gdbserver. It's not that difficult, but definitely not a beginner level task. I think you can cope. This documentation will be useful: Writing a GDB Remote Serial Protocol server.
rdos wrote:Also note that Windows is not supported, and so you must use Cygwin, which cannot run the debugger in graphics mode.
There's a native Windows version wingdb, but it's not free. Why do you need graphics mode anyway? GDB TUI is pretty neat. But if you insist, you could give a try to gdbgui, which is written in Python, so there should be no problem running it under Windows. If everything else fails, I'm sure you can compile GDB with a GUI using MINGW which creates a native Windows app. You might need a Windows X11 server like Xming, but that's the worst case scenario.

(Note I haven't used these software, so I'm just suggesting to try them out. I don't want to imply any of them can fulfill your needs, just maybe. I've used Xming 10 years ago or so, there might be a better alternative. It was working great back then.)

Cheers,
bzt