CDT: So you want me to use which debugger ... ?
Deciphering the CDT debugger alphabet soup.
Bruce Griffith
John Cortell (Freescale Semiconductor)
As the developer of an IDE based on CDT, you can choose to support:
The GNU debugger (gdb)
The Eclipse Debugger for C/C++ (EDC)
Debug Services Framework (DSF)
Target Communication Framework (TCF) agents
How do you decide which ones are right for your application?
This talk will present a guide describing how the current choices for remote debugging work together (or don’t) and a consumer’s view of the advantages of some of the possible combinations.
EclipseCon 2011: Deciphering the CDT debugger alphabet soup
1. So you want me to use which debugger ... ?
Deciphering the CDT debugger alphabet soup
Bruce Griffith John Cortell
Partner Senior Software Engineer
Sage Electronic Engineering, LLC Freescale Semiconductor
Bruce.Griffith@se-eng.com
2. What does a debugger need to do?
1. Launch new programs
2. Control program execution (run/stop/breakpoint)
3. Read/write hardware registers and memory
4. Interpret stack frames
5. Disassemble machine instructions
6. Perform symbol lookup and translate memory and registers into
program variable values
Additional things a debugger might do:
1. Track remote system status (e.g. process status, CPU utilization)
2. Perform symbol lookup on the remote system (for system calls)
3. Non-stop debug
4. Execution tracing
5. Read/write target flash
6. Edit-and-Continue / code hot-swap
3. Paradigms: Develop-on-Target
Debugger
Application
Application Application
Eclipse IDE with CDT
Desktop Operating System
Hardware Resources
Host / Target Machine
4. Paradigms: kernel debug
JTAG
Applications
Debugger
Debug
Probe
Eclipse IDE
with CDT
Driver Driver Driver
Comm
Comm Operating System
(559) 272-0900
Debug
“stub” Initial Program Loader (IPL)
Desktop Operating System
Debug
Hardware Resources Logic Hardware Resources
(Hardware)
Host Machine Target Machine
5. Paradigms: Remote Application Debug
Application
Debugger
Application
Eclipse IDE
with CDT
Comm Debug “stub”
Comm
Network
Desktop Operating System RTOS
Hardware Resources
Host Machine Target Machine
9. Summary
CDI-GDB DSF-GDB DSF-EDC-TCF TCF-debug
Debug Model Standard Flexible Hierarchy Flexible Hierarchy Flexible Hierarchy
Status of Reference
Not Active Mature Active Development Incubation
Implementation
Multi-core / Multi-process
None Under Development Designed In
Extensions
EDC
Debugger Backend gdb gdb TCF Agent(s)
TCF Agent(s)
Communications Handler gdb gdb TCF TCF
Java Java Java (TCF) Java (TCF)
Source Language
(+GNU components) (+GNU components) C (TCF Agents) C (TCF Agents)
Anything gdb Anything gdb gdbserver, x86,
Existing Target Support Windows, LINUX
supports supports ARM
Symbol Support DWARF DWARF DWARF DWARF, PDB
11. Some Definitions ...
host: debugger: (the definition for this talk)
The system used to compile, A piece of software that abstracts
assemble, and link a program. The access to the resources used by a
user interface to control symbolic target program and controls target
debug often runs on a host. program flow.
target or debuggee: In more concrete terms:
The system where the compiled • provides access to registers and
program will run. For desktop memory used by the debuggee
application programs, the host and • manipulates hardware and
target are usually the same software breakpoints and allow
system. For embedded systems, user to start/stop debuggee
the host and target are frequently • Performs symbol lookup for
different physical machines. symbolic names
• Perform instruction
disassembly
12. Definitions (cont.)
gdb: CDI: (C/C++ Debugger Interface)
A command-line debugger Serializes communications between
developed by the GNU Project. gdb Eclipse debug windows and
supports several target architectures gdb. Uses a fixed information
(e.g. ARM variants, PowerPC, x86, hierarchy.
etc.).
DSF: (Device Services Framework)
gdbserver (or stub): Synchronizes communications
A piece of gdb that runs on the target between Eclipse debug windows and
to interact with the target hardware gdb. Uses flexible hierarchy.
and OS. Allows gdb to debug a
remote target. TCF: (Target Communication Framework)
Abstracts communications, can be
EDC: (Eclipse Debugger for C/C++) used to make multiple virtual
Part of the Eclipse CDT project. A connections between host and target
lightweight debugger that exploits (e.g. proprietary debugger
DSF for message synchronization connection plus virtualized Ethernet
and uses TCF for target plus virtualized monitor).
communication.
13. CDI: C Debugger Interface
(CDI-GDB is the default C debugger implementation for CDT through Galileo)
"The CDI is a Java™-based • New development has ceased, but
Application Programming Interface reference implementations are mature
(API) whose classes and interfaces and production-ready.
make it possible to access the CDT's • Serializes debugger access to ensure
debugging framework. An Eclipse that responses remain associated with
plug-in that uses the CDI can add new the proper debugger commands.
debuggers to the CDT's operation and • Uses a fixed hierarchy:
display the debugging results in the ILauch =>
IDebugTarget =>
Eclipse/CDT debug perspective." IProcess =>
IThread =>
• CDI provides a standard programming IStackFrame
interface for Eclipse CDT views to • Events cause all debug views to
access a custom debugger. CDI-GDB update
provides a reference implementation
using gdb.
14. DSF: Debugger Services Framework
"Debugger Services Framework (DSF) • Currently the default debugger
is an API for integrating a debugger framework for CDT. The existing
with Eclipse's standard debugger reference implementation for gdb is
views. It is an alternative to Platform's mature and production-ready.
standard debug model and it • Uses a concurrency model to ensure
leverages debugger views' flexible that responses remain associated with
hierarchy API which was introduced in the proper debugger commands
Eclipse 3.2. The main design goal of without serializing requests.
DSF is to allow increased flexibility • Uses a flexible hierarchy for views
and performance in a debugger related to stack frames, threads,
integration." processes, etc.
• DSF-GDB will permit exploitation of
• DSF provides a standard new gdb features such as multi-core /
programming interface for Eclipse multi-process and OpenCL support.
CDT views to access a custom
debugger. DSF-GDB provides a
reference implementation using gdb.
15. TCF: Target Communications Framework
"TCF is a vendor-neutral, lightweight, • Aggregates and virtualizes host-to-
extensible network protocol mainly for target communications into a single
communicating with embedded physical or virtual connection.
systems (targets). Its most • Provides for agent discovery
distinguishing feature is that TCF is • Agents can perform any arbitrary
designed to transparently plug in service.
value-adding servers between the tool • Eliminates the need to dedicate
and the target. But even without value- multiple communications links for
add, the protocol has the potential to target debug, and can "piggyback"
unify lots of currently independent debug communications onto an
communication links, thus saving existing target link.
resources and making setup and
configuration much easier than in
current embedded development
scenarios."
16.
17. gdb: The GNU Debugger
"GDB is a source-level debugger for • Variants for ARM, x86, x86_64,
Ada, C, C++, Objective-C, Pascal and PowerPC, MIPS and several other
many other languages. GDB can processor architectures
target (i.e., debug programs running • Executes on LINUX, UNIX, and
on) more than a dozen different Windows hosts. (Windows
processor architectures, and GDB supported via Cygwin or MinGW)
itself can run on most popular • Debugs applications built for
GNU/Linux, Unix and Microsoft UNIX, LINUX, and Windows
Windows variants." • Supports ELF and PE file format
• Licensed under GPL • Supports DWARF symbols
• Supports C, C++, assembly • Does NOT support Windows PDB
language, FORTRAN, and several symbols
other languages • Emerging multi-process support
• Actively maintained under the Free • Emerging support for numeric
Software Foundation umbrella processing (NVIDIA and ATI
• Can be used to debug local and hardware and OpenCL)
remote applications
18. EDC: The Eclipse Debugger for C/C++
"EDC is a Complete Architecture for • Variants for ARM and x86
C/C++ Debugging in Eclipse/CDT that • Written in Java with agents written
leverages and connects existing in C.
Eclipse debug technology (Platform, • Debugs applications built for
CDT, DSF, TCF). EDC doesn’t require LINUX, Symbian, and Windows
a debug “back-end”. Completely • Supports ELF and PE file format
asynchronous for best performance. • Supports DWARF symbols
Pervasive multi core/context/process • Multi-process support
support. Provides a collection of core • Stack deframing based on
debug services. Uses platform specific dynamic processor modes is
low level debug agents. Reference possible (for example X86 real
implementations for Windows and mode to protected mode)
Linux." • Provides additional high-level
• Licensed under EPL features such as snapshots and
• Supports C and C++ scripting
19.
20. TCF-debug
"This code connects Eclipse Debug • TCF-debug is a debugger
Framework and Target reference implementation that
Communication Framework. It allows demonstrates using TCF agent(s)
to launch Eclipse debug session by as a full-featured debugger.
connecting to a target running TCF • Debugger services are
agent, and then perform basic discovered from within the local
debugging tasks, like resuming, network.
suspending, single-stepping, • Existing stubs are written in C and
setting/removing breakpoints, etc. The available for Windows and LINUX.
code can be used as a reference for The Windows stub can be used
developing new TCF clients." with Microsoft toolchains and
understands Microsoft symbols.
• Existing stubs are focused on
remote application debug and can
integrate with Remote System
Explorer (RSE).
• TCF-debug is in "incubation"