/
GDB QUICK REFERENCE GDB ersion Essen tial Commands gdb pr gr am or debug pr gr am using GDB QUICK REFERENCE GDB ersion Essen tial Commands gdb pr gr am or debug pr gr am using

GDB QUICK REFERENCE GDB ersion Essen tial Commands gdb pr gr am or debug pr gr am using - PDF document

phoebe-click
phoebe-click . @phoebe-click
Follow
665 views
Uploaded On 2014-11-13

GDB QUICK REFERENCE GDB ersion Essen tial Commands gdb pr gr am or debug pr gr am using - PPT Presentation

ermissions on bac Breakp oin ts and atc hp oin ts break 64257le line 64257le line set breakp oin at line um er in 64257le eg break mainc37 break 64257le func set breakp oin at func in 64257le break o64256set break o64256set set break at o64256set li ID: 11470

ermissions bac Breakp

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "GDB QUICK REFERENCE GDB ersion Essen tia..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

GDBQUICKREFERENCEGDBVersion4EssentialCommandsgdbprogram[core]debugprogram[usingcoredumpcore]b[ le:]functionsetbreakpointatfunction[in le]run[arglist]startyourprogram[witharglist]btbacktrace:displayprogramstackpexprdisplaythevalueofanexpressionccontinuerunningyourprogramnnextline,steppingoverfunctioncallssnextline,steppingintofunctioncallsStartingGDBgdbstartGDB,withnodebugging lesgdbprogrambegindebuggingprogramgdbprogramcoredebugcoredumpcoreproducedbyprogramgdb--helpdescribecommandlineoptionsStoppingGDBquitexitGDB;alsoqorEOF(egC-d)INTERRUPT(egC-c)terminatecurrentcommand,orsendtorunningprocessGettingHelphelplistclassesofcommandshelpclassone-linedescriptionsforcommandsinclasshelpcommanddescribecommandExecutingyourProgramrunargliststartyourprogramwitharglistrunstartyourprogramwithcurrentargumentlistrun:::inf�outfstartyourprogramwithinput,outputredirectedkillkillrunningprogramttydevusedevasstdinandstdoutfornextrunsetargsarglistspecifyarglistfornextrunsetargsspecifyemptyargumentlistshowargsdisplayargumentlistshowenvshowallenvironmentvariablesshowenvvarshowvalueofenvironmentvariablevarsetenvvarstringsetenvironmentvariablevarunsetenvvarremovevarfromenvironmentShellCommandscddirchangeworkingdirectorytodirpwdPrintworkingdirectorymake:::call\make"shellcmdexecutearbitraryshellcommandstring[]surroundoptionalarguments:::showoneormoreargumentsc\r1998FreeSoftwareFoundation,Inc.PermissionsonbackBreakpointsandWatchpointsbreak[ le:]lineb[ le:]linesetbreakpointatlinenumber[in le]eg:breakmain.c:37break[ le:]funcsetbreakpointatfunc[in le]break+o setbreak-o setsetbreakato setlinesfromcurrentstopbreak*addrsetbreakpointataddressaddrbreaksetbreakpointatnextinstructionbreak:::ifexprbreakconditionallyonnonzeroexprcondn[expr]newconditionalexpressiononbreakpointn;makeunconditionalifnoexprtbreak:::temporarybreak;disablewhenreachedrbreakregexbreakonallfunctionsmatchingregexwatchexprsetawatchpointforexpressionexprcatcheventbreakatevent,whichmaybecatch,throw,exec,fork,vfork,load,orunload.infobreakshowde nedbreakpointsinfowatchshowde nedwatchpointscleardeletebreakpointsatnextinstructionclear[ le:]fundeletebreakpointsatentrytofun()clear[ le:]linedeletebreakpointsonsourcelinedelete[n]deletebreakpoints[orbreakpointn]disable[n]disablebreakpoints[orbreakpointn]enable[n]enablebreakpoints[orbreakpointn]enableonce[n]enablebreakpoints[orbreakpointn];disableagainwhenreachedenabledel[n]enablebreakpoints[orbreakpointn];deletewhenreachedignorencountignorebreakpointn,counttimescommandsn[silent]command-listexecuteGDBcommand-listeverytimebreakpointnisreached.[silentsuppressesdefaultdisplay]endendofcommand-listProgramStackbacktrace[n]bt[n]printtraceofallframesinstack;orofnframes|innermostifn�0,outermostifnframe[n]selectframenumbernorframeataddressn;ifnon,displaycurrentframeupnselectframenframesupdownnselectframenframesdowninfoframe[addr]describeselectedframe,orframeataddrinfoargsargumentsofselectedframeinfolocalslocalvariablesofselectedframeinforeg[rn]:::infoall-reg[rn]registervalues[forregsrn]inselectedframe;all-regincludes\roatingpointExecutionControlcontinue[count]c[count]continuerunning;ifcountspeci ed,ignorethisbreakpointnextcounttimesstep[count]s[count]executeuntilanotherlinereached;repeatcounttimesifspeci edstepi[count]si[count]stepbymachineinstructionsratherthansourcelinesnext[count]n[count]executenextline,includinganyfunctioncallsnexti[count]ni[count]nextmachineinstructionratherthansourcelineuntil[location]rununtilnextinstruction(orlocation)finishrununtilselectedstackframereturnsreturn[expr]popselectedstackframewithoutexecuting[settingreturnvalue]signalnumresumeexecutionwithsignals(noneif0)jumplinejump*addressresumeexecutionatspeci edlinenumberoraddresssetvar=exprevaluateexprwithoutdisplayingit;useforalteringprogramvariablesDisplayprint[/f][expr]p[/f][expr]showvalueofexpr[orlastvalue$]accordingtoformatf:xhexadecimaldsigneddecimaluunsigneddecimalooctaltbinaryaaddress,absoluteandrelativeccharacterf\roatingpointcall[/f]exprlikeprintbutdoesnotdisplayvoidx[/Nuf]exprexaminememoryataddressexpr;optionalformatspecfollowsslashNcountofhowmanyunitstodisplayuunitsize;oneofbindividualbyteshhalfwords(twobytes)wwords(fourbytes)ggiantwords(eightbytes)fprintingformat.Anyprintformat,orsnull-terminatedstringimachineinstructionsdisassem[addr]displaymemoryasmachineinstructionsAutomaticDisplaydisplay[/f]exprshowvalueofexpreachtimeprogramstops[accordingtoformatf]displaydisplayallenabledexpressionsonlistundisplaynremovenumber(s)nfromlistofautomaticallydisplayedexpressionsdisabledispndisabledisplayforexpression(s)numbernenabledispnenabledisplayforexpression(s)numberninfodisplaynumberedlistofdisplayexpressions ExpressionsexpranexpressioninC,C++,orModula-2(includingfunctioncalls),or:addr@lenanarrayoflenelementsbeginningataddr le::nmavariableorfunctionnmde nedin leftypegaddrreadmemoryataddrasspeci edtype$mostrecentdisplayedvalue$nnthdisplayedvalue$$displayedvaluepreviousto$$$nnthdisplayedvaluebackfrom$$lastaddressexaminedwithx$valueataddress$$varconveniencevariable;assignanyvalueshowvalues[n]showlast10values[orsurrounding$n]showconvdisplayallconveniencevariablesSymbolTableinfoaddresssshowwheresymbolsisstoredinfofunc[regex]shownames,typesofde nedfunctions(all,ormatchingregex)infovar[regex]shownames,typesofglobalvariables(all,ormatchingregex)whatis[expr]ptype[expr]showdatatypeofexpr[or$]withoutevaluating;ptypegivesmoredetailptypetypedescribetype,struct,union,orenumGDBScriptssourcescriptread,executeGDBcommandsfrom lescriptdefinecmdcommand-listcreatenewGDBcommandcmd;executescriptde nedbycommand-listendendofcommand-listdocumentcmdhelp-textcreateonlinedocumentationfornewGDBcommandcmdendendofhelp-textSignalshandlesignalactspecifyGDBactionsforsignal:printannouncesignalnoprintbesilentforsignalstophaltexecutiononsignalnostopdonothaltexecutionpassallowyourprogramtohandlesignalnopassdonotallowyourprogramtoseesignalinfosignalsshowtableofsignals,GDBactionforeachDebuggingTargetstargettypeparamconnecttotargetmachine,process,or lehelptargetdisplayavailabletargetsattachparamconnecttoanotherprocessdetachreleasetargetfromGDBcontrolControllingGDBsetparamvaluesetoneofGDB'sinternalparametersshowparamdisplaycurrentsettingofparameterParametersunderstoodbysetandshow:complaintlimitnumberofmessagesonunusualsymbolsconfirmon/o enableordisablecautionaryquerieseditingon/o controlreadlinecommand-lineeditingheightlppnumberoflinesbeforepauseindisplaylanguagelangLanguageforGDBexpressions(auto,cormodula-2)listsizennumberoflinesshownbylistpromptstrusestrasGDBpromptradixbaseoctal,decimal,orhexnumberrepresentationverboseon/o controlmessageswhenloadingsymbolswidthcplnumberofcharactersbeforelinefoldedwriteon/o Alloworforbidpatchingbinary,core les(whenreopenedwithexecorcore)history:::h:::groupswiththefollowingoptions:hexpo /ondisable/enablereadlinehistoryexpansionhfile lename leforrecordingGDBcommandhistoryhsizesizenumberofcommandskeptinhistorylisthsaveo /oncontroluseofexternal leforcommandhistoryprint:::p:::groupswiththefollowingoptions:paddresson/o printmemoryaddressesinstacks,valuesparrayo /oncompactorattractiveformatforarrayspdemanglon/o source(demangled)orinternalformforC++symbolspasm-demon/o demangleC++symbolsinmachine-instructionoutputpelementslimitnumberofarrayelementstodisplaypobjecton/o printC++derivedtypesforobjectspprettyo /onstructdisplay:compactorindentedpunionon/o displayofunionmemberspvtblo /ondisplayofC++virtualfunctiontablesshowcommandsshowlast10commandsshowcommandsnshow10commandsaroundnumbernshowcommands+shownext10commandsWorkingFilesfile[ le]use leforbothsymbolsandexecutable;withnoarg,discardbothcore[ le]read leascoredump;ordiscardexec[ le]use leasexecutableonly;ordiscardsymbol[ le]usesymboltablefrom le;ordiscardload ledynamicallylink leandadditssymbolsadd-sym leaddrreadadditionalsymbolsfrom le,dynamicallyloadedataddrinfofilesdisplayworking lesandtargetsinusepathdirsadddirstofrontofpathsearchedforexecutableandsymbol lesshowpathdisplayexecutableandsymbol lepathinfosharelistnamesofsharedlibrariescurrentlyloadedSourceFilesdirnamesadddirectorynamestofrontofsourcepathdirclearsourcepathshowdirshowcurrentsourcepathlistshownexttenlinesofsourcelist-showprevioustenlineslistlinesdisplaysourcesurroundinglines,speci edas:[ le:]numlinenumber[innamed le][ le:]functionbeginningoffunction[innamed le]+o o linesafterlastprinted-o o linesprevioustolastprinted*addresslinecontainingaddresslistf,lfromlineftolinelinfolinenumshowstarting,endingaddressesofcompiledcodeforsourcelinenuminfosourceshownameofcurrentsource leinfosourceslistallsource lesinuseforwregexsearchfollowingsourcelinesforregexrevregexsearchprecedingsourcelinesforregexGDBunderGNUEmacsM-xgdbrunGDBunderEmacsC-hmdescribeGDBmodeM-ssteponeline(step)M-nnextline(next)M-isteponeinstruction(stepi)C-cC-f nishcurrentstackframe(finish)M-ccontinue(cont)M-uupargframes(up)M-ddownargframes(down)C-x©numberfrompoint,insertatendC-xSPC(insource le)setbreakatpointGDBLicenseshowcopyingDisplayGNUGeneralPublicLicenseshowwarrantyThereisNOWARRANTYforGDB.Displayfullno-warrantystatement.Copyrightc\r1991,'92,'93,'98FreeSoftwareFoundation,Inc.RolandH.PeschTheauthorassumesnoresponsibilityforanyerrorsonthiscard.ThiscardmaybefreelydistributedunderthetermsoftheGNUGeneralPublicLicense.Pleasecontributetodevelopmentofthiscardbyannotatingit.Improvementscanbesenttobug-gdb@gnu.org.GDBitselfisfreesoftware;youarewelcometodistributecopiesofitunderthetermsoftheGNUGeneralPublicLicense.ThereisabsolutelynowarrantyforGDB.