资源描述:
《Debug_with_GDB.pdf》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、DebuggingwithgdbThegnuSource-LevelDebuggerNinthEdition,forgdbversion7.0.50.20100205PACKAGE(GDB)RichardStallman,RolandPesch,StanShebs,etal.(Sendbugsandcommentsongdbtohttp://www.gnu.org/software/gdb/bugs/.)DebuggingwithgdbTEXinfo2003-02-03.16PublishedbytheFreeSoftwa
2、reFoundation51FranklinStreet,FifthFloor,Boston,MA02110-1301,USAISBN1-882114-77-9Copyrightc1988,1989,1990,1991,1992,1993,1994,1995,1996,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010FreeSoftwareFoundation,Inc.Permissionisgrantedtocopy,distributean
3、d/ormodifythisdocumentunderthetermsoftheGNUFreeDocumentationLicense,Version1.1oranylaterversionpublishedbytheFreeSoftwareFoundation;withtheInvariantSectionsbeing“FreeSoftware”and“FreeSoftwareNeedsFreeDocumentation”,withtheFront-CoverTextsbeing“AGNUManual,”andwitht
4、heBack-CoverTextsasin(a)below.(a)TheFSF’sBack-CoverTextis:“YouarefreetocopyandmodifythisGNUMan-ual.BuyingcopiesfromGNUPresssupportstheFSFindevelopingGNUandpromotingsoftwarefreedom.”ThiseditionoftheGDBmanualisdedicatedtothememoryofFredFish.Fredwasalong-standingcont
5、ributortoGDBandtoFreesoftwareingeneral.Wewillmisshim.iTableofContentsiiDebuggingwithgdbSummaryofgdb1SummaryofgdbThepurposeofadebuggersuchasgdbistoallowyoutoseewhatisgoingon“inside”anotherprogramwhileitexecutes—orwhatanotherprogramwasdoingatthemomentitcrashed.gdbca
6、ndofourmainkindsofthings(plusotherthingsinsupportofthese)tohelpyoucatchbugsintheact:•Startyourprogram,specifyinganythingthatmightaffectitsbehavior.•Makeyourprogramstoponspecifiedconditions.•Examinewhathashappened,whenyourprogramhasstopped.•Changethingsinyourprogram,
7、soyoucanexperimentwithcorrectingtheeffectsofonebugandgoontolearnaboutanother.YoucanusegdbtodebugprogramswritteninCandC++.Formoreinformation,seehundefinedi[SupportedLanguages],pagehundefinedi.Formoreinformation,seehunde-finedi[CandC++],pagehundefinedi.SupportforModula-2
8、ispartial.ForinformationonModula-2,seehundefinedi[Modula-2],pagehundefinedi.DebuggingPascalprogramswhichusesets,subranges,filevariables,ornestedfunctionsdo