GDB调试 hello world, 代码卡在 rtlt.c lookup_doit()

Viewed 65

问题描述


已经在main() 设了断点,但是运行不到就卡住了

硬件板卡


CANMV_K230 _LP4 V3.0

软件版本


CanMV-K230_sdcard_v1.6_nncase_v2.8.3

5 Answers

我一般是直接使用k230 linux系统的gdb 调试linux用户态程序(完全不使用cklink),
cklink我只用它调试linux内核态程序和kernel前面的程序,并且使用的是hbreak设置断点。

我在sdk里面搜不到lookup_doit 函数,请补充下操作步骤,你调试的是rtsmart的用户态程序吗?建议使用hbreak设置硬件断点。

是LINUX下运行的。生成的elf文件复制到目标板后能运行
(gdb) target remote 192.168.110.20:1025
Remote debugging using 192.168.110.20:1025
Reading symbols from /opt/toolchain/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.0/sysroot/lib/ld-linux-riscv64xthead-lp64d.so.1...
0x000000000000015a in _start ()
from /opt/toolchain/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.0/sysroot/lib/ld-linux-riscv64xthead-lp64d.so.1
(gdb) l
12
13 /*
14 * Demonstrate how to print a greeting message on standard output
15 * and exit.
16 *
17 * WARNING: This is a build-only project. Do not try to run it on a
18 * physical board, since it lacks the device specific startup.
19 *
20 * If semihosting is not available, use --specs=nosys.specs during link.
21 */
(gdb)
22
23 int
24 main(void)
25 {
26 int i=0;
27 long l=0;
28 do{
29 if(i%2==0)
30 l=l+i;
31 }
(gdb)
32 while(i++<1000);
33 return 0;
34
35 }
(gdb)
(gdb) break main
Breakpoint 1 at 0x1045c: file ../src/main.c, line 26.
(gdb) break main
Breakpoint 1 at 0x1045c: file ../src/main.c, line 26.
(gdb) c
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x000000000000015a in _start ()
from /opt/toolchain/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.0/sysroot/lib/ld-linux-riscv64xthead-lp64d.so.1
(gdb) c
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x000000000000015a in _start ()
from /opt/toolchain/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.0/sysroot/lib/ld-linux-riscv64xthead-lp64d.so.1

这次卡在 start()
这个用平头哥的CDK 连 CKLINK 能跑

上面的代码是平头哥的,最近在试调试功能,有一点乱, 平头哥,eclipse ,命令行都有。平头哥的有include 就不行,调试功能可以,应该是环境路径问题。eclipse 能编译不能调试,用GDB命令行调试也没走通,不知道是不是地址问题

开发环境真的是一言难尽,以前用vscode套件做 ESP32的时候,还抱怨过环境不好用,和K230比较一下,简直好到了天上。野火鲁班猫 RK3576 ,和K230 套件只有几十元差价,越来越想弃坑了。芯片很早就出来了,例程代码如果能整理一下用成VSCODE 模式就好了,开发板自带的 GDB我也没找到,可能要重新部署。