gdb

由“Qt程序运行一段时间后崩溃”引发的“opancv库中Mat::clone()函数”在多线程下的注意事项

怎甘沉沦 提交于 2021-01-04 08:00:20
问题描述 过程1:从相机中获取图像数据,然后存放到一个cv::Mat对象中(该对象是全局变量,用来交换数据)。由相机的回调函数自动调用。 过程2:将上述的全局变量拷贝并转换qimg,放到Qt界面上显示。该过程由定时器调用。 然后程序会在运行一段时间后,出现“程序异常结束。The process was ended forcefully.”。运行的时间长短不一。 问题解决与分析 由于QtCreator的编译器选的是MSVC,而调试器选只有GDB(查了下好像需要CDB)。所以无法debug,只能一点点排查。 测试定时器时间越短,出现问题越快。猜测是多线程下访问冲突。 输出线程id查看,使用std::this_thread::get_id()获取当前线程的ID,发现相机写入Mat对象的过程的线程号 和 定时器调用的读取Mat对象的线程号不一样。这说明相机的SDK在获取图像数据的部分是创建了新的线程进行的。 可是读写应该不冲突,所以看看opencv的Mat::clone()方法。 inline Mat Mat::clone() const { Mat m; copyTo(m); return m; } // 噢 原来是调用的cv::copyTo方法,等等,上面有个const,这下明白了,在拷贝的时候是不允许修改值的,如果正在拷贝,此时相机写入线程正好获取了相机数据,准备写入

Percona-Tookit工具包之pt-stalk

泪湿孤枕 提交于 2021-01-03 21:34:08
Preface We have a lot of methods to diagnose problems in our system such as strace,pstack,gstack,gdb,pt-pmp,etc.But sometimes there will be some fitful performance issues which are not so easy to trace.Thus,pt-stalk may help us in diagnosing these kind of problems. Introduce pt-stalk is a tool to collect detail diagnostic data base on triggers you specified such as gdb,oprofile,strace,tcpdump.The trigger is not the conception of trigger in database.They're different at all.pt-stalk provides various options to collect comprehensive data you need.It's really useful and helpful in performance

How to get environment of a program while debugging it in GDB

假如想象 提交于 2020-12-30 05:13:25
问题 I am debugging a program in GDB on linux. I am using getenv and setenv calls to read and set environment variables. For example I am calling setenv("TZ", "UTC", 1); to set the TZ environment variable for timezone. To check if the env variable is set I am using GDB command show environment . This prints all the environment variables and their values. But it dose not show TZ being set. Even command show environment TZ says Environment variable "TZ" not defined. Is their another way to check the

How to get environment of a program while debugging it in GDB

你。 提交于 2020-12-30 05:11:31
问题 I am debugging a program in GDB on linux. I am using getenv and setenv calls to read and set environment variables. For example I am calling setenv("TZ", "UTC", 1); to set the TZ environment variable for timezone. To check if the env variable is set I am using GDB command show environment . This prints all the environment variables and their values. But it dose not show TZ being set. Even command show environment TZ says Environment variable "TZ" not defined. Is their another way to check the

How to get environment of a program while debugging it in GDB

耗尽温柔 提交于 2020-12-30 05:11:21
问题 I am debugging a program in GDB on linux. I am using getenv and setenv calls to read and set environment variables. For example I am calling setenv("TZ", "UTC", 1); to set the TZ environment variable for timezone. To check if the env variable is set I am using GDB command show environment . This prints all the environment variables and their values. But it dose not show TZ being set. Even command show environment TZ says Environment variable "TZ" not defined. Is their another way to check the

How to get environment of a program while debugging it in GDB

≯℡__Kan透↙ 提交于 2020-12-30 05:10:45
问题 I am debugging a program in GDB on linux. I am using getenv and setenv calls to read and set environment variables. For example I am calling setenv("TZ", "UTC", 1); to set the TZ environment variable for timezone. To check if the env variable is set I am using GDB command show environment . This prints all the environment variables and their values. But it dose not show TZ being set. Even command show environment TZ says Environment variable "TZ" not defined. Is their another way to check the

How to get environment of a program while debugging it in GDB

拟墨画扇 提交于 2020-12-30 05:09:52
问题 I am debugging a program in GDB on linux. I am using getenv and setenv calls to read and set environment variables. For example I am calling setenv("TZ", "UTC", 1); to set the TZ environment variable for timezone. To check if the env variable is set I am using GDB command show environment . This prints all the environment variables and their values. But it dose not show TZ being set. Even command show environment TZ says Environment variable "TZ" not defined. Is their another way to check the

How to get environment of a program while debugging it in GDB

做~自己de王妃 提交于 2020-12-30 05:09:47
问题 I am debugging a program in GDB on linux. I am using getenv and setenv calls to read and set environment variables. For example I am calling setenv("TZ", "UTC", 1); to set the TZ environment variable for timezone. To check if the env variable is set I am using GDB command show environment . This prints all the environment variables and their values. But it dose not show TZ being set. Even command show environment TZ says Environment variable "TZ" not defined. Is their another way to check the

Prevent PLT (procedure linkage table) breakpoints in GDB

久未见 提交于 2020-12-28 07:04:32
问题 In recent versions of GDB, setting a breakpoint on a library function call results in multiple actual breakpoints: Call into the procedure linkage table (PLT) The actual function call This means that when the library function is called, we end up going through two breaks each time. In previous GDB versions, only #2 would be created and hence you only get one break. So the question is: can one can create a library function call breakpoint without the corresponding PLT breakpoint? I am aware

Prevent PLT (procedure linkage table) breakpoints in GDB

独自空忆成欢 提交于 2020-12-28 07:01:09
问题 In recent versions of GDB, setting a breakpoint on a library function call results in multiple actual breakpoints: Call into the procedure linkage table (PLT) The actual function call This means that when the library function is called, we end up going through two breaks each time. In previous GDB versions, only #2 would be created and hence you only get one break. So the question is: can one can create a library function call breakpoint without the corresponding PLT breakpoint? I am aware