关闭

关闭

关闭

封号提示

内容

首页 Debugging+with+GDB.pdf

Debugging+with+GDB.pdf

Debugging+with+GDB.pdf

上传者: 惊鸿游龙 2010-12-18 评分 0 0 0 0 0 0 暂无简介 简介 举报

简介:本文档为《Debugging+with+GDBpdf》,可适用于IT/计算机领域,主题内容包含DebuggingwithGDBDebuggingwithGDBTheGNUSourceLevelDebuggerNinthEdition,forG符等。

DebuggingwithGDBDebuggingwithGDBTheGNUSourceLevelDebuggerNinthEdition,forGDBversionJanuaryRichardStallman,RolandPesch,StanShebs,etalTableofContentslSummaryofGDBmFreesoftwaremFreeSoftwareNeedsFreeDocumentationmContributorstoGDBlASampleGDBSessionlGettingInandOutofGDBmInvokingGDBnChoosingfilesnChoosingmodesmQuittingGDBmShellcommandslGDBCommandsmCommandsyntaxmCommandcompletionmGettinghelplRunningProgramsUnderGDBmCompilingfordebuggingmStartingyourprogrammYourprogram'sargumentsmYourprogram'senvironmentmYourprogram'sworkingdirectorymYourprogram'sinputandoutputfile:C|gdbhtml(of)::DebuggingwithGDBmDebugginganalreadyrunningprocessmKillingthechildprocessmDebuggingprogramswithmultiplethreadsmDebuggingprogramswithmultipleprocesseslStoppingandContinuingmBreakpoints,watchpoints,andcatchpointsnSettingbreakpointsnSettingwatchpointsnSettingcatchpointsnDeletingbreakpointsnDisablingbreakpointsnBreakconditionsnBreakpointcommandlistsnBreakpointmenusn"Cannotinsertbreakpoints"mContinuingandsteppingmSignalsmStoppingandstartingmultithreadprogramslExaminingtheStackmStackframesmBacktracesmSelectingaframemInformationaboutaframelExaminingSourceFilesmPrintingsourcelinesmSearchingsourcefilesmSpecifyingsourcedirectoriesmSourceandmachinecodelExaminingDatamExpressionsmProgramvariablesmArtificialarraysmOutputformatsmExaminingmemorymAutomaticdisplaymPrintsettingsmValuehistorymConveniencevariablesfile:C|gdbhtml(of)::DebuggingwithGDBmRegistersmFloatingpointhardwaremMemoryRegionAttributesnAttributesnMemoryAccessModenMemoryAccessSizenDataCachelTracepointsmCommandstoSetTracepointsnCreateandDeleteTracepointsnEnableandDisableTracepointsnTracepointPasscountsnTracepointActionListsnListingTracepointsnStartingandStoppingTraceExperimentmUsingthecollecteddatantfindnntdumpnsavetracepointsfilenamemConvenienceVariablesforTracepointslUsingGDBwithDifferentLanguagesmSwitchingbetweensourcelanguagesnListoffilenameextensionsandlanguagesnSettingtheworkinglanguagenHavingGDBinferthesourcelanguagemDisplayingthelanguagemTypeandrangecheckingnAnoverviewoftypecheckingnAnoverviewofrangecheckingmSupportedlanguagesnCandCnCandCoperatorsnCandCconstantsnCexpressionsnCandCdefaultsnCandCtypeandrangechecksnGDBandCnGDBfeaturesforCfile:C|gdbhtml(of)::DebuggingwithGDBnModulanOperatorsnBuiltinfunctionsandproceduresnConstantsnModuladefaultsnDeviationsfromstandardModulanModulatypeandrangechecksnThescopeoperators::andnGDBandModulanChillnHowmodesaredisplayednLocationsandtheiraccessesnValuesandtheirOperationsnChilltypeandrangechecksnChilldefaultslExaminingtheSymbolTablelAlteringExecutionmAssignmenttovariablesmContinuingatadifferentaddressmGivingyourprogramasignalmReturningfromafunctionmCallingprogramfunctionsmPatchingprogramslGDBFilesmCommandstospecifyfilesmErrorsreadingsymbolfileslSpecifyingaDebuggingTargetmActivetargetsmCommandsformanagingtargetsmChoosingtargetbyteordermRemotedebuggingnTheGDBremoteserialprotocolnWhatthestubcandoforyounWhatyoumustdoforthestubnPuttingitalltogethernCommunicationprotocolnUsingthegdbserverprogramnUsingthegdbservenlmprogramfile:C|gdbhtml(of)::DebuggingwithGDBmKernelObjectDisplaylConfigurationSpecificInformationmNativenHPUXnSVRprocessinformationnFeaturesforDebuggingDJGPPProgramsmEmbeddedOperatingSystemsnUsingGDBwithVxWorksnConnectingtoVxWorksnVxWorksdownloadnRunningtasksmEmbeddedProcessorsnAMDAKEmbeddednAKUDInEBMONprotocolforAMDKnCommunicationssetupnEBKcrossdebuggingnRemotelognARMnHitachiHnConnectingtoHitachiboardsnUsingtheEincircuitemulatornSpecialGDBcommandsforHitachimicrosnHnIntelinStartupwithNindynOptionsforNindynNindyresetcommandnMitsubishiMRDnMknMKnMIPSEmbeddednPowerPCnHPPAEmbeddednHitachiSHnTsqwareSparcletnSettingfiletodebugnConnectingtoSparcletfile:C|gdbhtml(of)::DebuggingwithGDBnSparcletdownloadnRunninganddebuggingnFujitsuSparclitenTandemSTnZilogZmArchitecturesnAKnAlphanMIPSlControllingGDBmPromptmCommandeditingmCommandhistorymScreensizemNumbersmOptionalwarningsandmessagesmOptionalmessagesaboutinternalhappeningslCannedSequencesofCommandsmUserdefinedcommandsmUserdefinedcommandhooksmCommandfilesmCommandsforcontrolledoutputlGDBTextUserInterfacemTUIoverviewmTUIKeyBindingsmTUIspecificcommandsmTUIconfigurationvariableslUsingGDBunderGNUEmacslGDBAnnotationsmWhatisanAnnotationmTheServerPrefixmValuesmFramesmDisplaysmAnnotationforGDBInputmErrorsmInformationonBreakpointsmInvalidationNoticesfile:C|gdbhtml(of)::DebuggingwithGDBmRunningtheProgrammDisplayingSourcemAnnotationsWeMightWantintheFuturelTheGDBMIInterfacemFunctionandPurposemNotationandTerminologymGDBMICommandSyntaxnGDBMIInputSyntaxnGDBMIOutputSyntaxnSimpleExamplesofGDBMIInteractionmGDBMICompatibilitywithCLImGDBMIOutputRecordsnGDBMIResultRecordsnGDBMIStreamRecordsnGDBMIOutofbandRecordsmGDBMICommandDescriptionFormatmGDBMIBreakpointtablecommandsmGDBMIDataManipulationmGDBMIProgramcontrolmMiscellaneousGDBcommandsinGDBMImGDBMIStackManipulationCommandsmGDBMISymbolQueryCommandsmGDBMITargetManipulationCommandsmGDBMIThreadCommandsmGDBMITracepointCommandsmGDBMIVariableObjectslReportingBugsinGDBmHaveyoufoundabugmHowtoreportbugslCommandLineEditingmIntroductiontoLineEditingmReadlineInteractionnReadlineBareEssentialsnReadlineMovementCommandsnReadlineKillingCommandsnReadlineArgumentsnSearchingforCommandsintheHistorymReadlineInitFilefile:C|gdbhtml(of)::DebuggingwithGDBnReadlineInitFileSyntaxnConditionalInitConstructsnSampleInitFilemBindableReadlineCommandsnCommandsForMovingnCommandsForManipulatingTheHistorynCommandsForChangingTextnKillingAndYankingnSpecifyingNumericArgumentsnLettingReadlineTypeForYounKeyboardMacrosnSomeMiscellaneousCommandsmReadlineviModelUsingHistoryInteractivelymHistoryExpansionnEventDesignatorsnWordDesignatorsnModifierslFormattingDocumentationlInstallingGDBmCompilingGDBinanotherdirectorymSpecifyingnamesforhostsandtargetsmconfigureoptionslGNUFreeDocumentationLicensemADDENDUM:HowtousethisLicenseforyourdocumentslIndexdircategoryProgrammingdevelopmenttools*Gdb:(gdb)TheGNUdebuggerCopyright(C),,,,,,,,,,,,,FreeSoftwareFoundation,IncPublishedbytheFreeSoftwareFoundationTemplePlaceSuite,Boston,MAUSAISBNPermissionisgrantedtocopy,distributeandormodifythisdocumentunderthetermsoftheGNUFreeDocumentationLicense,VersionoranylaterversionpublishedbytheFreeSoftwareFoundationwiththeInvariantSectionsbeing"FreeSoftware"and"FreeSoftwareNeedsFreeDocumentation",withfile:C|gdbhtml(of)::DebuggingwithGDBtheFrontCoverTextsbeing"AGNUManual,"andwiththeBackCoverTextsasin(a)below(a)TheFreeSoftwareFoundation'sBackCoverTextis:"YouhavefreedomtocopyandmodifythisGNUManual,likeGNUsoftwareCopiespublishedbytheFreeSoftwareFoundationraisefundsforGNUdevelopment"nodeToptopDebuggingwithvalue{GDBN}Thisfiledescribesvalue{GDBN},thesc{gnu}symbolicdebuggerThisisthevalue{EDITION}Edition,value{DATE},forvalue{GDBN}Versionvalue{GDBVN}Copyright(C)FreeSoftwareFoundation,Incmenu*Summary::Summaryofvalue{GDBN}*SampleSession::Asamplevalue{GDBN}session*Invocation::Gettinginandoutofvalue{GDBN}*Commands::value{GDBN}commands*Running::Runningprogramsundervalue{GDBN}*Stopping::Stoppingandcontinuing*Stack::Examiningthestack*Source::Examiningsourcefiles*Data::Examiningdata*Languages::Usingvalue{GDBN}withdifferentlanguages*Symbols::Examiningthesymboltable*Altering::Alteringexecution*GDBFiles::value{GDBN}files*Targets::Specifyingadebuggingtarget*Configurations::Configurationspecificinformation*ControllingGDB::Controllingvalue{GDBN}*Sequences::Cannedsequencesofcommands*Emacs::Usingvalue{GDBN}undersc{gnu}Emacs*Annotations::value{GDBN}'sannotationinterface*GDBBugs::Reportingbugsinvalue{GDBN}*FormattingDocumentation::Howtoformatandprintvalue{GDBN}documentation*CommandLineEditing::CommandLineEditing*UsingHistoryInteractively::UsingHistoryInteractively*InstallingGDB::InstallingGDB*GNUFreeDocumentationLicense::Thelicenseforthisdocumentation*Index::IndexendmenuSummaryofGDBThepurposeofadebuggersuchasGDBistoallowyoutoseewhatisgoingon"inside"anotherprogramwhileitexecutesorwhatanotherprogramwasdoingatthemomentitcrashedGDBcandofourmainkindsofthings(plusotherthingsinsupportofthese)tohelpyoucatchbugsintheact:lStartyourprogram,specifyinganythingthatmightaffectitsbehaviorlMakeyourprogramstoponspecifiedconditionslExaminewhathashappened,whenyourprogramhasstoppedlChangethingsinyourprogram,soyoucanexperimentwithcorrectingtheeffectsofonebugandgoontolearnaboutanotherYoucanuseGDBtodebugprogramswritteninCandCFormoreinformation,seesectionSupportedlanguagesFormoreinformation,seesectionCandCSupportforModulaandChillispartialForinformationonModula,seesectionModulaForinformationonChill,seesectionChillfile:C|gdbhtml(of)::DebuggingwithGDBDebuggingPascalprogramswhichusesets,subranges,filevariables,ornestedfunctionsdoesnotcurrentlyworkGDBdoesnotsupportenteringexpressions,printingvalues,orsimilarfeaturesusingPascalsyntaxGDBcanbeusedtodebugprogramswritteninFortran,althoughitmaybenecessarytorefertosomevariableswithatrailingunderscorelFreeSoftware:FreelyredistributablesoftwarelContributors:ContributorstoGDBFreesoftwareGDBisfreesoftware,protectedbytheGNUGeneralPublicLicense(GPL)TheGPLgivesyouthefreedomtocopyoradaptalicensedprogrambuteverypersongettingacopyalsogetswithitthefreedomtomodifythatcopy(whichmeansthattheymustgetaccesstothesourcecode),andthefreedomtodistributefurthercopiesTypicalsoftwarecompaniesusecopyrightstolimityourfreedomstheFreeSoftwareFoundationusestheGPLtopreservethesefreedomsFundamentally,theGeneralPublicLicenseisalicensewhichsaysthatyouhavethesefreedomsandthatyoucannottakethesefreedomsawayfromanyoneelseFreeSoftwareNeedsFreeDocumentationThebiggestdeficiencyinthefreesoftwarecommunitytodayisnotinthesoftwareitisthelackofgoodfreedocumentationthatwecanincludewiththefreesoftwareManyofourmostimportantprogramsdonotcomewithfreereferencemanualsandfreeintroductorytextsDocumentationisanessentialpartofanysoftwarepackagewhenanimportantfreesoftwarepackagedoesnotcomewithafreemanualandafreetutorial,thatisamajorgapWehavemanysuchgapstodayConsiderPerl,forinstanceThetutorialmanualsthatpeoplenormallyusearenonfreeHowdidthiscomeaboutBecausetheauthorsofthosemanualspublishedthemwithrestrictivetermsnocopying,nomodification,sourcefilesnotavailablewhichexcludethemfromthefreesoftwareworldThatwasn'tthefirsttimethissortofthinghappened,anditwasfarfromthelastManytimeswehaveheardaGNUusereagerlydescribeamanualthatheiswriting,hisintendedcontributiontothecommunity,onlytolearnthathehadruinedeverythingbysigningapublicationcontracttomakeitnonfreeFreedocumentation,likefreesoftware,isamatteroffreedom,notpriceTheproblemwiththenonfreemanualisnotthatpublisherschargeapriceforprintedcopiesthatinitselfisfine(TheFreeSoftwareFoundationsellsprintedcopiesofmanuals,too)Theproblemistherestrictionsontheuseofthefile:C|gdbhtml(of)::DebuggingwithGDBmanualFreemanualsareavailableinsourcecodeform,andgiveyoupermissiontocopyandmodifyNonfreemanualsdonotallowthisThecriteriaoffreedomforafreemanualareroughlythesameasforfreesoftwareRedistribution(includingthenormalkindsofcommercialredistribution)mustbepermitted,sothatthemanualcanaccompanyeverycopyoftheprogram,bothonlineandonpaperPermissionformodificationofthetechnicalcontentiscrucialtooWhenpeoplemodifythesoftware,addingorchangingfeatures,iftheyareconscientioustheywillchangethemanualtoosotheycanprovideaccurateandcleardocumentationforthemodifiedprogramAmanualthatleavesyounochoicebuttowriteanewmanualtodocumentachangedversionoftheprogramisnotreallyavailabletoourcommunitySomekindsoflimitsonthewaymodificationishandledareacceptableForexample,requirementstopreservetheoriginalauthor'scopyrightnotice,thedistributionterms,orthelistofauthors,areokItisalsonoproblemtorequiremodifiedversionstoincludenoticethattheyweremodifiedEvenentiresectionsthatmaynotbedeletedorchangedareacceptable,aslongastheydealwithnontechnicaltopics(likethisone)Thesekindsofrestrictionsareacceptablebecausetheydon'tobstructthecommunity'snormaluseofthemanualHowever,itmustbepossibletomodifyallthetechnicalcontentofthemanual,andthendistributetheresultinalltheusualmedia,throughalltheusualchannelsOtherwise,therestrictionsobstructtheuseofthemanual,itisnotfree,andweneedanothermanualtoreplaceitPleasespreadthewordaboutthisissueOurcommunitycontinuestolosemanualstoproprietarypublishingIfwespreadthewordthatfreesoftwareneedsfreereferencemanualsandfreetutorials,perhapsthenextpersonwhowantstocontributebywritingdocumentationwillrealize,beforeitistoolate,thatonlyfreemanualscontributetothefreesoftwarecommunityIfyouarewritingdocumentation,pleaseinsistonpublishingitundertheGNUFreeDocumentationLicenseoranotherfreedocumentationlicenseRememberthatthisdecisionrequiresyourapprovalyoudon'thavetoletthepublisherdecideSomecommercialpublisherswilluseafreelicenseifyouinsist,buttheywillnotproposetheoptionitisuptoyoutoraisetheissueandsayfirmlythatthisiswhatyouwantIfthepublisheryouaredealingwithrefuses,pleasetryotherpublishersIfyou'renotsurewhetheraproposedlicenseisfree,writetolicensinggnuorgYoucanencouragecommercialpublisherstosellmorefree,copyleftedmanualsandtutorialsbybuyingthem,andparticularlybybuyingcopiesfromthepublishersthatpaidfortheirwritingorformajorimprovementsMeanwhile,trytoavoidbuyingnonfreedocumentationatallCheckthedistributiontermsofamanualbeforeyoubuyit,andinsistthatwhoeverseeksyourbusinessmustrespectyourfreedomCheckthehistoryofthebook,andtrytorewardthepublishersthathavepaidorpaytheauthorstoworkonitfile:C|gdbhtml(of)::DebuggingwithGDBTheFreeSoftwareFoundationmaintainsalistoffreedocumentationpublishedbyotherpublishers,athttp:wwwfsforgdocotherfreebookshtmlContributorstoGDBRichardStallmanwastheoriginalauthorofGDB,andofmanyotherGNUprogramsManyothershavecontributedtoitsdevelopmentThissectionattemptstocreditmajorcontributorsOneofthevirtuesoffreesoftwareisthateveryoneisfreetocontributetoitwithregret,wecannotactuallyacknowledgeeveryonehereThefile`ChangeLog'intheGDBdistributionapproximatesablowbyblowaccountChangesmuchpriortoversionarelostinthemistsoftimePlea:AdditionstothissectionareparticularlywelcomeIfyouoryourfriends(orenemies,tobeevenhanded)havebeenunfairlyomittedfromthislist,wewouldliketoaddyournames!Sothattheymaynotregardtheirmanylaborsasthankless,weparticularlythankthosewhoshepherdedGDBthroughmajorreleases:AndrewCagney(releasesand)JimBlandy(release)JasonMolenda(release)StanShebs(release)FredFish(releases,,,,,,and)StuGrossmanandJohnGilmore(releases,,,,and)JohnGilmore(releases,,,,and)JimKingdon(releases,,and)andRandySmith(releases,,and)RichardStallman,assistedatvarioustimesbyPeterTerMaat,ChrisHanson,andRichardMlynarik,handledreleasesthroughMichaelTiemannistheauthorofmostoftheGNUCsupportinGDB,withsignificantadditionalcontributionsfromPerBothnerandDanielBerlinJamesClarkwrotetheGNUCdemanglerEarlyworkonCwasbyPeterTerMaat(whoalsodidmuchgeneralupdateworkleadingtorelease)GDBusestheBFDsubroutinelibraryto

用户评论(0)

0/200

精彩专题

上传我的资料

每篇奖励 +2积分

资料评价:

/49
仅支持在线阅读

意见
反馈

立即扫码关注

爱问共享资料微信公众号

返回
顶部