...
- Download the ARM64 GDB package from here and save it somewhere.
Unpack the package. This should produce the folders
DEBIAN
,etc
, andusr
.Code Block language bash theme Midnight linenumbers true $ sudo dpkg-deb -R gdb_7.12-6_arm64.deb .
Compress the
etc
andusr
folders. Optionally delete theDEBIAN
,etc
, andusr
folders when you are done.
On a default PetaLinux image,zip
andtar
files are supported.Code Block language bash theme Midnight linenumbers true $ zip -r gdb.zip etc usr
On the guest, copy the compressed file via SCP and extract it.
Code Block language bash theme Midnight linenumbers true root@xilinx-zcu102-20192020_2:~# scp <host user>@<host IP>:/path/to/gdb.zip . root@xilinx-zcu102-20192020_2:~# unzip gdb.zip
On the guest, copy the extracted contents to root.
Code Block language bash theme Midnight linenumbers true root@xilinx-zcu102-20192020_2:~# cp -r etc usr /
Running GDB on the Guest
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
root@xilinx-zcu102-20192020_2:~# scp <host user>@<host IP>:/scratch/proj/gdb-test/segfault.c . <host user>@<host IP>'s password: segfault.c 100% 171 0.2KB/s 00:00 root@xilinx-zcu102-20192020_2:~# scp <host user>@<host IP>:/scratch/proj/gdb-test/segfault.elf . <host user>@<host IP>'s password: segfault.elf 100% 11KB 10.6KB/s 00:00 root@xilinx-zcu102-20192020_2:~# gdb gdb: /lib/libncurses.so.5: no version information available (required by gdb) gdb: /lib/libncurses.so.5: no version information available (required by gdb) gdb: /lib/libncurses.so.5: no version information available (required by gdb) gdb: /lib/libtinfo.so.5: no version information available (required by gdb) GNU gdb (Debian 7.12-6) 7.12.0.20161007-git Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "aarch64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word". (gdb) file segfault.elf Reading symbols from segfault.elf...done. (gdb) r Starting program: /home/root/segfault.elf Program received signal SIGSEGV, Segmentation fault. 0x00000000004005d8 in main () at segfault.c:8 8 *p_null = 0xAA55AA55; (gdb) |
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
Reading symbols from test.elf...done.
(gdb) b main
Breakpoint 1 at 0x4005de: file test.c, line 20.
(gdb) watch global_var & 0x00000003
Hardware watchpoint 2: global_var & 0x00000003
(gdb) r
Starting program: /scratch/gdb-test/test.elf
Breakpoint 1, main () at test.c:20
20 {
(gdb) c
Continuing.
Hardware watchpoint 2: global_var & 0x00000003
Old value = 0
New value = 3
foo (s=0x7fffffffe1c0) at test.c:38
38 if (s->str == NULL) {
(gdb) p/x global_var
$1 = 0xcc33cc33
(gdb) info break
Num Type Disp Enb Address What
1 breakpoint keep y 0x00000000004005de in main at test.c:20
breakpoint already hit 1 time
2 hw watchpoint keep y global_var & 0x00000003
breakpoint already hit 1 time
(gdb) info watch
Num Type Disp Enb Address What
2 hw watchpoint keep y global_var & 0x00000003
breakpoint already hit 1 time
(gdb) d 1
(gdb) d 2
(gdb) info break
No breakpoints or watchpoints.
(gdb)
|
Stepping through your program
...