gpt4 book ai didi

c++ - 如何让 gdb 从 icc "CHKP: Bounds check error"中断 `-check-pointers=write`

转载 作者:行者123 更新时间:2023-11-30 05:38:11 26 4
gpt4 key购买 nike

Intel icc 编译器有一个运行时检查功能 -check-pointers=write 可以神奇地检查指针写入的数据是否超出了它的范围应该。当我在我的代码上运行它时,我在 gdb 中遇到了数百个这样的错误。我想让 gdb 中断这个错误的第一个实例,但它没有作为异常或信号实现,所以 catch throwcatch 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com