Hi,
I am using Wandboard Dual Rev D1 board. About the Linux software I am using Kernel version 4.14.232 and Ubuntu 20.04 supplied from digi key source. I have cross compiled gdb using the toolchain provided by digi key source.
I have enabled all the config options required for KGDB support in the kernel and flashed to the board.
While using gdb and kgdb to debug kernel some times in the host system it is getting hanged in the gdb command as follows:
$ sudo ./arm-linux-gnueabi-gdb /home/ayyappan/Wandboard/armv7-multiplatform/KERNEL/vmlinux
[sudo] password for ayyappan:
GNU gdb (GDB) 9.1
Copyright (C) 2020 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 "--host=x86_64-linux-gnu --target=arm-linux-gnueabi".
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"...
Reading symbols from /home/ayyappan/Wandboard/armv7-multiplatform/KERNEL/vmlinux...
(gdb) set serial baud 115200
(gdb) set debug remote 1
(gdb) target remote /dev/ttyUSB0
But some times I am able to get through as follows:
> $ sudo ./arm-linux-gnueabi-gdb /home/ayyappan/Wandboard/armv7-multiplatform/KERNEL/vmlinux
> GNU gdb (GDB) 9.1
> Copyright (C) 2020 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 "--host=x86_64-linux-gnu --target=arm-linux-gnueabi".
> 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"...
> Reading symbols from /home/ayyappan/Wandboard/armv7-multiplatform/KERNEL/vmlinux...
> (gdb) set serial baud 115200
> (gdb) target remote /dev/ttyUSB0
> Remote debugging using /dev/ttyUSB0
> Ignoring packet error, continuing...
> warning: unrecognized item "timeout" in "qSupported" response
> Ignoring packet error, continuing...
> Remote replied unexpectedly to 'vMustReplyEmpty': timeout
> (gdb) b panic
> Breakpoint 1 at 0xc003c654: file kernel/panic.c, line 134.
> (gdb) b sys_sync
> Breakpoint 2 at 0xc0196818: file fs/sync.c, line 110.
> (gdb) i b
> Num Type Disp Enb Address What
> 1 breakpoint keep y 0xc003c654 in panic at kernel/panic.c:134
> 2 breakpoint keep y 0xc0196818 in sys_sync at fs/sync.c:110
> (gdb) q
> ayyappan@ayyappan-Inspiron-5559:~/Wandboard/temp/trial/arm-gdb/bin$
In both the cases, before that in target through minicom I am giving these commands
and getting the response in the target as follows:
> Ubuntu 20.04.2 LTS arm ttymxc0
>
> default username:password is [ubuntu:temppwd]
>
> ubuntugin:
> Password:
>
> The programs included with the Ubuntu system are free software;
> the exact distribution terms for each program are described in the
> individual files in /usr/share/doc/*/copyright.
>
> Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
> applicable law.
>
> To run a command as administrator (user "root"), use "sudo <command>".
> See "man sudo_root" for details.
>
> ubuntu@arm:~$ echo ttymxc0 > /sys/module/kgdboc/parameters/kgdboc
> ubuntu@arm:~$ sudo -i
> [sudo] password for ubuntu:
> root@arm:~# echo "1" > /proc/sys/kernel/sysrq
> root@arm:~# echo g > /proc/sysrq-trigger
> [ 125.338165] sysrq: DEBUG
> [ 125.340723] KGDB: Entering KGDB
> [ 125.343897] Internal error: Oops - undefined instruction: 0 [#1] PREEMPT SMP THUMB2
May I know what is the reason for this unstable behaviour in gdb executed in the host.
Note: I have not observed hitting the breakpoint as I dont know as of now how to trigger a breakpoint.
Please help me to fix this unstable behaviour.
Thanks.