Debugging Remote Applications with Eclipse

From wiki.emacinc.com
Revision as of 08:03, 29 May 2013 by Tstratman (talk | contribs) (created and added initial content)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The EMAC Eclipse distribution is pre-configured with remote debug support provided by the Debug Perspective. This eliminates the need to learn GDB's command-line when a program needs to be debugged. Remote debug support is facilitated by gdbserver on the remote machine. The following guide will provide an introduction to the use of the Eclipse Debug Perspective to step through code in a multi-threaded C/C++ application compiled for an EMAC OE product. For a general introduction to debugging and to gain a better understanding of GDB, refer to the EMAC OE SDK Debug Guide.

Introduction

This Eclipse Guide will use the pthread_demo EMAC OE SDK example project to provide instructions for the following debug tasks:

  1. Debug Configuration Setup
  2. Start a Debug Session
  3. Add Breakpoints
  4. Switch Between Threads
  5. Enable Scheduler-Locking Using the GDB Console
  6. Step Through Code
  7. Other Debug Tools

These lessons assume that the user has just finished editing a C source file called pthread_demo.c from the EMAC OE SDK example projects. They expose the basic debugging capability provided by the Eclipse Debug perspective, but are not intended to be a comprehensive guide to debugging in Eclipse. More information is provided by the C/C++ Development Tools plugin through a help menu. To access CDT debugging help, do the following:

  1. Click Help -> Help Contents
  2. In the Help -> Eclipse Dialog window, select C/C++ Development User Guide -> Tasks -> Running and debugging projects -> Debugging.

Debug Configuration Setup

Before switching to the Eclipse Debug Perspective, it is necessary to set up a Debug configuration that specifies the EMAC OE SDK version of GDB as the debugger. This is important because the remote target's CPU architecture must be taken into account by the debugger since each EMAC OE SDK is configured specifically for its particular target board.