This describes how to debug an application that is already running continuously, by attaching a debugger to the target using STWorkbench.
STLinux userspace applications have no intrinsic links to specific target boards, therefore this is applicable to any supported board. However, the following host and target features must be available.
Click File > New > Project.... The New Project window appears.
Select C > C Project from the Wizards tree/list and click Next. The C Project dialog appears.
Enter 'HelloWorld' into the Project name text box
Select Executable from the Project types list
Select ST40 Linux GCC from the Toolchain list.
Click Finish. If a confirmation appears, click Yes.
Select HelloWorld from the STWorkbench Navigator window.
Click File > New > File. The New File window appears.
Enter 'hello1.c' into the File name text box and click Finish.
Copy the following into the editor.
#include <stdio.h> int main() { while (1) { printf("Hello world\n"); } return 0; }
If the console output is not displayed automatically, select HelloWorld from the STWorkbench Navigator window.
Run the application.
Select HelloWorld from the STWorkbench Navigator window.
Click Run > Debug.... The Create, manage, and run configurations window appears.

From the Configurations list, select STLinux Attach to Target Application and click New. A HelloWorld configuration is automatically created from the selected project.
Select the Debugger tab.
Check that ST40 Linux GDB Debugger or ST200 Linux GDB Debugger is selected in the Debugger list.
Enter the name or IP address of the target board into the Target name or IP address text box.
Click Debug.
Select a process (PID) to attach to. A process is highlighted if it has the same name as the executable.
The debugger attaches to the application and suspends execution. The Debug view points where the target has stopped.
To quickly return execution to main(), set a breakpoint on the printf line, then select Run > Resume.