作者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