Re: [問題] 有關cmd parser...
※ 引述《will1220 (小崴)》之銘言:
: 標題: [問題] 有關cmd parser...
: 時間: Thu Jan 18 13:43:11 2007
:
: 終於要開始寫parser 可是一開始就碰到問題...
: 我在.h檔宣告以後想說先寫個breset來看看
: CmdExecStatus
: BRESETCmd::exec(const string& option)
: {
: vector<string> options;
: if(!CmdExec::lexOptions(option, options)) return CMD_EXEC_ERROR;
: if(options.size()<3) return CmdExec::errorOption(CMD_OPT_MISSING, "");
: return CMD_EXEC_DONE;
: }
: 結果我在終端機輸入
: bdd> breset
: Missing option!!
:
: bdd> breset s
: Missing option!!
: *** glibc detected *** free(): invalid pointer: 0x08083a98 ***
: 已經終止
:
: 打breset是正確...但後面只要有東西就不行...
: 請問這是怎麼一回事咧??
:
: --
: ※ 發信站: 批踢踢實業坊(ptt.cc)
: ◆ From: 61.229.229.142
: 推 ric2k1:用 debugger 看到底是 crash 在哪裡吧... 01/18 14:47
: → ric2k1:建議的 debugger commands: up/down/where 01/18 14:48
我試著用ddd去debug看看crash的原因...雖然對ddd還是沒有很熟
用up/down發現似乎是跑完BRESETCmd以後
然後跑到vector<string> options的destructor就crash掉了..
找一找好像是到
void deallocate(pointer _p,size _type)
{ ::operator delete(_p) }
就跳出了...這好像是stl裡面的code??
實在還是不知道怎麼辦><"
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.229.238.12
推
01/18 20:35, , 1F
01/18 20:35, 1F
→
01/18 20:35, , 2F
01/18 20:35, 2F
推
01/18 20:43, , 3F
01/18 20:43, 3F
推
01/18 20:51, , 4F
01/18 20:51, 4F
→
01/18 20:52, , 5F
01/18 20:52, 5F
推
01/18 23:46, , 6F
01/18 23:46, 6F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 4 篇):