且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

任意类型的 GDB 条件断点,例如 C++ std::string 相等

更新时间:2022-04-22 03:11:23

有什么方法可以在非原始上设置条件断点类型?

Is there any way I could set a conditional breakpoint on non-primitive types?

是的,一种方法是将非原始类型转换为原始类型,在您的情况下转换为 char*,然后使用 strcmp 比较字符串.

Yes, one way to do it is to convert non-primitive type to primitive one, in your case to char*, and use strcmp to compare strings.

condition 1 strcmp(myObject->myStringVar.c_str(),"foo") == 0