首页
社区
课程
招聘
[求助]用gdb调试,有的代码是arm,有的代码是thumb,互相切换。设置断点总会Segmentation fault。这个怎么解决?
2016-6-28 13:34 6498

[求助]用gdb调试,有的代码是arm,有的代码是thumb,互相切换。设置断点总会Segmentation fault。这个怎么解决?

2016-6-28 13:34
6498
我觉得是如果想在arm代码处设置断点,那么经过thumb的代码时就会段错误。
如果想在thumb代码处设置断点,那么经过arm的代码时就会段错误。
这个怎么解决呢?

阿里云助力开发者!2核2G 3M带宽不限流量!6.18限时价,开 发者可享99元/年,续费同价!

收藏
点赞0
打赏
分享
最新回复 (4)
雪    币: 52
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
btrace 2016-6-28 17:23
2
0
set arm fallback-mode (arm|thumb|auto)
gdb uses the symbol table, when available, to determine whether instructions
are ARM or Thumb. This command controls gdb’s default behavior when the
symbol table is not available. The default is ‘auto’, which causes gdb to use
the current execution mode (from the T bit in the CPSR register).

set arm force-mode (arm|thumb|auto)
This command overrides use of the symbol table to determine whether instructions
are ARM or Thumb. The default is ‘auto’, which causes gdb to use the
symbol table and then the setting of ‘set arm fallback-mode’.
雪    币: 97
活跃值: (30)
能力值: ( LV2,RANK:140 )
在线值:
发帖
回帖
粉丝
DebugFan 3 2016-8-12 19:11
4
0
gdb对arm断点和thumb断点的设置处理方式不一样。设置断点时如果模式不对,会引起Segmentation fault。
2楼提到的set arm fallback-mode/force-mode是比较常用的方法。这两个方法在我的印象中有个缺点,比如切换到arm模式设置了arm断点,就不能马上再切换到thumb模式设置thumb断点,必须等到下一步,否则前面设置的arm断点就也按照thumb断点模式设置了。
另外有个针对thumb断点设置的特殊方法就是thumb断点地址+1,这样当当前模式不为arm时,可以将fallback-mode/force-mode设置为arm模式,这样就可以同时设置arm断点和thumb断点(地址+1)了。
雪    币: 191
活跃值: (195)
能力值: ( LV8,RANK:130 )
在线值:
发帖
回帖
粉丝
大王叫我挖坟 3 2016-8-13 09:39
5
0
我勒个去,谢谢楼上的回复,我说为啥用ida调试经常报那种错误呢,原来如此
雪    币: 89
活跃值: (469)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
pkiller 2016-8-17 12:18
6
0
IDA中不是经常报 SIGILL 吗..
游客
登录 | 注册 方可回帖
返回