Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Can someone explain how to use debuger?

This topic is 5355 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

I want to make programs in C++ but I don''t know how to use debuger? Can anyone explain me only the basic things PLEASE !! Thanks...

Share this post

Link to post
Share on other sites
First of you will need an IDE which wraps the compiler/linker/editor/debugger into a single application - the compiler etc are all separate programs but IDEs such as Dev-C++ or Visual C++ allow you to run these programs from within which makes development a lot easier.

The first step is to get hold of either Dev-C++ which is free or Visual C++ which will cost you around $100 for the latest standard version.

Once you have hold of one of these then you can write your code and compile/build your programs. The debuggers for these IDEs are different so once you have yourself equipped with either Dev-C++ or VC++ then we (the ppl here on GD) can help with how to use the debugger that comes with whatever program you have chosen

[edited by - Spudder on February 20, 2004 7:04:59 AM]

Share this post

Link to post
Share on other sites
This is a high-level breezethrough of some of the VC Debugger functionality, it is by no means complete. The debugger allows you to step through your code and really see what''s going on when it runs:

- Under ensure View > Toolbars > Debug is enabled, you''ll thank me later.

- Ensure you are in "Debug" build, not the "Release" build (there''s a pulldown box or or under Build > Configuration Manager in VS .NET 2003).

- Put your cursor on the first line of your program.

- Under Debug menu, choose "Run To Cursor" (CTRL+F10). The program will compile, link, start running and then stop on that line of your code in the debugger. The debugger indicates what line you''re on by showing a yellow arrow.

- Now on the Debug toolbar or the Debug menu, you can choose:

"Step Into" -> follows the code wherever it calls, i.e. if it calls a function the debugger will step into that function

"Step Over" -> executes the line of code but does not follow it into any functions that it calls

"Step Out" -> executes the code until it returns from its current context (i.e. if you''re inside a function on the first line, clicking "Step Out" will execute code until the function returns)

"Stop" (looks like VCR stop button) -> will stop your program execution and debugger and return you to the IDE

- In the Watch pane, you can click in the first row and type in a variable name and press Enter. This will add the variable to the Watch pane and you can see the value of this variable as you step through the program.

- In the Call Stack tab you can see the program context (i.e. which functions its called currently)

- You can set breakpoints in your code (instead of running to your cursor position). To do this put your cursor on any line and press "F9" or use the Debug menu. This will put a red circle next to the line (you can set or clear breakpoints just by clicking next to a line also). Now instead of clicking "Run to Cursor" you can just click "Start" in the Debug menu or toolbar (F5). This will run the program and if the program hits the breakpoint it will stop just like "Run to Cursor". The beautiful thing with Breakpoints is that you can have multiple ones, can set Conditions and Hit Counts for your breakpoints (i.e. if a line executes N times or if a certain variable is equal to a certain value, etc). I haven''t played with Conditions or Hit Counts too much yet but it should be VERY useful.

The best thing to do is experiment and play around...it''s very intuitive once you get the hang of it.


[ Little Devils Inc. ]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!