Eclipse: How do you start stepping into/over like how Visual Studio does it in C++?

Started by
5 comments, last by SuperVGA 10 years, 6 months ago

In Visual Studio, when you press the Step Into (F11), or Step Over (F10), the compiler automatically builds the program, before stopping at the first line of code, whether it's written in C++ or assembly. It is sometimes useful when it comes to getting to know unfamiliar code in C++, where the main function might be obscured somewhere in the code, and it's hard to find.

I wanted to do the same thing with Eclipse. I wanted it to automatically start the JVM before stopping at the first line of Java code, just like what I explained for Visual Studio above.

Is this possible to do? Are there any methods of invoking such actions?

Advertisement

Have you attached your debugger? In your run settings, under debug config, you need to set a debugger. With gcc there's gdb.exe, I'm not sure what the MSc one is called.

I don't understand what Java debugger should I attach. Can you give instructions?

I don't understand what Java debugger should I attach. Can you give instructions?

Ahh, alright. I reread your post, thought it was about Eclipse C++.

Under your debug run configuration, Open the "Main" tab and check the "Stop in main" option at the bottom of the panel.

Remember to run with the debug configuration. (F11 by default)

Thanks for the instructions.

I prefer setting breakpoints in the regular Java editor views (from the right-click menu of the left gutter); any debug execution and any remote debugging session will stop where I specify.

In most cases using breakpoints should be more useful and convenient than setting a global option to stop only at the beginning of the main() method as SuperVGA suggests, since you can both stop execution near multiple arbitrary interesting places and allow uninteresting execution paths and other programs to run to completion without annoying pauses.

The Debugger perspective has a nice Breakpoints view that can be used to set breakpoints on thrown and caught exceptions and to review, enable, disable and delete breakpoints without chasing them throughout source files.

Omae Wa Mou Shindeiru

I prefer setting breakpoints in the regular Java editor views (from the right-click menu of the left gutter); any debug execution and any remote debugging session will stop where I specify.

In most cases using breakpoints should be more useful and convenient than setting a global option to stop only at the beginning of the main() method as SuperVGA suggests, since you can both stop execution near multiple arbitrary interesting places and allow uninteresting execution paths and other programs to run to completion without annoying pauses.

The Debugger perspective has a nice Breakpoints view that can be used to set breakpoints on thrown and caught exceptions and to review, enable, disable and delete breakpoints without chasing them throughout source files.

I agree, but I only told how to do it as an answer to Tom_Mai's question "...before stopping at the first line of code..."

- There's nothing as infuriating as stepping from main() all the way to the 20000th frame because that's around the point I'm through the menu, my world has loaded, and the buggy AI discovers an ammo crate. biggrin.png

Also, I strongly encourage using breakpoint conditions where possible. In the Borland/Embarcadero IDE, there was/is an option to enable and disable entire breakpoint groups. Powerful stuff. I don't think Netbeans or VS does this.... :(

This topic is closed to new replies.

Advertisement