Difference between revisions of "EBC Exercise 28 Remote gdb and more"

From eLinux.org
Jump to: navigation, search
m (The Sample Program: make instructions)
m (The Sample Program)
Line 48: Line 48:
 
$ make all install
 
$ make all install
 
</pre>
 
</pre>
This will compile the code and '''scp''' to your Beagle.
+
This will compile the code and '''scp''' to your Beagle. You've just compiled a program that performs a complex fft on random data.  It's main purpose is to see how fast it runs on the Beagle. (In case you are interested, I added to rule so you can compile it for your host computer.  Try '''make x86''' and compare the times on your host to those on the Beagle.)
  
 
== cbrowser/cscope ==
 
== cbrowser/cscope ==

Revision as of 15:36, 9 April 2011


There are many handy tools to know how to use.

gdb

gdb, the GNU Project debugger, allows you to see what is going on inside another program while it executes -- or what another program was doing at the moment it crashed.

gdb can do four main kinds of things to help you catch bugs in the act:

  • Start your program, specifying anything that might affect its behavior.
  • Make your program stop on specified conditions.
  • Examine what has happened, when your program has stopped.
  • Change things in your program, so you can experiment with correcting the effects of one bug and go on to learn about another.

The program being debugged can be written in Ada, C, C++, Objective-C, Pascal (and many other languages). Those programs might be executing on the same machine as GDB (native) or on another machine (remote). GDB can run on most popular UNIX and Microsoft Windows variants.

For our lab we'll be using a C program and do both local execution on the BeagleBoard and remote execution with gdb running on your host and debugging code on your Beagle.

The Sample Program

You can get the sample program from dfs.

$ sftp dfs.rose-hulman.edu
Connecting to dfs.rose-hulman.edu...
yoder@dfs.rose-hulman.edu's password: 
sftp> cd users/y/yoder/shared/beagleboard                                                                            
sftp> get gdbExample.tar.gz
sftp> exit
$ tar xvf gdbExample.tar.gz 
gdbExample/
gdbExample/cfft.c
gdbExample/main_bench.c
gdbExample/changelog
gdbExample/distance.c
gdbExample/cfft.h
gdbExample/README
gdbExample/distance.h
gdbExample/common.h
gdbExample/Makefile
gdbExample/main_cfft.c
$ cd gdbExample
$ gedit Makefile

Edit the Makefile and correct ARM_TOOLCHAIN_PATH for your machine. Also search for install: and fix it for your beagle.

$ make all install

This will compile the code and scp to your Beagle. You've just compiled a program that performs a complex fft on random data. It's main purpose is to see how fast it runs on the Beagle. (In case you are interested, I added to rule so you can compile it for your host computer. Try make x86 and compare the times on your host to those on the Beagle.)

cbrowser/cscope

strace

Binary Utilities

readelf

objdump

strip