欢迎来到天天文库
浏览记录
ID:49369694
大小:308.00 KB
页数:34页
时间:2020-02-04
《Data Display Debugger.ppt》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、ADDDTutorialElenaJakubiak&LarissaWineyWhatisDDDDDDstandsforDataDisplayDebuggerDDDisavisualinterfacetothecommand-lineGDBdebuggerWhyDDD?It’sintuitiveIt’sfast“Ijustuseprint()statements”That’slikesewingclothesusinganeedleandthreadinsteadofasewingmachineGettingStartedCopy
2、thesampleprogramstoyourdirectory%cp/r/uxpdworkshop/DebugLab/*.Compileyourprogramusingthe–gflag%g++-gfactorial.cpp–ofactorialRunyourprogram,rightnow,we’llstartwithfactorial(anyeasyprogramtostartwith)%factorialSoYouHaveaBugWhatdidyouexpecttheprogramtodo?Itshouldtakethe
3、factorialofanumberi.e.6!=6*5*4*3*2*1=720(1!=1)Anyideaswhatwentwrong?Youdidn’twritethiscodeYoucouldreadthecodeandthentrytounderstandabunchofitandthenputinprint()statementsYoucouldwalkthroughitinthedebugger(Hint:Choosethedebugger)StartingDDDOpenyourexecutableprograminD
4、DD(DDDknowswhatsourcecodetousebecauseyoucompiledwiththe–gflag)%dddfactorial&CustomizingDDDLinenumbers:SourceDisplayLineNumbersDockingtoolbars:EditPreferencesSettingBreakpointsIftheprogramisstuckinaninfiniteloop,thenwewanttosetabreakpointinthewhileloopRight-clickont
5、helinenumberofthewhile(number<1)SelectSetBreakpointThereshouldnowbeastop-signatthatlineStarttheProgramAtthetopofthescreen,select“Run”tostartyourprogramThiscanalsobefoundinthe‘program’menuIfDDDasksforargumentstoyourprogram,justleaveitblankTheprogramwillhaltandpromptyo
6、uforinputinthebottomofthewindowEnterasmallnumber:somethingthatshouldfinishinlessthanasecond.Itshouldstopagainatthebreakpoint.(Theblackarrowindicatesthenextlinetobeexecuted)Next,Hover,andStepUseNexttomovethroughtheprogramonelineatatimeAftereachNextyoucanholdyourcursor
7、overeachvariabletoseethevalueThisiscalledhoveringUsethistowatchthevaluesinfactorial,numberandstartnumberThisalwaysdisplaysthevariable’svalueatthecurrentlineofexecutionNoteStepwillmovedowntheprogram,onelineatatime.Itwillalsostepintofunctioncallsifthereareany.Nextwould
8、alsomovedownonelineatatime,butwouldskipfunctioncalls.FixingtheBugSo,what’sgoingwrong?LeaveDDDopenOpenthecodeinyourfavoriteeditor(fa
此文档下载收益归作者所有