开发者

How do debug header file implemetation (its .cpp) in c++ using GDB

I have these 3 file in my program:

  1. sample1.h (method in sample1.cpp are defined here)
  2. sample1.cpp (all the actual implementations)
  3. demo.cpp (I am using the methods in sampe1.cpp here, and have included sample1.h)

Now, I am using GDB to debug and I know the basic commands like "break lineno." or "break methodname". But, how do I debug the methods written in sample1.cpp?

I tried:开发者_如何转开发 break "sample1.cpp:mymethod" but it did not work.


try

break mymethod

As the function name in not ambiguous, it should work.

See. http://www.unknownroad.com/rtfm/gdbtut/gdbbreak.html#BCPPFUNC


If mymethod is a member of myclass:

break myclass::mymethod

There should be no need to specify the file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜