GDB的apple watch 3 硬件功能是否需要硬件相应的功能支持

求助,gdb的watchponit无法用_百度知道
求助,gdb的watchponit无法用
板子上运行的:gdbserver xxx主机上运行的:arm-linux-gdb xxxtarget remote成功之后,程序停了下来,然后我只添加了一个watch,然后就输入c让程序继续运行,但是有报错:Warning:Could not insert hardware watchpoint 1.Could not insert hardware breakpoi...
我有更好的答案
显示的只有我设置的那一个观察点没有其余的断点和观察点我用的7.3的gdb,编译的arm-linux版本的无法使用watch为了验证是不是gdb的问题,我又编译了一个x86版本的,x86版本的watch功能是正常的ARM9不是说有两个硬件断点吗?那么应该可以支持硬件watchpoint才对啊我自己的板子是ARM9的,反正是死活用不起watchpoint公司用的ARM11,也没法用watchpoint
查看原帖&&
采纳率:73%
为您推荐:
其他类似问题
gdb的相关知识
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。看一下我的提问_百度知道
看一下我的提问
看一下我的提问 谢谢
我有更好的答案
你提问得什么
为您推荐:
其他类似问题
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。笔记本断网_百度知道
笔记本断网
笔记本连接无线网络出现断网显示有限访问权限,根据你之前回答过的我卸载了所有网卡,重启还是一会一断
我有更好的答案
根据你说的情况判断,个人感觉应该是路由器的问题,建议你还是先重启路由器试试吧,如果不行,那么就只能恢复出厂设置,然后,重新设置路由器试试吧。
采纳率:82%
来自团队:
为您推荐:
其他类似问题
您可能关注的内容
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。gdb下watch的使用
我的图书馆
gdb下watch的使用
这里大概说下gdb调试程序时,watch的使用。至于原理尚不清楚,以后再做补充,还请见谅。
watch通常需要和break,run,continue联合使用。
下面举例说明:
代码如下:
[cpp] #include&&stdio.h&&&&&int&main()&&{&&&&&&int&a=0;&&&&&&for(int&i=0;&i&10;&i++)&&&&&&&&&&a+=i;&&}&&调试的时候过程如下:
1&& &#include &stdio.h&
3&& &int main()
5&& &&&& int a=0;
6&& &&&& for(int i=0; i&10; i++)
7&& &&&&&&&& a+=i;
(gdb) b 5&&&&&&&&&&&&&&&&&&& -------在第5行设置断电
Breakpoint 1 at 0x80483ba: file a.cpp, line 5.
(gdb) r&&&&&&&&&&&&&&&&&&&&&& -------执行到断点处停止
Starting program: /a.o
Breakpoint 1, main () at a.cpp:5
5&& &&&& int a=0;
(gdb) watch a&&&&&&&&&&&&&& -------观察a的值,当有变化时,停止
Hardware watchpoint 2: a
(gdb) c&&&&&&&&&&&&&&&&&&&&&&& -------继续执行,当a的值变化时停止
Continuing.
Hardware watchpoint 2: a
Old value = 0
New value = 1
main () at a.cpp:6
6&& &&&& for(int i=0; i&10; i++)
Continuing.
Hardware watchpoint 2: a
Old value = 1
New value = 3
main () at a.cpp:6
6&& &&&& for(int i=0; i&10; i++)
Continuing.
Hardware watchpoint 2: a
即,在使用watch时步骤如下:
1. 使用break在要观察的变量所在处设置断电;
2. 使用run执行,直到断点;
3. 使用watch设置观察点;
4. 使用continue观察设置的观察点是否有变化。
1. 直接设置观察点是不行的,原因未知。
2. 测试对于指针设置观察点,观察的为指针的值,还是指针所在的空间。
[转]&[转]&
喜欢该文的人也喜欢gdb 和 watchpoint
http://blog.csdn.net/xiaobai1593/article/details/6740222
转载自:http://www.kgdb.info/gdb/gdb_watchpoint/
1: 什么是watchpoint
watchpoint,顾名思义,其一般用来观察某个变量/内存地址的状态(也可以是表达式),如可以监控该变量/内存值是否被程序读/写情况。
在gdb中可通过下面的几种方法来设置watchpoint:
(gdb) watch
在指定变量/内存地址(表达式)expr设置一个watchpoint。
一但expr值有变化时,将停住程序。
(gdb) rwatch
当expr被读时,停住程序。
(gdb) awatch
当expr被读或被写时,停住程序。
(gdb) info watchpoints列出当前所设置了的所有观察点。(info break也可查看)
gdb watchpoint实践:
以GDB十分钟快速入门教程的gdb-sample.c为例,在gdb-sample.c中, 变量n总共被改变了3次,如果我们下个watchpoint在n变量处,因为n变量改变了3次而响应3次watchpoint,因而程序会将被调试器暂停运行3次:
编译gdb-sample.c,并使用gdb 加载gdb-sample:
$ gcc gdb-sample.c -o gdb-sample -g
$ gdb ./gdb-sample
GNU gdb (GDB) 7.0.50.-cvs
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
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 “i686-pc-linux-gnu”.
For bug reporting instructions, please see:
Reading symbols from /home/ddd/gdb-sample…done.(gdb)
watchpoint只能在程序启动后设置,先在main那下个断点,让程序启动后暂停在main函数处:
(gdb) b main
Breakpoint 1 at 0×80483ad: file gdb-sample.c, line 19.
Starting program: /home/ddd/gdb-sample
Breakpoint 1, main () at gdb-sample.c:19
给n变量下个watchpoint:
(gdb) watch n
Hardware watchpoint 2: n
敲入”c”命令让程序恢复运行,这时候程序会停止在第一次n变量改变处
并提示即将运行的下一条的语句:
Continuing.
Hardware watchpoint 2: n
Old value = -
New value = 2
main () at gdb-sample.c:23
重复如上操作,程序还会停止两次,所有gdb输出如下:
Continuing.
Hardware watchpoint 2: n
Old value = 2
New value = 1
main () at gdb-sample.c:25
25 nGlobalVar += 100;
(gdb) —-& 这次停止是由 ”23 n–; “改变变量n的值引起的
Continuing.
n = 1, nGlobalVar = 88
tempFunction is called, a = 1, b = 2
Hardware watchpoint 2: n
Old value = 1
New value = 3
main () at gdb-sample.c:31
31 printf(“n = %d”, n);
(gdb) —-& 这次停止是由 ” 30 n = tempFunction(1, 2); “改变变量n的值引起的
(gdb) cContinuing.
Watchpoint 2 deleted because the program has left the block in
which its expression is valid.
0xb7e91450 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6(gdb)
2: watchpoint在gdb中的实现原理
watchpoint可以看成是一种特殊的”断点”, 其实现一般需要CPU支持硬件断点,如果纯软件实现watchpoint,那好像会很耗CPU.(我没去看gdb的软0watchpoint的实现,有时间得去研究下,不过如果让我来实现这个功能(和同事讨论过),应该是设置watchpoint所在的那个页表为不可读/访问,然后在缺页处理那检测当前的页和地址是否是软设置watchpoint所在的页和watchpoint的地址,如果是,则说明可以假设该watchpoint发生了)
目前支持watchpoint硬件断点的arch有x86,ppc和mips。
如果支持硬件断点,那么可以将监控的操作交给硬件来完成,而gdb这边只要做个简单的逻辑处理就行.
还是以上面的gdb-sample.c为例:
当gdb执行watch n命令后,gdb会在n变量所在的内存地址上下个硬件写断点。
(gdb) watch n
Hardware watchpoint 2: n
(如果是 rwatch n命令,gdb会在n变量所在的内存地址上下个硬件读断点)
(tips: gdb 通过系统调用ptrace()去修改调试寄存器值,从而达到实现硬件断点的目的)
这样只要系统操作了n变量(内存地址),就会触发一个硬件断点中断。
gdb捕获到这个断点中断后,就会将新的n变量值和改变前的值做比较,
1)如果n变量的值改变了,则将程序停止。2)如果n变量的值没有改变了,则程序继续运行。
关于硬件断点,可以参考x86 调试寄存器 一文。
3: 远程gdb server的watchpoint 实现
如果调试本地应用程序,gdb可以直接通过ptrace发出的信号得到watchpoint信息。
如果远程调试程序,gdb怎么从远程gdb server那得到watchpoint信息呢?
说到这里,又不得不搬出 GDB远程串行协议了..
在GDB远程串行协议里定义了gdb server和gdb所有的通信规则,所以要告诉gdb,远程gdb server那边踩中watchpoint了,还得通过那个协议来传达。
在GDB远程串行协议的Stop-Reply-Packets里定义了如何传达watchpoint信息:
?View Code TEXT
`T AA n1:r1;n2:r2;...'
The program received signal number AA (a two-digit hexadecimal number).
This is equivalent to an `S' response, except that the `n:r' pairs can
carry values of important registers and other information directly in
the stop reply packet, reducing round-trip latency. Single-step and
breakpoint traps are reported this way. Each `n:r' pair is interpreted
as follows:
* If n is a recognized stop reason, it describes a more specific
event that stopped the target. The currently defined stop reasons are
listed below. aa should be `05', the trap signal. At most one stop
reason should be present.
The currently defined stop reasons are:
The packet indicates a watchpoint hit, and r is the data address, in hex.
所以只要在Stop-Reply-Packets里添加 watch+断点地址格式的数据,gdb就知道那边踩中watchpoint了.
没有更多推荐了,
加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!}

我要回帖

更多关于 apple watch功能详解 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信