即使在逻辑oring两个假条件之后,断点中的GDB复杂条件也变为真

即使在逻辑oring两个假条件之后,断点中的GDB复杂条件也变为真,gdb,Gdb,如果已读取带有条件的条件断点 (gdb) b handle.cpp:66 if ( (sn == 6092 && !strcmp(_name.c_str(),"HSI_IDX_DEF")) || (sn == 1251 && !strcmp(_name.c_str(),"SP_IDX_DEF"))) 它每次都会命中,因为即使在对两个假子条件进行oring之后,复杂条件每次都变为真 (gdb) p ( (sn == 6092 && !strc

如果已读取带有条件的条件断点

  (gdb) b handle.cpp:66 if ( (sn == 6092 && !strcmp(_name.c_str(),"HSI_IDX_DEF")) || (sn == 1251 && !strcmp(_name.c_str(),"SP_IDX_DEF")))
它每次都会命中,因为即使在对两个假子条件进行oring之后,复杂条件每次都变为真

(gdb) p  ( (sn == 6092 && !strcmp(_name.c_str(),"HSI_IDX_DEF")) || (sn == 1251 && !strcmp(_name.c_str(),"SP_IDX_DEF")))
    $10 = true
    (gdb) p (sn == 6092 && !strcmp(_name.c_str(),"HSI_IDX_DEF"))
    $11 = false
    (gdb) p  (sn == 1251 && !strcmp(_name.c_str(),"SP_IDX_DEF"))
    $12 = false
我的发行版

Linux lab-exchangeIn 2.6.32-279.el6.x86_64 #1 SMP Fri Jun 22 12:19:21 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
gdb版本

 GNU gdb (GDB) Red Hat Enterprise Linux (7.2-56.el6)
    Copyright (C) 2010 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "x86_64-redhat-linux-gnu".
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>

太糟糕了,不可能是真的。你能用值而不是变量名发布你的gcc/gdb版本、操作系统、变量值和条件结果吗?@kelter:添加了信息。无论如何,这不是什么高级bug。这很简单,就好像| |环不能正常工作一样。虽然这可能是一些旧版本中的错误。有人不得不问一个愚蠢的问题:优化是否被禁用?另外,请尝试写入条件并检查代码并运行;这些附加测试将有助于您的调试。请在不使用c_str()的情况下进行尝试-在此之前进行计算,并在打印中使用表达式或常量字符串值。
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)