Online C compiler and debugger – how to speed up the development of your C code

I’m sure that you encountered with the situation when your code or part of your code didn’t work as you wanted – operation with a few pointers, logic operations, conditions, parsing of value from long array etc.

If you have modern microcontrollers and development board which supports debugger (e.g. STM32 and Nucleo, Discovery) you can easily step (debug) your code in debugger.

If you don’t have debugger, how do you follow values, variables? Are you using UART? Or LCD?

The change of code, compilation, comparison of results, and upload the code takes a much time.

If there is some tools which you help you with development of code faster, you should use that.

I have the best experience with Online C compiler/debugger called OnlineGDB.

Of course, it’s not necesary to use “Online”, you can download Eclipse or other IDE and debug the code there. But, I prefer this OnlineGDB compiler/debugger.

OnlineGDB

The compiler/debugger contains “Run” button. This button runs whole code.

The “Debug” button contains debugging of your code.

The debug can be stopped by “Stop” button.

If you want to share the code to your friends, you can use the “Share” button. You can also save the code by “Save” button.

The Online compiler/debugger OnlineGDB is used only for C, without controling of the peripherals.

So, the OnlineGDB detects a mistake in your code but it can’t control GPIO, I2C and another.

As I mentioned, that’s amazing tool when you have to detect the mistake in your code where you are using parsing of array, pointers, logical operators and conditions.

Btw, the OnlineGDB supports more programming languages like C++, Java, Python, PHP ….

Here is easy example of using:

We have a few variables and we calculate some result.

Click to “Run” for running of your code.

The whole code is run and you see the result in “Input” window.

So, if the behavior of your code is not the same as you expect you can write “printf” behind of each lines and check if the variables have expected value or not.

If you have Arduino, I guess that you will use UART.
Or you use debugger.

Debugger is tool which shows you values in variables, registers during the running of microcontroller.

So you can step the code, it means that you stop on every line of code – “Step over“. If there is function on the line and you want to go on function, you use “Step into” button.

The next opinion is using the breakpoints. That are point where you label the line where the code has to be stopped.

As I mentioned, you can’t copy-paste whole code e.g. from Arduino to this OnlineGDB. That’s not possible to control GPIOs, interfaces or other.

But you can easily debug your part of code where you want to parse of array, use logical operations, conditions and so on.
Home webpage of project: https://www.onlinegdb.com/

How to use debugger in OnlineGDB.


Share the article:
Show your
Maker soul!
Buy a T-Shirt
Coffee for Chiptron
Give a boost to the next article

Related Articles

The development boards are very popular. I decided to share this list. These boards are interesting, popular and cheap (to 30? – by farnell.com). If you click on the picture, you will be redirected in eshop, where you can buy…

Another article about CHIP computer. In this article find speed of USB, WiFi, current consumption (during boot and after boot), log from boot pictures from thermal imager. Articles about CHIP computer: CHIP computer: first sight and comparison with Raspberry Pi…

AVR, ATMega, ATTiny, PIC, Arduino… these are very searching words in google and I asked myself “Why?”. Yes, AVR by Atmel or PIC by Microchip family is popular, but we can program better (modern, faster, more low-power, more peripherals) microcontrollers…

If you program microcontrollers by STM (STM32F4, STM32F0, STM32L1) with Standard Peripheral Library your code is bigger than without Standard Peripheral Library. It is motivation why we can program of microcontrollers without Standard Peripheral Library. Nevertheless, if you program without…

This Orange Pi Zero article will be about how to run WiFi (after boot) for OS armbian. What speed of WiFi and ethernet we can expect. I used speedtest for WiFi and ethernet. USB speed was measured for one big…