A typical debug session will begin by downloading code to Flash and then debugging from main() onwards. However, to explore an already running system a debug connection (attach) can be made to the target MCU without affecting the code execution (at least until the user chooses to halt the MCU!).
Note: Source level debug of a running target is only possible if the sources of the project to be attached exactly match the binary code running on the target.
Click the (Debug As) button on the toolbar, then click Debug Configurations from the drop-down menu.
In the left pane of the Debug Configurations dialog box, expand the debugging interface specified in the project settings and click the required launch configuration.
After you click the configuration in the left pane, the configuration settings appear in the right pane grouped in tabs.
PEmicro
Select the Startup tab, then set the ‘Attach to Running Target’ check box as below:
When a debug connection is made, the target will continue running until it is paused.
SEGGER J-Link
Select the Debugger tab, then set the ‘Connect to running target’ check box as below:
Unfortunately, this feature currently not supported.