简体   繁体   中英

Eclipse C++ debugging breaks in STL

I'm new to debugging with Eclipse.

I try to debug my app to know where it segfaults.

The problem is that Eclipse breaks within the STL, which is very annoying.

For example: I created a breakpoint in my source file on line 134, which works fine but if I hit F6 for "Step Over", Eclipse/gdb breaks in basic_string constructor used in the next line with std::cout.

Any hints on this? Is there a configuration option for Eclipse or such?

也许那是段错误?

我没有使用过Eclipse,但是我确定有一个“堆栈回溯”或“调用堆栈”视图,可以用来查看以STL代码结尾的调用链。

if the code is optimized then it might break in the stl. Try compiling using debug mode and it might help.

Given limited information, this is what comes to mind,

  1. Step into (F5) instead of stepping over (F6) to locate where this is happening.
  2. If this does not work, upgrade CDT to the latest version and try again.
  3. If this does not work either, try using gdb without Eclipse.
  4. Last option, throw in a bunch of cerr outputs. Note cerr (which is not buffered) not cout.

If none of this works post more details.

I had similar problem. It's about inline functions (which stl cuases).

You need to add some compiler flags to generate some extra debug information. If you are using gcc see -g* flags (-ggdb for gdb debugger compliance, it gives you the most decent support for that types of debuggers).

Also you might want to turn off optimization.

Ps I wasn't clear enough: it's not Eclipse's fault, it's compiler/debugger fault.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM