Jan 20, 2021, 02:35 AM

News:

GinGly.com - Used by 85,000 Members - SMS Backed up 7,35,000 - Contacts Stored  28,850 !!


Debugging a Program

Started by sukishan, Aug 13, 2009, 06:22 PM

previous topic - next topic
Go Down

sukishan

There are many ways to debug a program. One of the simplest is to use cout to output the values of key variables at various places in the program. Another is to use the debugger. You can access it by selecting Build, Start Debug. This brings up the choices: Go (to execute until a breakpoint is reached), Step Into (to execute the program line by line), Run to Cursor (run to the current cursor location).

If you select Step Into or Run to Cursor, you should be given a debug toolbar that has other options such as Step Over (also for executing line by line but without going inside the code for any function that is called). This toolbar also allows you to restart the program, to end debugging, etc. If the debug toolbar isn't shown, look under Tools, Customize, Toolbars and see that the debug toolbar is checked.

When the debugger is running, one or more windows may be open for displaying values. The debug toolbar has buttons for toggling on/off a watch window, an auto variable display window etc. The former lets you enter the names of variables whose values you would like to see. The latter automatically shows the values of variables used in the line just executed.

Note that to add or remove breakpoints (probably done before you even start the debugger), you can right click at the desired location in the code and then click on Insert/Remove breakpoint. Doing the same thing again removes the breakpoint. The debugger has many more features which you can learn if you like. See the Debugger Lab for a practice exercise on using the debugger.
A good beginning makes a good ending

Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:
Verification:
Please leave this box empty:

Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

shortcuts: alt+s submit/post or alt+p preview
IT Acumens Web Designing Chennai | GinGly :: Build your Personal Website | CineBuzz :: Cinema News | My Kids Diary :: Kids Memories Writing :: Book Website @ 349 Rs monthly
Copyright 2005 - 2020 :: IT Acumens :: All Rights Reserved. :: Sitemap
ITAcumens Discussion Forum with 2 lakhs post running for 15 years - Powered by IT Acumens Dedicated Server