address-sanitizer - Address Sanitizer:查找导致崩溃的线程
问题描述
我正在编写一个崩溃的多线程程序。从下面的 AddressSanitizer 输出中可以看到,AddressSanitizer 将线程 ID 打印为T16777215
与输出不匹配pthread_self()
或不匹配的线程 ID gettid()
。知道是什么T16777215
吗?
==6363== ERROR: AddressSanitizer: heap-use-after-free on address 0x600800021c98
at pc 0x7f79415f2b95 bp 0x7f79465d66e0 sp 0x7f79465d5e88
WRITE of size 8 at 0x600800021c98 thread T16777215
#0 0x7f79415f2b94 (/usr/lib64/libasan.so.0.0.0+0xeb94)
谢谢您的帮助
解决方案
Asan 的线程 id 就是线程的序列号:
u32 ThreadRegistry::CreateThread(uptr user_id, bool detached, u32 parent_tid,
void *arg) {
...
} else if (n_contexts_ < max_threads_) {
// Allocate new thread context and tid.
tid = n_contexts_++;
(完整代码见这里)。
推荐阅读
- java - 过滤 ACTION_PROCESS_TEXT 以在检测到电话号码时执行操作
- node.js - 无法将图像文件发布到服务器
- postgresql - 使用新添加的列更新表,该列包含来自同一表旧列的数据,但已修改(展平)jsonb
- postgresql - 为什么这个嵌套的 INNER JOIN 在 POSTGRESQL 中不起作用?
- azure - 通过 template.json 文件从 Storageacct 安装应用程序...我们需要通过参数传递 storageName 和 Key,因此它不是硬编码的
- c# - 在 TFS 中创建单独的搁置集
- tcl - 传递 $args 作为 vsim 参数的替代会产生错误
- javascript - 使用方法包括()检查字符串是否出现在数组中表示的字符返回真 - 从字符串中删除字符
- r - 带有 distHaversine 的 distm() 是否给出不准确的结果?
- reactjs - 类型“JSX.Element”不可分配给类型“元素”