作者dostaevsky (轩)
看板EE_DSnP
标题[问题] gdb testBdd时在decRefCount错误
时间Tue Jun 23 18:02:40 2009
执行testBdd时segmentation fault
用gdb看是在bddMgr.cpp 中
BddNode::_one = BddNode(BddNodeInt::_terminal, BDD_POS_EDGE);
在进行operator = 中的 decRefCount()时crash
display时
gdb因为避免无限recursion而不能display _refCount
display _one则出现
2: this->_one = {static _one = {static _one = <same as static member of an
already seen type>,
static _zero = {static _one = <same as static member of an already seen
type>,
static _zero = <same as static member of an already seen type>, static
_debugBddAddr = false,
static _debugRefCount = false, _nodeV = 0, static _BddMgr = 0x8055a80},
static _debugBddAddr = false,
static _debugRefCount = false, _nodeV = 0, static _BddMgr = 0x8055a80},
static _zero = <same as static member of an already seen type>, static
_debugBddAddr = false,
static _debugRefCount = false, _nodeV = 0, static _BddMgr = 0x8055a80}
而在BddNodeInt::decRefCount() 中有 (this = 0x0)
在~BddNode中
我本来想if(*this != 0 )时才进行getBddNodeInt()->decRefCount()
但我以为的if的判断条件似乎不起作用...总是会进到decRefCount(),然後就crash
...
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.166.233.130
1F:→ dostaevsky:我原本以为跟#1AG4HdeA有关 06/23 18:04
2F:推 sa901119:要确认nodeV不是NULL 才能操作 06/23 18:08
3F:→ dostaevsky:我在~BddNode中 06/23 18:13
4F:→ dostaevsky:if (_nodeV) getBddNodeInt()->decRefCount(); 06/23 18:13
5F:→ dostaevsky:还是会进入decRedCount() 06/23 18:13
6F:→ dostaevsky:另外我满想知道_one 跟_terminal照顾的时候要小心什麽 06/23 18:17
7F:→ sa901119:nodeV 是不是只能取前面几位? 因为後面是存bubble 06/23 18:26
8F:→ dostaevsky:我改用getBddNodeInt()取出 但仍然依旧 06/23 18:35
9F:推 ric2k1:if (*this != 0) 是不行的哦, 因为它会去呼叫 != operator 06/23 18:51
10F:→ ric2k1:所以当 _nodeV == 0 这个 if () 就 crash 了! 06/23 18:52
11F:推 ric2k1:提示一下: _nodeV 可能 = 1, 但是 getNodeInt() == 0... 06/23 18:54