Moxa UC-8416-T-LX [55/90] Debugging with gdb

Moxa UC-8410-T-LX [55/90] Debugging with gdb
UC-8410/8416/8418/8430 Programmer's Guide
5-3
For toolchain v3.x:
#export PATH=“/usr/local/arm-linux-4.4.2/bin:$PATH”
#export MANPATH=“/usr/local/arm-linux-4.4.2/man:$MANPATH”
Alternatively, you can add the same commands to $HOME/.bash_profile to cause it to take effect for all login
sessions initiated by this user.
Obtaining help
Use the Linux man utility to obtain help on many of the utilities provided by the tool chain. For example to get
help on the arm-linux-gcc compiler, issue the command:
#man arm-linux-gcc
Cross Compiling Applications and Libraries
To compile a simple C application, just use the cross compiler instead of the regular compiler:
#xscale-linux-gcc –o example –Wall –g –O2 example.c
#xscale-linux-strip –s example
#xscale-linux-gcc -ggdb –o example-debug example.c
Tools Available in the Host Environment
Most of the cross compiler tools are the same as their native compiler counterparts, but with an additional
prefix that specifies the target system. In the case of x86 environments, the prefix is i386-linux- and in the
case of the UC-8410/8416/8418/8430/8430 XScale boards, it is xscale-linux-.
For example, the native C compiler is gcc and the cross C compiler for XScale in the
UC-8410/8416/8418/8430/8430 is xscale-linux-gcc.
The following cross compiler tools are provided:
ar Manages archives (static libraries)
as Assembler
c++, g++ C++ compiler
cpp C preprocessor
gcc C compiler
gdb Debugger
ld Linker
nm Lists symbols from object files
objcopy Copies and translates object files
objdump Displays information about object files
ranlib Generates indexes to archives (static libraries)
readelf Displays information about ELF files
size Lists object file section sizes
strings Prints strings of printable characters from files (usually object files)
strip Removes symbols and sections from object files (usually debugging information)
Debugging with GDB
First use the option -ggdb to compile the program. Use the following steps:
1. To debug a program called hello-debug on the target, use the command:
#gdbserver 192.168.4.142:2000 hello-debug

Содержание

Скачать