Local Debugging

Let's start by compiling and debugging helloworld solely on the host system, tbdev1. The script buildrootfilesystem generates helloworld.c in /root/cross/builds and cross-compiles it for the target system. Let's use that source code file and compile it for the x86 processor using tbdev1. Here are the steps to install gdb and compile and debug helloworld.c for the x86 on tbdev1:

1.
Install gdb on tbdev1:
root@tbdev1[508]: apt-get install gdb
							
2.
Change into the /root/cross/builds directory and compile helloworld.c with the debugging flag -g:
root@tbdev1[509]: cd /root/cross/builds
root@tbdev1[510]: gcc
								-g
								-o helloworld-i386-linux helloworld.c
							
3.
You need to check a couple things. Using the file program, you can determine ...

Get Embedded Linux®: Hardware, Software, and Interfacing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.