Moxa KM-2430-T [50/52] On line debugging with gdb

Moxa KM-2430-T [50/52] On line debugging with gdb
ioPAC RTU Software RTU Programming
6-4
On-Line Debugging with GDB
The toolchain also provides an online debugging mechanism to help you develop your program. Before
performing a debugging session, add the option -ggdb to compile the program. A debugging session runs on
a client-server architecture on which the server gdbserver is installed on the ioPAC RTU and the client ddd is
installed in the host computer. We’ll assume that you have uploaded a program named hello_world-debug
to the ioPAC RTU and start to debug the program.
1. Log on to the ioPAC and run the debugging server program.
#gdbserver 192.168.127.254:2000 hello_world-debug
Process hello_world-debug created; pid=38
The debugging server listens for connections at network port 2000 from the network interface
192.168.127.254. The name of the program to be debugged follows these parameters. For a program
requiring arguments, add the arguments behind the program name.
2. In the host computer, change the directory to where the program source resides.
cd /my_work_directory/myfilesystem/testprograms
3. Execute the client program.
#ddd --debugger arm-linux-gdb hello_world-debug &
4. Enter the following command at the GDB, DDD command prompt.
Target remote 192.168.127.5:2000
The command produces a line of output on the target console, similar to the following.
Remote debugging using 192.168.127.5:2000
192.168.127.5 is the host PC’s IP address, and 2000 is the port number. You can now begin debugging in
the host environment using the interface provided by DDD.
5. Set an execution breakpoint by double-clicking, or by entering b main on the command line.
6. Click the cont button.
Library and APIs
For more detailed information about the library and APIs, please refer to the C/C++ Sample Code
Programming Guide for ioPAC RTU Controllers.

Содержание

Скачать