即使在逻辑或两个错误条件之后,断点处的GDB复杂条件也变为真

时间:2013-09-26 10:49:20

标签: 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")))

它每次都会命中,因为即使在两个错误的子条件之后,复杂条件也会变为真实。

(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版本:

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)

0 个答案:

没有答案