Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/125.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ GDB-strcmp不工作:\ u strcmp\ u sse2\ u未对齐_C++_Gdb_Breakpoints_Strcmp_Conditional Breakpoint - Fatal编程技术网

C++ GDB-strcmp不工作:\ u strcmp\ u sse2\ u未对齐

C++ GDB-strcmp不工作:\ u strcmp\ u sse2\ u未对齐,c++,gdb,breakpoints,strcmp,conditional-breakpoint,C++,Gdb,Breakpoints,Strcmp,Conditional Breakpoint,我无法使用strcmp在GDB中创建条件断点: break x if strcmp(str.c_str(), "foo") == 0 你为什么问 因为: print strcmp("hello", "hello") 收益率 (int (*)(const char *, const char *)) 0x7ffff76ffe70 <__strcmp_sse2_unaligned> 它返回一些无意义的值,如-143655312 这里有一个不太优雅的方法来“解决”我的问题。 我可以

我无法使用strcmp在GDB中创建条件断点:

break x if strcmp(str.c_str(), "foo") == 0
你为什么问

因为:

print strcmp("hello", "hello")
收益率

(int (*)(const char *, const char *)) 0x7ffff76ffe70 <__strcmp_sse2_unaligned> 
它返回一些无意义的值,如-143655312

这里有一个不太优雅的方法来“解决”我的问题。 我可以用自己的代码定义一个函数:

int mystrcmp(const char *str1, const char* str2){
    return strcmp(str1, str2);                   
}                                                
现在我可以用这个函数代替我的条件断点。 但这不是真正的调试,是吗?当你不得不改变你的原始代码来调试它时,你已经失去了游戏


那么我缺少什么呢?

strcmp是一个特殊的函数选择器(),它返回要在当前处理器上使用的strcmp的(几种可能的)实现的地址

您应该可以这样做:

break x if __strcmp_sse2_unaligned(str.c_str(), "foo") == 0

是否可以从用户代码修改
IFUNC
,以返回指向用户定义函数的指针?
break x if __strcmp_sse2_unaligned(str.c_str(), "foo") == 0