Linux Software Developers Kit (SDK) User Guide
66
1
1
2
2
.
.
P
P
r
r
o
o
f
f
i
i
l
l
i
i
n
n
g
g
&
&
D
D
e
e
b
b
u
u
g
g
g
g
i
i
n
n
g
g
Introduction
Various tools are provided in Linux for profiling system performance and debugging applications.
These include utilities for symbolic debugging, logging, and tracking of cpu, memory, network,
and file system usage. Descriptions of many of these programs are provided below.
gdbserver
The gdbserver program can be installed on the target to aid in debugging. To compile and install
gdbserver, enable the CONFIG_USER_GDBSERVER_GDBSERVER option in
linux/vendors/Lantronix/<platform>/config.vendor-2.6.x (or use 'make menuconfig'), and then
rebuild µClinux with "make distclean" followed by "make" from the installation directory.
To start debugging an application on the target, enter the following at the Linux shell prompt:
gdbserver :<tcp_port> <app_path> <app_args>
This will make gdbserver wait on port <tcp_port> for a gdb session of the desired application.
Each application built in µClinux has an associated <app_name>.gdb file in its build directory
(typically linux/user/<app_name>). You must use the gdb executable that is compiled for the
Coldfire architecture. Under <install_directory>/toolchains/freescale-coldfire-4.3/bin/ you will find
m68k-µClinux-gdb.
To connect to the gdbserver running on the target perform the following from your host system.
m68k-µClinux-gdb <app_path>/<app_name>.gdb
target remote <target_ip>:<tcp_port>
Perform gdb commands (e.g. set breakpoints, print variables, step through the code, ...). Refer to
a gdb manual for details.
Note that by default µClinux applications are compiled with space optimization on. This
optimization can make debugging with gdb more difficult.
To disable space optimization comment out (prefix with a '#') the following line from
<install_dir>/linux/config/config.make:
COMMON_CFLAGS_OPTIMIZE = -0s
syslog
The syslog daemon is responsible for recording log messages. The Lantronix SDK uses the
syslogd functionality provided by busybox. By default the target will write syslog messages in the
/var ramdisk partion to /var/log/messages. While syslog is useful for target development, it may
be best to disable it on production units in order to reduce memory usage.