ARM gdb warning: Unable to determine the number of hardware watchpoints available.

(gdb) b *0x40203c
Breakpoint 1 at 0x40203c: file src/pst.c, line 1332.
(gdb) r
Starting program: /data/ac/pst -A
warning: Unable to determine the number of hardware watchpoints available.
warning: Unable to determine the number of hardware breakpoints available.

Breakpoint 1, 0x000000000040203c in main (argc=2, argv=0x7ffffffc28) at src/pstree.c:1332
1332    src/pst.c: No such file or directory.
   0x0000000000402000 <main+0>: fd 7b b9 a9     stp     x29, x30, [sp, #-112]!
   0x0000000000402004 <main+4>: 0d fe 88 d2     mov     x13, #0x47f0                    // #18416
   0x0000000000402008 <main+8>: a2 00 00 f0     adrp    x2, 0x419000 <_IO_stdin_used>
   0x000000000040200c <main+12>:        fd 03 00 91     mov     x29, sp
   0x0000000000402010 <main+16>:        f3 53 01 a9     stp     x19, x20, [sp, #16]
   0x0000000000402014 <main+20>:        42 a0 34 91     add     x2, x2, #0xd28
   0x0000000000402018 <main+24>:        c3 01 00 b0     adrp    x3, 0x43b000
   0x000000000040201c <main+28>:        f5 5b 02 a9     stp     x21, x22, [sp, #32]
   0x0000000000402020 <main+32>:        63 80 37 91     add     x3, x3, #0xde0
   0x0000000000402024 <main+36>:        f4 03 01 aa     mov     x20, x1
   0x0000000000402028 <main+40>:        f7 63 03 a9     stp     x23, x24, [sp, #48]
   0x000000000040202c <main+44>:        41 40 01 91     add     x1, x2, #0x50
   0x0000000000402030 <main+48>:        f3 03 00 2a     mov     w19, w0
   0x0000000000402034 <main+52>:        f9 6b 04 a9     stp     x25, x26, [sp, #64]
   0x0000000000402038 <main+56>:        fb 73 05 a9     stp     x27, x28, [sp, #80]
=> 0x000000000040203c <main+60>:        ff 63 2d cb     sub     sp, sp, x13
   0x0000000000402040 <main+64>:        e2 07 00 f9     str     x2, [sp, #8]
   0x0000000000402044 <main+68>:        02 54 80 d2     mov     x2, #0x2a0                      // #672
   0x0000000000402048 <main+72>:        60 00 40 f9     ldr     x0, [x3]
   0x000000000040204c <main+76>:        e0 f7 23 f9     str     x0, [sp, #18408]
   0x0000000000402050 <main+80>:        00 00 80 d2     mov     x0, #0x0                        // #0
1: $sp = (void *) 0x7ffffffa30

实际的 40203c 的指令如下:

40203c:    97ffff35     bl    401d10 <getopt_long@plt>

第一次注意到这个警告,调试时发现断点位置确实有异样。首先想到了是不是gdb的编译有问题,核查没有问题。再次想到是不是应用程序有问题,重新使用相应平台编译,还是提示此警告。找板子上/bin目录下的应用测试,也是会提示此警告。

可能是重新编译了调试的应用,现使用gdb调试时断点处能与实际指令对上,但此警告还是存在。没有找到此警告的解决办法,能调试就不用管此警告。

(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /data/ac/pst -A
warning: Unable to determine the number of hardware watchpoints available.
warning: Unable to determine the number of hardware breakpoints available.

Breakpoint 3, 0x000000000040203c in ?? ()
=> 0x000000000040203c:  35 ff ff 97     bl      0x401d10 <getopt_long@plt>

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
这个警告是由于 GDB 在使用索引缓存目录时无法确定路径导致的。索引缓存目录用于存储 GDB 索引信息,提高调试时的响应速度。如果无法确定索引缓存目录的路径,GDB 仍然可以正常工作,但可能会影响调试的性能。 要解决这个警告,可以手动设置索引缓存目录的路径。具体的方法如下: 1. 打开 VS Code,选择菜单栏中的“文件” > “首选项” > “设置”。 2. 在搜索框中输入“cortex-debug.gdbPath”。 3. 单击“编辑 in settings.json”,打开设置文件。 4. 在 settings.json 文件中添加以下配置: ``` "cortex-debug.armToolchainPath": "<path-to-your-toolchain>", "cortex-debug.gdbPath": "<path-to-your-gdb>", "cortex-debug.gdbInit": [ "set substitute-path /path/on/host /path/on/target" ], ``` 其中,<path-to-your-toolchain> 表示你的工具链路径;<path-to-your-gdb> 表示你的 GDB 路径。 5. 保存并关闭 settings.json 文件。 6. 重新打开 VS Code,尝试使用 cortex-debug 插件进行调试,警告信息应该已经消失了。 需要注意的是,GDB 索引缓存目录的路径必须是可写的,否则 GDB 无法在该目录下创建索引缓存文件。如果你使用的是 Windows 系统,建议将索引缓存目录设置为 C 盘根目录下的一个目录,例如 C:\GDBIndexCache。如果你使用的是 Linux 或 macOS 系统,可以将索引缓存目录设置为你的 HOME 目录下的一个目录,例如 ~/GDBIndexCache。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值