英特尔 icc 编译器具有运行时检查功能-check-pointers=write
,它具有某种魔术作用,可以检查指针是否超出了预期的范围。在我的代码上运行此命令时,在 gdb 中,出现了数百个此类错误。我想在此错误的第一个实例上让 gdb 中断,但是它没有实现为异常或信号,因此catch throw
或catch signal
不起作用,并且我不知道是否有与之关联的函数名这项特征。
当运行时检查器击中调试器时,有什么办法可以使其“中断”?
最佳答案
-check-pointers
功能从libchkp.so
安装代码,所有功能中都带有chkp
前缀。使用info functions chkp
对gdb中的函数进行快速搜索显示,回溯函数被称为“chkp_print_traceback”,因此在回溯发生时,这将安装一个断点:
break chkp_print_traceback
现在它停止了!
[New Thread 0x7fffce34c700 (LWP 41385)]
[New Thread 0x7fffceb4d700 (LWP 41384)]
[New Thread 0x7fffd034e700 (LWP 41383)]
CHKP: Bounds check error ptr=0x7ffe24685870 sz=4 lb=0x7ffe24685860 ub=0x7ffe2468586f loc=0xb170b0
[New Thread 0x7ffec47fc700 (LWP 41621)]
[New Thread 0x7ffe29fff700 (LWP 41622)]
[New Thread 0x7ffed47fe700 (LWP 41603)]
[New Thread 0x7ffecc7fe700 (LWP 41605)]
[New Thread 0x7ffef07f8700 (LWP 41598)]
[New Thread 0x7fff147f8700 (LWP 41597)]
[New Thread 0x7fff387f8700 (LWP 41595)]
[New Thread 0x7fff687f8700 (LWP 41594)]
[New Thread 0x7fff707f8700 (LWP 41590)]
[New Thread 0x7fff907f8700 (LWP 41589)]
[New Thread 0x7fffb45ec700 (LWP 41587)]
[New Thread 0x7ffec4ffd700 (LWP 41577)]
[New Thread 0x7ffec57fe700 (LWP 41442)]
[New Thread 0x7ffec7fff700 (LWP 41441)]
[New Thread 0x7ffecefff700 (LWP 41440)]
[New Thread 0x7ffed5fff700 (LWP 41439)]
[New Thread 0x7ffef0ff9700 (LWP 41438)]
[Switching to Thread 0x7ffec47fc700 (LWP 41621)]
Breakpoint 1, 0x00007ffff5f32d74 in chkp_print_traceback () from /opt/intel/composer_xe_2015.2.164/compiler/lib/intel64/libchkp.so
(gdb) where
#0 0x00007ffff5f32d74 in chkp_print_traceback () from /opt/intel/composer_xe_2015.2.164/compiler/lib/intel64/libchkp.so
#1 0x00007ffff5f31706 in __chkp_check_bounds () from /opt/intel/composer_xe_2015.2.164/compiler/lib/intel64/libchkp.so
#2 0x0000000000b170b0 in redacted
关于c++ - 如何使GDB从icc “CHKP: Bounds check error”的 `-check-pointers=write`断开,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32896618/