Goal: debug the project from the previous blog.

Both the Windows and Linux version, from the same Eclipse project on your Windows laptop.

The Windows version as a local program - we're running eclipse on Windows and can debug locally.

The Linux version as a remote application. Our debugger will deploy on a Raspberry Pi, start the program in debug mode and link the Eclipse debugger.

In both scenarios, the effect is the same:

You start a debug session, the debugger halts on the first line of main(). You can step through the code and watch variables. You see output.

I'm using the project from the previous post. I just added some lines so that you can watch variables and see some real output.

 

#include <iostream>
using namespace std;

int main() {
  int i = 5;
  i++;
cout << "i = " << i << "." << endl;
return 0;
}

 

1: a Windows debug session

Select the project. Then go to Run > Debug configurations...

Create a new C/C++ Application configuration.

 

Press Debug.

It's possible that the debugger doesn't find your source file. There's a "Locate source file..." button that you can use to do this manually.

 

That was easy

 

2: a Linux debug session

Select the project. Then go to Run > Debug configurations...

 

Create a new C/C++ Remote Application configuration.

You need to enter a little more information. But in return, the debugger automatically uploads your program to the Pi (or BBB, ...) and makes it executable.

You know you've set up a correct connection, if the Browse... button allows you to navigate to a directory on your Linux box.

 

Set the debugger executable to the one available in your Linaro toolchain. It's the same prefix you use when setting the cross-compile toolchain.

Press Debug.

 

 

That was easy too.

 

In a few not too difficult steps, you get a single project that can be developed on a windows pc, built for Windows and Linux, and debugged in the warm comfort zone of your IDE.

In the next post, I discuss working with .so and .dll 3rd party libraries.

 

 

related blog
Part 1: preview
Part 2: start multi-target project
Part 3: debug on both platforms
Part 4a: link 3rd party library on Linux ARM
Part 4b: link 3rd party library on Windows