Jump to content
  • Advertisement
Sign in to follow this  
tom_mai78101

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

This topic is 2106 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.... :(

Edited by SuperVGA

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!