-
Notifications
You must be signed in to change notification settings - Fork 35
Debugging Epiphany
(Work in progress)
Start e-server in one terminal.
$ e-server --multiprocess
In a second terminal we start a host program:
Let's use e-prime from epiphany-examples for this tutorial.
Build the e-prime:
$ cd ~/epiphany-examples/apps/e-prime
$ git pull
$ ./build.sh
Start the program. EHAL_GDBSERVER
will make e-hal
start any epiphany program in a halted debug mode. This is useful if you want to be able to debug a program from the beginning.
$ EHAL_GDBSERVER=yes ./run.sh
You will notice that e-prime reports 0 primes factored / s. This is because the epiphany cores are not running yet, because of EHAL_GDBSERVER
. The next step is to attach with the e-gdb client and start debugging.
In a third terminal, start e-gdb
. You can either do this on your parallella or on your local computer if you have esdk-2016.11.x86_64 installed.
$ cd ~/epiphany-examples/apps/e-prime
$ epiphany-elf-gdb e_prime.elf
Enable non-stop mode. This must to be done before connecting to e-server. We also need to disable pagination as it breaks non-stop.
(gdb) set pagination off
(gdb) set non-stop on
Connect to the e-server. You'll need to adjust localhost
to parallella.local.
if you use e-gdb from your local computer.
(gdb) target extended-remote localhost:51000
List processes:
(gdb) info os processes
Attach to the default process (workgroup). The default process contains all cores that have not yet been manually assigned to a workgroup. To create a new process, use the monitor workgroup
command. The syntax is monitor workgroup [ROW0] [COL0] [ROWS] [COLS]
.
(gdb) attach 1
Stop all processes:
(gdb) interrupt -a
Show status for all threads:
(gdb) info threads
Switch to thread 7:
(gdb) thread 7
Print backtrace for current thread:
(gdb) bt
Set a breakpoint (will be applied to all threads):
(gdb) b is_prime
Continue all threads:
(gdb) c -a
Print local variables:
(gdb) info locals
Print function arguments:
(gdb) info args