[英]can I debug my cpp code using linux gdb? if yes how can I keep break points on a function which is called over an object
例:
class test_gdb
{
public:
void testFun(void)
{
cout << "this is test function"<<endl;
}
};
int main(void)
{
test_gdb testObj;
testObj.testFun();
}
在這里,如果我想在testFun保持一個斷點,我該怎么辦呢。 我嘗試過但是使用break testFun但它沒有用。
我該怎么做
幾種方式:
(gdb) break test_gdb::testFun
在所有testFun
上設置斷點,無論它們在哪個類中定義:
(gdb) rbreak testFun
如果您有多個具有不同簽名(不同參數類型)的testFun
,則可以使用GDB選項卡完成來選擇一個
(gdb) break 'test_gdb::testFun<TAB> # GDB will complete or offer multiple choice
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.