You are on page 1of 6

TRACE32 as GDB Back-End

TRACE32 Online Help


TRACE32 Directory
TRACE32 Index
TRACE32 Documents ......................................................................................................................

GDB Support ..................................................................................................................................

TRACE32 as GDB Back-End .....................................................................................................

Basic Concepts .......................................................................................................................

Introduction

Operating of the API Requests

Communication Setup ............................................................................................................

Preparing TRACE32 Device Driver

Starting GDB

Supported architectures

Supported GDB Packets

1989-2016 Lauterbach GmbH

TRACE32 as GDB Back-End

TRACE32 as GDB Back-End


Version 24-May-2016

Basic Concepts

Introduction
The TRACE32 Software contains an interface to connect to GDB (or any other application using the Remote
Serial Protocol) via UDP or TCP. TRACE32 implements a gdbserver functionality: it receives commands
from GDB, executes them and sends the response back to GDB.
The command chain using TRACE32 GDB API looks like that:
GDB <-----> TRACE32 display driver <----> TRACE32
(sockets)
(HW interface)

GDB

TCP/IP
Socket
Interface

Ethernet

TCP/IP
Socket
Interface

TRACE32
display driver

Ethernet
Parallel
Fiberoptic

TRACE32
Hardware

The communication to the TRACE32 display driver is implemented as a socket interface. This means, that
GDB and the display driver can reside on two different hosts, using network connections for communication.
The display driver just routes the GDB requests to the TRACE32 Hardware. This interface is the one, you
choose for your emulator. E.g. it could be Ethernet, parallel or optical interface.
The answers for the request go exactly the opposite way, returning information to GDB.

1989-2016 Lauterbach GmbH

TRACE32 as GDB Back-End

Basic Concepts

Operating of the API Requests


The API requests are operated just beside normal TRACE32 operation. You can use both, the TRACE32
window and the API interchangeable, although it is not recommended. GDB won't be informed about
changes that are done with the normal surface. Also, unpredictable errors may occur, if e.g. an API request
and a running practice file interfere.

1989-2016 Lauterbach GmbH

TRACE32 as GDB Back-End

Basic Concepts

Communication Setup

Preparing TRACE32 Device Driver


TRACE32 has to be configured for use with any remote control, such as the GDB API. To configure this type
of remote control, add the following lines to the file config.t32:
GDB=NETASSIST
PACKLEN=1024
PORT=30000
PROTOCOL=TCP

PACKLEN specifies the maximum package length in bytes for the socket communication.
PORT specifies the port number for communication. The default port is 30000. If this port is already in use,
try one higher than 30000.
PROTOCOL specifies the used protocol (TCP or UDP). Default is UDP.

Starting GDB
Start GDB with object file as argument:
C:\>gdb.exe sample.elf

Connect to the TRACE32 display driver using TCP:


(gdb) target remote <ip>:30000

<ip> is the remote ip or 127.0.0.1 if GDB and the TRACE32 display driver are on the same machine.

Supported architectures
The GDB API supports the architectures ARM, ARM64, PowerPC, MIPS32, SH, MicroBlaze, 68K, Intel
x86and Intel x86 64. Other architectures could be supported on request.

1989-2016 Lauterbach GmbH

TRACE32 as GDB Back-End

Communication Setup

Supported GDB Packets


The GDB API supports the following packets defined by the GDB Remote Serial Protocol:

?: Get debugger status. TRACE32 replies with S00 if the debugger is in Down state otherwise with
T packet.

B: insert/remove a software breakpoint.

c, C: Continue. The signal information within the C packet is not used by TRACE32.

d: Toggle debug flag. When debug mode is enable, TRAC32 will print the received/sent packets
in the AREA window.

D: Detach from TRACE32

g: Read general registers.

G: Write general registers (not supported for MIPS5k, please use instead the P packet).

H select the current task.

k: Detach from TRACE32.

m: Read memory.

M: Write memory.

p: Read single register.

P: Write single register.

qC: return the current thread id.

qRcmd: GDB monitor command. TRACE32 defines three types of monitor commands:

1. Help: the debugger returns the string TRACE32

(gdb)

monitor help

2. Execute a TRACE32 command


(gdb) monitor B:: <TRACE32 command>

qfThreadInfo, qsThreadInfo: return the list of active threads

qThreadExtraInfo: Obtain a printable string description of threads attributes.

T: Find out if the thread is alive.

1989-2016 Lauterbach GmbH

TRACE32 as GDB Back-End

Communication Setup

3. Execute a TRACE32 function and get the result


(gdb)

monitor eval <TRACE32 function>

R, r: Reset.

s, S: Single step. The signal information within the S packet is not used by TRACE32.

vCont?: Probe vCont packet. TRACE32 will return vCont;c;C;s;S.

vCont;<action>: Execute a single step / resume execution.

X: Write memory. The data is transmitted in binary.

Z, z: Set/Remove a breakpoint.

1989-2016 Lauterbach GmbH

TRACE32 as GDB Back-End

Communication Setup

You might also like