Setting up IDE for debugging

Hi
I am pretty new to arduino, but I have some background experience in programming even though it has been many years since I wrote my last line of code.
I have been struggling quite a lot reading guides on how to get debugging working (with breakpoints and stuff) in eclipse with all possible arduino plugins, but after several days of trials I would like to ask the community how do they debug (besides old school writing data to serial port). The closest I got to have it working is with Sloeber, but I believe I am downloading packages (gcc, g++, gdb, etc) in MinGW that later don't talk too well with eclipse. Unfortunately following the guides and screenshots is getting confusing because they are not up to date with the latest releases, so options in the configuration are slightly different.
Any help will be greatly appreciated.
Thanks

Old School here, I am afraid. Using the Arduino IDE, Serial.print() and sometimes flashing LEDs to indicate program status. Making use of functions allows portions of code to be tested in isolation and using a shield with switches, LEDs, a pot and a shift register with a 7 segment display makes it easy to test simple ideas before they are incorporated into larger programs.

I have briefly looked at other IDEs but for my needs I could not be bothered to get into the complexities of setting any of them up.

You will never get a debugger working. The Arduino simply does not have the tools needed.

Typically, when debugging a program, the program and the debugger are running on the same machine. The Arduino, where the program to be debugged runs, can NOT run a debugger, too. It can only run one program. Running the debugger on some other machine is pointless, since the Arduino doesn't understand watchpoints, breakpoints, single stepping, etc.

When I get desperate I hook up an atmel jtagice3 and use atmel studio for debugging. But most of the time, print and pin toggling...

Or an xplained mini 328p board...

I was wondering because I have seen videos of people actually running debug and had working breakpoints. Maybe it is just me that I have always been used to work in Visual Studio where everything was worming smoothly. Speaking of visual studio, there is a free 3rd party plugin for arduino and they say you can debug but you need to purchase the license for that, so technically it can be done.

gohan:
there is a free 3rd party plugin for arduino and they say you can debug but you need to purchase the license for that, so technically it can be done.

"they say" != "technically it can be done"

You would need a debug kernal on the target arduino that would take up a lot of flash and most of the RAM.

http://www.visualmicro.com/post/2012/05/05/Debug-Arduino-Overview.aspx

You tell me, I am no expert at the moment :slight_smile:

PaulS:
You will never get a debugger working. The Arduino simply does not have the tools needed.

Typically, when debugging a program, the program and the debugger are running on the same machine. The Arduino, where the program to be debugged runs, can NOT run a debugger, too. It can only run one program. Running the debugger on some other machine is pointless, since the Arduino doesn't understand watchpoints, breakpoints, single stepping, etc.

That's really surprising..... and completely wrong. Both VisualStudio and AtmelStudio support using gdb for Arduino debugging, if you simply install the visualmicro plug-in from visualmicro.com....

Regards,
Ray L.

How big is the monitor kernel and how much RAM does it take? - I could not find it in the above link.

RayLivingston:
Both VisualStudio and AtmelStudio support using gdb for Arduino debugging, if you simply install the visualmicro plug-in from visualmicro.com....

Regards,
Ray L.

But debug function is the same as per Visual Studio and needs to be purchased, right?

gohan:
But debug function is the same as per Visual Studio and needs to be purchased, right?

VisualStudio and AtmelStudio (which is based on VisualStudio) are both free. gdb is free. The debugger version of visualmicro is cheap (something like $30).

http://www.visualmicro.com/page/User-Guide.aspx?doc=Arduino-gdb-Tutorial.html

Regards,
Ray L.

Are you saying that you can setup visual studio to work (and debug) using gdb?

gohan:
Are you saying that you can setup visual studio to work (and debug) using gdb?

Did you look at the links I posted???

Whoops! The gdb capability is currently limited to the Zero, M0, and LM4F.... However, VisualMicro does have some more limited debugging capability even on AVRs. It supports trace points, and breakpoints, and some other capabilities.

Regards,
Ray L.

I have a Mega2560, so my only option is the VisualMicro with debugging?

Mega2560 supports JTAG, I think that can be used for debugging. Need the right tool to connect to the JTAG pins.

what is the tool you are referring to?

One of the tools Atmel makes/supports, I don't know which one specifically.

Scroll down to Debugger on the Tools tab:

ATMEL Studio and ATMEL-ICE which uses debugWire through a modified Arduino. No kernel required.