Andifyourunthe d bugger, yourprogramrunsandexitsandwegetsomeoutputsandyoumighthave a littlecouncilwindoworloggingfacility, whichhecouldhaveusedtocapturedthatwhatyourprogramisdone.
However, sometimesit's a lotmoreusefultojustlookyourprogrammingrunninginrealtime.
Nowyoumaynotice I'vepopped a littlekeyboardonthescreen, andthisistoshowyousomeofthekeyboardshortcutsthat I'llbeusinginvisualstudiowithany D bugger.
Ifwehave a lookingatthebookingwindow, wecanseethat P A.
Hereiscurrentlyundefined.
That's thezero x c C C C c.
I'llpopthisbackintodecimalview, andweseeheresomecurlybracketswithsomequestionmarksinthisisthe D Boger, tellinguswhatthevalueisatthatpointoflocationandiscurrentlyundefined.
Solet's defineitbysteppingtothenextlineofcodewecannowseeThePointerhasbeengiven a memoryaddressonitcontainsthevaluesevenandthisiswe'rehaving a memorywindowcanalsobequiteuseful.
Wecanjustclickanddragthataddressintothememorywindowandhave a lookatitdirectly, andwecansee, ofcourse, appearinthefirstelementisourfourbites.
Anymemorythatchangesgetshighlightedred, andwe'llsee a bitmoreofthislaterhome.
Let's have a looknowatthefloatingpointpointer, wecanseethedeepbuggerknowswhattypeitisanddisplaysthedataaccordingly.
Andifwehave a lookatthisin a memorywindow, thisisthehexdecimalequivalentofourfloatingpointvalue, which, ofcourse, doesn't makemuchsensetomeremortalhumans.
Sotomakethismorereadable, youcanrightclickandchoose a particulardataformattodisplay.
Inthiscase, I knowmyfloatsare 32 bitfloatingpoints, so I willchangethememorydisplayto 32 bitfloatingpointon.
Butifwedragthatoverto a memorywindowandhave a look, weseethatsomehexdecimalcharactershere, whichrepresentsourworldandactuallyshowsyouthatinthememorywithanaskinginterpretation.
OfftheHexidecimalcharactersbitsixesaboutnavigatingfunctions, usingthedeepOkay, soif I controlin f tendtothisline, it's executedallthecodethatwesawbefore, andwecanseewhereweareinourcurrentcallstack.
Thesecondwaytodebugthefunctionistocontrolin F 10 toit, andyoucannowpress F 11 tostepintothefunctiononbackout.
Steppingintoanoverfunctionsonanyotherkindofcallinyourprogramisvitaltodebuggingasthere's prettymuchalways a 1 to 1 relationshipbetweenthenatureofhowyou'resteppingontheorderofftheprogramexecution.
However, thisiswherethingsget a littlebitdaunting.
Let's say I controlin F 10 tothisstringdeclaration.
Well, ofcourse, weknowthatstringisactuallyanobjectisnot a primitivetype.
Soif I pressed F 11 I starttostepintotheconstructoroffthestringandyoucanseeitgetsquitecomplicated.
I startsteppingthroughthiscode.
Wecanseehoweverythingworks, but I'llbepressing F 11 for a longtimehere.
Sosometimes I needtostepoutoffthecodeandtwostepoutof a functionitshiftin F 11 holddowntheshiftholdon F 11 andEventually I getbacktowhere I waas.
I personallydon't tendtousethisverymuch, and I prefercontrolinat 10.
However, itdoeshavesomeusefuladvantages.
Takethiscode, forexample.
I have a littlefourloopthat's doingsomethingrepeatedly, butlet's assume I discover a bugweresomethingonlystartstoeffecttheprogramwheneyesequaltovalue 55.
I couldsitherenowpressing F 10 onmonitoringthevariablewindowappeararemonitoringthevalueofeyeuntilitisequalto 55.
I'llbeherealldayandsaid, What I candoisset a moreintelligentbreakpoint.
So I saidtobreakpointandclickonthelittlegearnexttoit.
I'vealsogot a Jasonobject, which I'vepinchedfromtheJasonwebsitefromtheexamplepageon.
Yes, theylook.
Theylookquiteterrible, butitis a popularwayofmanipulatingdata.
Let's seehowthedeepogrehandlesthese.
So I'm goingtocontrolan F 10 toit, andwe'lllookattheHTMLonfirst, sowe'llfindavailableatthemoment.
It's notbeendefinedasanything, butassoonas I clickonhere, wecanseeit's just a stringforallintentsandpurposes.
Butrightnexttoit, there's a littlemagnifyingglass, and I canchoosehowwishtovisualizethisstringandif I choosetheHTMLvisualizeer, itactuallydisplaysHTML, andthisisthelinkthatwecreated.
Infact, it's sogood I canclickonthelinkandittakesyoutomywebsite.
Thisisn't a fullyfunctionalhtmlDreiser, butit's goodenough.
A similarthinghappensfortheJasonobjecttheJasonobjectnowcontaintostring.
Solet's have a lookatthatusingwth e JasonVisualizeerwell, I shouldexpectitbreaksitupintothetree.
Soforthefirstvalue, I'd expect 36 andputmycursorover a onehereandwesee.
Ofcourse, thevalueis 36.
Wecanvalidatethatbylookingatthelocalswindow.
Justpointouttheautoswindowatthemomentislike a summarizedlocalsversion.
SothedeBoogerhasdecided.
Whatusefulinformationdo I needtoseeinlargeprograms?
Thisisinvaluable, butthisiswherewecanexploit a reallypowerfulfeatureofthedeBooger.
I cannowgoandchangethecontentsofmyfunction.
Let's makeitcubethenumberbytimesandbyteaagain.
Thistime, when I pressed F tendtostepthroughthelineofcodeitcompiled, itsaidHere, editcontinuesuccessfullyappliedcodechanges, andifwehave a looknow, a twoshouldbethecubeoffsix, whichindeeditis.
Atleastit's givenus a hintthatit's somethingtodowithBufferonetheway I wouldbebooked.
Thisistostarttheprogramandcontrolin F 10 tothestartofitandhave a lookwhatwe'redoingwithbeforeoneinordertocorruptit.
Well, if I taketheaddressherefrombeforeoneandhave a lookatitin a memorywindow, I know, ofcourse, herethatbeforeonecanonlycontainfivebites, let's seewhathappensiswestepthroughthecode.
Well, the 1st 1 gotwrittentheirvaluezero 2nd 11 two, three, fourfive.