OSDev.org

The Place to Start for Operating System Developers
It is currently Sun May 24, 2020 7:47 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: x64 C (or C++) compiler & debugger for realtime applications
PostPosted: Sat Dec 21, 2019 9:32 am 
Offline
Member
Member

Joined: Wed Oct 01, 2008 1:55 pm
Posts: 2249
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.


Top
 Profile  
 
 Post subject: Re: x64 C (or C++) compiler & debugger for realtime applicat
PostPosted: Sat Dec 21, 2019 11:07 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 1954
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.


Top
 Profile  
 
 Post subject: Re: x64 C (or C++) compiler & debugger for realtime applicat
PostPosted: Sat Dec 21, 2019 12:34 pm 
Offline
Member
Member

Joined: Wed Oct 01, 2008 1:55 pm
Posts: 2249
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....


Top
 Profile  
 
 Post subject: Re: x64 C (or C++) compiler & debugger for realtime applicat
PostPosted: Sun Dec 22, 2019 4:09 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 1954
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.


Top
 Profile  
 
 Post subject: Re: x64 C (or C++) compiler & debugger for realtime applicat
PostPosted: Sun Dec 22, 2019 5:45 am 
Offline
Member
Member

Joined: Wed Oct 01, 2008 1:55 pm
Posts: 2249
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?


Top
 Profile  
 
 Post subject: Re: x64 C (or C++) compiler & debugger for realtime applicat
PostPosted: Wed Jan 22, 2020 11:00 am 
Offline

Joined: Wed Jul 17, 2019 2:27 pm
Posts: 12
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.


Top
 Profile  
 
 Post subject: Re: x64 C (or C++) compiler & debugger for realtime applicat
PostPosted: Wed Jan 22, 2020 12:36 pm 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 625
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group