You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 3 година
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303
  1. This is gdb.info, produced by makeinfo version 6.5 from gdb.texinfo.
  2. Copyright (C) 1988-2020 Free Software Foundation, Inc.
  3. Permission is granted to copy, distribute and/or modify this document
  4. under the terms of the GNU Free Documentation License, Version 1.3 or
  5. any later version published by the Free Software Foundation; with the
  6. Invariant Sections being "Free Software" and "Free Software Needs Free
  7. Documentation", with the Front-Cover Texts being "A GNU Manual," and
  8. with the Back-Cover Texts as in (a) below.
  9. (a) The FSF's Back-Cover Text is: "You are free to copy and modify
  10. this GNU Manual. Buying copies from GNU Press supports the FSF in
  11. developing GNU and promoting software freedom."
  12. INFO-DIR-SECTION Software development
  13. START-INFO-DIR-ENTRY
  14. * Gdb: (gdb). The GNU debugger.
  15. * gdbserver: (gdb) Server. The GNU debugging server.
  16. END-INFO-DIR-ENTRY
  17. This file documents the GNU debugger GDB.
  18. This is the Tenth Edition, of 'Debugging with GDB: the GNU
  19. Source-Level Debugger' for GDB (GNU Arm Embedded Toolchain
  20. 10-2020-q4-major) Version 10.1.90.20201028-git.
  21. Copyright (C) 1988-2020 Free Software Foundation, Inc.
  22. Permission is granted to copy, distribute and/or modify this document
  23. under the terms of the GNU Free Documentation License, Version 1.3 or
  24. any later version published by the Free Software Foundation; with the
  25. Invariant Sections being "Free Software" and "Free Software Needs Free
  26. Documentation", with the Front-Cover Texts being "A GNU Manual," and
  27. with the Back-Cover Texts as in (a) below.
  28. (a) The FSF's Back-Cover Text is: "You are free to copy and modify
  29. this GNU Manual. Buying copies from GNU Press supports the FSF in
  30. developing GNU and promoting software freedom."
  31. 
  32. File: gdb.info, Node: Top, Next: Summary
  33. Debugging with GDB
  34. ******************
  35. This file describes GDB, the GNU symbolic debugger.
  36. This is the Tenth Edition, for GDB (GNU Arm Embedded Toolchain
  37. 10-2020-q4-major) Version 10.1.90.20201028-git.
  38. Copyright (C) 1988-2020 Free Software Foundation, Inc.
  39. This edition of the GDB manual is dedicated to the memory of Fred
  40. Fish. Fred was a long-standing contributor to GDB and to Free software
  41. in general. We will miss him.
  42. * Menu:
  43. * Summary:: Summary of GDB
  44. * Sample Session:: A sample GDB session
  45. * Invocation:: Getting in and out of GDB
  46. * Commands:: GDB commands
  47. * Running:: Running programs under GDB
  48. * Stopping:: Stopping and continuing
  49. * Reverse Execution:: Running programs backward
  50. * Process Record and Replay:: Recording inferior's execution and replaying it
  51. * Stack:: Examining the stack
  52. * Source:: Examining source files
  53. * Data:: Examining data
  54. * Optimized Code:: Debugging optimized code
  55. * Macros:: Preprocessor Macros
  56. * Tracepoints:: Debugging remote targets non-intrusively
  57. * Overlays:: Debugging programs that use overlays
  58. * Languages:: Using GDB with different languages
  59. * Symbols:: Examining the symbol table
  60. * Altering:: Altering execution
  61. * GDB Files:: GDB files
  62. * Targets:: Specifying a debugging target
  63. * Remote Debugging:: Debugging remote programs
  64. * Configurations:: Configuration-specific information
  65. * Controlling GDB:: Controlling GDB
  66. * Extending GDB:: Extending GDB
  67. * Interpreters:: Command Interpreters
  68. * TUI:: GDB Text User Interface
  69. * Emacs:: Using GDB under GNU Emacs
  70. * GDB/MI:: GDB's Machine Interface.
  71. * Annotations:: GDB's annotation interface.
  72. * JIT Interface:: Using the JIT debugging interface.
  73. * In-Process Agent:: In-Process Agent
  74. * GDB Bugs:: Reporting bugs in GDB
  75. * Command Line Editing:: Command Line Editing
  76. * Using History Interactively:: Using History Interactively
  77. * In Memoriam:: In Memoriam
  78. * Formatting Documentation:: How to format and print GDB documentation
  79. * Installing GDB:: Installing GDB
  80. * Maintenance Commands:: Maintenance Commands
  81. * Remote Protocol:: GDB Remote Serial Protocol
  82. * Agent Expressions:: The GDB Agent Expression Mechanism
  83. * Target Descriptions:: How targets can describe themselves to
  84. GDB
  85. * Operating System Information:: Getting additional information from
  86. the operating system
  87. * Trace File Format:: GDB trace file format
  88. * Index Section Format:: .gdb_index section format
  89. * Man Pages:: Manual pages
  90. * Copying:: GNU General Public License says
  91. how you can copy and share GDB
  92. * GNU Free Documentation License:: The license for this documentation
  93. * Concept Index:: Index of GDB concepts
  94. * Command and Variable Index:: Index of GDB commands, variables,
  95. functions, and Python data types
  96. 
  97. File: gdb.info, Node: Summary, Next: Sample Session, Up: Top
  98. Summary of GDB
  99. **************
  100. The purpose of a debugger such as GDB is to allow you to see what is
  101. going on "inside" another program while it executes--or what another
  102. program was doing at the moment it crashed.
  103. GDB can do four main kinds of things (plus other things in support of
  104. these) to help you catch bugs in the act:
  105. * Start your program, specifying anything that might affect its
  106. behavior.
  107. * Make your program stop on specified conditions.
  108. * Examine what has happened, when your program has stopped.
  109. * Change things in your program, so you can experiment with
  110. correcting the effects of one bug and go on to learn about another.
  111. You can use GDB to debug programs written in C and C++. For more
  112. information, see *note Supported Languages: Supported Languages. For
  113. more information, see *note C and C++: C.
  114. Support for D is partial. For information on D, see *note D: D.
  115. Support for Modula-2 is partial. For information on Modula-2, see
  116. *note Modula-2: Modula-2.
  117. Support for OpenCL C is partial. For information on OpenCL C, see
  118. *note OpenCL C: OpenCL C.
  119. Debugging Pascal programs which use sets, subranges, file variables,
  120. or nested functions does not currently work. GDB does not support
  121. entering expressions, printing values, or similar features using Pascal
  122. syntax.
  123. GDB can be used to debug programs written in Fortran, although it may
  124. be necessary to refer to some variables with a trailing underscore.
  125. GDB can be used to debug programs written in Objective-C, using
  126. either the Apple/NeXT or the GNU Objective-C runtime.
  127. * Menu:
  128. * Free Software:: Freely redistributable software
  129. * Free Documentation:: Free Software Needs Free Documentation
  130. * Contributors:: Contributors to GDB
  131. 
  132. File: gdb.info, Node: Free Software, Next: Free Documentation, Up: Summary
  133. Free Software
  134. =============
  135. GDB is "free software", protected by the GNU General Public License
  136. (GPL). The GPL gives you the freedom to copy or adapt a licensed
  137. program--but every person getting a copy also gets with it the freedom
  138. to modify that copy (which means that they must get access to the source
  139. code), and the freedom to distribute further copies. Typical software
  140. companies use copyrights to limit your freedoms; the Free Software
  141. Foundation uses the GPL to preserve these freedoms.
  142. Fundamentally, the General Public License is a license which says
  143. that you have these freedoms and that you cannot take these freedoms
  144. away from anyone else.
  145. 
  146. File: gdb.info, Node: Free Documentation, Next: Contributors, Prev: Free Software, Up: Summary
  147. Free Software Needs Free Documentation
  148. ======================================
  149. The biggest deficiency in the free software community today is not in
  150. the software--it is the lack of good free documentation that we can
  151. include with the free software. Many of our most important programs do
  152. not come with free reference manuals and free introductory texts.
  153. Documentation is an essential part of any software package; when an
  154. important free software package does not come with a free manual and a
  155. free tutorial, that is a major gap. We have many such gaps today.
  156. Consider Perl, for instance. The tutorial manuals that people
  157. normally use are non-free. How did this come about? Because the
  158. authors of those manuals published them with restrictive terms--no
  159. copying, no modification, source files not available--which exclude them
  160. from the free software world.
  161. That wasn't the first time this sort of thing happened, and it was
  162. far from the last. Many times we have heard a GNU user eagerly describe
  163. a manual that he is writing, his intended contribution to the community,
  164. only to learn that he had ruined everything by signing a publication
  165. contract to make it non-free.
  166. Free documentation, like free software, is a matter of freedom, not
  167. price. The problem with the non-free manual is not that publishers
  168. charge a price for printed copies--that in itself is fine. (The Free
  169. Software Foundation sells printed copies of manuals, too.) The problem
  170. is the restrictions on the use of the manual. Free manuals are
  171. available in source code form, and give you permission to copy and
  172. modify. Non-free manuals do not allow this.
  173. The criteria of freedom for a free manual are roughly the same as for
  174. free software. Redistribution (including the normal kinds of commercial
  175. redistribution) must be permitted, so that the manual can accompany
  176. every copy of the program, both on-line and on paper.
  177. Permission for modification of the technical content is crucial too.
  178. When people modify the software, adding or changing features, if they
  179. are conscientious they will change the manual too--so they can provide
  180. accurate and clear documentation for the modified program. A manual
  181. that leaves you no choice but to write a new manual to document a
  182. changed version of the program is not really available to our community.
  183. Some kinds of limits on the way modification is handled are
  184. acceptable. For example, requirements to preserve the original author's
  185. copyright notice, the distribution terms, or the list of authors, are
  186. ok. It is also no problem to require modified versions to include
  187. notice that they were modified. Even entire sections that may not be
  188. deleted or changed are acceptable, as long as they deal with
  189. nontechnical topics (like this one). These kinds of restrictions are
  190. acceptable because they don't obstruct the community's normal use of the
  191. manual.
  192. However, it must be possible to modify all the _technical_ content of
  193. the manual, and then distribute the result in all the usual media,
  194. through all the usual channels. Otherwise, the restrictions obstruct
  195. the use of the manual, it is not free, and we need another manual to
  196. replace it.
  197. Please spread the word about this issue. Our community continues to
  198. lose manuals to proprietary publishing. If we spread the word that free
  199. software needs free reference manuals and free tutorials, perhaps the
  200. next person who wants to contribute by writing documentation will
  201. realize, before it is too late, that only free manuals contribute to the
  202. free software community.
  203. If you are writing documentation, please insist on publishing it
  204. under the GNU Free Documentation License or another free documentation
  205. license. Remember that this decision requires your approval--you don't
  206. have to let the publisher decide. Some commercial publishers will use a
  207. free license if you insist, but they will not propose the option; it is
  208. up to you to raise the issue and say firmly that this is what you want.
  209. If the publisher you are dealing with refuses, please try other
  210. publishers. If you're not sure whether a proposed license is free,
  211. write to <licensing@gnu.org>.
  212. You can encourage commercial publishers to sell more free, copylefted
  213. manuals and tutorials by buying them, and particularly by buying copies
  214. from the publishers that paid for their writing or for major
  215. improvements. Meanwhile, try to avoid buying non-free documentation at
  216. all. Check the distribution terms of a manual before you buy it, and
  217. insist that whoever seeks your business must respect your freedom.
  218. Check the history of the book, and try to reward the publishers that
  219. have paid or pay the authors to work on it.
  220. The Free Software Foundation maintains a list of free documentation
  221. published by other publishers, at
  222. <http://www.fsf.org/doc/other-free-books.html>.
  223. 
  224. File: gdb.info, Node: Contributors, Prev: Free Documentation, Up: Summary
  225. Contributors to GDB
  226. ===================
  227. Richard Stallman was the original author of GDB, and of many other GNU
  228. programs. Many others have contributed to its development. This
  229. section attempts to credit major contributors. One of the virtues of
  230. free software is that everyone is free to contribute to it; with regret,
  231. we cannot actually acknowledge everyone here. The file 'ChangeLog' in
  232. the GDB distribution approximates a blow-by-blow account.
  233. Changes much prior to version 2.0 are lost in the mists of time.
  234. _Plea:_ Additions to this section are particularly welcome. If you
  235. or your friends (or enemies, to be evenhanded) have been unfairly
  236. omitted from this list, we would like to add your names!
  237. So that they may not regard their many labors as thankless, we
  238. particularly thank those who shepherded GDB through major releases:
  239. Andrew Cagney (releases 6.3, 6.2, 6.1, 6.0, 5.3, 5.2, 5.1 and 5.0); Jim
  240. Blandy (release 4.18); Jason Molenda (release 4.17); Stan Shebs (release
  241. 4.14); Fred Fish (releases 4.16, 4.15, 4.13, 4.12, 4.11, 4.10, and 4.9);
  242. Stu Grossman and John Gilmore (releases 4.8, 4.7, 4.6, 4.5, and 4.4);
  243. John Gilmore (releases 4.3, 4.2, 4.1, 4.0, and 3.9); Jim Kingdon
  244. (releases 3.5, 3.4, and 3.3); and Randy Smith (releases 3.2, 3.1, and
  245. 3.0).
  246. Richard Stallman, assisted at various times by Peter TerMaat, Chris
  247. Hanson, and Richard Mlynarik, handled releases through 2.8.
  248. Michael Tiemann is the author of most of the GNU C++ support in GDB,
  249. with significant additional contributions from Per Bothner and Daniel
  250. Berlin. James Clark wrote the GNU C++ demangler. Early work on C++ was
  251. by Peter TerMaat (who also did much general update work leading to
  252. release 3.0).
  253. GDB uses the BFD subroutine library to examine multiple object-file
  254. formats; BFD was a joint project of David V. Henkel-Wallace, Rich
  255. Pixley, Steve Chamberlain, and John Gilmore.
  256. David Johnson wrote the original COFF support; Pace Willison did the
  257. original support for encapsulated COFF.
  258. Brent Benson of Harris Computer Systems contributed DWARF 2 support.
  259. Adam de Boor and Bradley Davis contributed the ISI Optimum V support.
  260. Per Bothner, Noboyuki Hikichi, and Alessandro Forin contributed MIPS
  261. support. Jean-Daniel Fekete contributed Sun 386i support. Chris Hanson
  262. improved the HP9000 support. Noboyuki Hikichi and Tomoyuki Hasei
  263. contributed Sony/News OS 3 support. David Johnson contributed Encore
  264. Umax support. Jyrki Kuoppala contributed Altos 3068 support. Jeff Law
  265. contributed HP PA and SOM support. Keith Packard contributed NS32K
  266. support. Doug Rabson contributed Acorn Risc Machine support. Bob Rusk
  267. contributed Harris Nighthawk CX-UX support. Chris Smith contributed
  268. Convex support (and Fortran debugging). Jonathan Stone contributed
  269. Pyramid support. Michael Tiemann contributed SPARC support. Tim Tucker
  270. contributed support for the Gould NP1 and Gould Powernode. Pace
  271. Willison contributed Intel 386 support. Jay Vosburgh contributed
  272. Symmetry support. Marko Mlinar contributed OpenRISC 1000 support.
  273. Andreas Schwab contributed M68K GNU/Linux support.
  274. Rich Schaefer and Peter Schauer helped with support of SunOS shared
  275. libraries.
  276. Jay Fenlason and Roland McGrath ensured that GDB and GAS agree about
  277. several machine instruction sets.
  278. Patrick Duval, Ted Goldstein, Vikram Koka and Glenn Engel helped
  279. develop remote debugging. Intel Corporation, Wind River Systems, AMD,
  280. and ARM contributed remote debugging modules for the i960, VxWorks, A29K
  281. UDI, and RDI targets, respectively.
  282. Brian Fox is the author of the readline libraries providing
  283. command-line editing and command history.
  284. Andrew Beers of SUNY Buffalo wrote the language-switching code, the
  285. Modula-2 support, and contributed the Languages chapter of this manual.
  286. Fred Fish wrote most of the support for Unix System Vr4. He also
  287. enhanced the command-completion support to cover C++ overloaded symbols.
  288. Hitachi America (now Renesas America), Ltd. sponsored the support
  289. for H8/300, H8/500, and Super-H processors.
  290. NEC sponsored the support for the v850, Vr4xxx, and Vr5xxx
  291. processors.
  292. Mitsubishi (now Renesas) sponsored the support for D10V, D30V, and
  293. M32R/D processors.
  294. Toshiba sponsored the support for the TX39 Mips processor.
  295. Matsushita sponsored the support for the MN10200 and MN10300
  296. processors.
  297. Fujitsu sponsored the support for SPARClite and FR30 processors.
  298. Kung Hsu, Jeff Law, and Rick Sladkey added support for hardware
  299. watchpoints.
  300. Michael Snyder added support for tracepoints.
  301. Stu Grossman wrote gdbserver.
  302. Jim Kingdon, Peter Schauer, Ian Taylor, and Stu Grossman made nearly
  303. innumerable bug fixes and cleanups throughout GDB.
  304. The following people at the Hewlett-Packard Company contributed
  305. support for the PA-RISC 2.0 architecture, HP-UX 10.20, 10.30, and 11.0
  306. (narrow mode), HP's implementation of kernel threads, HP's aC++
  307. compiler, and the Text User Interface (nee Terminal User Interface): Ben
  308. Krepp, Richard Title, John Bishop, Susan Macchia, Kathy Mann, Satish
  309. Pai, India Paul, Steve Rehrauer, and Elena Zannoni. Kim Haase provided
  310. HP-specific information in this manual.
  311. DJ Delorie ported GDB to MS-DOS, for the DJGPP project. Robert
  312. Hoehne made significant contributions to the DJGPP port.
  313. Cygnus Solutions has sponsored GDB maintenance and much of its
  314. development since 1991. Cygnus engineers who have worked on GDB
  315. fulltime include Mark Alexander, Jim Blandy, Per Bothner, Kevin
  316. Buettner, Edith Epstein, Chris Faylor, Fred Fish, Martin Hunt, Jim
  317. Ingham, John Gilmore, Stu Grossman, Kung Hsu, Jim Kingdon, John Metzler,
  318. Fernando Nasser, Geoffrey Noer, Dawn Perchik, Rich Pixley, Zdenek
  319. Radouch, Keith Seitz, Stan Shebs, David Taylor, and Elena Zannoni. In
  320. addition, Dave Brolley, Ian Carmichael, Steve Chamberlain, Nick Clifton,
  321. JT Conklin, Stan Cox, DJ Delorie, Ulrich Drepper, Frank Eigler, Doug
  322. Evans, Sean Fagan, David Henkel-Wallace, Richard Henderson, Jeff
  323. Holcomb, Jeff Law, Jim Lemke, Tom Lord, Bob Manson, Michael Meissner,
  324. Jason Merrill, Catherine Moore, Drew Moseley, Ken Raeburn, Gavin
  325. Romig-Koch, Rob Savoye, Jamie Smith, Mike Stump, Ian Taylor, Angela
  326. Thomas, Michael Tiemann, Tom Tromey, Ron Unrau, Jim Wilson, and David
  327. Zuhn have made contributions both large and small.
  328. Andrew Cagney, Fernando Nasser, and Elena Zannoni, while working for
  329. Cygnus Solutions, implemented the original GDB/MI interface.
  330. Jim Blandy added support for preprocessor macros, while working for
  331. Red Hat.
  332. Andrew Cagney designed GDB's architecture vector. Many people
  333. including Andrew Cagney, Stephane Carrez, Randolph Chung, Nick Duffek,
  334. Richard Henderson, Mark Kettenis, Grace Sainsbury, Kei Sakamoto,
  335. Yoshinori Sato, Michael Snyder, Andreas Schwab, Jason Thorpe, Corinna
  336. Vinschen, Ulrich Weigand, and Elena Zannoni, helped with the migration
  337. of old architectures to this new framework.
  338. Andrew Cagney completely re-designed and re-implemented GDB's
  339. unwinder framework, this consisting of a fresh new design featuring
  340. frame IDs, independent frame sniffers, and the sentinel frame. Mark
  341. Kettenis implemented the DWARF 2 unwinder, Jeff Johnston the libunwind
  342. unwinder, and Andrew Cagney the dummy, sentinel, tramp, and trad
  343. unwinders. The architecture-specific changes, each involving a complete
  344. rewrite of the architecture's frame code, were carried out by Jim
  345. Blandy, Joel Brobecker, Kevin Buettner, Andrew Cagney, Stephane Carrez,
  346. Randolph Chung, Orjan Friberg, Richard Henderson, Daniel Jacobowitz,
  347. Jeff Johnston, Mark Kettenis, Theodore A. Roth, Kei Sakamoto, Yoshinori
  348. Sato, Michael Snyder, Corinna Vinschen, and Ulrich Weigand.
  349. Christian Zankel, Ross Morley, Bob Wilson, and Maxim Grigoriev from
  350. Tensilica, Inc. contributed support for Xtensa processors. Others who
  351. have worked on the Xtensa port of GDB in the past include Steve Tjiang,
  352. John Newlin, and Scott Foehner.
  353. Michael Eager and staff of Xilinx, Inc., contributed support for the
  354. Xilinx MicroBlaze architecture.
  355. Initial support for the FreeBSD/mips target and native configuration
  356. was developed by SRI International and the University of Cambridge
  357. Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
  358. ("CTSRD"), as part of the DARPA CRASH research programme.
  359. Initial support for the FreeBSD/riscv target and native configuration
  360. was developed by SRI International and the University of Cambridge
  361. Computer Laboratory (Department of Computer Science and Technology)
  362. under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the DARPA
  363. SSITH research programme.
  364. The original port to the OpenRISC 1000 is believed to be due to
  365. Alessandro Forin and Per Bothner. More recent ports have been the work
  366. of Jeremy Bennett, Franck Jullien, Stefan Wallentowitz and Stafford
  367. Horne.
  368. Weimin Pan, David Faust and Jose E. Marchesi contributed support for
  369. the Linux kernel BPF virtual architecture. This work was sponsored by
  370. Oracle.
  371. 
  372. File: gdb.info, Node: Sample Session, Next: Invocation, Prev: Summary, Up: Top
  373. 1 A Sample GDB Session
  374. **********************
  375. You can use this manual at your leisure to read all about GDB. However,
  376. a handful of commands are enough to get started using the debugger.
  377. This chapter illustrates those commands.
  378. One of the preliminary versions of GNU 'm4' (a generic macro
  379. processor) exhibits the following bug: sometimes, when we change its
  380. quote strings from the default, the commands used to capture one macro
  381. definition within another stop working. In the following short 'm4'
  382. session, we define a macro 'foo' which expands to '0000'; we then use
  383. the 'm4' built-in 'defn' to define 'bar' as the same thing. However,
  384. when we change the open quote string to '<QUOTE>' and the close quote
  385. string to '<UNQUOTE>', the same procedure fails to define a new synonym
  386. 'baz':
  387. $ cd gnu/m4
  388. $ ./m4
  389. define(foo,0000)
  390. foo
  391. 0000
  392. define(bar,defn('foo'))
  393. bar
  394. 0000
  395. changequote(<QUOTE>,<UNQUOTE>)
  396. define(baz,defn(<QUOTE>foo<UNQUOTE>))
  397. baz
  398. Ctrl-d
  399. m4: End of input: 0: fatal error: EOF in string
  400. Let us use GDB to try to see what is going on.
  401. $ gdb m4
  402. GDB is free software and you are welcome to distribute copies
  403. of it under certain conditions; type "show copying" to see
  404. the conditions.
  405. There is absolutely no warranty for GDB; type "show warranty"
  406. for details.
  407. GDB 10.1.90.20201028-git, Copyright 1999 Free Software Foundation, Inc...
  408. (gdb)
  409. GDB reads only enough symbol data to know where to find the rest when
  410. needed; as a result, the first prompt comes up very quickly. We now
  411. tell GDB to use a narrower display width than usual, so that examples
  412. fit in this manual.
  413. (gdb) set width 70
  414. We need to see how the 'm4' built-in 'changequote' works. Having looked
  415. at the source, we know the relevant subroutine is 'm4_changequote', so
  416. we set a breakpoint there with the GDB 'break' command.
  417. (gdb) break m4_changequote
  418. Breakpoint 1 at 0x62f4: file builtin.c, line 879.
  419. Using the 'run' command, we start 'm4' running under GDB control; as
  420. long as control does not reach the 'm4_changequote' subroutine, the
  421. program runs as usual:
  422. (gdb) run
  423. Starting program: /work/Editorial/gdb/gnu/m4/m4
  424. define(foo,0000)
  425. foo
  426. 0000
  427. To trigger the breakpoint, we call 'changequote'. GDB suspends
  428. execution of 'm4', displaying information about the context where it
  429. stops.
  430. changequote(<QUOTE>,<UNQUOTE>)
  431. Breakpoint 1, m4_changequote (argc=3, argv=0x33c70)
  432. at builtin.c:879
  433. 879 if (bad_argc(TOKEN_DATA_TEXT(argv[0]),argc,1,3))
  434. Now we use the command 'n' ('next') to advance execution to the next
  435. line of the current function.
  436. (gdb) n
  437. 882 set_quotes((argc >= 2) ? TOKEN_DATA_TEXT(argv[1])\
  438. : nil,
  439. 'set_quotes' looks like a promising subroutine. We can go into it by
  440. using the command 's' ('step') instead of 'next'. 'step' goes to the
  441. next line to be executed in _any_ subroutine, so it steps into
  442. 'set_quotes'.
  443. (gdb) s
  444. set_quotes (lq=0x34c78 "<QUOTE>", rq=0x34c88 "<UNQUOTE>")
  445. at input.c:530
  446. 530 if (lquote != def_lquote)
  447. The display that shows the subroutine where 'm4' is now suspended (and
  448. its arguments) is called a stack frame display. It shows a summary of
  449. the stack. We can use the 'backtrace' command (which can also be
  450. spelled 'bt'), to see where we are in the stack as a whole: the
  451. 'backtrace' command displays a stack frame for each active subroutine.
  452. (gdb) bt
  453. #0 set_quotes (lq=0x34c78 "<QUOTE>", rq=0x34c88 "<UNQUOTE>")
  454. at input.c:530
  455. #1 0x6344 in m4_changequote (argc=3, argv=0x33c70)
  456. at builtin.c:882
  457. #2 0x8174 in expand_macro (sym=0x33320) at macro.c:242
  458. #3 0x7a88 in expand_token (obs=0x0, t=209696, td=0xf7fffa30)
  459. at macro.c:71
  460. #4 0x79dc in expand_input () at macro.c:40
  461. #5 0x2930 in main (argc=0, argv=0xf7fffb20) at m4.c:195
  462. We step through a few more lines to see what happens. The first two
  463. times, we can use 's'; the next two times we use 'n' to avoid falling
  464. into the 'xstrdup' subroutine.
  465. (gdb) s
  466. 0x3b5c 532 if (rquote != def_rquote)
  467. (gdb) s
  468. 0x3b80 535 lquote = (lq == nil || *lq == '\0') ? \
  469. def_lquote : xstrdup(lq);
  470. (gdb) n
  471. 536 rquote = (rq == nil || *rq == '\0') ? def_rquote\
  472. : xstrdup(rq);
  473. (gdb) n
  474. 538 len_lquote = strlen(rquote);
  475. The last line displayed looks a little odd; we can examine the variables
  476. 'lquote' and 'rquote' to see if they are in fact the new left and right
  477. quotes we specified. We use the command 'p' ('print') to see their
  478. values.
  479. (gdb) p lquote
  480. $1 = 0x35d40 "<QUOTE>"
  481. (gdb) p rquote
  482. $2 = 0x35d50 "<UNQUOTE>"
  483. 'lquote' and 'rquote' are indeed the new left and right quotes. To look
  484. at some context, we can display ten lines of source surrounding the
  485. current line with the 'l' ('list') command.
  486. (gdb) l
  487. 533 xfree(rquote);
  488. 534
  489. 535 lquote = (lq == nil || *lq == '\0') ? def_lquote\
  490. : xstrdup (lq);
  491. 536 rquote = (rq == nil || *rq == '\0') ? def_rquote\
  492. : xstrdup (rq);
  493. 537
  494. 538 len_lquote = strlen(rquote);
  495. 539 len_rquote = strlen(lquote);
  496. 540 }
  497. 541
  498. 542 void
  499. Let us step past the two lines that set 'len_lquote' and 'len_rquote',
  500. and then examine the values of those variables.
  501. (gdb) n
  502. 539 len_rquote = strlen(lquote);
  503. (gdb) n
  504. 540 }
  505. (gdb) p len_lquote
  506. $3 = 9
  507. (gdb) p len_rquote
  508. $4 = 7
  509. That certainly looks wrong, assuming 'len_lquote' and 'len_rquote' are
  510. meant to be the lengths of 'lquote' and 'rquote' respectively. We can
  511. set them to better values using the 'p' command, since it can print the
  512. value of any expression--and that expression can include subroutine
  513. calls and assignments.
  514. (gdb) p len_lquote=strlen(lquote)
  515. $5 = 7
  516. (gdb) p len_rquote=strlen(rquote)
  517. $6 = 9
  518. Is that enough to fix the problem of using the new quotes with the 'm4'
  519. built-in 'defn'? We can allow 'm4' to continue executing with the 'c'
  520. ('continue') command, and then try the example that caused trouble
  521. initially:
  522. (gdb) c
  523. Continuing.
  524. define(baz,defn(<QUOTE>foo<UNQUOTE>))
  525. baz
  526. 0000
  527. Success! The new quotes now work just as well as the default ones. The
  528. problem seems to have been just the two typos defining the wrong
  529. lengths. We allow 'm4' exit by giving it an EOF as input:
  530. Ctrl-d
  531. Program exited normally.
  532. The message 'Program exited normally.' is from GDB; it indicates 'm4'
  533. has finished executing. We can end our GDB session with the GDB 'quit'
  534. command.
  535. (gdb) quit
  536. 
  537. File: gdb.info, Node: Invocation, Next: Commands, Prev: Sample Session, Up: Top
  538. 2 Getting In and Out of GDB
  539. ***************************
  540. This chapter discusses how to start GDB, and how to get out of it. The
  541. essentials are:
  542. * type 'gdb' to start GDB.
  543. * type 'quit' or 'Ctrl-d' to exit.
  544. * Menu:
  545. * Invoking GDB:: How to start GDB
  546. * Quitting GDB:: How to quit GDB
  547. * Shell Commands:: How to use shell commands inside GDB
  548. * Logging Output:: How to log GDB's output to a file
  549. 
  550. File: gdb.info, Node: Invoking GDB, Next: Quitting GDB, Up: Invocation
  551. 2.1 Invoking GDB
  552. ================
  553. Invoke GDB by running the program 'gdb'. Once started, GDB reads
  554. commands from the terminal until you tell it to exit.
  555. You can also run 'gdb' with a variety of arguments and options, to
  556. specify more of your debugging environment at the outset.
  557. The command-line options described here are designed to cover a
  558. variety of situations; in some environments, some of these options may
  559. effectively be unavailable.
  560. The most usual way to start GDB is with one argument, specifying an
  561. executable program:
  562. gdb PROGRAM
  563. You can also start with both an executable program and a core file
  564. specified:
  565. gdb PROGRAM CORE
  566. You can, instead, specify a process ID as a second argument or use
  567. option '-p', if you want to debug a running process:
  568. gdb PROGRAM 1234
  569. gdb -p 1234
  570. would attach GDB to process '1234'. With option '-p' you can omit the
  571. PROGRAM filename.
  572. Taking advantage of the second command-line argument requires a
  573. fairly complete operating system; when you use GDB as a remote debugger
  574. attached to a bare board, there may not be any notion of "process", and
  575. there is often no way to get a core dump. GDB will warn you if it is
  576. unable to attach or to read core dumps.
  577. You can optionally have 'gdb' pass any arguments after the executable
  578. file to the inferior using '--args'. This option stops option
  579. processing.
  580. gdb --args gcc -O2 -c foo.c
  581. This will cause 'gdb' to debug 'gcc', and to set 'gcc''s command-line
  582. arguments (*note Arguments::) to '-O2 -c foo.c'.
  583. You can run 'gdb' without printing the front material, which
  584. describes GDB's non-warranty, by specifying '--silent' (or
  585. '-q'/'--quiet'):
  586. gdb --silent
  587. You can further control how GDB starts up by using command-line options.
  588. GDB itself can remind you of the options available.
  589. Type
  590. gdb -help
  591. to display all available options and briefly describe their use ('gdb
  592. -h' is a shorter equivalent).
  593. All options and command line arguments you give are processed in
  594. sequential order. The order makes a difference when the '-x' option is
  595. used.
  596. * Menu:
  597. * File Options:: Choosing files
  598. * Mode Options:: Choosing modes
  599. * Startup:: What GDB does during startup
  600. 
  601. File: gdb.info, Node: File Options, Next: Mode Options, Up: Invoking GDB
  602. 2.1.1 Choosing Files
  603. --------------------
  604. When GDB starts, it reads any arguments other than options as specifying
  605. an executable file and core file (or process ID). This is the same as if
  606. the arguments were specified by the '-se' and '-c' (or '-p') options
  607. respectively. (GDB reads the first argument that does not have an
  608. associated option flag as equivalent to the '-se' option followed by
  609. that argument; and the second argument that does not have an associated
  610. option flag, if any, as equivalent to the '-c'/'-p' option followed by
  611. that argument.) If the second argument begins with a decimal digit, GDB
  612. will first attempt to attach to it as a process, and if that fails,
  613. attempt to open it as a corefile. If you have a corefile whose name
  614. begins with a digit, you can prevent GDB from treating it as a pid by
  615. prefixing it with './', e.g. './12345'.
  616. If GDB has not been configured to included core file support, such as
  617. for most embedded targets, then it will complain about a second argument
  618. and ignore it.
  619. Many options have both long and short forms; both are shown in the
  620. following list. GDB also recognizes the long forms if you truncate
  621. them, so long as enough of the option is present to be unambiguous. (If
  622. you prefer, you can flag option arguments with '--' rather than '-',
  623. though we illustrate the more usual convention.)
  624. '-symbols FILE'
  625. '-s FILE'
  626. Read symbol table from file FILE.
  627. '-exec FILE'
  628. '-e FILE'
  629. Use file FILE as the executable file to execute when appropriate,
  630. and for examining pure data in conjunction with a core dump.
  631. '-se FILE'
  632. Read symbol table from file FILE and use it as the executable file.
  633. '-core FILE'
  634. '-c FILE'
  635. Use file FILE as a core dump to examine.
  636. '-pid NUMBER'
  637. '-p NUMBER'
  638. Connect to process ID NUMBER, as with the 'attach' command.
  639. '-command FILE'
  640. '-x FILE'
  641. Execute commands from file FILE. The contents of this file is
  642. evaluated exactly as the 'source' command would. *Note Command
  643. files: Command Files.
  644. '-eval-command COMMAND'
  645. '-ex COMMAND'
  646. Execute a single GDB command.
  647. This option may be used multiple times to call multiple commands.
  648. It may also be interleaved with '-command' as required.
  649. gdb -ex 'target sim' -ex 'load' \
  650. -x setbreakpoints -ex 'run' a.out
  651. '-init-command FILE'
  652. '-ix FILE'
  653. Execute commands from file FILE before loading the inferior (but
  654. after loading gdbinit files). *Note Startup::.
  655. '-init-eval-command COMMAND'
  656. '-iex COMMAND'
  657. Execute a single GDB command before loading the inferior (but after
  658. loading gdbinit files). *Note Startup::.
  659. '-directory DIRECTORY'
  660. '-d DIRECTORY'
  661. Add DIRECTORY to the path to search for source and script files.
  662. '-r'
  663. '-readnow'
  664. Read each symbol file's entire symbol table immediately, rather
  665. than the default, which is to read it incrementally as it is
  666. needed. This makes startup slower, but makes future operations
  667. faster.
  668. '--readnever'
  669. Do not read each symbol file's symbolic debug information. This
  670. makes startup faster but at the expense of not being able to
  671. perform symbolic debugging. DWARF unwind information is also not
  672. read, meaning backtraces may become incomplete or inaccurate. One
  673. use of this is when a user simply wants to do the following
  674. sequence: attach, dump core, detach. Loading the debugging
  675. information in this case is an unnecessary cause of delay.
  676. 
  677. File: gdb.info, Node: Mode Options, Next: Startup, Prev: File Options, Up: Invoking GDB
  678. 2.1.2 Choosing Modes
  679. --------------------
  680. You can run GDB in various alternative modes--for example, in batch mode
  681. or quiet mode.
  682. '-nx'
  683. '-n'
  684. Do not execute commands found in any initialization file. There
  685. are three init files, loaded in the following order:
  686. 'system.gdbinit'
  687. This is the system-wide init file. Its location is specified
  688. with the '--with-system-gdbinit' configure option (*note
  689. System-wide configuration::). It is loaded first when GDB
  690. starts, before command line options have been processed.
  691. 'system.gdbinit.d'
  692. This is the system-wide init directory. Its location is
  693. specified with the '--with-system-gdbinit-dir' configure
  694. option (*note System-wide configuration::). Files in this
  695. directory are loaded in alphabetical order immediately after
  696. system.gdbinit (if enabled) when GDB starts, before command
  697. line options have been processed. Files need to have a
  698. recognized scripting language extension ('.py'/'.scm') or be
  699. named with a '.gdb' extension to be interpreted as regular GDB
  700. commands. GDB will not recurse into any subdirectories of
  701. this directory.
  702. '~/.gdbinit'
  703. This is the init file in your home directory. It is loaded
  704. next, after 'system.gdbinit', and before command options have
  705. been processed.
  706. './.gdbinit'
  707. This is the init file in the current directory. It is loaded
  708. last, after command line options other than '-x' and '-ex'
  709. have been processed. Command line options '-x' and '-ex' are
  710. processed last, after './.gdbinit' has been loaded.
  711. For further documentation on startup processing, *Note Startup::.
  712. For documentation on how to write command files, *Note Command
  713. Files: Command Files.
  714. '-nh'
  715. Do not execute commands found in '~/.gdbinit', the init file in
  716. your home directory. *Note Startup::.
  717. '-quiet'
  718. '-silent'
  719. '-q'
  720. "Quiet". Do not print the introductory and copyright messages.
  721. These messages are also suppressed in batch mode.
  722. '-batch'
  723. Run in batch mode. Exit with status '0' after processing all the
  724. command files specified with '-x' (and all commands from
  725. initialization files, if not inhibited with '-n'). Exit with
  726. nonzero status if an error occurs in executing the GDB commands in
  727. the command files. Batch mode also disables pagination, sets
  728. unlimited terminal width and height *note Screen Size::, and acts
  729. as if 'set confirm off' were in effect (*note Messages/Warnings::).
  730. Batch mode may be useful for running GDB as a filter, for example
  731. to download and run a program on another computer; in order to make
  732. this more useful, the message
  733. Program exited normally.
  734. (which is ordinarily issued whenever a program running under GDB
  735. control terminates) is not issued when running in batch mode.
  736. '-batch-silent'
  737. Run in batch mode exactly like '-batch', but totally silently. All
  738. GDB output to 'stdout' is prevented ('stderr' is unaffected). This
  739. is much quieter than '-silent' and would be useless for an
  740. interactive session.
  741. This is particularly useful when using targets that give 'Loading
  742. section' messages, for example.
  743. Note that targets that give their output via GDB, as opposed to
  744. writing directly to 'stdout', will also be made silent.
  745. '-return-child-result'
  746. The return code from GDB will be the return code from the child
  747. process (the process being debugged), with the following
  748. exceptions:
  749. * GDB exits abnormally. E.g., due to an incorrect argument or
  750. an internal error. In this case the exit code is the same as
  751. it would have been without '-return-child-result'.
  752. * The user quits with an explicit value. E.g., 'quit 1'.
  753. * The child process never runs, or is not allowed to terminate,
  754. in which case the exit code will be -1.
  755. This option is useful in conjunction with '-batch' or
  756. '-batch-silent', when GDB is being used as a remote program loader
  757. or simulator interface.
  758. '-nowindows'
  759. '-nw'
  760. "No windows". If GDB comes with a graphical user interface (GUI)
  761. built in, then this option tells GDB to only use the command-line
  762. interface. If no GUI is available, this option has no effect.
  763. '-windows'
  764. '-w'
  765. If GDB includes a GUI, then this option requires it to be used if
  766. possible.
  767. '-cd DIRECTORY'
  768. Run GDB using DIRECTORY as its working directory, instead of the
  769. current directory.
  770. '-data-directory DIRECTORY'
  771. '-D DIRECTORY'
  772. Run GDB using DIRECTORY as its data directory. The data directory
  773. is where GDB searches for its auxiliary files. *Note Data Files::.
  774. '-fullname'
  775. '-f'
  776. GNU Emacs sets this option when it runs GDB as a subprocess. It
  777. tells GDB to output the full file name and line number in a
  778. standard, recognizable fashion each time a stack frame is displayed
  779. (which includes each time your program stops). This recognizable
  780. format looks like two '\032' characters, followed by the file name,
  781. line number and character position separated by colons, and a
  782. newline. The Emacs-to-GDB interface program uses the two '\032'
  783. characters as a signal to display the source code for the frame.
  784. '-annotate LEVEL'
  785. This option sets the "annotation level" inside GDB. Its effect is
  786. identical to using 'set annotate LEVEL' (*note Annotations::). The
  787. annotation LEVEL controls how much information GDB prints together
  788. with its prompt, values of expressions, source lines, and other
  789. types of output. Level 0 is the normal, level 1 is for use when
  790. GDB is run as a subprocess of GNU Emacs, level 3 is the maximum
  791. annotation suitable for programs that control GDB, and level 2 has
  792. been deprecated.
  793. The annotation mechanism has largely been superseded by GDB/MI
  794. (*note GDB/MI::).
  795. '--args'
  796. Change interpretation of command line so that arguments following
  797. the executable file are passed as command line arguments to the
  798. inferior. This option stops option processing.
  799. '-baud BPS'
  800. '-b BPS'
  801. Set the line speed (baud rate or bits per second) of any serial
  802. interface used by GDB for remote debugging.
  803. '-l TIMEOUT'
  804. Set the timeout (in seconds) of any communication used by GDB for
  805. remote debugging.
  806. '-tty DEVICE'
  807. '-t DEVICE'
  808. Run using DEVICE for your program's standard input and output.
  809. '-tui'
  810. Activate the "Text User Interface" when starting. The Text User
  811. Interface manages several text windows on the terminal, showing
  812. source, assembly, registers and GDB command outputs (*note GDB Text
  813. User Interface: TUI.). Do not use this option if you run GDB from
  814. Emacs (*note Using GDB under GNU Emacs: Emacs.).
  815. '-interpreter INTERP'
  816. Use the interpreter INTERP for interface with the controlling
  817. program or device. This option is meant to be set by programs
  818. which communicate with GDB using it as a back end. *Note Command
  819. Interpreters: Interpreters.
  820. '--interpreter=mi' (or '--interpreter=mi3') causes GDB to use the
  821. "GDB/MI interface" version 3 (*note The GDB/MI Interface: GDB/MI.)
  822. included since GDB version 9.1. GDB/MI version 2 ('mi2'), included
  823. in GDB 6.0 and version 1 ('mi1'), included in GDB 5.3, are also
  824. available. Earlier GDB/MI interfaces are no longer supported.
  825. '-write'
  826. Open the executable and core files for both reading and writing.
  827. This is equivalent to the 'set write on' command inside GDB (*note
  828. Patching::).
  829. '-statistics'
  830. This option causes GDB to print statistics about time and memory
  831. usage after it completes each command and returns to the prompt.
  832. '-version'
  833. This option causes GDB to print its version number and no-warranty
  834. blurb, and exit.
  835. '-configuration'
  836. This option causes GDB to print details about its build-time
  837. configuration parameters, and then exit. These details can be
  838. important when reporting GDB bugs (*note GDB Bugs::).
  839. 
  840. File: gdb.info, Node: Startup, Prev: Mode Options, Up: Invoking GDB
  841. 2.1.3 What GDB Does During Startup
  842. ----------------------------------
  843. Here's the description of what GDB does during session startup:
  844. 1. Sets up the command interpreter as specified by the command line
  845. (*note interpreter: Mode Options.).
  846. 2. Reads the system-wide "init file" (if '--with-system-gdbinit' was
  847. used when building GDB; *note System-wide configuration and
  848. settings: System-wide configuration.) and the files in the
  849. system-wide gdbinit directory (if '--with-system-gdbinit-dir' was
  850. used) and executes all the commands in those files. The files need
  851. to be named with a '.gdb' extension to be interpreted as GDB
  852. commands, or they can be written in a supported scripting language
  853. with an appropriate file extension.
  854. 3. Reads the init file (if any) in your home directory(1) and executes
  855. all the commands in that file.
  856. 4. Executes commands and command files specified by the '-iex' and
  857. '-ix' options in their specified order. Usually you should use the
  858. '-ex' and '-x' options instead, but this way you can apply settings
  859. before GDB init files get executed and before inferior gets loaded.
  860. 5. Processes command line options and operands.
  861. 6. Reads and executes the commands from init file (if any) in the
  862. current working directory as long as 'set auto-load local-gdbinit'
  863. is set to 'on' (*note Init File in the Current Directory::). This
  864. is only done if the current directory is different from your home
  865. directory. Thus, you can have more than one init file, one generic
  866. in your home directory, and another, specific to the program you
  867. are debugging, in the directory where you invoke GDB.
  868. 7. If the command line specified a program to debug, or a process to
  869. attach to, or a core file, GDB loads any auto-loaded scripts
  870. provided for the program or for its loaded shared libraries. *Note
  871. Auto-loading::.
  872. If you wish to disable the auto-loading during startup, you must do
  873. something like the following:
  874. $ gdb -iex "set auto-load python-scripts off" myprogram
  875. Option '-ex' does not work because the auto-loading is then turned
  876. off too late.
  877. 8. Executes commands and command files specified by the '-ex' and '-x'
  878. options in their specified order. *Note Command Files::, for more
  879. details about GDB command files.
  880. 9. Reads the command history recorded in the "history file". *Note
  881. Command History::, for more details about the command history and
  882. the files where GDB records it.
  883. Init files use the same syntax as "command files" (*note Command
  884. Files::) and are processed by GDB in the same way. The init file in
  885. your home directory can set options (such as 'set complaints') that
  886. affect subsequent processing of command line options and operands. Init
  887. files are not executed if you use the '-nx' option (*note Choosing
  888. Modes: Mode Options.).
  889. To display the list of init files loaded by gdb at startup, you can
  890. use 'gdb --help'.
  891. The GDB init files are normally called '.gdbinit'. The DJGPP port of
  892. GDB uses the name 'gdb.ini', due to the limitations of file names
  893. imposed by DOS filesystems. The Windows port of GDB uses the standard
  894. name, but if it finds a 'gdb.ini' file in your home directory, it warns
  895. you about that and suggests to rename the file to the standard name.
  896. ---------- Footnotes ----------
  897. (1) On DOS/Windows systems, the home directory is the one pointed to
  898. by the 'HOME' environment variable.
  899. 
  900. File: gdb.info, Node: Quitting GDB, Next: Shell Commands, Prev: Invoking GDB, Up: Invocation
  901. 2.2 Quitting GDB
  902. ================
  903. 'quit [EXPRESSION]'
  904. 'q'
  905. To exit GDB, use the 'quit' command (abbreviated 'q'), or type an
  906. end-of-file character (usually 'Ctrl-d'). If you do not supply
  907. EXPRESSION, GDB will terminate normally; otherwise it will
  908. terminate using the result of EXPRESSION as the error code.
  909. An interrupt (often 'Ctrl-c') does not exit from GDB, but rather
  910. terminates the action of any GDB command that is in progress and returns
  911. to GDB command level. It is safe to type the interrupt character at any
  912. time because GDB does not allow it to take effect until a time when it
  913. is safe.
  914. If you have been using GDB to control an attached process or device,
  915. you can release it with the 'detach' command (*note Debugging an
  916. Already-running Process: Attach.).
  917. 
  918. File: gdb.info, Node: Shell Commands, Next: Logging Output, Prev: Quitting GDB, Up: Invocation
  919. 2.3 Shell Commands
  920. ==================
  921. If you need to execute occasional shell commands during your debugging
  922. session, there is no need to leave or suspend GDB; you can just use the
  923. 'shell' command.
  924. 'shell COMMAND-STRING'
  925. '!COMMAND-STRING'
  926. Invoke a standard shell to execute COMMAND-STRING. Note that no
  927. space is needed between '!' and COMMAND-STRING. On GNU and Unix
  928. systems, the environment variable 'SHELL', if it exists, determines
  929. which shell to run. Otherwise GDB uses the default shell
  930. ('/bin/sh' on GNU and Unix systems, 'cmd.exe' on MS-Windows,
  931. 'COMMAND.COM' on MS-DOS, etc.).
  932. The utility 'make' is often needed in development environments. You
  933. do not have to use the 'shell' command for this purpose in GDB:
  934. 'make MAKE-ARGS'
  935. Execute the 'make' program with the specified arguments. This is
  936. equivalent to 'shell make MAKE-ARGS'.
  937. 'pipe [COMMAND] | SHELL_COMMAND'
  938. '| [COMMAND] | SHELL_COMMAND'
  939. 'pipe -d DELIM COMMAND DELIM SHELL_COMMAND'
  940. '| -d DELIM COMMAND DELIM SHELL_COMMAND'
  941. Executes COMMAND and sends its output to SHELL_COMMAND. Note that
  942. no space is needed around '|'. If no COMMAND is provided, the last
  943. command executed is repeated.
  944. In case the COMMAND contains a '|', the option '-d DELIM' can be
  945. used to specify an alternate delimiter string DELIM that separates
  946. the COMMAND from the SHELL_COMMAND.
  947. Example:
  948. (gdb) p var
  949. $1 = {
  950. black = 144,
  951. red = 233,
  952. green = 377,
  953. blue = 610,
  954. white = 987
  955. }
  956. (gdb) pipe p var|wc
  957. 7 19 80
  958. (gdb) |p var|wc -l
  959. 7
  960. (gdb) p /x var
  961. $4 = {
  962. black = 0x90,
  963. red = 0xe9,
  964. green = 0x179,
  965. blue = 0x262,
  966. white = 0x3db
  967. }
  968. (gdb) ||grep red
  969. red => 0xe9,
  970. (gdb) | -d ! echo this contains a | char\n ! sed -e 's/|/PIPE/'
  971. this contains a PIPE char
  972. (gdb) | -d xxx echo this contains a | char!\n xxx sed -e 's/|/PIPE/'
  973. this contains a PIPE char!
  974. (gdb)
  975. The convenience variables '$_shell_exitcode' and '$_shell_exitsignal'
  976. can be used to examine the exit status of the last shell command
  977. launched by 'shell', 'make', 'pipe' and '|'. *Note Convenience
  978. Variables: Convenience Vars.
  979. 
  980. File: gdb.info, Node: Logging Output, Prev: Shell Commands, Up: Invocation
  981. 2.4 Logging Output
  982. ==================
  983. You may want to save the output of GDB commands to a file. There are
  984. several commands to control GDB's logging.
  985. 'set logging on'
  986. Enable logging.
  987. 'set logging off'
  988. Disable logging.
  989. 'set logging file FILE'
  990. Change the name of the current logfile. The default logfile is
  991. 'gdb.txt'.
  992. 'set logging overwrite [on|off]'
  993. By default, GDB will append to the logfile. Set 'overwrite' if you
  994. want 'set logging on' to overwrite the logfile instead.
  995. 'set logging redirect [on|off]'
  996. By default, GDB output will go to both the terminal and the
  997. logfile. Set 'redirect' if you want output to go only to the log
  998. file.
  999. 'set logging debugredirect [on|off]'
  1000. By default, GDB debug output will go to both the terminal and the
  1001. logfile. Set 'debugredirect' if you want debug output to go only
  1002. to the log file.
  1003. 'show logging'
  1004. Show the current values of the logging settings.
  1005. You can also redirect the output of a GDB command to a shell command.
  1006. *Note pipe::.
  1007. 
  1008. File: gdb.info, Node: Commands, Next: Running, Prev: Invocation, Up: Top
  1009. 3 GDB Commands
  1010. **************
  1011. You can abbreviate a GDB command to the first few letters of the command
  1012. name, if that abbreviation is unambiguous; and you can repeat certain
  1013. GDB commands by typing just <RET>. You can also use the <TAB> key to
  1014. get GDB to fill out the rest of a word in a command (or to show you the
  1015. alternatives available, if there is more than one possibility).
  1016. * Menu:
  1017. * Command Syntax:: How to give commands to GDB
  1018. * Command Settings:: How to change default behavior of commands
  1019. * Completion:: Command completion
  1020. * Command Options:: Command options
  1021. * Command aliases default args:: Automatically prepend default arguments to user-defined aliases
  1022. * Help:: How to ask GDB for help
  1023. 
  1024. File: gdb.info, Node: Command Syntax, Next: Command Settings, Up: Commands
  1025. 3.1 Command Syntax
  1026. ==================
  1027. A GDB command is a single line of input. There is no limit on how long
  1028. it can be. It starts with a command name, which is followed by
  1029. arguments whose meaning depends on the command name. For example, the
  1030. command 'step' accepts an argument which is the number of times to step,
  1031. as in 'step 5'. You can also use the 'step' command with no arguments.
  1032. Some commands do not allow any arguments.
  1033. GDB command names may always be truncated if that abbreviation is
  1034. unambiguous. Other possible command abbreviations are listed in the
  1035. documentation for individual commands. In some cases, even ambiguous
  1036. abbreviations are allowed; for example, 's' is specially defined as
  1037. equivalent to 'step' even though there are other commands whose names
  1038. start with 's'. You can test abbreviations by using them as arguments
  1039. to the 'help' command.
  1040. A blank line as input to GDB (typing just <RET>) means to repeat the
  1041. previous command. Certain commands (for example, 'run') will not repeat
  1042. this way; these are commands whose unintentional repetition might cause
  1043. trouble and which you are unlikely to want to repeat. User-defined
  1044. commands can disable this feature; see *note dont-repeat: Define.
  1045. The 'list' and 'x' commands, when you repeat them with <RET>,
  1046. construct new arguments rather than repeating exactly as typed. This
  1047. permits easy scanning of source or memory.
  1048. GDB can also use <RET> in another way: to partition lengthy output,
  1049. in a way similar to the common utility 'more' (*note Screen Size: Screen
  1050. Size.). Since it is easy to press one <RET> too many in this situation,
  1051. GDB disables command repetition after any command that generates this
  1052. sort of display.
  1053. Any text from a '#' to the end of the line is a comment; it does
  1054. nothing. This is useful mainly in command files (*note Command Files:
  1055. Command Files.).
  1056. The 'Ctrl-o' binding is useful for repeating a complex sequence of
  1057. commands. This command accepts the current line, like <RET>, and then
  1058. fetches the next line relative to the current line from the history for
  1059. editing.
  1060. 
  1061. File: gdb.info, Node: Command Settings, Next: Completion, Prev: Command Syntax, Up: Commands
  1062. 3.2 Command Settings
  1063. ====================
  1064. Many commands change their behavior according to command-specific
  1065. variables or settings. These settings can be changed with the 'set'
  1066. subcommands. For example, the 'print' command (*note Examining Data:
  1067. Data.) prints arrays differently depending on settings changeable with
  1068. the commands 'set print elements NUMBER-OF-ELEMENTS' and 'set print
  1069. array-indexes', among others.
  1070. You can change these settings to your preference in the gdbinit files
  1071. loaded at GDB startup. *Note Startup::.
  1072. The settings can also be changed interactively during the debugging
  1073. session. For example, to change the limit of array elements to print,
  1074. you can do the following:
  1075. (GDB) set print elements 10
  1076. (GDB) print some_array
  1077. $1 = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90...}
  1078. The above 'set print elements 10' command changes the number of
  1079. elements to print from the default of 200 to 10. If you only intend
  1080. this limit of 10 to be used for printing 'some_array', then you must
  1081. restore the limit back to 200, with 'set print elements 200'.
  1082. Some commands allow overriding settings with command options. For
  1083. example, the 'print' command supports a number of options that allow
  1084. overriding relevant global print settings as set by 'set print'
  1085. subcommands. *Note print options::. The example above could be
  1086. rewritten as:
  1087. (GDB) print -elements 10 -- some_array
  1088. $1 = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90...}
  1089. Alternatively, you can use the 'with' command to change a setting
  1090. temporarily, for the duration of a command invocation.
  1091. 'with SETTING [VALUE] [-- COMMAND]'
  1092. 'w SETTING [VALUE] [-- COMMAND]'
  1093. Temporarily set SETTING to VALUE for the duration of COMMAND.
  1094. SETTING is any setting you can change with the 'set' subcommands.
  1095. VALUE is the value to assign to 'setting' while running 'command'.
  1096. If no COMMAND is provided, the last command executed is repeated.
  1097. If a COMMAND is provided, it must be preceded by a double dash
  1098. ('--') separator. This is required because some settings accept
  1099. free-form arguments, such as expressions or filenames.
  1100. For example, the command
  1101. (GDB) with print array on -- print some_array
  1102. is equivalent to the following 3 commands:
  1103. (GDB) set print array on
  1104. (GDB) print some_array
  1105. (GDB) set print array off
  1106. The 'with' command is particularly useful when you want to override
  1107. a setting while running user-defined commands, or commands defined
  1108. in Python or Guile. *Note Extending GDB: Extending GDB.
  1109. (GDB) with print pretty on -- my_complex_command
  1110. To change several settings for the same command, you can nest
  1111. 'with' commands. For example, 'with language ada -- with print
  1112. elements 10' temporarily changes the language to Ada and sets a
  1113. limit of 10 elements to print for arrays and strings.
  1114. 
  1115. File: gdb.info, Node: Completion, Next: Command Options, Prev: Command Settings, Up: Commands
  1116. 3.3 Command Completion
  1117. ======================
  1118. GDB can fill in the rest of a word in a command for you, if there is
  1119. only one possibility; it can also show you what the valid possibilities
  1120. are for the next word in a command, at any time. This works for GDB
  1121. commands, GDB subcommands, command options, and the names of symbols in
  1122. your program.
  1123. Press the <TAB> key whenever you want GDB to fill out the rest of a
  1124. word. If there is only one possibility, GDB fills in the word, and
  1125. waits for you to finish the command (or press <RET> to enter it). For
  1126. example, if you type
  1127. (gdb) info bre <TAB>
  1128. GDB fills in the rest of the word 'breakpoints', since that is the only
  1129. 'info' subcommand beginning with 'bre':
  1130. (gdb) info breakpoints
  1131. You can either press <RET> at this point, to run the 'info breakpoints'
  1132. command, or backspace and enter something else, if 'breakpoints' does
  1133. not look like the command you expected. (If you were sure you wanted
  1134. 'info breakpoints' in the first place, you might as well just type <RET>
  1135. immediately after 'info bre', to exploit command abbreviations rather
  1136. than command completion).
  1137. If there is more than one possibility for the next word when you
  1138. press <TAB>, GDB sounds a bell. You can either supply more characters
  1139. and try again, or just press <TAB> a second time; GDB displays all the
  1140. possible completions for that word. For example, you might want to set
  1141. a breakpoint on a subroutine whose name begins with 'make_', but when
  1142. you type 'b make_<TAB>' GDB just sounds the bell. Typing <TAB> again
  1143. displays all the function names in your program that begin with those
  1144. characters, for example:
  1145. (gdb) b make_ <TAB>
  1146. GDB sounds bell; press <TAB> again, to see:
  1147. make_a_section_from_file make_environ
  1148. make_abs_section make_function_type
  1149. make_blockvector make_pointer_type
  1150. make_cleanup make_reference_type
  1151. make_command make_symbol_completion_list
  1152. (gdb) b make_
  1153. After displaying the available possibilities, GDB copies your partial
  1154. input ('b make_' in the example) so you can finish the command.
  1155. If you just want to see the list of alternatives in the first place,
  1156. you can press 'M-?' rather than pressing <TAB> twice. 'M-?' means
  1157. '<META> ?'. You can type this either by holding down a key designated
  1158. as the <META> shift on your keyboard (if there is one) while typing '?',
  1159. or as <ESC> followed by '?'.
  1160. If the number of possible completions is large, GDB will print as
  1161. much of the list as it has collected, as well as a message indicating
  1162. that the list may be truncated.
  1163. (gdb) b m<TAB><TAB>
  1164. main
  1165. <... the rest of the possible completions ...>
  1166. *** List may be truncated, max-completions reached. ***
  1167. (gdb) b m
  1168. This behavior can be controlled with the following commands:
  1169. 'set max-completions LIMIT'
  1170. 'set max-completions unlimited'
  1171. Set the maximum number of completion candidates. GDB will stop
  1172. looking for more completions once it collects this many candidates.
  1173. This is useful when completing on things like function names as
  1174. collecting all the possible candidates can be time consuming. The
  1175. default value is 200. A value of zero disables tab-completion.
  1176. Note that setting either no limit or a very large limit can make
  1177. completion slow.
  1178. 'show max-completions'
  1179. Show the maximum number of candidates that GDB will collect and
  1180. show during completion.
  1181. Sometimes the string you need, while logically a "word", may contain
  1182. parentheses or other characters that GDB normally excludes from its
  1183. notion of a word. To permit word completion to work in this situation,
  1184. you may enclose words in ''' (single quote marks) in GDB commands.
  1185. A likely situation where you might need this is in typing an
  1186. expression that involves a C++ symbol name with template parameters.
  1187. This is because when completing expressions, GDB treats the '<'
  1188. character as word delimiter, assuming that it's the less-than comparison
  1189. operator (*note C and C++ Operators: C Operators.).
  1190. For example, when you want to call a C++ template function
  1191. interactively using the 'print' or 'call' commands, you may need to
  1192. distinguish whether you mean the version of 'name' that was specialized
  1193. for 'int', 'name<int>()', or the version that was specialized for
  1194. 'float', 'name<float>()'. To use the word-completion facilities in this
  1195. situation, type a single quote ''' at the beginning of the function
  1196. name. This alerts GDB that it may need to consider more information
  1197. than usual when you press <TAB> or 'M-?' to request word completion:
  1198. (gdb) p 'func< M-?
  1199. func<int>() func<float>()
  1200. (gdb) p 'func<
  1201. When setting breakpoints however (*note Specify Location::), you
  1202. don't usually need to type a quote before the function name, because GDB
  1203. understands that you want to set a breakpoint on a function:
  1204. (gdb) b func< M-?
  1205. func<int>() func<float>()
  1206. (gdb) b func<
  1207. This is true even in the case of typing the name of C++ overloaded
  1208. functions (multiple definitions of the same function, distinguished by
  1209. argument type). For example, when you want to set a breakpoint you
  1210. don't need to distinguish whether you mean the version of 'name' that
  1211. takes an 'int' parameter, 'name(int)', or the version that takes a
  1212. 'float' parameter, 'name(float)'.
  1213. (gdb) b bubble( M-?
  1214. bubble(int) bubble(double)
  1215. (gdb) b bubble(dou M-?
  1216. bubble(double)
  1217. See *note quoting names:: for a description of other scenarios that
  1218. require quoting.
  1219. For more information about overloaded functions, see *note C++
  1220. Expressions: C Plus Plus Expressions. You can use the command 'set
  1221. overload-resolution off' to disable overload resolution; see *note GDB
  1222. Features for C++: Debugging C Plus Plus.
  1223. When completing in an expression which looks up a field in a
  1224. structure, GDB also tries(1) to limit completions to the field names
  1225. available in the type of the left-hand-side:
  1226. (gdb) p gdb_stdout.M-?
  1227. magic to_fputs to_rewind
  1228. to_data to_isatty to_write
  1229. to_delete to_put to_write_async_safe
  1230. to_flush to_read
  1231. This is because the 'gdb_stdout' is a variable of the type 'struct
  1232. ui_file' that is defined in GDB sources as follows:
  1233. struct ui_file
  1234. {
  1235. int *magic;
  1236. ui_file_flush_ftype *to_flush;
  1237. ui_file_write_ftype *to_write;
  1238. ui_file_write_async_safe_ftype *to_write_async_safe;
  1239. ui_file_fputs_ftype *to_fputs;
  1240. ui_file_read_ftype *to_read;
  1241. ui_file_delete_ftype *to_delete;
  1242. ui_file_isatty_ftype *to_isatty;
  1243. ui_file_rewind_ftype *to_rewind;
  1244. ui_file_put_ftype *to_put;
  1245. void *to_data;
  1246. }
  1247. ---------- Footnotes ----------
  1248. (1) The completer can be confused by certain kinds of invalid
  1249. expressions. Also, it only examines the static type of the expression,
  1250. not the dynamic type.
  1251. 
  1252. File: gdb.info, Node: Command Options, Next: Command aliases default args, Prev: Completion, Up: Commands
  1253. 3.4 Command options
  1254. ===================
  1255. Some commands accept options starting with a leading dash. For example,
  1256. 'print -pretty'. Similarly to command names, you can abbreviate a GDB
  1257. option to the first few letters of the option name, if that abbreviation
  1258. is unambiguous, and you can also use the <TAB> key to get GDB to fill
  1259. out the rest of a word in an option (or to show you the alternatives
  1260. available, if there is more than one possibility).
  1261. Some commands take raw input as argument. For example, the print
  1262. command processes arbitrary expressions in any of the languages
  1263. supported by GDB. With such commands, because raw input may start with
  1264. a leading dash that would be confused with an option or any of its
  1265. abbreviations, e.g. 'print -p' (short for 'print -pretty' or printing
  1266. negative 'p'?), if you specify any command option, then you must use a
  1267. double-dash ('--') delimiter to indicate the end of options.
  1268. Some options are described as accepting an argument which can be
  1269. either 'on' or 'off'. These are known as "boolean options". Similarly
  1270. to boolean settings commands--'on' and 'off' are the typical values, but
  1271. any of '1', 'yes' and 'enable' can also be used as "true" value, and any
  1272. of '0', 'no' and 'disable' can also be used as "false" value. You can
  1273. also omit a "true" value, as it is implied by default.
  1274. For example, these are equivalent:
  1275. (gdb) print -object on -pretty off -element unlimited -- *myptr
  1276. (gdb) p -o -p 0 -e u -- *myptr
  1277. You can discover the set of options some command accepts by
  1278. completing on '-' after the command name. For example:
  1279. (gdb) print -<TAB><TAB>
  1280. -address -max-depth -raw-values -union
  1281. -array -null-stop -repeats -vtbl
  1282. -array-indexes -object -static-members
  1283. -elements -pretty -symbol
  1284. Completion will in some cases guide you with a suggestion of what
  1285. kind of argument an option expects. For example:
  1286. (gdb) print -elements <TAB><TAB>
  1287. NUMBER unlimited
  1288. Here, the option expects a number (e.g., '100'), not literal
  1289. 'NUMBER'. Such metasyntactical arguments are always presented in
  1290. uppercase.
  1291. (For more on using the 'print' command, see *note Examining Data:
  1292. Data.)
  1293. 
  1294. File: gdb.info, Node: Command aliases default args, Next: Help, Prev: Command Options, Up: Commands
  1295. 3.5 Automatically prepend default arguments to user-defined aliases
  1296. ===================================================================
  1297. You can tell GDB to always prepend some default arguments to the list of
  1298. arguments provided explicitly by the user when using a user-defined
  1299. alias.
  1300. If you repeatedly use the same arguments or options for a command,
  1301. you can define an alias for this command and tell GDB to automatically
  1302. prepend these arguments or options to the list of arguments you type
  1303. explicitly when using the alias(1).
  1304. For example, if you often use the command 'thread apply all'
  1305. specifying to work on the threads in ascending order and to continue in
  1306. case it encounters an error, you can tell GDB to automatically preprend
  1307. the '-ascending' and '-c' options by using:
  1308. (gdb) alias thread apply asc-all = thread apply all -ascending -c
  1309. Once you have defined this alias with its default args, any time you
  1310. type the 'thread apply asc-all' followed by 'some arguments', GDB will
  1311. execute 'thread apply all -ascending -c some arguments'.
  1312. To have even less to type, you can also define a one word alias:
  1313. (gdb) alias t_a_c = thread apply all -ascending -c
  1314. As usual, unambiguous abbreviations can be used for ALIAS and
  1315. DEFAULT-ARGS.
  1316. The different aliases of a command do not share their default args.
  1317. For example, you define a new alias 'bt_ALL' showing all possible
  1318. information and another alias 'bt_SMALL' showing very limited
  1319. information using:
  1320. (gdb) alias bt_ALL = backtrace -entry-values both -frame-arg all \
  1321. -past-main -past-entry -full
  1322. (gdb) alias bt_SMALL = backtrace -entry-values no -frame-arg none \
  1323. -past-main off -past-entry off
  1324. (For more on using the 'alias' command, see *note Aliases::.)
  1325. Default args are not limited to the arguments and options of COMMAND,
  1326. but can specify nested commands if COMMAND accepts such a nested command
  1327. as argument. For example, the below defines 'faalocalsoftype' that
  1328. lists the frames having locals of a certain type, together with the
  1329. matching local vars:
  1330. (gdb) alias faalocalsoftype = frame apply all info locals -q -t
  1331. (gdb) faalocalsoftype int
  1332. #1 0x55554f5e in sleeper_or_burner (v=0xdf50) at sleepers.c:86
  1333. i = 0
  1334. ret = 21845
  1335. This is also very useful to define an alias for a set of nested
  1336. 'with' commands to have a particular combination of temporary settings.
  1337. For example, the below defines the alias 'pp10' that pretty prints an
  1338. expression argument, with a maximum of 10 elements if the expression is
  1339. a string or an array:
  1340. (gdb) alias pp10 = with print pretty -- with print elements 10 -- print
  1341. This defines the alias 'pp10' as being a sequence of 3 commands. The
  1342. first part 'with print pretty --' temporarily activates the setting 'set
  1343. print pretty', then launches the command that follows the separator
  1344. '--'. The command following the first part is also a 'with' command
  1345. that temporarily changes the setting 'set print elements' to 10, then
  1346. launches the command that follows the second separator '--'. The third
  1347. part 'print' is the command the 'pp10' alias will launch, using the
  1348. temporary values of the settings and the arguments explicitly given by
  1349. the user. For more information about the 'with' command usage, see
  1350. *note Command Settings::.
  1351. ---------- Footnotes ----------
  1352. (1) GDB could easily accept default arguments for pre-defined
  1353. commands and aliases, but it was deemed this would be confusing, and so
  1354. is not allowed.
  1355. 
  1356. File: gdb.info, Node: Help, Prev: Command aliases default args, Up: Commands
  1357. 3.6 Getting Help
  1358. ================
  1359. You can always ask GDB itself for information on its commands, using the
  1360. command 'help'.
  1361. 'help'
  1362. 'h'
  1363. You can use 'help' (abbreviated 'h') with no arguments to display a
  1364. short list of named classes of commands:
  1365. (gdb) help
  1366. List of classes of commands:
  1367. aliases -- User-defined aliases of other commands
  1368. breakpoints -- Making program stop at certain points
  1369. data -- Examining data
  1370. files -- Specifying and examining files
  1371. internals -- Maintenance commands
  1372. obscure -- Obscure features
  1373. running -- Running the program
  1374. stack -- Examining the stack
  1375. status -- Status inquiries
  1376. support -- Support facilities
  1377. tracepoints -- Tracing of program execution without
  1378. stopping the program
  1379. user-defined -- User-defined commands
  1380. Type "help" followed by a class name for a list of
  1381. commands in that class.
  1382. Type "help" followed by command name for full
  1383. documentation.
  1384. Command name abbreviations are allowed if unambiguous.
  1385. (gdb)
  1386. 'help CLASS'
  1387. Using one of the general help classes as an argument, you can get a
  1388. list of the individual commands in that class. If a command has
  1389. aliases, the aliases are given after the command name, separated by
  1390. commas. If an alias has default arguments, the full definition of
  1391. the alias is given after the first line. For example, here is the
  1392. help display for the class 'status':
  1393. (gdb) help status
  1394. Status inquiries.
  1395. List of commands:
  1396. info, inf, i -- Generic command for showing things
  1397. about the program being debugged
  1398. info address, iamain -- Describe where symbol SYM is stored.
  1399. alias iamain = info address main
  1400. info all-registers -- List of all registers and their contents,
  1401. for selected stack frame.
  1402. ...
  1403. show, info set -- Generic command for showing things
  1404. about the debugger
  1405. Type "help" followed by command name for full
  1406. documentation.
  1407. Command name abbreviations are allowed if unambiguous.
  1408. (gdb)
  1409. 'help COMMAND'
  1410. With a command name as 'help' argument, GDB displays a short
  1411. paragraph on how to use that command. If that command has one or
  1412. more aliases, GDB will display a first line with the command name
  1413. and all its aliases separated by commas. This first line will be
  1414. followed by the full definition of all aliases having default
  1415. arguments.
  1416. 'apropos [-v] REGEXP'
  1417. The 'apropos' command searches through all of the GDB commands, and
  1418. their documentation, for the regular expression specified in ARGS.
  1419. It prints out all matches found. The optional flag '-v', which
  1420. stands for 'verbose', indicates to output the full documentation of
  1421. the matching commands and highlight the parts of the documentation
  1422. matching REGEXP. For example:
  1423. apropos alias
  1424. results in:
  1425. alias -- Define a new command that is an alias of an existing command
  1426. aliases -- User-defined aliases of other commands
  1427. while
  1428. apropos -v cut.*thread apply
  1429. results in the below output, where 'cut for 'thread apply' is
  1430. highlighted if styling is enabled.
  1431. taas -- Apply a command to all threads (ignoring errors
  1432. and empty output).
  1433. Usage: taas COMMAND
  1434. shortcut for 'thread apply all -s COMMAND'
  1435. tfaas -- Apply a command to all frames of all threads
  1436. (ignoring errors and empty output).
  1437. Usage: tfaas COMMAND
  1438. shortcut for 'thread apply all -s frame apply all -s COMMAND'
  1439. 'complete ARGS'
  1440. The 'complete ARGS' command lists all the possible completions for
  1441. the beginning of a command. Use ARGS to specify the beginning of
  1442. the command you want completed. For example:
  1443. complete i
  1444. results in:
  1445. if
  1446. ignore
  1447. info
  1448. inspect
  1449. This is intended for use by GNU Emacs.
  1450. In addition to 'help', you can use the GDB commands 'info' and 'show'
  1451. to inquire about the state of your program, or the state of GDB itself.
  1452. Each command supports many topics of inquiry; this manual introduces
  1453. each of them in the appropriate context. The listings under 'info' and
  1454. under 'show' in the Command, Variable, and Function Index point to all
  1455. the sub-commands. *Note Command and Variable Index::.
  1456. 'info'
  1457. This command (abbreviated 'i') is for describing the state of your
  1458. program. For example, you can show the arguments passed to a
  1459. function with 'info args', list the registers currently in use with
  1460. 'info registers', or list the breakpoints you have set with 'info
  1461. breakpoints'. You can get a complete list of the 'info'
  1462. sub-commands with 'help info'.
  1463. 'set'
  1464. You can assign the result of an expression to an environment
  1465. variable with 'set'. For example, you can set the GDB prompt to a
  1466. $-sign with 'set prompt $'.
  1467. 'show'
  1468. In contrast to 'info', 'show' is for describing the state of GDB
  1469. itself. You can change most of the things you can 'show', by using
  1470. the related command 'set'; for example, you can control what number
  1471. system is used for displays with 'set radix', or simply inquire
  1472. which is currently in use with 'show radix'.
  1473. To display all the settable parameters and their current values,
  1474. you can use 'show' with no arguments; you may also use 'info set'.
  1475. Both commands produce the same display.
  1476. Here are several miscellaneous 'show' subcommands, all of which are
  1477. exceptional in lacking corresponding 'set' commands:
  1478. 'show version'
  1479. Show what version of GDB is running. You should include this
  1480. information in GDB bug-reports. If multiple versions of GDB are in
  1481. use at your site, you may need to determine which version of GDB
  1482. you are running; as GDB evolves, new commands are introduced, and
  1483. old ones may wither away. Also, many system vendors ship variant
  1484. versions of GDB, and there are variant versions of GDB in GNU/Linux
  1485. distributions as well. The version number is the same as the one
  1486. announced when you start GDB.
  1487. 'show copying'
  1488. 'info copying'
  1489. Display information about permission for copying GDB.
  1490. 'show warranty'
  1491. 'info warranty'
  1492. Display the GNU "NO WARRANTY" statement, or a warranty, if your
  1493. version of GDB comes with one.
  1494. 'show configuration'
  1495. Display detailed information about the way GDB was configured when
  1496. it was built. This displays the optional arguments passed to the
  1497. 'configure' script and also configuration parameters detected
  1498. automatically by 'configure'. When reporting a GDB bug (*note GDB
  1499. Bugs::), it is important to include this information in your
  1500. report.
  1501. 
  1502. File: gdb.info, Node: Running, Next: Stopping, Prev: Commands, Up: Top
  1503. 4 Running Programs Under GDB
  1504. ****************************
  1505. When you run a program under GDB, you must first generate debugging
  1506. information when you compile it.
  1507. You may start GDB with its arguments, if any, in an environment of
  1508. your choice. If you are doing native debugging, you may redirect your
  1509. program's input and output, debug an already running process, or kill a
  1510. child process.
  1511. * Menu:
  1512. * Compilation:: Compiling for debugging
  1513. * Starting:: Starting your program
  1514. * Arguments:: Your program's arguments
  1515. * Environment:: Your program's environment
  1516. * Working Directory:: Your program's working directory
  1517. * Input/Output:: Your program's input and output
  1518. * Attach:: Debugging an already-running process
  1519. * Kill Process:: Killing the child process
  1520. * Inferiors Connections and Programs:: Debugging multiple inferiors
  1521. connections and programs
  1522. * Threads:: Debugging programs with multiple threads
  1523. * Forks:: Debugging forks
  1524. * Checkpoint/Restart:: Setting a _bookmark_ to return to later
  1525. 
  1526. File: gdb.info, Node: Compilation, Next: Starting, Up: Running
  1527. 4.1 Compiling for Debugging
  1528. ===========================
  1529. In order to debug a program effectively, you need to generate debugging
  1530. information when you compile it. This debugging information is stored
  1531. in the object file; it describes the data type of each variable or
  1532. function and the correspondence between source line numbers and
  1533. addresses in the executable code.
  1534. To request debugging information, specify the '-g' option when you
  1535. run the compiler.
  1536. Programs that are to be shipped to your customers are compiled with
  1537. optimizations, using the '-O' compiler option. However, some compilers
  1538. are unable to handle the '-g' and '-O' options together. Using those
  1539. compilers, you cannot generate optimized executables containing
  1540. debugging information.
  1541. GCC, the GNU C/C++ compiler, supports '-g' with or without '-O',
  1542. making it possible to debug optimized code. We recommend that you
  1543. _always_ use '-g' whenever you compile a program. You may think your
  1544. program is correct, but there is no sense in pushing your luck. For
  1545. more information, see *note Optimized Code::.
  1546. Older versions of the GNU C compiler permitted a variant option '-gg'
  1547. for debugging information. GDB no longer supports this format; if your
  1548. GNU C compiler has this option, do not use it.
  1549. GDB knows about preprocessor macros and can show you their expansion
  1550. (*note Macros::). Most compilers do not include information about
  1551. preprocessor macros in the debugging information if you specify the '-g'
  1552. flag alone. Version 3.1 and later of GCC, the GNU C compiler, provides
  1553. macro information if you are using the DWARF debugging format, and
  1554. specify the option '-g3'.
  1555. *Note Options for Debugging Your Program or GCC: (gcc)Debugging
  1556. Options, for more information on GCC options affecting debug
  1557. information.
  1558. You will have the best debugging experience if you use the latest
  1559. version of the DWARF debugging format that your compiler supports.
  1560. DWARF is currently the most expressive and best supported debugging
  1561. format in GDB.
  1562. 
  1563. File: gdb.info, Node: Starting, Next: Arguments, Prev: Compilation, Up: Running
  1564. 4.2 Starting your Program
  1565. =========================
  1566. 'run'
  1567. 'r'
  1568. Use the 'run' command to start your program under GDB. You must
  1569. first specify the program name with an argument to GDB (*note
  1570. Getting In and Out of GDB: Invocation.), or by using the 'file' or
  1571. 'exec-file' command (*note Commands to Specify Files: Files.).
  1572. If you are running your program in an execution environment that
  1573. supports processes, 'run' creates an inferior process and makes that
  1574. process run your program. In some environments without processes, 'run'
  1575. jumps to the start of your program. Other targets, like 'remote', are
  1576. always running. If you get an error message like this one:
  1577. The "remote" target does not support "run".
  1578. Try "help target" or "continue".
  1579. then use 'continue' to run your program. You may need 'load' first
  1580. (*note load::).
  1581. The execution of a program is affected by certain information it
  1582. receives from its superior. GDB provides ways to specify this
  1583. information, which you must do _before_ starting your program. (You can
  1584. change it after starting your program, but such changes only affect your
  1585. program the next time you start it.) This information may be divided
  1586. into four categories:
  1587. The _arguments._
  1588. Specify the arguments to give your program as the arguments of the
  1589. 'run' command. If a shell is available on your target, the shell
  1590. is used to pass the arguments, so that you may use normal
  1591. conventions (such as wildcard expansion or variable substitution)
  1592. in describing the arguments. In Unix systems, you can control
  1593. which shell is used with the 'SHELL' environment variable. If you
  1594. do not define 'SHELL', GDB uses the default shell ('/bin/sh'). You
  1595. can disable use of any shell with the 'set startup-with-shell'
  1596. command (see below for details).
  1597. The _environment._
  1598. Your program normally inherits its environment from GDB, but you
  1599. can use the GDB commands 'set environment' and 'unset environment'
  1600. to change parts of the environment that affect your program. *Note
  1601. Your Program's Environment: Environment.
  1602. The _working directory._
  1603. You can set your program's working directory with the command 'set
  1604. cwd'. If you do not set any working directory with this command,
  1605. your program will inherit GDB's working directory if native
  1606. debugging, or the remote server's working directory if remote
  1607. debugging. *Note Your Program's Working Directory: Working
  1608. Directory.
  1609. The _standard input and output._
  1610. Your program normally uses the same device for standard input and
  1611. standard output as GDB is using. You can redirect input and output
  1612. in the 'run' command line, or you can use the 'tty' command to set
  1613. a different device for your program. *Note Your Program's Input
  1614. and Output: Input/Output.
  1615. _Warning:_ While input and output redirection work, you cannot use
  1616. pipes to pass the output of the program you are debugging to
  1617. another program; if you attempt this, GDB is likely to wind up
  1618. debugging the wrong program.
  1619. When you issue the 'run' command, your program begins to execute
  1620. immediately. *Note Stopping and Continuing: Stopping, for discussion of
  1621. how to arrange for your program to stop. Once your program has stopped,
  1622. you may call functions in your program, using the 'print' or 'call'
  1623. commands. *Note Examining Data: Data.
  1624. If the modification time of your symbol file has changed since the
  1625. last time GDB read its symbols, GDB discards its symbol table, and reads
  1626. it again. When it does this, GDB tries to retain your current
  1627. breakpoints.
  1628. 'start'
  1629. The name of the main procedure can vary from language to language.
  1630. With C or C++, the main procedure name is always 'main', but other
  1631. languages such as Ada do not require a specific name for their main
  1632. procedure. The debugger provides a convenient way to start the
  1633. execution of the program and to stop at the beginning of the main
  1634. procedure, depending on the language used.
  1635. The 'start' command does the equivalent of setting a temporary
  1636. breakpoint at the beginning of the main procedure and then invoking
  1637. the 'run' command.
  1638. Some programs contain an "elaboration" phase where some startup
  1639. code is executed before the main procedure is called. This depends
  1640. on the languages used to write your program. In C++, for instance,
  1641. constructors for static and global objects are executed before
  1642. 'main' is called. It is therefore possible that the debugger stops
  1643. before reaching the main procedure. However, the temporary
  1644. breakpoint will remain to halt execution.
  1645. Specify the arguments to give to your program as arguments to the
  1646. 'start' command. These arguments will be given verbatim to the
  1647. underlying 'run' command. Note that the same arguments will be
  1648. reused if no argument is provided during subsequent calls to
  1649. 'start' or 'run'.
  1650. It is sometimes necessary to debug the program during elaboration.
  1651. In these cases, using the 'start' command would stop the execution
  1652. of your program too late, as the program would have already
  1653. completed the elaboration phase. Under these circumstances, either
  1654. insert breakpoints in your elaboration code before running your
  1655. program or use the 'starti' command.
  1656. 'starti'
  1657. The 'starti' command does the equivalent of setting a temporary
  1658. breakpoint at the first instruction of a program's execution and
  1659. then invoking the 'run' command. For programs containing an
  1660. elaboration phase, the 'starti' command will stop execution at the
  1661. start of the elaboration phase.
  1662. 'set exec-wrapper WRAPPER'
  1663. 'show exec-wrapper'
  1664. 'unset exec-wrapper'
  1665. When 'exec-wrapper' is set, the specified wrapper is used to launch
  1666. programs for debugging. GDB starts your program with a shell
  1667. command of the form 'exec WRAPPER PROGRAM'. Quoting is added to
  1668. PROGRAM and its arguments, but not to WRAPPER, so you should add
  1669. quotes if appropriate for your shell. The wrapper runs until it
  1670. executes your program, and then GDB takes control.
  1671. You can use any program that eventually calls 'execve' with its
  1672. arguments as a wrapper. Several standard Unix utilities do this,
  1673. e.g. 'env' and 'nohup'. Any Unix shell script ending with 'exec
  1674. "$@"' will also work.
  1675. For example, you can use 'env' to pass an environment variable to
  1676. the debugged program, without setting the variable in your shell's
  1677. environment:
  1678. (gdb) set exec-wrapper env 'LD_PRELOAD=libtest.so'
  1679. (gdb) run
  1680. This command is available when debugging locally on most targets,
  1681. excluding DJGPP, Cygwin, MS Windows, and QNX Neutrino.
  1682. 'set startup-with-shell'
  1683. 'set startup-with-shell on'
  1684. 'set startup-with-shell off'
  1685. 'show startup-with-shell'
  1686. On Unix systems, by default, if a shell is available on your
  1687. target, GDB) uses it to start your program. Arguments of the 'run'
  1688. command are passed to the shell, which does variable substitution,
  1689. expands wildcard characters and performs redirection of I/O. In
  1690. some circumstances, it may be useful to disable such use of a
  1691. shell, for example, when debugging the shell itself or diagnosing
  1692. startup failures such as:
  1693. (gdb) run
  1694. Starting program: ./a.out
  1695. During startup program terminated with signal SIGSEGV, Segmentation fault.
  1696. which indicates the shell or the wrapper specified with
  1697. 'exec-wrapper' crashed, not your program. Most often, this is
  1698. caused by something odd in your shell's non-interactive mode
  1699. initialization file--such as '.cshrc' for C-shell, $'.zshenv' for
  1700. the Z shell, or the file specified in the 'BASH_ENV' environment
  1701. variable for BASH.
  1702. 'set auto-connect-native-target'
  1703. 'set auto-connect-native-target on'
  1704. 'set auto-connect-native-target off'
  1705. 'show auto-connect-native-target'
  1706. By default, if the current inferior is not connected to any target
  1707. yet (e.g., with 'target remote'), the 'run' command starts your
  1708. program as a native process under GDB, on your local machine. If
  1709. you're sure you don't want to debug programs on your local machine,
  1710. you can tell GDB to not connect to the native target automatically
  1711. with the 'set auto-connect-native-target off' command.
  1712. If 'on', which is the default, and if the current inferior is not
  1713. connected to a target already, the 'run' command automaticaly
  1714. connects to the native target, if one is available.
  1715. If 'off', and if the current inferior is not connected to a target
  1716. already, the 'run' command fails with an error:
  1717. (gdb) run
  1718. Don't know how to run. Try "help target".
  1719. If the current inferior is already connected to a target, GDB
  1720. always uses it with the 'run' command.
  1721. In any case, you can explicitly connect to the native target with
  1722. the 'target native' command. For example,
  1723. (gdb) set auto-connect-native-target off
  1724. (gdb) run
  1725. Don't know how to run. Try "help target".
  1726. (gdb) target native
  1727. (gdb) run
  1728. Starting program: ./a.out
  1729. [Inferior 1 (process 10421) exited normally]
  1730. In case you connected explicitly to the 'native' target, GDB
  1731. remains connected even if all inferiors exit, ready for the next
  1732. 'run' command. Use the 'disconnect' command to disconnect.
  1733. Examples of other commands that likewise respect the
  1734. 'auto-connect-native-target' setting: 'attach', 'info proc', 'info
  1735. os'.
  1736. 'set disable-randomization'
  1737. 'set disable-randomization on'
  1738. This option (enabled by default in GDB) will turn off the native
  1739. randomization of the virtual address space of the started program.
  1740. This option is useful for multiple debugging sessions to make the
  1741. execution better reproducible and memory addresses reusable across
  1742. debugging sessions.
  1743. This feature is implemented only on certain targets, including
  1744. GNU/Linux. On GNU/Linux you can get the same behavior using
  1745. (gdb) set exec-wrapper setarch `uname -m` -R
  1746. 'set disable-randomization off'
  1747. Leave the behavior of the started executable unchanged. Some bugs
  1748. rear their ugly heads only when the program is loaded at certain
  1749. addresses. If your bug disappears when you run the program under
  1750. GDB, that might be because GDB by default disables the address
  1751. randomization on platforms, such as GNU/Linux, which do that for
  1752. stand-alone programs. Use 'set disable-randomization off' to try
  1753. to reproduce such elusive bugs.
  1754. On targets where it is available, virtual address space
  1755. randomization protects the programs against certain kinds of
  1756. security attacks. In these cases the attacker needs to know the
  1757. exact location of a concrete executable code. Randomizing its
  1758. location makes it impossible to inject jumps misusing a code at its
  1759. expected addresses.
  1760. Prelinking shared libraries provides a startup performance
  1761. advantage but it makes addresses in these libraries predictable for
  1762. privileged processes by having just unprivileged access at the
  1763. target system. Reading the shared library binary gives enough
  1764. information for assembling the malicious code misusing it. Still
  1765. even a prelinked shared library can get loaded at a new random
  1766. address just requiring the regular relocation process during the
  1767. startup. Shared libraries not already prelinked are always loaded
  1768. at a randomly chosen address.
  1769. Position independent executables (PIE) contain position independent
  1770. code similar to the shared libraries and therefore such executables
  1771. get loaded at a randomly chosen address upon startup. PIE
  1772. executables always load even already prelinked shared libraries at
  1773. a random address. You can build such executable using 'gcc -fPIE
  1774. -pie'.
  1775. Heap (malloc storage), stack and custom mmap areas are always
  1776. placed randomly (as long as the randomization is enabled).
  1777. 'show disable-randomization'
  1778. Show the current setting of the explicit disable of the native
  1779. randomization of the virtual address space of the started program.
  1780. 
  1781. File: gdb.info, Node: Arguments, Next: Environment, Prev: Starting, Up: Running
  1782. 4.3 Your Program's Arguments
  1783. ============================
  1784. The arguments to your program can be specified by the arguments of the
  1785. 'run' command. They are passed to a shell, which expands wildcard
  1786. characters and performs redirection of I/O, and thence to your program.
  1787. Your 'SHELL' environment variable (if it exists) specifies what shell
  1788. GDB uses. If you do not define 'SHELL', GDB uses the default shell
  1789. ('/bin/sh' on Unix).
  1790. On non-Unix systems, the program is usually invoked directly by GDB,
  1791. which emulates I/O redirection via the appropriate system calls, and the
  1792. wildcard characters are expanded by the startup code of the program, not
  1793. by the shell.
  1794. 'run' with no arguments uses the same arguments used by the previous
  1795. 'run', or those set by the 'set args' command.
  1796. 'set args'
  1797. Specify the arguments to be used the next time your program is run.
  1798. If 'set args' has no arguments, 'run' executes your program with no
  1799. arguments. Once you have run your program with arguments, using
  1800. 'set args' before the next 'run' is the only way to run it again
  1801. without arguments.
  1802. 'show args'
  1803. Show the arguments to give your program when it is started.
  1804. 
  1805. File: gdb.info, Node: Environment, Next: Working Directory, Prev: Arguments, Up: Running
  1806. 4.4 Your Program's Environment
  1807. ==============================
  1808. The "environment" consists of a set of environment variables and their
  1809. values. Environment variables conventionally record such things as your
  1810. user name, your home directory, your terminal type, and your search path
  1811. for programs to run. Usually you set up environment variables with the
  1812. shell and they are inherited by all the other programs you run. When
  1813. debugging, it can be useful to try running your program with a modified
  1814. environment without having to start GDB over again.
  1815. 'path DIRECTORY'
  1816. Add DIRECTORY to the front of the 'PATH' environment variable (the
  1817. search path for executables) that will be passed to your program.
  1818. The value of 'PATH' used by GDB does not change. You may specify
  1819. several directory names, separated by whitespace or by a
  1820. system-dependent separator character (':' on Unix, ';' on MS-DOS
  1821. and MS-Windows). If DIRECTORY is already in the path, it is moved
  1822. to the front, so it is searched sooner.
  1823. You can use the string '$cwd' to refer to whatever is the current
  1824. working directory at the time GDB searches the path. If you use
  1825. '.' instead, it refers to the directory where you executed the
  1826. 'path' command. GDB replaces '.' in the DIRECTORY argument (with
  1827. the current path) before adding DIRECTORY to the search path.
  1828. 'show paths'
  1829. Display the list of search paths for executables (the 'PATH'
  1830. environment variable).
  1831. 'show environment [VARNAME]'
  1832. Print the value of environment variable VARNAME to be given to your
  1833. program when it starts. If you do not supply VARNAME, print the
  1834. names and values of all environment variables to be given to your
  1835. program. You can abbreviate 'environment' as 'env'.
  1836. 'set environment VARNAME [=VALUE]'
  1837. Set environment variable VARNAME to VALUE. The value changes for
  1838. your program (and the shell GDB uses to launch it), not for GDB
  1839. itself. The VALUE may be any string; the values of environment
  1840. variables are just strings, and any interpretation is supplied by
  1841. your program itself. The VALUE parameter is optional; if it is
  1842. eliminated, the variable is set to a null value.
  1843. For example, this command:
  1844. set env USER = foo
  1845. tells the debugged program, when subsequently run, that its user is
  1846. named 'foo'. (The spaces around '=' are used for clarity here;
  1847. they are not actually required.)
  1848. Note that on Unix systems, GDB runs your program via a shell, which
  1849. also inherits the environment set with 'set environment'. If
  1850. necessary, you can avoid that by using the 'env' program as a
  1851. wrapper instead of using 'set environment'. *Note set
  1852. exec-wrapper::, for an example doing just that.
  1853. Environment variables that are set by the user are also transmitted
  1854. to 'gdbserver' to be used when starting the remote inferior. *note
  1855. QEnvironmentHexEncoded::.
  1856. 'unset environment VARNAME'
  1857. Remove variable VARNAME from the environment to be passed to your
  1858. program. This is different from 'set env VARNAME ='; 'unset
  1859. environment' removes the variable from the environment, rather than
  1860. assigning it an empty value.
  1861. Environment variables that are unset by the user are also unset on
  1862. 'gdbserver' when starting the remote inferior. *note
  1863. QEnvironmentUnset::.
  1864. _Warning:_ On Unix systems, GDB runs your program using the shell
  1865. indicated by your 'SHELL' environment variable if it exists (or
  1866. '/bin/sh' if not). If your 'SHELL' variable names a shell that runs an
  1867. initialization file when started non-interactively--such as '.cshrc' for
  1868. C-shell, $'.zshenv' for the Z shell, or the file specified in the
  1869. 'BASH_ENV' environment variable for BASH--any variables you set in that
  1870. file affect your program. You may wish to move setting of environment
  1871. variables to files that are only run when you sign on, such as '.login'
  1872. or '.profile'.
  1873. 
  1874. File: gdb.info, Node: Working Directory, Next: Input/Output, Prev: Environment, Up: Running
  1875. 4.5 Your Program's Working Directory
  1876. ====================================
  1877. Each time you start your program with 'run', the inferior will be
  1878. initialized with the current working directory specified by the 'set
  1879. cwd' command. If no directory has been specified by this command, then
  1880. the inferior will inherit GDB's current working directory as its working
  1881. directory if native debugging, or it will inherit the remote server's
  1882. current working directory if remote debugging.
  1883. 'set cwd [DIRECTORY]'
  1884. Set the inferior's working directory to DIRECTORY, which will be
  1885. 'glob'-expanded in order to resolve tildes ('~'). If no argument
  1886. has been specified, the command clears the setting and resets it to
  1887. an empty state. This setting has no effect on GDB's working
  1888. directory, and it only takes effect the next time you start the
  1889. inferior. The '~' in DIRECTORY is a short for the "home
  1890. directory", usually pointed to by the 'HOME' environment variable.
  1891. On MS-Windows, if 'HOME' is not defined, GDB uses the concatenation
  1892. of 'HOMEDRIVE' and 'HOMEPATH' as fallback.
  1893. You can also change GDB's current working directory by using the
  1894. 'cd' command. *Note cd command::.
  1895. 'show cwd'
  1896. Show the inferior's working directory. If no directory has been
  1897. specified by 'set cwd', then the default inferior's working
  1898. directory is the same as GDB's working directory.
  1899. 'cd [DIRECTORY]'
  1900. Set the GDB working directory to DIRECTORY. If not given,
  1901. DIRECTORY uses ''~''.
  1902. The GDB working directory serves as a default for the commands that
  1903. specify files for GDB to operate on. *Note Commands to Specify
  1904. Files: Files. *Note set cwd command::.
  1905. 'pwd'
  1906. Print the GDB working directory.
  1907. It is generally impossible to find the current working directory of
  1908. the process being debugged (since a program can change its directory
  1909. during its run). If you work on a system where GDB supports the 'info
  1910. proc' command (*note Process Information::), you can use the 'info proc'
  1911. command to find out the current working directory of the debuggee.
  1912. 
  1913. File: gdb.info, Node: Input/Output, Next: Attach, Prev: Working Directory, Up: Running
  1914. 4.6 Your Program's Input and Output
  1915. ===================================
  1916. By default, the program you run under GDB does input and output to the
  1917. same terminal that GDB uses. GDB switches the terminal to its own
  1918. terminal modes to interact with you, but it records the terminal modes
  1919. your program was using and switches back to them when you continue
  1920. running your program.
  1921. 'info terminal'
  1922. Displays information recorded by GDB about the terminal modes your
  1923. program is using.
  1924. You can redirect your program's input and/or output using shell
  1925. redirection with the 'run' command. For example,
  1926. run > outfile
  1927. starts your program, diverting its output to the file 'outfile'.
  1928. Another way to specify where your program should do input and output
  1929. is with the 'tty' command. This command accepts a file name as
  1930. argument, and causes this file to be the default for future 'run'
  1931. commands. It also resets the controlling terminal for the child
  1932. process, for future 'run' commands. For example,
  1933. tty /dev/ttyb
  1934. directs that processes started with subsequent 'run' commands default to
  1935. do input and output on the terminal '/dev/ttyb' and have that as their
  1936. controlling terminal.
  1937. An explicit redirection in 'run' overrides the 'tty' command's effect
  1938. on the input/output device, but not its effect on the controlling
  1939. terminal.
  1940. When you use the 'tty' command or redirect input in the 'run'
  1941. command, only the input _for your program_ is affected. The input for
  1942. GDB still comes from your terminal. 'tty' is an alias for 'set
  1943. inferior-tty'.
  1944. You can use the 'show inferior-tty' command to tell GDB to display
  1945. the name of the terminal that will be used for future runs of your
  1946. program.
  1947. 'set inferior-tty [ TTY ]'
  1948. Set the tty for the program being debugged to TTY. Omitting TTY
  1949. restores the default behavior, which is to use the same terminal as
  1950. GDB.
  1951. 'show inferior-tty'
  1952. Show the current tty for the program being debugged.
  1953. 
  1954. File: gdb.info, Node: Attach, Next: Kill Process, Prev: Input/Output, Up: Running
  1955. 4.7 Debugging an Already-running Process
  1956. ========================================
  1957. 'attach PROCESS-ID'
  1958. This command attaches to a running process--one that was started
  1959. outside GDB. ('info files' shows your active targets.) The
  1960. command takes as argument a process ID. The usual way to find out
  1961. the PROCESS-ID of a Unix process is with the 'ps' utility, or with
  1962. the 'jobs -l' shell command.
  1963. 'attach' does not repeat if you press <RET> a second time after
  1964. executing the command.
  1965. To use 'attach', your program must be running in an environment which
  1966. supports processes; for example, 'attach' does not work for programs on
  1967. bare-board targets that lack an operating system. You must also have
  1968. permission to send the process a signal.
  1969. When you use 'attach', the debugger finds the program running in the
  1970. process first by looking in the current working directory, then (if the
  1971. program is not found) by using the source file search path (*note
  1972. Specifying Source Directories: Source Path.). You can also use the
  1973. 'file' command to load the program. *Note Commands to Specify Files:
  1974. Files.
  1975. If the debugger can determine that the executable file running in the
  1976. process it is attaching to does not match the current exec-file loaded
  1977. by GDB, the option 'exec-file-mismatch' specifies how to handle the
  1978. mismatch. GDB tries to compare the files by comparing their build IDs
  1979. (*note build ID::), if available.
  1980. 'set exec-file-mismatch 'ask|warn|off''
  1981. Whether to detect mismatch between the current executable file
  1982. loaded by GDB and the executable file used to start the process.
  1983. If 'ask', the default, display a warning and ask the user whether
  1984. to load the process executable file; if 'warn', just display a
  1985. warning; if 'off', don't attempt to detect a mismatch. If the user
  1986. confirms loading the process executable file, then its symbols will
  1987. be loaded as well.
  1988. 'show exec-file-mismatch'
  1989. Show the current value of 'exec-file-mismatch'.
  1990. The first thing GDB does after arranging to debug the specified
  1991. process is to stop it. You can examine and modify an attached process
  1992. with all the GDB commands that are ordinarily available when you start
  1993. processes with 'run'. You can insert breakpoints; you can step and
  1994. continue; you can modify storage. If you would rather the process
  1995. continue running, you may use the 'continue' command after attaching GDB
  1996. to the process.
  1997. 'detach'
  1998. When you have finished debugging the attached process, you can use
  1999. the 'detach' command to release it from GDB control. Detaching the
  2000. process continues its execution. After the 'detach' command, that
  2001. process and GDB become completely independent once more, and you
  2002. are ready to 'attach' another process or start one with 'run'.
  2003. 'detach' does not repeat if you press <RET> again after executing
  2004. the command.
  2005. If you exit GDB while you have an attached process, you detach that
  2006. process. If you use the 'run' command, you kill that process. By
  2007. default, GDB asks for confirmation if you try to do either of these
  2008. things; you can control whether or not you need to confirm by using the
  2009. 'set confirm' command (*note Optional Warnings and Messages:
  2010. Messages/Warnings.).
  2011. 
  2012. File: gdb.info, Node: Kill Process, Next: Inferiors Connections and Programs, Prev: Attach, Up: Running
  2013. 4.8 Killing the Child Process
  2014. =============================
  2015. 'kill'
  2016. Kill the child process in which your program is running under GDB.
  2017. This command is useful if you wish to debug a core dump instead of a
  2018. running process. GDB ignores any core dump file while your program is
  2019. running.
  2020. On some operating systems, a program cannot be executed outside GDB
  2021. while you have breakpoints set on it inside GDB. You can use the 'kill'
  2022. command in this situation to permit running your program outside the
  2023. debugger.
  2024. The 'kill' command is also useful if you wish to recompile and relink
  2025. your program, since on many systems it is impossible to modify an
  2026. executable file while it is running in a process. In this case, when
  2027. you next type 'run', GDB notices that the file has changed, and reads
  2028. the symbol table again (while trying to preserve your current breakpoint
  2029. settings).
  2030. 
  2031. File: gdb.info, Node: Inferiors Connections and Programs, Next: Threads, Prev: Kill Process, Up: Running
  2032. 4.9 Debugging Multiple Inferiors Connections and Programs
  2033. =========================================================
  2034. GDB lets you run and debug multiple programs in a single session. In
  2035. addition, GDB on some systems may let you run several programs
  2036. simultaneously (otherwise you have to exit from one before starting
  2037. another). On some systems GDB may even let you debug several programs
  2038. simultaneously on different remote systems. In the most general case,
  2039. you can have multiple threads of execution in each of multiple
  2040. processes, launched from multiple executables, running on different
  2041. machines.
  2042. GDB represents the state of each program execution with an object
  2043. called an "inferior". An inferior typically corresponds to a process,
  2044. but is more general and applies also to targets that do not have
  2045. processes. Inferiors may be created before a process runs, and may be
  2046. retained after a process exits. Inferiors have unique identifiers that
  2047. are different from process ids. Usually each inferior will also have
  2048. its own distinct address space, although some embedded targets may have
  2049. several inferiors running in different parts of a single address space.
  2050. Each inferior may in turn have multiple threads running in it.
  2051. To find out what inferiors exist at any moment, use 'info inferiors':
  2052. 'info inferiors'
  2053. Print a list of all inferiors currently being managed by GDB. By
  2054. default all inferiors are printed, but the argument ID... - a space
  2055. separated list of inferior numbers - can be used to limit the
  2056. display to just the requested inferiors.
  2057. GDB displays for each inferior (in this order):
  2058. 1. the inferior number assigned by GDB
  2059. 2. the target system's inferior identifier
  2060. 3. the target connection the inferior is bound to, including the
  2061. unique connection number assigned by GDB, and the protocol
  2062. used by the connection.
  2063. 4. the name of the executable the inferior is running.
  2064. An asterisk '*' preceding the GDB inferior number indicates the
  2065. current inferior.
  2066. For example,
  2067. (gdb) info inferiors
  2068. Num Description Connection Executable
  2069. * 1 process 3401 1 (native) goodbye
  2070. 2 process 2307 2 (extended-remote host:10000) hello
  2071. To find out what open target connections exist at any moment, use
  2072. 'info connections':
  2073. 'info connections'
  2074. Print a list of all open target connections currently being managed
  2075. by GDB. By default all connections are printed, but the argument
  2076. ID... - a space separated list of connections numbers - can be used
  2077. to limit the display to just the requested connections.
  2078. GDB displays for each connection (in this order):
  2079. 1. the connection number assigned by GDB.
  2080. 2. the protocol used by the connection.
  2081. 3. a textual description of the protocol used by the connection.
  2082. An asterisk '*' preceding the connection number indicates the
  2083. connection of the current inferior.
  2084. For example,
  2085. (gdb) info connections
  2086. Num What Description
  2087. * 1 extended-remote host:10000 Extended remote serial target in gdb-specific protocol
  2088. 2 native Native process
  2089. 3 core Local core dump file
  2090. To switch focus between inferiors, use the 'inferior' command:
  2091. 'inferior INFNO'
  2092. Make inferior number INFNO the current inferior. The argument
  2093. INFNO is the inferior number assigned by GDB, as shown in the first
  2094. field of the 'info inferiors' display.
  2095. The debugger convenience variable '$_inferior' contains the number of
  2096. the current inferior. You may find this useful in writing breakpoint
  2097. conditional expressions, command scripts, and so forth. *Note
  2098. Convenience Variables: Convenience Vars, for general information on
  2099. convenience variables.
  2100. You can get multiple executables into a debugging session via the
  2101. 'add-inferior' and 'clone-inferior' commands. On some systems GDB can
  2102. add inferiors to the debug session automatically by following calls to
  2103. 'fork' and 'exec'. To remove inferiors from the debugging session use
  2104. the 'remove-inferiors' command.
  2105. 'add-inferior [ -copies N ] [ -exec EXECUTABLE ] [-no-connection ]'
  2106. Adds N inferiors to be run using EXECUTABLE as the executable; N
  2107. defaults to 1. If no executable is specified, the inferiors begins
  2108. empty, with no program. You can still assign or change the program
  2109. assigned to the inferior at any time by using the 'file' command
  2110. with the executable name as its argument.
  2111. By default, the new inferior begins connected to the same target
  2112. connection as the current inferior. For example, if the current
  2113. inferior was connected to 'gdbserver' with 'target remote', then
  2114. the new inferior will be connected to the same 'gdbserver'
  2115. instance. The '-no-connection' option starts the new inferior with
  2116. no connection yet. You can then for example use the 'target
  2117. remote' command to connect to some other 'gdbserver' instance, use
  2118. 'run' to spawn a local program, etc.
  2119. 'clone-inferior [ -copies N ] [ INFNO ]'
  2120. Adds N inferiors ready to execute the same program as inferior
  2121. INFNO; N defaults to 1, and INFNO defaults to the number of the
  2122. current inferior. This is a convenient command when you want to
  2123. run another instance of the inferior you are debugging.
  2124. (gdb) info inferiors
  2125. Num Description Connection Executable
  2126. * 1 process 29964 1 (native) helloworld
  2127. (gdb) clone-inferior
  2128. Added inferior 2.
  2129. 1 inferiors added.
  2130. (gdb) info inferiors
  2131. Num Description Connection Executable
  2132. * 1 process 29964 1 (native) helloworld
  2133. 2 <null> 1 (native) helloworld
  2134. You can now simply switch focus to inferior 2 and run it.
  2135. 'remove-inferiors INFNO...'
  2136. Removes the inferior or inferiors INFNO.... It is not possible to
  2137. remove an inferior that is running with this command. For those,
  2138. use the 'kill' or 'detach' command first.
  2139. To quit debugging one of the running inferiors that is not the
  2140. current inferior, you can either detach from it by using the
  2141. 'detach inferior' command (allowing it to run independently), or kill it
  2142. using the 'kill inferiors' command:
  2143. 'detach inferior INFNO...'
  2144. Detach from the inferior or inferiors identified by GDB inferior
  2145. number(s) INFNO.... Note that the inferior's entry still stays on
  2146. the list of inferiors shown by 'info inferiors', but its
  2147. Description will show '<null>'.
  2148. 'kill inferiors INFNO...'
  2149. Kill the inferior or inferiors identified by GDB inferior number(s)
  2150. INFNO.... Note that the inferior's entry still stays on the list
  2151. of inferiors shown by 'info inferiors', but its Description will
  2152. show '<null>'.
  2153. After the successful completion of a command such as 'detach',
  2154. 'detach inferiors', 'kill' or 'kill inferiors', or after a normal
  2155. process exit, the inferior is still valid and listed with 'info
  2156. inferiors', ready to be restarted.
  2157. To be notified when inferiors are started or exit under GDB's control
  2158. use 'set print inferior-events':
  2159. 'set print inferior-events'
  2160. 'set print inferior-events on'
  2161. 'set print inferior-events off'
  2162. The 'set print inferior-events' command allows you to enable or
  2163. disable printing of messages when GDB notices that new inferiors
  2164. have started or that inferiors have exited or have been detached.
  2165. By default, these messages will not be printed.
  2166. 'show print inferior-events'
  2167. Show whether messages will be printed when GDB detects that
  2168. inferiors have started, exited or have been detached.
  2169. Many commands will work the same with multiple programs as with a
  2170. single program: e.g., 'print myglobal' will simply display the value of
  2171. 'myglobal' in the current inferior.
  2172. Occasionally, when debugging GDB itself, it may be useful to get more
  2173. info about the relationship of inferiors, programs, address spaces in a
  2174. debug session. You can do that with the 'maint info program-spaces'
  2175. command.
  2176. 'maint info program-spaces'
  2177. Print a list of all program spaces currently being managed by GDB.
  2178. GDB displays for each program space (in this order):
  2179. 1. the program space number assigned by GDB
  2180. 2. the name of the executable loaded into the program space, with
  2181. e.g., the 'file' command.
  2182. An asterisk '*' preceding the GDB program space number indicates
  2183. the current program space.
  2184. In addition, below each program space line, GDB prints extra
  2185. information that isn't suitable to display in tabular form. For
  2186. example, the list of inferiors bound to the program space.
  2187. (gdb) maint info program-spaces
  2188. Id Executable
  2189. * 1 hello
  2190. 2 goodbye
  2191. Bound inferiors: ID 1 (process 21561)
  2192. Here we can see that no inferior is running the program 'hello',
  2193. while 'process 21561' is running the program 'goodbye'. On some
  2194. targets, it is possible that multiple inferiors are bound to the
  2195. same program space. The most common example is that of debugging
  2196. both the parent and child processes of a 'vfork' call. For
  2197. example,
  2198. (gdb) maint info program-spaces
  2199. Id Executable
  2200. * 1 vfork-test
  2201. Bound inferiors: ID 2 (process 18050), ID 1 (process 18045)
  2202. Here, both inferior 2 and inferior 1 are running in the same
  2203. program space as a result of inferior 1 having executed a 'vfork'
  2204. call.
  2205. 
  2206. File: gdb.info, Node: Threads, Next: Forks, Prev: Inferiors Connections and Programs, Up: Running
  2207. 4.10 Debugging Programs with Multiple Threads
  2208. =============================================
  2209. In some operating systems, such as GNU/Linux and Solaris, a single
  2210. program may have more than one "thread" of execution. The precise
  2211. semantics of threads differ from one operating system to another, but in
  2212. general the threads of a single program are akin to multiple
  2213. processes--except that they share one address space (that is, they can
  2214. all examine and modify the same variables). On the other hand, each
  2215. thread has its own registers and execution stack, and perhaps private
  2216. memory.
  2217. GDB provides these facilities for debugging multi-thread programs:
  2218. * automatic notification of new threads
  2219. * 'thread THREAD-ID', a command to switch among threads
  2220. * 'info threads', a command to inquire about existing threads
  2221. * 'thread apply [THREAD-ID-LIST | all] ARGS', a command to apply a
  2222. command to a list of threads
  2223. * thread-specific breakpoints
  2224. * 'set print thread-events', which controls printing of messages on
  2225. thread start and exit.
  2226. * 'set libthread-db-search-path PATH', which lets the user specify
  2227. which 'libthread_db' to use if the default choice isn't compatible
  2228. with the program.
  2229. The GDB thread debugging facility allows you to observe all threads
  2230. while your program runs--but whenever GDB takes control, one thread in
  2231. particular is always the focus of debugging. This thread is called the
  2232. "current thread". Debugging commands show program information from the
  2233. perspective of the current thread.
  2234. Whenever GDB detects a new thread in your program, it displays the
  2235. target system's identification for the thread with a message in the form
  2236. '[New SYSTAG]', where SYSTAG is a thread identifier whose form varies
  2237. depending on the particular system. For example, on GNU/Linux, you
  2238. might see
  2239. [New Thread 0x41e02940 (LWP 25582)]
  2240. when GDB notices a new thread. In contrast, on other systems, the
  2241. SYSTAG is simply something like 'process 368', with no further
  2242. qualifier.
  2243. For debugging purposes, GDB associates its own thread number --always
  2244. a single integer--with each thread of an inferior. This number is
  2245. unique between all threads of an inferior, but not unique between
  2246. threads of different inferiors.
  2247. You can refer to a given thread in an inferior using the qualified
  2248. INFERIOR-NUM.THREAD-NUM syntax, also known as "qualified thread ID",
  2249. with INFERIOR-NUM being the inferior number and THREAD-NUM being the
  2250. thread number of the given inferior. For example, thread '2.3' refers
  2251. to thread number 3 of inferior 2. If you omit INFERIOR-NUM (e.g.,
  2252. 'thread 3'), then GDB infers you're referring to a thread of the current
  2253. inferior.
  2254. Until you create a second inferior, GDB does not show the
  2255. INFERIOR-NUM part of thread IDs, even though you can always use the full
  2256. INFERIOR-NUM.THREAD-NUM form to refer to threads of inferior 1, the
  2257. initial inferior.
  2258. Some commands accept a space-separated "thread ID list" as argument.
  2259. A list element can be:
  2260. 1. A thread ID as shown in the first field of the 'info threads'
  2261. display, with or without an inferior qualifier. E.g., '2.1' or
  2262. '1'.
  2263. 2. A range of thread numbers, again with or without an inferior
  2264. qualifier, as in INF.THR1-THR2 or THR1-THR2. E.g., '1.2-4' or
  2265. '2-4'.
  2266. 3. All threads of an inferior, specified with a star wildcard, with or
  2267. without an inferior qualifier, as in INF.'*' (e.g., '1.*') or '*'.
  2268. The former refers to all threads of the given inferior, and the
  2269. latter form without an inferior qualifier refers to all threads of
  2270. the current inferior.
  2271. For example, if the current inferior is 1, and inferior 7 has one
  2272. thread with ID 7.1, the thread list '1 2-3 4.5 6.7-9 7.*' includes
  2273. threads 1 to 3 of inferior 1, thread 5 of inferior 4, threads 7 to 9 of
  2274. inferior 6 and all threads of inferior 7. That is, in expanded
  2275. qualified form, the same as '1.1 1.2 1.3 4.5 6.7 6.8 6.9 7.1'.
  2276. In addition to a _per-inferior_ number, each thread is also assigned
  2277. a unique _global_ number, also known as "global thread ID", a single
  2278. integer. Unlike the thread number component of the thread ID, no two
  2279. threads have the same global ID, even when you're debugging multiple
  2280. inferiors.
  2281. From GDB's perspective, a process always has at least one thread. In
  2282. other words, GDB assigns a thread number to the program's "main thread"
  2283. even if the program is not multi-threaded.
  2284. The debugger convenience variables '$_thread' and '$_gthread'
  2285. contain, respectively, the per-inferior thread number and the global
  2286. thread number of the current thread. You may find this useful in
  2287. writing breakpoint conditional expressions, command scripts, and so
  2288. forth. *Note Convenience Variables: Convenience Vars, for general
  2289. information on convenience variables.
  2290. If GDB detects the program is multi-threaded, it augments the usual
  2291. message about stopping at a breakpoint with the ID and name of the
  2292. thread that hit the breakpoint.
  2293. Thread 2 "client" hit Breakpoint 1, send_message () at client.c:68
  2294. Likewise when the program receives a signal:
  2295. Thread 1 "main" received signal SIGINT, Interrupt.
  2296. 'info threads [THREAD-ID-LIST]'
  2297. Display information about one or more threads. With no arguments
  2298. displays information about all threads. You can specify the list
  2299. of threads that you want to display using the thread ID list syntax
  2300. (*note thread ID lists::).
  2301. GDB displays for each thread (in this order):
  2302. 1. the per-inferior thread number assigned by GDB
  2303. 2. the global thread number assigned by GDB, if the '-gid' option
  2304. was specified
  2305. 3. the target system's thread identifier (SYSTAG)
  2306. 4. the thread's name, if one is known. A thread can either be
  2307. named by the user (see 'thread name', below), or, in some
  2308. cases, by the program itself.
  2309. 5. the current stack frame summary for that thread
  2310. An asterisk '*' to the left of the GDB thread number indicates the
  2311. current thread.
  2312. For example,
  2313. (gdb) info threads
  2314. Id Target Id Frame
  2315. * 1 process 35 thread 13 main (argc=1, argv=0x7ffffff8)
  2316. 2 process 35 thread 23 0x34e5 in sigpause ()
  2317. 3 process 35 thread 27 0x34e5 in sigpause ()
  2318. at threadtest.c:68
  2319. If you're debugging multiple inferiors, GDB displays thread IDs using
  2320. the qualified INFERIOR-NUM.THREAD-NUM format. Otherwise, only
  2321. THREAD-NUM is shown.
  2322. If you specify the '-gid' option, GDB displays a column indicating
  2323. each thread's global thread ID:
  2324. (gdb) info threads
  2325. Id GId Target Id Frame
  2326. 1.1 1 process 35 thread 13 main (argc=1, argv=0x7ffffff8)
  2327. 1.2 3 process 35 thread 23 0x34e5 in sigpause ()
  2328. 1.3 4 process 35 thread 27 0x34e5 in sigpause ()
  2329. * 2.1 2 process 65 thread 1 main (argc=1, argv=0x7ffffff8)
  2330. On Solaris, you can display more information about user threads with
  2331. a Solaris-specific command:
  2332. 'maint info sol-threads'
  2333. Display info on Solaris user threads.
  2334. 'thread THREAD-ID'
  2335. Make thread ID THREAD-ID the current thread. The command argument
  2336. THREAD-ID is the GDB thread ID, as shown in the first field of the
  2337. 'info threads' display, with or without an inferior qualifier
  2338. (e.g., '2.1' or '1').
  2339. GDB responds by displaying the system identifier of the thread you
  2340. selected, and its current stack frame summary:
  2341. (gdb) thread 2
  2342. [Switching to thread 2 (Thread 0xb7fdab70 (LWP 12747))]
  2343. #0 some_function (ignore=0x0) at example.c:8
  2344. 8 printf ("hello\n");
  2345. As with the '[New ...]' message, the form of the text after
  2346. 'Switching to' depends on your system's conventions for identifying
  2347. threads.
  2348. 'thread apply [THREAD-ID-LIST | all [-ascending]] [FLAG]... COMMAND'
  2349. The 'thread apply' command allows you to apply the named COMMAND to
  2350. one or more threads. Specify the threads that you want affected
  2351. using the thread ID list syntax (*note thread ID lists::), or
  2352. specify 'all' to apply to all threads. To apply a command to all
  2353. threads in descending order, type 'thread apply all COMMAND'. To
  2354. apply a command to all threads in ascending order, type 'thread
  2355. apply all -ascending COMMAND'.
  2356. The FLAG arguments control what output to produce and how to handle
  2357. errors raised when applying COMMAND to a thread. FLAG must start
  2358. with a '-' directly followed by one letter in 'qcs'. If several
  2359. flags are provided, they must be given individually, such as '-c
  2360. -q'.
  2361. By default, GDB displays some thread information before the output
  2362. produced by COMMAND, and an error raised during the execution of a
  2363. COMMAND will abort 'thread apply'. The following flags can be used
  2364. to fine-tune this behavior:
  2365. '-c'
  2366. The flag '-c', which stands for 'continue', causes any errors
  2367. in COMMAND to be displayed, and the execution of 'thread
  2368. apply' then continues.
  2369. '-s'
  2370. The flag '-s', which stands for 'silent', causes any errors or
  2371. empty output produced by a COMMAND to be silently ignored.
  2372. That is, the execution continues, but the thread information
  2373. and errors are not printed.
  2374. '-q'
  2375. The flag '-q' ('quiet') disables printing the thread
  2376. information.
  2377. Flags '-c' and '-s' cannot be used together.
  2378. 'taas [OPTION]... COMMAND'
  2379. Shortcut for 'thread apply all -s [OPTION]... COMMAND'. Applies
  2380. COMMAND on all threads, ignoring errors and empty output.
  2381. The 'taas' command accepts the same options as the 'thread apply
  2382. all' command. *Note thread apply all::.
  2383. 'tfaas [OPTION]... COMMAND'
  2384. Shortcut for 'thread apply all -s -- frame apply all -s [OPTION]...
  2385. COMMAND'. Applies COMMAND on all frames of all threads, ignoring
  2386. errors and empty output. Note that the flag '-s' is specified
  2387. twice: The first '-s' ensures that 'thread apply' only shows the
  2388. thread information of the threads for which 'frame apply' produces
  2389. some output. The second '-s' is needed to ensure that 'frame
  2390. apply' shows the frame information of a frame only if the COMMAND
  2391. successfully produced some output.
  2392. It can for example be used to print a local variable or a function
  2393. argument without knowing the thread or frame where this variable or
  2394. argument is, using:
  2395. (gdb) tfaas p some_local_var_i_do_not_remember_where_it_is
  2396. The 'tfaas' command accepts the same options as the 'frame apply'
  2397. command. *Note frame apply: Frame Apply.
  2398. 'thread name [NAME]'
  2399. This command assigns a name to the current thread. If no argument
  2400. is given, any existing user-specified name is removed. The thread
  2401. name appears in the 'info threads' display.
  2402. On some systems, such as GNU/Linux, GDB is able to determine the
  2403. name of the thread as given by the OS. On these systems, a name
  2404. specified with 'thread name' will override the system-give name,
  2405. and removing the user-specified name will cause GDB to once again
  2406. display the system-specified name.
  2407. 'thread find [REGEXP]'
  2408. Search for and display thread ids whose name or SYSTAG matches the
  2409. supplied regular expression.
  2410. As well as being the complement to the 'thread name' command, this
  2411. command also allows you to identify a thread by its target SYSTAG.
  2412. For instance, on GNU/Linux, the target SYSTAG is the LWP id.
  2413. (GDB) thread find 26688
  2414. Thread 4 has target id 'Thread 0x41e02940 (LWP 26688)'
  2415. (GDB) info thread 4
  2416. Id Target Id Frame
  2417. 4 Thread 0x41e02940 (LWP 26688) 0x00000031ca6cd372 in select ()
  2418. 'set print thread-events'
  2419. 'set print thread-events on'
  2420. 'set print thread-events off'
  2421. The 'set print thread-events' command allows you to enable or
  2422. disable printing of messages when GDB notices that new threads have
  2423. started or that threads have exited. By default, these messages
  2424. will be printed if detection of these events is supported by the
  2425. target. Note that these messages cannot be disabled on all
  2426. targets.
  2427. 'show print thread-events'
  2428. Show whether messages will be printed when GDB detects that threads
  2429. have started and exited.
  2430. *Note Stopping and Starting Multi-thread Programs: Thread Stops, for
  2431. more information about how GDB behaves when you stop and start programs
  2432. with multiple threads.
  2433. *Note Setting Watchpoints: Set Watchpoints, for information about
  2434. watchpoints in programs with multiple threads.
  2435. 'set libthread-db-search-path [PATH]'
  2436. If this variable is set, PATH is a colon-separated list of
  2437. directories GDB will use to search for 'libthread_db'. If you omit
  2438. PATH, 'libthread-db-search-path' will be reset to its default value
  2439. ('$sdir:$pdir' on GNU/Linux and Solaris systems). Internally, the
  2440. default value comes from the 'LIBTHREAD_DB_SEARCH_PATH' macro.
  2441. On GNU/Linux and Solaris systems, GDB uses a "helper"
  2442. 'libthread_db' library to obtain information about threads in the
  2443. inferior process. GDB will use 'libthread-db-search-path' to find
  2444. 'libthread_db'. GDB also consults first if inferior specific
  2445. thread debugging library loading is enabled by 'set auto-load
  2446. libthread-db' (*note libthread_db.so.1 file::).
  2447. A special entry '$sdir' for 'libthread-db-search-path' refers to
  2448. the default system directories that are normally searched for
  2449. loading shared libraries. The '$sdir' entry is the only kind not
  2450. needing to be enabled by 'set auto-load libthread-db' (*note
  2451. libthread_db.so.1 file::).
  2452. A special entry '$pdir' for 'libthread-db-search-path' refers to
  2453. the directory from which 'libpthread' was loaded in the inferior
  2454. process.
  2455. For any 'libthread_db' library GDB finds in above directories, GDB
  2456. attempts to initialize it with the current inferior process. If
  2457. this initialization fails (which could happen because of a version
  2458. mismatch between 'libthread_db' and 'libpthread'), GDB will unload
  2459. 'libthread_db', and continue with the next directory. If none of
  2460. 'libthread_db' libraries initialize successfully, GDB will issue a
  2461. warning and thread debugging will be disabled.
  2462. Setting 'libthread-db-search-path' is currently implemented only on
  2463. some platforms.
  2464. 'show libthread-db-search-path'
  2465. Display current libthread_db search path.
  2466. 'set debug libthread-db'
  2467. 'show debug libthread-db'
  2468. Turns on or off display of 'libthread_db'-related events. Use '1'
  2469. to enable, '0' to disable.
  2470. 
  2471. File: gdb.info, Node: Forks, Next: Checkpoint/Restart, Prev: Threads, Up: Running
  2472. 4.11 Debugging Forks
  2473. ====================
  2474. On most systems, GDB has no special support for debugging programs which
  2475. create additional processes using the 'fork' function. When a program
  2476. forks, GDB will continue to debug the parent process and the child
  2477. process will run unimpeded. If you have set a breakpoint in any code
  2478. which the child then executes, the child will get a 'SIGTRAP' signal
  2479. which (unless it catches the signal) will cause it to terminate.
  2480. However, if you want to debug the child process there is a workaround
  2481. which isn't too painful. Put a call to 'sleep' in the code which the
  2482. child process executes after the fork. It may be useful to sleep only
  2483. if a certain environment variable is set, or a certain file exists, so
  2484. that the delay need not occur when you don't want to run GDB on the
  2485. child. While the child is sleeping, use the 'ps' program to get its
  2486. process ID. Then tell GDB (a new invocation of GDB if you are also
  2487. debugging the parent process) to attach to the child process (*note
  2488. Attach::). From that point on you can debug the child process just like
  2489. any other process which you attached to.
  2490. On some systems, GDB provides support for debugging programs that
  2491. create additional processes using the 'fork' or 'vfork' functions. On
  2492. GNU/Linux platforms, this feature is supported with kernel version
  2493. 2.5.46 and later.
  2494. The fork debugging commands are supported in native mode and when
  2495. connected to 'gdbserver' in either 'target remote' mode or 'target
  2496. extended-remote' mode.
  2497. By default, when a program forks, GDB will continue to debug the
  2498. parent process and the child process will run unimpeded.
  2499. If you want to follow the child process instead of the parent
  2500. process, use the command 'set follow-fork-mode'.
  2501. 'set follow-fork-mode MODE'
  2502. Set the debugger response to a program call of 'fork' or 'vfork'.
  2503. A call to 'fork' or 'vfork' creates a new process. The MODE
  2504. argument can be:
  2505. 'parent'
  2506. The original process is debugged after a fork. The child
  2507. process runs unimpeded. This is the default.
  2508. 'child'
  2509. The new process is debugged after a fork. The parent process
  2510. runs unimpeded.
  2511. 'show follow-fork-mode'
  2512. Display the current debugger response to a 'fork' or 'vfork' call.
  2513. On Linux, if you want to debug both the parent and child processes,
  2514. use the command 'set detach-on-fork'.
  2515. 'set detach-on-fork MODE'
  2516. Tells gdb whether to detach one of the processes after a fork, or
  2517. retain debugger control over them both.
  2518. 'on'
  2519. The child process (or parent process, depending on the value
  2520. of 'follow-fork-mode') will be detached and allowed to run
  2521. independently. This is the default.
  2522. 'off'
  2523. Both processes will be held under the control of GDB. One
  2524. process (child or parent, depending on the value of
  2525. 'follow-fork-mode') is debugged as usual, while the other is
  2526. held suspended.
  2527. 'show detach-on-fork'
  2528. Show whether detach-on-fork mode is on/off.
  2529. If you choose to set 'detach-on-fork' mode off, then GDB will retain
  2530. control of all forked processes (including nested forks). You can list
  2531. the forked processes under the control of GDB by using the
  2532. 'info inferiors' command, and switch from one fork to another by using
  2533. the 'inferior' command (*note Debugging Multiple Inferiors Connections
  2534. and Programs: Inferiors Connections and Programs.).
  2535. To quit debugging one of the forked processes, you can either detach
  2536. from it by using the 'detach inferiors' command (allowing it to run
  2537. independently), or kill it using the 'kill inferiors' command. *Note
  2538. Debugging Multiple Inferiors Connections and Programs: Inferiors
  2539. Connections and Programs.
  2540. If you ask to debug a child process and a 'vfork' is followed by an
  2541. 'exec', GDB executes the new target up to the first breakpoint in the
  2542. new target. If you have a breakpoint set on 'main' in your original
  2543. program, the breakpoint will also be set on the child process's 'main'.
  2544. On some systems, when a child process is spawned by 'vfork', you
  2545. cannot debug the child or parent until an 'exec' call completes.
  2546. If you issue a 'run' command to GDB after an 'exec' call executes,
  2547. the new target restarts. To restart the parent process, use the 'file'
  2548. command with the parent executable name as its argument. By default,
  2549. after an 'exec' call executes, GDB discards the symbols of the previous
  2550. executable image. You can change this behaviour with the
  2551. 'set follow-exec-mode' command.
  2552. 'set follow-exec-mode MODE'
  2553. Set debugger response to a program call of 'exec'. An 'exec' call
  2554. replaces the program image of a process.
  2555. 'follow-exec-mode' can be:
  2556. 'new'
  2557. GDB creates a new inferior and rebinds the process to this new
  2558. inferior. The program the process was running before the
  2559. 'exec' call can be restarted afterwards by restarting the
  2560. original inferior.
  2561. For example:
  2562. (gdb) info inferiors
  2563. (gdb) info inferior
  2564. Id Description Executable
  2565. * 1 <null> prog1
  2566. (gdb) run
  2567. process 12020 is executing new program: prog2
  2568. Program exited normally.
  2569. (gdb) info inferiors
  2570. Id Description Executable
  2571. 1 <null> prog1
  2572. * 2 <null> prog2
  2573. 'same'
  2574. GDB keeps the process bound to the same inferior. The new
  2575. executable image replaces the previous executable loaded in
  2576. the inferior. Restarting the inferior after the 'exec' call,
  2577. with e.g., the 'run' command, restarts the executable the
  2578. process was running after the 'exec' call. This is the
  2579. default mode.
  2580. For example:
  2581. (gdb) info inferiors
  2582. Id Description Executable
  2583. * 1 <null> prog1
  2584. (gdb) run
  2585. process 12020 is executing new program: prog2
  2586. Program exited normally.
  2587. (gdb) info inferiors
  2588. Id Description Executable
  2589. * 1 <null> prog2
  2590. 'follow-exec-mode' is supported in native mode and 'target
  2591. extended-remote' mode.
  2592. You can use the 'catch' command to make GDB stop whenever a 'fork',
  2593. 'vfork', or 'exec' call is made. *Note Setting Catchpoints: Set
  2594. Catchpoints.
  2595. 
  2596. File: gdb.info, Node: Checkpoint/Restart, Prev: Forks, Up: Running
  2597. 4.12 Setting a _Bookmark_ to Return to Later
  2598. ============================================
  2599. On certain operating systems(1), GDB is able to save a "snapshot" of a
  2600. program's state, called a "checkpoint", and come back to it later.
  2601. Returning to a checkpoint effectively undoes everything that has
  2602. happened in the program since the 'checkpoint' was saved. This includes
  2603. changes in memory, registers, and even (within some limits) system
  2604. state. Effectively, it is like going back in time to the moment when
  2605. the checkpoint was saved.
  2606. Thus, if you're stepping thru a program and you think you're getting
  2607. close to the point where things go wrong, you can save a checkpoint.
  2608. Then, if you accidentally go too far and miss the critical statement,
  2609. instead of having to restart your program from the beginning, you can
  2610. just go back to the checkpoint and start again from there.
  2611. This can be especially useful if it takes a lot of time or steps to
  2612. reach the point where you think the bug occurs.
  2613. To use the 'checkpoint'/'restart' method of debugging:
  2614. 'checkpoint'
  2615. Save a snapshot of the debugged program's current execution state.
  2616. The 'checkpoint' command takes no arguments, but each checkpoint is
  2617. assigned a small integer id, similar to a breakpoint id.
  2618. 'info checkpoints'
  2619. List the checkpoints that have been saved in the current debugging
  2620. session. For each checkpoint, the following information will be
  2621. listed:
  2622. 'Checkpoint ID'
  2623. 'Process ID'
  2624. 'Code Address'
  2625. 'Source line, or label'
  2626. 'restart CHECKPOINT-ID'
  2627. Restore the program state that was saved as checkpoint number
  2628. CHECKPOINT-ID. All program variables, registers, stack frames etc.
  2629. will be returned to the values that they had when the checkpoint
  2630. was saved. In essence, gdb will "wind back the clock" to the point
  2631. in time when the checkpoint was saved.
  2632. Note that breakpoints, GDB variables, command history etc. are not
  2633. affected by restoring a checkpoint. In general, a checkpoint only
  2634. restores things that reside in the program being debugged, not in
  2635. the debugger.
  2636. 'delete checkpoint CHECKPOINT-ID'
  2637. Delete the previously-saved checkpoint identified by CHECKPOINT-ID.
  2638. Returning to a previously saved checkpoint will restore the user
  2639. state of the program being debugged, plus a significant subset of the
  2640. system (OS) state, including file pointers. It won't "un-write" data
  2641. from a file, but it will rewind the file pointer to the previous
  2642. location, so that the previously written data can be overwritten. For
  2643. files opened in read mode, the pointer will also be restored so that the
  2644. previously read data can be read again.
  2645. Of course, characters that have been sent to a printer (or other
  2646. external device) cannot be "snatched back", and characters received from
  2647. eg. a serial device can be removed from internal program buffers, but
  2648. they cannot be "pushed back" into the serial pipeline, ready to be
  2649. received again. Similarly, the actual contents of files that have been
  2650. changed cannot be restored (at this time).
  2651. However, within those constraints, you actually can "rewind" your
  2652. program to a previously saved point in time, and begin debugging it
  2653. again -- and you can change the course of events so as to debug a
  2654. different execution path this time.
  2655. Finally, there is one bit of internal program state that will be
  2656. different when you return to a checkpoint -- the program's process id.
  2657. Each checkpoint will have a unique process id (or PID), and each will be
  2658. different from the program's original PID. If your program has saved a
  2659. local copy of its process id, this could potentially pose a problem.
  2660. 4.12.1 A Non-obvious Benefit of Using Checkpoints
  2661. -------------------------------------------------
  2662. On some systems such as GNU/Linux, address space randomization is
  2663. performed on new processes for security reasons. This makes it
  2664. difficult or impossible to set a breakpoint, or watchpoint, on an
  2665. absolute address if you have to restart the program, since the absolute
  2666. location of a symbol will change from one execution to the next.
  2667. A checkpoint, however, is an _identical_ copy of a process.
  2668. Therefore if you create a checkpoint at (eg.) the start of main, and
  2669. simply return to that checkpoint instead of restarting the process, you
  2670. can avoid the effects of address randomization and your symbols will all
  2671. stay in the same place.
  2672. ---------- Footnotes ----------
  2673. (1) Currently, only GNU/Linux.
  2674. 
  2675. File: gdb.info, Node: Stopping, Next: Reverse Execution, Prev: Running, Up: Top
  2676. 5 Stopping and Continuing
  2677. *************************
  2678. The principal purposes of using a debugger are so that you can stop your
  2679. program before it terminates; or so that, if your program runs into
  2680. trouble, you can investigate and find out why.
  2681. Inside GDB, your program may stop for any of several reasons, such as
  2682. a signal, a breakpoint, or reaching a new line after a GDB command such
  2683. as 'step'. You may then examine and change variables, set new
  2684. breakpoints or remove old ones, and then continue execution. Usually,
  2685. the messages shown by GDB provide ample explanation of the status of
  2686. your program--but you can also explicitly request this information at
  2687. any time.
  2688. 'info program'
  2689. Display information about the status of your program: whether it is
  2690. running or not, what process it is, and why it stopped.
  2691. * Menu:
  2692. * Breakpoints:: Breakpoints, watchpoints, and catchpoints
  2693. * Continuing and Stepping:: Resuming execution
  2694. * Skipping Over Functions and Files::
  2695. Skipping over functions and files
  2696. * Signals:: Signals
  2697. * Thread Stops:: Stopping and starting multi-thread programs
  2698. 
  2699. File: gdb.info, Node: Breakpoints, Next: Continuing and Stepping, Up: Stopping
  2700. 5.1 Breakpoints, Watchpoints, and Catchpoints
  2701. =============================================
  2702. A "breakpoint" makes your program stop whenever a certain point in the
  2703. program is reached. For each breakpoint, you can add conditions to
  2704. control in finer detail whether your program stops. You can set
  2705. breakpoints with the 'break' command and its variants (*note Setting
  2706. Breakpoints: Set Breaks.), to specify the place where your program
  2707. should stop by line number, function name or exact address in the
  2708. program.
  2709. On some systems, you can set breakpoints in shared libraries before
  2710. the executable is run.
  2711. A "watchpoint" is a special breakpoint that stops your program when
  2712. the value of an expression changes. The expression may be a value of a
  2713. variable, or it could involve values of one or more variables combined
  2714. by operators, such as 'a + b'. This is sometimes called "data
  2715. breakpoints". You must use a different command to set watchpoints
  2716. (*note Setting Watchpoints: Set Watchpoints.), but aside from that, you
  2717. can manage a watchpoint like any other breakpoint: you enable, disable,
  2718. and delete both breakpoints and watchpoints using the same commands.
  2719. You can arrange to have values from your program displayed
  2720. automatically whenever GDB stops at a breakpoint. *Note Automatic
  2721. Display: Auto Display.
  2722. A "catchpoint" is another special breakpoint that stops your program
  2723. when a certain kind of event occurs, such as the throwing of a C++
  2724. exception or the loading of a library. As with watchpoints, you use a
  2725. different command to set a catchpoint (*note Setting Catchpoints: Set
  2726. Catchpoints.), but aside from that, you can manage a catchpoint like any
  2727. other breakpoint. (To stop when your program receives a signal, use the
  2728. 'handle' command; see *note Signals: Signals.)
  2729. GDB assigns a number to each breakpoint, watchpoint, or catchpoint
  2730. when you create it; these numbers are successive integers starting with
  2731. one. In many of the commands for controlling various features of
  2732. breakpoints you use the breakpoint number to say which breakpoint you
  2733. want to change. Each breakpoint may be "enabled" or "disabled"; if
  2734. disabled, it has no effect on your program until you enable it again.
  2735. Some GDB commands accept a space-separated list of breakpoints on
  2736. which to operate. A list element can be either a single breakpoint
  2737. number, like '5', or a range of such numbers, like '5-7'. When a
  2738. breakpoint list is given to a command, all breakpoints in that list are
  2739. operated on.
  2740. * Menu:
  2741. * Set Breaks:: Setting breakpoints
  2742. * Set Watchpoints:: Setting watchpoints
  2743. * Set Catchpoints:: Setting catchpoints
  2744. * Delete Breaks:: Deleting breakpoints
  2745. * Disabling:: Disabling breakpoints
  2746. * Conditions:: Break conditions
  2747. * Break Commands:: Breakpoint command lists
  2748. * Dynamic Printf:: Dynamic printf
  2749. * Save Breakpoints:: How to save breakpoints in a file
  2750. * Static Probe Points:: Listing static probe points
  2751. * Error in Breakpoints:: "Cannot insert breakpoints"
  2752. * Breakpoint-related Warnings:: "Breakpoint address adjusted..."
  2753. 
  2754. File: gdb.info, Node: Set Breaks, Next: Set Watchpoints, Up: Breakpoints
  2755. 5.1.1 Setting Breakpoints
  2756. -------------------------
  2757. Breakpoints are set with the 'break' command (abbreviated 'b'). The
  2758. debugger convenience variable '$bpnum' records the number of the
  2759. breakpoint you've set most recently; see *note Convenience Variables:
  2760. Convenience Vars, for a discussion of what you can do with convenience
  2761. variables.
  2762. 'break LOCATION'
  2763. Set a breakpoint at the given LOCATION, which can specify a
  2764. function name, a line number, or an address of an instruction.
  2765. (*Note Specify Location::, for a list of all the possible ways to
  2766. specify a LOCATION.) The breakpoint will stop your program just
  2767. before it executes any of the code in the specified LOCATION.
  2768. When using source languages that permit overloading of symbols,
  2769. such as C++, a function name may refer to more than one possible
  2770. place to break. *Note Ambiguous Expressions: Ambiguous
  2771. Expressions, for a discussion of that situation.
  2772. It is also possible to insert a breakpoint that will stop the
  2773. program only if a specific thread (*note Thread-Specific
  2774. Breakpoints::) or a specific task (*note Ada Tasks::) hits that
  2775. breakpoint.
  2776. 'break'
  2777. When called without any arguments, 'break' sets a breakpoint at the
  2778. next instruction to be executed in the selected stack frame (*note
  2779. Examining the Stack: Stack.). In any selected frame but the
  2780. innermost, this makes your program stop as soon as control returns
  2781. to that frame. This is similar to the effect of a 'finish' command
  2782. in the frame inside the selected frame--except that 'finish' does
  2783. not leave an active breakpoint. If you use 'break' without an
  2784. argument in the innermost frame, GDB stops the next time it reaches
  2785. the current location; this may be useful inside loops.
  2786. GDB normally ignores breakpoints when it resumes execution, until
  2787. at least one instruction has been executed. If it did not do this,
  2788. you would be unable to proceed past a breakpoint without first
  2789. disabling the breakpoint. This rule applies whether or not the
  2790. breakpoint already existed when your program stopped.
  2791. 'break ... if COND'
  2792. Set a breakpoint with condition COND; evaluate the expression COND
  2793. each time the breakpoint is reached, and stop only if the value is
  2794. nonzero--that is, if COND evaluates as true. '...' stands for one
  2795. of the possible arguments described above (or no argument)
  2796. specifying where to break. *Note Break Conditions: Conditions, for
  2797. more information on breakpoint conditions.
  2798. 'tbreak ARGS'
  2799. Set a breakpoint enabled only for one stop. The ARGS are the same
  2800. as for the 'break' command, and the breakpoint is set in the same
  2801. way, but the breakpoint is automatically deleted after the first
  2802. time your program stops there. *Note Disabling Breakpoints:
  2803. Disabling.
  2804. 'hbreak ARGS'
  2805. Set a hardware-assisted breakpoint. The ARGS are the same as for
  2806. the 'break' command and the breakpoint is set in the same way, but
  2807. the breakpoint requires hardware support and some target hardware
  2808. may not have this support. The main purpose of this is EPROM/ROM
  2809. code debugging, so you can set a breakpoint at an instruction
  2810. without changing the instruction. This can be used with the new
  2811. trap-generation provided by SPARClite DSU and most x86-based
  2812. targets. These targets will generate traps when a program accesses
  2813. some data or instruction address that is assigned to the debug
  2814. registers. However the hardware breakpoint registers can take a
  2815. limited number of breakpoints. For example, on the DSU, only two
  2816. data breakpoints can be set at a time, and GDB will reject this
  2817. command if more than two are used. Delete or disable unused
  2818. hardware breakpoints before setting new ones (*note Disabling
  2819. Breakpoints: Disabling.). *Note Break Conditions: Conditions. For
  2820. remote targets, you can restrict the number of hardware breakpoints
  2821. GDB will use, see *note set remote hardware-breakpoint-limit::.
  2822. 'thbreak ARGS'
  2823. Set a hardware-assisted breakpoint enabled only for one stop. The
  2824. ARGS are the same as for the 'hbreak' command and the breakpoint is
  2825. set in the same way. However, like the 'tbreak' command, the
  2826. breakpoint is automatically deleted after the first time your
  2827. program stops there. Also, like the 'hbreak' command, the
  2828. breakpoint requires hardware support and some target hardware may
  2829. not have this support. *Note Disabling Breakpoints: Disabling.
  2830. See also *note Break Conditions: Conditions.
  2831. 'rbreak REGEX'
  2832. Set breakpoints on all functions matching the regular expression
  2833. REGEX. This command sets an unconditional breakpoint on all
  2834. matches, printing a list of all breakpoints it set. Once these
  2835. breakpoints are set, they are treated just like the breakpoints set
  2836. with the 'break' command. You can delete them, disable them, or
  2837. make them conditional the same way as any other breakpoint.
  2838. In programs using different languages, GDB chooses the syntax to
  2839. print the list of all breakpoints it sets according to the 'set
  2840. language' value: using 'set language auto' (see *note Set Language
  2841. Automatically: Automatically.) means to use the language of the
  2842. breakpoint's function, other values mean to use the manually
  2843. specified language (see *note Set Language Manually: Manually.).
  2844. The syntax of the regular expression is the standard one used with
  2845. tools like 'grep'. Note that this is different from the syntax
  2846. used by shells, so for instance 'foo*' matches all functions that
  2847. include an 'fo' followed by zero or more 'o's. There is an
  2848. implicit '.*' leading and trailing the regular expression you
  2849. supply, so to match only functions that begin with 'foo', use
  2850. '^foo'.
  2851. When debugging C++ programs, 'rbreak' is useful for setting
  2852. breakpoints on overloaded functions that are not members of any
  2853. special classes.
  2854. The 'rbreak' command can be used to set breakpoints in *all* the
  2855. functions in a program, like this:
  2856. (gdb) rbreak .
  2857. 'rbreak FILE:REGEX'
  2858. If 'rbreak' is called with a filename qualification, it limits the
  2859. search for functions matching the given regular expression to the
  2860. specified FILE. This can be used, for example, to set breakpoints
  2861. on every function in a given file:
  2862. (gdb) rbreak file.c:.
  2863. The colon separating the filename qualifier from the regex may
  2864. optionally be surrounded by spaces.
  2865. 'info breakpoints [LIST...]'
  2866. 'info break [LIST...]'
  2867. Print a table of all breakpoints, watchpoints, and catchpoints set
  2868. and not deleted. Optional argument N means print information only
  2869. about the specified breakpoint(s) (or watchpoint(s) or
  2870. catchpoint(s)). For each breakpoint, following columns are
  2871. printed:
  2872. _Breakpoint Numbers_
  2873. _Type_
  2874. Breakpoint, watchpoint, or catchpoint.
  2875. _Disposition_
  2876. Whether the breakpoint is marked to be disabled or deleted
  2877. when hit.
  2878. _Enabled or Disabled_
  2879. Enabled breakpoints are marked with 'y'. 'n' marks
  2880. breakpoints that are not enabled.
  2881. _Address_
  2882. Where the breakpoint is in your program, as a memory address.
  2883. For a pending breakpoint whose address is not yet known, this
  2884. field will contain '<PENDING>'. Such breakpoint won't fire
  2885. until a shared library that has the symbol or line referred by
  2886. breakpoint is loaded. See below for details. A breakpoint
  2887. with several locations will have '<MULTIPLE>' in this
  2888. field--see below for details.
  2889. _What_
  2890. Where the breakpoint is in the source for your program, as a
  2891. file and line number. For a pending breakpoint, the original
  2892. string passed to the breakpoint command will be listed as it
  2893. cannot be resolved until the appropriate shared library is
  2894. loaded in the future.
  2895. If a breakpoint is conditional, there are two evaluation modes:
  2896. "host" and "target". If mode is "host", breakpoint condition
  2897. evaluation is done by GDB on the host's side. If it is "target",
  2898. then the condition is evaluated by the target. The 'info break'
  2899. command shows the condition on the line following the affected
  2900. breakpoint, together with its condition evaluation mode in between
  2901. parentheses.
  2902. Breakpoint commands, if any, are listed after that. A pending
  2903. breakpoint is allowed to have a condition specified for it. The
  2904. condition is not parsed for validity until a shared library is
  2905. loaded that allows the pending breakpoint to resolve to a valid
  2906. location.
  2907. 'info break' with a breakpoint number N as argument lists only that
  2908. breakpoint. The convenience variable '$_' and the default
  2909. examining-address for the 'x' command are set to the address of the
  2910. last breakpoint listed (*note Examining Memory: Memory.).
  2911. 'info break' displays a count of the number of times the breakpoint
  2912. has been hit. This is especially useful in conjunction with the
  2913. 'ignore' command. You can ignore a large number of breakpoint
  2914. hits, look at the breakpoint info to see how many times the
  2915. breakpoint was hit, and then run again, ignoring one less than that
  2916. number. This will get you quickly to the last hit of that
  2917. breakpoint.
  2918. For a breakpoints with an enable count (xref) greater than 1, 'info
  2919. break' also displays that count.
  2920. GDB allows you to set any number of breakpoints at the same place in
  2921. your program. There is nothing silly or meaningless about this. When
  2922. the breakpoints are conditional, this is even useful (*note Break
  2923. Conditions: Conditions.).
  2924. It is possible that a breakpoint corresponds to several locations in
  2925. your program. Examples of this situation are:
  2926. * Multiple functions in the program may have the same name.
  2927. * For a C++ constructor, the GCC compiler generates several instances
  2928. of the function body, used in different cases.
  2929. * For a C++ template function, a given line in the function can
  2930. correspond to any number of instantiations.
  2931. * For an inlined function, a given source line can correspond to
  2932. several places where that function is inlined.
  2933. In all those cases, GDB will insert a breakpoint at all the relevant
  2934. locations.
  2935. A breakpoint with multiple locations is displayed in the breakpoint
  2936. table using several rows--one header row, followed by one row for each
  2937. breakpoint location. The header row has '<MULTIPLE>' in the address
  2938. column. The rows for individual locations contain the actual addresses
  2939. for locations, and show the functions to which those locations belong.
  2940. The number column for a location is of the form
  2941. BREAKPOINT-NUMBER.LOCATION-NUMBER.
  2942. For example:
  2943. Num Type Disp Enb Address What
  2944. 1 breakpoint keep y <MULTIPLE>
  2945. stop only if i==1
  2946. breakpoint already hit 1 time
  2947. 1.1 y 0x080486a2 in void foo<int>() at t.cc:8
  2948. 1.2 y 0x080486ca in void foo<double>() at t.cc:8
  2949. You cannot delete the individual locations from a breakpoint.
  2950. However, each location can be individually enabled or disabled by
  2951. passing BREAKPOINT-NUMBER.LOCATION-NUMBER as argument to the 'enable'
  2952. and 'disable' commands. It's also possible to 'enable' and 'disable' a
  2953. range of LOCATION-NUMBER locations using a BREAKPOINT-NUMBER and two
  2954. LOCATION-NUMBERs, in increasing order, separated by a hyphen, like
  2955. 'BREAKPOINT-NUMBER.LOCATION-NUMBER1-LOCATION-NUMBER2', in which case GDB
  2956. acts on all the locations in the range (inclusive). Disabling or
  2957. enabling the parent breakpoint (*note Disabling::) affects all of the
  2958. locations that belong to that breakpoint.
  2959. It's quite common to have a breakpoint inside a shared library.
  2960. Shared libraries can be loaded and unloaded explicitly, and possibly
  2961. repeatedly, as the program is executed. To support this use case, GDB
  2962. updates breakpoint locations whenever any shared library is loaded or
  2963. unloaded. Typically, you would set a breakpoint in a shared library at
  2964. the beginning of your debugging session, when the library is not loaded,
  2965. and when the symbols from the library are not available. When you try
  2966. to set breakpoint, GDB will ask you if you want to set a so called
  2967. "pending breakpoint"--breakpoint whose address is not yet resolved.
  2968. After the program is run, whenever a new shared library is loaded,
  2969. GDB reevaluates all the breakpoints. When a newly loaded shared library
  2970. contains the symbol or line referred to by some pending breakpoint, that
  2971. breakpoint is resolved and becomes an ordinary breakpoint. When a
  2972. library is unloaded, all breakpoints that refer to its symbols or source
  2973. lines become pending again.
  2974. This logic works for breakpoints with multiple locations, too. For
  2975. example, if you have a breakpoint in a C++ template function, and a
  2976. newly loaded shared library has an instantiation of that template, a new
  2977. location is added to the list of locations for the breakpoint.
  2978. Except for having unresolved address, pending breakpoints do not
  2979. differ from regular breakpoints. You can set conditions or commands,
  2980. enable and disable them and perform other breakpoint operations.
  2981. GDB provides some additional commands for controlling what happens
  2982. when the 'break' command cannot resolve breakpoint address specification
  2983. to an address:
  2984. 'set breakpoint pending auto'
  2985. This is the default behavior. When GDB cannot find the breakpoint
  2986. location, it queries you whether a pending breakpoint should be
  2987. created.
  2988. 'set breakpoint pending on'
  2989. This indicates that an unrecognized breakpoint location should
  2990. automatically result in a pending breakpoint being created.
  2991. 'set breakpoint pending off'
  2992. This indicates that pending breakpoints are not to be created. Any
  2993. unrecognized breakpoint location results in an error. This setting
  2994. does not affect any pending breakpoints previously created.
  2995. 'show breakpoint pending'
  2996. Show the current behavior setting for creating pending breakpoints.
  2997. The settings above only affect the 'break' command and its variants.
  2998. Once breakpoint is set, it will be automatically updated as shared
  2999. libraries are loaded and unloaded.
  3000. For some targets, GDB can automatically decide if hardware or
  3001. software breakpoints should be used, depending on whether the breakpoint
  3002. address is read-only or read-write. This applies to breakpoints set
  3003. with the 'break' command as well as to internal breakpoints set by
  3004. commands like 'next' and 'finish'. For breakpoints set with 'hbreak',
  3005. GDB will always use hardware breakpoints.
  3006. You can control this automatic behaviour with the following commands:
  3007. 'set breakpoint auto-hw on'
  3008. This is the default behavior. When GDB sets a breakpoint, it will
  3009. try to use the target memory map to decide if software or hardware
  3010. breakpoint must be used.
  3011. 'set breakpoint auto-hw off'
  3012. This indicates GDB should not automatically select breakpoint type.
  3013. If the target provides a memory map, GDB will warn when trying to
  3014. set software breakpoint at a read-only address.
  3015. GDB normally implements breakpoints by replacing the program code at
  3016. the breakpoint address with a special instruction, which, when executed,
  3017. given control to the debugger. By default, the program code is so
  3018. modified only when the program is resumed. As soon as the program
  3019. stops, GDB restores the original instructions. This behaviour guards
  3020. against leaving breakpoints inserted in the target should gdb abrubptly
  3021. disconnect. However, with slow remote targets, inserting and removing
  3022. breakpoint can reduce the performance. This behavior can be controlled
  3023. with the following commands::
  3024. 'set breakpoint always-inserted off'
  3025. All breakpoints, including newly added by the user, are inserted in
  3026. the target only when the target is resumed. All breakpoints are
  3027. removed from the target when it stops. This is the default mode.
  3028. 'set breakpoint always-inserted on'
  3029. Causes all breakpoints to be inserted in the target at all times.
  3030. If the user adds a new breakpoint, or changes an existing
  3031. breakpoint, the breakpoints in the target are updated immediately.
  3032. A breakpoint is removed from the target only when breakpoint itself
  3033. is deleted.
  3034. GDB handles conditional breakpoints by evaluating these conditions
  3035. when a breakpoint breaks. If the condition is true, then the process
  3036. being debugged stops, otherwise the process is resumed.
  3037. If the target supports evaluating conditions on its end, GDB may
  3038. download the breakpoint, together with its conditions, to it.
  3039. This feature can be controlled via the following commands:
  3040. 'set breakpoint condition-evaluation host'
  3041. This option commands GDB to evaluate the breakpoint conditions on
  3042. the host's side. Unconditional breakpoints are sent to the target
  3043. which in turn receives the triggers and reports them back to GDB
  3044. for condition evaluation. This is the standard evaluation mode.
  3045. 'set breakpoint condition-evaluation target'
  3046. This option commands GDB to download breakpoint conditions to the
  3047. target at the moment of their insertion. The target is responsible
  3048. for evaluating the conditional expression and reporting breakpoint
  3049. stop events back to GDB whenever the condition is true. Due to
  3050. limitations of target-side evaluation, some conditions cannot be
  3051. evaluated there, e.g., conditions that depend on local data that is
  3052. only known to the host. Examples include conditional expressions
  3053. involving convenience variables, complex types that cannot be
  3054. handled by the agent expression parser and expressions that are too
  3055. long to be sent over to the target, specially when the target is a
  3056. remote system. In these cases, the conditions will be evaluated by
  3057. GDB.
  3058. 'set breakpoint condition-evaluation auto'
  3059. This is the default mode. If the target supports evaluating
  3060. breakpoint conditions on its end, GDB will download breakpoint
  3061. conditions to the target (limitations mentioned previously apply).
  3062. If the target does not support breakpoint condition evaluation,
  3063. then GDB will fallback to evaluating all these conditions on the
  3064. host's side.
  3065. GDB itself sometimes sets breakpoints in your program for special
  3066. purposes, such as proper handling of 'longjmp' (in C programs). These
  3067. internal breakpoints are assigned negative numbers, starting with '-1';
  3068. 'info breakpoints' does not display them. You can see these breakpoints
  3069. with the GDB maintenance command 'maint info breakpoints' (*note maint
  3070. info breakpoints::).
  3071. 
  3072. File: gdb.info, Node: Set Watchpoints, Next: Set Catchpoints, Prev: Set Breaks, Up: Breakpoints
  3073. 5.1.2 Setting Watchpoints
  3074. -------------------------
  3075. You can use a watchpoint to stop execution whenever the value of an
  3076. expression changes, without having to predict a particular place where
  3077. this may happen. (This is sometimes called a "data breakpoint".) The
  3078. expression may be as simple as the value of a single variable, or as
  3079. complex as many variables combined by operators. Examples include:
  3080. * A reference to the value of a single variable.
  3081. * An address cast to an appropriate data type. For example, '*(int
  3082. *)0x12345678' will watch a 4-byte region at the specified address
  3083. (assuming an 'int' occupies 4 bytes).
  3084. * An arbitrarily complex expression, such as 'a*b + c/d'. The
  3085. expression can use any operators valid in the program's native
  3086. language (*note Languages::).
  3087. You can set a watchpoint on an expression even if the expression can
  3088. not be evaluated yet. For instance, you can set a watchpoint on
  3089. '*global_ptr' before 'global_ptr' is initialized. GDB will stop when
  3090. your program sets 'global_ptr' and the expression produces a valid
  3091. value. If the expression becomes valid in some other way than changing
  3092. a variable (e.g. if the memory pointed to by '*global_ptr' becomes
  3093. readable as the result of a 'malloc' call), GDB may not stop until the
  3094. next time the expression changes.
  3095. Depending on your system, watchpoints may be implemented in software
  3096. or hardware. GDB does software watchpointing by single-stepping your
  3097. program and testing the variable's value each time, which is hundreds of
  3098. times slower than normal execution. (But this may still be worth it, to
  3099. catch errors where you have no clue what part of your program is the
  3100. culprit.)
  3101. On some systems, such as most PowerPC or x86-based targets, GDB
  3102. includes support for hardware watchpoints, which do not slow down the
  3103. running of your program.
  3104. 'watch [-l|-location] EXPR [thread THREAD-ID] [mask MASKVALUE]'
  3105. Set a watchpoint for an expression. GDB will break when the
  3106. expression EXPR is written into by the program and its value
  3107. changes. The simplest (and the most popular) use of this command
  3108. is to watch the value of a single variable:
  3109. (gdb) watch foo
  3110. If the command includes a '[thread THREAD-ID]' argument, GDB breaks
  3111. only when the thread identified by THREAD-ID changes the value of
  3112. EXPR. If any other threads change the value of EXPR, GDB will not
  3113. break. Note that watchpoints restricted to a single thread in this
  3114. way only work with Hardware Watchpoints.
  3115. Ordinarily a watchpoint respects the scope of variables in EXPR
  3116. (see below). The '-location' argument tells GDB to instead watch
  3117. the memory referred to by EXPR. In this case, GDB will evaluate
  3118. EXPR, take the address of the result, and watch the memory at that
  3119. address. The type of the result is used to determine the size of
  3120. the watched memory. If the expression's result does not have an
  3121. address, then GDB will print an error.
  3122. The '[mask MASKVALUE]' argument allows creation of masked
  3123. watchpoints, if the current architecture supports this feature
  3124. (e.g., PowerPC Embedded architecture, see *note PowerPC
  3125. Embedded::.) A "masked watchpoint" specifies a mask in addition to
  3126. an address to watch. The mask specifies that some bits of an
  3127. address (the bits which are reset in the mask) should be ignored
  3128. when matching the address accessed by the inferior against the
  3129. watchpoint address. Thus, a masked watchpoint watches many
  3130. addresses simultaneously--those addresses whose unmasked bits are
  3131. identical to the unmasked bits in the watchpoint address. The
  3132. 'mask' argument implies '-location'. Examples:
  3133. (gdb) watch foo mask 0xffff00ff
  3134. (gdb) watch *0xdeadbeef mask 0xffffff00
  3135. 'rwatch [-l|-location] EXPR [thread THREAD-ID] [mask MASKVALUE]'
  3136. Set a watchpoint that will break when the value of EXPR is read by
  3137. the program.
  3138. 'awatch [-l|-location] EXPR [thread THREAD-ID] [mask MASKVALUE]'
  3139. Set a watchpoint that will break when EXPR is either read from or
  3140. written into by the program.
  3141. 'info watchpoints [LIST...]'
  3142. This command prints a list of watchpoints, using the same format as
  3143. 'info break' (*note Set Breaks::).
  3144. If you watch for a change in a numerically entered address you need
  3145. to dereference it, as the address itself is just a constant number which
  3146. will never change. GDB refuses to create a watchpoint that watches a
  3147. never-changing value:
  3148. (gdb) watch 0x600850
  3149. Cannot watch constant value 0x600850.
  3150. (gdb) watch *(int *) 0x600850
  3151. Watchpoint 1: *(int *) 6293584
  3152. GDB sets a "hardware watchpoint" if possible. Hardware watchpoints
  3153. execute very quickly, and the debugger reports a change in value at the
  3154. exact instruction where the change occurs. If GDB cannot set a hardware
  3155. watchpoint, it sets a software watchpoint, which executes more slowly
  3156. and reports the change in value at the next _statement_, not the
  3157. instruction, after the change occurs.
  3158. You can force GDB to use only software watchpoints with the 'set
  3159. can-use-hw-watchpoints 0' command. With this variable set to zero, GDB
  3160. will never try to use hardware watchpoints, even if the underlying
  3161. system supports them. (Note that hardware-assisted watchpoints that
  3162. were set _before_ setting 'can-use-hw-watchpoints' to zero will still
  3163. use the hardware mechanism of watching expression values.)
  3164. 'set can-use-hw-watchpoints'
  3165. Set whether or not to use hardware watchpoints.
  3166. 'show can-use-hw-watchpoints'
  3167. Show the current mode of using hardware watchpoints.
  3168. For remote targets, you can restrict the number of hardware
  3169. watchpoints GDB will use, see *note set remote
  3170. hardware-breakpoint-limit::.
  3171. When you issue the 'watch' command, GDB reports
  3172. Hardware watchpoint NUM: EXPR
  3173. if it was able to set a hardware watchpoint.
  3174. Currently, the 'awatch' and 'rwatch' commands can only set hardware
  3175. watchpoints, because accesses to data that don't change the value of the
  3176. watched expression cannot be detected without examining every
  3177. instruction as it is being executed, and GDB does not do that currently.
  3178. If GDB finds that it is unable to set a hardware breakpoint with the
  3179. 'awatch' or 'rwatch' command, it will print a message like this:
  3180. Expression cannot be implemented with read/access watchpoint.
  3181. Sometimes, GDB cannot set a hardware watchpoint because the data type
  3182. of the watched expression is wider than what a hardware watchpoint on
  3183. the target machine can handle. For example, some systems can only watch
  3184. regions that are up to 4 bytes wide; on such systems you cannot set
  3185. hardware watchpoints for an expression that yields a double-precision
  3186. floating-point number (which is typically 8 bytes wide). As a
  3187. work-around, it might be possible to break the large region into a
  3188. series of smaller ones and watch them with separate watchpoints.
  3189. If you set too many hardware watchpoints, GDB might be unable to
  3190. insert all of them when you resume the execution of your program. Since
  3191. the precise number of active watchpoints is unknown until such time as
  3192. the program is about to be resumed, GDB might not be able to warn you
  3193. about this when you set the watchpoints, and the warning will be printed
  3194. only when the program is resumed:
  3195. Hardware watchpoint NUM: Could not insert watchpoint
  3196. If this happens, delete or disable some of the watchpoints.
  3197. Watching complex expressions that reference many variables can also
  3198. exhaust the resources available for hardware-assisted watchpoints.
  3199. That's because GDB needs to watch every variable in the expression with
  3200. separately allocated resources.
  3201. If you call a function interactively using 'print' or 'call', any
  3202. watchpoints you have set will be inactive until GDB reaches another kind
  3203. of breakpoint or the call completes.
  3204. GDB automatically deletes watchpoints that watch local (automatic)
  3205. variables, or expressions that involve such variables, when they go out
  3206. of scope, that is, when the execution leaves the block in which these
  3207. variables were defined. In particular, when the program being debugged
  3208. terminates, _all_ local variables go out of scope, and so only
  3209. watchpoints that watch global variables remain set. If you rerun the
  3210. program, you will need to set all such watchpoints again. One way of
  3211. doing that would be to set a code breakpoint at the entry to the 'main'
  3212. function and when it breaks, set all the watchpoints.
  3213. In multi-threaded programs, watchpoints will detect changes to the
  3214. watched expression from every thread.
  3215. _Warning:_ In multi-threaded programs, software watchpoints have
  3216. only limited usefulness. If GDB creates a software watchpoint, it
  3217. can only watch the value of an expression _in a single thread_. If
  3218. you are confident that the expression can only change due to the
  3219. current thread's activity (and if you are also confident that no
  3220. other thread can become current), then you can use software
  3221. watchpoints as usual. However, GDB may not notice when a
  3222. non-current thread's activity changes the expression. (Hardware
  3223. watchpoints, in contrast, watch an expression in all threads.)
  3224. *Note set remote hardware-watchpoint-limit::.
  3225. 
  3226. File: gdb.info, Node: Set Catchpoints, Next: Delete Breaks, Prev: Set Watchpoints, Up: Breakpoints
  3227. 5.1.3 Setting Catchpoints
  3228. -------------------------
  3229. You can use "catchpoints" to cause the debugger to stop for certain
  3230. kinds of program events, such as C++ exceptions or the loading of a
  3231. shared library. Use the 'catch' command to set a catchpoint.
  3232. 'catch EVENT'
  3233. Stop when EVENT occurs. The EVENT can be any of the following:
  3234. 'throw [REGEXP]'
  3235. 'rethrow [REGEXP]'
  3236. 'catch [REGEXP]'
  3237. The throwing, re-throwing, or catching of a C++ exception.
  3238. If REGEXP is given, then only exceptions whose type matches
  3239. the regular expression will be caught.
  3240. The convenience variable '$_exception' is available at an
  3241. exception-related catchpoint, on some systems. This holds the
  3242. exception being thrown.
  3243. There are currently some limitations to C++ exception handling
  3244. in GDB:
  3245. * The support for these commands is system-dependent.
  3246. Currently, only systems using the 'gnu-v3' C++ ABI (*note
  3247. ABI::) are supported.
  3248. * The regular expression feature and the '$_exception'
  3249. convenience variable rely on the presence of some SDT
  3250. probes in 'libstdc++'. If these probes are not present,
  3251. then these features cannot be used. These probes were
  3252. first available in the GCC 4.8 release, but whether or
  3253. not they are available in your GCC also depends on how it
  3254. was built.
  3255. * The '$_exception' convenience variable is only valid at
  3256. the instruction at which an exception-related catchpoint
  3257. is set.
  3258. * When an exception-related catchpoint is hit, GDB stops at
  3259. a location in the system library which implements runtime
  3260. exception support for C++, usually 'libstdc++'. You can
  3261. use 'up' (*note Selection::) to get to your code.
  3262. * If you call a function interactively, GDB normally
  3263. returns control to you when the function has finished
  3264. executing. If the call raises an exception, however, the
  3265. call may bypass the mechanism that returns control to you
  3266. and cause your program either to abort or to simply
  3267. continue running until it hits a breakpoint, catches a
  3268. signal that GDB is listening for, or exits. This is the
  3269. case even if you set a catchpoint for the exception;
  3270. catchpoints on exceptions are disabled within interactive
  3271. calls. *Note Calling::, for information on controlling
  3272. this with 'set unwind-on-terminating-exception'.
  3273. * You cannot raise an exception interactively.
  3274. * You cannot install an exception handler interactively.
  3275. 'exception [NAME]'
  3276. An Ada exception being raised. If an exception name is
  3277. specified at the end of the command (eg 'catch exception
  3278. Program_Error'), the debugger will stop only when this
  3279. specific exception is raised. Otherwise, the debugger stops
  3280. execution when any Ada exception is raised.
  3281. When inserting an exception catchpoint on a user-defined
  3282. exception whose name is identical to one of the exceptions
  3283. defined by the language, the fully qualified name must be used
  3284. as the exception name. Otherwise, GDB will assume that it
  3285. should stop on the pre-defined exception rather than the
  3286. user-defined one. For instance, assuming an exception called
  3287. 'Constraint_Error' is defined in package 'Pck', then the
  3288. command to use to catch such exceptions is 'catch exception
  3289. Pck.Constraint_Error'.
  3290. The convenience variable '$_ada_exception' holds the address
  3291. of the exception being thrown. This can be useful when
  3292. setting a condition for such a catchpoint.
  3293. 'exception unhandled'
  3294. An exception that was raised but is not handled by the
  3295. program. The convenience variable '$_ada_exception' is set as
  3296. for 'catch exception'.
  3297. 'handlers [NAME]'
  3298. An Ada exception being handled. If an exception name is
  3299. specified at the end of the command (eg 'catch handlers
  3300. Program_Error'), the debugger will stop only when this
  3301. specific exception is handled. Otherwise, the debugger stops
  3302. execution when any Ada exception is handled.
  3303. When inserting a handlers catchpoint on a user-defined
  3304. exception whose name is identical to one of the exceptions
  3305. defined by the language, the fully qualified name must be used
  3306. as the exception name. Otherwise, GDB will assume that it
  3307. should stop on the pre-defined exception rather than the
  3308. user-defined one. For instance, assuming an exception called
  3309. 'Constraint_Error' is defined in package 'Pck', then the
  3310. command to use to catch such exceptions handling is 'catch
  3311. handlers Pck.Constraint_Error'.
  3312. The convenience variable '$_ada_exception' is set as for
  3313. 'catch exception'.
  3314. 'assert'
  3315. A failed Ada assertion. Note that the convenience variable
  3316. '$_ada_exception' is _not_ set by this catchpoint.
  3317. 'exec'
  3318. A call to 'exec'.
  3319. 'syscall'
  3320. 'syscall [NAME | NUMBER | group:GROUPNAME | g:GROUPNAME] ...'
  3321. A call to or return from a system call, a.k.a. "syscall". A
  3322. syscall is a mechanism for application programs to request a
  3323. service from the operating system (OS) or one of the OS system
  3324. services. GDB can catch some or all of the syscalls issued by
  3325. the debuggee, and show the related information for each
  3326. syscall. If no argument is specified, calls to and returns
  3327. from all system calls will be caught.
  3328. NAME can be any system call name that is valid for the
  3329. underlying OS. Just what syscalls are valid depends on the OS.
  3330. On GNU and Unix systems, you can find the full list of valid
  3331. syscall names on '/usr/include/asm/unistd.h'.
  3332. Normally, GDB knows in advance which syscalls are valid for
  3333. each OS, so you can use the GDB command-line completion
  3334. facilities (*note command completion: Completion.) to list the
  3335. available choices.
  3336. You may also specify the system call numerically. A syscall's
  3337. number is the value passed to the OS's syscall dispatcher to
  3338. identify the requested service. When you specify the syscall
  3339. by its name, GDB uses its database of syscalls to convert the
  3340. name into the corresponding numeric code, but using the number
  3341. directly may be useful if GDB's database does not have the
  3342. complete list of syscalls on your system (e.g., because GDB
  3343. lags behind the OS upgrades).
  3344. You may specify a group of related syscalls to be caught at
  3345. once using the 'group:' syntax ('g:' is a shorter equivalent).
  3346. For instance, on some platforms GDB allows you to catch all
  3347. network related syscalls, by passing the argument
  3348. 'group:network' to 'catch syscall'. Note that not all syscall
  3349. groups are available in every system. You can use the command
  3350. completion facilities (*note command completion: Completion.)
  3351. to list the syscall groups available on your environment.
  3352. The example below illustrates how this command works if you
  3353. don't provide arguments to it:
  3354. (gdb) catch syscall
  3355. Catchpoint 1 (syscall)
  3356. (gdb) r
  3357. Starting program: /tmp/catch-syscall
  3358. Catchpoint 1 (call to syscall 'close'), \
  3359. 0xffffe424 in __kernel_vsyscall ()
  3360. (gdb) c
  3361. Continuing.
  3362. Catchpoint 1 (returned from syscall 'close'), \
  3363. 0xffffe424 in __kernel_vsyscall ()
  3364. (gdb)
  3365. Here is an example of catching a system call by name:
  3366. (gdb) catch syscall chroot
  3367. Catchpoint 1 (syscall 'chroot' [61])
  3368. (gdb) r
  3369. Starting program: /tmp/catch-syscall
  3370. Catchpoint 1 (call to syscall 'chroot'), \
  3371. 0xffffe424 in __kernel_vsyscall ()
  3372. (gdb) c
  3373. Continuing.
  3374. Catchpoint 1 (returned from syscall 'chroot'), \
  3375. 0xffffe424 in __kernel_vsyscall ()
  3376. (gdb)
  3377. An example of specifying a system call numerically. In the
  3378. case below, the syscall number has a corresponding entry in
  3379. the XML file, so GDB finds its name and prints it:
  3380. (gdb) catch syscall 252
  3381. Catchpoint 1 (syscall(s) 'exit_group')
  3382. (gdb) r
  3383. Starting program: /tmp/catch-syscall
  3384. Catchpoint 1 (call to syscall 'exit_group'), \
  3385. 0xffffe424 in __kernel_vsyscall ()
  3386. (gdb) c
  3387. Continuing.
  3388. Program exited normally.
  3389. (gdb)
  3390. Here is an example of catching a syscall group:
  3391. (gdb) catch syscall group:process
  3392. Catchpoint 1 (syscalls 'exit' [1] 'fork' [2] 'waitpid' [7]
  3393. 'execve' [11] 'wait4' [114] 'clone' [120] 'vfork' [190]
  3394. 'exit_group' [252] 'waitid' [284] 'unshare' [310])
  3395. (gdb) r
  3396. Starting program: /tmp/catch-syscall
  3397. Catchpoint 1 (call to syscall fork), 0x00007ffff7df4e27 in open64 ()
  3398. from /lib64/ld-linux-x86-64.so.2
  3399. (gdb) c
  3400. Continuing.
  3401. However, there can be situations when there is no
  3402. corresponding name in XML file for that syscall number. In
  3403. this case, GDB prints a warning message saying that it was not
  3404. able to find the syscall name, but the catchpoint will be set
  3405. anyway. See the example below:
  3406. (gdb) catch syscall 764
  3407. warning: The number '764' does not represent a known syscall.
  3408. Catchpoint 2 (syscall 764)
  3409. (gdb)
  3410. If you configure GDB using the '--without-expat' option, it
  3411. will not be able to display syscall names. Also, if your
  3412. architecture does not have an XML file describing its system
  3413. calls, you will not be able to see the syscall names. It is
  3414. important to notice that these two features are used for
  3415. accessing the syscall name database. In either case, you will
  3416. see a warning like this:
  3417. (gdb) catch syscall
  3418. warning: Could not open "syscalls/i386-linux.xml"
  3419. warning: Could not load the syscall XML file 'syscalls/i386-linux.xml'.
  3420. GDB will not be able to display syscall names.
  3421. Catchpoint 1 (syscall)
  3422. (gdb)
  3423. Of course, the file name will change depending on your
  3424. architecture and system.
  3425. Still using the example above, you can also try to catch a
  3426. syscall by its number. In this case, you would see something
  3427. like:
  3428. (gdb) catch syscall 252
  3429. Catchpoint 1 (syscall(s) 252)
  3430. Again, in this case GDB would not be able to display syscall's
  3431. names.
  3432. 'fork'
  3433. A call to 'fork'.
  3434. 'vfork'
  3435. A call to 'vfork'.
  3436. 'load [REGEXP]'
  3437. 'unload [REGEXP]'
  3438. The loading or unloading of a shared library. If REGEXP is
  3439. given, then the catchpoint will stop only if the regular
  3440. expression matches one of the affected libraries.
  3441. 'signal [SIGNAL... | 'all']'
  3442. The delivery of a signal.
  3443. With no arguments, this catchpoint will catch any signal that
  3444. is not used internally by GDB, specifically, all signals
  3445. except 'SIGTRAP' and 'SIGINT'.
  3446. With the argument 'all', all signals, including those used by
  3447. GDB, will be caught. This argument cannot be used with other
  3448. signal names.
  3449. Otherwise, the arguments are a list of signal names as given
  3450. to 'handle' (*note Signals::). Only signals specified in this
  3451. list will be caught.
  3452. One reason that 'catch signal' can be more useful than
  3453. 'handle' is that you can attach commands and conditions to the
  3454. catchpoint.
  3455. When a signal is caught by a catchpoint, the signal's 'stop'
  3456. and 'print' settings, as specified by 'handle', are ignored.
  3457. However, whether the signal is still delivered to the inferior
  3458. depends on the 'pass' setting; this can be changed in the
  3459. catchpoint's commands.
  3460. 'tcatch EVENT'
  3461. Set a catchpoint that is enabled only for one stop. The catchpoint
  3462. is automatically deleted after the first time the event is caught.
  3463. Use the 'info break' command to list the current catchpoints.
  3464. 
  3465. File: gdb.info, Node: Delete Breaks, Next: Disabling, Prev: Set Catchpoints, Up: Breakpoints
  3466. 5.1.4 Deleting Breakpoints
  3467. --------------------------
  3468. It is often necessary to eliminate a breakpoint, watchpoint, or
  3469. catchpoint once it has done its job and you no longer want your program
  3470. to stop there. This is called "deleting" the breakpoint. A breakpoint
  3471. that has been deleted no longer exists; it is forgotten.
  3472. With the 'clear' command you can delete breakpoints according to
  3473. where they are in your program. With the 'delete' command you can
  3474. delete individual breakpoints, watchpoints, or catchpoints by specifying
  3475. their breakpoint numbers.
  3476. It is not necessary to delete a breakpoint to proceed past it. GDB
  3477. automatically ignores breakpoints on the first instruction to be
  3478. executed when you continue execution without changing the execution
  3479. address.
  3480. 'clear'
  3481. Delete any breakpoints at the next instruction to be executed in
  3482. the selected stack frame (*note Selecting a Frame: Selection.).
  3483. When the innermost frame is selected, this is a good way to delete
  3484. a breakpoint where your program just stopped.
  3485. 'clear LOCATION'
  3486. Delete any breakpoints set at the specified LOCATION. *Note
  3487. Specify Location::, for the various forms of LOCATION; the most
  3488. useful ones are listed below:
  3489. 'clear FUNCTION'
  3490. 'clear FILENAME:FUNCTION'
  3491. Delete any breakpoints set at entry to the named FUNCTION.
  3492. 'clear LINENUM'
  3493. 'clear FILENAME:LINENUM'
  3494. Delete any breakpoints set at or within the code of the
  3495. specified LINENUM of the specified FILENAME.
  3496. 'delete [breakpoints] [LIST...]'
  3497. Delete the breakpoints, watchpoints, or catchpoints of the
  3498. breakpoint list specified as argument. If no argument is
  3499. specified, delete all breakpoints (GDB asks confirmation, unless
  3500. you have 'set confirm off'). You can abbreviate this command as
  3501. 'd'.
  3502. 
  3503. File: gdb.info, Node: Disabling, Next: Conditions, Prev: Delete Breaks, Up: Breakpoints
  3504. 5.1.5 Disabling Breakpoints
  3505. ---------------------------
  3506. Rather than deleting a breakpoint, watchpoint, or catchpoint, you might
  3507. prefer to "disable" it. This makes the breakpoint inoperative as if it
  3508. had been deleted, but remembers the information on the breakpoint so
  3509. that you can "enable" it again later.
  3510. You disable and enable breakpoints, watchpoints, and catchpoints with
  3511. the 'enable' and 'disable' commands, optionally specifying one or more
  3512. breakpoint numbers as arguments. Use 'info break' to print a list of
  3513. all breakpoints, watchpoints, and catchpoints if you do not know which
  3514. numbers to use.
  3515. Disabling and enabling a breakpoint that has multiple locations
  3516. affects all of its locations.
  3517. A breakpoint, watchpoint, or catchpoint can have any of several
  3518. different states of enablement:
  3519. * Enabled. The breakpoint stops your program. A breakpoint set with
  3520. the 'break' command starts out in this state.
  3521. * Disabled. The breakpoint has no effect on your program.
  3522. * Enabled once. The breakpoint stops your program, but then becomes
  3523. disabled.
  3524. * Enabled for a count. The breakpoint stops your program for the
  3525. next N times, then becomes disabled.
  3526. * Enabled for deletion. The breakpoint stops your program, but
  3527. immediately after it does so it is deleted permanently. A
  3528. breakpoint set with the 'tbreak' command starts out in this state.
  3529. You can use the following commands to enable or disable breakpoints,
  3530. watchpoints, and catchpoints:
  3531. 'disable [breakpoints] [LIST...]'
  3532. Disable the specified breakpoints--or all breakpoints, if none are
  3533. listed. A disabled breakpoint has no effect but is not forgotten.
  3534. All options such as ignore-counts, conditions and commands are
  3535. remembered in case the breakpoint is enabled again later. You may
  3536. abbreviate 'disable' as 'dis'.
  3537. 'enable [breakpoints] [LIST...]'
  3538. Enable the specified breakpoints (or all defined breakpoints).
  3539. They become effective once again in stopping your program.
  3540. 'enable [breakpoints] once LIST...'
  3541. Enable the specified breakpoints temporarily. GDB disables any of
  3542. these breakpoints immediately after stopping your program.
  3543. 'enable [breakpoints] count COUNT LIST...'
  3544. Enable the specified breakpoints temporarily. GDB records COUNT
  3545. with each of the specified breakpoints, and decrements a
  3546. breakpoint's count when it is hit. When any count reaches 0, GDB
  3547. disables that breakpoint. If a breakpoint has an ignore count
  3548. (*note Break Conditions: Conditions.), that will be decremented to
  3549. 0 before COUNT is affected.
  3550. 'enable [breakpoints] delete LIST...'
  3551. Enable the specified breakpoints to work once, then die. GDB
  3552. deletes any of these breakpoints as soon as your program stops
  3553. there. Breakpoints set by the 'tbreak' command start out in this
  3554. state.
  3555. Except for a breakpoint set with 'tbreak' (*note Setting Breakpoints:
  3556. Set Breaks.), breakpoints that you set are initially enabled;
  3557. subsequently, they become disabled or enabled only when you use one of
  3558. the commands above. (The command 'until' can set and delete a
  3559. breakpoint of its own, but it does not change the state of your other
  3560. breakpoints; see *note Continuing and Stepping: Continuing and
  3561. Stepping.)
  3562. 
  3563. File: gdb.info, Node: Conditions, Next: Break Commands, Prev: Disabling, Up: Breakpoints
  3564. 5.1.6 Break Conditions
  3565. ----------------------
  3566. The simplest sort of breakpoint breaks every time your program reaches a
  3567. specified place. You can also specify a "condition" for a breakpoint.
  3568. A condition is just a Boolean expression in your programming language
  3569. (*note Expressions: Expressions.). A breakpoint with a condition
  3570. evaluates the expression each time your program reaches it, and your
  3571. program stops only if the condition is _true_.
  3572. This is the converse of using assertions for program validation; in
  3573. that situation, you want to stop when the assertion is violated--that
  3574. is, when the condition is false. In C, if you want to test an assertion
  3575. expressed by the condition ASSERT, you should set the condition '!
  3576. ASSERT' on the appropriate breakpoint.
  3577. Conditions are also accepted for watchpoints; you may not need them,
  3578. since a watchpoint is inspecting the value of an expression anyhow--but
  3579. it might be simpler, say, to just set a watchpoint on a variable name,
  3580. and specify a condition that tests whether the new value is an
  3581. interesting one.
  3582. Break conditions can have side effects, and may even call functions
  3583. in your program. This can be useful, for example, to activate functions
  3584. that log program progress, or to use your own print functions to format
  3585. special data structures. The effects are completely predictable unless
  3586. there is another enabled breakpoint at the same address. (In that case,
  3587. GDB might see the other breakpoint first and stop your program without
  3588. checking the condition of this one.) Note that breakpoint commands are
  3589. usually more convenient and flexible than break conditions for the
  3590. purpose of performing side effects when a breakpoint is reached (*note
  3591. Breakpoint Command Lists: Break Commands.).
  3592. Breakpoint conditions can also be evaluated on the target's side if
  3593. the target supports it. Instead of evaluating the conditions locally,
  3594. GDB encodes the expression into an agent expression (*note Agent
  3595. Expressions::) suitable for execution on the target, independently of
  3596. GDB. Global variables become raw memory locations, locals become stack
  3597. accesses, and so forth.
  3598. In this case, GDB will only be notified of a breakpoint trigger when
  3599. its condition evaluates to true. This mechanism may provide faster
  3600. response times depending on the performance characteristics of the
  3601. target since it does not need to keep GDB informed about every
  3602. breakpoint trigger, even those with false conditions.
  3603. Break conditions can be specified when a breakpoint is set, by using
  3604. 'if' in the arguments to the 'break' command. *Note Setting
  3605. Breakpoints: Set Breaks. They can also be changed at any time with the
  3606. 'condition' command.
  3607. You can also use the 'if' keyword with the 'watch' command. The
  3608. 'catch' command does not recognize the 'if' keyword; 'condition' is the
  3609. only way to impose a further condition on a catchpoint.
  3610. 'condition BNUM EXPRESSION'
  3611. Specify EXPRESSION as the break condition for breakpoint,
  3612. watchpoint, or catchpoint number BNUM. After you set a condition,
  3613. breakpoint BNUM stops your program only if the value of EXPRESSION
  3614. is true (nonzero, in C). When you use 'condition', GDB checks
  3615. EXPRESSION immediately for syntactic correctness, and to determine
  3616. whether symbols in it have referents in the context of your
  3617. breakpoint. If EXPRESSION uses symbols not referenced in the
  3618. context of the breakpoint, GDB prints an error message:
  3619. No symbol "foo" in current context.
  3620. GDB does not actually evaluate EXPRESSION at the time the
  3621. 'condition' command (or a command that sets a breakpoint with a
  3622. condition, like 'break if ...') is given, however. *Note
  3623. Expressions: Expressions.
  3624. 'condition BNUM'
  3625. Remove the condition from breakpoint number BNUM. It becomes an
  3626. ordinary unconditional breakpoint.
  3627. A special case of a breakpoint condition is to stop only when the
  3628. breakpoint has been reached a certain number of times. This is so
  3629. useful that there is a special way to do it, using the "ignore count" of
  3630. the breakpoint. Every breakpoint has an ignore count, which is an
  3631. integer. Most of the time, the ignore count is zero, and therefore has
  3632. no effect. But if your program reaches a breakpoint whose ignore count
  3633. is positive, then instead of stopping, it just decrements the ignore
  3634. count by one and continues. As a result, if the ignore count value is
  3635. N, the breakpoint does not stop the next N times your program reaches
  3636. it.
  3637. 'ignore BNUM COUNT'
  3638. Set the ignore count of breakpoint number BNUM to COUNT. The next
  3639. COUNT times the breakpoint is reached, your program's execution
  3640. does not stop; other than to decrement the ignore count, GDB takes
  3641. no action.
  3642. To make the breakpoint stop the next time it is reached, specify a
  3643. count of zero.
  3644. When you use 'continue' to resume execution of your program from a
  3645. breakpoint, you can specify an ignore count directly as an argument
  3646. to 'continue', rather than using 'ignore'. *Note Continuing and
  3647. Stepping: Continuing and Stepping.
  3648. If a breakpoint has a positive ignore count and a condition, the
  3649. condition is not checked. Once the ignore count reaches zero, GDB
  3650. resumes checking the condition.
  3651. You could achieve the effect of the ignore count with a condition
  3652. such as '$foo-- <= 0' using a debugger convenience variable that is
  3653. decremented each time. *Note Convenience Variables: Convenience
  3654. Vars.
  3655. Ignore counts apply to breakpoints, watchpoints, and catchpoints.
  3656. 
  3657. File: gdb.info, Node: Break Commands, Next: Dynamic Printf, Prev: Conditions, Up: Breakpoints
  3658. 5.1.7 Breakpoint Command Lists
  3659. ------------------------------
  3660. You can give any breakpoint (or watchpoint or catchpoint) a series of
  3661. commands to execute when your program stops due to that breakpoint. For
  3662. example, you might want to print the values of certain expressions, or
  3663. enable other breakpoints.
  3664. 'commands [LIST...]'
  3665. '... COMMAND-LIST ...'
  3666. 'end'
  3667. Specify a list of commands for the given breakpoints. The commands
  3668. themselves appear on the following lines. Type a line containing
  3669. just 'end' to terminate the commands.
  3670. To remove all commands from a breakpoint, type 'commands' and
  3671. follow it immediately with 'end'; that is, give no commands.
  3672. With no argument, 'commands' refers to the last breakpoint,
  3673. watchpoint, or catchpoint set (not to the breakpoint most recently
  3674. encountered). If the most recent breakpoints were set with a
  3675. single command, then the 'commands' will apply to all the
  3676. breakpoints set by that command. This applies to breakpoints set
  3677. by 'rbreak', and also applies when a single 'break' command creates
  3678. multiple breakpoints (*note Ambiguous Expressions: Ambiguous
  3679. Expressions.).
  3680. Pressing <RET> as a means of repeating the last GDB command is
  3681. disabled within a COMMAND-LIST.
  3682. You can use breakpoint commands to start your program up again.
  3683. Simply use the 'continue' command, or 'step', or any other command that
  3684. resumes execution.
  3685. Any other commands in the command list, after a command that resumes
  3686. execution, are ignored. This is because any time you resume execution
  3687. (even with a simple 'next' or 'step'), you may encounter another
  3688. breakpoint--which could have its own command list, leading to
  3689. ambiguities about which list to execute.
  3690. If the first command you specify in a command list is 'silent', the
  3691. usual message about stopping at a breakpoint is not printed. This may
  3692. be desirable for breakpoints that are to print a specific message and
  3693. then continue. If none of the remaining commands print anything, you
  3694. see no sign that the breakpoint was reached. 'silent' is meaningful
  3695. only at the beginning of a breakpoint command list.
  3696. The commands 'echo', 'output', and 'printf' allow you to print
  3697. precisely controlled output, and are often useful in silent breakpoints.
  3698. *Note Commands for Controlled Output: Output.
  3699. For example, here is how you could use breakpoint commands to print
  3700. the value of 'x' at entry to 'foo' whenever 'x' is positive.
  3701. break foo if x>0
  3702. commands
  3703. silent
  3704. printf "x is %d\n",x
  3705. cont
  3706. end
  3707. One application for breakpoint commands is to compensate for one bug
  3708. so you can test for another. Put a breakpoint just after the erroneous
  3709. line of code, give it a condition to detect the case in which something
  3710. erroneous has been done, and give it commands to assign correct values
  3711. to any variables that need them. End with the 'continue' command so
  3712. that your program does not stop, and start with the 'silent' command so
  3713. that no output is produced. Here is an example:
  3714. break 403
  3715. commands
  3716. silent
  3717. set x = y + 4
  3718. cont
  3719. end
  3720. 
  3721. File: gdb.info, Node: Dynamic Printf, Next: Save Breakpoints, Prev: Break Commands, Up: Breakpoints
  3722. 5.1.8 Dynamic Printf
  3723. --------------------
  3724. The dynamic printf command 'dprintf' combines a breakpoint with
  3725. formatted printing of your program's data to give you the effect of
  3726. inserting 'printf' calls into your program on-the-fly, without having to
  3727. recompile it.
  3728. In its most basic form, the output goes to the GDB console. However,
  3729. you can set the variable 'dprintf-style' for alternate handling. For
  3730. instance, you can ask to format the output by calling your program's
  3731. 'printf' function. This has the advantage that the characters go to the
  3732. program's output device, so they can recorded in redirects to files and
  3733. so forth.
  3734. If you are doing remote debugging with a stub or agent, you can also
  3735. ask to have the printf handled by the remote agent. In addition to
  3736. ensuring that the output goes to the remote program's device along with
  3737. any other output the program might produce, you can also ask that the
  3738. dprintf remain active even after disconnecting from the remote target.
  3739. Using the stub/agent is also more efficient, as it can do everything
  3740. without needing to communicate with GDB.
  3741. 'dprintf LOCATION,TEMPLATE,EXPRESSION[,EXPRESSION...]'
  3742. Whenever execution reaches LOCATION, print the values of one or
  3743. more EXPRESSIONS under the control of the string TEMPLATE. To
  3744. print several values, separate them with commas.
  3745. 'set dprintf-style STYLE'
  3746. Set the dprintf output to be handled in one of several different
  3747. styles enumerated below. A change of style affects all existing
  3748. dynamic printfs immediately. (If you need individual control over
  3749. the print commands, simply define normal breakpoints with
  3750. explicitly-supplied command lists.)
  3751. 'gdb'
  3752. Handle the output using the GDB 'printf' command.
  3753. 'call'
  3754. Handle the output by calling a function in your program
  3755. (normally 'printf').
  3756. 'agent'
  3757. Have the remote debugging agent (such as 'gdbserver') handle
  3758. the output itself. This style is only available for agents
  3759. that support running commands on the target.
  3760. 'set dprintf-function FUNCTION'
  3761. Set the function to call if the dprintf style is 'call'. By
  3762. default its value is 'printf'. You may set it to any expression.
  3763. that GDB can evaluate to a function, as per the 'call' command.
  3764. 'set dprintf-channel CHANNEL'
  3765. Set a "channel" for dprintf. If set to a non-empty value, GDB will
  3766. evaluate it as an expression and pass the result as a first
  3767. argument to the 'dprintf-function', in the manner of 'fprintf' and
  3768. similar functions. Otherwise, the dprintf format string will be
  3769. the first argument, in the manner of 'printf'.
  3770. As an example, if you wanted 'dprintf' output to go to a logfile
  3771. that is a standard I/O stream assigned to the variable 'mylog', you
  3772. could do the following:
  3773. (gdb) set dprintf-style call
  3774. (gdb) set dprintf-function fprintf
  3775. (gdb) set dprintf-channel mylog
  3776. (gdb) dprintf 25,"at line 25, glob=%d\n",glob
  3777. Dprintf 1 at 0x123456: file main.c, line 25.
  3778. (gdb) info break
  3779. 1 dprintf keep y 0x00123456 in main at main.c:25
  3780. call (void) fprintf (mylog,"at line 25, glob=%d\n",glob)
  3781. continue
  3782. (gdb)
  3783. Note that the 'info break' displays the dynamic printf commands as
  3784. normal breakpoint commands; you can thus easily see the effect of
  3785. the variable settings.
  3786. 'set disconnected-dprintf on'
  3787. 'set disconnected-dprintf off'
  3788. Choose whether 'dprintf' commands should continue to run if GDB has
  3789. disconnected from the target. This only applies if the
  3790. 'dprintf-style' is 'agent'.
  3791. 'show disconnected-dprintf off'
  3792. Show the current choice for disconnected 'dprintf'.
  3793. GDB does not check the validity of function and channel, relying on
  3794. you to supply values that are meaningful for the contexts in which they
  3795. are being used. For instance, the function and channel may be the
  3796. values of local variables, but if that is the case, then all enabled
  3797. dynamic prints must be at locations within the scope of those locals.
  3798. If evaluation fails, GDB will report an error.
  3799. 
  3800. File: gdb.info, Node: Save Breakpoints, Next: Static Probe Points, Prev: Dynamic Printf, Up: Breakpoints
  3801. 5.1.9 How to save breakpoints to a file
  3802. ---------------------------------------
  3803. To save breakpoint definitions to a file use the 'save breakpoints'
  3804. command.
  3805. 'save breakpoints [FILENAME]'
  3806. This command saves all current breakpoint definitions together with
  3807. their commands and ignore counts, into a file 'FILENAME' suitable
  3808. for use in a later debugging session. This includes all types of
  3809. breakpoints (breakpoints, watchpoints, catchpoints, tracepoints).
  3810. To read the saved breakpoint definitions, use the 'source' command
  3811. (*note Command Files::). Note that watchpoints with expressions
  3812. involving local variables may fail to be recreated because it may
  3813. not be possible to access the context where the watchpoint is valid
  3814. anymore. Because the saved breakpoint definitions are simply a
  3815. sequence of GDB commands that recreate the breakpoints, you can
  3816. edit the file in your favorite editing program, and remove the
  3817. breakpoint definitions you're not interested in, or that can no
  3818. longer be recreated.
  3819. 
  3820. File: gdb.info, Node: Static Probe Points, Next: Error in Breakpoints, Prev: Save Breakpoints, Up: Breakpoints
  3821. 5.1.10 Static Probe Points
  3822. --------------------------
  3823. GDB supports "SDT" probes in the code. SDT stands for Statically
  3824. Defined Tracing, and the probes are designed to have a tiny runtime code
  3825. and data footprint, and no dynamic relocations.
  3826. Currently, the following types of probes are supported on
  3827. ELF-compatible systems:
  3828. * 'SystemTap' (<http://sourceware.org/systemtap/>) SDT probes(1).
  3829. 'SystemTap' probes are usable from assembly, C and C++
  3830. languages(2).
  3831. * 'DTrace' (<http://oss.oracle.com/projects/DTrace>) USDT probes.
  3832. 'DTrace' probes are usable from C and C++ languages.
  3833. Some 'SystemTap' probes have an associated semaphore variable; for
  3834. instance, this happens automatically if you defined your probe using a
  3835. DTrace-style '.d' file. If your probe has a semaphore, GDB will
  3836. automatically enable it when you specify a breakpoint using the
  3837. '-probe-stap' notation. But, if you put a breakpoint at a probe's
  3838. location by some other method (e.g., 'break file:line'), then GDB will
  3839. not automatically set the semaphore. 'DTrace' probes do not support
  3840. semaphores.
  3841. You can examine the available static static probes using 'info
  3842. probes', with optional arguments:
  3843. 'info probes [TYPE] [PROVIDER [NAME [OBJFILE]]]'
  3844. If given, TYPE is either 'stap' for listing 'SystemTap' probes or
  3845. 'dtrace' for listing 'DTrace' probes. If omitted all probes are
  3846. listed regardless of their types.
  3847. If given, PROVIDER is a regular expression used to match against
  3848. provider names when selecting which probes to list. If omitted,
  3849. probes by all probes from all providers are listed.
  3850. If given, NAME is a regular expression to match against probe names
  3851. when selecting which probes to list. If omitted, probe names are
  3852. not considered when deciding whether to display them.
  3853. If given, OBJFILE is a regular expression used to select which
  3854. object files (executable or shared libraries) to examine. If not
  3855. given, all object files are considered.
  3856. 'info probes all'
  3857. List the available static probes, from all types.
  3858. Some probe points can be enabled and/or disabled. The effect of
  3859. enabling or disabling a probe depends on the type of probe being
  3860. handled. Some 'DTrace' probes can be enabled or disabled, but
  3861. 'SystemTap' probes cannot be disabled.
  3862. You can enable (or disable) one or more probes using the following
  3863. commands, with optional arguments:
  3864. 'enable probes [PROVIDER [NAME [OBJFILE]]]'
  3865. If given, PROVIDER is a regular expression used to match against
  3866. provider names when selecting which probes to enable. If omitted,
  3867. all probes from all providers are enabled.
  3868. If given, NAME is a regular expression to match against probe names
  3869. when selecting which probes to enable. If omitted, probe names are
  3870. not considered when deciding whether to enable them.
  3871. If given, OBJFILE is a regular expression used to select which
  3872. object files (executable or shared libraries) to examine. If not
  3873. given, all object files are considered.
  3874. 'disable probes [PROVIDER [NAME [OBJFILE]]]'
  3875. See the 'enable probes' command above for a description of the
  3876. optional arguments accepted by this command.
  3877. A probe may specify up to twelve arguments. These are available at
  3878. the point at which the probe is defined--that is, when the current PC is
  3879. at the probe's location. The arguments are available using the
  3880. convenience variables (*note Convenience Vars::)
  3881. '$_probe_arg0'...'$_probe_arg11'. In 'SystemTap' probes each probe
  3882. argument is an integer of the appropriate size; types are not preserved.
  3883. In 'DTrace' probes types are preserved provided that they are recognized
  3884. as such by GDB; otherwise the value of the probe argument will be a long
  3885. integer. The convenience variable '$_probe_argc' holds the number of
  3886. arguments at the current probe point.
  3887. These variables are always available, but attempts to access them at
  3888. any location other than a probe point will cause GDB to give an error
  3889. message.
  3890. ---------- Footnotes ----------
  3891. (1) See
  3892. <http://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps> for
  3893. more information on how to add 'SystemTap' SDT probes in your
  3894. applications.
  3895. (2) See
  3896. <http://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation> for
  3897. a good reference on how the SDT probes are implemented.
  3898. 
  3899. File: gdb.info, Node: Error in Breakpoints, Next: Breakpoint-related Warnings, Prev: Static Probe Points, Up: Breakpoints
  3900. 5.1.11 "Cannot insert breakpoints"
  3901. ----------------------------------
  3902. If you request too many active hardware-assisted breakpoints and
  3903. watchpoints, you will see this error message:
  3904. Stopped; cannot insert breakpoints.
  3905. You may have requested too many hardware breakpoints and watchpoints.
  3906. This message is printed when you attempt to resume the program, since
  3907. only then GDB knows exactly how many hardware breakpoints and
  3908. watchpoints it needs to insert.
  3909. When this message is printed, you need to disable or remove some of
  3910. the hardware-assisted breakpoints and watchpoints, and then continue.
  3911. 
  3912. File: gdb.info, Node: Breakpoint-related Warnings, Prev: Error in Breakpoints, Up: Breakpoints
  3913. 5.1.12 "Breakpoint address adjusted..."
  3914. ---------------------------------------
  3915. Some processor architectures place constraints on the addresses at which
  3916. breakpoints may be placed. For architectures thus constrained, GDB will
  3917. attempt to adjust the breakpoint's address to comply with the
  3918. constraints dictated by the architecture.
  3919. One example of such an architecture is the Fujitsu FR-V. The FR-V is
  3920. a VLIW architecture in which a number of RISC-like instructions may be
  3921. bundled together for parallel execution. The FR-V architecture
  3922. constrains the location of a breakpoint instruction within such a bundle
  3923. to the instruction with the lowest address. GDB honors this constraint
  3924. by adjusting a breakpoint's address to the first in the bundle.
  3925. It is not uncommon for optimized code to have bundles which contain
  3926. instructions from different source statements, thus it may happen that a
  3927. breakpoint's address will be adjusted from one source statement to
  3928. another. Since this adjustment may significantly alter GDB's breakpoint
  3929. related behavior from what the user expects, a warning is printed when
  3930. the breakpoint is first set and also when the breakpoint is hit.
  3931. A warning like the one below is printed when setting a breakpoint
  3932. that's been subject to address adjustment:
  3933. warning: Breakpoint address adjusted from 0x00010414 to 0x00010410.
  3934. Such warnings are printed both for user settable and GDB's internal
  3935. breakpoints. If you see one of these warnings, you should verify that a
  3936. breakpoint set at the adjusted address will have the desired affect. If
  3937. not, the breakpoint in question may be removed and other breakpoints may
  3938. be set which will have the desired behavior. E.g., it may be sufficient
  3939. to place the breakpoint at a later instruction. A conditional
  3940. breakpoint may also be useful in some cases to prevent the breakpoint
  3941. from triggering too often.
  3942. GDB will also issue a warning when stopping at one of these adjusted
  3943. breakpoints:
  3944. warning: Breakpoint 1 address previously adjusted from 0x00010414
  3945. to 0x00010410.
  3946. When this warning is encountered, it may be too late to take remedial
  3947. action except in cases where the breakpoint is hit earlier or more
  3948. frequently than expected.
  3949. 
  3950. File: gdb.info, Node: Continuing and Stepping, Next: Skipping Over Functions and Files, Prev: Breakpoints, Up: Stopping
  3951. 5.2 Continuing and Stepping
  3952. ===========================
  3953. "Continuing" means resuming program execution until your program
  3954. completes normally. In contrast, "stepping" means executing just one
  3955. more "step" of your program, where "step" may mean either one line of
  3956. source code, or one machine instruction (depending on what particular
  3957. command you use). Either when continuing or when stepping, your program
  3958. may stop even sooner, due to a breakpoint or a signal. (If it stops due
  3959. to a signal, you may want to use 'handle', or use 'signal 0' to resume
  3960. execution (*note Signals: Signals.), or you may step into the signal's
  3961. handler (*note stepping and signal handlers::).)
  3962. 'continue [IGNORE-COUNT]'
  3963. 'c [IGNORE-COUNT]'
  3964. 'fg [IGNORE-COUNT]'
  3965. Resume program execution, at the address where your program last
  3966. stopped; any breakpoints set at that address are bypassed. The
  3967. optional argument IGNORE-COUNT allows you to specify a further
  3968. number of times to ignore a breakpoint at this location; its effect
  3969. is like that of 'ignore' (*note Break Conditions: Conditions.).
  3970. The argument IGNORE-COUNT is meaningful only when your program
  3971. stopped due to a breakpoint. At other times, the argument to
  3972. 'continue' is ignored.
  3973. The synonyms 'c' and 'fg' (for "foreground", as the debugged
  3974. program is deemed to be the foreground program) are provided purely
  3975. for convenience, and have exactly the same behavior as 'continue'.
  3976. To resume execution at a different place, you can use 'return' (*note
  3977. Returning from a Function: Returning.) to go back to the calling
  3978. function; or 'jump' (*note Continuing at a Different Address: Jumping.)
  3979. to go to an arbitrary location in your program.
  3980. A typical technique for using stepping is to set a breakpoint (*note
  3981. Breakpoints; Watchpoints; and Catchpoints: Breakpoints.) at the
  3982. beginning of the function or the section of your program where a problem
  3983. is believed to lie, run your program until it stops at that breakpoint,
  3984. and then step through the suspect area, examining the variables that are
  3985. interesting, until you see the problem happen.
  3986. 'step'
  3987. Continue running your program until control reaches a different
  3988. source line, then stop it and return control to GDB. This command
  3989. is abbreviated 's'.
  3990. _Warning:_ If you use the 'step' command while control is
  3991. within a function that was compiled without debugging
  3992. information, execution proceeds until control reaches a
  3993. function that does have debugging information. Likewise, it
  3994. will not step into a function which is compiled without
  3995. debugging information. To step through functions without
  3996. debugging information, use the 'stepi' command, described
  3997. below.
  3998. The 'step' command only stops at the first instruction of a source
  3999. line. This prevents the multiple stops that could otherwise occur
  4000. in 'switch' statements, 'for' loops, etc. 'step' continues to stop
  4001. if a function that has debugging information is called within the
  4002. line. In other words, 'step' _steps inside_ any functions called
  4003. within the line.
  4004. Also, the 'step' command only enters a function if there is line
  4005. number information for the function. Otherwise it acts like the
  4006. 'next' command. This avoids problems when using 'cc -gl' on MIPS
  4007. machines. Previously, 'step' entered subroutines if there was any
  4008. debugging information about the routine.
  4009. 'step COUNT'
  4010. Continue running as in 'step', but do so COUNT times. If a
  4011. breakpoint is reached, or a signal not related to stepping occurs
  4012. before COUNT steps, stepping stops right away.
  4013. 'next [COUNT]'
  4014. Continue to the next source line in the current (innermost) stack
  4015. frame. This is similar to 'step', but function calls that appear
  4016. within the line of code are executed without stopping. Execution
  4017. stops when control reaches a different line of code at the original
  4018. stack level that was executing when you gave the 'next' command.
  4019. This command is abbreviated 'n'.
  4020. An argument COUNT is a repeat count, as for 'step'.
  4021. The 'next' command only stops at the first instruction of a source
  4022. line. This prevents multiple stops that could otherwise occur in
  4023. 'switch' statements, 'for' loops, etc.
  4024. 'set step-mode'
  4025. 'set step-mode on'
  4026. The 'set step-mode on' command causes the 'step' command to stop at
  4027. the first instruction of a function which contains no debug line
  4028. information rather than stepping over it.
  4029. This is useful in cases where you may be interested in inspecting
  4030. the machine instructions of a function which has no symbolic info
  4031. and do not want GDB to automatically skip over this function.
  4032. 'set step-mode off'
  4033. Causes the 'step' command to step over any functions which contains
  4034. no debug information. This is the default.
  4035. 'show step-mode'
  4036. Show whether GDB will stop in or step over functions without source
  4037. line debug information.
  4038. 'finish'
  4039. Continue running until just after function in the selected stack
  4040. frame returns. Print the returned value (if any). This command
  4041. can be abbreviated as 'fin'.
  4042. Contrast this with the 'return' command (*note Returning from a
  4043. Function: Returning.).
  4044. 'set print finish [on|off]'
  4045. 'show print finish'
  4046. By default the 'finish' command will show the value that is
  4047. returned by the function. This can be disabled using 'set print
  4048. finish off'. When disabled, the value is still entered into the
  4049. value history (*note Value History::), but not displayed.
  4050. 'until'
  4051. 'u'
  4052. Continue running until a source line past the current line, in the
  4053. current stack frame, is reached. This command is used to avoid
  4054. single stepping through a loop more than once. It is like the
  4055. 'next' command, except that when 'until' encounters a jump, it
  4056. automatically continues execution until the program counter is
  4057. greater than the address of the jump.
  4058. This means that when you reach the end of a loop after single
  4059. stepping though it, 'until' makes your program continue execution
  4060. until it exits the loop. In contrast, a 'next' command at the end
  4061. of a loop simply steps back to the beginning of the loop, which
  4062. forces you to step through the next iteration.
  4063. 'until' always stops your program if it attempts to exit the
  4064. current stack frame.
  4065. 'until' may produce somewhat counterintuitive results if the order
  4066. of machine code does not match the order of the source lines. For
  4067. example, in the following excerpt from a debugging session, the 'f'
  4068. ('frame') command shows that execution is stopped at line '206';
  4069. yet when we use 'until', we get to line '195':
  4070. (gdb) f
  4071. #0 main (argc=4, argv=0xf7fffae8) at m4.c:206
  4072. 206 expand_input();
  4073. (gdb) until
  4074. 195 for ( ; argc > 0; NEXTARG) {
  4075. This happened because, for execution efficiency, the compiler had
  4076. generated code for the loop closure test at the end, rather than
  4077. the start, of the loop--even though the test in a C 'for'-loop is
  4078. written before the body of the loop. The 'until' command appeared
  4079. to step back to the beginning of the loop when it advanced to this
  4080. expression; however, it has not really gone to an earlier
  4081. statement--not in terms of the actual machine code.
  4082. 'until' with no argument works by means of single instruction
  4083. stepping, and hence is slower than 'until' with an argument.
  4084. 'until LOCATION'
  4085. 'u LOCATION'
  4086. Continue running your program until either the specified LOCATION
  4087. is reached, or the current stack frame returns. The location is
  4088. any of the forms described in *note Specify Location::. This form
  4089. of the command uses temporary breakpoints, and hence is quicker
  4090. than 'until' without an argument. The specified location is
  4091. actually reached only if it is in the current frame. This implies
  4092. that 'until' can be used to skip over recursive function
  4093. invocations. For instance in the code below, if the current
  4094. location is line '96', issuing 'until 99' will execute the program
  4095. up to line '99' in the same invocation of factorial, i.e., after
  4096. the inner invocations have returned.
  4097. 94 int factorial (int value)
  4098. 95 {
  4099. 96 if (value > 1) {
  4100. 97 value *= factorial (value - 1);
  4101. 98 }
  4102. 99 return (value);
  4103. 100 }
  4104. 'advance LOCATION'
  4105. Continue running the program up to the given LOCATION. An argument
  4106. is required, which should be of one of the forms described in *note
  4107. Specify Location::. Execution will also stop upon exit from the
  4108. current stack frame. This command is similar to 'until', but
  4109. 'advance' will not skip over recursive function calls, and the
  4110. target location doesn't have to be in the same frame as the current
  4111. one.
  4112. 'stepi'
  4113. 'stepi ARG'
  4114. 'si'
  4115. Execute one machine instruction, then stop and return to the
  4116. debugger.
  4117. It is often useful to do 'display/i $pc' when stepping by machine
  4118. instructions. This makes GDB automatically display the next
  4119. instruction to be executed, each time your program stops. *Note
  4120. Automatic Display: Auto Display.
  4121. An argument is a repeat count, as in 'step'.
  4122. 'nexti'
  4123. 'nexti ARG'
  4124. 'ni'
  4125. Execute one machine instruction, but if it is a function call,
  4126. proceed until the function returns.
  4127. An argument is a repeat count, as in 'next'.
  4128. By default, and if available, GDB makes use of target-assisted "range
  4129. stepping". In other words, whenever you use a stepping command (e.g.,
  4130. 'step', 'next'), GDB tells the target to step the corresponding range of
  4131. instruction addresses instead of issuing multiple single-steps. This
  4132. speeds up line stepping, particularly for remote targets. Ideally,
  4133. there should be no reason you would want to turn range stepping off.
  4134. However, it's possible that a bug in the debug info, a bug in the remote
  4135. stub (for remote targets), or even a bug in GDB could make line stepping
  4136. behave incorrectly when target-assisted range stepping is enabled. You
  4137. can use the following command to turn off range stepping if necessary:
  4138. 'set range-stepping'
  4139. 'show range-stepping'
  4140. Control whether range stepping is enabled.
  4141. If 'on', and the target supports it, GDB tells the target to step a
  4142. range of addresses itself, instead of issuing multiple
  4143. single-steps. If 'off', GDB always issues single-steps, even if
  4144. range stepping is supported by the target. The default is 'on'.
  4145. 
  4146. File: gdb.info, Node: Skipping Over Functions and Files, Next: Signals, Prev: Continuing and Stepping, Up: Stopping
  4147. 5.3 Skipping Over Functions and Files
  4148. =====================================
  4149. The program you are debugging may contain some functions which are
  4150. uninteresting to debug. The 'skip' command lets you tell GDB to skip a
  4151. function, all functions in a file or a particular function in a
  4152. particular file when stepping.
  4153. For example, consider the following C function:
  4154. 101 int func()
  4155. 102 {
  4156. 103 foo(boring());
  4157. 104 bar(boring());
  4158. 105 }
  4159. Suppose you wish to step into the functions 'foo' and 'bar', but you are
  4160. not interested in stepping through 'boring'. If you run 'step' at line
  4161. 103, you'll enter 'boring()', but if you run 'next', you'll step over
  4162. both 'foo' and 'boring'!
  4163. One solution is to 'step' into 'boring' and use the 'finish' command
  4164. to immediately exit it. But this can become tedious if 'boring' is
  4165. called from many places.
  4166. A more flexible solution is to execute 'skip boring'. This instructs
  4167. GDB never to step into 'boring'. Now when you execute 'step' at line
  4168. 103, you'll step over 'boring' and directly into 'foo'.
  4169. Functions may be skipped by providing either a function name,
  4170. linespec (*note Specify Location::), regular expression that matches the
  4171. function's name, file name or a 'glob'-style pattern that matches the
  4172. file name.
  4173. On Posix systems the form of the regular expression is "Extended
  4174. Regular Expressions". See for example 'man 7 regex' on GNU/Linux
  4175. systems. On non-Posix systems the form of the regular expression is
  4176. whatever is provided by the 'regcomp' function of the underlying system.
  4177. See for example 'man 7 glob' on GNU/Linux systems for a description of
  4178. 'glob'-style patterns.
  4179. 'skip [OPTIONS]'
  4180. The basic form of the 'skip' command takes zero or more options
  4181. that specify what to skip. The OPTIONS argument is any useful
  4182. combination of the following:
  4183. '-file FILE'
  4184. '-fi FILE'
  4185. Functions in FILE will be skipped over when stepping.
  4186. '-gfile FILE-GLOB-PATTERN'
  4187. '-gfi FILE-GLOB-PATTERN'
  4188. Functions in files matching FILE-GLOB-PATTERN will be skipped
  4189. over when stepping.
  4190. (gdb) skip -gfi utils/*.c
  4191. '-function LINESPEC'
  4192. '-fu LINESPEC'
  4193. Functions named by LINESPEC or the function containing the
  4194. line named by LINESPEC will be skipped over when stepping.
  4195. *Note Specify Location::.
  4196. '-rfunction REGEXP'
  4197. '-rfu REGEXP'
  4198. Functions whose name matches REGEXP will be skipped over when
  4199. stepping.
  4200. This form is useful for complex function names. For example,
  4201. there is generally no need to step into C++ 'std::string'
  4202. constructors or destructors. Plus with C++ templates it can
  4203. be hard to write out the full name of the function, and often
  4204. it doesn't matter what the template arguments are. Specifying
  4205. the function to be skipped as a regular expression makes this
  4206. easier.
  4207. (gdb) skip -rfu ^std::(allocator|basic_string)<.*>::~?\1 *\(
  4208. If you want to skip every templated C++ constructor and
  4209. destructor in the 'std' namespace you can do:
  4210. (gdb) skip -rfu ^std::([a-zA-z0-9_]+)<.*>::~?\1 *\(
  4211. If no options are specified, the function you're currently
  4212. debugging will be skipped.
  4213. 'skip function [LINESPEC]'
  4214. After running this command, the function named by LINESPEC or the
  4215. function containing the line named by LINESPEC will be skipped over
  4216. when stepping. *Note Specify Location::.
  4217. If you do not specify LINESPEC, the function you're currently
  4218. debugging will be skipped.
  4219. (If you have a function called 'file' that you want to skip, use
  4220. 'skip function file'.)
  4221. 'skip file [FILENAME]'
  4222. After running this command, any function whose source lives in
  4223. FILENAME will be skipped over when stepping.
  4224. (gdb) skip file boring.c
  4225. File boring.c will be skipped when stepping.
  4226. If you do not specify FILENAME, functions whose source lives in the
  4227. file you're currently debugging will be skipped.
  4228. Skips can be listed, deleted, disabled, and enabled, much like
  4229. breakpoints. These are the commands for managing your list of skips:
  4230. 'info skip [RANGE]'
  4231. Print details about the specified skip(s). If RANGE is not
  4232. specified, print a table with details about all functions and files
  4233. marked for skipping. 'info skip' prints the following information
  4234. about each skip:
  4235. _Identifier_
  4236. A number identifying this skip.
  4237. _Enabled or Disabled_
  4238. Enabled skips are marked with 'y'. Disabled skips are marked
  4239. with 'n'.
  4240. _Glob_
  4241. If the file name is a 'glob' pattern this is 'y'. Otherwise
  4242. it is 'n'.
  4243. _File_
  4244. The name or 'glob' pattern of the file to be skipped. If no
  4245. file is specified this is '<none>'.
  4246. _RE_
  4247. If the function name is a 'regular expression' this is 'y'.
  4248. Otherwise it is 'n'.
  4249. _Function_
  4250. The name or regular expression of the function to skip. If no
  4251. function is specified this is '<none>'.
  4252. 'skip delete [RANGE]'
  4253. Delete the specified skip(s). If RANGE is not specified, delete
  4254. all skips.
  4255. 'skip enable [RANGE]'
  4256. Enable the specified skip(s). If RANGE is not specified, enable
  4257. all skips.
  4258. 'skip disable [RANGE]'
  4259. Disable the specified skip(s). If RANGE is not specified, disable
  4260. all skips.
  4261. 'set debug skip [on|off]'
  4262. Set whether to print the debug output about skipping files and
  4263. functions.
  4264. 'show debug skip'
  4265. Show whether the debug output about skipping files and functions is
  4266. printed.
  4267. 
  4268. File: gdb.info, Node: Signals, Next: Thread Stops, Prev: Skipping Over Functions and Files, Up: Stopping
  4269. 5.4 Signals
  4270. ===========
  4271. A signal is an asynchronous event that can happen in a program. The
  4272. operating system defines the possible kinds of signals, and gives each
  4273. kind a name and a number. For example, in Unix 'SIGINT' is the signal a
  4274. program gets when you type an interrupt character (often 'Ctrl-c');
  4275. 'SIGSEGV' is the signal a program gets from referencing a place in
  4276. memory far away from all the areas in use; 'SIGALRM' occurs when the
  4277. alarm clock timer goes off (which happens only if your program has
  4278. requested an alarm).
  4279. Some signals, including 'SIGALRM', are a normal part of the
  4280. functioning of your program. Others, such as 'SIGSEGV', indicate
  4281. errors; these signals are "fatal" (they kill your program immediately)
  4282. if the program has not specified in advance some other way to handle the
  4283. signal. 'SIGINT' does not indicate an error in your program, but it is
  4284. normally fatal so it can carry out the purpose of the interrupt: to kill
  4285. the program.
  4286. GDB has the ability to detect any occurrence of a signal in your
  4287. program. You can tell GDB in advance what to do for each kind of
  4288. signal.
  4289. Normally, GDB is set up to let the non-erroneous signals like
  4290. 'SIGALRM' be silently passed to your program (so as not to interfere
  4291. with their role in the program's functioning) but to stop your program
  4292. immediately whenever an error signal happens. You can change these
  4293. settings with the 'handle' command.
  4294. 'info signals'
  4295. 'info handle'
  4296. Print a table of all the kinds of signals and how GDB has been told
  4297. to handle each one. You can use this to see the signal numbers of
  4298. all the defined types of signals.
  4299. 'info signals SIG'
  4300. Similar, but print information only about the specified signal
  4301. number.
  4302. 'info handle' is an alias for 'info signals'.
  4303. 'catch signal [SIGNAL... | 'all']'
  4304. Set a catchpoint for the indicated signals. *Note Set
  4305. Catchpoints::, for details about this command.
  4306. 'handle SIGNAL [KEYWORDS...]'
  4307. Change the way GDB handles signal SIGNAL. The SIGNAL can be the
  4308. number of a signal or its name (with or without the 'SIG' at the
  4309. beginning); a list of signal numbers of the form 'LOW-HIGH'; or the
  4310. word 'all', meaning all the known signals. Optional arguments
  4311. KEYWORDS, described below, say what change to make.
  4312. The keywords allowed by the 'handle' command can be abbreviated.
  4313. Their full names are:
  4314. 'nostop'
  4315. GDB should not stop your program when this signal happens. It may
  4316. still print a message telling you that the signal has come in.
  4317. 'stop'
  4318. GDB should stop your program when this signal happens. This
  4319. implies the 'print' keyword as well.
  4320. 'print'
  4321. GDB should print a message when this signal happens.
  4322. 'noprint'
  4323. GDB should not mention the occurrence of the signal at all. This
  4324. implies the 'nostop' keyword as well.
  4325. 'pass'
  4326. 'noignore'
  4327. GDB should allow your program to see this signal; your program can
  4328. handle the signal, or else it may terminate if the signal is fatal
  4329. and not handled. 'pass' and 'noignore' are synonyms.
  4330. 'nopass'
  4331. 'ignore'
  4332. GDB should not allow your program to see this signal. 'nopass' and
  4333. 'ignore' are synonyms.
  4334. When a signal stops your program, the signal is not visible to the
  4335. program until you continue. Your program sees the signal then, if
  4336. 'pass' is in effect for the signal in question _at that time_. In other
  4337. words, after GDB reports a signal, you can use the 'handle' command with
  4338. 'pass' or 'nopass' to control whether your program sees that signal when
  4339. you continue.
  4340. The default is set to 'nostop', 'noprint', 'pass' for non-erroneous
  4341. signals such as 'SIGALRM', 'SIGWINCH' and 'SIGCHLD', and to 'stop',
  4342. 'print', 'pass' for the erroneous signals.
  4343. You can also use the 'signal' command to prevent your program from
  4344. seeing a signal, or cause it to see a signal it normally would not see,
  4345. or to give it any signal at any time. For example, if your program
  4346. stopped due to some sort of memory reference error, you might store
  4347. correct values into the erroneous variables and continue, hoping to see
  4348. more execution; but your program would probably terminate immediately as
  4349. a result of the fatal signal once it saw the signal. To prevent this,
  4350. you can continue with 'signal 0'. *Note Giving your Program a Signal:
  4351. Signaling.
  4352. GDB optimizes for stepping the mainline code. If a signal that has
  4353. 'handle nostop' and 'handle pass' set arrives while a stepping command
  4354. (e.g., 'stepi', 'step', 'next') is in progress, GDB lets the signal
  4355. handler run and then resumes stepping the mainline code once the signal
  4356. handler returns. In other words, GDB steps over the signal handler.
  4357. This prevents signals that you've specified as not interesting (with
  4358. 'handle nostop') from changing the focus of debugging unexpectedly.
  4359. Note that the signal handler itself may still hit a breakpoint, stop for
  4360. another signal that has 'handle stop' in effect, or for any other event
  4361. that normally results in stopping the stepping command sooner. Also
  4362. note that GDB still informs you that the program received a signal if
  4363. 'handle print' is set.
  4364. If you set 'handle pass' for a signal, and your program sets up a
  4365. handler for it, then issuing a stepping command, such as 'step' or
  4366. 'stepi', when your program is stopped due to the signal will step _into_
  4367. the signal handler (if the target supports that).
  4368. Likewise, if you use the 'queue-signal' command to queue a signal to
  4369. be delivered to the current thread when execution of the thread resumes
  4370. (*note Giving your Program a Signal: Signaling.), then a stepping
  4371. command will step into the signal handler.
  4372. Here's an example, using 'stepi' to step to the first instruction of
  4373. 'SIGUSR1''s handler:
  4374. (gdb) handle SIGUSR1
  4375. Signal Stop Print Pass to program Description
  4376. SIGUSR1 Yes Yes Yes User defined signal 1
  4377. (gdb) c
  4378. Continuing.
  4379. Program received signal SIGUSR1, User defined signal 1.
  4380. main () sigusr1.c:28
  4381. 28 p = 0;
  4382. (gdb) si
  4383. sigusr1_handler () at sigusr1.c:9
  4384. 9 {
  4385. The same, but using 'queue-signal' instead of waiting for the program
  4386. to receive the signal first:
  4387. (gdb) n
  4388. 28 p = 0;
  4389. (gdb) queue-signal SIGUSR1
  4390. (gdb) si
  4391. sigusr1_handler () at sigusr1.c:9
  4392. 9 {
  4393. (gdb)
  4394. On some targets, GDB can inspect extra signal information associated
  4395. with the intercepted signal, before it is actually delivered to the
  4396. program being debugged. This information is exported by the convenience
  4397. variable '$_siginfo', and consists of data that is passed by the kernel
  4398. to the signal handler at the time of the receipt of a signal. The data
  4399. type of the information itself is target dependent. You can see the
  4400. data type using the 'ptype $_siginfo' command. On Unix systems, it
  4401. typically corresponds to the standard 'siginfo_t' type, as defined in
  4402. the 'signal.h' system header.
  4403. Here's an example, on a GNU/Linux system, printing the stray
  4404. referenced address that raised a segmentation fault.
  4405. (gdb) continue
  4406. Program received signal SIGSEGV, Segmentation fault.
  4407. 0x0000000000400766 in main ()
  4408. 69 *(int *)p = 0;
  4409. (gdb) ptype $_siginfo
  4410. type = struct {
  4411. int si_signo;
  4412. int si_errno;
  4413. int si_code;
  4414. union {
  4415. int _pad[28];
  4416. struct {...} _kill;
  4417. struct {...} _timer;
  4418. struct {...} _rt;
  4419. struct {...} _sigchld;
  4420. struct {...} _sigfault;
  4421. struct {...} _sigpoll;
  4422. } _sifields;
  4423. }
  4424. (gdb) ptype $_siginfo._sifields._sigfault
  4425. type = struct {
  4426. void *si_addr;
  4427. }
  4428. (gdb) p $_siginfo._sifields._sigfault.si_addr
  4429. $1 = (void *) 0x7ffff7ff7000
  4430. Depending on target support, '$_siginfo' may also be writable.
  4431. On some targets, a 'SIGSEGV' can be caused by a boundary violation,
  4432. i.e., accessing an address outside of the allowed range. In those cases
  4433. GDB may displays additional information, depending on how GDB has been
  4434. told to handle the signal. With 'handle stop SIGSEGV', GDB displays the
  4435. violation kind: "Upper" or "Lower", the memory address accessed and the
  4436. bounds, while with 'handle nostop SIGSEGV' no additional information is
  4437. displayed.
  4438. The usual output of a segfault is:
  4439. Program received signal SIGSEGV, Segmentation fault
  4440. 0x0000000000400d7c in upper () at i386-mpx-sigsegv.c:68
  4441. 68 value = *(p + len);
  4442. While a bound violation is presented as:
  4443. Program received signal SIGSEGV, Segmentation fault
  4444. Upper bound violation while accessing address 0x7fffffffc3b3
  4445. Bounds: [lower = 0x7fffffffc390, upper = 0x7fffffffc3a3]
  4446. 0x0000000000400d7c in upper () at i386-mpx-sigsegv.c:68
  4447. 68 value = *(p + len);
  4448. 
  4449. File: gdb.info, Node: Thread Stops, Prev: Signals, Up: Stopping
  4450. 5.5 Stopping and Starting Multi-thread Programs
  4451. ===============================================
  4452. GDB supports debugging programs with multiple threads (*note Debugging
  4453. Programs with Multiple Threads: Threads.). There are two modes of
  4454. controlling execution of your program within the debugger. In the
  4455. default mode, referred to as "all-stop mode", when any thread in your
  4456. program stops (for example, at a breakpoint or while being stepped), all
  4457. other threads in the program are also stopped by GDB. On some targets,
  4458. GDB also supports "non-stop mode", in which other threads can continue
  4459. to run freely while you examine the stopped thread in the debugger.
  4460. * Menu:
  4461. * All-Stop Mode:: All threads stop when GDB takes control
  4462. * Non-Stop Mode:: Other threads continue to execute
  4463. * Background Execution:: Running your program asynchronously
  4464. * Thread-Specific Breakpoints:: Controlling breakpoints
  4465. * Interrupted System Calls:: GDB may interfere with system calls
  4466. * Observer Mode:: GDB does not alter program behavior
  4467. 
  4468. File: gdb.info, Node: All-Stop Mode, Next: Non-Stop Mode, Up: Thread Stops
  4469. 5.5.1 All-Stop Mode
  4470. -------------------
  4471. In all-stop mode, whenever your program stops under GDB for any reason,
  4472. _all_ threads of execution stop, not just the current thread. This
  4473. allows you to examine the overall state of the program, including
  4474. switching between threads, without worrying that things may change
  4475. underfoot.
  4476. Conversely, whenever you restart the program, _all_ threads start
  4477. executing. _This is true even when single-stepping_ with commands like
  4478. 'step' or 'next'.
  4479. In particular, GDB cannot single-step all threads in lockstep. Since
  4480. thread scheduling is up to your debugging target's operating system (not
  4481. controlled by GDB), other threads may execute more than one statement
  4482. while the current thread completes a single step. Moreover, in general
  4483. other threads stop in the middle of a statement, rather than at a clean
  4484. statement boundary, when the program stops.
  4485. You might even find your program stopped in another thread after
  4486. continuing or even single-stepping. This happens whenever some other
  4487. thread runs into a breakpoint, a signal, or an exception before the
  4488. first thread completes whatever you requested.
  4489. Whenever GDB stops your program, due to a breakpoint or a signal, it
  4490. automatically selects the thread where that breakpoint or signal
  4491. happened. GDB alerts you to the context switch with a message such as
  4492. '[Switching to Thread N]' to identify the thread.
  4493. On some OSes, you can modify GDB's default behavior by locking the OS
  4494. scheduler to allow only a single thread to run.
  4495. 'set scheduler-locking MODE'
  4496. Set the scheduler locking mode. It applies to normal execution,
  4497. record mode, and replay mode. If it is 'off', then there is no
  4498. locking and any thread may run at any time. If 'on', then only the
  4499. current thread may run when the inferior is resumed. The 'step'
  4500. mode optimizes for single-stepping; it prevents other threads from
  4501. preempting the current thread while you are stepping, so that the
  4502. focus of debugging does not change unexpectedly. Other threads
  4503. never get a chance to run when you step, and they are completely
  4504. free to run when you use commands like 'continue', 'until', or
  4505. 'finish'. However, unless another thread hits a breakpoint during
  4506. its timeslice, GDB does not change the current thread away from the
  4507. thread that you are debugging. The 'replay' mode behaves like
  4508. 'off' in record mode and like 'on' in replay mode.
  4509. 'show scheduler-locking'
  4510. Display the current scheduler locking mode.
  4511. By default, when you issue one of the execution commands such as
  4512. 'continue', 'next' or 'step', GDB allows only threads of the current
  4513. inferior to run. For example, if GDB is attached to two inferiors, each
  4514. with two threads, the 'continue' command resumes only the two threads of
  4515. the current inferior. This is useful, for example, when you debug a
  4516. program that forks and you want to hold the parent stopped (so that, for
  4517. instance, it doesn't run to exit), while you debug the child. In other
  4518. situations, you may not be interested in inspecting the current state of
  4519. any of the processes GDB is attached to, and you may want to resume them
  4520. all until some breakpoint is hit. In the latter case, you can instruct
  4521. GDB to allow all threads of all the inferiors to run with the
  4522. 'set schedule-multiple' command.
  4523. 'set schedule-multiple'
  4524. Set the mode for allowing threads of multiple processes to be
  4525. resumed when an execution command is issued. When 'on', all
  4526. threads of all processes are allowed to run. When 'off', only the
  4527. threads of the current process are resumed. The default is 'off'.
  4528. The 'scheduler-locking' mode takes precedence when set to 'on', or
  4529. while you are stepping and set to 'step'.
  4530. 'show schedule-multiple'
  4531. Display the current mode for resuming the execution of threads of
  4532. multiple processes.
  4533. 
  4534. File: gdb.info, Node: Non-Stop Mode, Next: Background Execution, Prev: All-Stop Mode, Up: Thread Stops
  4535. 5.5.2 Non-Stop Mode
  4536. -------------------
  4537. For some multi-threaded targets, GDB supports an optional mode of
  4538. operation in which you can examine stopped program threads in the
  4539. debugger while other threads continue to execute freely. This minimizes
  4540. intrusion when debugging live systems, such as programs where some
  4541. threads have real-time constraints or must continue to respond to
  4542. external events. This is referred to as "non-stop" mode.
  4543. In non-stop mode, when a thread stops to report a debugging event,
  4544. _only_ that thread is stopped; GDB does not stop other threads as well,
  4545. in contrast to the all-stop mode behavior. Additionally, execution
  4546. commands such as 'continue' and 'step' apply by default only to the
  4547. current thread in non-stop mode, rather than all threads as in all-stop
  4548. mode. This allows you to control threads explicitly in ways that are
  4549. not possible in all-stop mode -- for example, stepping one thread while
  4550. allowing others to run freely, stepping one thread while holding all
  4551. others stopped, or stepping several threads independently and
  4552. simultaneously.
  4553. To enter non-stop mode, use this sequence of commands before you run
  4554. or attach to your program:
  4555. # If using the CLI, pagination breaks non-stop.
  4556. set pagination off
  4557. # Finally, turn it on!
  4558. set non-stop on
  4559. You can use these commands to manipulate the non-stop mode setting:
  4560. 'set non-stop on'
  4561. Enable selection of non-stop mode.
  4562. 'set non-stop off'
  4563. Disable selection of non-stop mode.
  4564. 'show non-stop'
  4565. Show the current non-stop enablement setting.
  4566. Note these commands only reflect whether non-stop mode is enabled,
  4567. not whether the currently-executing program is being run in non-stop
  4568. mode. In particular, the 'set non-stop' preference is only consulted
  4569. when GDB starts or connects to the target program, and it is generally
  4570. not possible to switch modes once debugging has started. Furthermore,
  4571. since not all targets support non-stop mode, even when you have enabled
  4572. non-stop mode, GDB may still fall back to all-stop operation by default.
  4573. In non-stop mode, all execution commands apply only to the current
  4574. thread by default. That is, 'continue' only continues one thread. To
  4575. continue all threads, issue 'continue -a' or 'c -a'.
  4576. You can use GDB's background execution commands (*note Background
  4577. Execution::) to run some threads in the background while you continue to
  4578. examine or step others from GDB. The MI execution commands (*note
  4579. GDB/MI Program Execution::) are always executed asynchronously in
  4580. non-stop mode.
  4581. Suspending execution is done with the 'interrupt' command when
  4582. running in the background, or 'Ctrl-c' during foreground execution. In
  4583. all-stop mode, this stops the whole process; but in non-stop mode the
  4584. interrupt applies only to the current thread. To stop the whole
  4585. program, use 'interrupt -a'.
  4586. Other execution commands do not currently support the '-a' option.
  4587. In non-stop mode, when a thread stops, GDB doesn't automatically make
  4588. that thread current, as it does in all-stop mode. This is because the
  4589. thread stop notifications are asynchronous with respect to GDB's command
  4590. interpreter, and it would be confusing if GDB unexpectedly changed to a
  4591. different thread just as you entered a command to operate on the
  4592. previously current thread.
  4593. 
  4594. File: gdb.info, Node: Background Execution, Next: Thread-Specific Breakpoints, Prev: Non-Stop Mode, Up: Thread Stops
  4595. 5.5.3 Background Execution
  4596. --------------------------
  4597. GDB's execution commands have two variants: the normal foreground
  4598. (synchronous) behavior, and a background (asynchronous) behavior. In
  4599. foreground execution, GDB waits for the program to report that some
  4600. thread has stopped before prompting for another command. In background
  4601. execution, GDB immediately gives a command prompt so that you can issue
  4602. other commands while your program runs.
  4603. If the target doesn't support async mode, GDB issues an error message
  4604. if you attempt to use the background execution commands.
  4605. To specify background execution, add a '&' to the command. For
  4606. example, the background form of the 'continue' command is 'continue&',
  4607. or just 'c&'. The execution commands that accept background execution
  4608. are:
  4609. 'run'
  4610. *Note Starting your Program: Starting.
  4611. 'attach'
  4612. *Note Debugging an Already-running Process: Attach.
  4613. 'step'
  4614. *Note step: Continuing and Stepping.
  4615. 'stepi'
  4616. *Note stepi: Continuing and Stepping.
  4617. 'next'
  4618. *Note next: Continuing and Stepping.
  4619. 'nexti'
  4620. *Note nexti: Continuing and Stepping.
  4621. 'continue'
  4622. *Note continue: Continuing and Stepping.
  4623. 'finish'
  4624. *Note finish: Continuing and Stepping.
  4625. 'until'
  4626. *Note until: Continuing and Stepping.
  4627. Background execution is especially useful in conjunction with
  4628. non-stop mode for debugging programs with multiple threads; see *note
  4629. Non-Stop Mode::. However, you can also use these commands in the normal
  4630. all-stop mode with the restriction that you cannot issue another
  4631. execution command until the previous one finishes. Examples of commands
  4632. that are valid in all-stop mode while the program is running include
  4633. 'help' and 'info break'.
  4634. You can interrupt your program while it is running in the background
  4635. by using the 'interrupt' command.
  4636. 'interrupt'
  4637. 'interrupt -a'
  4638. Suspend execution of the running program. In all-stop mode,
  4639. 'interrupt' stops the whole process, but in non-stop mode, it stops
  4640. only the current thread. To stop the whole program in non-stop
  4641. mode, use 'interrupt -a'.
  4642. 
  4643. File: gdb.info, Node: Thread-Specific Breakpoints, Next: Interrupted System Calls, Prev: Background Execution, Up: Thread Stops
  4644. 5.5.4 Thread-Specific Breakpoints
  4645. ---------------------------------
  4646. When your program has multiple threads (*note Debugging Programs with
  4647. Multiple Threads: Threads.), you can choose whether to set breakpoints
  4648. on all threads, or on a particular thread.
  4649. 'break LOCATION thread THREAD-ID'
  4650. 'break LOCATION thread THREAD-ID if ...'
  4651. LOCATION specifies source lines; there are several ways of writing
  4652. them (*note Specify Location::), but the effect is always to
  4653. specify some source line.
  4654. Use the qualifier 'thread THREAD-ID' with a breakpoint command to
  4655. specify that you only want GDB to stop the program when a
  4656. particular thread reaches this breakpoint. The THREAD-ID specifier
  4657. is one of the thread identifiers assigned by GDB, shown in the
  4658. first column of the 'info threads' display.
  4659. If you do not specify 'thread THREAD-ID' when you set a breakpoint,
  4660. the breakpoint applies to _all_ threads of your program.
  4661. You can use the 'thread' qualifier on conditional breakpoints as
  4662. well; in this case, place 'thread THREAD-ID' before or after the
  4663. breakpoint condition, like this:
  4664. (gdb) break frik.c:13 thread 28 if bartab > lim
  4665. Thread-specific breakpoints are automatically deleted when GDB
  4666. detects the corresponding thread is no longer in the thread list. For
  4667. example:
  4668. (gdb) c
  4669. Thread-specific breakpoint 3 deleted - thread 28 no longer in the thread list.
  4670. There are several ways for a thread to disappear, such as a regular
  4671. thread exit, but also when you detach from the process with the 'detach'
  4672. command (*note Debugging an Already-running Process: Attach.), or if GDB
  4673. loses the remote connection (*note Remote Debugging::), etc. Note that
  4674. with some targets, GDB is only able to detect a thread has exited when
  4675. the user explictly asks for the thread list with the 'info threads'
  4676. command.
  4677. 
  4678. File: gdb.info, Node: Interrupted System Calls, Next: Observer Mode, Prev: Thread-Specific Breakpoints, Up: Thread Stops
  4679. 5.5.5 Interrupted System Calls
  4680. ------------------------------
  4681. There is an unfortunate side effect when using GDB to debug
  4682. multi-threaded programs. If one thread stops for a breakpoint, or for
  4683. some other reason, and another thread is blocked in a system call, then
  4684. the system call may return prematurely. This is a consequence of the
  4685. interaction between multiple threads and the signals that GDB uses to
  4686. implement breakpoints and other events that stop execution.
  4687. To handle this problem, your program should check the return value of
  4688. each system call and react appropriately. This is good programming
  4689. style anyways.
  4690. For example, do not write code like this:
  4691. sleep (10);
  4692. The call to 'sleep' will return early if a different thread stops at
  4693. a breakpoint or for some other reason.
  4694. Instead, write this:
  4695. int unslept = 10;
  4696. while (unslept > 0)
  4697. unslept = sleep (unslept);
  4698. A system call is allowed to return early, so the system is still
  4699. conforming to its specification. But GDB does cause your multi-threaded
  4700. program to behave differently than it would without GDB.
  4701. Also, GDB uses internal breakpoints in the thread library to monitor
  4702. certain events such as thread creation and thread destruction. When
  4703. such an event happens, a system call in another thread may return
  4704. prematurely, even though your program does not appear to stop.
  4705. 
  4706. File: gdb.info, Node: Observer Mode, Prev: Interrupted System Calls, Up: Thread Stops
  4707. 5.5.6 Observer Mode
  4708. -------------------
  4709. If you want to build on non-stop mode and observe program behavior
  4710. without any chance of disruption by GDB, you can set variables to
  4711. disable all of the debugger's attempts to modify state, whether by
  4712. writing memory, inserting breakpoints, etc. These operate at a low
  4713. level, intercepting operations from all commands.
  4714. When all of these are set to 'off', then GDB is said to be "observer
  4715. mode". As a convenience, the variable 'observer' can be set to disable
  4716. these, plus enable non-stop mode.
  4717. Note that GDB will not prevent you from making nonsensical
  4718. combinations of these settings. For instance, if you have enabled
  4719. 'may-insert-breakpoints' but disabled 'may-write-memory', then
  4720. breakpoints that work by writing trap instructions into the code stream
  4721. will still not be able to be placed.
  4722. 'set observer on'
  4723. 'set observer off'
  4724. When set to 'on', this disables all the permission variables below
  4725. (except for 'insert-fast-tracepoints'), plus enables non-stop
  4726. debugging. Setting this to 'off' switches back to normal
  4727. debugging, though remaining in non-stop mode.
  4728. 'show observer'
  4729. Show whether observer mode is on or off.
  4730. 'set may-write-registers on'
  4731. 'set may-write-registers off'
  4732. This controls whether GDB will attempt to alter the values of
  4733. registers, such as with assignment expressions in 'print', or the
  4734. 'jump' command. It defaults to 'on'.
  4735. 'show may-write-registers'
  4736. Show the current permission to write registers.
  4737. 'set may-write-memory on'
  4738. 'set may-write-memory off'
  4739. This controls whether GDB will attempt to alter the contents of
  4740. memory, such as with assignment expressions in 'print'. It
  4741. defaults to 'on'.
  4742. 'show may-write-memory'
  4743. Show the current permission to write memory.
  4744. 'set may-insert-breakpoints on'
  4745. 'set may-insert-breakpoints off'
  4746. This controls whether GDB will attempt to insert breakpoints. This
  4747. affects all breakpoints, including internal breakpoints defined by
  4748. GDB. It defaults to 'on'.
  4749. 'show may-insert-breakpoints'
  4750. Show the current permission to insert breakpoints.
  4751. 'set may-insert-tracepoints on'
  4752. 'set may-insert-tracepoints off'
  4753. This controls whether GDB will attempt to insert (regular)
  4754. tracepoints at the beginning of a tracing experiment. It affects
  4755. only non-fast tracepoints, fast tracepoints being under the control
  4756. of 'may-insert-fast-tracepoints'. It defaults to 'on'.
  4757. 'show may-insert-tracepoints'
  4758. Show the current permission to insert tracepoints.
  4759. 'set may-insert-fast-tracepoints on'
  4760. 'set may-insert-fast-tracepoints off'
  4761. This controls whether GDB will attempt to insert fast tracepoints
  4762. at the beginning of a tracing experiment. It affects only fast
  4763. tracepoints, regular (non-fast) tracepoints being under the control
  4764. of 'may-insert-tracepoints'. It defaults to 'on'.
  4765. 'show may-insert-fast-tracepoints'
  4766. Show the current permission to insert fast tracepoints.
  4767. 'set may-interrupt on'
  4768. 'set may-interrupt off'
  4769. This controls whether GDB will attempt to interrupt or stop program
  4770. execution. When this variable is 'off', the 'interrupt' command
  4771. will have no effect, nor will 'Ctrl-c'. It defaults to 'on'.
  4772. 'show may-interrupt'
  4773. Show the current permission to interrupt or stop the program.
  4774. 
  4775. File: gdb.info, Node: Reverse Execution, Next: Process Record and Replay, Prev: Stopping, Up: Top
  4776. 6 Running programs backward
  4777. ***************************
  4778. When you are debugging a program, it is not unusual to realize that you
  4779. have gone too far, and some event of interest has already happened. If
  4780. the target environment supports it, GDB can allow you to "rewind" the
  4781. program by running it backward.
  4782. A target environment that supports reverse execution should be able
  4783. to "undo" the changes in machine state that have taken place as the
  4784. program was executing normally. Variables, registers etc. should revert
  4785. to their previous values. Obviously this requires a great deal of
  4786. sophistication on the part of the target environment; not all target
  4787. environments can support reverse execution.
  4788. When a program is executed in reverse, the instructions that have
  4789. most recently been executed are "un-executed", in reverse order. The
  4790. program counter runs backward, following the previous thread of
  4791. execution in reverse. As each instruction is "un-executed", the values
  4792. of memory and/or registers that were changed by that instruction are
  4793. reverted to their previous states. After executing a piece of source
  4794. code in reverse, all side effects of that code should be "undone", and
  4795. all variables should be returned to their prior values(1).
  4796. On some platforms, GDB has built-in support for reverse execution,
  4797. activated with the 'record' or 'record btrace' commands. *Note Process
  4798. Record and Replay::. Some remote targets, typically full system
  4799. emulators, support reverse execution directly without requiring any
  4800. special command.
  4801. If you are debugging in a target environment that supports reverse
  4802. execution, GDB provides the following commands.
  4803. 'reverse-continue [IGNORE-COUNT]'
  4804. 'rc [IGNORE-COUNT]'
  4805. Beginning at the point where your program last stopped, start
  4806. executing in reverse. Reverse execution will stop for breakpoints
  4807. and synchronous exceptions (signals), just like normal execution.
  4808. Behavior of asynchronous signals depends on the target environment.
  4809. 'reverse-step [COUNT]'
  4810. Run the program backward until control reaches the start of a
  4811. different source line; then stop it, and return control to GDB.
  4812. Like the 'step' command, 'reverse-step' will only stop at the
  4813. beginning of a source line. It "un-executes" the previously
  4814. executed source line. If the previous source line included calls
  4815. to debuggable functions, 'reverse-step' will step (backward) into
  4816. the called function, stopping at the beginning of the _last_
  4817. statement in the called function (typically a return statement).
  4818. Also, as with the 'step' command, if non-debuggable functions are
  4819. called, 'reverse-step' will run thru them backward without
  4820. stopping.
  4821. 'reverse-stepi [COUNT]'
  4822. Reverse-execute one machine instruction. Note that the instruction
  4823. to be reverse-executed is _not_ the one pointed to by the program
  4824. counter, but the instruction executed prior to that one. For
  4825. instance, if the last instruction was a jump, 'reverse-stepi' will
  4826. take you back from the destination of the jump to the jump
  4827. instruction itself.
  4828. 'reverse-next [COUNT]'
  4829. Run backward to the beginning of the previous line executed in the
  4830. current (innermost) stack frame. If the line contains function
  4831. calls, they will be "un-executed" without stopping. Starting from
  4832. the first line of a function, 'reverse-next' will take you back to
  4833. the caller of that function, _before_ the function was called, just
  4834. as the normal 'next' command would take you from the last line of a
  4835. function back to its return to its caller (2).
  4836. 'reverse-nexti [COUNT]'
  4837. Like 'nexti', 'reverse-nexti' executes a single instruction in
  4838. reverse, except that called functions are "un-executed" atomically.
  4839. That is, if the previously executed instruction was a return from
  4840. another function, 'reverse-nexti' will continue to execute in
  4841. reverse until the call to that function (from the current stack
  4842. frame) is reached.
  4843. 'reverse-finish'
  4844. Just as the 'finish' command takes you to the point where the
  4845. current function returns, 'reverse-finish' takes you to the point
  4846. where it was called. Instead of ending up at the end of the
  4847. current function invocation, you end up at the beginning.
  4848. 'set exec-direction'
  4849. Set the direction of target execution.
  4850. 'set exec-direction reverse'
  4851. GDB will perform all execution commands in reverse, until the
  4852. exec-direction mode is changed to "forward". Affected commands
  4853. include 'step, stepi, next, nexti, continue, and finish'. The
  4854. 'return' command cannot be used in reverse mode.
  4855. 'set exec-direction forward'
  4856. GDB will perform all execution commands in the normal fashion.
  4857. This is the default.
  4858. ---------- Footnotes ----------
  4859. (1) Note that some side effects are easier to undo than others. For
  4860. instance, memory and registers are relatively easy, but device I/O is
  4861. hard. Some targets may be able undo things like device I/O, and some
  4862. may not.
  4863. The contract between GDB and the reverse executing target requires
  4864. only that the target do something reasonable when GDB tells it to
  4865. execute backwards, and then report the results back to GDB. Whatever
  4866. the target reports back to GDB, GDB will report back to the user. GDB
  4867. assumes that the memory and registers that the target reports are in a
  4868. consistent state, but GDB accepts whatever it is given.
  4869. (2) Unless the code is too heavily optimized.
  4870. 
  4871. File: gdb.info, Node: Process Record and Replay, Next: Stack, Prev: Reverse Execution, Up: Top
  4872. 7 Recording Inferior's Execution and Replaying It
  4873. *************************************************
  4874. On some platforms, GDB provides a special "process record and replay"
  4875. target that can record a log of the process execution, and replay it
  4876. later with both forward and reverse execution commands.
  4877. When this target is in use, if the execution log includes the record
  4878. for the next instruction, GDB will debug in "replay mode". In the
  4879. replay mode, the inferior does not really execute code instructions.
  4880. Instead, all the events that normally happen during code execution are
  4881. taken from the execution log. While code is not really executed in
  4882. replay mode, the values of registers (including the program counter
  4883. register) and the memory of the inferior are still changed as they
  4884. normally would. Their contents are taken from the execution log.
  4885. If the record for the next instruction is not in the execution log,
  4886. GDB will debug in "record mode". In this mode, the inferior executes
  4887. normally, and GDB records the execution log for future replay.
  4888. The process record and replay target supports reverse execution
  4889. (*note Reverse Execution::), even if the platform on which the inferior
  4890. runs does not. However, the reverse execution is limited in this case
  4891. by the range of the instructions recorded in the execution log. In
  4892. other words, reverse execution on platforms that don't support it
  4893. directly can only be done in the replay mode.
  4894. When debugging in the reverse direction, GDB will work in replay mode
  4895. as long as the execution log includes the record for the previous
  4896. instruction; otherwise, it will work in record mode, if the platform
  4897. supports reverse execution, or stop if not.
  4898. Currently, process record and replay is supported on ARM, Aarch64,
  4899. Moxie, PowerPC, PowerPC64, S/390, and x86 (i386/amd64) running
  4900. GNU/Linux. Process record and replay can be used both when native
  4901. debugging, and when remote debugging via 'gdbserver'.
  4902. For architecture environments that support process record and replay,
  4903. GDB provides the following commands:
  4904. 'record METHOD'
  4905. This command starts the process record and replay target. The
  4906. recording method can be specified as parameter. Without a
  4907. parameter the command uses the 'full' recording method. The
  4908. following recording methods are available:
  4909. 'full'
  4910. Full record/replay recording using GDB's software record and
  4911. replay implementation. This method allows replaying and
  4912. reverse execution.
  4913. 'btrace FORMAT'
  4914. Hardware-supported instruction recording, supported on Intel
  4915. processors. This method does not record data. Further, the
  4916. data is collected in a ring buffer so old data will be
  4917. overwritten when the buffer is full. It allows limited
  4918. reverse execution. Variables and registers are not available
  4919. during reverse execution. In remote debugging, recording
  4920. continues on disconnect. Recorded data can be inspected after
  4921. reconnecting. The recording may be stopped using 'record
  4922. stop'.
  4923. The recording format can be specified as parameter. Without a
  4924. parameter the command chooses the recording format. The
  4925. following recording formats are available:
  4926. 'bts'
  4927. Use the "Branch Trace Store" (BTS) recording format. In
  4928. this format, the processor stores a from/to record for
  4929. each executed branch in the btrace ring buffer.
  4930. 'pt'
  4931. Use the "Intel Processor Trace" recording format. In
  4932. this format, the processor stores the execution trace in
  4933. a compressed form that is afterwards decoded by GDB.
  4934. The trace can be recorded with very low overhead. The
  4935. compressed trace format also allows small trace buffers
  4936. to already contain a big number of instructions compared
  4937. to BTS.
  4938. Decoding the recorded execution trace, on the other hand,
  4939. is more expensive than decoding BTS trace. This is
  4940. mostly due to the increased number of instructions to
  4941. process. You should increase the buffer-size with care.
  4942. Not all recording formats may be available on all processors.
  4943. The process record and replay target can only debug a process that
  4944. is already running. Therefore, you need first to start the process
  4945. with the 'run' or 'start' commands, and then start the recording
  4946. with the 'record METHOD' command.
  4947. Displaced stepping (*note displaced stepping: Maintenance
  4948. Commands.) will be automatically disabled when process record and
  4949. replay target is started. That's because the process record and
  4950. replay target doesn't support displaced stepping.
  4951. If the inferior is in the non-stop mode (*note Non-Stop Mode::) or
  4952. in the asynchronous execution mode (*note Background Execution::),
  4953. not all recording methods are available. The 'full' recording
  4954. method does not support these two modes.
  4955. 'record stop'
  4956. Stop the process record and replay target. When process record and
  4957. replay target stops, the entire execution log will be deleted and
  4958. the inferior will either be terminated, or will remain in its final
  4959. state.
  4960. When you stop the process record and replay target in record mode
  4961. (at the end of the execution log), the inferior will be stopped at
  4962. the next instruction that would have been recorded. In other
  4963. words, if you record for a while and then stop recording, the
  4964. inferior process will be left in the same state as if the recording
  4965. never happened.
  4966. On the other hand, if the process record and replay target is
  4967. stopped while in replay mode (that is, not at the end of the
  4968. execution log, but at some earlier point), the inferior process
  4969. will become "live" at that earlier state, and it will then be
  4970. possible to continue the usual "live" debugging of the process from
  4971. that state.
  4972. When the inferior process exits, or GDB detaches from it, process
  4973. record and replay target will automatically stop itself.
  4974. 'record goto'
  4975. Go to a specific location in the execution log. There are several
  4976. ways to specify the location to go to:
  4977. 'record goto begin'
  4978. 'record goto start'
  4979. Go to the beginning of the execution log.
  4980. 'record goto end'
  4981. Go to the end of the execution log.
  4982. 'record goto N'
  4983. Go to instruction number N in the execution log.
  4984. 'record save FILENAME'
  4985. Save the execution log to a file 'FILENAME'. Default filename is
  4986. 'gdb_record.PROCESS_ID', where PROCESS_ID is the process ID of the
  4987. inferior.
  4988. This command may not be available for all recording methods.
  4989. 'record restore FILENAME'
  4990. Restore the execution log from a file 'FILENAME'. File must have
  4991. been created with 'record save'.
  4992. 'set record full insn-number-max LIMIT'
  4993. 'set record full insn-number-max unlimited'
  4994. Set the limit of instructions to be recorded for the 'full'
  4995. recording method. Default value is 200000.
  4996. If LIMIT is a positive number, then GDB will start deleting
  4997. instructions from the log once the number of the record
  4998. instructions becomes greater than LIMIT. For every new recorded
  4999. instruction, GDB will delete the earliest recorded instruction to
  5000. keep the number of recorded instructions at the limit. (Since
  5001. deleting recorded instructions loses information, GDB lets you
  5002. control what happens when the limit is reached, by means of the
  5003. 'stop-at-limit' option, described below.)
  5004. If LIMIT is 'unlimited' or zero, GDB will never delete recorded
  5005. instructions from the execution log. The number of recorded
  5006. instructions is limited only by the available memory.
  5007. 'show record full insn-number-max'
  5008. Show the limit of instructions to be recorded with the 'full'
  5009. recording method.
  5010. 'set record full stop-at-limit'
  5011. Control the behavior of the 'full' recording method when the number
  5012. of recorded instructions reaches the limit. If ON (the default),
  5013. GDB will stop when the limit is reached for the first time and ask
  5014. you whether you want to stop the inferior or continue running it
  5015. and recording the execution log. If you decide to continue
  5016. recording, each new recorded instruction will cause the oldest one
  5017. to be deleted.
  5018. If this option is OFF, GDB will automatically delete the oldest
  5019. record to make room for each new one, without asking.
  5020. 'show record full stop-at-limit'
  5021. Show the current setting of 'stop-at-limit'.
  5022. 'set record full memory-query'
  5023. Control the behavior when GDB is unable to record memory changes
  5024. caused by an instruction for the 'full' recording method. If ON,
  5025. GDB will query whether to stop the inferior in that case.
  5026. If this option is OFF (the default), GDB will automatically ignore
  5027. the effect of such instructions on memory. Later, when GDB replays
  5028. this execution log, it will mark the log of this instruction as not
  5029. accessible, and it will not affect the replay results.
  5030. 'show record full memory-query'
  5031. Show the current setting of 'memory-query'.
  5032. The 'btrace' record target does not trace data. As a convenience,
  5033. when replaying, GDB reads read-only memory off the live program
  5034. directly, assuming that the addresses of the read-only areas don't
  5035. change. This for example makes it possible to disassemble code
  5036. while replaying, but not to print variables. In some cases, being
  5037. able to inspect variables might be useful. You can use the
  5038. following command for that:
  5039. 'set record btrace replay-memory-access'
  5040. Control the behavior of the 'btrace' recording method when
  5041. accessing memory during replay. If 'read-only' (the default), GDB
  5042. will only allow accesses to read-only memory. If 'read-write', GDB
  5043. will allow accesses to read-only and to read-write memory. Beware
  5044. that the accessed memory corresponds to the live target and not
  5045. necessarily to the current replay position.
  5046. 'set record btrace cpu IDENTIFIER'
  5047. Set the processor to be used for enabling workarounds for processor
  5048. errata when decoding the trace.
  5049. Processor errata are defects in processor operation, caused by its
  5050. design or manufacture. They can cause a trace not to match the
  5051. specification. This, in turn, may cause trace decode to fail. GDB
  5052. can detect erroneous trace packets and correct them, thus avoiding
  5053. the decoding failures. These corrections are known as "errata
  5054. workarounds", and are enabled based on the processor on which the
  5055. trace was recorded.
  5056. By default, GDB attempts to detect the processor automatically, and
  5057. apply the necessary workarounds for it. However, you may need to
  5058. specify the processor if GDB does not yet support it. This command
  5059. allows you to do that, and also allows to disable the workarounds.
  5060. The argument IDENTIFIER identifies the CPU and is of the form:
  5061. 'VENDOR:PROCESSOR IDENTIFIER'. In addition, there are two special
  5062. identifiers, 'none' and 'auto' (default).
  5063. The following vendor identifiers and corresponding processor
  5064. identifiers are currently supported:
  5065. 'intel' FAMILY/MODEL[/STEPPING]
  5066. On GNU/Linux systems, the processor FAMILY, MODEL, and STEPPING can
  5067. be obtained from '/proc/cpuinfo'.
  5068. If IDENTIFIER is 'auto', enable errata workarounds for the
  5069. processor on which the trace was recorded. If IDENTIFIER is
  5070. 'none', errata workarounds are disabled.
  5071. For example, when using an old GDB on a new system, decode may fail
  5072. because GDB does not support the new processor. It often suffices
  5073. to specify an older processor that GDB supports.
  5074. (gdb) info record
  5075. Active record target: record-btrace
  5076. Recording format: Intel Processor Trace.
  5077. Buffer size: 16kB.
  5078. Failed to configure the Intel Processor Trace decoder: unknown cpu.
  5079. (gdb) set record btrace cpu intel:6/158
  5080. (gdb) info record
  5081. Active record target: record-btrace
  5082. Recording format: Intel Processor Trace.
  5083. Buffer size: 16kB.
  5084. Recorded 84872 instructions in 3189 functions (0 gaps) for thread 1 (...).
  5085. 'show record btrace replay-memory-access'
  5086. Show the current setting of 'replay-memory-access'.
  5087. 'show record btrace cpu'
  5088. Show the processor to be used for enabling trace decode errata
  5089. workarounds.
  5090. 'set record btrace bts buffer-size SIZE'
  5091. 'set record btrace bts buffer-size unlimited'
  5092. Set the requested ring buffer size for branch tracing in BTS
  5093. format. Default is 64KB.
  5094. If SIZE is a positive number, then GDB will try to allocate a
  5095. buffer of at least SIZE bytes for each new thread that uses the
  5096. btrace recording method and the BTS format. The actually obtained
  5097. buffer size may differ from the requested SIZE. Use the 'info
  5098. record' command to see the actual buffer size for each thread that
  5099. uses the btrace recording method and the BTS format.
  5100. If LIMIT is 'unlimited' or zero, GDB will try to allocate a buffer
  5101. of 4MB.
  5102. Bigger buffers mean longer traces. On the other hand, GDB will
  5103. also need longer to process the branch trace data before it can be
  5104. used.
  5105. 'show record btrace bts buffer-size SIZE'
  5106. Show the current setting of the requested ring buffer size for
  5107. branch tracing in BTS format.
  5108. 'set record btrace pt buffer-size SIZE'
  5109. 'set record btrace pt buffer-size unlimited'
  5110. Set the requested ring buffer size for branch tracing in Intel
  5111. Processor Trace format. Default is 16KB.
  5112. If SIZE is a positive number, then GDB will try to allocate a
  5113. buffer of at least SIZE bytes for each new thread that uses the
  5114. btrace recording method and the Intel Processor Trace format. The
  5115. actually obtained buffer size may differ from the requested SIZE.
  5116. Use the 'info record' command to see the actual buffer size for
  5117. each thread.
  5118. If LIMIT is 'unlimited' or zero, GDB will try to allocate a buffer
  5119. of 4MB.
  5120. Bigger buffers mean longer traces. On the other hand, GDB will
  5121. also need longer to process the branch trace data before it can be
  5122. used.
  5123. 'show record btrace pt buffer-size SIZE'
  5124. Show the current setting of the requested ring buffer size for
  5125. branch tracing in Intel Processor Trace format.
  5126. 'info record'
  5127. Show various statistics about the recording depending on the
  5128. recording method:
  5129. 'full'
  5130. For the 'full' recording method, it shows the state of process
  5131. record and its in-memory execution log buffer, including:
  5132. * Whether in record mode or replay mode.
  5133. * Lowest recorded instruction number (counting from when
  5134. the current execution log started recording
  5135. instructions).
  5136. * Highest recorded instruction number.
  5137. * Current instruction about to be replayed (if in replay
  5138. mode).
  5139. * Number of instructions contained in the execution log.
  5140. * Maximum number of instructions that may be contained in
  5141. the execution log.
  5142. 'btrace'
  5143. For the 'btrace' recording method, it shows:
  5144. * Recording format.
  5145. * Number of instructions that have been recorded.
  5146. * Number of blocks of sequential control-flow formed by the
  5147. recorded instructions.
  5148. * Whether in record mode or replay mode.
  5149. For the 'bts' recording format, it also shows:
  5150. * Size of the perf ring buffer.
  5151. For the 'pt' recording format, it also shows:
  5152. * Size of the perf ring buffer.
  5153. 'record delete'
  5154. When record target runs in replay mode ("in the past"), delete the
  5155. subsequent execution log and begin to record a new execution log
  5156. starting from the current address. This means you will abandon the
  5157. previously recorded "future" and begin recording a new "future".
  5158. 'record instruction-history'
  5159. Disassembles instructions from the recorded execution log. By
  5160. default, ten instructions are disassembled. This can be changed
  5161. using the 'set record instruction-history-size' command.
  5162. Instructions are printed in execution order.
  5163. It can also print mixed source+disassembly if you specify the the
  5164. '/m' or '/s' modifier, and print the raw instructions in hex as
  5165. well as in symbolic form by specifying the '/r' modifier.
  5166. The current position marker is printed for the instruction at the
  5167. current program counter value. This instruction can appear
  5168. multiple times in the trace and the current position marker will be
  5169. printed every time. To omit the current position marker, specify
  5170. the '/p' modifier.
  5171. To better align the printed instructions when the trace contains
  5172. instructions from more than one function, the function name may be
  5173. omitted by specifying the '/f' modifier.
  5174. Speculatively executed instructions are prefixed with '?'. This
  5175. feature is not available for all recording formats.
  5176. There are several ways to specify what part of the execution log to
  5177. disassemble:
  5178. 'record instruction-history INSN'
  5179. Disassembles ten instructions starting from instruction number
  5180. INSN.
  5181. 'record instruction-history INSN, +/-N'
  5182. Disassembles N instructions around instruction number INSN.
  5183. If N is preceded with '+', disassembles N instructions after
  5184. instruction number INSN. If N is preceded with '-',
  5185. disassembles N instructions before instruction number INSN.
  5186. 'record instruction-history'
  5187. Disassembles ten more instructions after the last disassembly.
  5188. 'record instruction-history -'
  5189. Disassembles ten more instructions before the last
  5190. disassembly.
  5191. 'record instruction-history BEGIN, END'
  5192. Disassembles instructions beginning with instruction number
  5193. BEGIN until instruction number END. The instruction number
  5194. END is included.
  5195. This command may not be available for all recording methods.
  5196. 'set record instruction-history-size SIZE'
  5197. 'set record instruction-history-size unlimited'
  5198. Define how many instructions to disassemble in the 'record
  5199. instruction-history' command. The default value is 10. A SIZE of
  5200. 'unlimited' means unlimited instructions.
  5201. 'show record instruction-history-size'
  5202. Show how many instructions to disassemble in the 'record
  5203. instruction-history' command.
  5204. 'record function-call-history'
  5205. Prints the execution history at function granularity. It prints
  5206. one line for each sequence of instructions that belong to the same
  5207. function giving the name of that function, the source lines for
  5208. this instruction sequence (if the '/l' modifier is specified), and
  5209. the instructions numbers that form the sequence (if the '/i'
  5210. modifier is specified). The function names are indented to reflect
  5211. the call stack depth if the '/c' modifier is specified. The '/l',
  5212. '/i', and '/c' modifiers can be given together.
  5213. (gdb) list 1, 10
  5214. 1 void foo (void)
  5215. 2 {
  5216. 3 }
  5217. 4
  5218. 5 void bar (void)
  5219. 6 {
  5220. 7 ...
  5221. 8 foo ();
  5222. 9 ...
  5223. 10 }
  5224. (gdb) record function-call-history /ilc
  5225. 1 bar inst 1,4 at foo.c:6,8
  5226. 2 foo inst 5,10 at foo.c:2,3
  5227. 3 bar inst 11,13 at foo.c:9,10
  5228. By default, ten lines are printed. This can be changed using the
  5229. 'set record function-call-history-size' command. Functions are
  5230. printed in execution order. There are several ways to specify what
  5231. to print:
  5232. 'record function-call-history FUNC'
  5233. Prints ten functions starting from function number FUNC.
  5234. 'record function-call-history FUNC, +/-N'
  5235. Prints N functions around function number FUNC. If N is
  5236. preceded with '+', prints N functions after function number
  5237. FUNC. If N is preceded with '-', prints N functions before
  5238. function number FUNC.
  5239. 'record function-call-history'
  5240. Prints ten more functions after the last ten-line print.
  5241. 'record function-call-history -'
  5242. Prints ten more functions before the last ten-line print.
  5243. 'record function-call-history BEGIN, END'
  5244. Prints functions beginning with function number BEGIN until
  5245. function number END. The function number END is included.
  5246. This command may not be available for all recording methods.
  5247. 'set record function-call-history-size SIZE'
  5248. 'set record function-call-history-size unlimited'
  5249. Define how many lines to print in the 'record
  5250. function-call-history' command. The default value is 10. A size
  5251. of 'unlimited' means unlimited lines.
  5252. 'show record function-call-history-size'
  5253. Show how many lines to print in the 'record function-call-history'
  5254. command.
  5255. 
  5256. File: gdb.info, Node: Stack, Next: Source, Prev: Process Record and Replay, Up: Top
  5257. 8 Examining the Stack
  5258. *********************
  5259. When your program has stopped, the first thing you need to know is where
  5260. it stopped and how it got there.
  5261. Each time your program performs a function call, information about
  5262. the call is generated. That information includes the location of the
  5263. call in your program, the arguments of the call, and the local variables
  5264. of the function being called. The information is saved in a block of
  5265. data called a "stack frame". The stack frames are allocated in a region
  5266. of memory called the "call stack".
  5267. When your program stops, the GDB commands for examining the stack
  5268. allow you to see all of this information.
  5269. One of the stack frames is "selected" by GDB and many GDB commands
  5270. refer implicitly to the selected frame. In particular, whenever you ask
  5271. GDB for the value of a variable in your program, the value is found in
  5272. the selected frame. There are special GDB commands to select whichever
  5273. frame you are interested in. *Note Selecting a Frame: Selection.
  5274. When your program stops, GDB automatically selects the currently
  5275. executing frame and describes it briefly, similar to the 'frame' command
  5276. (*note Information about a Frame: Frame Info.).
  5277. * Menu:
  5278. * Frames:: Stack frames
  5279. * Backtrace:: Backtraces
  5280. * Selection:: Selecting a frame
  5281. * Frame Info:: Information on a frame
  5282. * Frame Apply:: Applying a command to several frames
  5283. * Frame Filter Management:: Managing frame filters
  5284. 
  5285. File: gdb.info, Node: Frames, Next: Backtrace, Up: Stack
  5286. 8.1 Stack Frames
  5287. ================
  5288. The call stack is divided up into contiguous pieces called "stack
  5289. frames", or "frames" for short; each frame is the data associated with
  5290. one call to one function. The frame contains the arguments given to the
  5291. function, the function's local variables, and the address at which the
  5292. function is executing.
  5293. When your program is started, the stack has only one frame, that of
  5294. the function 'main'. This is called the "initial" frame or the
  5295. "outermost" frame. Each time a function is called, a new frame is made.
  5296. Each time a function returns, the frame for that function invocation is
  5297. eliminated. If a function is recursive, there can be many frames for
  5298. the same function. The frame for the function in which execution is
  5299. actually occurring is called the "innermost" frame. This is the most
  5300. recently created of all the stack frames that still exist.
  5301. Inside your program, stack frames are identified by their addresses.
  5302. A stack frame consists of many bytes, each of which has its own address;
  5303. each kind of computer has a convention for choosing one byte whose
  5304. address serves as the address of the frame. Usually this address is
  5305. kept in a register called the "frame pointer register" (*note $fp:
  5306. Registers.) while execution is going on in that frame.
  5307. GDB labels each existing stack frame with a "level", a number that is
  5308. zero for the innermost frame, one for the frame that called it, and so
  5309. on upward. These level numbers give you a way of designating stack
  5310. frames in GDB commands. The terms "frame number" and "frame level" can
  5311. be used interchangeably to describe this number.
  5312. Some compilers provide a way to compile functions so that they
  5313. operate without stack frames. (For example, the GCC option
  5314. '-fomit-frame-pointer'
  5315. generates functions without a frame.) This is occasionally done with
  5316. heavily used library functions to save the frame setup time. GDB has
  5317. limited facilities for dealing with these function invocations. If the
  5318. innermost function invocation has no stack frame, GDB nevertheless
  5319. regards it as though it had a separate frame, which is numbered zero as
  5320. usual, allowing correct tracing of the function call chain. However,
  5321. GDB has no provision for frameless functions elsewhere in the stack.
  5322. 
  5323. File: gdb.info, Node: Backtrace, Next: Selection, Prev: Frames, Up: Stack
  5324. 8.2 Backtraces
  5325. ==============
  5326. A backtrace is a summary of how your program got where it is. It shows
  5327. one line per frame, for many frames, starting with the currently
  5328. executing frame (frame zero), followed by its caller (frame one), and on
  5329. up the stack.
  5330. To print a backtrace of the entire stack, use the 'backtrace'
  5331. command, or its alias 'bt'. This command will print one line per frame
  5332. for frames in the stack. By default, all stack frames are printed. You
  5333. can stop the backtrace at any time by typing the system interrupt
  5334. character, normally 'Ctrl-c'.
  5335. 'backtrace [OPTION]... [QUALIFIER]... [COUNT]'
  5336. 'bt [OPTION]... [QUALIFIER]... [COUNT]'
  5337. Print the backtrace of the entire stack.
  5338. The optional COUNT can be one of the following:
  5339. 'N'
  5340. 'N'
  5341. Print only the innermost N frames, where N is a positive
  5342. number.
  5343. '-N'
  5344. '-N'
  5345. Print only the outermost N frames, where N is a positive
  5346. number.
  5347. Options:
  5348. '-full'
  5349. Print the values of the local variables also. This can be
  5350. combined with the optional COUNT to limit the number of frames
  5351. shown.
  5352. '-no-filters'
  5353. Do not run Python frame filters on this backtrace. *Note
  5354. Frame Filter API::, for more information. Additionally use
  5355. *note disable frame-filter all:: to turn off all frame
  5356. filters. This is only relevant when GDB has been configured
  5357. with 'Python' support.
  5358. '-hide'
  5359. A Python frame filter might decide to "elide" some frames.
  5360. Normally such elided frames are still printed, but they are
  5361. indented relative to the filtered frames that cause them to be
  5362. elided. The '-hide' option causes elided frames to not be
  5363. printed at all.
  5364. The 'backtrace' command also supports a number of options that
  5365. allow overriding relevant global print settings as set by 'set
  5366. backtrace' and 'set print' subcommands:
  5367. '-past-main [on|off]'
  5368. Set whether backtraces should continue past 'main'. Related
  5369. setting: *note set backtrace past-main::.
  5370. '-past-entry [on|off]'
  5371. Set whether backtraces should continue past the entry point of
  5372. a program. Related setting: *note set backtrace past-entry::.
  5373. '-entry-values no|only|preferred|if-needed|both|compact|default'
  5374. Set printing of function arguments at function entry. Related
  5375. setting: *note set print entry-values::.
  5376. '-frame-arguments all|scalars|none'
  5377. Set printing of non-scalar frame arguments. Related setting:
  5378. *note set print frame-arguments::.
  5379. '-raw-frame-arguments [on|off]'
  5380. Set whether to print frame arguments in raw form. Related
  5381. setting: *note set print raw-frame-arguments::.
  5382. '-frame-info auto|source-line|location|source-and-location|location-and-address|short-location'
  5383. Set printing of frame information. Related setting: *note set
  5384. print frame-info::.
  5385. The optional QUALIFIER is maintained for backward compatibility.
  5386. It can be one of the following:
  5387. 'full'
  5388. Equivalent to the '-full' option.
  5389. 'no-filters'
  5390. Equivalent to the '-no-filters' option.
  5391. 'hide'
  5392. Equivalent to the '-hide' option.
  5393. The names 'where' and 'info stack' (abbreviated 'info s') are
  5394. additional aliases for 'backtrace'.
  5395. In a multi-threaded program, GDB by default shows the backtrace only
  5396. for the current thread. To display the backtrace for several or all of
  5397. the threads, use the command 'thread apply' (*note thread apply:
  5398. Threads.). For example, if you type 'thread apply all backtrace', GDB
  5399. will display the backtrace for all the threads; this is handy when you
  5400. debug a core dump of a multi-threaded program.
  5401. Each line in the backtrace shows the frame number and the function
  5402. name. The program counter value is also shown--unless you use 'set
  5403. print address off'. The backtrace also shows the source file name and
  5404. line number, as well as the arguments to the function. The program
  5405. counter value is omitted if it is at the beginning of the code for that
  5406. line number.
  5407. Here is an example of a backtrace. It was made with the command 'bt
  5408. 3', so it shows the innermost three frames.
  5409. #0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8)
  5410. at builtin.c:993
  5411. #1 0x6e38 in expand_macro (sym=0x2b600, data=...) at macro.c:242
  5412. #2 0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08)
  5413. at macro.c:71
  5414. (More stack frames follow...)
  5415. The display for frame zero does not begin with a program counter value,
  5416. indicating that your program has stopped at the beginning of the code
  5417. for line '993' of 'builtin.c'.
  5418. The value of parameter 'data' in frame 1 has been replaced by '...'. By
  5419. default, GDB prints the value of a parameter only if it is a scalar
  5420. (integer, pointer, enumeration, etc). See command 'set print
  5421. frame-arguments' in *note Print Settings:: for more details on how to
  5422. configure the way function parameter values are printed. The command
  5423. 'set print frame-info' (*note Print Settings::) controls what frame
  5424. information is printed.
  5425. If your program was compiled with optimizations, some compilers will
  5426. optimize away arguments passed to functions if those arguments are never
  5427. used after the call. Such optimizations generate code that passes
  5428. arguments through registers, but doesn't store those arguments in the
  5429. stack frame. GDB has no way of displaying such arguments in stack
  5430. frames other than the innermost one. Here's what such a backtrace might
  5431. look like:
  5432. #0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8)
  5433. at builtin.c:993
  5434. #1 0x6e38 in expand_macro (sym=<optimized out>) at macro.c:242
  5435. #2 0x6840 in expand_token (obs=0x0, t=<optimized out>, td=0xf7fffb08)
  5436. at macro.c:71
  5437. (More stack frames follow...)
  5438. The values of arguments that were not saved in their stack frames are
  5439. shown as '<optimized out>'.
  5440. If you need to display the values of such optimized-out arguments,
  5441. either deduce that from other variables whose values depend on the one
  5442. you are interested in, or recompile without optimizations.
  5443. Most programs have a standard user entry point--a place where system
  5444. libraries and startup code transition into user code. For C this is
  5445. 'main'(1). When GDB finds the entry function in a backtrace it will
  5446. terminate the backtrace, to avoid tracing into highly system-specific
  5447. (and generally uninteresting) code.
  5448. If you need to examine the startup code, or limit the number of
  5449. levels in a backtrace, you can change this behavior:
  5450. 'set backtrace past-main'
  5451. 'set backtrace past-main on'
  5452. Backtraces will continue past the user entry point.
  5453. 'set backtrace past-main off'
  5454. Backtraces will stop when they encounter the user entry point.
  5455. This is the default.
  5456. 'show backtrace past-main'
  5457. Display the current user entry point backtrace policy.
  5458. 'set backtrace past-entry'
  5459. 'set backtrace past-entry on'
  5460. Backtraces will continue past the internal entry point of an
  5461. application. This entry point is encoded by the linker when the
  5462. application is built, and is likely before the user entry point
  5463. 'main' (or equivalent) is called.
  5464. 'set backtrace past-entry off'
  5465. Backtraces will stop when they encounter the internal entry point
  5466. of an application. This is the default.
  5467. 'show backtrace past-entry'
  5468. Display the current internal entry point backtrace policy.
  5469. 'set backtrace limit N'
  5470. 'set backtrace limit 0'
  5471. 'set backtrace limit unlimited'
  5472. Limit the backtrace to N levels. A value of 'unlimited' or zero
  5473. means unlimited levels.
  5474. 'show backtrace limit'
  5475. Display the current limit on backtrace levels.
  5476. You can control how file names are displayed.
  5477. 'set filename-display'
  5478. 'set filename-display relative'
  5479. Display file names relative to the compilation directory. This is
  5480. the default.
  5481. 'set filename-display basename'
  5482. Display only basename of a filename.
  5483. 'set filename-display absolute'
  5484. Display an absolute filename.
  5485. 'show filename-display'
  5486. Show the current way to display filenames.
  5487. ---------- Footnotes ----------
  5488. (1) Note that embedded programs (the so-called "free-standing"
  5489. environment) are not required to have a 'main' function as the entry
  5490. point. They could even have multiple entry points.
  5491. 
  5492. File: gdb.info, Node: Selection, Next: Frame Info, Prev: Backtrace, Up: Stack
  5493. 8.3 Selecting a Frame
  5494. =====================
  5495. Most commands for examining the stack and other data in your program
  5496. work on whichever stack frame is selected at the moment. Here are the
  5497. commands for selecting a stack frame; all of them finish by printing a
  5498. brief description of the stack frame just selected.
  5499. 'frame [ FRAME-SELECTION-SPEC ]'
  5500. 'f [ FRAME-SELECTION-SPEC ]'
  5501. The 'frame' command allows different stack frames to be selected.
  5502. The FRAME-SELECTION-SPEC can be any of the following:
  5503. 'NUM'
  5504. 'level NUM'
  5505. Select frame level NUM. Recall that frame zero is the
  5506. innermost (currently executing) frame, frame one is the frame
  5507. that called the innermost one, and so on. The highest level
  5508. frame is usually the one for 'main'.
  5509. As this is the most common method of navigating the frame
  5510. stack, the string 'level' can be omitted. For example, the
  5511. following two commands are equivalent:
  5512. (gdb) frame 3
  5513. (gdb) frame level 3
  5514. 'address STACK-ADDRESS'
  5515. Select the frame with stack address STACK-ADDRESS. The
  5516. STACK-ADDRESS for a frame can be seen in the output of 'info
  5517. frame', for example:
  5518. (gdb) info frame
  5519. Stack level 1, frame at 0x7fffffffda30:
  5520. rip = 0x40066d in b (amd64-entry-value.cc:59); saved rip 0x4004c5
  5521. tail call frame, caller of frame at 0x7fffffffda30
  5522. source language c++.
  5523. Arglist at unknown address.
  5524. Locals at unknown address, Previous frame's sp is 0x7fffffffda30
  5525. The STACK-ADDRESS for this frame is '0x7fffffffda30' as
  5526. indicated by the line:
  5527. Stack level 1, frame at 0x7fffffffda30:
  5528. 'function FUNCTION-NAME'
  5529. Select the stack frame for function FUNCTION-NAME. If there
  5530. are multiple stack frames for function FUNCTION-NAME then the
  5531. inner most stack frame is selected.
  5532. 'view STACK-ADDRESS [ PC-ADDR ]'
  5533. View a frame that is not part of GDB's backtrace. The frame
  5534. viewed has stack address STACK-ADDR, and optionally, a program
  5535. counter address of PC-ADDR.
  5536. This is useful mainly if the chaining of stack frames has been
  5537. damaged by a bug, making it impossible for GDB to assign
  5538. numbers properly to all frames. In addition, this can be
  5539. useful when your program has multiple stacks and switches
  5540. between them.
  5541. When viewing a frame outside the current backtrace using
  5542. 'frame view' then you can always return to the original stack
  5543. using one of the previous stack frame selection instructions,
  5544. for example 'frame level 0'.
  5545. 'up N'
  5546. Move N frames up the stack; N defaults to 1. For positive numbers
  5547. N, this advances toward the outermost frame, to higher frame
  5548. numbers, to frames that have existed longer.
  5549. 'down N'
  5550. Move N frames down the stack; N defaults to 1. For positive
  5551. numbers N, this advances toward the innermost frame, to lower frame
  5552. numbers, to frames that were created more recently. You may
  5553. abbreviate 'down' as 'do'.
  5554. All of these commands end by printing two lines of output describing
  5555. the frame. The first line shows the frame number, the function name,
  5556. the arguments, and the source file and line number of execution in that
  5557. frame. The second line shows the text of that source line.
  5558. For example:
  5559. (gdb) up
  5560. #1 0x22f0 in main (argc=1, argv=0xf7fffbf4, env=0xf7fffbfc)
  5561. at env.c:10
  5562. 10 read_input_file (argv[i]);
  5563. After such a printout, the 'list' command with no arguments prints
  5564. ten lines centered on the point of execution in the frame. You can also
  5565. edit the program at the point of execution with your favorite editing
  5566. program by typing 'edit'. *Note Printing Source Lines: List, for
  5567. details.
  5568. 'select-frame [ FRAME-SELECTION-SPEC ]'
  5569. The 'select-frame' command is a variant of 'frame' that does not
  5570. display the new frame after selecting it. This command is intended
  5571. primarily for use in GDB command scripts, where the output might be
  5572. unnecessary and distracting. The FRAME-SELECTION-SPEC is as for
  5573. the 'frame' command described in *note Selecting a Frame:
  5574. Selection.
  5575. 'up-silently N'
  5576. 'down-silently N'
  5577. These two commands are variants of 'up' and 'down', respectively;
  5578. they differ in that they do their work silently, without causing
  5579. display of the new frame. They are intended primarily for use in
  5580. GDB command scripts, where the output might be unnecessary and
  5581. distracting.
  5582. 
  5583. File: gdb.info, Node: Frame Info, Next: Frame Apply, Prev: Selection, Up: Stack
  5584. 8.4 Information About a Frame
  5585. =============================
  5586. There are several other commands to print information about the selected
  5587. stack frame.
  5588. 'frame'
  5589. 'f'
  5590. When used without any argument, this command does not change which
  5591. frame is selected, but prints a brief description of the currently
  5592. selected stack frame. It can be abbreviated 'f'. With an
  5593. argument, this command is used to select a stack frame. *Note
  5594. Selecting a Frame: Selection.
  5595. 'info frame'
  5596. 'info f'
  5597. This command prints a verbose description of the selected stack
  5598. frame, including:
  5599. * the address of the frame
  5600. * the address of the next frame down (called by this frame)
  5601. * the address of the next frame up (caller of this frame)
  5602. * the language in which the source code corresponding to this
  5603. frame is written
  5604. * the address of the frame's arguments
  5605. * the address of the frame's local variables
  5606. * the program counter saved in it (the address of execution in
  5607. the caller frame)
  5608. * which registers were saved in the frame
  5609. The verbose description is useful when something has gone wrong
  5610. that has made the stack format fail to fit the usual conventions.
  5611. 'info frame [ FRAME-SELECTION-SPEC ]'
  5612. 'info f [ FRAME-SELECTION-SPEC ]'
  5613. Print a verbose description of the frame selected by
  5614. FRAME-SELECTION-SPEC. The FRAME-SELECTION-SPEC is the same as for
  5615. the 'frame' command (*note Selecting a Frame: Selection.). The
  5616. selected frame remains unchanged by this command.
  5617. 'info args [-q]'
  5618. Print the arguments of the selected frame, each on a separate line.
  5619. The optional flag '-q', which stands for 'quiet', disables printing
  5620. header information and messages explaining why no argument have
  5621. been printed.
  5622. 'info args [-q] [-t TYPE_REGEXP] [REGEXP]'
  5623. Like 'info args', but only print the arguments selected with the
  5624. provided regexp(s).
  5625. If REGEXP is provided, print only the arguments whose names match
  5626. the regular expression REGEXP.
  5627. If TYPE_REGEXP is provided, print only the arguments whose types,
  5628. as printed by the 'whatis' command, match the regular expression
  5629. TYPE_REGEXP. If TYPE_REGEXP contains space(s), it should be
  5630. enclosed in quote characters. If needed, use backslash to escape
  5631. the meaning of special characters or quotes.
  5632. If both REGEXP and TYPE_REGEXP are provided, an argument is printed
  5633. only if its name matches REGEXP and its type matches TYPE_REGEXP.
  5634. 'info locals [-q]'
  5635. Print the local variables of the selected frame, each on a separate
  5636. line. These are all variables (declared either static or
  5637. automatic) accessible at the point of execution of the selected
  5638. frame.
  5639. The optional flag '-q', which stands for 'quiet', disables printing
  5640. header information and messages explaining why no local variables
  5641. have been printed.
  5642. 'info locals [-q] [-t TYPE_REGEXP] [REGEXP]'
  5643. Like 'info locals', but only print the local variables selected
  5644. with the provided regexp(s).
  5645. If REGEXP is provided, print only the local variables whose names
  5646. match the regular expression REGEXP.
  5647. If TYPE_REGEXP is provided, print only the local variables whose
  5648. types, as printed by the 'whatis' command, match the regular
  5649. expression TYPE_REGEXP. If TYPE_REGEXP contains space(s), it
  5650. should be enclosed in quote characters. If needed, use backslash
  5651. to escape the meaning of special characters or quotes.
  5652. If both REGEXP and TYPE_REGEXP are provided, a local variable is
  5653. printed only if its name matches REGEXP and its type matches
  5654. TYPE_REGEXP.
  5655. The command 'info locals -q -t TYPE_REGEXP' can usefully be
  5656. combined with the commands 'frame apply' and 'thread apply'. For
  5657. example, your program might use Resource Acquisition Is
  5658. Initialization types (RAII) such as 'lock_something_t': each local
  5659. variable of type 'lock_something_t' automatically places a lock
  5660. that is destroyed when the variable goes out of scope. You can
  5661. then list all acquired locks in your program by doing
  5662. thread apply all -s frame apply all -s info locals -q -t lock_something_t
  5663. or the equivalent shorter form
  5664. tfaas i lo -q -t lock_something_t
  5665. 
  5666. File: gdb.info, Node: Frame Apply, Next: Frame Filter Management, Prev: Frame Info, Up: Stack
  5667. 8.5 Applying a Command to Several Frames.
  5668. =========================================
  5669. 'frame apply [all | COUNT | -COUNT | level LEVEL...] [OPTION]... COMMAND'
  5670. The 'frame apply' command allows you to apply the named COMMAND to
  5671. one or more frames.
  5672. 'all'
  5673. Specify 'all' to apply COMMAND to all frames.
  5674. 'COUNT'
  5675. Use COUNT to apply COMMAND to the innermost COUNT frames,
  5676. where COUNT is a positive number.
  5677. '-COUNT'
  5678. Use -COUNT to apply COMMAND to the outermost COUNT frames,
  5679. where COUNT is a positive number.
  5680. 'level'
  5681. Use 'level' to apply COMMAND to the set of frames identified
  5682. by the LEVEL list. LEVEL is a frame level or a range of frame
  5683. levels as LEVEL1-LEVEL2. The frame level is the number shown
  5684. in the first field of the 'backtrace' command output. E.g.,
  5685. '2-4 6-8 3' indicates to apply COMMAND for the frames at
  5686. levels 2, 3, 4, 6, 7, 8, and then again on frame at level 3.
  5687. Note that the frames on which 'frame apply' applies a command are
  5688. also influenced by the 'set backtrace' settings such as 'set
  5689. backtrace past-main' and 'set backtrace limit N'. *Note
  5690. Backtraces: Backtrace.
  5691. The 'frame apply' command also supports a number of options that
  5692. allow overriding relevant 'set backtrace' settings:
  5693. '-past-main [on|off]'
  5694. Whether backtraces should continue past 'main'. Related
  5695. setting: *note set backtrace past-main::.
  5696. '-past-entry [on|off]'
  5697. Whether backtraces should continue past the entry point of a
  5698. program. Related setting: *note set backtrace past-entry::.
  5699. By default, GDB displays some frame information before the output
  5700. produced by COMMAND, and an error raised during the execution of a
  5701. COMMAND will abort 'frame apply'. The following options can be
  5702. used to fine-tune these behaviors:
  5703. '-c'
  5704. The flag '-c', which stands for 'continue', causes any errors
  5705. in COMMAND to be displayed, and the execution of 'frame apply'
  5706. then continues.
  5707. '-s'
  5708. The flag '-s', which stands for 'silent', causes any errors or
  5709. empty output produced by a COMMAND to be silently ignored.
  5710. That is, the execution continues, but the frame information
  5711. and errors are not printed.
  5712. '-q'
  5713. The flag '-q' ('quiet') disables printing the frame
  5714. information.
  5715. The following example shows how the flags '-c' and '-s' are working
  5716. when applying the command 'p j' to all frames, where variable 'j'
  5717. can only be successfully printed in the outermost '#1 main' frame.
  5718. (gdb) frame apply all p j
  5719. #0 some_function (i=5) at fun.c:4
  5720. No symbol "j" in current context.
  5721. (gdb) frame apply all -c p j
  5722. #0 some_function (i=5) at fun.c:4
  5723. No symbol "j" in current context.
  5724. #1 0x565555fb in main (argc=1, argv=0xffffd2c4) at fun.c:11
  5725. $1 = 5
  5726. (gdb) frame apply all -s p j
  5727. #1 0x565555fb in main (argc=1, argv=0xffffd2c4) at fun.c:11
  5728. $2 = 5
  5729. (gdb)
  5730. By default, 'frame apply', prints the frame location information
  5731. before the command output:
  5732. (gdb) frame apply all p $sp
  5733. #0 some_function (i=5) at fun.c:4
  5734. $4 = (void *) 0xffffd1e0
  5735. #1 0x565555fb in main (argc=1, argv=0xffffd2c4) at fun.c:11
  5736. $5 = (void *) 0xffffd1f0
  5737. (gdb)
  5738. If the flag '-q' is given, no frame information is printed:
  5739. (gdb) frame apply all -q p $sp
  5740. $12 = (void *) 0xffffd1e0
  5741. $13 = (void *) 0xffffd1f0
  5742. (gdb)
  5743. 'faas COMMAND'
  5744. Shortcut for 'frame apply all -s COMMAND'. Applies COMMAND on all
  5745. frames, ignoring errors and empty output.
  5746. It can for example be used to print a local variable or a function
  5747. argument without knowing the frame where this variable or argument
  5748. is, using:
  5749. (gdb) faas p some_local_var_i_do_not_remember_where_it_is
  5750. The 'faas' command accepts the same options as the 'frame apply'
  5751. command. *Note frame apply: Frame Apply.
  5752. Note that the command 'tfaas COMMAND' applies COMMAND on all frames
  5753. of all threads. See *Note Threads: Threads.
  5754. 
  5755. File: gdb.info, Node: Frame Filter Management, Prev: Frame Apply, Up: Stack
  5756. 8.6 Management of Frame Filters.
  5757. ================================
  5758. Frame filters are Python based utilities to manage and decorate the
  5759. output of frames. *Note Frame Filter API::, for further information.
  5760. Managing frame filters is performed by several commands available
  5761. within GDB, detailed here.
  5762. 'info frame-filter'
  5763. Print a list of installed frame filters from all dictionaries,
  5764. showing their name, priority and enabled status.
  5765. 'disable frame-filter FILTER-DICTIONARY FILTER-NAME'
  5766. Disable a frame filter in the dictionary matching FILTER-DICTIONARY
  5767. and FILTER-NAME. The FILTER-DICTIONARY may be 'all', 'global',
  5768. 'progspace', or the name of the object file where the frame filter
  5769. dictionary resides. When 'all' is specified, all frame filters
  5770. across all dictionaries are disabled. The FILTER-NAME is the name
  5771. of the frame filter and is used when 'all' is not the option for
  5772. FILTER-DICTIONARY. A disabled frame-filter is not deleted, it may
  5773. be enabled again later.
  5774. 'enable frame-filter FILTER-DICTIONARY FILTER-NAME'
  5775. Enable a frame filter in the dictionary matching FILTER-DICTIONARY
  5776. and FILTER-NAME. The FILTER-DICTIONARY may be 'all', 'global',
  5777. 'progspace' or the name of the object file where the frame filter
  5778. dictionary resides. When 'all' is specified, all frame filters
  5779. across all dictionaries are enabled. The FILTER-NAME is the name
  5780. of the frame filter and is used when 'all' is not the option for
  5781. FILTER-DICTIONARY.
  5782. Example:
  5783. (gdb) info frame-filter
  5784. global frame-filters:
  5785. Priority Enabled Name
  5786. 1000 No PrimaryFunctionFilter
  5787. 100 Yes Reverse
  5788. progspace /build/test frame-filters:
  5789. Priority Enabled Name
  5790. 100 Yes ProgspaceFilter
  5791. objfile /build/test frame-filters:
  5792. Priority Enabled Name
  5793. 999 Yes BuildProgramFilter
  5794. (gdb) disable frame-filter /build/test BuildProgramFilter
  5795. (gdb) info frame-filter
  5796. global frame-filters:
  5797. Priority Enabled Name
  5798. 1000 No PrimaryFunctionFilter
  5799. 100 Yes Reverse
  5800. progspace /build/test frame-filters:
  5801. Priority Enabled Name
  5802. 100 Yes ProgspaceFilter
  5803. objfile /build/test frame-filters:
  5804. Priority Enabled Name
  5805. 999 No BuildProgramFilter
  5806. (gdb) enable frame-filter global PrimaryFunctionFilter
  5807. (gdb) info frame-filter
  5808. global frame-filters:
  5809. Priority Enabled Name
  5810. 1000 Yes PrimaryFunctionFilter
  5811. 100 Yes Reverse
  5812. progspace /build/test frame-filters:
  5813. Priority Enabled Name
  5814. 100 Yes ProgspaceFilter
  5815. objfile /build/test frame-filters:
  5816. Priority Enabled Name
  5817. 999 No BuildProgramFilter
  5818. 'set frame-filter priority FILTER-DICTIONARY FILTER-NAME PRIORITY'
  5819. Set the PRIORITY of a frame filter in the dictionary matching
  5820. FILTER-DICTIONARY, and the frame filter name matching FILTER-NAME.
  5821. The FILTER-DICTIONARY may be 'global', 'progspace' or the name of
  5822. the object file where the frame filter dictionary resides. The
  5823. PRIORITY is an integer.
  5824. 'show frame-filter priority FILTER-DICTIONARY FILTER-NAME'
  5825. Show the PRIORITY of a frame filter in the dictionary matching
  5826. FILTER-DICTIONARY, and the frame filter name matching FILTER-NAME.
  5827. The FILTER-DICTIONARY may be 'global', 'progspace' or the name of
  5828. the object file where the frame filter dictionary resides.
  5829. Example:
  5830. (gdb) info frame-filter
  5831. global frame-filters:
  5832. Priority Enabled Name
  5833. 1000 Yes PrimaryFunctionFilter
  5834. 100 Yes Reverse
  5835. progspace /build/test frame-filters:
  5836. Priority Enabled Name
  5837. 100 Yes ProgspaceFilter
  5838. objfile /build/test frame-filters:
  5839. Priority Enabled Name
  5840. 999 No BuildProgramFilter
  5841. (gdb) set frame-filter priority global Reverse 50
  5842. (gdb) info frame-filter
  5843. global frame-filters:
  5844. Priority Enabled Name
  5845. 1000 Yes PrimaryFunctionFilter
  5846. 50 Yes Reverse
  5847. progspace /build/test frame-filters:
  5848. Priority Enabled Name
  5849. 100 Yes ProgspaceFilter
  5850. objfile /build/test frame-filters:
  5851. Priority Enabled Name
  5852. 999 No BuildProgramFilter
  5853. 
  5854. File: gdb.info, Node: Source, Next: Data, Prev: Stack, Up: Top
  5855. 9 Examining Source Files
  5856. ************************
  5857. GDB can print parts of your program's source, since the debugging
  5858. information recorded in the program tells GDB what source files were
  5859. used to build it. When your program stops, GDB spontaneously prints the
  5860. line where it stopped. Likewise, when you select a stack frame (*note
  5861. Selecting a Frame: Selection.), GDB prints the line where execution in
  5862. that frame has stopped. You can print other portions of source files by
  5863. explicit command.
  5864. If you use GDB through its GNU Emacs interface, you may prefer to use
  5865. Emacs facilities to view source; see *note Using GDB under GNU Emacs:
  5866. Emacs.
  5867. * Menu:
  5868. * List:: Printing source lines
  5869. * Specify Location:: How to specify code locations
  5870. * Edit:: Editing source files
  5871. * Search:: Searching source files
  5872. * Source Path:: Specifying source directories
  5873. * Machine Code:: Source and machine code
  5874. 
  5875. File: gdb.info, Node: List, Next: Specify Location, Up: Source
  5876. 9.1 Printing Source Lines
  5877. =========================
  5878. To print lines from a source file, use the 'list' command (abbreviated
  5879. 'l'). By default, ten lines are printed. There are several ways to
  5880. specify what part of the file you want to print; see *note Specify
  5881. Location::, for the full list.
  5882. Here are the forms of the 'list' command most commonly used:
  5883. 'list LINENUM'
  5884. Print lines centered around line number LINENUM in the current
  5885. source file.
  5886. 'list FUNCTION'
  5887. Print lines centered around the beginning of function FUNCTION.
  5888. 'list'
  5889. Print more lines. If the last lines printed were printed with a
  5890. 'list' command, this prints lines following the last lines printed;
  5891. however, if the last line printed was a solitary line printed as
  5892. part of displaying a stack frame (*note Examining the Stack:
  5893. Stack.), this prints lines centered around that line.
  5894. 'list -'
  5895. Print lines just before the lines last printed.
  5896. By default, GDB prints ten source lines with any of these forms of
  5897. the 'list' command. You can change this using 'set listsize':
  5898. 'set listsize COUNT'
  5899. 'set listsize unlimited'
  5900. Make the 'list' command display COUNT source lines (unless the
  5901. 'list' argument explicitly specifies some other number). Setting
  5902. COUNT to 'unlimited' or 0 means there's no limit.
  5903. 'show listsize'
  5904. Display the number of lines that 'list' prints.
  5905. Repeating a 'list' command with <RET> discards the argument, so it is
  5906. equivalent to typing just 'list'. This is more useful than listing the
  5907. same lines again. An exception is made for an argument of '-'; that
  5908. argument is preserved in repetition so that each repetition moves up in
  5909. the source file.
  5910. In general, the 'list' command expects you to supply zero, one or two
  5911. "locations". Locations specify source lines; there are several ways of
  5912. writing them (*note Specify Location::), but the effect is always to
  5913. specify some source line.
  5914. Here is a complete description of the possible arguments for 'list':
  5915. 'list LOCATION'
  5916. Print lines centered around the line specified by LOCATION.
  5917. 'list FIRST,LAST'
  5918. Print lines from FIRST to LAST. Both arguments are locations.
  5919. When a 'list' command has two locations, and the source file of the
  5920. second location is omitted, this refers to the same source file as
  5921. the first location.
  5922. 'list ,LAST'
  5923. Print lines ending with LAST.
  5924. 'list FIRST,'
  5925. Print lines starting with FIRST.
  5926. 'list +'
  5927. Print lines just after the lines last printed.
  5928. 'list -'
  5929. Print lines just before the lines last printed.
  5930. 'list'
  5931. As described in the preceding table.
  5932. 
  5933. File: gdb.info, Node: Specify Location, Next: Edit, Prev: List, Up: Source
  5934. 9.2 Specifying a Location
  5935. =========================
  5936. * Menu:
  5937. * Linespec Locations:: Linespec locations
  5938. * Explicit Locations:: Explicit locations
  5939. * Address Locations:: Address locations
  5940. Several GDB commands accept arguments that specify a location of your
  5941. program's code. Since GDB is a source-level debugger, a location
  5942. usually specifies some line in the source code. Locations may be
  5943. specified using three different formats: linespec locations, explicit
  5944. locations, or address locations.
  5945. 
  5946. File: gdb.info, Node: Linespec Locations, Next: Explicit Locations, Up: Specify Location
  5947. 9.2.1 Linespec Locations
  5948. ------------------------
  5949. A "linespec" is a colon-separated list of source location parameters
  5950. such as file name, function name, etc. Here are all the different ways
  5951. of specifying a linespec:
  5952. 'LINENUM'
  5953. Specifies the line number LINENUM of the current source file.
  5954. '-OFFSET'
  5955. '+OFFSET'
  5956. Specifies the line OFFSET lines before or after the "current line".
  5957. For the 'list' command, the current line is the last one printed;
  5958. for the breakpoint commands, this is the line at which execution
  5959. stopped in the currently selected "stack frame" (*note Frames:
  5960. Frames, for a description of stack frames.) When used as the
  5961. second of the two linespecs in a 'list' command, this specifies the
  5962. line OFFSET lines up or down from the first linespec.
  5963. 'FILENAME:LINENUM'
  5964. Specifies the line LINENUM in the source file FILENAME. If
  5965. FILENAME is a relative file name, then it will match any source
  5966. file name with the same trailing components. For example, if
  5967. FILENAME is 'gcc/expr.c', then it will match source file name of
  5968. '/build/trunk/gcc/expr.c', but not '/build/trunk/libcpp/expr.c' or
  5969. '/build/trunk/gcc/x-expr.c'.
  5970. 'FUNCTION'
  5971. Specifies the line that begins the body of the function FUNCTION.
  5972. For example, in C, this is the line with the open brace.
  5973. By default, in C++ and Ada, FUNCTION is interpreted as specifying
  5974. all functions named FUNCTION in all scopes. For C++, this means in
  5975. all namespaces and classes. For Ada, this means in all packages.
  5976. For example, assuming a program with C++ symbols named 'A::B::func'
  5977. and 'B::func', both commands 'break func' and 'break B::func' set a
  5978. breakpoint on both symbols.
  5979. Commands that accept a linespec let you override this with the
  5980. '-qualified' option. For example, 'break -qualified func' sets a
  5981. breakpoint on a free-function named 'func' ignoring any C++ class
  5982. methods and namespace functions called 'func'.
  5983. *Note Explicit Locations::.
  5984. 'FUNCTION:LABEL'
  5985. Specifies the line where LABEL appears in FUNCTION.
  5986. 'FILENAME:FUNCTION'
  5987. Specifies the line that begins the body of the function FUNCTION in
  5988. the file FILENAME. You only need the file name with a function
  5989. name to avoid ambiguity when there are identically named functions
  5990. in different source files.
  5991. 'LABEL'
  5992. Specifies the line at which the label named LABEL appears in the
  5993. function corresponding to the currently selected stack frame. If
  5994. there is no current selected stack frame (for instance, if the
  5995. inferior is not running), then GDB will not search for a label.
  5996. '-pstap|-probe-stap [OBJFILE:[PROVIDER:]]NAME'
  5997. The GNU/Linux tool 'SystemTap' provides a way for applications to
  5998. embed static probes. *Note Static Probe Points::, for more
  5999. information on finding and using static probes. This form of
  6000. linespec specifies the location of such a static probe.
  6001. If OBJFILE is given, only probes coming from that shared library or
  6002. executable matching OBJFILE as a regular expression are considered.
  6003. If PROVIDER is given, then only probes from that provider are
  6004. considered. If several probes match the spec, GDB will insert a
  6005. breakpoint at each one of those probes.
  6006. 
  6007. File: gdb.info, Node: Explicit Locations, Next: Address Locations, Prev: Linespec Locations, Up: Specify Location
  6008. 9.2.2 Explicit Locations
  6009. ------------------------
  6010. "Explicit locations" allow the user to directly specify the source
  6011. location's parameters using option-value pairs.
  6012. Explicit locations are useful when several functions, labels, or file
  6013. names have the same name (base name for files) in the program's sources.
  6014. In these cases, explicit locations point to the source line you meant
  6015. more accurately and unambiguously. Also, using explicit locations might
  6016. be faster in large programs.
  6017. For example, the linespec 'foo:bar' may refer to a function 'bar'
  6018. defined in the file named 'foo' or the label 'bar' in a function named
  6019. 'foo'. GDB must search either the file system or the symbol table to
  6020. know.
  6021. The list of valid explicit location options is summarized in the
  6022. following table:
  6023. '-source FILENAME'
  6024. The value specifies the source file name. To differentiate between
  6025. files with the same base name, prepend as many directories as is
  6026. necessary to uniquely identify the desired file, e.g.,
  6027. 'foo/bar/baz.c'. Otherwise GDB will use the first file it finds
  6028. with the given base name. This option requires the use of either
  6029. '-function' or '-line'.
  6030. '-function FUNCTION'
  6031. The value specifies the name of a function. Operations on function
  6032. locations unmodified by other options (such as '-label' or '-line')
  6033. refer to the line that begins the body of the function. In C, for
  6034. example, this is the line with the open brace.
  6035. By default, in C++ and Ada, FUNCTION is interpreted as specifying
  6036. all functions named FUNCTION in all scopes. For C++, this means in
  6037. all namespaces and classes. For Ada, this means in all packages.
  6038. For example, assuming a program with C++ symbols named 'A::B::func'
  6039. and 'B::func', both commands 'break -function func' and
  6040. 'break -function B::func' set a breakpoint on both symbols.
  6041. You can use the '-qualified' flag to override this (see below).
  6042. '-qualified'
  6043. This flag makes GDB interpret a function name specified with
  6044. '-function' as a complete fully-qualified name.
  6045. For example, assuming a C++ program with symbols named 'A::B::func'
  6046. and 'B::func', the 'break -qualified -function B::func' command
  6047. sets a breakpoint on 'B::func', only.
  6048. (Note: the '-qualified' option can precede a linespec as well
  6049. (*note Linespec Locations::), so the particular example above could
  6050. be simplified as 'break -qualified B::func'.)
  6051. '-label LABEL'
  6052. The value specifies the name of a label. When the function name is
  6053. not specified, the label is searched in the function of the
  6054. currently selected stack frame.
  6055. '-line NUMBER'
  6056. The value specifies a line offset for the location. The offset may
  6057. either be absolute ('-line 3') or relative ('-line +3'), depending
  6058. on the command. When specified without any other options, the line
  6059. offset is relative to the current line.
  6060. Explicit location options may be abbreviated by omitting any
  6061. non-unique trailing characters from the option name, e.g.,
  6062. 'break -s main.c -li 3'.
  6063. 
  6064. File: gdb.info, Node: Address Locations, Prev: Explicit Locations, Up: Specify Location
  6065. 9.2.3 Address Locations
  6066. -----------------------
  6067. "Address locations" indicate a specific program address. They have the
  6068. generalized form *ADDRESS.
  6069. For line-oriented commands, such as 'list' and 'edit', this specifies
  6070. a source line that contains ADDRESS. For 'break' and other
  6071. breakpoint-oriented commands, this can be used to set breakpoints in
  6072. parts of your program which do not have debugging information or source
  6073. files.
  6074. Here ADDRESS may be any expression valid in the current working
  6075. language (*note working language: Languages.) that specifies a code
  6076. address. In addition, as a convenience, GDB extends the semantics of
  6077. expressions used in locations to cover several situations that
  6078. frequently occur during debugging. Here are the various forms of
  6079. ADDRESS:
  6080. 'EXPRESSION'
  6081. Any expression valid in the current working language.
  6082. 'FUNCADDR'
  6083. An address of a function or procedure derived from its name. In C,
  6084. C++, Objective-C, Fortran, minimal, and assembly, this is simply
  6085. the function's name FUNCTION (and actually a special case of a
  6086. valid expression). In Pascal and Modula-2, this is '&FUNCTION'.
  6087. In Ada, this is 'FUNCTION'Address' (although the Pascal form also
  6088. works).
  6089. This form specifies the address of the function's first
  6090. instruction, before the stack frame and arguments have been set up.
  6091. ''FILENAME':FUNCADDR'
  6092. Like FUNCADDR above, but also specifies the name of the source file
  6093. explicitly. This is useful if the name of the function does not
  6094. specify the function unambiguously, e.g., if there are several
  6095. functions with identical names in different source files.
  6096. 
  6097. File: gdb.info, Node: Edit, Next: Search, Prev: Specify Location, Up: Source
  6098. 9.3 Editing Source Files
  6099. ========================
  6100. To edit the lines in a source file, use the 'edit' command. The editing
  6101. program of your choice is invoked with the current line set to the
  6102. active line in the program. Alternatively, there are several ways to
  6103. specify what part of the file you want to print if you want to see other
  6104. parts of the program:
  6105. 'edit LOCATION'
  6106. Edit the source file specified by 'location'. Editing starts at
  6107. that LOCATION, e.g., at the specified source line of the specified
  6108. file. *Note Specify Location::, for all the possible forms of the
  6109. LOCATION argument; here are the forms of the 'edit' command most
  6110. commonly used:
  6111. 'edit NUMBER'
  6112. Edit the current source file with NUMBER as the active line
  6113. number.
  6114. 'edit FUNCTION'
  6115. Edit the file containing FUNCTION at the beginning of its
  6116. definition.
  6117. 9.3.1 Choosing your Editor
  6118. --------------------------
  6119. You can customize GDB to use any editor you want (1). By default, it is
  6120. '/bin/ex', but you can change this by setting the environment variable
  6121. 'EDITOR' before using GDB. For example, to configure GDB to use the
  6122. 'vi' editor, you could use these commands with the 'sh' shell:
  6123. EDITOR=/usr/bin/vi
  6124. export EDITOR
  6125. gdb ...
  6126. or in the 'csh' shell,
  6127. setenv EDITOR /usr/bin/vi
  6128. gdb ...
  6129. ---------- Footnotes ----------
  6130. (1) The only restriction is that your editor (say 'ex'), recognizes
  6131. the following command-line syntax:
  6132. ex +NUMBER file
  6133. The optional numeric value +NUMBER specifies the number of the line
  6134. in the file where to start editing.
  6135. 
  6136. File: gdb.info, Node: Search, Next: Source Path, Prev: Edit, Up: Source
  6137. 9.4 Searching Source Files
  6138. ==========================
  6139. There are two commands for searching through the current source file for
  6140. a regular expression.
  6141. 'forward-search REGEXP'
  6142. 'search REGEXP'
  6143. The command 'forward-search REGEXP' checks each line, starting with
  6144. the one following the last line listed, for a match for REGEXP. It
  6145. lists the line that is found. You can use the synonym 'search
  6146. REGEXP' or abbreviate the command name as 'fo'.
  6147. 'reverse-search REGEXP'
  6148. The command 'reverse-search REGEXP' checks each line, starting with
  6149. the one before the last line listed and going backward, for a match
  6150. for REGEXP. It lists the line that is found. You can abbreviate
  6151. this command as 'rev'.
  6152. 
  6153. File: gdb.info, Node: Source Path, Next: Machine Code, Prev: Search, Up: Source
  6154. 9.5 Specifying Source Directories
  6155. =================================
  6156. Executable programs sometimes do not record the directories of the
  6157. source files from which they were compiled, just the names. Even when
  6158. they do, the directories could be moved between the compilation and your
  6159. debugging session. GDB has a list of directories to search for source
  6160. files; this is called the "source path". Each time GDB wants a source
  6161. file, it tries all the directories in the list, in the order they are
  6162. present in the list, until it finds a file with the desired name.
  6163. For example, suppose an executable references the file
  6164. '/usr/src/foo-1.0/lib/foo.c', does not record a compilation directory,
  6165. and the "source path" is '/mnt/cross'. GDB would look for the source
  6166. file in the following locations:
  6167. 1. '/usr/src/foo-1.0/lib/foo.c'
  6168. 2. '/mnt/cross/usr/src/foo-1.0/lib/foo.c'
  6169. 3. '/mnt/cross/foo.c'
  6170. If the source file is not present at any of the above locations then
  6171. an error is printed. GDB does not look up the parts of the source file
  6172. name, such as '/mnt/cross/src/foo-1.0/lib/foo.c'. Likewise, the
  6173. subdirectories of the source path are not searched: if the source path
  6174. is '/mnt/cross', and the binary refers to 'foo.c', GDB would not find it
  6175. under '/mnt/cross/usr/src/foo-1.0/lib'.
  6176. Plain file names, relative file names with leading directories, file
  6177. names containing dots, etc. are all treated as described above, except
  6178. that non-absolute file names are not looked up literally. If the
  6179. "source path" is '/mnt/cross', the source file is recorded as
  6180. '../lib/foo.c', and no compilation directory is recorded, then GDB will
  6181. search in the following locations:
  6182. 1. '/mnt/cross/../lib/foo.c'
  6183. 2. '/mnt/cross/foo.c'
  6184. The "source path" will always include two special entries '$cdir' and
  6185. '$cwd', these refer to the compilation directory (if one is recorded)
  6186. and the current working directory respectively.
  6187. '$cdir' causes GDB to search within the compilation directory, if one
  6188. is recorded in the debug information. If no compilation directory is
  6189. recorded in the debug information then '$cdir' is ignored.
  6190. '$cwd' is not the same as '.'--the former tracks the current working
  6191. directory as it changes during your GDB session, while the latter is
  6192. immediately expanded to the current directory at the time you add an
  6193. entry to the source path.
  6194. If a compilation directory is recorded in the debug information, and
  6195. GDB has not found the source file after the first search using "source
  6196. path", then GDB will combine the compilation directory and the filename,
  6197. and then search for the source file again using the "source path".
  6198. For example, if the executable records the source file as
  6199. '/usr/src/foo-1.0/lib/foo.c', the compilation directory is recorded as
  6200. '/project/build', and the "source path" is '/mnt/cross:$cdir:$cwd' while
  6201. the current working directory of the GDB session is '/home/user', then
  6202. GDB will search for the source file in the following locations:
  6203. 1. '/usr/src/foo-1.0/lib/foo.c'
  6204. 2. '/mnt/cross/usr/src/foo-1.0/lib/foo.c'
  6205. 3. '/project/build/usr/src/foo-1.0/lib/foo.c'
  6206. 4. '/home/user/usr/src/foo-1.0/lib/foo.c'
  6207. 5. '/mnt/cross/project/build/usr/src/foo-1.0/lib/foo.c'
  6208. 6. '/project/build/project/build/usr/src/foo-1.0/lib/foo.c'
  6209. 7. '/home/user/project/build/usr/src/foo-1.0/lib/foo.c'
  6210. 8. '/mnt/cross/foo.c'
  6211. 9. '/project/build/foo.c'
  6212. 10. '/home/user/foo.c'
  6213. If the file name in the previous example had been recorded in the
  6214. executable as a relative path rather than an absolute path, then the
  6215. first look up would not have occurred, but all of the remaining steps
  6216. would be similar.
  6217. When searching for source files on MS-DOS and MS-Windows, where
  6218. absolute paths start with a drive letter (e.g. 'C:/project/foo.c'), GDB
  6219. will remove the drive letter from the file name before appending it to a
  6220. search directory from "source path"; for instance if the executable
  6221. references the source file 'C:/project/foo.c' and "source path" is set
  6222. to 'D:/mnt/cross', then GDB will search in the following locations for
  6223. the source file:
  6224. 1. 'C:/project/foo.c'
  6225. 2. 'D:/mnt/cross/project/foo.c'
  6226. 3. 'D:/mnt/cross/foo.c'
  6227. Note that the executable search path is _not_ used to locate the
  6228. source files.
  6229. Whenever you reset or rearrange the source path, GDB clears out any
  6230. information it has cached about where source files are found and where
  6231. each line is in the file.
  6232. When you start GDB, its source path includes only '$cdir' and '$cwd',
  6233. in that order. To add other directories, use the 'directory' command.
  6234. The search path is used to find both program source files and GDB
  6235. script files (read using the '-command' option and 'source' command).
  6236. In addition to the source path, GDB provides a set of commands that
  6237. manage a list of source path substitution rules. A "substitution rule"
  6238. specifies how to rewrite source directories stored in the program's
  6239. debug information in case the sources were moved to a different
  6240. directory between compilation and debugging. A rule is made of two
  6241. strings, the first specifying what needs to be rewritten in the path,
  6242. and the second specifying how it should be rewritten. In *note set
  6243. substitute-path::, we name these two parts FROM and TO respectively.
  6244. GDB does a simple string replacement of FROM with TO at the start of the
  6245. directory part of the source file name, and uses that result instead of
  6246. the original file name to look up the sources.
  6247. Using the previous example, suppose the 'foo-1.0' tree has been moved
  6248. from '/usr/src' to '/mnt/cross', then you can tell GDB to replace
  6249. '/usr/src' in all source path names with '/mnt/cross'. The first lookup
  6250. will then be '/mnt/cross/foo-1.0/lib/foo.c' in place of the original
  6251. location of '/usr/src/foo-1.0/lib/foo.c'. To define a source path
  6252. substitution rule, use the 'set substitute-path' command (*note set
  6253. substitute-path::).
  6254. To avoid unexpected substitution results, a rule is applied only if
  6255. the FROM part of the directory name ends at a directory separator. For
  6256. instance, a rule substituting '/usr/source' into '/mnt/cross' will be
  6257. applied to '/usr/source/foo-1.0' but not to '/usr/sourceware/foo-2.0'.
  6258. And because the substitution is applied only at the beginning of the
  6259. directory name, this rule will not be applied to
  6260. '/root/usr/source/baz.c' either.
  6261. In many cases, you can achieve the same result using the 'directory'
  6262. command. However, 'set substitute-path' can be more efficient in the
  6263. case where the sources are organized in a complex tree with multiple
  6264. subdirectories. With the 'directory' command, you need to add each
  6265. subdirectory of your project. If you moved the entire tree while
  6266. preserving its internal organization, then 'set substitute-path' allows
  6267. you to direct the debugger to all the sources with one single command.
  6268. 'set substitute-path' is also more than just a shortcut command. The
  6269. source path is only used if the file at the original location no longer
  6270. exists. On the other hand, 'set substitute-path' modifies the debugger
  6271. behavior to look at the rewritten location instead. So, if for any
  6272. reason a source file that is not relevant to your executable is located
  6273. at the original location, a substitution rule is the only method
  6274. available to point GDB at the new location.
  6275. You can configure a default source path substitution rule by
  6276. configuring GDB with the '--with-relocated-sources=DIR' option. The DIR
  6277. should be the name of a directory under GDB's configured prefix (set
  6278. with '--prefix' or '--exec-prefix'), and directory names in debug
  6279. information under DIR will be adjusted automatically if the installed
  6280. GDB is moved to a new location. This is useful if GDB, libraries or
  6281. executables with debug information and corresponding source code are
  6282. being moved together.
  6283. 'directory DIRNAME ...'
  6284. 'dir DIRNAME ...'
  6285. Add directory DIRNAME to the front of the source path. Several
  6286. directory names may be given to this command, separated by ':' (';'
  6287. on MS-DOS and MS-Windows, where ':' usually appears as part of
  6288. absolute file names) or whitespace. You may specify a directory
  6289. that is already in the source path; this moves it forward, so GDB
  6290. searches it sooner.
  6291. The special strings '$cdir' (to refer to the compilation directory,
  6292. if one is recorded), and '$cwd' (to refer to the current working
  6293. directory) can also be included in the list of directories DIRNAME.
  6294. Though these will already be in the source path they will be moved
  6295. forward in the list so GDB searches them sooner.
  6296. 'directory'
  6297. Reset the source path to its default value ('$cdir:$cwd' on Unix
  6298. systems). This requires confirmation.
  6299. 'set directories PATH-LIST'
  6300. Set the source path to PATH-LIST. '$cdir:$cwd' are added if
  6301. missing.
  6302. 'show directories'
  6303. Print the source path: show which directories it contains.
  6304. 'set substitute-path FROM TO'
  6305. Define a source path substitution rule, and add it at the end of
  6306. the current list of existing substitution rules. If a rule with
  6307. the same FROM was already defined, then the old rule is also
  6308. deleted.
  6309. For example, if the file '/foo/bar/baz.c' was moved to
  6310. '/mnt/cross/baz.c', then the command
  6311. (gdb) set substitute-path /foo/bar /mnt/cross
  6312. will tell GDB to replace '/foo/bar' with '/mnt/cross', which will
  6313. allow GDB to find the file 'baz.c' even though it was moved.
  6314. In the case when more than one substitution rule have been defined,
  6315. the rules are evaluated one by one in the order where they have
  6316. been defined. The first one matching, if any, is selected to
  6317. perform the substitution.
  6318. For instance, if we had entered the following commands:
  6319. (gdb) set substitute-path /usr/src/include /mnt/include
  6320. (gdb) set substitute-path /usr/src /mnt/src
  6321. GDB would then rewrite '/usr/src/include/defs.h' into
  6322. '/mnt/include/defs.h' by using the first rule. However, it would
  6323. use the second rule to rewrite '/usr/src/lib/foo.c' into
  6324. '/mnt/src/lib/foo.c'.
  6325. 'unset substitute-path [path]'
  6326. If a path is specified, search the current list of substitution
  6327. rules for a rule that would rewrite that path. Delete that rule if
  6328. found. A warning is emitted by the debugger if no rule could be
  6329. found.
  6330. If no path is specified, then all substitution rules are deleted.
  6331. 'show substitute-path [path]'
  6332. If a path is specified, then print the source path substitution
  6333. rule which would rewrite that path, if any.
  6334. If no path is specified, then print all existing source path
  6335. substitution rules.
  6336. If your source path is cluttered with directories that are no longer
  6337. of interest, GDB may sometimes cause confusion by finding the wrong
  6338. versions of source. You can correct the situation as follows:
  6339. 1. Use 'directory' with no argument to reset the source path to its
  6340. default value.
  6341. 2. Use 'directory' with suitable arguments to reinstall the
  6342. directories you want in the source path. You can add all the
  6343. directories in one command.
  6344. 
  6345. File: gdb.info, Node: Machine Code, Prev: Source Path, Up: Source
  6346. 9.6 Source and Machine Code
  6347. ===========================
  6348. You can use the command 'info line' to map source lines to program
  6349. addresses (and vice versa), and the command 'disassemble' to display a
  6350. range of addresses as machine instructions. You can use the command
  6351. 'set disassemble-next-line' to set whether to disassemble next source
  6352. line when execution stops. When run under GNU Emacs mode, the 'info
  6353. line' command causes the arrow to point to the line specified. Also,
  6354. 'info line' prints addresses in symbolic form as well as hex.
  6355. 'info line'
  6356. 'info line LOCATION'
  6357. Print the starting and ending addresses of the compiled code for
  6358. source line LOCATION. You can specify source lines in any of the
  6359. ways documented in *note Specify Location::. With no LOCATION
  6360. information about the current source line is printed.
  6361. For example, we can use 'info line' to discover the location of the
  6362. object code for the first line of function 'm4_changequote':
  6363. (gdb) info line m4_changequote
  6364. Line 895 of "builtin.c" starts at pc 0x634c <m4_changequote> and \
  6365. ends at 0x6350 <m4_changequote+4>.
  6366. We can also inquire (using '*ADDR' as the form for LOCATION) what source
  6367. line covers a particular address:
  6368. (gdb) info line *0x63ff
  6369. Line 926 of "builtin.c" starts at pc 0x63e4 <m4_changequote+152> and \
  6370. ends at 0x6404 <m4_changequote+184>.
  6371. After 'info line', the default address for the 'x' command is changed
  6372. to the starting address of the line, so that 'x/i' is sufficient to
  6373. begin examining the machine code (*note Examining Memory: Memory.).
  6374. Also, this address is saved as the value of the convenience variable
  6375. '$_' (*note Convenience Variables: Convenience Vars.).
  6376. After 'info line', using 'info line' again without specifying a
  6377. location will display information about the next source line.
  6378. 'disassemble'
  6379. 'disassemble /m'
  6380. 'disassemble /s'
  6381. 'disassemble /r'
  6382. This specialized command dumps a range of memory as machine
  6383. instructions. It can also print mixed source+disassembly by
  6384. specifying the '/m' or '/s' modifier and print the raw instructions
  6385. in hex as well as in symbolic form by specifying the '/r' modifier.
  6386. The default memory range is the function surrounding the program
  6387. counter of the selected frame. A single argument to this command
  6388. is a program counter value; GDB dumps the function surrounding this
  6389. value. When two arguments are given, they should be separated by a
  6390. comma, possibly surrounded by whitespace. The arguments specify a
  6391. range of addresses to dump, in one of two forms:
  6392. 'START,END'
  6393. the addresses from START (inclusive) to END (exclusive)
  6394. 'START,+LENGTH'
  6395. the addresses from START (inclusive) to 'START+LENGTH'
  6396. (exclusive).
  6397. When 2 arguments are specified, the name of the function is also
  6398. printed (since there could be several functions in the given
  6399. range).
  6400. The argument(s) can be any expression yielding a numeric value,
  6401. such as '0x32c4', '&main+10' or '$pc - 8'.
  6402. If the range of memory being disassembled contains current program
  6403. counter, the instruction at that location is shown with a '=>'
  6404. marker.
  6405. The following example shows the disassembly of a range of addresses
  6406. of HP PA-RISC 2.0 code:
  6407. (gdb) disas 0x32c4, 0x32e4
  6408. Dump of assembler code from 0x32c4 to 0x32e4:
  6409. 0x32c4 <main+204>: addil 0,dp
  6410. 0x32c8 <main+208>: ldw 0x22c(sr0,r1),r26
  6411. 0x32cc <main+212>: ldil 0x3000,r31
  6412. 0x32d0 <main+216>: ble 0x3f8(sr4,r31)
  6413. 0x32d4 <main+220>: ldo 0(r31),rp
  6414. 0x32d8 <main+224>: addil -0x800,dp
  6415. 0x32dc <main+228>: ldo 0x588(r1),r26
  6416. 0x32e0 <main+232>: ldil 0x3000,r31
  6417. End of assembler dump.
  6418. Here is an example showing mixed source+assembly for Intel x86 with
  6419. '/m' or '/s', when the program is stopped just after function prologue
  6420. in a non-optimized function with no inline code.
  6421. (gdb) disas /m main
  6422. Dump of assembler code for function main:
  6423. 5 {
  6424. 0x08048330 <+0>: push %ebp
  6425. 0x08048331 <+1>: mov %esp,%ebp
  6426. 0x08048333 <+3>: sub $0x8,%esp
  6427. 0x08048336 <+6>: and $0xfffffff0,%esp
  6428. 0x08048339 <+9>: sub $0x10,%esp
  6429. 6 printf ("Hello.\n");
  6430. => 0x0804833c <+12>: movl $0x8048440,(%esp)
  6431. 0x08048343 <+19>: call 0x8048284 <puts@plt>
  6432. 7 return 0;
  6433. 8 }
  6434. 0x08048348 <+24>: mov $0x0,%eax
  6435. 0x0804834d <+29>: leave
  6436. 0x0804834e <+30>: ret
  6437. End of assembler dump.
  6438. The '/m' option is deprecated as its output is not useful when there
  6439. is either inlined code or re-ordered code. The '/s' option is the
  6440. preferred choice. Here is an example for AMD x86-64 showing the
  6441. difference between '/m' output and '/s' output. This example has one
  6442. inline function defined in a header file, and the code is compiled with
  6443. '-O2' optimization. Note how the '/m' output is missing the disassembly
  6444. of several instructions that are present in the '/s' output.
  6445. 'foo.h':
  6446. int
  6447. foo (int a)
  6448. {
  6449. if (a < 0)
  6450. return a * 2;
  6451. if (a == 0)
  6452. return 1;
  6453. return a + 10;
  6454. }
  6455. 'foo.c':
  6456. #include "foo.h"
  6457. volatile int x, y;
  6458. int
  6459. main ()
  6460. {
  6461. x = foo (y);
  6462. return 0;
  6463. }
  6464. (gdb) disas /m main
  6465. Dump of assembler code for function main:
  6466. 5 {
  6467. 6 x = foo (y);
  6468. 0x0000000000400400 <+0>: mov 0x200c2e(%rip),%eax # 0x601034 <y>
  6469. 0x0000000000400417 <+23>: mov %eax,0x200c13(%rip) # 0x601030 <x>
  6470. 7 return 0;
  6471. 8 }
  6472. 0x000000000040041d <+29>: xor %eax,%eax
  6473. 0x000000000040041f <+31>: retq
  6474. 0x0000000000400420 <+32>: add %eax,%eax
  6475. 0x0000000000400422 <+34>: jmp 0x400417 <main+23>
  6476. End of assembler dump.
  6477. (gdb) disas /s main
  6478. Dump of assembler code for function main:
  6479. foo.c:
  6480. 5 {
  6481. 6 x = foo (y);
  6482. 0x0000000000400400 <+0>: mov 0x200c2e(%rip),%eax # 0x601034 <y>
  6483. foo.h:
  6484. 4 if (a < 0)
  6485. 0x0000000000400406 <+6>: test %eax,%eax
  6486. 0x0000000000400408 <+8>: js 0x400420 <main+32>
  6487. 6 if (a == 0)
  6488. 7 return 1;
  6489. 8 return a + 10;
  6490. 0x000000000040040a <+10>: lea 0xa(%rax),%edx
  6491. 0x000000000040040d <+13>: test %eax,%eax
  6492. 0x000000000040040f <+15>: mov $0x1,%eax
  6493. 0x0000000000400414 <+20>: cmovne %edx,%eax
  6494. foo.c:
  6495. 6 x = foo (y);
  6496. 0x0000000000400417 <+23>: mov %eax,0x200c13(%rip) # 0x601030 <x>
  6497. 7 return 0;
  6498. 8 }
  6499. 0x000000000040041d <+29>: xor %eax,%eax
  6500. 0x000000000040041f <+31>: retq
  6501. foo.h:
  6502. 5 return a * 2;
  6503. 0x0000000000400420 <+32>: add %eax,%eax
  6504. 0x0000000000400422 <+34>: jmp 0x400417 <main+23>
  6505. End of assembler dump.
  6506. Here is another example showing raw instructions in hex for AMD
  6507. x86-64,
  6508. (gdb) disas /r 0x400281,+10
  6509. Dump of assembler code from 0x400281 to 0x40028b:
  6510. 0x0000000000400281: 38 36 cmp %dh,(%rsi)
  6511. 0x0000000000400283: 2d 36 34 2e 73 sub $0x732e3436,%eax
  6512. 0x0000000000400288: 6f outsl %ds:(%rsi),(%dx)
  6513. 0x0000000000400289: 2e 32 00 xor %cs:(%rax),%al
  6514. End of assembler dump.
  6515. Addresses cannot be specified as a location (*note Specify
  6516. Location::). So, for example, if you want to disassemble function 'bar'
  6517. in file 'foo.c', you must type 'disassemble 'foo.c'::bar' and not
  6518. 'disassemble foo.c:bar'.
  6519. Some architectures have more than one commonly-used set of
  6520. instruction mnemonics or other syntax.
  6521. For programs that were dynamically linked and use shared libraries,
  6522. instructions that call functions or branch to locations in the shared
  6523. libraries might show a seemingly bogus location--it's actually a
  6524. location of the relocation table. On some architectures, GDB might be
  6525. able to resolve these to actual function names.
  6526. 'set disassembler-options OPTION1[,OPTION2...]'
  6527. This command controls the passing of target specific information to
  6528. the disassembler. For a list of valid options, please refer to the
  6529. '-M'/'--disassembler-options' section of the 'objdump' manual
  6530. and/or the output of 'objdump --help' (*note objdump:
  6531. (binutils)objdump.). The default value is the empty string.
  6532. If it is necessary to specify more than one disassembler option,
  6533. then multiple options can be placed together into a comma separated
  6534. list. Currently this command is only supported on targets ARM,
  6535. MIPS, PowerPC and S/390.
  6536. 'show disassembler-options'
  6537. Show the current setting of the disassembler options.
  6538. 'set disassembly-flavor INSTRUCTION-SET'
  6539. Select the instruction set to use when disassembling the program
  6540. via the 'disassemble' or 'x/i' commands.
  6541. Currently this command is only defined for the Intel x86 family.
  6542. You can set INSTRUCTION-SET to either 'intel' or 'att'. The
  6543. default is 'att', the AT&T flavor used by default by Unix
  6544. assemblers for x86-based targets.
  6545. 'show disassembly-flavor'
  6546. Show the current setting of the disassembly flavor.
  6547. 'set disassemble-next-line'
  6548. 'show disassemble-next-line'
  6549. Control whether or not GDB will disassemble the next source line or
  6550. instruction when execution stops. If ON, GDB will display
  6551. disassembly of the next source line when execution of the program
  6552. being debugged stops. This is _in addition_ to displaying the
  6553. source line itself, which GDB always does if possible. If the next
  6554. source line cannot be displayed for some reason (e.g., if GDB
  6555. cannot find the source file, or there's no line info in the debug
  6556. info), GDB will display disassembly of the next _instruction_
  6557. instead of showing the next source line. If AUTO, GDB will display
  6558. disassembly of next instruction only if the source line cannot be
  6559. displayed. This setting causes GDB to display some feedback when
  6560. you step through a function with no line info or whose source file
  6561. is unavailable. The default is OFF, which means never display the
  6562. disassembly of the next line or instruction.
  6563. 
  6564. File: gdb.info, Node: Data, Next: Optimized Code, Prev: Source, Up: Top
  6565. 10 Examining Data
  6566. *****************
  6567. The usual way to examine data in your program is with the 'print'
  6568. command (abbreviated 'p'), or its synonym 'inspect'. It evaluates and
  6569. prints the value of an expression of the language your program is
  6570. written in (*note Using GDB with Different Languages: Languages.). It
  6571. may also print the expression using a Python-based pretty-printer (*note
  6572. Pretty Printing::).
  6573. 'print [[OPTIONS] --] EXPR'
  6574. 'print [[OPTIONS] --] /F EXPR'
  6575. EXPR is an expression (in the source language). By default the
  6576. value of EXPR is printed in a format appropriate to its data type;
  6577. you can choose a different format by specifying '/F', where F is a
  6578. letter specifying the format; see *note Output Formats: Output
  6579. Formats.
  6580. The 'print' command supports a number of options that allow
  6581. overriding relevant global print settings as set by 'set print'
  6582. subcommands:
  6583. '-address [on|off]'
  6584. Set printing of addresses. Related setting: *note set print
  6585. address::.
  6586. '-array [on|off]'
  6587. Pretty formatting of arrays. Related setting: *note set print
  6588. array::.
  6589. '-array-indexes [on|off]'
  6590. Set printing of array indexes. Related setting: *note set
  6591. print array-indexes::.
  6592. '-elements NUMBER-OF-ELEMENTS|unlimited'
  6593. Set limit on string chars or array elements to print. The
  6594. value 'unlimited' causes there to be no limit. Related
  6595. setting: *note set print elements::.
  6596. '-max-depth DEPTH|unlimited'
  6597. Set the threshold after which nested structures are replaced
  6598. with ellipsis. Related setting: *note set print max-depth::.
  6599. '-null-stop [on|off]'
  6600. Set printing of char arrays to stop at first null char.
  6601. Related setting: *note set print null-stop::.
  6602. '-object [on|off]'
  6603. Set printing C++ virtual function tables. Related setting:
  6604. *note set print object::.
  6605. '-pretty [on|off]'
  6606. Set pretty formatting of structures. Related setting: *note
  6607. set print pretty::.
  6608. '-raw-values [on|off]'
  6609. Set whether to print values in raw form, bypassing any
  6610. pretty-printers for that value. Related setting: *note set
  6611. print raw-values::.
  6612. '-repeats NUMBER-OF-REPEATS|unlimited'
  6613. Set threshold for repeated print elements. 'unlimited' causes
  6614. all elements to be individually printed. Related setting:
  6615. *note set print repeats::.
  6616. '-static-members [on|off]'
  6617. Set printing C++ static members. Related setting: *note set
  6618. print static-members::.
  6619. '-symbol [on|off]'
  6620. Set printing of symbol names when printing pointers. Related
  6621. setting: *note set print symbol::.
  6622. '-union [on|off]'
  6623. Set printing of unions interior to structures. Related
  6624. setting: *note set print union::.
  6625. '-vtbl [on|off]'
  6626. Set printing of C++ virtual function tables. Related setting:
  6627. *note set print vtbl::.
  6628. Because the 'print' command accepts arbitrary expressions which may
  6629. look like options (including abbreviations), if you specify any
  6630. command option, then you must use a double dash ('--') to mark the
  6631. end of option processing.
  6632. For example, this prints the value of the '-p' expression:
  6633. (gdb) print -p
  6634. While this repeats the last value in the value history (see below)
  6635. with the '-pretty' option in effect:
  6636. (gdb) print -p --
  6637. Here is an example including both on option and an expression:
  6638. (gdb) print -pretty -- *myptr
  6639. $1 = {
  6640. next = 0x0,
  6641. flags = {
  6642. sweet = 1,
  6643. sour = 1
  6644. },
  6645. meat = 0x54 "Pork"
  6646. }
  6647. 'print [OPTIONS]'
  6648. 'print [OPTIONS] /F'
  6649. If you omit EXPR, GDB displays the last value again (from the
  6650. "value history"; *note Value History: Value History.). This allows
  6651. you to conveniently inspect the same value in an alternative
  6652. format.
  6653. A more low-level way of examining data is with the 'x' command. It
  6654. examines data in memory at a specified address and prints it in a
  6655. specified format. *Note Examining Memory: Memory.
  6656. If you are interested in information about types, or about how the
  6657. fields of a struct or a class are declared, use the 'ptype EXP' command
  6658. rather than 'print'. *Note Examining the Symbol Table: Symbols.
  6659. Another way of examining values of expressions and type information
  6660. is through the Python extension command 'explore' (available only if the
  6661. GDB build is configured with '--with-python'). It offers an interactive
  6662. way to start at the highest level (or, the most abstract level) of the
  6663. data type of an expression (or, the data type itself) and explore all
  6664. the way down to leaf scalar values/fields embedded in the higher level
  6665. data types.
  6666. 'explore ARG'
  6667. ARG is either an expression (in the source language), or a type
  6668. visible in the current context of the program being debugged.
  6669. The working of the 'explore' command can be illustrated with an
  6670. example. If a data type 'struct ComplexStruct' is defined in your C
  6671. program as
  6672. struct SimpleStruct
  6673. {
  6674. int i;
  6675. double d;
  6676. };
  6677. struct ComplexStruct
  6678. {
  6679. struct SimpleStruct *ss_p;
  6680. int arr[10];
  6681. };
  6682. followed by variable declarations as
  6683. struct SimpleStruct ss = { 10, 1.11 };
  6684. struct ComplexStruct cs = { &ss, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } };
  6685. then, the value of the variable 'cs' can be explored using the 'explore'
  6686. command as follows.
  6687. (gdb) explore cs
  6688. The value of `cs' is a struct/class of type `struct ComplexStruct' with
  6689. the following fields:
  6690. ss_p = <Enter 0 to explore this field of type `struct SimpleStruct *'>
  6691. arr = <Enter 1 to explore this field of type `int [10]'>
  6692. Enter the field number of choice:
  6693. Since the fields of 'cs' are not scalar values, you are being prompted
  6694. to chose the field you want to explore. Let's say you choose the field
  6695. 'ss_p' by entering '0'. Then, since this field is a pointer, you will
  6696. be asked if it is pointing to a single value. From the declaration of
  6697. 'cs' above, it is indeed pointing to a single value, hence you enter
  6698. 'y'. If you enter 'n', then you will be asked if it were pointing to an
  6699. array of values, in which case this field will be explored as if it were
  6700. an array.
  6701. `cs.ss_p' is a pointer to a value of type `struct SimpleStruct'
  6702. Continue exploring it as a pointer to a single value [y/n]: y
  6703. The value of `*(cs.ss_p)' is a struct/class of type `struct
  6704. SimpleStruct' with the following fields:
  6705. i = 10 .. (Value of type `int')
  6706. d = 1.1100000000000001 .. (Value of type `double')
  6707. Press enter to return to parent value:
  6708. If the field 'arr' of 'cs' was chosen for exploration by entering '1'
  6709. earlier, then since it is as array, you will be prompted to enter the
  6710. index of the element in the array that you want to explore.
  6711. `cs.arr' is an array of `int'.
  6712. Enter the index of the element you want to explore in `cs.arr': 5
  6713. `(cs.arr)[5]' is a scalar value of type `int'.
  6714. (cs.arr)[5] = 4
  6715. Press enter to return to parent value:
  6716. In general, at any stage of exploration, you can go deeper towards
  6717. the leaf values by responding to the prompts appropriately, or hit the
  6718. return key to return to the enclosing data structure (the higher level
  6719. data structure).
  6720. Similar to exploring values, you can use the 'explore' command to
  6721. explore types. Instead of specifying a value (which is typically a
  6722. variable name or an expression valid in the current context of the
  6723. program being debugged), you specify a type name. If you consider the
  6724. same example as above, your can explore the type 'struct ComplexStruct'
  6725. by passing the argument 'struct ComplexStruct' to the 'explore' command.
  6726. (gdb) explore struct ComplexStruct
  6727. By responding to the prompts appropriately in the subsequent interactive
  6728. session, you can explore the type 'struct ComplexStruct' in a manner
  6729. similar to how the value 'cs' was explored in the above example.
  6730. The 'explore' command also has two sub-commands, 'explore value' and
  6731. 'explore type'. The former sub-command is a way to explicitly specify
  6732. that value exploration of the argument is being invoked, while the
  6733. latter is a way to explicitly specify that type exploration of the
  6734. argument is being invoked.
  6735. 'explore value EXPR'
  6736. This sub-command of 'explore' explores the value of the expression
  6737. EXPR (if EXPR is an expression valid in the current context of the
  6738. program being debugged). The behavior of this command is identical
  6739. to that of the behavior of the 'explore' command being passed the
  6740. argument EXPR.
  6741. 'explore type ARG'
  6742. This sub-command of 'explore' explores the type of ARG (if ARG is a
  6743. type visible in the current context of program being debugged), or
  6744. the type of the value/expression ARG (if ARG is an expression valid
  6745. in the current context of the program being debugged). If ARG is a
  6746. type, then the behavior of this command is identical to that of the
  6747. 'explore' command being passed the argument ARG. If ARG is an
  6748. expression, then the behavior of this command will be identical to
  6749. that of the 'explore' command being passed the type of ARG as the
  6750. argument.
  6751. * Menu:
  6752. * Expressions:: Expressions
  6753. * Ambiguous Expressions:: Ambiguous Expressions
  6754. * Variables:: Program variables
  6755. * Arrays:: Artificial arrays
  6756. * Output Formats:: Output formats
  6757. * Memory:: Examining memory
  6758. * Auto Display:: Automatic display
  6759. * Print Settings:: Print settings
  6760. * Pretty Printing:: Python pretty printing
  6761. * Value History:: Value history
  6762. * Convenience Vars:: Convenience variables
  6763. * Convenience Funs:: Convenience functions
  6764. * Registers:: Registers
  6765. * Floating Point Hardware:: Floating point hardware
  6766. * Vector Unit:: Vector Unit
  6767. * OS Information:: Auxiliary data provided by operating system
  6768. * Memory Region Attributes:: Memory region attributes
  6769. * Dump/Restore Files:: Copy between memory and a file
  6770. * Core File Generation:: Cause a program dump its core
  6771. * Character Sets:: Debugging programs that use a different
  6772. character set than GDB does
  6773. * Caching Target Data:: Data caching for targets
  6774. * Searching Memory:: Searching memory for a sequence of bytes
  6775. * Value Sizes:: Managing memory allocated for values
  6776. 
  6777. File: gdb.info, Node: Expressions, Next: Ambiguous Expressions, Up: Data
  6778. 10.1 Expressions
  6779. ================
  6780. 'print' and many other GDB commands accept an expression and compute its
  6781. value. Any kind of constant, variable or operator defined by the
  6782. programming language you are using is valid in an expression in GDB.
  6783. This includes conditional expressions, function calls, casts, and string
  6784. constants. It also includes preprocessor macros, if you compiled your
  6785. program to include this information; see *note Compilation::.
  6786. GDB supports array constants in expressions input by the user. The
  6787. syntax is {ELEMENT, ELEMENT...}. For example, you can use the command
  6788. 'print {1, 2, 3}' to create an array of three integers. If you pass an
  6789. array to a function or assign it to a program variable, GDB copies the
  6790. array to memory that is 'malloc'ed in the target program.
  6791. Because C is so widespread, most of the expressions shown in examples
  6792. in this manual are in C. *Note Using GDB with Different Languages:
  6793. Languages, for information on how to use expressions in other languages.
  6794. In this section, we discuss operators that you can use in GDB
  6795. expressions regardless of your programming language.
  6796. Casts are supported in all languages, not just in C, because it is so
  6797. useful to cast a number into a pointer in order to examine a structure
  6798. at that address in memory.
  6799. GDB supports these operators, in addition to those common to
  6800. programming languages:
  6801. '@'
  6802. '@' is a binary operator for treating parts of memory as arrays.
  6803. *Note Artificial Arrays: Arrays, for more information.
  6804. '::'
  6805. '::' allows you to specify a variable in terms of the file or
  6806. function where it is defined. *Note Program Variables: Variables.
  6807. '{TYPE} ADDR'
  6808. Refers to an object of type TYPE stored at address ADDR in memory.
  6809. The address ADDR may be any expression whose value is an integer or
  6810. pointer (but parentheses are required around binary operators, just
  6811. as in a cast). This construct is allowed regardless of what kind
  6812. of data is normally supposed to reside at ADDR.
  6813. 
  6814. File: gdb.info, Node: Ambiguous Expressions, Next: Variables, Prev: Expressions, Up: Data
  6815. 10.2 Ambiguous Expressions
  6816. ==========================
  6817. Expressions can sometimes contain some ambiguous elements. For
  6818. instance, some programming languages (notably Ada, C++ and Objective-C)
  6819. permit a single function name to be defined several times, for
  6820. application in different contexts. This is called "overloading".
  6821. Another example involving Ada is generics. A "generic package" is
  6822. similar to C++ templates and is typically instantiated several times,
  6823. resulting in the same function name being defined in different contexts.
  6824. In some cases and depending on the language, it is possible to adjust
  6825. the expression to remove the ambiguity. For instance in C++, you can
  6826. specify the signature of the function you want to break on, as in 'break
  6827. FUNCTION(TYPES)'. In Ada, using the fully qualified name of your
  6828. function often makes the expression unambiguous as well.
  6829. When an ambiguity that needs to be resolved is detected, the debugger
  6830. has the capability to display a menu of numbered choices for each
  6831. possibility, and then waits for the selection with the prompt '>'. The
  6832. first option is always '[0] cancel', and typing '0 <RET>' aborts the
  6833. current command. If the command in which the expression was used allows
  6834. more than one choice to be selected, the next option in the menu is '[1]
  6835. all', and typing '1 <RET>' selects all possible choices.
  6836. For example, the following session excerpt shows an attempt to set a
  6837. breakpoint at the overloaded symbol 'String::after'. We choose three
  6838. particular definitions of that function name:
  6839. (gdb) b String::after
  6840. [0] cancel
  6841. [1] all
  6842. [2] file:String.cc; line number:867
  6843. [3] file:String.cc; line number:860
  6844. [4] file:String.cc; line number:875
  6845. [5] file:String.cc; line number:853
  6846. [6] file:String.cc; line number:846
  6847. [7] file:String.cc; line number:735
  6848. > 2 4 6
  6849. Breakpoint 1 at 0xb26c: file String.cc, line 867.
  6850. Breakpoint 2 at 0xb344: file String.cc, line 875.
  6851. Breakpoint 3 at 0xafcc: file String.cc, line 846.
  6852. Multiple breakpoints were set.
  6853. Use the "delete" command to delete unwanted
  6854. breakpoints.
  6855. (gdb)
  6856. 'set multiple-symbols MODE'
  6857. This option allows you to adjust the debugger behavior when an
  6858. expression is ambiguous.
  6859. By default, MODE is set to 'all'. If the command with which the
  6860. expression is used allows more than one choice, then GDB
  6861. automatically selects all possible choices. For instance,
  6862. inserting a breakpoint on a function using an ambiguous name
  6863. results in a breakpoint inserted on each possible match. However,
  6864. if a unique choice must be made, then GDB uses the menu to help you
  6865. disambiguate the expression. For instance, printing the address of
  6866. an overloaded function will result in the use of the menu.
  6867. When MODE is set to 'ask', the debugger always uses the menu when
  6868. an ambiguity is detected.
  6869. Finally, when MODE is set to 'cancel', the debugger reports an
  6870. error due to the ambiguity and the command is aborted.
  6871. 'show multiple-symbols'
  6872. Show the current value of the 'multiple-symbols' setting.
  6873. 
  6874. File: gdb.info, Node: Variables, Next: Arrays, Prev: Ambiguous Expressions, Up: Data
  6875. 10.3 Program Variables
  6876. ======================
  6877. The most common kind of expression to use is the name of a variable in
  6878. your program.
  6879. Variables in expressions are understood in the selected stack frame
  6880. (*note Selecting a Frame: Selection.); they must be either:
  6881. * global (or file-static)
  6882. or
  6883. * visible according to the scope rules of the programming language
  6884. from the point of execution in that frame
  6885. This means that in the function
  6886. foo (a)
  6887. int a;
  6888. {
  6889. bar (a);
  6890. {
  6891. int b = test ();
  6892. bar (b);
  6893. }
  6894. }
  6895. you can examine and use the variable 'a' whenever your program is
  6896. executing within the function 'foo', but you can only use or examine the
  6897. variable 'b' while your program is executing inside the block where 'b'
  6898. is declared.
  6899. There is an exception: you can refer to a variable or function whose
  6900. scope is a single source file even if the current execution point is not
  6901. in this file. But it is possible to have more than one such variable or
  6902. function with the same name (in different source files). If that
  6903. happens, referring to that name has unpredictable effects. If you wish,
  6904. you can specify a static variable in a particular function or file by
  6905. using the colon-colon ('::') notation:
  6906. FILE::VARIABLE
  6907. FUNCTION::VARIABLE
  6908. Here FILE or FUNCTION is the name of the context for the static
  6909. VARIABLE. In the case of file names, you can use quotes to make sure
  6910. GDB parses the file name as a single word--for example, to print a
  6911. global value of 'x' defined in 'f2.c':
  6912. (gdb) p 'f2.c'::x
  6913. The '::' notation is normally used for referring to static variables,
  6914. since you typically disambiguate uses of local variables in functions by
  6915. selecting the appropriate frame and using the simple name of the
  6916. variable. However, you may also use this notation to refer to local
  6917. variables in frames enclosing the selected frame:
  6918. void
  6919. foo (int a)
  6920. {
  6921. if (a < 10)
  6922. bar (a);
  6923. else
  6924. process (a); /* Stop here */
  6925. }
  6926. int
  6927. bar (int a)
  6928. {
  6929. foo (a + 5);
  6930. }
  6931. For example, if there is a breakpoint at the commented line, here is
  6932. what you might see when the program stops after executing the call
  6933. 'bar(0)':
  6934. (gdb) p a
  6935. $1 = 10
  6936. (gdb) p bar::a
  6937. $2 = 5
  6938. (gdb) up 2
  6939. #2 0x080483d0 in foo (a=5) at foobar.c:12
  6940. (gdb) p a
  6941. $3 = 5
  6942. (gdb) p bar::a
  6943. $4 = 0
  6944. These uses of '::' are very rarely in conflict with the very similar
  6945. use of the same notation in C++. When they are in conflict, the C++
  6946. meaning takes precedence; however, this can be overridden by quoting the
  6947. file or function name with single quotes.
  6948. For example, suppose the program is stopped in a method of a class
  6949. that has a field named 'includefile', and there is also an include file
  6950. named 'includefile' that defines a variable, 'some_global'.
  6951. (gdb) p includefile
  6952. $1 = 23
  6953. (gdb) p includefile::some_global
  6954. A syntax error in expression, near `'.
  6955. (gdb) p 'includefile'::some_global
  6956. $2 = 27
  6957. _Warning:_ Occasionally, a local variable may appear to have the
  6958. wrong value at certain points in a function--just after entry to a
  6959. new scope, and just before exit.
  6960. You may see this problem when you are stepping by machine
  6961. instructions. This is because, on most machines, it takes more than one
  6962. instruction to set up a stack frame (including local variable
  6963. definitions); if you are stepping by machine instructions, variables may
  6964. appear to have the wrong values until the stack frame is completely
  6965. built. On exit, it usually also takes more than one machine instruction
  6966. to destroy a stack frame; after you begin stepping through that group of
  6967. instructions, local variable definitions may be gone.
  6968. This may also happen when the compiler does significant
  6969. optimizations. To be sure of always seeing accurate values, turn off
  6970. all optimization when compiling.
  6971. Another possible effect of compiler optimizations is to optimize
  6972. unused variables out of existence, or assign variables to registers (as
  6973. opposed to memory addresses). Depending on the support for such cases
  6974. offered by the debug info format used by the compiler, GDB might not be
  6975. able to display values for such local variables. If that happens, GDB
  6976. will print a message like this:
  6977. No symbol "foo" in current context.
  6978. To solve such problems, either recompile without optimizations, or
  6979. use a different debug info format, if the compiler supports several such
  6980. formats. *Note Compilation::, for more information on choosing compiler
  6981. options. *Note C and C++: C, for more information about debug info
  6982. formats that are best suited to C++ programs.
  6983. If you ask to print an object whose contents are unknown to GDB,
  6984. e.g., because its data type is not completely specified by the debug
  6985. information, GDB will say '<incomplete type>'. *Note incomplete type:
  6986. Symbols, for more about this.
  6987. If you try to examine or use the value of a (global) variable for
  6988. which GDB has no type information, e.g., because the program includes no
  6989. debug information, GDB displays an error message. *Note unknown type:
  6990. Symbols, for more about unknown types. If you cast the variable to its
  6991. declared type, GDB gets the variable's value using the cast-to type as
  6992. the variable's type. For example, in a C program:
  6993. (gdb) p var
  6994. 'var' has unknown type; cast it to its declared type
  6995. (gdb) p (float) var
  6996. $1 = 3.14
  6997. If you append '@entry' string to a function parameter name you get
  6998. its value at the time the function got called. If the value is not
  6999. available an error message is printed. Entry values are available only
  7000. with some compilers. Entry values are normally also printed at the
  7001. function parameter list according to *note set print entry-values::.
  7002. Breakpoint 1, d (i=30) at gdb.base/entry-value.c:29
  7003. 29 i++;
  7004. (gdb) next
  7005. 30 e (i);
  7006. (gdb) print i
  7007. $1 = 31
  7008. (gdb) print i@entry
  7009. $2 = 30
  7010. Strings are identified as arrays of 'char' values without specified
  7011. signedness. Arrays of either 'signed char' or 'unsigned char' get
  7012. printed as arrays of 1 byte sized integers. '-fsigned-char' or
  7013. '-funsigned-char' GCC options have no effect as GDB defines literal
  7014. string type '"char"' as 'char' without a sign. For program code
  7015. char var0[] = "A";
  7016. signed char var1[] = "A";
  7017. You get during debugging
  7018. (gdb) print var0
  7019. $1 = "A"
  7020. (gdb) print var1
  7021. $2 = {65 'A', 0 '\0'}
  7022. 
  7023. File: gdb.info, Node: Arrays, Next: Output Formats, Prev: Variables, Up: Data
  7024. 10.4 Artificial Arrays
  7025. ======================
  7026. It is often useful to print out several successive objects of the same
  7027. type in memory; a section of an array, or an array of dynamically
  7028. determined size for which only a pointer exists in the program.
  7029. You can do this by referring to a contiguous span of memory as an
  7030. "artificial array", using the binary operator '@'. The left operand of
  7031. '@' should be the first element of the desired array and be an
  7032. individual object. The right operand should be the desired length of
  7033. the array. The result is an array value whose elements are all of the
  7034. type of the left argument. The first element is actually the left
  7035. argument; the second element comes from bytes of memory immediately
  7036. following those that hold the first element, and so on. Here is an
  7037. example. If a program says
  7038. int *array = (int *) malloc (len * sizeof (int));
  7039. you can print the contents of 'array' with
  7040. p *array@len
  7041. The left operand of '@' must reside in memory. Array values made
  7042. with '@' in this way behave just like other arrays in terms of
  7043. subscripting, and are coerced to pointers when used in expressions.
  7044. Artificial arrays most often appear in expressions via the value history
  7045. (*note Value History: Value History.), after printing one out.
  7046. Another way to create an artificial array is to use a cast. This
  7047. re-interprets a value as if it were an array. The value need not be in
  7048. memory:
  7049. (gdb) p/x (short[2])0x12345678
  7050. $1 = {0x1234, 0x5678}
  7051. As a convenience, if you leave the array length out (as in
  7052. '(TYPE[])VALUE') GDB calculates the size to fill the value (as
  7053. 'sizeof(VALUE)/sizeof(TYPE)':
  7054. (gdb) p/x (short[])0x12345678
  7055. $2 = {0x1234, 0x5678}
  7056. Sometimes the artificial array mechanism is not quite enough; in
  7057. moderately complex data structures, the elements of interest may not
  7058. actually be adjacent--for example, if you are interested in the values
  7059. of pointers in an array. One useful work-around in this situation is to
  7060. use a convenience variable (*note Convenience Variables: Convenience
  7061. Vars.) as a counter in an expression that prints the first interesting
  7062. value, and then repeat that expression via <RET>. For instance, suppose
  7063. you have an array 'dtab' of pointers to structures, and you are
  7064. interested in the values of a field 'fv' in each structure. Here is an
  7065. example of what you might type:
  7066. set $i = 0
  7067. p dtab[$i++]->fv
  7068. <RET>
  7069. <RET>
  7070. ...
  7071. 
  7072. File: gdb.info, Node: Output Formats, Next: Memory, Prev: Arrays, Up: Data
  7073. 10.5 Output Formats
  7074. ===================
  7075. By default, GDB prints a value according to its data type. Sometimes
  7076. this is not what you want. For example, you might want to print a
  7077. number in hex, or a pointer in decimal. Or you might want to view data
  7078. in memory at a certain address as a character string or as an
  7079. instruction. To do these things, specify an "output format" when you
  7080. print a value.
  7081. The simplest use of output formats is to say how to print a value
  7082. already computed. This is done by starting the arguments of the 'print'
  7083. command with a slash and a format letter. The format letters supported
  7084. are:
  7085. 'x'
  7086. Regard the bits of the value as an integer, and print the integer
  7087. in hexadecimal.
  7088. 'd'
  7089. Print as integer in signed decimal.
  7090. 'u'
  7091. Print as integer in unsigned decimal.
  7092. 'o'
  7093. Print as integer in octal.
  7094. 't'
  7095. Print as integer in binary. The letter 't' stands for "two". (1)
  7096. 'a'
  7097. Print as an address, both absolute in hexadecimal and as an offset
  7098. from the nearest preceding symbol. You can use this format used to
  7099. discover where (in what function) an unknown address is located:
  7100. (gdb) p/a 0x54320
  7101. $3 = 0x54320 <_initialize_vx+396>
  7102. The command 'info symbol 0x54320' yields similar results. *Note
  7103. info symbol: Symbols.
  7104. 'c'
  7105. Regard as an integer and print it as a character constant. This
  7106. prints both the numerical value and its character representation.
  7107. The character representation is replaced with the octal escape
  7108. '\nnn' for characters outside the 7-bit ASCII range.
  7109. Without this format, GDB displays 'char', 'unsigned char', and
  7110. 'signed char' data as character constants. Single-byte members of
  7111. vectors are displayed as integer data.
  7112. 'f'
  7113. Regard the bits of the value as a floating point number and print
  7114. using typical floating point syntax.
  7115. 's'
  7116. Regard as a string, if possible. With this format, pointers to
  7117. single-byte data are displayed as null-terminated strings and
  7118. arrays of single-byte data are displayed as fixed-length strings.
  7119. Other values are displayed in their natural types.
  7120. Without this format, GDB displays pointers to and arrays of 'char',
  7121. 'unsigned char', and 'signed char' as strings. Single-byte members
  7122. of a vector are displayed as an integer array.
  7123. 'z'
  7124. Like 'x' formatting, the value is treated as an integer and printed
  7125. as hexadecimal, but leading zeros are printed to pad the value to
  7126. the size of the integer type.
  7127. 'r'
  7128. Print using the 'raw' formatting. By default, GDB will use a
  7129. Python-based pretty-printer, if one is available (*note Pretty
  7130. Printing::). This typically results in a higher-level display of
  7131. the value's contents. The 'r' format bypasses any Python
  7132. pretty-printer which might exist.
  7133. For example, to print the program counter in hex (*note Registers::),
  7134. type
  7135. p/x $pc
  7136. Note that no space is required before the slash; this is because command
  7137. names in GDB cannot contain a slash.
  7138. To reprint the last value in the value history with a different
  7139. format, you can use the 'print' command with just a format and no
  7140. expression. For example, 'p/x' reprints the last value in hex.
  7141. ---------- Footnotes ----------
  7142. (1) 'b' cannot be used because these format letters are also used
  7143. with the 'x' command, where 'b' stands for "byte"; see *note Examining
  7144. Memory: Memory.
  7145. 
  7146. File: gdb.info, Node: Memory, Next: Auto Display, Prev: Output Formats, Up: Data
  7147. 10.6 Examining Memory
  7148. =====================
  7149. You can use the command 'x' (for "examine") to examine memory in any of
  7150. several formats, independently of your program's data types.
  7151. 'x/NFU ADDR'
  7152. 'x ADDR'
  7153. 'x'
  7154. Use the 'x' command to examine memory.
  7155. N, F, and U are all optional parameters that specify how much memory
  7156. to display and how to format it; ADDR is an expression giving the
  7157. address where you want to start displaying memory. If you use defaults
  7158. for NFU, you need not type the slash '/'. Several commands set
  7159. convenient defaults for ADDR.
  7160. N, the repeat count
  7161. The repeat count is a decimal integer; the default is 1. It
  7162. specifies how much memory (counting by units U) to display. If a
  7163. negative number is specified, memory is examined backward from
  7164. ADDR.
  7165. F, the display format
  7166. The display format is one of the formats used by 'print' ('x', 'd',
  7167. 'u', 'o', 't', 'a', 'c', 'f', 's'), and in addition 'i' (for
  7168. machine instructions). The default is 'x' (hexadecimal) initially.
  7169. The default changes each time you use either 'x' or 'print'.
  7170. U, the unit size
  7171. The unit size is any of
  7172. 'b'
  7173. Bytes.
  7174. 'h'
  7175. Halfwords (two bytes).
  7176. 'w'
  7177. Words (four bytes). This is the initial default.
  7178. 'g'
  7179. Giant words (eight bytes).
  7180. Each time you specify a unit size with 'x', that size becomes the
  7181. default unit the next time you use 'x'. For the 'i' format, the
  7182. unit size is ignored and is normally not written. For the 's'
  7183. format, the unit size defaults to 'b', unless it is explicitly
  7184. given. Use 'x /hs' to display 16-bit char strings and 'x /ws' to
  7185. display 32-bit strings. The next use of 'x /s' will again display
  7186. 8-bit strings. Note that the results depend on the programming
  7187. language of the current compilation unit. If the language is C,
  7188. the 's' modifier will use the UTF-16 encoding while 'w' will use
  7189. UTF-32. The encoding is set by the programming language and cannot
  7190. be altered.
  7191. ADDR, starting display address
  7192. ADDR is the address where you want GDB to begin displaying memory.
  7193. The expression need not have a pointer value (though it may); it is
  7194. always interpreted as an integer address of a byte of memory.
  7195. *Note Expressions: Expressions, for more information on
  7196. expressions. The default for ADDR is usually just after the last
  7197. address examined--but several other commands also set the default
  7198. address: 'info breakpoints' (to the address of the last breakpoint
  7199. listed), 'info line' (to the starting address of a line), and
  7200. 'print' (if you use it to display a value from memory).
  7201. For example, 'x/3uh 0x54320' is a request to display three halfwords
  7202. ('h') of memory, formatted as unsigned decimal integers ('u'), starting
  7203. at address '0x54320'. 'x/4xw $sp' prints the four words ('w') of memory
  7204. above the stack pointer (here, '$sp'; *note Registers: Registers.) in
  7205. hexadecimal ('x').
  7206. You can also specify a negative repeat count to examine memory
  7207. backward from the given address. For example, 'x/-3uh 0x54320' prints
  7208. three halfwords ('h') at '0x54314', '0x54328', and '0x5431c'.
  7209. Since the letters indicating unit sizes are all distinct from the
  7210. letters specifying output formats, you do not have to remember whether
  7211. unit size or format comes first; either order works. The output
  7212. specifications '4xw' and '4wx' mean exactly the same thing. (However,
  7213. the count N must come first; 'wx4' does not work.)
  7214. Even though the unit size U is ignored for the formats 's' and 'i',
  7215. you might still want to use a count N; for example, '3i' specifies that
  7216. you want to see three machine instructions, including any operands. For
  7217. convenience, especially when used with the 'display' command, the 'i'
  7218. format also prints branch delay slot instructions, if any, beyond the
  7219. count specified, which immediately follow the last instruction that is
  7220. within the count. The command 'disassemble' gives an alternative way of
  7221. inspecting machine instructions; see *note Source and Machine Code:
  7222. Machine Code.
  7223. If a negative repeat count is specified for the formats 's' or 'i',
  7224. the command displays null-terminated strings or instructions before the
  7225. given address as many as the absolute value of the given number. For
  7226. the 'i' format, we use line number information in the debug info to
  7227. accurately locate instruction boundaries while disassembling backward.
  7228. If line info is not available, the command stops examining memory with
  7229. an error message.
  7230. All the defaults for the arguments to 'x' are designed to make it
  7231. easy to continue scanning memory with minimal specifications each time
  7232. you use 'x'. For example, after you have inspected three machine
  7233. instructions with 'x/3i ADDR', you can inspect the next seven with just
  7234. 'x/7'. If you use <RET> to repeat the 'x' command, the repeat count N
  7235. is used again; the other arguments default as for successive uses of
  7236. 'x'.
  7237. When examining machine instructions, the instruction at current
  7238. program counter is shown with a '=>' marker. For example:
  7239. (gdb) x/5i $pc-6
  7240. 0x804837f <main+11>: mov %esp,%ebp
  7241. 0x8048381 <main+13>: push %ecx
  7242. 0x8048382 <main+14>: sub $0x4,%esp
  7243. => 0x8048385 <main+17>: movl $0x8048460,(%esp)
  7244. 0x804838c <main+24>: call 0x80482d4 <puts@plt>
  7245. The addresses and contents printed by the 'x' command are not saved
  7246. in the value history because there is often too much of them and they
  7247. would get in the way. Instead, GDB makes these values available for
  7248. subsequent use in expressions as values of the convenience variables
  7249. '$_' and '$__'. After an 'x' command, the last address examined is
  7250. available for use in expressions in the convenience variable '$_'. The
  7251. contents of that address, as examined, are available in the convenience
  7252. variable '$__'.
  7253. If the 'x' command has a repeat count, the address and contents saved
  7254. are from the last memory unit printed; this is not the same as the last
  7255. address printed if several units were printed on the last line of
  7256. output.
  7257. Most targets have an addressable memory unit size of 8 bits. This
  7258. means that to each memory address are associated 8 bits of data. Some
  7259. targets, however, have other addressable memory unit sizes. Within GDB
  7260. and this document, the term "addressable memory unit" (or "memory unit"
  7261. for short) is used when explicitly referring to a chunk of data of that
  7262. size. The word "byte" is used to refer to a chunk of data of 8 bits,
  7263. regardless of the addressable memory unit size of the target. For most
  7264. systems, addressable memory unit is a synonym of byte.
  7265. When you are debugging a program running on a remote target machine
  7266. (*note Remote Debugging::), you may wish to verify the program's image
  7267. in the remote machine's memory against the executable file you
  7268. downloaded to the target. Or, on any target, you may want to check
  7269. whether the program has corrupted its own read-only sections. The
  7270. 'compare-sections' command is provided for such situations.
  7271. 'compare-sections [SECTION-NAME|-r]'
  7272. Compare the data of a loadable section SECTION-NAME in the
  7273. executable file of the program being debugged with the same section
  7274. in the target machine's memory, and report any mismatches. With no
  7275. arguments, compares all loadable sections. With an argument of
  7276. '-r', compares all loadable read-only sections.
  7277. Note: for remote targets, this command can be accelerated if the
  7278. target supports computing the CRC checksum of a block of memory
  7279. (*note qCRC packet::).
  7280. 
  7281. File: gdb.info, Node: Auto Display, Next: Print Settings, Prev: Memory, Up: Data
  7282. 10.7 Automatic Display
  7283. ======================
  7284. If you find that you want to print the value of an expression frequently
  7285. (to see how it changes), you might want to add it to the "automatic
  7286. display list" so that GDB prints its value each time your program stops.
  7287. Each expression added to the list is given a number to identify it; to
  7288. remove an expression from the list, you specify that number. The
  7289. automatic display looks like this:
  7290. 2: foo = 38
  7291. 3: bar[5] = (struct hack *) 0x3804
  7292. This display shows item numbers, expressions and their current values.
  7293. As with displays you request manually using 'x' or 'print', you can
  7294. specify the output format you prefer; in fact, 'display' decides whether
  7295. to use 'print' or 'x' depending your format specification--it uses 'x'
  7296. if you specify either the 'i' or 's' format, or a unit size; otherwise
  7297. it uses 'print'.
  7298. 'display EXPR'
  7299. Add the expression EXPR to the list of expressions to display each
  7300. time your program stops. *Note Expressions: Expressions.
  7301. 'display' does not repeat if you press <RET> again after using it.
  7302. 'display/FMT EXPR'
  7303. For FMT specifying only a display format and not a size or count,
  7304. add the expression EXPR to the auto-display list but arrange to
  7305. display it each time in the specified format FMT. *Note Output
  7306. Formats: Output Formats.
  7307. 'display/FMT ADDR'
  7308. For FMT 'i' or 's', or including a unit-size or a number of units,
  7309. add the expression ADDR as a memory address to be examined each
  7310. time your program stops. Examining means in effect doing 'x/FMT
  7311. ADDR'. *Note Examining Memory: Memory.
  7312. For example, 'display/i $pc' can be helpful, to see the machine
  7313. instruction about to be executed each time execution stops ('$pc' is a
  7314. common name for the program counter; *note Registers: Registers.).
  7315. 'undisplay DNUMS...'
  7316. 'delete display DNUMS...'
  7317. Remove items from the list of expressions to display. Specify the
  7318. numbers of the displays that you want affected with the command
  7319. argument DNUMS. It can be a single display number, one of the
  7320. numbers shown in the first field of the 'info display' display; or
  7321. it could be a range of display numbers, as in '2-4'.
  7322. 'undisplay' does not repeat if you press <RET> after using it.
  7323. (Otherwise you would just get the error 'No display number ...'.)
  7324. 'disable display DNUMS...'
  7325. Disable the display of item numbers DNUMS. A disabled display item
  7326. is not printed automatically, but is not forgotten. It may be
  7327. enabled again later. Specify the numbers of the displays that you
  7328. want affected with the command argument DNUMS. It can be a single
  7329. display number, one of the numbers shown in the first field of the
  7330. 'info display' display; or it could be a range of display numbers,
  7331. as in '2-4'.
  7332. 'enable display DNUMS...'
  7333. Enable display of item numbers DNUMS. It becomes effective once
  7334. again in auto display of its expression, until you specify
  7335. otherwise. Specify the numbers of the displays that you want
  7336. affected with the command argument DNUMS. It can be a single
  7337. display number, one of the numbers shown in the first field of the
  7338. 'info display' display; or it could be a range of display numbers,
  7339. as in '2-4'.
  7340. 'display'
  7341. Display the current values of the expressions on the list, just as
  7342. is done when your program stops.
  7343. 'info display'
  7344. Print the list of expressions previously set up to display
  7345. automatically, each one with its item number, but without showing
  7346. the values. This includes disabled expressions, which are marked
  7347. as such. It also includes expressions which would not be displayed
  7348. right now because they refer to automatic variables not currently
  7349. available.
  7350. If a display expression refers to local variables, then it does not
  7351. make sense outside the lexical context for which it was set up. Such an
  7352. expression is disabled when execution enters a context where one of its
  7353. variables is not defined. For example, if you give the command 'display
  7354. last_char' while inside a function with an argument 'last_char', GDB
  7355. displays this argument while your program continues to stop inside that
  7356. function. When it stops elsewhere--where there is no variable
  7357. 'last_char'--the display is disabled automatically. The next time your
  7358. program stops where 'last_char' is meaningful, you can enable the
  7359. display expression once again.
  7360. 
  7361. File: gdb.info, Node: Print Settings, Next: Pretty Printing, Prev: Auto Display, Up: Data
  7362. 10.8 Print Settings
  7363. ===================
  7364. GDB provides the following ways to control how arrays, structures, and
  7365. symbols are printed.
  7366. These settings are useful for debugging programs in any language:
  7367. 'set print address'
  7368. 'set print address on'
  7369. GDB prints memory addresses showing the location of stack traces,
  7370. structure values, pointer values, breakpoints, and so forth, even
  7371. when it also displays the contents of those addresses. The default
  7372. is 'on'. For example, this is what a stack frame display looks
  7373. like with 'set print address on':
  7374. (gdb) f
  7375. #0 set_quotes (lq=0x34c78 "<<", rq=0x34c88 ">>")
  7376. at input.c:530
  7377. 530 if (lquote != def_lquote)
  7378. 'set print address off'
  7379. Do not print addresses when displaying their contents. For
  7380. example, this is the same stack frame displayed with 'set print
  7381. address off':
  7382. (gdb) set print addr off
  7383. (gdb) f
  7384. #0 set_quotes (lq="<<", rq=">>") at input.c:530
  7385. 530 if (lquote != def_lquote)
  7386. You can use 'set print address off' to eliminate all machine
  7387. dependent displays from the GDB interface. For example, with
  7388. 'print address off', you should get the same text for backtraces on
  7389. all machines--whether or not they involve pointer arguments.
  7390. 'show print address'
  7391. Show whether or not addresses are to be printed.
  7392. When GDB prints a symbolic address, it normally prints the closest
  7393. earlier symbol plus an offset. If that symbol does not uniquely
  7394. identify the address (for example, it is a name whose scope is a single
  7395. source file), you may need to clarify. One way to do this is with 'info
  7396. line', for example 'info line *0x4537'. Alternately, you can set GDB to
  7397. print the source file and line number when it prints a symbolic address:
  7398. 'set print symbol-filename on'
  7399. Tell GDB to print the source file name and line number of a symbol
  7400. in the symbolic form of an address.
  7401. 'set print symbol-filename off'
  7402. Do not print source file name and line number of a symbol. This is
  7403. the default.
  7404. 'show print symbol-filename'
  7405. Show whether or not GDB will print the source file name and line
  7406. number of a symbol in the symbolic form of an address.
  7407. Another situation where it is helpful to show symbol filenames and
  7408. line numbers is when disassembling code; GDB shows you the line number
  7409. and source file that corresponds to each instruction.
  7410. Also, you may wish to see the symbolic form only if the address being
  7411. printed is reasonably close to the closest earlier symbol:
  7412. 'set print max-symbolic-offset MAX-OFFSET'
  7413. 'set print max-symbolic-offset unlimited'
  7414. Tell GDB to only display the symbolic form of an address if the
  7415. offset between the closest earlier symbol and the address is less
  7416. than MAX-OFFSET. The default is 'unlimited', which tells GDB to
  7417. always print the symbolic form of an address if any symbol precedes
  7418. it. Zero is equivalent to 'unlimited'.
  7419. 'show print max-symbolic-offset'
  7420. Ask how large the maximum offset is that GDB prints in a symbolic
  7421. address.
  7422. If you have a pointer and you are not sure where it points, try 'set
  7423. print symbol-filename on'. Then you can determine the name and source
  7424. file location of the variable where it points, using 'p/a POINTER'.
  7425. This interprets the address in symbolic form. For example, here GDB
  7426. shows that a variable 'ptt' points at another variable 't', defined in
  7427. 'hi2.c':
  7428. (gdb) set print symbol-filename on
  7429. (gdb) p/a ptt
  7430. $4 = 0xe008 <t in hi2.c>
  7431. _Warning:_ For pointers that point to a local variable, 'p/a' does
  7432. not show the symbol name and filename of the referent, even with
  7433. the appropriate 'set print' options turned on.
  7434. You can also enable '/a'-like formatting all the time using 'set
  7435. print symbol on':
  7436. 'set print symbol on'
  7437. Tell GDB to print the symbol corresponding to an address, if one
  7438. exists.
  7439. 'set print symbol off'
  7440. Tell GDB not to print the symbol corresponding to an address. In
  7441. this mode, GDB will still print the symbol corresponding to
  7442. pointers to functions. This is the default.
  7443. 'show print symbol'
  7444. Show whether GDB will display the symbol corresponding to an
  7445. address.
  7446. Other settings control how different kinds of objects are printed:
  7447. 'set print array'
  7448. 'set print array on'
  7449. Pretty print arrays. This format is more convenient to read, but
  7450. uses more space. The default is off.
  7451. 'set print array off'
  7452. Return to compressed format for arrays.
  7453. 'show print array'
  7454. Show whether compressed or pretty format is selected for displaying
  7455. arrays.
  7456. 'set print array-indexes'
  7457. 'set print array-indexes on'
  7458. Print the index of each element when displaying arrays. May be
  7459. more convenient to locate a given element in the array or quickly
  7460. find the index of a given element in that printed array. The
  7461. default is off.
  7462. 'set print array-indexes off'
  7463. Stop printing element indexes when displaying arrays.
  7464. 'show print array-indexes'
  7465. Show whether the index of each element is printed when displaying
  7466. arrays.
  7467. 'set print elements NUMBER-OF-ELEMENTS'
  7468. 'set print elements unlimited'
  7469. Set a limit on how many elements of an array GDB will print. If
  7470. GDB is printing a large array, it stops printing after it has
  7471. printed the number of elements set by the 'set print elements'
  7472. command. This limit also applies to the display of strings. When
  7473. GDB starts, this limit is set to 200. Setting NUMBER-OF-ELEMENTS
  7474. to 'unlimited' or zero means that the number of elements to print
  7475. is unlimited.
  7476. 'show print elements'
  7477. Display the number of elements of a large array that GDB will
  7478. print. If the number is 0, then the printing is unlimited.
  7479. 'set print frame-arguments VALUE'
  7480. This command allows to control how the values of arguments are
  7481. printed when the debugger prints a frame (*note Frames::). The
  7482. possible values are:
  7483. 'all'
  7484. The values of all arguments are printed.
  7485. 'scalars'
  7486. Print the value of an argument only if it is a scalar. The
  7487. value of more complex arguments such as arrays, structures,
  7488. unions, etc, is replaced by '...'. This is the default. Here
  7489. is an example where only scalar arguments are shown:
  7490. #1 0x08048361 in call_me (i=3, s=..., ss=0xbf8d508c, u=..., e=green)
  7491. at frame-args.c:23
  7492. 'none'
  7493. None of the argument values are printed. Instead, the value
  7494. of each argument is replaced by '...'. In this case, the
  7495. example above now becomes:
  7496. #1 0x08048361 in call_me (i=..., s=..., ss=..., u=..., e=...)
  7497. at frame-args.c:23
  7498. 'presence'
  7499. Only the presence of arguments is indicated by '...'. The
  7500. '...' are not printed for function without any arguments.
  7501. None of the argument names and values are printed. In this
  7502. case, the example above now becomes:
  7503. #1 0x08048361 in call_me (...) at frame-args.c:23
  7504. By default, only scalar arguments are printed. This command can be
  7505. used to configure the debugger to print the value of all arguments,
  7506. regardless of their type. However, it is often advantageous to not
  7507. print the value of more complex parameters. For instance, it
  7508. reduces the amount of information printed in each frame, making the
  7509. backtrace more readable. Also, it improves performance when
  7510. displaying Ada frames, because the computation of large arguments
  7511. can sometimes be CPU-intensive, especially in large applications.
  7512. Setting 'print frame-arguments' to 'scalars' (the default), 'none'
  7513. or 'presence' avoids this computation, thus speeding up the display
  7514. of each Ada frame.
  7515. 'show print frame-arguments'
  7516. Show how the value of arguments should be displayed when printing a
  7517. frame.
  7518. 'set print raw-frame-arguments on'
  7519. Print frame arguments in raw, non pretty-printed, form.
  7520. 'set print raw-frame-arguments off'
  7521. Print frame arguments in pretty-printed form, if there is a
  7522. pretty-printer for the value (*note Pretty Printing::), otherwise
  7523. print the value in raw form. This is the default.
  7524. 'show print raw-frame-arguments'
  7525. Show whether to print frame arguments in raw form.
  7526. 'set print entry-values VALUE'
  7527. Set printing of frame argument values at function entry. In some
  7528. cases GDB can determine the value of function argument which was
  7529. passed by the function caller, even if the value was modified
  7530. inside the called function and therefore is different. With
  7531. optimized code, the current value could be unavailable, but the
  7532. entry value may still be known.
  7533. The default value is 'default' (see below for its description).
  7534. Older GDB behaved as with the setting 'no'. Compilers not
  7535. supporting this feature will behave in the 'default' setting the
  7536. same way as with the 'no' setting.
  7537. This functionality is currently supported only by DWARF 2 debugging
  7538. format and the compiler has to produce 'DW_TAG_call_site' tags.
  7539. With GCC, you need to specify '-O -g' during compilation, to get
  7540. this information.
  7541. The VALUE parameter can be one of the following:
  7542. 'no'
  7543. Print only actual parameter values, never print values from
  7544. function entry point.
  7545. #0 equal (val=5)
  7546. #0 different (val=6)
  7547. #0 lost (val=<optimized out>)
  7548. #0 born (val=10)
  7549. #0 invalid (val=<optimized out>)
  7550. 'only'
  7551. Print only parameter values from function entry point. The
  7552. actual parameter values are never printed.
  7553. #0 equal (val@entry=5)
  7554. #0 different (val@entry=5)
  7555. #0 lost (val@entry=5)
  7556. #0 born (val@entry=<optimized out>)
  7557. #0 invalid (val@entry=<optimized out>)
  7558. 'preferred'
  7559. Print only parameter values from function entry point. If
  7560. value from function entry point is not known while the actual
  7561. value is known, print the actual value for such parameter.
  7562. #0 equal (val@entry=5)
  7563. #0 different (val@entry=5)
  7564. #0 lost (val@entry=5)
  7565. #0 born (val=10)
  7566. #0 invalid (val@entry=<optimized out>)
  7567. 'if-needed'
  7568. Print actual parameter values. If actual parameter value is
  7569. not known while value from function entry point is known,
  7570. print the entry point value for such parameter.
  7571. #0 equal (val=5)
  7572. #0 different (val=6)
  7573. #0 lost (val@entry=5)
  7574. #0 born (val=10)
  7575. #0 invalid (val=<optimized out>)
  7576. 'both'
  7577. Always print both the actual parameter value and its value
  7578. from function entry point, even if values of one or both are
  7579. not available due to compiler optimizations.
  7580. #0 equal (val=5, val@entry=5)
  7581. #0 different (val=6, val@entry=5)
  7582. #0 lost (val=<optimized out>, val@entry=5)
  7583. #0 born (val=10, val@entry=<optimized out>)
  7584. #0 invalid (val=<optimized out>, val@entry=<optimized out>)
  7585. 'compact'
  7586. Print the actual parameter value if it is known and also its
  7587. value from function entry point if it is known. If neither is
  7588. known, print for the actual value '<optimized out>'. If not
  7589. in MI mode (*note GDB/MI::) and if both values are known and
  7590. identical, print the shortened 'param=param@entry=VALUE'
  7591. notation.
  7592. #0 equal (val=val@entry=5)
  7593. #0 different (val=6, val@entry=5)
  7594. #0 lost (val@entry=5)
  7595. #0 born (val=10)
  7596. #0 invalid (val=<optimized out>)
  7597. 'default'
  7598. Always print the actual parameter value. Print also its value
  7599. from function entry point, but only if it is known. If not in
  7600. MI mode (*note GDB/MI::) and if both values are known and
  7601. identical, print the shortened 'param=param@entry=VALUE'
  7602. notation.
  7603. #0 equal (val=val@entry=5)
  7604. #0 different (val=6, val@entry=5)
  7605. #0 lost (val=<optimized out>, val@entry=5)
  7606. #0 born (val=10)
  7607. #0 invalid (val=<optimized out>)
  7608. For analysis messages on possible failures of frame argument values
  7609. at function entry resolution see *note set debug entry-values::.
  7610. 'show print entry-values'
  7611. Show the method being used for printing of frame argument values at
  7612. function entry.
  7613. 'set print frame-info VALUE'
  7614. This command allows to control the information printed when the
  7615. debugger prints a frame. See *note Frames::, *note Backtrace::,
  7616. for a general explanation about frames and frame information. Note
  7617. that some other settings (such as 'set print frame-arguments' and
  7618. 'set print address') are also influencing if and how some frame
  7619. information is displayed. In particular, the frame program counter
  7620. is never printed if 'set print address' is off.
  7621. The possible values for 'set print frame-info' are:
  7622. 'short-location'
  7623. Print the frame level, the program counter (if not at the
  7624. beginning of the location source line), the function, the
  7625. function arguments.
  7626. 'location'
  7627. Same as 'short-location' but also print the source file and
  7628. source line number.
  7629. 'location-and-address'
  7630. Same as 'location' but print the program counter even if
  7631. located at the beginning of the location source line.
  7632. 'source-line'
  7633. Print the program counter (if not at the beginning of the
  7634. location source line), the line number and the source line.
  7635. 'source-and-location'
  7636. Print what 'location' and 'source-line' are printing.
  7637. 'auto'
  7638. The information printed for a frame is decided automatically
  7639. by the GDB command that prints a frame. For example, 'frame'
  7640. prints the information printed by 'source-and-location' while
  7641. 'stepi' will switch between 'source-line' and
  7642. 'source-and-location' depending on the program counter. The
  7643. default value is 'auto'.
  7644. 'set print repeats NUMBER-OF-REPEATS'
  7645. 'set print repeats unlimited'
  7646. Set the threshold for suppressing display of repeated array
  7647. elements. When the number of consecutive identical elements of an
  7648. array exceeds the threshold, GDB prints the string '"<repeats N
  7649. times>"', where N is the number of identical repetitions, instead
  7650. of displaying the identical elements themselves. Setting the
  7651. threshold to 'unlimited' or zero will cause all elements to be
  7652. individually printed. The default threshold is 10.
  7653. 'show print repeats'
  7654. Display the current threshold for printing repeated identical
  7655. elements.
  7656. 'set print max-depth DEPTH'
  7657. 'set print max-depth unlimited'
  7658. Set the threshold after which nested structures are replaced with
  7659. ellipsis, this can make visualising deeply nested structures
  7660. easier.
  7661. For example, given this C code
  7662. typedef struct s1 { int a; } s1;
  7663. typedef struct s2 { s1 b; } s2;
  7664. typedef struct s3 { s2 c; } s3;
  7665. typedef struct s4 { s3 d; } s4;
  7666. s4 var = { { { { 3 } } } };
  7667. The following table shows how different values of DEPTH will effect
  7668. how 'var' is printed by GDB:
  7669. DEPTH setting Result of 'p var'
  7670. --------------------------------------------------------------------------
  7671. unlimited '$1 = {d = {c = {b = {a = 3}}}}'
  7672. '0' '$1 = {...}'
  7673. '1' '$1 = {d = {...}}'
  7674. '2' '$1 = {d = {c = {...}}}'
  7675. '3' '$1 = {d = {c = {b = {...}}}}'
  7676. '4' '$1 = {d = {c = {b = {a = 3}}}}'
  7677. To see the contents of structures that have been hidden the user
  7678. can either increase the print max-depth, or they can print the
  7679. elements of the structure that are visible, for example
  7680. (gdb) set print max-depth 2
  7681. (gdb) p var
  7682. $1 = {d = {c = {...}}}
  7683. (gdb) p var.d
  7684. $2 = {c = {b = {...}}}
  7685. (gdb) p var.d.c
  7686. $3 = {b = {a = 3}}
  7687. The pattern used to replace nested structures varies based on
  7688. language, for most languages '{...}' is used, but Fortran uses
  7689. '(...)'.
  7690. 'show print max-depth'
  7691. Display the current threshold after which nested structures are
  7692. replaces with ellipsis.
  7693. 'set print null-stop'
  7694. Cause GDB to stop printing the characters of an array when the
  7695. first NULL is encountered. This is useful when large arrays
  7696. actually contain only short strings. The default is off.
  7697. 'show print null-stop'
  7698. Show whether GDB stops printing an array on the first NULL
  7699. character.
  7700. 'set print pretty on'
  7701. Cause GDB to print structures in an indented format with one member
  7702. per line, like this:
  7703. $1 = {
  7704. next = 0x0,
  7705. flags = {
  7706. sweet = 1,
  7707. sour = 1
  7708. },
  7709. meat = 0x54 "Pork"
  7710. }
  7711. 'set print pretty off'
  7712. Cause GDB to print structures in a compact format, like this:
  7713. $1 = {next = 0x0, flags = {sweet = 1, sour = 1}, \
  7714. meat = 0x54 "Pork"}
  7715. This is the default format.
  7716. 'show print pretty'
  7717. Show which format GDB is using to print structures.
  7718. 'set print raw-values on'
  7719. Print values in raw form, without applying the pretty printers for
  7720. the value.
  7721. 'set print raw-values off'
  7722. Print values in pretty-printed form, if there is a pretty-printer
  7723. for the value (*note Pretty Printing::), otherwise print the value
  7724. in raw form.
  7725. The default setting is "off".
  7726. 'show print raw-values'
  7727. Show whether to print values in raw form.
  7728. 'set print sevenbit-strings on'
  7729. Print using only seven-bit characters; if this option is set, GDB
  7730. displays any eight-bit characters (in strings or character values)
  7731. using the notation '\'NNN. This setting is best if you are working
  7732. in English (ASCII) and you use the high-order bit of characters as
  7733. a marker or "meta" bit.
  7734. 'set print sevenbit-strings off'
  7735. Print full eight-bit characters. This allows the use of more
  7736. international character sets, and is the default.
  7737. 'show print sevenbit-strings'
  7738. Show whether or not GDB is printing only seven-bit characters.
  7739. 'set print union on'
  7740. Tell GDB to print unions which are contained in structures and
  7741. other unions. This is the default setting.
  7742. 'set print union off'
  7743. Tell GDB not to print unions which are contained in structures and
  7744. other unions. GDB will print '"{...}"' instead.
  7745. 'show print union'
  7746. Ask GDB whether or not it will print unions which are contained in
  7747. structures and other unions.
  7748. For example, given the declarations
  7749. typedef enum {Tree, Bug} Species;
  7750. typedef enum {Big_tree, Acorn, Seedling} Tree_forms;
  7751. typedef enum {Caterpillar, Cocoon, Butterfly}
  7752. Bug_forms;
  7753. struct thing {
  7754. Species it;
  7755. union {
  7756. Tree_forms tree;
  7757. Bug_forms bug;
  7758. } form;
  7759. };
  7760. struct thing foo = {Tree, {Acorn}};
  7761. with 'set print union on' in effect 'p foo' would print
  7762. $1 = {it = Tree, form = {tree = Acorn, bug = Cocoon}}
  7763. and with 'set print union off' in effect it would print
  7764. $1 = {it = Tree, form = {...}}
  7765. 'set print union' affects programs written in C-like languages and
  7766. in Pascal.
  7767. These settings are of interest when debugging C++ programs:
  7768. 'set print demangle'
  7769. 'set print demangle on'
  7770. Print C++ names in their source form rather than in the encoded
  7771. ("mangled") form passed to the assembler and linker for type-safe
  7772. linkage. The default is on.
  7773. 'show print demangle'
  7774. Show whether C++ names are printed in mangled or demangled form.
  7775. 'set print asm-demangle'
  7776. 'set print asm-demangle on'
  7777. Print C++ names in their source form rather than their mangled
  7778. form, even in assembler code printouts such as instruction
  7779. disassemblies. The default is off.
  7780. 'show print asm-demangle'
  7781. Show whether C++ names in assembly listings are printed in mangled
  7782. or demangled form.
  7783. 'set demangle-style STYLE'
  7784. Choose among several encoding schemes used by different compilers
  7785. to represent C++ names. If you omit STYLE, you will see a list of
  7786. possible formats. The default value is AUTO, which lets GDB choose
  7787. a decoding style by inspecting your program.
  7788. 'show demangle-style'
  7789. Display the encoding style currently in use for decoding C++
  7790. symbols.
  7791. 'set print object'
  7792. 'set print object on'
  7793. When displaying a pointer to an object, identify the _actual_
  7794. (derived) type of the object rather than the _declared_ type, using
  7795. the virtual function table. Note that the virtual function table
  7796. is required--this feature can only work for objects that have
  7797. run-time type identification; a single virtual method in the
  7798. object's declared type is sufficient. Note that this setting is
  7799. also taken into account when working with variable objects via MI
  7800. (*note GDB/MI::).
  7801. 'set print object off'
  7802. Display only the declared type of objects, without reference to the
  7803. virtual function table. This is the default setting.
  7804. 'show print object'
  7805. Show whether actual, or declared, object types are displayed.
  7806. 'set print static-members'
  7807. 'set print static-members on'
  7808. Print static members when displaying a C++ object. The default is
  7809. on.
  7810. 'set print static-members off'
  7811. Do not print static members when displaying a C++ object.
  7812. 'show print static-members'
  7813. Show whether C++ static members are printed or not.
  7814. 'set print pascal_static-members'
  7815. 'set print pascal_static-members on'
  7816. Print static members when displaying a Pascal object. The default
  7817. is on.
  7818. 'set print pascal_static-members off'
  7819. Do not print static members when displaying a Pascal object.
  7820. 'show print pascal_static-members'
  7821. Show whether Pascal static members are printed or not.
  7822. 'set print vtbl'
  7823. 'set print vtbl on'
  7824. Pretty print C++ virtual function tables. The default is off.
  7825. (The 'vtbl' commands do not work on programs compiled with the HP
  7826. ANSI C++ compiler ('aCC').)
  7827. 'set print vtbl off'
  7828. Do not pretty print C++ virtual function tables.
  7829. 'show print vtbl'
  7830. Show whether C++ virtual function tables are pretty printed, or
  7831. not.
  7832. 
  7833. File: gdb.info, Node: Pretty Printing, Next: Value History, Prev: Print Settings, Up: Data
  7834. 10.9 Pretty Printing
  7835. ====================
  7836. GDB provides a mechanism to allow pretty-printing of values using Python
  7837. code. It greatly simplifies the display of complex objects. This
  7838. mechanism works for both MI and the CLI.
  7839. * Menu:
  7840. * Pretty-Printer Introduction:: Introduction to pretty-printers
  7841. * Pretty-Printer Example:: An example pretty-printer
  7842. * Pretty-Printer Commands:: Pretty-printer commands
  7843. 
  7844. File: gdb.info, Node: Pretty-Printer Introduction, Next: Pretty-Printer Example, Up: Pretty Printing
  7845. 10.9.1 Pretty-Printer Introduction
  7846. ----------------------------------
  7847. When GDB prints a value, it first sees if there is a pretty-printer
  7848. registered for the value. If there is then GDB invokes the
  7849. pretty-printer to print the value. Otherwise the value is printed
  7850. normally.
  7851. Pretty-printers are normally named. This makes them easy to manage.
  7852. The 'info pretty-printer' command will list all the installed
  7853. pretty-printers with their names. If a pretty-printer can handle
  7854. multiple data types, then its "subprinters" are the printers for the
  7855. individual data types. Each such subprinter has its own name. The
  7856. format of the name is PRINTER-NAME;SUBPRINTER-NAME.
  7857. Pretty-printers are installed by "registering" them with GDB.
  7858. Typically they are automatically loaded and registered when the
  7859. corresponding debug information is loaded, thus making them available
  7860. without having to do anything special.
  7861. There are three places where a pretty-printer can be registered.
  7862. * Pretty-printers registered globally are available when debugging
  7863. all inferiors.
  7864. * Pretty-printers registered with a program space are available only
  7865. when debugging that program. *Note Progspaces In Python::, for
  7866. more details on program spaces in Python.
  7867. * Pretty-printers registered with an objfile are loaded and unloaded
  7868. with the corresponding objfile (e.g., shared library). *Note
  7869. Objfiles In Python::, for more details on objfiles in Python.
  7870. *Note Selecting Pretty-Printers::, for further information on how
  7871. pretty-printers are selected,
  7872. *Note Writing a Pretty-Printer::, for implementing pretty printers
  7873. for new types.
  7874. 
  7875. File: gdb.info, Node: Pretty-Printer Example, Next: Pretty-Printer Commands, Prev: Pretty-Printer Introduction, Up: Pretty Printing
  7876. 10.9.2 Pretty-Printer Example
  7877. -----------------------------
  7878. Here is how a C++ 'std::string' looks without a pretty-printer:
  7879. (gdb) print s
  7880. $1 = {
  7881. static npos = 4294967295,
  7882. _M_dataplus = {
  7883. <std::allocator<char>> = {
  7884. <__gnu_cxx::new_allocator<char>> = {
  7885. <No data fields>}, <No data fields>
  7886. },
  7887. members of std::basic_string<char, std::char_traits<char>,
  7888. std::allocator<char> >::_Alloc_hider:
  7889. _M_p = 0x804a014 "abcd"
  7890. }
  7891. }
  7892. With a pretty-printer for 'std::string' only the contents are
  7893. printed:
  7894. (gdb) print s
  7895. $2 = "abcd"
  7896. 
  7897. File: gdb.info, Node: Pretty-Printer Commands, Prev: Pretty-Printer Example, Up: Pretty Printing
  7898. 10.9.3 Pretty-Printer Commands
  7899. ------------------------------
  7900. 'info pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]'
  7901. Print the list of installed pretty-printers. This includes
  7902. disabled pretty-printers, which are marked as such.
  7903. OBJECT-REGEXP is a regular expression matching the objects whose
  7904. pretty-printers to list. Objects can be 'global', the program
  7905. space's file (*note Progspaces In Python::), and the object files
  7906. within that program space (*note Objfiles In Python::). *Note
  7907. Selecting Pretty-Printers::, for details on how GDB looks up a
  7908. printer from these three objects.
  7909. NAME-REGEXP is a regular expression matching the name of the
  7910. printers to list.
  7911. 'disable pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]'
  7912. Disable pretty-printers matching OBJECT-REGEXP and NAME-REGEXP. A
  7913. disabled pretty-printer is not forgotten, it may be enabled again
  7914. later.
  7915. 'enable pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]'
  7916. Enable pretty-printers matching OBJECT-REGEXP and NAME-REGEXP.
  7917. Example:
  7918. Suppose we have three pretty-printers installed: one from library1.so
  7919. named 'foo' that prints objects of type 'foo', and another from
  7920. library2.so named 'bar' that prints two types of objects, 'bar1' and
  7921. 'bar2'.
  7922. (gdb) info pretty-printer
  7923. library1.so:
  7924. foo
  7925. library2.so:
  7926. bar
  7927. bar1
  7928. bar2
  7929. (gdb) info pretty-printer library2
  7930. library2.so:
  7931. bar
  7932. bar1
  7933. bar2
  7934. (gdb) disable pretty-printer library1
  7935. 1 printer disabled
  7936. 2 of 3 printers enabled
  7937. (gdb) info pretty-printer
  7938. library1.so:
  7939. foo [disabled]
  7940. library2.so:
  7941. bar
  7942. bar1
  7943. bar2
  7944. (gdb) disable pretty-printer library2 bar;bar1
  7945. 1 printer disabled
  7946. 1 of 3 printers enabled
  7947. (gdb) info pretty-printer library2
  7948. library1.so:
  7949. foo [disabled]
  7950. library2.so:
  7951. bar
  7952. bar1 [disabled]
  7953. bar2
  7954. (gdb) disable pretty-printer library2 bar
  7955. 1 printer disabled
  7956. 0 of 3 printers enabled
  7957. (gdb) info pretty-printer library2
  7958. library1.so:
  7959. foo [disabled]
  7960. library2.so:
  7961. bar [disabled]
  7962. bar1 [disabled]
  7963. bar2
  7964. Note that for 'bar' the entire printer can be disabled, as can each
  7965. individual subprinter.
  7966. Printing values and frame arguments is done by default using the
  7967. enabled pretty printers.
  7968. The print option '-raw-values' and GDB setting 'set print raw-values'
  7969. (*note set print raw-values::) can be used to print values without
  7970. applying the enabled pretty printers.
  7971. Similarly, the backtrace option '-raw-frame-arguments' and GDB
  7972. setting 'set print raw-frame-arguments' (*note set print
  7973. raw-frame-arguments::) can be used to ignore the enabled pretty printers
  7974. when printing frame argument values.
  7975. 
  7976. File: gdb.info, Node: Value History, Next: Convenience Vars, Prev: Pretty Printing, Up: Data
  7977. 10.10 Value History
  7978. ===================
  7979. Values printed by the 'print' command are saved in the GDB "value
  7980. history". This allows you to refer to them in other expressions.
  7981. Values are kept until the symbol table is re-read or discarded (for
  7982. example with the 'file' or 'symbol-file' commands). When the symbol
  7983. table changes, the value history is discarded, since the values may
  7984. contain pointers back to the types defined in the symbol table.
  7985. The values printed are given "history numbers" by which you can refer
  7986. to them. These are successive integers starting with one. 'print'
  7987. shows you the history number assigned to a value by printing '$NUM = '
  7988. before the value; here NUM is the history number.
  7989. To refer to any previous value, use '$' followed by the value's
  7990. history number. The way 'print' labels its output is designed to remind
  7991. you of this. Just '$' refers to the most recent value in the history,
  7992. and '$$' refers to the value before that. '$$N' refers to the Nth value
  7993. from the end; '$$2' is the value just prior to '$$', '$$1' is equivalent
  7994. to '$$', and '$$0' is equivalent to '$'.
  7995. For example, suppose you have just printed a pointer to a structure
  7996. and want to see the contents of the structure. It suffices to type
  7997. p *$
  7998. If you have a chain of structures where the component 'next' points
  7999. to the next one, you can print the contents of the next one with this:
  8000. p *$.next
  8001. You can print successive links in the chain by repeating this
  8002. command--which you can do by just typing <RET>.
  8003. Note that the history records values, not expressions. If the value
  8004. of 'x' is 4 and you type these commands:
  8005. print x
  8006. set x=5
  8007. then the value recorded in the value history by the 'print' command
  8008. remains 4 even though the value of 'x' has changed.
  8009. 'show values'
  8010. Print the last ten values in the value history, with their item
  8011. numbers. This is like 'p $$9' repeated ten times, except that
  8012. 'show values' does not change the history.
  8013. 'show values N'
  8014. Print ten history values centered on history item number N.
  8015. 'show values +'
  8016. Print ten history values just after the values last printed. If no
  8017. more values are available, 'show values +' produces no display.
  8018. Pressing <RET> to repeat 'show values N' has exactly the same effect
  8019. as 'show values +'.
  8020. 
  8021. File: gdb.info, Node: Convenience Vars, Next: Convenience Funs, Prev: Value History, Up: Data
  8022. 10.11 Convenience Variables
  8023. ===========================
  8024. GDB provides "convenience variables" that you can use within GDB to hold
  8025. on to a value and refer to it later. These variables exist entirely
  8026. within GDB; they are not part of your program, and setting a convenience
  8027. variable has no direct effect on further execution of your program.
  8028. That is why you can use them freely.
  8029. Convenience variables are prefixed with '$'. Any name preceded by
  8030. '$' can be used for a convenience variable, unless it is one of the
  8031. predefined machine-specific register names (*note Registers:
  8032. Registers.). (Value history references, in contrast, are _numbers_
  8033. preceded by '$'. *Note Value History: Value History.)
  8034. You can save a value in a convenience variable with an assignment
  8035. expression, just as you would set a variable in your program. For
  8036. example:
  8037. set $foo = *object_ptr
  8038. would save in '$foo' the value contained in the object pointed to by
  8039. 'object_ptr'.
  8040. Using a convenience variable for the first time creates it, but its
  8041. value is 'void' until you assign a new value. You can alter the value
  8042. with another assignment at any time.
  8043. Convenience variables have no fixed types. You can assign a
  8044. convenience variable any type of value, including structures and arrays,
  8045. even if that variable already has a value of a different type. The
  8046. convenience variable, when used as an expression, has the type of its
  8047. current value.
  8048. 'show convenience'
  8049. Print a list of convenience variables used so far, and their
  8050. values, as well as a list of the convenience functions.
  8051. Abbreviated 'show conv'.
  8052. 'init-if-undefined $VARIABLE = EXPRESSION'
  8053. Set a convenience variable if it has not already been set. This is
  8054. useful for user-defined commands that keep some state. It is
  8055. similar, in concept, to using local static variables with
  8056. initializers in C (except that convenience variables are global).
  8057. It can also be used to allow users to override default values used
  8058. in a command script.
  8059. If the variable is already defined then the expression is not
  8060. evaluated so any side-effects do not occur.
  8061. One of the ways to use a convenience variable is as a counter to be
  8062. incremented or a pointer to be advanced. For example, to print a field
  8063. from successive elements of an array of structures:
  8064. set $i = 0
  8065. print bar[$i++]->contents
  8066. Repeat that command by typing <RET>.
  8067. Some convenience variables are created automatically by GDB and given
  8068. values likely to be useful.
  8069. '$_'
  8070. The variable '$_' is automatically set by the 'x' command to the
  8071. last address examined (*note Examining Memory: Memory.). Other
  8072. commands which provide a default address for 'x' to examine also
  8073. set '$_' to that address; these commands include 'info line' and
  8074. 'info breakpoint'. The type of '$_' is 'void *' except when set by
  8075. the 'x' command, in which case it is a pointer to the type of
  8076. '$__'.
  8077. '$__'
  8078. The variable '$__' is automatically set by the 'x' command to the
  8079. value found in the last address examined. Its type is chosen to
  8080. match the format in which the data was printed.
  8081. '$_exitcode'
  8082. When the program being debugged terminates normally, GDB
  8083. automatically sets this variable to the exit code of the program,
  8084. and resets '$_exitsignal' to 'void'.
  8085. '$_exitsignal'
  8086. When the program being debugged dies due to an uncaught signal, GDB
  8087. automatically sets this variable to that signal's number, and
  8088. resets '$_exitcode' to 'void'.
  8089. To distinguish between whether the program being debugged has
  8090. exited (i.e., '$_exitcode' is not 'void') or signalled (i.e.,
  8091. '$_exitsignal' is not 'void'), the convenience function '$_isvoid'
  8092. can be used (*note Convenience Functions: Convenience Funs.). For
  8093. example, considering the following source code:
  8094. #include <signal.h>
  8095. int
  8096. main (int argc, char *argv[])
  8097. {
  8098. raise (SIGALRM);
  8099. return 0;
  8100. }
  8101. A valid way of telling whether the program being debugged has
  8102. exited or signalled would be:
  8103. (gdb) define has_exited_or_signalled
  8104. Type commands for definition of ``has_exited_or_signalled''.
  8105. End with a line saying just ``end''.
  8106. >if $_isvoid ($_exitsignal)
  8107. >echo The program has exited\n
  8108. >else
  8109. >echo The program has signalled\n
  8110. >end
  8111. >end
  8112. (gdb) run
  8113. Starting program:
  8114. Program terminated with signal SIGALRM, Alarm clock.
  8115. The program no longer exists.
  8116. (gdb) has_exited_or_signalled
  8117. The program has signalled
  8118. As can be seen, GDB correctly informs that the program being
  8119. debugged has signalled, since it calls 'raise' and raises a
  8120. 'SIGALRM' signal. If the program being debugged had not called
  8121. 'raise', then GDB would report a normal exit:
  8122. (gdb) has_exited_or_signalled
  8123. The program has exited
  8124. '$_exception'
  8125. The variable '$_exception' is set to the exception object being
  8126. thrown at an exception-related catchpoint. *Note Set
  8127. Catchpoints::.
  8128. '$_ada_exception'
  8129. The variable '$_ada_exception' is set to the address of the
  8130. exception being caught or thrown at an Ada exception-related
  8131. catchpoint. *Note Set Catchpoints::.
  8132. '$_probe_argc'
  8133. '$_probe_arg0...$_probe_arg11'
  8134. Arguments to a static probe. *Note Static Probe Points::.
  8135. '$_sdata'
  8136. The variable '$_sdata' contains extra collected static tracepoint
  8137. data. *Note Tracepoint Action Lists: Tracepoint Actions. Note
  8138. that '$_sdata' could be empty, if not inspecting a trace buffer, or
  8139. if extra static tracepoint data has not been collected.
  8140. '$_siginfo'
  8141. The variable '$_siginfo' contains extra signal information (*note
  8142. extra signal information::). Note that '$_siginfo' could be empty,
  8143. if the application has not yet received any signals. For example,
  8144. it will be empty before you execute the 'run' command.
  8145. '$_tlb'
  8146. The variable '$_tlb' is automatically set when debugging
  8147. applications running on MS-Windows in native mode or connected to
  8148. gdbserver that supports the 'qGetTIBAddr' request. *Note General
  8149. Query Packets::. This variable contains the address of the thread
  8150. information block.
  8151. '$_inferior'
  8152. The number of the current inferior. *Note Debugging Multiple
  8153. Inferiors Connections and Programs: Inferiors Connections and
  8154. Programs.
  8155. '$_thread'
  8156. The thread number of the current thread. *Note thread numbers::.
  8157. '$_gthread'
  8158. The global number of the current thread. *Note global thread
  8159. numbers::.
  8160. '$_gdb_major'
  8161. '$_gdb_minor'
  8162. The major and minor version numbers of the running GDB.
  8163. Development snapshots and pretest versions have their minor version
  8164. incremented by one; thus, GDB pretest 9.11.90 will produce the
  8165. value 12 for '$_gdb_minor'. These variables allow you to write
  8166. scripts that work with different versions of GDB without errors
  8167. caused by features unavailable in some of those versions.
  8168. '$_shell_exitcode'
  8169. '$_shell_exitsignal'
  8170. GDB commands such as 'shell' and '|' are launching shell commands.
  8171. When a launched command terminates, GDB automatically maintains the
  8172. variables '$_shell_exitcode' and '$_shell_exitsignal' according to
  8173. the exit status of the last launched command. These variables are
  8174. set and used similarly to the variables '$_exitcode' and
  8175. '$_exitsignal'.
  8176. 
  8177. File: gdb.info, Node: Convenience Funs, Next: Registers, Prev: Convenience Vars, Up: Data
  8178. 10.12 Convenience Functions
  8179. ===========================
  8180. GDB also supplies some "convenience functions". These have a syntax
  8181. similar to convenience variables. A convenience function can be used in
  8182. an expression just like an ordinary function; however, a convenience
  8183. function is implemented internally to GDB.
  8184. These functions do not require GDB to be configured with 'Python'
  8185. support, which means that they are always available.
  8186. '$_isvoid (EXPR)'
  8187. Return one if the expression EXPR is 'void'. Otherwise it returns
  8188. zero.
  8189. A 'void' expression is an expression where the type of the result
  8190. is 'void'. For example, you can examine a convenience variable
  8191. (see *note Convenience Variables: Convenience Vars.) to check
  8192. whether it is 'void':
  8193. (gdb) print $_exitcode
  8194. $1 = void
  8195. (gdb) print $_isvoid ($_exitcode)
  8196. $2 = 1
  8197. (gdb) run
  8198. Starting program: ./a.out
  8199. [Inferior 1 (process 29572) exited normally]
  8200. (gdb) print $_exitcode
  8201. $3 = 0
  8202. (gdb) print $_isvoid ($_exitcode)
  8203. $4 = 0
  8204. In the example above, we used '$_isvoid' to check whether
  8205. '$_exitcode' is 'void' before and after the execution of the
  8206. program being debugged. Before the execution there is no exit code
  8207. to be examined, therefore '$_exitcode' is 'void'. After the
  8208. execution the program being debugged returned zero, therefore
  8209. '$_exitcode' is zero, which means that it is not 'void' anymore.
  8210. The 'void' expression can also be a call of a function from the
  8211. program being debugged. For example, given the following function:
  8212. void
  8213. foo (void)
  8214. {
  8215. }
  8216. The result of calling it inside GDB is 'void':
  8217. (gdb) print foo ()
  8218. $1 = void
  8219. (gdb) print $_isvoid (foo ())
  8220. $2 = 1
  8221. (gdb) set $v = foo ()
  8222. (gdb) print $v
  8223. $3 = void
  8224. (gdb) print $_isvoid ($v)
  8225. $4 = 1
  8226. '$_gdb_setting_str (SETTING)'
  8227. Return the value of the GDB SETTING as a string. SETTING is any
  8228. setting that can be used in a 'set' or 'show' command (*note
  8229. Controlling GDB::).
  8230. (gdb) show print frame-arguments
  8231. Printing of non-scalar frame arguments is "scalars".
  8232. (gdb) p $_gdb_setting_str("print frame-arguments")
  8233. $1 = "scalars"
  8234. (gdb) p $_gdb_setting_str("height")
  8235. $2 = "30"
  8236. (gdb)
  8237. '$_gdb_setting (SETTING)'
  8238. Return the value of the GDB SETTING. The type of the returned
  8239. value depends on the setting.
  8240. The value type for boolean and auto boolean settings is 'int'. The
  8241. boolean values 'off' and 'on' are converted to the integer values
  8242. '0' and '1'. The value 'auto' is converted to the value '-1'.
  8243. The value type for integer settings is either 'unsigned int' or
  8244. 'int', depending on the setting.
  8245. Some integer settings accept an 'unlimited' value. Depending on
  8246. the setting, the 'set' command also accepts the value '0' or the
  8247. value '-1' as a synonym for 'unlimited'. For example, 'set height
  8248. unlimited' is equivalent to 'set height 0'.
  8249. Some other settings that accept the 'unlimited' value use the value
  8250. '0' to literally mean zero. For example, 'set history size 0'
  8251. indicates to not record any GDB commands in the command history.
  8252. For such settings, '-1' is the synonym for 'unlimited'.
  8253. See the documentation of the corresponding 'set' command for the
  8254. numerical value equivalent to 'unlimited'.
  8255. The '$_gdb_setting' function converts the unlimited value to a '0'
  8256. or a '-1' value according to what the 'set' command uses.
  8257. (gdb) p $_gdb_setting_str("height")
  8258. $1 = "30"
  8259. (gdb) p $_gdb_setting("height")
  8260. $2 = 30
  8261. (gdb) set height unlimited
  8262. (gdb) p $_gdb_setting_str("height")
  8263. $3 = "unlimited"
  8264. (gdb) p $_gdb_setting("height")
  8265. $4 = 0
  8266. (gdb) p $_gdb_setting_str("history size")
  8267. $5 = "unlimited"
  8268. (gdb) p $_gdb_setting("history size")
  8269. $6 = -1
  8270. (gdb) p $_gdb_setting_str("disassemble-next-line")
  8271. $7 = "auto"
  8272. (gdb) p $_gdb_setting("disassemble-next-line")
  8273. $8 = -1
  8274. (gdb)
  8275. Other setting types (enum, filename, optional filename, string,
  8276. string noescape) are returned as string values.
  8277. '$_gdb_maint_setting_str (SETTING)'
  8278. Like the '$_gdb_setting_str' function, but works with 'maintenance
  8279. set' variables.
  8280. '$_gdb_maint_setting (SETTING)'
  8281. Like the '$_gdb_setting' function, but works with 'maintenance set'
  8282. variables.
  8283. The following functions require GDB to be configured with 'Python'
  8284. support.
  8285. '$_memeq(BUF1, BUF2, LENGTH)'
  8286. Returns one if the LENGTH bytes at the addresses given by BUF1 and
  8287. BUF2 are equal. Otherwise it returns zero.
  8288. '$_regex(STR, REGEX)'
  8289. Returns one if the string STR matches the regular expression REGEX.
  8290. Otherwise it returns zero. The syntax of the regular expression is
  8291. that specified by 'Python''s regular expression support.
  8292. '$_streq(STR1, STR2)'
  8293. Returns one if the strings STR1 and STR2 are equal. Otherwise it
  8294. returns zero.
  8295. '$_strlen(STR)'
  8296. Returns the length of string STR.
  8297. '$_caller_is(NAME[, NUMBER_OF_FRAMES])'
  8298. Returns one if the calling function's name is equal to NAME.
  8299. Otherwise it returns zero.
  8300. If the optional argument NUMBER_OF_FRAMES is provided, it is the
  8301. number of frames up in the stack to look. The default is 1.
  8302. Example:
  8303. (gdb) backtrace
  8304. #0 bottom_func ()
  8305. at testsuite/gdb.python/py-caller-is.c:21
  8306. #1 0x00000000004005a0 in middle_func ()
  8307. at testsuite/gdb.python/py-caller-is.c:27
  8308. #2 0x00000000004005ab in top_func ()
  8309. at testsuite/gdb.python/py-caller-is.c:33
  8310. #3 0x00000000004005b6 in main ()
  8311. at testsuite/gdb.python/py-caller-is.c:39
  8312. (gdb) print $_caller_is ("middle_func")
  8313. $1 = 1
  8314. (gdb) print $_caller_is ("top_func", 2)
  8315. $1 = 1
  8316. '$_caller_matches(REGEXP[, NUMBER_OF_FRAMES])'
  8317. Returns one if the calling function's name matches the regular
  8318. expression REGEXP. Otherwise it returns zero.
  8319. If the optional argument NUMBER_OF_FRAMES is provided, it is the
  8320. number of frames up in the stack to look. The default is 1.
  8321. '$_any_caller_is(NAME[, NUMBER_OF_FRAMES])'
  8322. Returns one if any calling function's name is equal to NAME.
  8323. Otherwise it returns zero.
  8324. If the optional argument NUMBER_OF_FRAMES is provided, it is the
  8325. number of frames up in the stack to look. The default is 1.
  8326. This function differs from '$_caller_is' in that this function
  8327. checks all stack frames from the immediate caller to the frame
  8328. specified by NUMBER_OF_FRAMES, whereas '$_caller_is' only checks
  8329. the frame specified by NUMBER_OF_FRAMES.
  8330. '$_any_caller_matches(REGEXP[, NUMBER_OF_FRAMES])'
  8331. Returns one if any calling function's name matches the regular
  8332. expression REGEXP. Otherwise it returns zero.
  8333. If the optional argument NUMBER_OF_FRAMES is provided, it is the
  8334. number of frames up in the stack to look. The default is 1.
  8335. This function differs from '$_caller_matches' in that this function
  8336. checks all stack frames from the immediate caller to the frame
  8337. specified by NUMBER_OF_FRAMES, whereas '$_caller_matches' only
  8338. checks the frame specified by NUMBER_OF_FRAMES.
  8339. '$_as_string(VALUE)'
  8340. Return the string representation of VALUE.
  8341. This function is useful to obtain the textual label (enumerator) of
  8342. an enumeration value. For example, assuming the variable NODE is
  8343. of an enumerated type:
  8344. (gdb) printf "Visiting node of type %s\n", $_as_string(node)
  8345. Visiting node of type NODE_INTEGER
  8346. '$_cimag(VALUE)'
  8347. '$_creal(VALUE)'
  8348. Return the imaginary ('$_cimag') or real ('$_creal') part of the
  8349. complex number VALUE.
  8350. The type of the imaginary or real part depends on the type of the
  8351. complex number, e.g., using '$_cimag' on a 'float complex' will
  8352. return an imaginary part of type 'float'.
  8353. GDB provides the ability to list and get help on convenience
  8354. functions.
  8355. 'help function'
  8356. Print a list of all convenience functions.
  8357. 
  8358. File: gdb.info, Node: Registers, Next: Floating Point Hardware, Prev: Convenience Funs, Up: Data
  8359. 10.13 Registers
  8360. ===============
  8361. You can refer to machine register contents, in expressions, as variables
  8362. with names starting with '$'. The names of registers are different for
  8363. each machine; use 'info registers' to see the names used on your
  8364. machine.
  8365. 'info registers'
  8366. Print the names and values of all registers except floating-point
  8367. and vector registers (in the selected stack frame).
  8368. 'info all-registers'
  8369. Print the names and values of all registers, including
  8370. floating-point and vector registers (in the selected stack frame).
  8371. 'info registers REGGROUP ...'
  8372. Print the name and value of the registers in each of the specified
  8373. REGGROUPs. The REGGROUP can be any of those returned by 'maint
  8374. print reggroups' (*note Maintenance Commands::).
  8375. 'info registers REGNAME ...'
  8376. Print the "relativized" value of each specified register REGNAME.
  8377. As discussed in detail below, register values are normally relative
  8378. to the selected stack frame. The REGNAME may be any register name
  8379. valid on the machine you are using, with or without the initial
  8380. '$'.
  8381. GDB has four "standard" register names that are available (in
  8382. expressions) on most machines--whenever they do not conflict with an
  8383. architecture's canonical mnemonics for registers. The register names
  8384. '$pc' and '$sp' are used for the program counter register and the stack
  8385. pointer. '$fp' is used for a register that contains a pointer to the
  8386. current stack frame, and '$ps' is used for a register that contains the
  8387. processor status. For example, you could print the program counter in
  8388. hex with
  8389. p/x $pc
  8390. or print the instruction to be executed next with
  8391. x/i $pc
  8392. or add four to the stack pointer(1) with
  8393. set $sp += 4
  8394. Whenever possible, these four standard register names are available
  8395. on your machine even though the machine has different canonical
  8396. mnemonics, so long as there is no conflict. The 'info registers'
  8397. command shows the canonical names. For example, on the SPARC, 'info
  8398. registers' displays the processor status register as '$psr' but you can
  8399. also refer to it as '$ps'; and on x86-based machines '$ps' is an alias
  8400. for the EFLAGS register.
  8401. GDB always considers the contents of an ordinary register as an
  8402. integer when the register is examined in this way. Some machines have
  8403. special registers which can hold nothing but floating point; these
  8404. registers are considered to have floating point values. There is no way
  8405. to refer to the contents of an ordinary register as floating point value
  8406. (although you can _print_ it as a floating point value with 'print/f
  8407. $REGNAME').
  8408. Some registers have distinct "raw" and "virtual" data formats. This
  8409. means that the data format in which the register contents are saved by
  8410. the operating system is not the same one that your program normally
  8411. sees. For example, the registers of the 68881 floating point
  8412. coprocessor are always saved in "extended" (raw) format, but all C
  8413. programs expect to work with "double" (virtual) format. In such cases,
  8414. GDB normally works with the virtual format only (the format that makes
  8415. sense for your program), but the 'info registers' command prints the
  8416. data in both formats.
  8417. Some machines have special registers whose contents can be
  8418. interpreted in several different ways. For example, modern x86-based
  8419. machines have SSE and MMX registers that can hold several values packed
  8420. together in several different formats. GDB refers to such registers in
  8421. 'struct' notation:
  8422. (gdb) print $xmm1
  8423. $1 = {
  8424. v4_float = {0, 3.43859137e-038, 1.54142831e-044, 1.821688e-044},
  8425. v2_double = {9.92129282474342e-303, 2.7585945287983262e-313},
  8426. v16_int8 = "\000\000\000\000\3706;\001\v\000\000\000\r\000\000",
  8427. v8_int16 = {0, 0, 14072, 315, 11, 0, 13, 0},
  8428. v4_int32 = {0, 20657912, 11, 13},
  8429. v2_int64 = {88725056443645952, 55834574859},
  8430. uint128 = 0x0000000d0000000b013b36f800000000
  8431. }
  8432. To set values of such registers, you need to tell GDB which view of the
  8433. register you wish to change, as if you were assigning value to a
  8434. 'struct' member:
  8435. (gdb) set $xmm1.uint128 = 0x000000000000000000000000FFFFFFFF
  8436. Normally, register values are relative to the selected stack frame
  8437. (*note Selecting a Frame: Selection.). This means that you get the
  8438. value that the register would contain if all stack frames farther in
  8439. were exited and their saved registers restored. In order to see the
  8440. true contents of hardware registers, you must select the innermost frame
  8441. (with 'frame 0').
  8442. Usually ABIs reserve some registers as not needed to be saved by the
  8443. callee (a.k.a.: "caller-saved", "call-clobbered" or "volatile"
  8444. registers). It may therefore not be possible for GDB to know the value
  8445. a register had before the call (in other words, in the outer frame), if
  8446. the register value has since been changed by the callee. GDB tries to
  8447. deduce where the inner frame saved ("callee-saved") registers, from the
  8448. debug info, unwind info, or the machine code generated by your compiler.
  8449. If some register is not saved, and GDB knows the register is
  8450. "caller-saved" (via its own knowledge of the ABI, or because the
  8451. debug/unwind info explicitly says the register's value is undefined),
  8452. GDB displays '<not saved>' as the register's value. With targets that
  8453. GDB has no knowledge of the register saving convention, if a register
  8454. was not saved by the callee, then its value and location in the outer
  8455. frame are assumed to be the same of the inner frame. This is usually
  8456. harmless, because if the register is call-clobbered, the caller either
  8457. does not care what is in the register after the call, or has code to
  8458. restore the value that it does care about. Note, however, that if you
  8459. change such a register in the outer frame, you may also be affecting the
  8460. inner frame. Also, the more "outer" the frame is you're looking at, the
  8461. more likely a call-clobbered register's value is to be wrong, in the
  8462. sense that it doesn't actually represent the value the register had just
  8463. before the call.
  8464. ---------- Footnotes ----------
  8465. (1) This is a way of removing one word from the stack, on machines
  8466. where stacks grow downward in memory (most machines, nowadays). This
  8467. assumes that the innermost stack frame is selected; setting '$sp' is not
  8468. allowed when other stack frames are selected. To pop entire frames off
  8469. the stack, regardless of machine architecture, use 'return'; see *note
  8470. Returning from a Function: Returning.
  8471. 
  8472. File: gdb.info, Node: Floating Point Hardware, Next: Vector Unit, Prev: Registers, Up: Data
  8473. 10.14 Floating Point Hardware
  8474. =============================
  8475. Depending on the configuration, GDB may be able to give you more
  8476. information about the status of the floating point hardware.
  8477. 'info float'
  8478. Display hardware-dependent information about the floating point
  8479. unit. The exact contents and layout vary depending on the floating
  8480. point chip. Currently, 'info float' is supported on the ARM and
  8481. x86 machines.
  8482. 
  8483. File: gdb.info, Node: Vector Unit, Next: OS Information, Prev: Floating Point Hardware, Up: Data
  8484. 10.15 Vector Unit
  8485. =================
  8486. Depending on the configuration, GDB may be able to give you more
  8487. information about the status of the vector unit.
  8488. 'info vector'
  8489. Display information about the vector unit. The exact contents and
  8490. layout vary depending on the hardware.
  8491. 
  8492. File: gdb.info, Node: OS Information, Next: Memory Region Attributes, Prev: Vector Unit, Up: Data
  8493. 10.16 Operating System Auxiliary Information
  8494. ============================================
  8495. GDB provides interfaces to useful OS facilities that can help you debug
  8496. your program.
  8497. Some operating systems supply an "auxiliary vector" to programs at
  8498. startup. This is akin to the arguments and environment that you specify
  8499. for a program, but contains a system-dependent variety of binary values
  8500. that tell system libraries important details about the hardware,
  8501. operating system, and process. Each value's purpose is identified by an
  8502. integer tag; the meanings are well-known but system-specific. Depending
  8503. on the configuration and operating system facilities, GDB may be able to
  8504. show you this information. For remote targets, this functionality may
  8505. further depend on the remote stub's support of the 'qXfer:auxv:read'
  8506. packet, see *note qXfer auxiliary vector read::.
  8507. 'info auxv'
  8508. Display the auxiliary vector of the inferior, which can be either a
  8509. live process or a core dump file. GDB prints each tag value
  8510. numerically, and also shows names and text descriptions for
  8511. recognized tags. Some values in the vector are numbers, some bit
  8512. masks, and some pointers to strings or other data. GDB displays
  8513. each value in the most appropriate form for a recognized tag, and
  8514. in hexadecimal for an unrecognized tag.
  8515. On some targets, GDB can access operating system-specific information
  8516. and show it to you. The types of information available will differ
  8517. depending on the type of operating system running on the target. The
  8518. mechanism used to fetch the data is described in *note Operating System
  8519. Information::. For remote targets, this functionality depends on the
  8520. remote stub's support of the 'qXfer:osdata:read' packet, see *note qXfer
  8521. osdata read::.
  8522. 'info os INFOTYPE'
  8523. Display OS information of the requested type.
  8524. On GNU/Linux, the following values of INFOTYPE are valid:
  8525. 'cpus'
  8526. Display the list of all CPUs/cores. For each CPU/core, GDB
  8527. prints the available fields from /proc/cpuinfo. For each
  8528. supported architecture different fields are available. Two
  8529. common entries are processor which gives CPU number and
  8530. bogomips; a system constant that is calculated during kernel
  8531. initialization.
  8532. 'files'
  8533. Display the list of open file descriptors on the target. For
  8534. each file descriptor, GDB prints the identifier of the process
  8535. owning the descriptor, the command of the owning process, the
  8536. value of the descriptor, and the target of the descriptor.
  8537. 'modules'
  8538. Display the list of all loaded kernel modules on the target.
  8539. For each module, GDB prints the module name, the size of the
  8540. module in bytes, the number of times the module is used, the
  8541. dependencies of the module, the status of the module, and the
  8542. address of the loaded module in memory.
  8543. 'msg'
  8544. Display the list of all System V message queues on the target.
  8545. For each message queue, GDB prints the message queue key, the
  8546. message queue identifier, the access permissions, the current
  8547. number of bytes on the queue, the current number of messages
  8548. on the queue, the processes that last sent and received a
  8549. message on the queue, the user and group of the owner and
  8550. creator of the message queue, the times at which a message was
  8551. last sent and received on the queue, and the time at which the
  8552. message queue was last changed.
  8553. 'processes'
  8554. Display the list of processes on the target. For each
  8555. process, GDB prints the process identifier, the name of the
  8556. user, the command corresponding to the process, and the list
  8557. of processor cores that the process is currently running on.
  8558. (To understand what these properties mean, for this and the
  8559. following info types, please consult the general GNU/Linux
  8560. documentation.)
  8561. 'procgroups'
  8562. Display the list of process groups on the target. For each
  8563. process, GDB prints the identifier of the process group that
  8564. it belongs to, the command corresponding to the process group
  8565. leader, the process identifier, and the command line of the
  8566. process. The list is sorted first by the process group
  8567. identifier, then by the process identifier, so that processes
  8568. belonging to the same process group are grouped together and
  8569. the process group leader is listed first.
  8570. 'semaphores'
  8571. Display the list of all System V semaphore sets on the target.
  8572. For each semaphore set, GDB prints the semaphore set key, the
  8573. semaphore set identifier, the access permissions, the number
  8574. of semaphores in the set, the user and group of the owner and
  8575. creator of the semaphore set, and the times at which the
  8576. semaphore set was operated upon and changed.
  8577. 'shm'
  8578. Display the list of all System V shared-memory regions on the
  8579. target. For each shared-memory region, GDB prints the region
  8580. key, the shared-memory identifier, the access permissions, the
  8581. size of the region, the process that created the region, the
  8582. process that last attached to or detached from the region, the
  8583. current number of live attaches to the region, and the times
  8584. at which the region was last attached to, detach from, and
  8585. changed.
  8586. 'sockets'
  8587. Display the list of Internet-domain sockets on the target.
  8588. For each socket, GDB prints the address and port of the local
  8589. and remote endpoints, the current state of the connection, the
  8590. creator of the socket, the IP address family of the socket,
  8591. and the type of the connection.
  8592. 'threads'
  8593. Display the list of threads running on the target. For each
  8594. thread, GDB prints the identifier of the process that the
  8595. thread belongs to, the command of the process, the thread
  8596. identifier, and the processor core that it is currently
  8597. running on. The main thread of a process is not listed.
  8598. 'info os'
  8599. If INFOTYPE is omitted, then list the possible values for INFOTYPE
  8600. and the kind of OS information available for each INFOTYPE. If the
  8601. target does not return a list of possible types, this command will
  8602. report an error.
  8603. 
  8604. File: gdb.info, Node: Memory Region Attributes, Next: Dump/Restore Files, Prev: OS Information, Up: Data
  8605. 10.17 Memory Region Attributes
  8606. ==============================
  8607. "Memory region attributes" allow you to describe special handling
  8608. required by regions of your target's memory. GDB uses attributes to
  8609. determine whether to allow certain types of memory accesses; whether to
  8610. use specific width accesses; and whether to cache target memory. By
  8611. default the description of memory regions is fetched from the target (if
  8612. the current target supports this), but the user can override the fetched
  8613. regions.
  8614. Defined memory regions can be individually enabled and disabled.
  8615. When a memory region is disabled, GDB uses the default attributes when
  8616. accessing memory in that region. Similarly, if no memory regions have
  8617. been defined, GDB uses the default attributes when accessing all memory.
  8618. When a memory region is defined, it is given a number to identify it;
  8619. to enable, disable, or remove a memory region, you specify that number.
  8620. 'mem LOWER UPPER ATTRIBUTES...'
  8621. Define a memory region bounded by LOWER and UPPER with attributes
  8622. ATTRIBUTES..., and add it to the list of regions monitored by GDB.
  8623. Note that UPPER == 0 is a special case: it is treated as the
  8624. target's maximum memory address. (0xffff on 16 bit targets,
  8625. 0xffffffff on 32 bit targets, etc.)
  8626. 'mem auto'
  8627. Discard any user changes to the memory regions and use
  8628. target-supplied regions, if available, or no regions if the target
  8629. does not support.
  8630. 'delete mem NUMS...'
  8631. Remove memory regions NUMS... from the list of regions monitored by
  8632. GDB.
  8633. 'disable mem NUMS...'
  8634. Disable monitoring of memory regions NUMS.... A disabled memory
  8635. region is not forgotten. It may be enabled again later.
  8636. 'enable mem NUMS...'
  8637. Enable monitoring of memory regions NUMS....
  8638. 'info mem'
  8639. Print a table of all defined memory regions, with the following
  8640. columns for each region:
  8641. _Memory Region Number_
  8642. _Enabled or Disabled._
  8643. Enabled memory regions are marked with 'y'. Disabled memory
  8644. regions are marked with 'n'.
  8645. _Lo Address_
  8646. The address defining the inclusive lower bound of the memory
  8647. region.
  8648. _Hi Address_
  8649. The address defining the exclusive upper bound of the memory
  8650. region.
  8651. _Attributes_
  8652. The list of attributes set for this memory region.
  8653. 10.17.1 Attributes
  8654. ------------------
  8655. 10.17.1.1 Memory Access Mode
  8656. ............................
  8657. The access mode attributes set whether GDB may make read or write
  8658. accesses to a memory region.
  8659. While these attributes prevent GDB from performing invalid memory
  8660. accesses, they do nothing to prevent the target system, I/O DMA, etc.
  8661. from accessing memory.
  8662. 'ro'
  8663. Memory is read only.
  8664. 'wo'
  8665. Memory is write only.
  8666. 'rw'
  8667. Memory is read/write. This is the default.
  8668. 10.17.1.2 Memory Access Size
  8669. ............................
  8670. The access size attribute tells GDB to use specific sized accesses in
  8671. the memory region. Often memory mapped device registers require
  8672. specific sized accesses. If no access size attribute is specified, GDB
  8673. may use accesses of any size.
  8674. '8'
  8675. Use 8 bit memory accesses.
  8676. '16'
  8677. Use 16 bit memory accesses.
  8678. '32'
  8679. Use 32 bit memory accesses.
  8680. '64'
  8681. Use 64 bit memory accesses.
  8682. 10.17.1.3 Data Cache
  8683. ....................
  8684. The data cache attributes set whether GDB will cache target memory.
  8685. While this generally improves performance by reducing debug protocol
  8686. overhead, it can lead to incorrect results because GDB does not know
  8687. about volatile variables or memory mapped device registers.
  8688. 'cache'
  8689. Enable GDB to cache target memory.
  8690. 'nocache'
  8691. Disable GDB from caching target memory. This is the default.
  8692. 10.17.2 Memory Access Checking
  8693. ------------------------------
  8694. GDB can be instructed to refuse accesses to memory that is not
  8695. explicitly described. This can be useful if accessing such regions has
  8696. undesired effects for a specific target, or to provide better error
  8697. checking. The following commands control this behaviour.
  8698. 'set mem inaccessible-by-default [on|off]'
  8699. If 'on' is specified, make GDB treat memory not explicitly
  8700. described by the memory ranges as non-existent and refuse accesses
  8701. to such memory. The checks are only performed if there's at least
  8702. one memory range defined. If 'off' is specified, make GDB treat
  8703. the memory not explicitly described by the memory ranges as RAM.
  8704. The default value is 'on'.
  8705. 'show mem inaccessible-by-default'
  8706. Show the current handling of accesses to unknown memory.
  8707. 
  8708. File: gdb.info, Node: Dump/Restore Files, Next: Core File Generation, Prev: Memory Region Attributes, Up: Data
  8709. 10.18 Copy Between Memory and a File
  8710. ====================================
  8711. You can use the commands 'dump', 'append', and 'restore' to copy data
  8712. between target memory and a file. The 'dump' and 'append' commands
  8713. write data to a file, and the 'restore' command reads data from a file
  8714. back into the inferior's memory. Files may be in binary, Motorola
  8715. S-record, Intel hex, Tektronix Hex, or Verilog Hex format; however, GDB
  8716. can only append to binary files, and cannot read from Verilog Hex files.
  8717. 'dump [FORMAT] memory FILENAME START_ADDR END_ADDR'
  8718. 'dump [FORMAT] value FILENAME EXPR'
  8719. Dump the contents of memory from START_ADDR to END_ADDR, or the
  8720. value of EXPR, to FILENAME in the given format.
  8721. The FORMAT parameter may be any one of:
  8722. 'binary'
  8723. Raw binary form.
  8724. 'ihex'
  8725. Intel hex format.
  8726. 'srec'
  8727. Motorola S-record format.
  8728. 'tekhex'
  8729. Tektronix Hex format.
  8730. 'verilog'
  8731. Verilog Hex format.
  8732. GDB uses the same definitions of these formats as the GNU binary
  8733. utilities, like 'objdump' and 'objcopy'. If FORMAT is omitted, GDB
  8734. dumps the data in raw binary form.
  8735. 'append [binary] memory FILENAME START_ADDR END_ADDR'
  8736. 'append [binary] value FILENAME EXPR'
  8737. Append the contents of memory from START_ADDR to END_ADDR, or the
  8738. value of EXPR, to the file FILENAME, in raw binary form. (GDB can
  8739. only append data to files in raw binary form.)
  8740. 'restore FILENAME [binary] BIAS START END'
  8741. Restore the contents of file FILENAME into memory. The 'restore'
  8742. command can automatically recognize any known BFD file format,
  8743. except for raw binary. To restore a raw binary file you must
  8744. specify the optional keyword 'binary' after the filename.
  8745. If BIAS is non-zero, its value will be added to the addresses
  8746. contained in the file. Binary files always start at address zero,
  8747. so they will be restored at address BIAS. Other bfd files have a
  8748. built-in location; they will be restored at offset BIAS from that
  8749. location.
  8750. If START and/or END are non-zero, then only data between file
  8751. offset START and file offset END will be restored. These offsets
  8752. are relative to the addresses in the file, before the BIAS argument
  8753. is applied.
  8754. 
  8755. File: gdb.info, Node: Core File Generation, Next: Character Sets, Prev: Dump/Restore Files, Up: Data
  8756. 10.19 How to Produce a Core File from Your Program
  8757. ==================================================
  8758. A "core file" or "core dump" is a file that records the memory image of
  8759. a running process and its process status (register values etc.). Its
  8760. primary use is post-mortem debugging of a program that crashed while it
  8761. ran outside a debugger. A program that crashes automatically produces a
  8762. core file, unless this feature is disabled by the user. *Note Files::,
  8763. for information on invoking GDB in the post-mortem debugging mode.
  8764. Occasionally, you may wish to produce a core file of the program you
  8765. are debugging in order to preserve a snapshot of its state. GDB has a
  8766. special command for that.
  8767. 'generate-core-file [FILE]'
  8768. 'gcore [FILE]'
  8769. Produce a core dump of the inferior process. The optional argument
  8770. FILE specifies the file name where to put the core dump. If not
  8771. specified, the file name defaults to 'core.PID', where PID is the
  8772. inferior process ID.
  8773. Note that this command is implemented only for some systems (as of
  8774. this writing, GNU/Linux, FreeBSD, Solaris, and S390).
  8775. On GNU/Linux, this command can take into account the value of the
  8776. file '/proc/PID/coredump_filter' when generating the core dump
  8777. (*note set use-coredump-filter::), and by default honors the
  8778. 'VM_DONTDUMP' flag for mappings where it is present in the file
  8779. '/proc/PID/smaps' (*note set dump-excluded-mappings::).
  8780. 'set use-coredump-filter on'
  8781. 'set use-coredump-filter off'
  8782. Enable or disable the use of the file '/proc/PID/coredump_filter'
  8783. when generating core dump files. This file is used by the Linux
  8784. kernel to decide what types of memory mappings will be dumped or
  8785. ignored when generating a core dump file. PID is the process ID of
  8786. a currently running process.
  8787. To make use of this feature, you have to write in the
  8788. '/proc/PID/coredump_filter' file a value, in hexadecimal, which is
  8789. a bit mask representing the memory mapping types. If a bit is set
  8790. in the bit mask, then the memory mappings of the corresponding
  8791. types will be dumped; otherwise, they will be ignored. This
  8792. configuration is inherited by child processes. For more
  8793. information about the bits that can be set in the
  8794. '/proc/PID/coredump_filter' file, please refer to the manpage of
  8795. 'core(5)'.
  8796. By default, this option is 'on'. If this option is turned 'off',
  8797. GDB does not read the 'coredump_filter' file and instead uses the
  8798. same default value as the Linux kernel in order to decide which
  8799. pages will be dumped in the core dump file. This value is
  8800. currently '0x33', which means that bits '0' (anonymous private
  8801. mappings), '1' (anonymous shared mappings), '4' (ELF headers) and
  8802. '5' (private huge pages) are active. This will cause these memory
  8803. mappings to be dumped automatically.
  8804. 'set dump-excluded-mappings on'
  8805. 'set dump-excluded-mappings off'
  8806. If 'on' is specified, GDB will dump memory mappings marked with the
  8807. 'VM_DONTDUMP' flag. This flag is represented in the file
  8808. '/proc/PID/smaps' with the acronym 'dd'.
  8809. The default value is 'off'.
  8810. 
  8811. File: gdb.info, Node: Character Sets, Next: Caching Target Data, Prev: Core File Generation, Up: Data
  8812. 10.20 Character Sets
  8813. ====================
  8814. If the program you are debugging uses a different character set to
  8815. represent characters and strings than the one GDB uses itself, GDB can
  8816. automatically translate between the character sets for you. The
  8817. character set GDB uses we call the "host character set"; the one the
  8818. inferior program uses we call the "target character set".
  8819. For example, if you are running GDB on a GNU/Linux system, which uses
  8820. the ISO Latin 1 character set, but you are using GDB's remote protocol
  8821. (*note Remote Debugging::) to debug a program running on an IBM
  8822. mainframe, which uses the EBCDIC character set, then the host character
  8823. set is Latin-1, and the target character set is EBCDIC. If you give GDB
  8824. the command 'set target-charset EBCDIC-US', then GDB translates between
  8825. EBCDIC and Latin 1 as you print character or string values, or use
  8826. character and string literals in expressions.
  8827. GDB has no way to automatically recognize which character set the
  8828. inferior program uses; you must tell it, using the 'set target-charset'
  8829. command, described below.
  8830. Here are the commands for controlling GDB's character set support:
  8831. 'set target-charset CHARSET'
  8832. Set the current target character set to CHARSET. To display the
  8833. list of supported target character sets, type
  8834. 'set target-charset <TAB><TAB>'.
  8835. 'set host-charset CHARSET'
  8836. Set the current host character set to CHARSET.
  8837. By default, GDB uses a host character set appropriate to the system
  8838. it is running on; you can override that default using the 'set
  8839. host-charset' command. On some systems, GDB cannot automatically
  8840. determine the appropriate host character set. In this case, GDB
  8841. uses 'UTF-8'.
  8842. GDB can only use certain character sets as its host character set.
  8843. If you type 'set host-charset <TAB><TAB>', GDB will list the host
  8844. character sets it supports.
  8845. 'set charset CHARSET'
  8846. Set the current host and target character sets to CHARSET. As
  8847. above, if you type 'set charset <TAB><TAB>', GDB will list the
  8848. names of the character sets that can be used for both host and
  8849. target.
  8850. 'show charset'
  8851. Show the names of the current host and target character sets.
  8852. 'show host-charset'
  8853. Show the name of the current host character set.
  8854. 'show target-charset'
  8855. Show the name of the current target character set.
  8856. 'set target-wide-charset CHARSET'
  8857. Set the current target's wide character set to CHARSET. This is
  8858. the character set used by the target's 'wchar_t' type. To display
  8859. the list of supported wide character sets, type
  8860. 'set target-wide-charset <TAB><TAB>'.
  8861. 'show target-wide-charset'
  8862. Show the name of the current target's wide character set.
  8863. Here is an example of GDB's character set support in action. Assume
  8864. that the following source code has been placed in the file
  8865. 'charset-test.c':
  8866. #include <stdio.h>
  8867. char ascii_hello[]
  8868. = {72, 101, 108, 108, 111, 44, 32, 119,
  8869. 111, 114, 108, 100, 33, 10, 0};
  8870. char ibm1047_hello[]
  8871. = {200, 133, 147, 147, 150, 107, 64, 166,
  8872. 150, 153, 147, 132, 90, 37, 0};
  8873. main ()
  8874. {
  8875. printf ("Hello, world!\n");
  8876. }
  8877. In this program, 'ascii_hello' and 'ibm1047_hello' are arrays
  8878. containing the string 'Hello, world!' followed by a newline, encoded in
  8879. the ASCII and IBM1047 character sets.
  8880. We compile the program, and invoke the debugger on it:
  8881. $ gcc -g charset-test.c -o charset-test
  8882. $ gdb -nw charset-test
  8883. GNU gdb 2001-12-19-cvs
  8884. Copyright 2001 Free Software Foundation, Inc.
  8885. ...
  8886. (gdb)
  8887. We can use the 'show charset' command to see what character sets GDB
  8888. is currently using to interpret and display characters and strings:
  8889. (gdb) show charset
  8890. The current host and target character set is `ISO-8859-1'.
  8891. (gdb)
  8892. For the sake of printing this manual, let's use ASCII as our initial
  8893. character set:
  8894. (gdb) set charset ASCII
  8895. (gdb) show charset
  8896. The current host and target character set is `ASCII'.
  8897. (gdb)
  8898. Let's assume that ASCII is indeed the correct character set for our
  8899. host system -- in other words, let's assume that if GDB prints
  8900. characters using the ASCII character set, our terminal will display them
  8901. properly. Since our current target character set is also ASCII, the
  8902. contents of 'ascii_hello' print legibly:
  8903. (gdb) print ascii_hello
  8904. $1 = 0x401698 "Hello, world!\n"
  8905. (gdb) print ascii_hello[0]
  8906. $2 = 72 'H'
  8907. (gdb)
  8908. GDB uses the target character set for character and string literals
  8909. you use in expressions:
  8910. (gdb) print '+'
  8911. $3 = 43 '+'
  8912. (gdb)
  8913. The ASCII character set uses the number 43 to encode the '+'
  8914. character.
  8915. GDB relies on the user to tell it which character set the target
  8916. program uses. If we print 'ibm1047_hello' while our target character
  8917. set is still ASCII, we get jibberish:
  8918. (gdb) print ibm1047_hello
  8919. $4 = 0x4016a8 "\310\205\223\223\226k@\246\226\231\223\204Z%"
  8920. (gdb) print ibm1047_hello[0]
  8921. $5 = 200 '\310'
  8922. (gdb)
  8923. If we invoke the 'set target-charset' followed by <TAB><TAB>, GDB
  8924. tells us the character sets it supports:
  8925. (gdb) set target-charset
  8926. ASCII EBCDIC-US IBM1047 ISO-8859-1
  8927. (gdb) set target-charset
  8928. We can select IBM1047 as our target character set, and examine the
  8929. program's strings again. Now the ASCII string is wrong, but GDB
  8930. translates the contents of 'ibm1047_hello' from the target character
  8931. set, IBM1047, to the host character set, ASCII, and they display
  8932. correctly:
  8933. (gdb) set target-charset IBM1047
  8934. (gdb) show charset
  8935. The current host character set is `ASCII'.
  8936. The current target character set is `IBM1047'.
  8937. (gdb) print ascii_hello
  8938. $6 = 0x401698 "\110\145%%?\054\040\167?\162%\144\041\012"
  8939. (gdb) print ascii_hello[0]
  8940. $7 = 72 '\110'
  8941. (gdb) print ibm1047_hello
  8942. $8 = 0x4016a8 "Hello, world!\n"
  8943. (gdb) print ibm1047_hello[0]
  8944. $9 = 200 'H'
  8945. (gdb)
  8946. As above, GDB uses the target character set for character and string
  8947. literals you use in expressions:
  8948. (gdb) print '+'
  8949. $10 = 78 '+'
  8950. (gdb)
  8951. The IBM1047 character set uses the number 78 to encode the '+'
  8952. character.
  8953. 
  8954. File: gdb.info, Node: Caching Target Data, Next: Searching Memory, Prev: Character Sets, Up: Data
  8955. 10.21 Caching Data of Targets
  8956. =============================
  8957. GDB caches data exchanged between the debugger and a target. Each cache
  8958. is associated with the address space of the inferior. *Note Inferiors
  8959. Connections and Programs::, about inferior and address space. Such
  8960. caching generally improves performance in remote debugging (*note Remote
  8961. Debugging::), because it reduces the overhead of the remote protocol by
  8962. bundling memory reads and writes into large chunks. Unfortunately,
  8963. simply caching everything would lead to incorrect results, since GDB
  8964. does not necessarily know anything about volatile values, memory-mapped
  8965. I/O addresses, etc. Furthermore, in non-stop mode (*note Non-Stop
  8966. Mode::) memory can be changed _while_ a gdb command is executing.
  8967. Therefore, by default, GDB only caches data known to be on the stack(1)
  8968. or in the code segment. Other regions of memory can be explicitly
  8969. marked as cacheable; *note Memory Region Attributes::.
  8970. 'set remotecache on'
  8971. 'set remotecache off'
  8972. This option no longer does anything; it exists for compatibility
  8973. with old scripts.
  8974. 'show remotecache'
  8975. Show the current state of the obsolete remotecache flag.
  8976. 'set stack-cache on'
  8977. 'set stack-cache off'
  8978. Enable or disable caching of stack accesses. When 'on', use
  8979. caching. By default, this option is 'on'.
  8980. 'show stack-cache'
  8981. Show the current state of data caching for memory accesses.
  8982. 'set code-cache on'
  8983. 'set code-cache off'
  8984. Enable or disable caching of code segment accesses. When 'on', use
  8985. caching. By default, this option is 'on'. This improves
  8986. performance of disassembly in remote debugging.
  8987. 'show code-cache'
  8988. Show the current state of target memory cache for code segment
  8989. accesses.
  8990. 'info dcache [line]'
  8991. Print the information about the performance of data cache of the
  8992. current inferior's address space. The information displayed
  8993. includes the dcache width and depth, and for each cache line, its
  8994. number, address, and how many times it was referenced. This
  8995. command is useful for debugging the data cache operation.
  8996. If a line number is specified, the contents of that line will be
  8997. printed in hex.
  8998. 'set dcache size SIZE'
  8999. Set maximum number of entries in dcache (dcache depth above).
  9000. 'set dcache line-size LINE-SIZE'
  9001. Set number of bytes each dcache entry caches (dcache width above).
  9002. Must be a power of 2.
  9003. 'show dcache size'
  9004. Show maximum number of dcache entries. *Note info dcache: Caching
  9005. Target Data.
  9006. 'show dcache line-size'
  9007. Show default size of dcache lines.
  9008. ---------- Footnotes ----------
  9009. (1) In non-stop mode, it is moderately rare for a running thread to
  9010. modify the stack of a stopped thread in a way that would interfere with
  9011. a backtrace, and caching of stack reads provides a significant speed up
  9012. of remote backtraces.
  9013. 
  9014. File: gdb.info, Node: Searching Memory, Next: Value Sizes, Prev: Caching Target Data, Up: Data
  9015. 10.22 Search Memory
  9016. ===================
  9017. Memory can be searched for a particular sequence of bytes with the
  9018. 'find' command.
  9019. 'find [/SN] START_ADDR, +LEN, VAL1 [, VAL2, ...]'
  9020. 'find [/SN] START_ADDR, END_ADDR, VAL1 [, VAL2, ...]'
  9021. Search memory for the sequence of bytes specified by VAL1, VAL2,
  9022. etc. The search begins at address START_ADDR and continues for
  9023. either LEN bytes or through to END_ADDR inclusive.
  9024. S and N are optional parameters. They may be specified in either
  9025. order, apart or together.
  9026. S, search query size
  9027. The size of each search query value.
  9028. 'b'
  9029. bytes
  9030. 'h'
  9031. halfwords (two bytes)
  9032. 'w'
  9033. words (four bytes)
  9034. 'g'
  9035. giant words (eight bytes)
  9036. All values are interpreted in the current language. This means,
  9037. for example, that if the current source language is C/C++ then
  9038. searching for the string "hello" includes the trailing '\0'. The
  9039. null terminator can be removed from searching by using casts, e.g.:
  9040. '{char[5]}"hello"'.
  9041. If the value size is not specified, it is taken from the value's
  9042. type in the current language. This is useful when one wants to
  9043. specify the search pattern as a mixture of types. Note that this
  9044. means, for example, that in the case of C-like languages a search
  9045. for an untyped 0x42 will search for '(int) 0x42' which is typically
  9046. four bytes.
  9047. N, maximum number of finds
  9048. The maximum number of matches to print. The default is to print
  9049. all finds.
  9050. You can use strings as search values. Quote them with double-quotes
  9051. ('"'). The string value is copied into the search pattern byte by byte,
  9052. regardless of the endianness of the target and the size specification.
  9053. The address of each match found is printed as well as a count of the
  9054. number of matches found.
  9055. The address of the last value found is stored in convenience variable
  9056. '$_'. A count of the number of matches is stored in '$numfound'.
  9057. For example, if stopped at the 'printf' in this function:
  9058. void
  9059. hello ()
  9060. {
  9061. static char hello[] = "hello-hello";
  9062. static struct { char c; short s; int i; }
  9063. __attribute__ ((packed)) mixed
  9064. = { 'c', 0x1234, 0x87654321 };
  9065. printf ("%s\n", hello);
  9066. }
  9067. you get during debugging:
  9068. (gdb) find &hello[0], +sizeof(hello), "hello"
  9069. 0x804956d <hello.1620+6>
  9070. 1 pattern found
  9071. (gdb) find &hello[0], +sizeof(hello), 'h', 'e', 'l', 'l', 'o'
  9072. 0x8049567 <hello.1620>
  9073. 0x804956d <hello.1620+6>
  9074. 2 patterns found.
  9075. (gdb) find &hello[0], +sizeof(hello), {char[5]}"hello"
  9076. 0x8049567 <hello.1620>
  9077. 0x804956d <hello.1620+6>
  9078. 2 patterns found.
  9079. (gdb) find /b1 &hello[0], +sizeof(hello), 'h', 0x65, 'l'
  9080. 0x8049567 <hello.1620>
  9081. 1 pattern found
  9082. (gdb) find &mixed, +sizeof(mixed), (char) 'c', (short) 0x1234, (int) 0x87654321
  9083. 0x8049560 <mixed.1625>
  9084. 1 pattern found
  9085. (gdb) print $numfound
  9086. $1 = 1
  9087. (gdb) print $_
  9088. $2 = (void *) 0x8049560
  9089. 
  9090. File: gdb.info, Node: Value Sizes, Prev: Searching Memory, Up: Data
  9091. 10.23 Value Sizes
  9092. =================
  9093. Whenever GDB prints a value memory will be allocated within GDB to hold
  9094. the contents of the value. It is possible in some languages with
  9095. dynamic typing systems, that an invalid program may indicate a value
  9096. that is incorrectly large, this in turn may cause GDB to try and
  9097. allocate an overly large amount of memory.
  9098. 'set max-value-size BYTES'
  9099. 'set max-value-size unlimited'
  9100. Set the maximum size of memory that GDB will allocate for the
  9101. contents of a value to BYTES, trying to display a value that
  9102. requires more memory than that will result in an error.
  9103. Setting this variable does not effect values that have already been
  9104. allocated within GDB, only future allocations.
  9105. There's a minimum size that 'max-value-size' can be set to in order
  9106. that GDB can still operate correctly, this minimum is currently 16
  9107. bytes.
  9108. The limit applies to the results of some subexpressions as well as
  9109. to complete expressions. For example, an expression denoting a
  9110. simple integer component, such as 'x.y.z', may fail if the size of
  9111. X.Y is dynamic and exceeds BYTES. On the other hand, GDB is
  9112. sometimes clever; the expression 'A[i]', where A is an array
  9113. variable with non-constant size, will generally succeed regardless
  9114. of the bounds on A, as long as the component size is less than
  9115. BYTES.
  9116. The default value of 'max-value-size' is currently 64k.
  9117. 'show max-value-size'
  9118. Show the maximum size of memory, in bytes, that GDB will allocate
  9119. for the contents of a value.
  9120. 
  9121. File: gdb.info, Node: Optimized Code, Next: Macros, Prev: Data, Up: Top
  9122. 11 Debugging Optimized Code
  9123. ***************************
  9124. Almost all compilers support optimization. With optimization disabled,
  9125. the compiler generates assembly code that corresponds directly to your
  9126. source code, in a simplistic way. As the compiler applies more powerful
  9127. optimizations, the generated assembly code diverges from your original
  9128. source code. With help from debugging information generated by the
  9129. compiler, GDB can map from the running program back to constructs from
  9130. your original source.
  9131. GDB is more accurate with optimization disabled. If you can
  9132. recompile without optimization, it is easier to follow the progress of
  9133. your program during debugging. But, there are many cases where you may
  9134. need to debug an optimized version.
  9135. When you debug a program compiled with '-g -O', remember that the
  9136. optimizer has rearranged your code; the debugger shows you what is
  9137. really there. Do not be too surprised when the execution path does not
  9138. exactly match your source file! An extreme example: if you define a
  9139. variable, but never use it, GDB never sees that variable--because the
  9140. compiler optimizes it out of existence.
  9141. Some things do not work as well with '-g -O' as with just '-g',
  9142. particularly on machines with instruction scheduling. If in doubt,
  9143. recompile with '-g' alone, and if this fixes the problem, please report
  9144. it to us as a bug (including a test case!). *Note Variables::, for more
  9145. information about debugging optimized code.
  9146. * Menu:
  9147. * Inline Functions:: How GDB presents inlining
  9148. * Tail Call Frames:: GDB analysis of jumps to functions
  9149. 
  9150. File: gdb.info, Node: Inline Functions, Next: Tail Call Frames, Up: Optimized Code
  9151. 11.1 Inline Functions
  9152. =====================
  9153. "Inlining" is an optimization that inserts a copy of the function body
  9154. directly at each call site, instead of jumping to a shared routine. GDB
  9155. displays inlined functions just like non-inlined functions. They appear
  9156. in backtraces. You can view their arguments and local variables, step
  9157. into them with 'step', skip them with 'next', and escape from them with
  9158. 'finish'. You can check whether a function was inlined by using the
  9159. 'info frame' command.
  9160. For GDB to support inlined functions, the compiler must record
  9161. information about inlining in the debug information -- GCC using the
  9162. DWARF 2 format does this, and several other compilers do also. GDB only
  9163. supports inlined functions when using DWARF 2. Versions of GCC before
  9164. 4.1 do not emit two required attributes ('DW_AT_call_file' and
  9165. 'DW_AT_call_line'); GDB does not display inlined function calls with
  9166. earlier versions of GCC. It instead displays the arguments and local
  9167. variables of inlined functions as local variables in the caller.
  9168. The body of an inlined function is directly included at its call
  9169. site; unlike a non-inlined function, there are no instructions devoted
  9170. to the call. GDB still pretends that the call site and the start of the
  9171. inlined function are different instructions. Stepping to the call site
  9172. shows the call site, and then stepping again shows the first line of the
  9173. inlined function, even though no additional instructions are executed.
  9174. This makes source-level debugging much clearer; you can see both the
  9175. context of the call and then the effect of the call. Only stepping by a
  9176. single instruction using 'stepi' or 'nexti' does not do this; single
  9177. instruction steps always show the inlined body.
  9178. There are some ways that GDB does not pretend that inlined function
  9179. calls are the same as normal calls:
  9180. * Setting breakpoints at the call site of an inlined function may not
  9181. work, because the call site does not contain any code. GDB may
  9182. incorrectly move the breakpoint to the next line of the enclosing
  9183. function, after the call. This limitation will be removed in a
  9184. future version of GDB; until then, set a breakpoint on an earlier
  9185. line or inside the inlined function instead.
  9186. * GDB cannot locate the return value of inlined calls after using the
  9187. 'finish' command. This is a limitation of compiler-generated
  9188. debugging information; after 'finish', you can step to the next
  9189. line and print a variable where your program stored the return
  9190. value.
  9191. 
  9192. File: gdb.info, Node: Tail Call Frames, Prev: Inline Functions, Up: Optimized Code
  9193. 11.2 Tail Call Frames
  9194. =====================
  9195. Function 'B' can call function 'C' in its very last statement. In
  9196. unoptimized compilation the call of 'C' is immediately followed by
  9197. return instruction at the end of 'B' code. Optimizing compiler may
  9198. replace the call and return in function 'B' into one jump to function
  9199. 'C' instead. Such use of a jump instruction is called "tail call".
  9200. During execution of function 'C', there will be no indication in the
  9201. function call stack frames that it was tail-called from 'B'. If
  9202. function 'A' regularly calls function 'B' which tail-calls function 'C',
  9203. then GDB will see 'A' as the caller of 'C'. However, in some cases GDB
  9204. can determine that 'C' was tail-called from 'B', and it will then create
  9205. fictitious call frame for that, with the return address set up as if 'B'
  9206. called 'C' normally.
  9207. This functionality is currently supported only by DWARF 2 debugging
  9208. format and the compiler has to produce 'DW_TAG_call_site' tags. With
  9209. GCC, you need to specify '-O -g' during compilation, to get this
  9210. information.
  9211. 'info frame' command (*note Frame Info::) will indicate the tail call
  9212. frame kind by text 'tail call frame' such as in this sample GDB output:
  9213. (gdb) x/i $pc - 2
  9214. 0x40066b <b(int, double)+11>: jmp 0x400640 <c(int, double)>
  9215. (gdb) info frame
  9216. Stack level 1, frame at 0x7fffffffda30:
  9217. rip = 0x40066d in b (amd64-entry-value.cc:59); saved rip 0x4004c5
  9218. tail call frame, caller of frame at 0x7fffffffda30
  9219. source language c++.
  9220. Arglist at unknown address.
  9221. Locals at unknown address, Previous frame's sp is 0x7fffffffda30
  9222. The detection of all the possible code path executions can find them
  9223. ambiguous. There is no execution history stored (possible *note Reverse
  9224. Execution:: is never used for this purpose) and the last known caller
  9225. could have reached the known callee by multiple different jump
  9226. sequences. In such case GDB still tries to show at least all the
  9227. unambiguous top tail callers and all the unambiguous bottom tail calees,
  9228. if any.
  9229. 'set debug entry-values'
  9230. When set to on, enables printing of analysis messages for both
  9231. frame argument values at function entry and tail calls. It will
  9232. show all the possible valid tail calls code paths it has
  9233. considered. It will also print the intersection of them with the
  9234. final unambiguous (possibly partial or even empty) code path
  9235. result.
  9236. 'show debug entry-values'
  9237. Show the current state of analysis messages printing for both frame
  9238. argument values at function entry and tail calls.
  9239. The analysis messages for tail calls can for example show why the
  9240. virtual tail call frame for function 'c' has not been recognized (due to
  9241. the indirect reference by variable 'x'):
  9242. static void __attribute__((noinline, noclone)) c (void);
  9243. void (*x) (void) = c;
  9244. static void __attribute__((noinline, noclone)) a (void) { x++; }
  9245. static void __attribute__((noinline, noclone)) c (void) { a (); }
  9246. int main (void) { x (); return 0; }
  9247. Breakpoint 1, DW_OP_entry_value resolving cannot find
  9248. DW_TAG_call_site 0x40039a in main
  9249. a () at t.c:3
  9250. 3 static void __attribute__((noinline, noclone)) a (void) { x++; }
  9251. (gdb) bt
  9252. #0 a () at t.c:3
  9253. #1 0x000000000040039a in main () at t.c:5
  9254. Another possibility is an ambiguous virtual tail call frames
  9255. resolution:
  9256. int i;
  9257. static void __attribute__((noinline, noclone)) f (void) { i++; }
  9258. static void __attribute__((noinline, noclone)) e (void) { f (); }
  9259. static void __attribute__((noinline, noclone)) d (void) { f (); }
  9260. static void __attribute__((noinline, noclone)) c (void) { d (); }
  9261. static void __attribute__((noinline, noclone)) b (void)
  9262. { if (i) c (); else e (); }
  9263. static void __attribute__((noinline, noclone)) a (void) { b (); }
  9264. int main (void) { a (); return 0; }
  9265. tailcall: initial: 0x4004d2(a) 0x4004ce(b) 0x4004b2(c) 0x4004a2(d)
  9266. tailcall: compare: 0x4004d2(a) 0x4004cc(b) 0x400492(e)
  9267. tailcall: reduced: 0x4004d2(a) |
  9268. (gdb) bt
  9269. #0 f () at t.c:2
  9270. #1 0x00000000004004d2 in a () at t.c:8
  9271. #2 0x0000000000400395 in main () at t.c:9
  9272. Frames #0 and #2 are real, #1 is a virtual tail call frame. The code
  9273. can have possible execution paths 'main->a->b->c->d->f' or
  9274. 'main->a->b->e->f', GDB cannot find which one from the inferior state.
  9275. 'initial:' state shows some random possible calling sequence GDB has
  9276. found. It then finds another possible calling sequence - that one is
  9277. prefixed by 'compare:'. The non-ambiguous intersection of these two is
  9278. printed as the 'reduced:' calling sequence. That one could have many
  9279. further 'compare:' and 'reduced:' statements as long as there remain any
  9280. non-ambiguous sequence entries.
  9281. For the frame of function 'b' in both cases there are different
  9282. possible '$pc' values ('0x4004cc' or '0x4004ce'), therefore this frame
  9283. is also ambiguous. The only non-ambiguous frame is the one for function
  9284. 'a', therefore this one is displayed to the user while the ambiguous
  9285. frames are omitted.
  9286. There can be also reasons why printing of frame argument values at
  9287. function entry may fail:
  9288. int v;
  9289. static void __attribute__((noinline, noclone)) c (int i) { v++; }
  9290. static void __attribute__((noinline, noclone)) a (int i);
  9291. static void __attribute__((noinline, noclone)) b (int i) { a (i); }
  9292. static void __attribute__((noinline, noclone)) a (int i)
  9293. { if (i) b (i - 1); else c (0); }
  9294. int main (void) { a (5); return 0; }
  9295. (gdb) bt
  9296. #0 c (i=i@entry=0) at t.c:2
  9297. #1 0x0000000000400428 in a (DW_OP_entry_value resolving has found
  9298. function "a" at 0x400420 can call itself via tail calls
  9299. i=<optimized out>) at t.c:6
  9300. #2 0x000000000040036e in main () at t.c:7
  9301. GDB cannot find out from the inferior state if and how many times did
  9302. function 'a' call itself (via function 'b') as these calls would be tail
  9303. calls. Such tail calls would modify the 'i' variable, therefore GDB
  9304. cannot be sure the value it knows would be right - GDB prints
  9305. '<optimized out>' instead.
  9306. 
  9307. File: gdb.info, Node: Macros, Next: Tracepoints, Prev: Optimized Code, Up: Top
  9308. 12 C Preprocessor Macros
  9309. ************************
  9310. Some languages, such as C and C++, provide a way to define and invoke
  9311. "preprocessor macros" which expand into strings of tokens. GDB can
  9312. evaluate expressions containing macro invocations, show the result of
  9313. macro expansion, and show a macro's definition, including where it was
  9314. defined.
  9315. You may need to compile your program specially to provide GDB with
  9316. information about preprocessor macros. Most compilers do not include
  9317. macros in their debugging information, even when you compile with the
  9318. '-g' flag. *Note Compilation::.
  9319. A program may define a macro at one point, remove that definition
  9320. later, and then provide a different definition after that. Thus, at
  9321. different points in the program, a macro may have different definitions,
  9322. or have no definition at all. If there is a current stack frame, GDB
  9323. uses the macros in scope at that frame's source code line. Otherwise,
  9324. GDB uses the macros in scope at the current listing location; see *note
  9325. List::.
  9326. Whenever GDB evaluates an expression, it always expands any macro
  9327. invocations present in the expression. GDB also provides the following
  9328. commands for working with macros explicitly.
  9329. 'macro expand EXPRESSION'
  9330. 'macro exp EXPRESSION'
  9331. Show the results of expanding all preprocessor macro invocations in
  9332. EXPRESSION. Since GDB simply expands macros, but does not parse
  9333. the result, EXPRESSION need not be a valid expression; it can be
  9334. any string of tokens.
  9335. 'macro expand-once EXPRESSION'
  9336. 'macro exp1 EXPRESSION'
  9337. (This command is not yet implemented.) Show the results of
  9338. expanding those preprocessor macro invocations that appear
  9339. explicitly in EXPRESSION. Macro invocations appearing in that
  9340. expansion are left unchanged. This command allows you to see the
  9341. effect of a particular macro more clearly, without being confused
  9342. by further expansions. Since GDB simply expands macros, but does
  9343. not parse the result, EXPRESSION need not be a valid expression; it
  9344. can be any string of tokens.
  9345. 'info macro [-a|-all] [--] MACRO'
  9346. Show the current definition or all definitions of the named MACRO,
  9347. and describe the source location or compiler command-line where
  9348. that definition was established. The optional double dash is to
  9349. signify the end of argument processing and the beginning of MACRO
  9350. for non C-like macros where the macro may begin with a hyphen.
  9351. 'info macros LOCATION'
  9352. Show all macro definitions that are in effect at the location
  9353. specified by LOCATION, and describe the source location or compiler
  9354. command-line where those definitions were established.
  9355. 'macro define MACRO REPLACEMENT-LIST'
  9356. 'macro define MACRO(ARGLIST) REPLACEMENT-LIST'
  9357. Introduce a definition for a preprocessor macro named MACRO,
  9358. invocations of which are replaced by the tokens given in
  9359. REPLACEMENT-LIST. The first form of this command defines an
  9360. "object-like" macro, which takes no arguments; the second form
  9361. defines a "function-like" macro, which takes the arguments given in
  9362. ARGLIST.
  9363. A definition introduced by this command is in scope in every
  9364. expression evaluated in GDB, until it is removed with the 'macro
  9365. undef' command, described below. The definition overrides all
  9366. definitions for MACRO present in the program being debugged, as
  9367. well as any previous user-supplied definition.
  9368. 'macro undef MACRO'
  9369. Remove any user-supplied definition for the macro named MACRO.
  9370. This command only affects definitions provided with the 'macro
  9371. define' command, described above; it cannot remove definitions
  9372. present in the program being debugged.
  9373. 'macro list'
  9374. List all the macros defined using the 'macro define' command.
  9375. Here is a transcript showing the above commands in action. First, we
  9376. show our source files:
  9377. $ cat sample.c
  9378. #include <stdio.h>
  9379. #include "sample.h"
  9380. #define M 42
  9381. #define ADD(x) (M + x)
  9382. main ()
  9383. {
  9384. #define N 28
  9385. printf ("Hello, world!\n");
  9386. #undef N
  9387. printf ("We're so creative.\n");
  9388. #define N 1729
  9389. printf ("Goodbye, world!\n");
  9390. }
  9391. $ cat sample.h
  9392. #define Q <
  9393. $
  9394. Now, we compile the program using the GNU C compiler, GCC. We pass
  9395. the '-gdwarf-2'(1) _and_ '-g3' flags to ensure the compiler includes
  9396. information about preprocessor macros in the debugging information.
  9397. $ gcc -gdwarf-2 -g3 sample.c -o sample
  9398. $
  9399. Now, we start GDB on our sample program:
  9400. $ gdb -nw sample
  9401. GNU gdb 2002-05-06-cvs
  9402. Copyright 2002 Free Software Foundation, Inc.
  9403. GDB is free software, ...
  9404. (gdb)
  9405. We can expand macros and examine their definitions, even when the
  9406. program is not running. GDB uses the current listing position to decide
  9407. which macro definitions are in scope:
  9408. (gdb) list main
  9409. 3
  9410. 4 #define M 42
  9411. 5 #define ADD(x) (M + x)
  9412. 6
  9413. 7 main ()
  9414. 8 {
  9415. 9 #define N 28
  9416. 10 printf ("Hello, world!\n");
  9417. 11 #undef N
  9418. 12 printf ("We're so creative.\n");
  9419. (gdb) info macro ADD
  9420. Defined at /home/jimb/gdb/macros/play/sample.c:5
  9421. #define ADD(x) (M + x)
  9422. (gdb) info macro Q
  9423. Defined at /home/jimb/gdb/macros/play/sample.h:1
  9424. included at /home/jimb/gdb/macros/play/sample.c:2
  9425. #define Q <
  9426. (gdb) macro expand ADD(1)
  9427. expands to: (42 + 1)
  9428. (gdb) macro expand-once ADD(1)
  9429. expands to: once (M + 1)
  9430. (gdb)
  9431. In the example above, note that 'macro expand-once' expands only the
  9432. macro invocation explicit in the original text -- the invocation of
  9433. 'ADD' -- but does not expand the invocation of the macro 'M', which was
  9434. introduced by 'ADD'.
  9435. Once the program is running, GDB uses the macro definitions in force
  9436. at the source line of the current stack frame:
  9437. (gdb) break main
  9438. Breakpoint 1 at 0x8048370: file sample.c, line 10.
  9439. (gdb) run
  9440. Starting program: /home/jimb/gdb/macros/play/sample
  9441. Breakpoint 1, main () at sample.c:10
  9442. 10 printf ("Hello, world!\n");
  9443. (gdb)
  9444. At line 10, the definition of the macro 'N' at line 9 is in force:
  9445. (gdb) info macro N
  9446. Defined at /home/jimb/gdb/macros/play/sample.c:9
  9447. #define N 28
  9448. (gdb) macro expand N Q M
  9449. expands to: 28 < 42
  9450. (gdb) print N Q M
  9451. $1 = 1
  9452. (gdb)
  9453. As we step over directives that remove 'N''s definition, and then
  9454. give it a new definition, GDB finds the definition (or lack thereof) in
  9455. force at each point:
  9456. (gdb) next
  9457. Hello, world!
  9458. 12 printf ("We're so creative.\n");
  9459. (gdb) info macro N
  9460. The symbol `N' has no definition as a C/C++ preprocessor macro
  9461. at /home/jimb/gdb/macros/play/sample.c:12
  9462. (gdb) next
  9463. We're so creative.
  9464. 14 printf ("Goodbye, world!\n");
  9465. (gdb) info macro N
  9466. Defined at /home/jimb/gdb/macros/play/sample.c:13
  9467. #define N 1729
  9468. (gdb) macro expand N Q M
  9469. expands to: 1729 < 42
  9470. (gdb) print N Q M
  9471. $2 = 0
  9472. (gdb)
  9473. In addition to source files, macros can be defined on the compilation
  9474. command line using the '-DNAME=VALUE' syntax. For macros defined in
  9475. such a way, GDB displays the location of their definition as line zero
  9476. of the source file submitted to the compiler.
  9477. (gdb) info macro __STDC__
  9478. Defined at /home/jimb/gdb/macros/play/sample.c:0
  9479. -D__STDC__=1
  9480. (gdb)
  9481. ---------- Footnotes ----------
  9482. (1) This is the minimum. Recent versions of GCC support '-gdwarf-3'
  9483. and '-gdwarf-4'; we recommend always choosing the most recent version of
  9484. DWARF.
  9485. 
  9486. File: gdb.info, Node: Tracepoints, Next: Overlays, Prev: Macros, Up: Top
  9487. 13 Tracepoints
  9488. **************
  9489. In some applications, it is not feasible for the debugger to interrupt
  9490. the program's execution long enough for the developer to learn anything
  9491. helpful about its behavior. If the program's correctness depends on its
  9492. real-time behavior, delays introduced by a debugger might cause the
  9493. program to change its behavior drastically, or perhaps fail, even when
  9494. the code itself is correct. It is useful to be able to observe the
  9495. program's behavior without interrupting it.
  9496. Using GDB's 'trace' and 'collect' commands, you can specify locations
  9497. in the program, called "tracepoints", and arbitrary expressions to
  9498. evaluate when those tracepoints are reached. Later, using the 'tfind'
  9499. command, you can examine the values those expressions had when the
  9500. program hit the tracepoints. The expressions may also denote objects in
  9501. memory--structures or arrays, for example--whose values GDB should
  9502. record; while visiting a particular tracepoint, you may inspect those
  9503. objects as if they were in memory at that moment. However, because GDB
  9504. records these values without interacting with you, it can do so quickly
  9505. and unobtrusively, hopefully not disturbing the program's behavior.
  9506. The tracepoint facility is currently available only for remote
  9507. targets. *Note Targets::. In addition, your remote target must know
  9508. how to collect trace data. This functionality is implemented in the
  9509. remote stub; however, none of the stubs distributed with GDB support
  9510. tracepoints as of this writing. The format of the remote packets used
  9511. to implement tracepoints are described in *note Tracepoint Packets::.
  9512. It is also possible to get trace data from a file, in a manner
  9513. reminiscent of corefiles; you specify the filename, and use 'tfind' to
  9514. search through the file. *Note Trace Files::, for more details.
  9515. This chapter describes the tracepoint commands and features.
  9516. * Menu:
  9517. * Set Tracepoints::
  9518. * Analyze Collected Data::
  9519. * Tracepoint Variables::
  9520. * Trace Files::
  9521. 
  9522. File: gdb.info, Node: Set Tracepoints, Next: Analyze Collected Data, Up: Tracepoints
  9523. 13.1 Commands to Set Tracepoints
  9524. ================================
  9525. Before running such a "trace experiment", an arbitrary number of
  9526. tracepoints can be set. A tracepoint is actually a special type of
  9527. breakpoint (*note Set Breaks::), so you can manipulate it using standard
  9528. breakpoint commands. For instance, as with breakpoints, tracepoint
  9529. numbers are successive integers starting from one, and many of the
  9530. commands associated with tracepoints take the tracepoint number as their
  9531. argument, to identify which tracepoint to work on.
  9532. For each tracepoint, you can specify, in advance, some arbitrary set
  9533. of data that you want the target to collect in the trace buffer when it
  9534. hits that tracepoint. The collected data can include registers, local
  9535. variables, or global data. Later, you can use GDB commands to examine
  9536. the values these data had at the time the tracepoint was hit.
  9537. Tracepoints do not support every breakpoint feature. Ignore counts
  9538. on tracepoints have no effect, and tracepoints cannot run GDB commands
  9539. when they are hit. Tracepoints may not be thread-specific either.
  9540. Some targets may support "fast tracepoints", which are inserted in a
  9541. different way (such as with a jump instead of a trap), that is faster
  9542. but possibly restricted in where they may be installed.
  9543. Regular and fast tracepoints are dynamic tracing facilities, meaning
  9544. that they can be used to insert tracepoints at (almost) any location in
  9545. the target. Some targets may also support controlling "static
  9546. tracepoints" from GDB. With static tracing, a set of instrumentation
  9547. points, also known as "markers", are embedded in the target program, and
  9548. can be activated or deactivated by name or address. These are usually
  9549. placed at locations which facilitate investigating what the target is
  9550. actually doing. GDB's support for static tracing includes being able to
  9551. list instrumentation points, and attach them with GDB defined high level
  9552. tracepoints that expose the whole range of convenience of GDB's
  9553. tracepoints support. Namely, support for collecting registers values
  9554. and values of global or local (to the instrumentation point) variables;
  9555. tracepoint conditions and trace state variables. The act of installing
  9556. a GDB static tracepoint on an instrumentation point, or marker, is
  9557. referred to as "probing" a static tracepoint marker.
  9558. 'gdbserver' supports tracepoints on some target systems. *Note
  9559. Tracepoints support in 'gdbserver': Server.
  9560. This section describes commands to set tracepoints and associated
  9561. conditions and actions.
  9562. * Menu:
  9563. * Create and Delete Tracepoints::
  9564. * Enable and Disable Tracepoints::
  9565. * Tracepoint Passcounts::
  9566. * Tracepoint Conditions::
  9567. * Trace State Variables::
  9568. * Tracepoint Actions::
  9569. * Listing Tracepoints::
  9570. * Listing Static Tracepoint Markers::
  9571. * Starting and Stopping Trace Experiments::
  9572. * Tracepoint Restrictions::
  9573. 
  9574. File: gdb.info, Node: Create and Delete Tracepoints, Next: Enable and Disable Tracepoints, Up: Set Tracepoints
  9575. 13.1.1 Create and Delete Tracepoints
  9576. ------------------------------------
  9577. 'trace LOCATION'
  9578. The 'trace' command is very similar to the 'break' command. Its
  9579. argument LOCATION can be any valid location. *Note Specify
  9580. Location::. The 'trace' command defines a tracepoint, which is a
  9581. point in the target program where the debugger will briefly stop,
  9582. collect some data, and then allow the program to continue. Setting
  9583. a tracepoint or changing its actions takes effect immediately if
  9584. the remote stub supports the 'InstallInTrace' feature (*note
  9585. install tracepoint in tracing::). If remote stub doesn't support
  9586. the 'InstallInTrace' feature, all these changes don't take effect
  9587. until the next 'tstart' command, and once a trace experiment is
  9588. running, further changes will not have any effect until the next
  9589. trace experiment starts. In addition, GDB supports "pending
  9590. tracepoints"--tracepoints whose address is not yet resolved. (This
  9591. is similar to pending breakpoints.) Pending tracepoints are not
  9592. downloaded to the target and not installed until they are resolved.
  9593. The resolution of pending tracepoints requires GDB support--when
  9594. debugging with the remote target, and GDB disconnects from the
  9595. remote stub (*note disconnected tracing::), pending tracepoints can
  9596. not be resolved (and downloaded to the remote stub) while GDB is
  9597. disconnected.
  9598. Here are some examples of using the 'trace' command:
  9599. (gdb) trace foo.c:121 // a source file and line number
  9600. (gdb) trace +2 // 2 lines forward
  9601. (gdb) trace my_function // first source line of function
  9602. (gdb) trace *my_function // EXACT start address of function
  9603. (gdb) trace *0x2117c4 // an address
  9604. You can abbreviate 'trace' as 'tr'.
  9605. 'trace LOCATION if COND'
  9606. Set a tracepoint with condition COND; evaluate the expression COND
  9607. each time the tracepoint is reached, and collect data only if the
  9608. value is nonzero--that is, if COND evaluates as true. *Note
  9609. Tracepoint Conditions: Tracepoint Conditions, for more information
  9610. on tracepoint conditions.
  9611. 'ftrace LOCATION [ if COND ]'
  9612. The 'ftrace' command sets a fast tracepoint. For targets that
  9613. support them, fast tracepoints will use a more efficient but
  9614. possibly less general technique to trigger data collection, such as
  9615. a jump instruction instead of a trap, or some sort of hardware
  9616. support. It may not be possible to create a fast tracepoint at the
  9617. desired location, in which case the command will exit with an
  9618. explanatory message.
  9619. GDB handles arguments to 'ftrace' exactly as for 'trace'.
  9620. On 32-bit x86-architecture systems, fast tracepoints normally need
  9621. to be placed at an instruction that is 5 bytes or longer, but can
  9622. be placed at 4-byte instructions if the low 64K of memory of the
  9623. target program is available to install trampolines. Some Unix-type
  9624. systems, such as GNU/Linux, exclude low addresses from the
  9625. program's address space; but for instance with the Linux kernel it
  9626. is possible to let GDB use this area by doing a 'sysctl' command to
  9627. set the 'mmap_min_addr' kernel parameter, as in
  9628. sudo sysctl -w vm.mmap_min_addr=32768
  9629. which sets the low address to 32K, which leaves plenty of room for
  9630. trampolines. The minimum address should be set to a page boundary.
  9631. 'strace LOCATION [ if COND ]'
  9632. The 'strace' command sets a static tracepoint. For targets that
  9633. support it, setting a static tracepoint probes a static
  9634. instrumentation point, or marker, found at LOCATION. It may not be
  9635. possible to set a static tracepoint at the desired location, in
  9636. which case the command will exit with an explanatory message.
  9637. GDB handles arguments to 'strace' exactly as for 'trace', with the
  9638. addition that the user can also specify '-m MARKER' as LOCATION.
  9639. This probes the marker identified by the MARKER string identifier.
  9640. This identifier depends on the static tracepoint backend library
  9641. your program is using. You can find all the marker identifiers in
  9642. the 'ID' field of the 'info static-tracepoint-markers' command
  9643. output. *Note Listing Static Tracepoint Markers: Listing Static
  9644. Tracepoint Markers. For example, in the following small program
  9645. using the UST tracing engine:
  9646. main ()
  9647. {
  9648. trace_mark(ust, bar33, "str %s", "FOOBAZ");
  9649. }
  9650. the marker id is composed of joining the first two arguments to the
  9651. 'trace_mark' call with a slash, which translates to:
  9652. (gdb) info static-tracepoint-markers
  9653. Cnt Enb ID Address What
  9654. 1 n ust/bar33 0x0000000000400ddc in main at stexample.c:22
  9655. Data: "str %s"
  9656. [etc...]
  9657. so you may probe the marker above with:
  9658. (gdb) strace -m ust/bar33
  9659. Static tracepoints accept an extra collect action -- 'collect
  9660. $_sdata'. This collects arbitrary user data passed in the probe
  9661. point call to the tracing library. In the UST example above,
  9662. you'll see that the third argument to 'trace_mark' is a printf-like
  9663. format string. The user data is then the result of running that
  9664. formatting string against the following arguments. Note that 'info
  9665. static-tracepoint-markers' command output lists that format string
  9666. in the 'Data:' field.
  9667. You can inspect this data when analyzing the trace buffer, by
  9668. printing the $_sdata variable like any other variable available to
  9669. GDB. *Note Tracepoint Action Lists: Tracepoint Actions.
  9670. The convenience variable '$tpnum' records the tracepoint number of
  9671. the most recently set tracepoint.
  9672. 'delete tracepoint [NUM]'
  9673. Permanently delete one or more tracepoints. With no argument, the
  9674. default is to delete all tracepoints. Note that the regular
  9675. 'delete' command can remove tracepoints also.
  9676. Examples:
  9677. (gdb) delete trace 1 2 3 // remove three tracepoints
  9678. (gdb) delete trace // remove all tracepoints
  9679. You can abbreviate this command as 'del tr'.
  9680. 
  9681. File: gdb.info, Node: Enable and Disable Tracepoints, Next: Tracepoint Passcounts, Prev: Create and Delete Tracepoints, Up: Set Tracepoints
  9682. 13.1.2 Enable and Disable Tracepoints
  9683. -------------------------------------
  9684. These commands are deprecated; they are equivalent to plain 'disable'
  9685. and 'enable'.
  9686. 'disable tracepoint [NUM]'
  9687. Disable tracepoint NUM, or all tracepoints if no argument NUM is
  9688. given. A disabled tracepoint will have no effect during a trace
  9689. experiment, but it is not forgotten. You can re-enable a disabled
  9690. tracepoint using the 'enable tracepoint' command. If the command
  9691. is issued during a trace experiment and the debug target has
  9692. support for disabling tracepoints during a trace experiment, then
  9693. the change will be effective immediately. Otherwise, it will be
  9694. applied to the next trace experiment.
  9695. 'enable tracepoint [NUM]'
  9696. Enable tracepoint NUM, or all tracepoints. If this command is
  9697. issued during a trace experiment and the debug target supports
  9698. enabling tracepoints during a trace experiment, then the enabled
  9699. tracepoints will become effective immediately. Otherwise, they
  9700. will become effective the next time a trace experiment is run.
  9701. 
  9702. File: gdb.info, Node: Tracepoint Passcounts, Next: Tracepoint Conditions, Prev: Enable and Disable Tracepoints, Up: Set Tracepoints
  9703. 13.1.3 Tracepoint Passcounts
  9704. ----------------------------
  9705. 'passcount [N [NUM]]'
  9706. Set the "passcount" of a tracepoint. The passcount is a way to
  9707. automatically stop a trace experiment. If a tracepoint's passcount
  9708. is N, then the trace experiment will be automatically stopped on
  9709. the N'th time that tracepoint is hit. If the tracepoint number NUM
  9710. is not specified, the 'passcount' command sets the passcount of the
  9711. most recently defined tracepoint. If no passcount is given, the
  9712. trace experiment will run until stopped explicitly by the user.
  9713. Examples:
  9714. (gdb) passcount 5 2 // Stop on the 5th execution of
  9715. // tracepoint 2
  9716. (gdb) passcount 12 // Stop on the 12th execution of the
  9717. // most recently defined tracepoint.
  9718. (gdb) trace foo
  9719. (gdb) pass 3
  9720. (gdb) trace bar
  9721. (gdb) pass 2
  9722. (gdb) trace baz
  9723. (gdb) pass 1 // Stop tracing when foo has been
  9724. // executed 3 times OR when bar has
  9725. // been executed 2 times
  9726. // OR when baz has been executed 1 time.
  9727. 
  9728. File: gdb.info, Node: Tracepoint Conditions, Next: Trace State Variables, Prev: Tracepoint Passcounts, Up: Set Tracepoints
  9729. 13.1.4 Tracepoint Conditions
  9730. ----------------------------
  9731. The simplest sort of tracepoint collects data every time your program
  9732. reaches a specified place. You can also specify a "condition" for a
  9733. tracepoint. A condition is just a Boolean expression in your
  9734. programming language (*note Expressions: Expressions.). A tracepoint
  9735. with a condition evaluates the expression each time your program reaches
  9736. it, and data collection happens only if the condition is true.
  9737. Tracepoint conditions can be specified when a tracepoint is set, by
  9738. using 'if' in the arguments to the 'trace' command. *Note Setting
  9739. Tracepoints: Create and Delete Tracepoints. They can also be set or
  9740. changed at any time with the 'condition' command, just as with
  9741. breakpoints.
  9742. Unlike breakpoint conditions, GDB does not actually evaluate the
  9743. conditional expression itself. Instead, GDB encodes the expression into
  9744. an agent expression (*note Agent Expressions::) suitable for execution
  9745. on the target, independently of GDB. Global variables become raw memory
  9746. locations, locals become stack accesses, and so forth.
  9747. For instance, suppose you have a function that is usually called
  9748. frequently, but should not be called after an error has occurred. You
  9749. could use the following tracepoint command to collect data about calls
  9750. of that function that happen while the error code is propagating through
  9751. the program; an unconditional tracepoint could end up collecting
  9752. thousands of useless trace frames that you would have to search through.
  9753. (gdb) trace normal_operation if errcode > 0
  9754. 
  9755. File: gdb.info, Node: Trace State Variables, Next: Tracepoint Actions, Prev: Tracepoint Conditions, Up: Set Tracepoints
  9756. 13.1.5 Trace State Variables
  9757. ----------------------------
  9758. A "trace state variable" is a special type of variable that is created
  9759. and managed by target-side code. The syntax is the same as that for
  9760. GDB's convenience variables (a string prefixed with "$"), but they are
  9761. stored on the target. They must be created explicitly, using a
  9762. 'tvariable' command. They are always 64-bit signed integers.
  9763. Trace state variables are remembered by GDB, and downloaded to the
  9764. target along with tracepoint information when the trace experiment
  9765. starts. There are no intrinsic limits on the number of trace state
  9766. variables, beyond memory limitations of the target.
  9767. Although trace state variables are managed by the target, you can use
  9768. them in print commands and expressions as if they were convenience
  9769. variables; GDB will get the current value from the target while the
  9770. trace experiment is running. Trace state variables share the same
  9771. namespace as other "$" variables, which means that you cannot have trace
  9772. state variables with names like '$23' or '$pc', nor can you have a trace
  9773. state variable and a convenience variable with the same name.
  9774. 'tvariable $NAME [ = EXPRESSION ]'
  9775. The 'tvariable' command creates a new trace state variable named
  9776. '$NAME', and optionally gives it an initial value of EXPRESSION.
  9777. The EXPRESSION is evaluated when this command is entered; the
  9778. result will be converted to an integer if possible, otherwise GDB
  9779. will report an error. A subsequent 'tvariable' command specifying
  9780. the same name does not create a variable, but instead assigns the
  9781. supplied initial value to the existing variable of that name,
  9782. overwriting any previous initial value. The default initial value
  9783. is 0.
  9784. 'info tvariables'
  9785. List all the trace state variables along with their initial values.
  9786. Their current values may also be displayed, if the trace experiment
  9787. is currently running.
  9788. 'delete tvariable [ $NAME ... ]'
  9789. Delete the given trace state variables, or all of them if no
  9790. arguments are specified.
  9791. 
  9792. File: gdb.info, Node: Tracepoint Actions, Next: Listing Tracepoints, Prev: Trace State Variables, Up: Set Tracepoints
  9793. 13.1.6 Tracepoint Action Lists
  9794. ------------------------------
  9795. 'actions [NUM]'
  9796. This command will prompt for a list of actions to be taken when the
  9797. tracepoint is hit. If the tracepoint number NUM is not specified,
  9798. this command sets the actions for the one that was most recently
  9799. defined (so that you can define a tracepoint and then say 'actions'
  9800. without bothering about its number). You specify the actions
  9801. themselves on the following lines, one action at a time, and
  9802. terminate the actions list with a line containing just 'end'. So
  9803. far, the only defined actions are 'collect', 'teval', and
  9804. 'while-stepping'.
  9805. 'actions' is actually equivalent to 'commands' (*note Breakpoint
  9806. Command Lists: Break Commands.), except that only the defined
  9807. actions are allowed; any other GDB command is rejected.
  9808. To remove all actions from a tracepoint, type 'actions NUM' and
  9809. follow it immediately with 'end'.
  9810. (gdb) collect DATA // collect some data
  9811. (gdb) while-stepping 5 // single-step 5 times, collect data
  9812. (gdb) end // signals the end of actions.
  9813. In the following example, the action list begins with 'collect'
  9814. commands indicating the things to be collected when the tracepoint
  9815. is hit. Then, in order to single-step and collect additional data
  9816. following the tracepoint, a 'while-stepping' command is used,
  9817. followed by the list of things to be collected after each step in a
  9818. sequence of single steps. The 'while-stepping' command is
  9819. terminated by its own separate 'end' command. Lastly, the action
  9820. list is terminated by an 'end' command.
  9821. (gdb) trace foo
  9822. (gdb) actions
  9823. Enter actions for tracepoint 1, one per line:
  9824. > collect bar,baz
  9825. > collect $regs
  9826. > while-stepping 12
  9827. > collect $pc, arr[i]
  9828. > end
  9829. end
  9830. 'collect[/MODS] EXPR1, EXPR2, ...'
  9831. Collect values of the given expressions when the tracepoint is hit.
  9832. This command accepts a comma-separated list of any valid
  9833. expressions. In addition to global, static, or local variables,
  9834. the following special arguments are supported:
  9835. '$regs'
  9836. Collect all registers.
  9837. '$args'
  9838. Collect all function arguments.
  9839. '$locals'
  9840. Collect all local variables.
  9841. '$_ret'
  9842. Collect the return address. This is helpful if you want to
  9843. see more of a backtrace.
  9844. _Note:_ The return address location can not always be reliably
  9845. determined up front, and the wrong address / registers may end
  9846. up collected instead. On some architectures the reliability
  9847. is higher for tracepoints at function entry, while on others
  9848. it's the opposite. When this happens, backtracing will stop
  9849. because the return address is found unavailable (unless
  9850. another collect rule happened to match it).
  9851. '$_probe_argc'
  9852. Collects the number of arguments from the static probe at
  9853. which the tracepoint is located. *Note Static Probe Points::.
  9854. '$_probe_argN'
  9855. N is an integer between 0 and 11. Collects the Nth argument
  9856. from the static probe at which the tracepoint is located.
  9857. *Note Static Probe Points::.
  9858. '$_sdata'
  9859. Collect static tracepoint marker specific data. Only
  9860. available for static tracepoints. *Note Tracepoint Action
  9861. Lists: Tracepoint Actions. On the UST static tracepoints
  9862. library backend, an instrumentation point resembles a 'printf'
  9863. function call. The tracing library is able to collect user
  9864. specified data formatted to a character string using the
  9865. format provided by the programmer that instrumented the
  9866. program. Other backends have similar mechanisms. Here's an
  9867. example of a UST marker call:
  9868. const char master_name[] = "$your_name";
  9869. trace_mark(channel1, marker1, "hello %s", master_name)
  9870. In this case, collecting '$_sdata' collects the string 'hello
  9871. $yourname'. When analyzing the trace buffer, you can inspect
  9872. '$_sdata' like any other variable available to GDB.
  9873. You can give several consecutive 'collect' commands, each one with
  9874. a single argument, or one 'collect' command with several arguments
  9875. separated by commas; the effect is the same.
  9876. The optional MODS changes the usual handling of the arguments. 's'
  9877. requests that pointers to chars be handled as strings, in
  9878. particular collecting the contents of the memory being pointed at,
  9879. up to the first zero. The upper bound is by default the value of
  9880. the 'print elements' variable; if 's' is followed by a decimal
  9881. number, that is the upper bound instead. So for instance
  9882. 'collect/s25 mystr' collects as many as 25 characters at 'mystr'.
  9883. The command 'info scope' (*note info scope: Symbols.) is
  9884. particularly useful for figuring out what data to collect.
  9885. 'teval EXPR1, EXPR2, ...'
  9886. Evaluate the given expressions when the tracepoint is hit. This
  9887. command accepts a comma-separated list of expressions. The results
  9888. are discarded, so this is mainly useful for assigning values to
  9889. trace state variables (*note Trace State Variables::) without
  9890. adding those values to the trace buffer, as would be the case if
  9891. the 'collect' action were used.
  9892. 'while-stepping N'
  9893. Perform N single-step instruction traces after the tracepoint,
  9894. collecting new data after each step. The 'while-stepping' command
  9895. is followed by the list of what to collect while stepping (followed
  9896. by its own 'end' command):
  9897. > while-stepping 12
  9898. > collect $regs, myglobal
  9899. > end
  9900. >
  9901. Note that '$pc' is not automatically collected by 'while-stepping';
  9902. you need to explicitly collect that register if you need it. You
  9903. may abbreviate 'while-stepping' as 'ws' or 'stepping'.
  9904. 'set default-collect EXPR1, EXPR2, ...'
  9905. This variable is a list of expressions to collect at each
  9906. tracepoint hit. It is effectively an additional 'collect' action
  9907. prepended to every tracepoint action list. The expressions are
  9908. parsed individually for each tracepoint, so for instance a variable
  9909. named 'xyz' may be interpreted as a global for one tracepoint, and
  9910. a local for another, as appropriate to the tracepoint's location.
  9911. 'show default-collect'
  9912. Show the list of expressions that are collected by default at each
  9913. tracepoint hit.
  9914. 
  9915. File: gdb.info, Node: Listing Tracepoints, Next: Listing Static Tracepoint Markers, Prev: Tracepoint Actions, Up: Set Tracepoints
  9916. 13.1.7 Listing Tracepoints
  9917. --------------------------
  9918. 'info tracepoints [NUM...]'
  9919. Display information about the tracepoint NUM. If you don't specify
  9920. a tracepoint number, displays information about all the tracepoints
  9921. defined so far. The format is similar to that used for 'info
  9922. breakpoints'; in fact, 'info tracepoints' is the same command,
  9923. simply restricting itself to tracepoints.
  9924. A tracepoint's listing may include additional information specific
  9925. to tracing:
  9926. * its passcount as given by the 'passcount N' command
  9927. * the state about installed on target of each location
  9928. (gdb) info trace
  9929. Num Type Disp Enb Address What
  9930. 1 tracepoint keep y 0x0804ab57 in foo() at main.cxx:7
  9931. while-stepping 20
  9932. collect globfoo, $regs
  9933. end
  9934. collect globfoo2
  9935. end
  9936. pass count 1200
  9937. 2 tracepoint keep y <MULTIPLE>
  9938. collect $eip
  9939. 2.1 y 0x0804859c in func4 at change-loc.h:35
  9940. installed on target
  9941. 2.2 y 0xb7ffc480 in func4 at change-loc.h:35
  9942. installed on target
  9943. 2.3 y <PENDING> set_tracepoint
  9944. 3 tracepoint keep y 0x080485b1 in foo at change-loc.c:29
  9945. not installed on target
  9946. (gdb)
  9947. This command can be abbreviated 'info tp'.
  9948. 
  9949. File: gdb.info, Node: Listing Static Tracepoint Markers, Next: Starting and Stopping Trace Experiments, Prev: Listing Tracepoints, Up: Set Tracepoints
  9950. 13.1.8 Listing Static Tracepoint Markers
  9951. ----------------------------------------
  9952. 'info static-tracepoint-markers'
  9953. Display information about all static tracepoint markers defined in
  9954. the program.
  9955. For each marker, the following columns are printed:
  9956. _Count_
  9957. An incrementing counter, output to help readability. This is
  9958. not a stable identifier.
  9959. _ID_
  9960. The marker ID, as reported by the target.
  9961. _Enabled or Disabled_
  9962. Probed markers are tagged with 'y'. 'n' identifies marks that
  9963. are not enabled.
  9964. _Address_
  9965. Where the marker is in your program, as a memory address.
  9966. _What_
  9967. Where the marker is in the source for your program, as a file
  9968. and line number. If the debug information included in the
  9969. program does not allow GDB to locate the source of the marker,
  9970. this column will be left blank.
  9971. In addition, the following information may be printed for each
  9972. marker:
  9973. _Data_
  9974. User data passed to the tracing library by the marker call.
  9975. In the UST backend, this is the format string passed as
  9976. argument to the marker call.
  9977. _Static tracepoints probing the marker_
  9978. The list of static tracepoints attached to the marker.
  9979. (gdb) info static-tracepoint-markers
  9980. Cnt ID Enb Address What
  9981. 1 ust/bar2 y 0x0000000000400e1a in main at stexample.c:25
  9982. Data: number1 %d number2 %d
  9983. Probed by static tracepoints: #2
  9984. 2 ust/bar33 n 0x0000000000400c87 in main at stexample.c:24
  9985. Data: str %s
  9986. (gdb)
  9987. 
  9988. File: gdb.info, Node: Starting and Stopping Trace Experiments, Next: Tracepoint Restrictions, Prev: Listing Static Tracepoint Markers, Up: Set Tracepoints
  9989. 13.1.9 Starting and Stopping Trace Experiments
  9990. ----------------------------------------------
  9991. 'tstart'
  9992. This command starts the trace experiment, and begins collecting
  9993. data. It has the side effect of discarding all the data collected
  9994. in the trace buffer during the previous trace experiment. If any
  9995. arguments are supplied, they are taken as a note and stored with
  9996. the trace experiment's state. The notes may be arbitrary text, and
  9997. are especially useful with disconnected tracing in a multi-user
  9998. context; the notes can explain what the trace is doing, supply user
  9999. contact information, and so forth.
  10000. 'tstop'
  10001. This command stops the trace experiment. If any arguments are
  10002. supplied, they are recorded with the experiment as a note. This is
  10003. useful if you are stopping a trace started by someone else, for
  10004. instance if the trace is interfering with the system's behavior and
  10005. needs to be stopped quickly.
  10006. *Note*: a trace experiment and data collection may stop
  10007. automatically if any tracepoint's passcount is reached (*note
  10008. Tracepoint Passcounts::), or if the trace buffer becomes full.
  10009. 'tstatus'
  10010. This command displays the status of the current trace data
  10011. collection.
  10012. Here is an example of the commands we described so far:
  10013. (gdb) trace gdb_c_test
  10014. (gdb) actions
  10015. Enter actions for tracepoint #1, one per line.
  10016. > collect $regs,$locals,$args
  10017. > while-stepping 11
  10018. > collect $regs
  10019. > end
  10020. > end
  10021. (gdb) tstart
  10022. [time passes ...]
  10023. (gdb) tstop
  10024. You can choose to continue running the trace experiment even if GDB
  10025. disconnects from the target, voluntarily or involuntarily. For commands
  10026. such as 'detach', the debugger will ask what you want to do with the
  10027. trace. But for unexpected terminations (GDB crash, network outage), it
  10028. would be unfortunate to lose hard-won trace data, so the variable
  10029. 'disconnected-tracing' lets you decide whether the trace should continue
  10030. running without GDB.
  10031. 'set disconnected-tracing on'
  10032. 'set disconnected-tracing off'
  10033. Choose whether a tracing run should continue to run if GDB has
  10034. disconnected from the target. Note that 'detach' or 'quit' will
  10035. ask you directly what to do about a running trace no matter what
  10036. this variable's setting, so the variable is mainly useful for
  10037. handling unexpected situations, such as loss of the network.
  10038. 'show disconnected-tracing'
  10039. Show the current choice for disconnected tracing.
  10040. When you reconnect to the target, the trace experiment may or may not
  10041. still be running; it might have filled the trace buffer in the meantime,
  10042. or stopped for one of the other reasons. If it is running, it will
  10043. continue after reconnection.
  10044. Upon reconnection, the target will upload information about the
  10045. tracepoints in effect. GDB will then compare that information to the
  10046. set of tracepoints currently defined, and attempt to match them up,
  10047. allowing for the possibility that the numbers may have changed due to
  10048. creation and deletion in the meantime. If one of the target's
  10049. tracepoints does not match any in GDB, the debugger will create a new
  10050. tracepoint, so that you have a number with which to specify that
  10051. tracepoint. This matching-up process is necessarily heuristic, and it
  10052. may result in useless tracepoints being created; you may simply delete
  10053. them if they are of no use.
  10054. If your target agent supports a "circular trace buffer", then you can
  10055. run a trace experiment indefinitely without filling the trace buffer;
  10056. when space runs out, the agent deletes already-collected trace frames,
  10057. oldest first, until there is enough room to continue collecting. This
  10058. is especially useful if your tracepoints are being hit too often, and
  10059. your trace gets terminated prematurely because the buffer is full. To
  10060. ask for a circular trace buffer, simply set 'circular-trace-buffer' to
  10061. on. You can set this at any time, including during tracing; if the
  10062. agent can do it, it will change buffer handling on the fly, otherwise it
  10063. will not take effect until the next run.
  10064. 'set circular-trace-buffer on'
  10065. 'set circular-trace-buffer off'
  10066. Choose whether a tracing run should use a linear or circular buffer
  10067. for trace data. A linear buffer will not lose any trace data, but
  10068. may fill up prematurely, while a circular buffer will discard old
  10069. trace data, but it will have always room for the latest tracepoint
  10070. hits.
  10071. 'show circular-trace-buffer'
  10072. Show the current choice for the trace buffer. Note that this may
  10073. not match the agent's current buffer handling, nor is it guaranteed
  10074. to match the setting that might have been in effect during a past
  10075. run, for instance if you are looking at frames from a trace file.
  10076. 'set trace-buffer-size N'
  10077. 'set trace-buffer-size unlimited'
  10078. Request that the target use a trace buffer of N bytes. Not all
  10079. targets will honor the request; they may have a compiled-in size
  10080. for the trace buffer, or some other limitation. Set to a value of
  10081. 'unlimited' or '-1' to let the target use whatever size it likes.
  10082. This is also the default.
  10083. 'show trace-buffer-size'
  10084. Show the current requested size for the trace buffer. Note that
  10085. this will only match the actual size if the target supports
  10086. size-setting, and was able to handle the requested size. For
  10087. instance, if the target can only change buffer size between runs,
  10088. this variable will not reflect the change until the next run
  10089. starts. Use 'tstatus' to get a report of the actual buffer size.
  10090. 'set trace-user TEXT'
  10091. 'show trace-user'
  10092. 'set trace-notes TEXT'
  10093. Set the trace run's notes.
  10094. 'show trace-notes'
  10095. Show the trace run's notes.
  10096. 'set trace-stop-notes TEXT'
  10097. Set the trace run's stop notes. The handling of the note is as for
  10098. 'tstop' arguments; the set command is convenient way to fix a stop
  10099. note that is mistaken or incomplete.
  10100. 'show trace-stop-notes'
  10101. Show the trace run's stop notes.
  10102. 
  10103. File: gdb.info, Node: Tracepoint Restrictions, Prev: Starting and Stopping Trace Experiments, Up: Set Tracepoints
  10104. 13.1.10 Tracepoint Restrictions
  10105. -------------------------------
  10106. There are a number of restrictions on the use of tracepoints. As
  10107. described above, tracepoint data gathering occurs on the target without
  10108. interaction from GDB. Thus the full capabilities of the debugger are
  10109. not available during data gathering, and then at data examination time,
  10110. you will be limited by only having what was collected. The following
  10111. items describe some common problems, but it is not exhaustive, and you
  10112. may run into additional difficulties not mentioned here.
  10113. * Tracepoint expressions are intended to gather objects (lvalues).
  10114. Thus the full flexibility of GDB's expression evaluator is not
  10115. available. You cannot call functions, cast objects to aggregate
  10116. types, access convenience variables or modify values (except by
  10117. assignment to trace state variables). Some language features may
  10118. implicitly call functions (for instance Objective-C fields with
  10119. accessors), and therefore cannot be collected either.
  10120. * Collection of local variables, either individually or in bulk with
  10121. '$locals' or '$args', during 'while-stepping' may behave
  10122. erratically. The stepping action may enter a new scope (for
  10123. instance by stepping into a function), or the location of the
  10124. variable may change (for instance it is loaded into a register).
  10125. The tracepoint data recorded uses the location information for the
  10126. variables that is correct for the tracepoint location. When the
  10127. tracepoint is created, it is not possible, in general, to determine
  10128. where the steps of a 'while-stepping' sequence will advance the
  10129. program--particularly if a conditional branch is stepped.
  10130. * Collection of an incompletely-initialized or partially-destroyed
  10131. object may result in something that GDB cannot display, or displays
  10132. in a misleading way.
  10133. * When GDB displays a pointer to character it automatically
  10134. dereferences the pointer to also display characters of the string
  10135. being pointed to. However, collecting the pointer during tracing
  10136. does not automatically collect the string. You need to explicitly
  10137. dereference the pointer and provide size information if you want to
  10138. collect not only the pointer, but the memory pointed to. For
  10139. example, '*ptr@50' can be used to collect the 50 element array
  10140. pointed to by 'ptr'.
  10141. * It is not possible to collect a complete stack backtrace at a
  10142. tracepoint. Instead, you may collect the registers and a few
  10143. hundred bytes from the stack pointer with something like
  10144. '*(unsigned char *)$esp@300' (adjust to use the name of the actual
  10145. stack pointer register on your target architecture, and the amount
  10146. of stack you wish to capture). Then the 'backtrace' command will
  10147. show a partial backtrace when using a trace frame. The number of
  10148. stack frames that can be examined depends on the sizes of the
  10149. frames in the collected stack. Note that if you ask for a block so
  10150. large that it goes past the bottom of the stack, the target agent
  10151. may report an error trying to read from an invalid address.
  10152. * If you do not collect registers at a tracepoint, GDB can infer that
  10153. the value of '$pc' must be the same as the address of the
  10154. tracepoint and use that when you are looking at a trace frame for
  10155. that tracepoint. However, this cannot work if the tracepoint has
  10156. multiple locations (for instance if it was set in a function that
  10157. was inlined), or if it has a 'while-stepping' loop. In those cases
  10158. GDB will warn you that it can't infer '$pc', and default it to
  10159. zero.
  10160. 
  10161. File: gdb.info, Node: Analyze Collected Data, Next: Tracepoint Variables, Prev: Set Tracepoints, Up: Tracepoints
  10162. 13.2 Using the Collected Data
  10163. =============================
  10164. After the tracepoint experiment ends, you use GDB commands for examining
  10165. the trace data. The basic idea is that each tracepoint collects a trace
  10166. "snapshot" every time it is hit and another snapshot every time it
  10167. single-steps. All these snapshots are consecutively numbered from zero
  10168. and go into a buffer, and you can examine them later. The way you
  10169. examine them is to "focus" on a specific trace snapshot. When the
  10170. remote stub is focused on a trace snapshot, it will respond to all GDB
  10171. requests for memory and registers by reading from the buffer which
  10172. belongs to that snapshot, rather than from _real_ memory or registers of
  10173. the program being debugged. This means that *all* GDB commands
  10174. ('print', 'info registers', 'backtrace', etc.) will behave as if we
  10175. were currently debugging the program state as it was when the tracepoint
  10176. occurred. Any requests for data that are not in the buffer will fail.
  10177. * Menu:
  10178. * tfind:: How to select a trace snapshot
  10179. * tdump:: How to display all data for a snapshot
  10180. * save tracepoints:: How to save tracepoints for a future run
  10181. 
  10182. File: gdb.info, Node: tfind, Next: tdump, Up: Analyze Collected Data
  10183. 13.2.1 'tfind N'
  10184. ----------------
  10185. The basic command for selecting a trace snapshot from the buffer is
  10186. 'tfind N', which finds trace snapshot number N, counting from zero. If
  10187. no argument N is given, the next snapshot is selected.
  10188. Here are the various forms of using the 'tfind' command.
  10189. 'tfind start'
  10190. Find the first snapshot in the buffer. This is a synonym for
  10191. 'tfind 0' (since 0 is the number of the first snapshot).
  10192. 'tfind none'
  10193. Stop debugging trace snapshots, resume _live_ debugging.
  10194. 'tfind end'
  10195. Same as 'tfind none'.
  10196. 'tfind'
  10197. No argument means find the next trace snapshot or find the first
  10198. one if no trace snapshot is selected.
  10199. 'tfind -'
  10200. Find the previous trace snapshot before the current one. This
  10201. permits retracing earlier steps.
  10202. 'tfind tracepoint NUM'
  10203. Find the next snapshot associated with tracepoint NUM. Search
  10204. proceeds forward from the last examined trace snapshot. If no
  10205. argument NUM is given, it means find the next snapshot collected
  10206. for the same tracepoint as the current snapshot.
  10207. 'tfind pc ADDR'
  10208. Find the next snapshot associated with the value ADDR of the
  10209. program counter. Search proceeds forward from the last examined
  10210. trace snapshot. If no argument ADDR is given, it means find the
  10211. next snapshot with the same value of PC as the current snapshot.
  10212. 'tfind outside ADDR1, ADDR2'
  10213. Find the next snapshot whose PC is outside the given range of
  10214. addresses (exclusive).
  10215. 'tfind range ADDR1, ADDR2'
  10216. Find the next snapshot whose PC is between ADDR1 and ADDR2
  10217. (inclusive).
  10218. 'tfind line [FILE:]N'
  10219. Find the next snapshot associated with the source line N. If the
  10220. optional argument FILE is given, refer to line N in that source
  10221. file. Search proceeds forward from the last examined trace
  10222. snapshot. If no argument N is given, it means find the next line
  10223. other than the one currently being examined; thus saying 'tfind
  10224. line' repeatedly can appear to have the same effect as stepping
  10225. from line to line in a _live_ debugging session.
  10226. The default arguments for the 'tfind' commands are specifically
  10227. designed to make it easy to scan through the trace buffer. For
  10228. instance, 'tfind' with no argument selects the next trace snapshot, and
  10229. 'tfind -' with no argument selects the previous trace snapshot. So, by
  10230. giving one 'tfind' command, and then simply hitting <RET> repeatedly you
  10231. can examine all the trace snapshots in order. Or, by saying 'tfind -'
  10232. and then hitting <RET> repeatedly you can examine the snapshots in
  10233. reverse order. The 'tfind line' command with no argument selects the
  10234. snapshot for the next source line executed. The 'tfind pc' command with
  10235. no argument selects the next snapshot with the same program counter (PC)
  10236. as the current frame. The 'tfind tracepoint' command with no argument
  10237. selects the next trace snapshot collected by the same tracepoint as the
  10238. current one.
  10239. In addition to letting you scan through the trace buffer manually,
  10240. these commands make it easy to construct GDB scripts that scan through
  10241. the trace buffer and print out whatever collected data you are
  10242. interested in. Thus, if we want to examine the PC, FP, and SP registers
  10243. from each trace frame in the buffer, we can say this:
  10244. (gdb) tfind start
  10245. (gdb) while ($trace_frame != -1)
  10246. > printf "Frame %d, PC = %08X, SP = %08X, FP = %08X\n", \
  10247. $trace_frame, $pc, $sp, $fp
  10248. > tfind
  10249. > end
  10250. Frame 0, PC = 0020DC64, SP = 0030BF3C, FP = 0030BF44
  10251. Frame 1, PC = 0020DC6C, SP = 0030BF38, FP = 0030BF44
  10252. Frame 2, PC = 0020DC70, SP = 0030BF34, FP = 0030BF44
  10253. Frame 3, PC = 0020DC74, SP = 0030BF30, FP = 0030BF44
  10254. Frame 4, PC = 0020DC78, SP = 0030BF2C, FP = 0030BF44
  10255. Frame 5, PC = 0020DC7C, SP = 0030BF28, FP = 0030BF44
  10256. Frame 6, PC = 0020DC80, SP = 0030BF24, FP = 0030BF44
  10257. Frame 7, PC = 0020DC84, SP = 0030BF20, FP = 0030BF44
  10258. Frame 8, PC = 0020DC88, SP = 0030BF1C, FP = 0030BF44
  10259. Frame 9, PC = 0020DC8E, SP = 0030BF18, FP = 0030BF44
  10260. Frame 10, PC = 00203F6C, SP = 0030BE3C, FP = 0030BF14
  10261. Or, if we want to examine the variable 'X' at each source line in the
  10262. buffer:
  10263. (gdb) tfind start
  10264. (gdb) while ($trace_frame != -1)
  10265. > printf "Frame %d, X == %d\n", $trace_frame, X
  10266. > tfind line
  10267. > end
  10268. Frame 0, X = 1
  10269. Frame 7, X = 2
  10270. Frame 13, X = 255
  10271. 
  10272. File: gdb.info, Node: tdump, Next: save tracepoints, Prev: tfind, Up: Analyze Collected Data
  10273. 13.2.2 'tdump'
  10274. --------------
  10275. This command takes no arguments. It prints all the data collected at
  10276. the current trace snapshot.
  10277. (gdb) trace 444
  10278. (gdb) actions
  10279. Enter actions for tracepoint #2, one per line:
  10280. > collect $regs, $locals, $args, gdb_long_test
  10281. > end
  10282. (gdb) tstart
  10283. (gdb) tfind line 444
  10284. #0 gdb_test (p1=0x11, p2=0x22, p3=0x33, p4=0x44, p5=0x55, p6=0x66)
  10285. at gdb_test.c:444
  10286. 444 printp( "%s: arguments = 0x%X 0x%X 0x%X 0x%X 0x%X 0x%X\n", )
  10287. (gdb) tdump
  10288. Data collected at tracepoint 2, trace frame 1:
  10289. d0 0xc4aa0085 -995491707
  10290. d1 0x18 24
  10291. d2 0x80 128
  10292. d3 0x33 51
  10293. d4 0x71aea3d 119204413
  10294. d5 0x22 34
  10295. d6 0xe0 224
  10296. d7 0x380035 3670069
  10297. a0 0x19e24a 1696330
  10298. a1 0x3000668 50333288
  10299. a2 0x100 256
  10300. a3 0x322000 3284992
  10301. a4 0x3000698 50333336
  10302. a5 0x1ad3cc 1758156
  10303. fp 0x30bf3c 0x30bf3c
  10304. sp 0x30bf34 0x30bf34
  10305. ps 0x0 0
  10306. pc 0x20b2c8 0x20b2c8
  10307. fpcontrol 0x0 0
  10308. fpstatus 0x0 0
  10309. fpiaddr 0x0 0
  10310. p = 0x20e5b4 "gdb-test"
  10311. p1 = (void *) 0x11
  10312. p2 = (void *) 0x22
  10313. p3 = (void *) 0x33
  10314. p4 = (void *) 0x44
  10315. p5 = (void *) 0x55
  10316. p6 = (void *) 0x66
  10317. gdb_long_test = 17 '\021'
  10318. (gdb)
  10319. 'tdump' works by scanning the tracepoint's current collection actions
  10320. and printing the value of each expression listed. So 'tdump' can fail,
  10321. if after a run, you change the tracepoint's actions to mention variables
  10322. that were not collected during the run.
  10323. Also, for tracepoints with 'while-stepping' loops, 'tdump' uses the
  10324. collected value of '$pc' to distinguish between trace frames that were
  10325. collected at the tracepoint hit, and frames that were collected while
  10326. stepping. This allows it to correctly choose whether to display the
  10327. basic list of collections, or the collections from the body of the
  10328. while-stepping loop. However, if '$pc' was not collected, then 'tdump'
  10329. will always attempt to dump using the basic collection list, and may
  10330. fail if a while-stepping frame does not include all the same data that
  10331. is collected at the tracepoint hit.
  10332. 
  10333. File: gdb.info, Node: save tracepoints, Prev: tdump, Up: Analyze Collected Data
  10334. 13.2.3 'save tracepoints FILENAME'
  10335. ----------------------------------
  10336. This command saves all current tracepoint definitions together with
  10337. their actions and passcounts, into a file 'FILENAME' suitable for use in
  10338. a later debugging session. To read the saved tracepoint definitions,
  10339. use the 'source' command (*note Command Files::). The
  10340. 'save-tracepoints' command is a deprecated alias for 'save tracepoints'
  10341. 
  10342. File: gdb.info, Node: Tracepoint Variables, Next: Trace Files, Prev: Analyze Collected Data, Up: Tracepoints
  10343. 13.3 Convenience Variables for Tracepoints
  10344. ==========================================
  10345. '(int) $trace_frame'
  10346. The current trace snapshot (a.k.a. "frame") number, or -1 if no
  10347. snapshot is selected.
  10348. '(int) $tracepoint'
  10349. The tracepoint for the current trace snapshot.
  10350. '(int) $trace_line'
  10351. The line number for the current trace snapshot.
  10352. '(char []) $trace_file'
  10353. The source file for the current trace snapshot.
  10354. '(char []) $trace_func'
  10355. The name of the function containing '$tracepoint'.
  10356. Note: '$trace_file' is not suitable for use in 'printf', use 'output'
  10357. instead.
  10358. Here's a simple example of using these convenience variables for
  10359. stepping through all the trace snapshots and printing some of their
  10360. data. Note that these are not the same as trace state variables, which
  10361. are managed by the target.
  10362. (gdb) tfind start
  10363. (gdb) while $trace_frame != -1
  10364. > output $trace_file
  10365. > printf ", line %d (tracepoint #%d)\n", $trace_line, $tracepoint
  10366. > tfind
  10367. > end
  10368. 
  10369. File: gdb.info, Node: Trace Files, Prev: Tracepoint Variables, Up: Tracepoints
  10370. 13.4 Using Trace Files
  10371. ======================
  10372. In some situations, the target running a trace experiment may no longer
  10373. be available; perhaps it crashed, or the hardware was needed for a
  10374. different activity. To handle these cases, you can arrange to dump the
  10375. trace data into a file, and later use that file as a source of trace
  10376. data, via the 'target tfile' command.
  10377. 'tsave [ -r ] FILENAME'
  10378. 'tsave [-ctf] DIRNAME'
  10379. Save the trace data to FILENAME. By default, this command assumes
  10380. that FILENAME refers to the host filesystem, so if necessary GDB
  10381. will copy raw trace data up from the target and then save it. If
  10382. the target supports it, you can also supply the optional argument
  10383. '-r' ("remote") to direct the target to save the data directly into
  10384. FILENAME in its own filesystem, which may be more efficient if the
  10385. trace buffer is very large. (Note, however, that 'target tfile'
  10386. can only read from files accessible to the host.) By default, this
  10387. command will save trace frame in tfile format. You can supply the
  10388. optional argument '-ctf' to save data in CTF format. The "Common
  10389. Trace Format" (CTF) is proposed as a trace format that can be
  10390. shared by multiple debugging and tracing tools. Please go to
  10391. 'http://www.efficios.com/ctf' to get more information.
  10392. 'target tfile FILENAME'
  10393. 'target ctf DIRNAME'
  10394. Use the file named FILENAME or directory named DIRNAME as a source
  10395. of trace data. Commands that examine data work as they do with a
  10396. live target, but it is not possible to run any new trace
  10397. experiments. 'tstatus' will report the state of the trace run at
  10398. the moment the data was saved, as well as the current trace frame
  10399. you are examining. Both FILENAME and DIRNAME must be on a
  10400. filesystem accessible to the host.
  10401. (gdb) target ctf ctf.ctf
  10402. (gdb) tfind
  10403. Found trace frame 0, tracepoint 2
  10404. 39 ++a; /* set tracepoint 1 here */
  10405. (gdb) tdump
  10406. Data collected at tracepoint 2, trace frame 0:
  10407. i = 0
  10408. a = 0
  10409. b = 1 '\001'
  10410. c = {"123", "456", "789", "123", "456", "789"}
  10411. d = {{{a = 1, b = 2}, {a = 3, b = 4}}, {{a = 5, b = 6}, {a = 7, b = 8}}}
  10412. (gdb) p b
  10413. $1 = 1
  10414. 
  10415. File: gdb.info, Node: Overlays, Next: Languages, Prev: Tracepoints, Up: Top
  10416. 14 Debugging Programs That Use Overlays
  10417. ***************************************
  10418. If your program is too large to fit completely in your target system's
  10419. memory, you can sometimes use "overlays" to work around this problem.
  10420. GDB provides some support for debugging programs that use overlays.
  10421. * Menu:
  10422. * How Overlays Work:: A general explanation of overlays.
  10423. * Overlay Commands:: Managing overlays in GDB.
  10424. * Automatic Overlay Debugging:: GDB can find out which overlays are
  10425. mapped by asking the inferior.
  10426. * Overlay Sample Program:: A sample program using overlays.
  10427. 
  10428. File: gdb.info, Node: How Overlays Work, Next: Overlay Commands, Up: Overlays
  10429. 14.1 How Overlays Work
  10430. ======================
  10431. Suppose you have a computer whose instruction address space is only 64
  10432. kilobytes long, but which has much more memory which can be accessed by
  10433. other means: special instructions, segment registers, or memory
  10434. management hardware, for example. Suppose further that you want to
  10435. adapt a program which is larger than 64 kilobytes to run on this system.
  10436. One solution is to identify modules of your program which are
  10437. relatively independent, and need not call each other directly; call
  10438. these modules "overlays". Separate the overlays from the main program,
  10439. and place their machine code in the larger memory. Place your main
  10440. program in instruction memory, but leave at least enough space there to
  10441. hold the largest overlay as well.
  10442. Now, to call a function located in an overlay, you must first copy
  10443. that overlay's machine code from the large memory into the space set
  10444. aside for it in the instruction memory, and then jump to its entry point
  10445. there.
  10446. Data Instruction Larger
  10447. Address Space Address Space Address Space
  10448. +-----------+ +-----------+ +-----------+
  10449. | | | | | |
  10450. +-----------+ +-----------+ +-----------+<-- overlay 1
  10451. | program | | main | .----| overlay 1 | load address
  10452. | variables | | program | | +-----------+
  10453. | and heap | | | | | |
  10454. +-----------+ | | | +-----------+<-- overlay 2
  10455. | | +-----------+ | | | load address
  10456. +-----------+ | | | .-| overlay 2 |
  10457. | | | | | |
  10458. mapped --->+-----------+ | | +-----------+
  10459. address | | | | | |
  10460. | overlay | <-' | | |
  10461. | area | <---' +-----------+<-- overlay 3
  10462. | | <---. | | load address
  10463. +-----------+ `--| overlay 3 |
  10464. | | | |
  10465. +-----------+ | |
  10466. +-----------+
  10467. | |
  10468. +-----------+
  10469. A code overlay
  10470. The diagram (*note A code overlay::) shows a system with separate
  10471. data and instruction address spaces. To map an overlay, the program
  10472. copies its code from the larger address space to the instruction address
  10473. space. Since the overlays shown here all use the same mapped address,
  10474. only one may be mapped at a time. For a system with a single address
  10475. space for data and instructions, the diagram would be similar, except
  10476. that the program variables and heap would share an address space with
  10477. the main program and the overlay area.
  10478. An overlay loaded into instruction memory and ready for use is called
  10479. a "mapped" overlay; its "mapped address" is its address in the
  10480. instruction memory. An overlay not present (or only partially present)
  10481. in instruction memory is called "unmapped"; its "load address" is its
  10482. address in the larger memory. The mapped address is also called the
  10483. "virtual memory address", or "VMA"; the load address is also called the
  10484. "load memory address", or "LMA".
  10485. Unfortunately, overlays are not a completely transparent way to adapt
  10486. a program to limited instruction memory. They introduce a new set of
  10487. global constraints you must keep in mind as you design your program:
  10488. * Before calling or returning to a function in an overlay, your
  10489. program must make sure that overlay is actually mapped. Otherwise,
  10490. the call or return will transfer control to the right address, but
  10491. in the wrong overlay, and your program will probably crash.
  10492. * If the process of mapping an overlay is expensive on your system,
  10493. you will need to choose your overlays carefully to minimize their
  10494. effect on your program's performance.
  10495. * The executable file you load onto your system must contain each
  10496. overlay's instructions, appearing at the overlay's load address,
  10497. not its mapped address. However, each overlay's instructions must
  10498. be relocated and its symbols defined as if the overlay were at its
  10499. mapped address. You can use GNU linker scripts to specify
  10500. different load and relocation addresses for pieces of your program;
  10501. see *note (ld.info)Overlay Description::.
  10502. * The procedure for loading executable files onto your system must be
  10503. able to load their contents into the larger address space as well
  10504. as the instruction and data spaces.
  10505. The overlay system described above is rather simple, and could be
  10506. improved in many ways:
  10507. * If your system has suitable bank switch registers or memory
  10508. management hardware, you could use those facilities to make an
  10509. overlay's load area contents simply appear at their mapped address
  10510. in instruction space. This would probably be faster than copying
  10511. the overlay to its mapped area in the usual way.
  10512. * If your overlays are small enough, you could set aside more than
  10513. one overlay area, and have more than one overlay mapped at a time.
  10514. * You can use overlays to manage data, as well as instructions. In
  10515. general, data overlays are even less transparent to your design
  10516. than code overlays: whereas code overlays only require care when
  10517. you call or return to functions, data overlays require care every
  10518. time you access the data. Also, if you change the contents of a
  10519. data overlay, you must copy its contents back out to its load
  10520. address before you can copy a different data overlay into the same
  10521. mapped area.
  10522. 
  10523. File: gdb.info, Node: Overlay Commands, Next: Automatic Overlay Debugging, Prev: How Overlays Work, Up: Overlays
  10524. 14.2 Overlay Commands
  10525. =====================
  10526. To use GDB's overlay support, each overlay in your program must
  10527. correspond to a separate section of the executable file. The section's
  10528. virtual memory address and load memory address must be the overlay's
  10529. mapped and load addresses. Identifying overlays with sections allows
  10530. GDB to determine the appropriate address of a function or variable,
  10531. depending on whether the overlay is mapped or not.
  10532. GDB's overlay commands all start with the word 'overlay'; you can
  10533. abbreviate this as 'ov' or 'ovly'. The commands are:
  10534. 'overlay off'
  10535. Disable GDB's overlay support. When overlay support is disabled,
  10536. GDB assumes that all functions and variables are always present at
  10537. their mapped addresses. By default, GDB's overlay support is
  10538. disabled.
  10539. 'overlay manual'
  10540. Enable "manual" overlay debugging. In this mode, GDB relies on you
  10541. to tell it which overlays are mapped, and which are not, using the
  10542. 'overlay map-overlay' and 'overlay unmap-overlay' commands
  10543. described below.
  10544. 'overlay map-overlay OVERLAY'
  10545. 'overlay map OVERLAY'
  10546. Tell GDB that OVERLAY is now mapped; OVERLAY must be the name of
  10547. the object file section containing the overlay. When an overlay is
  10548. mapped, GDB assumes it can find the overlay's functions and
  10549. variables at their mapped addresses. GDB assumes that any other
  10550. overlays whose mapped ranges overlap that of OVERLAY are now
  10551. unmapped.
  10552. 'overlay unmap-overlay OVERLAY'
  10553. 'overlay unmap OVERLAY'
  10554. Tell GDB that OVERLAY is no longer mapped; OVERLAY must be the name
  10555. of the object file section containing the overlay. When an overlay
  10556. is unmapped, GDB assumes it can find the overlay's functions and
  10557. variables at their load addresses.
  10558. 'overlay auto'
  10559. Enable "automatic" overlay debugging. In this mode, GDB consults a
  10560. data structure the overlay manager maintains in the inferior to see
  10561. which overlays are mapped. For details, see *note Automatic
  10562. Overlay Debugging::.
  10563. 'overlay load-target'
  10564. 'overlay load'
  10565. Re-read the overlay table from the inferior. Normally, GDB
  10566. re-reads the table GDB automatically each time the inferior stops,
  10567. so this command should only be necessary if you have changed the
  10568. overlay mapping yourself using GDB. This command is only useful
  10569. when using automatic overlay debugging.
  10570. 'overlay list-overlays'
  10571. 'overlay list'
  10572. Display a list of the overlays currently mapped, along with their
  10573. mapped addresses, load addresses, and sizes.
  10574. Normally, when GDB prints a code address, it includes the name of the
  10575. function the address falls in:
  10576. (gdb) print main
  10577. $3 = {int ()} 0x11a0 <main>
  10578. When overlay debugging is enabled, GDB recognizes code in unmapped
  10579. overlays, and prints the names of unmapped functions with asterisks
  10580. around them. For example, if 'foo' is a function in an unmapped
  10581. overlay, GDB prints it this way:
  10582. (gdb) overlay list
  10583. No sections are mapped.
  10584. (gdb) print foo
  10585. $5 = {int (int)} 0x100000 <*foo*>
  10586. When 'foo''s overlay is mapped, GDB prints the function's name normally:
  10587. (gdb) overlay list
  10588. Section .ov.foo.text, loaded at 0x100000 - 0x100034,
  10589. mapped at 0x1016 - 0x104a
  10590. (gdb) print foo
  10591. $6 = {int (int)} 0x1016 <foo>
  10592. When overlay debugging is enabled, GDB can find the correct address
  10593. for functions and variables in an overlay, whether or not the overlay is
  10594. mapped. This allows most GDB commands, like 'break' and 'disassemble',
  10595. to work normally, even on unmapped code. However, GDB's breakpoint
  10596. support has some limitations:
  10597. * You can set breakpoints in functions in unmapped overlays, as long
  10598. as GDB can write to the overlay at its load address.
  10599. * GDB can not set hardware or simulator-based breakpoints in unmapped
  10600. overlays. However, if you set a breakpoint at the end of your
  10601. overlay manager (and tell GDB which overlays are now mapped, if you
  10602. are using manual overlay management), GDB will re-set its
  10603. breakpoints properly.
  10604. 
  10605. File: gdb.info, Node: Automatic Overlay Debugging, Next: Overlay Sample Program, Prev: Overlay Commands, Up: Overlays
  10606. 14.3 Automatic Overlay Debugging
  10607. ================================
  10608. GDB can automatically track which overlays are mapped and which are not,
  10609. given some simple co-operation from the overlay manager in the inferior.
  10610. If you enable automatic overlay debugging with the 'overlay auto'
  10611. command (*note Overlay Commands::), GDB looks in the inferior's memory
  10612. for certain variables describing the current state of the overlays.
  10613. Here are the variables your overlay manager must define to support
  10614. GDB's automatic overlay debugging:
  10615. '_ovly_table':
  10616. This variable must be an array of the following structures:
  10617. struct
  10618. {
  10619. /* The overlay's mapped address. */
  10620. unsigned long vma;
  10621. /* The size of the overlay, in bytes. */
  10622. unsigned long size;
  10623. /* The overlay's load address. */
  10624. unsigned long lma;
  10625. /* Non-zero if the overlay is currently mapped;
  10626. zero otherwise. */
  10627. unsigned long mapped;
  10628. }
  10629. '_novlys':
  10630. This variable must be a four-byte signed integer, holding the total
  10631. number of elements in '_ovly_table'.
  10632. To decide whether a particular overlay is mapped or not, GDB looks
  10633. for an entry in '_ovly_table' whose 'vma' and 'lma' members equal the
  10634. VMA and LMA of the overlay's section in the executable file. When GDB
  10635. finds a matching entry, it consults the entry's 'mapped' member to
  10636. determine whether the overlay is currently mapped.
  10637. In addition, your overlay manager may define a function called
  10638. '_ovly_debug_event'. If this function is defined, GDB will silently set
  10639. a breakpoint there. If the overlay manager then calls this function
  10640. whenever it has changed the overlay table, this will enable GDB to
  10641. accurately keep track of which overlays are in program memory, and
  10642. update any breakpoints that may be set in overlays. This will allow
  10643. breakpoints to work even if the overlays are kept in ROM or other
  10644. non-writable memory while they are not being executed.
  10645. 
  10646. File: gdb.info, Node: Overlay Sample Program, Prev: Automatic Overlay Debugging, Up: Overlays
  10647. 14.4 Overlay Sample Program
  10648. ===========================
  10649. When linking a program which uses overlays, you must place the overlays
  10650. at their load addresses, while relocating them to run at their mapped
  10651. addresses. To do this, you must write a linker script (*note
  10652. (ld.info)Overlay Description::). Unfortunately, since linker scripts
  10653. are specific to a particular host system, target architecture, and
  10654. target memory layout, this manual cannot provide portable sample code
  10655. demonstrating GDB's overlay support.
  10656. However, the GDB source distribution does contain an overlaid
  10657. program, with linker scripts for a few systems, as part of its test
  10658. suite. The program consists of the following files from
  10659. 'gdb/testsuite/gdb.base':
  10660. 'overlays.c'
  10661. The main program file.
  10662. 'ovlymgr.c'
  10663. A simple overlay manager, used by 'overlays.c'.
  10664. 'foo.c'
  10665. 'bar.c'
  10666. 'baz.c'
  10667. 'grbx.c'
  10668. Overlay modules, loaded and used by 'overlays.c'.
  10669. 'd10v.ld'
  10670. 'm32r.ld'
  10671. Linker scripts for linking the test program on the 'd10v-elf' and
  10672. 'm32r-elf' targets.
  10673. You can build the test program using the 'd10v-elf' GCC
  10674. cross-compiler like this:
  10675. $ d10v-elf-gcc -g -c overlays.c
  10676. $ d10v-elf-gcc -g -c ovlymgr.c
  10677. $ d10v-elf-gcc -g -c foo.c
  10678. $ d10v-elf-gcc -g -c bar.c
  10679. $ d10v-elf-gcc -g -c baz.c
  10680. $ d10v-elf-gcc -g -c grbx.c
  10681. $ d10v-elf-gcc -g overlays.o ovlymgr.o foo.o bar.o \
  10682. baz.o grbx.o -Wl,-Td10v.ld -o overlays
  10683. The build process is identical for any other architecture, except
  10684. that you must substitute the appropriate compiler and linker script for
  10685. the target system for 'd10v-elf-gcc' and 'd10v.ld'.
  10686. 
  10687. File: gdb.info, Node: Languages, Next: Symbols, Prev: Overlays, Up: Top
  10688. 15 Using GDB with Different Languages
  10689. *************************************
  10690. Although programming languages generally have common aspects, they are
  10691. rarely expressed in the same manner. For instance, in ANSI C,
  10692. dereferencing a pointer 'p' is accomplished by '*p', but in Modula-2, it
  10693. is accomplished by 'p^'. Values can also be represented (and displayed)
  10694. differently. Hex numbers in C appear as '0x1ae', while in Modula-2 they
  10695. appear as '1AEH'.
  10696. Language-specific information is built into GDB for some languages,
  10697. allowing you to express operations like the above in your program's
  10698. native language, and allowing GDB to output values in a manner
  10699. consistent with the syntax of your program's native language. The
  10700. language you use to build expressions is called the "working language".
  10701. * Menu:
  10702. * Setting:: Switching between source languages
  10703. * Show:: Displaying the language
  10704. * Checks:: Type and range checks
  10705. * Supported Languages:: Supported languages
  10706. * Unsupported Languages:: Unsupported languages
  10707. 
  10708. File: gdb.info, Node: Setting, Next: Show, Up: Languages
  10709. 15.1 Switching Between Source Languages
  10710. =======================================
  10711. There are two ways to control the working language--either have GDB set
  10712. it automatically, or select it manually yourself. You can use the 'set
  10713. language' command for either purpose. On startup, GDB defaults to
  10714. setting the language automatically. The working language is used to
  10715. determine how expressions you type are interpreted, how values are
  10716. printed, etc.
  10717. In addition to the working language, every source file that GDB knows
  10718. about has its own working language. For some object file formats, the
  10719. compiler might indicate which language a particular source file is in.
  10720. However, most of the time GDB infers the language from the name of the
  10721. file. The language of a source file controls whether C++ names are
  10722. demangled--this way 'backtrace' can show each frame appropriately for
  10723. its own language. There is no way to set the language of a source file
  10724. from within GDB, but you can set the language associated with a filename
  10725. extension. *Note Displaying the Language: Show.
  10726. This is most commonly a problem when you use a program, such as
  10727. 'cfront' or 'f2c', that generates C but is written in another language.
  10728. In that case, make the program use '#line' directives in its C output;
  10729. that way GDB will know the correct language of the source code of the
  10730. original program, and will display that source code, not the generated C
  10731. code.
  10732. * Menu:
  10733. * Filenames:: Filename extensions and languages.
  10734. * Manually:: Setting the working language manually
  10735. * Automatically:: Having GDB infer the source language
  10736. 
  10737. File: gdb.info, Node: Filenames, Next: Manually, Up: Setting
  10738. 15.1.1 List of Filename Extensions and Languages
  10739. ------------------------------------------------
  10740. If a source file name ends in one of the following extensions, then GDB
  10741. infers that its language is the one indicated.
  10742. '.ada'
  10743. '.ads'
  10744. '.adb'
  10745. '.a'
  10746. Ada source file.
  10747. '.c'
  10748. C source file
  10749. '.C'
  10750. '.cc'
  10751. '.cp'
  10752. '.cpp'
  10753. '.cxx'
  10754. '.c++'
  10755. C++ source file
  10756. '.d'
  10757. D source file
  10758. '.m'
  10759. Objective-C source file
  10760. '.f'
  10761. '.F'
  10762. Fortran source file
  10763. '.mod'
  10764. Modula-2 source file
  10765. '.s'
  10766. '.S'
  10767. Assembler source file. This actually behaves almost like C, but
  10768. GDB does not skip over function prologues when stepping.
  10769. In addition, you may set the language associated with a filename
  10770. extension. *Note Displaying the Language: Show.
  10771. 
  10772. File: gdb.info, Node: Manually, Next: Automatically, Prev: Filenames, Up: Setting
  10773. 15.1.2 Setting the Working Language
  10774. -----------------------------------
  10775. If you allow GDB to set the language automatically, expressions are
  10776. interpreted the same way in your debugging session and your program.
  10777. If you wish, you may set the language manually. To do this, issue
  10778. the command 'set language LANG', where LANG is the name of a language,
  10779. such as 'c' or 'modula-2'. For a list of the supported languages, type
  10780. 'set language'.
  10781. Setting the language manually prevents GDB from updating the working
  10782. language automatically. This can lead to confusion if you try to debug
  10783. a program when the working language is not the same as the source
  10784. language, when an expression is acceptable to both languages--but means
  10785. different things. For instance, if the current source file were written
  10786. in C, and GDB was parsing Modula-2, a command such as:
  10787. print a = b + c
  10788. might not have the effect you intended. In C, this means to add 'b' and
  10789. 'c' and place the result in 'a'. The result printed would be the value
  10790. of 'a'. In Modula-2, this means to compare 'a' to the result of 'b+c',
  10791. yielding a 'BOOLEAN' value.
  10792. 
  10793. File: gdb.info, Node: Automatically, Prev: Manually, Up: Setting
  10794. 15.1.3 Having GDB Infer the Source Language
  10795. -------------------------------------------
  10796. To have GDB set the working language automatically, use 'set language
  10797. local' or 'set language auto'. GDB then infers the working language.
  10798. That is, when your program stops in a frame (usually by encountering a
  10799. breakpoint), GDB sets the working language to the language recorded for
  10800. the function in that frame. If the language for a frame is unknown
  10801. (that is, if the function or block corresponding to the frame was
  10802. defined in a source file that does not have a recognized extension), the
  10803. current working language is not changed, and GDB issues a warning.
  10804. This may not seem necessary for most programs, which are written
  10805. entirely in one source language. However, program modules and libraries
  10806. written in one source language can be used by a main program written in
  10807. a different source language. Using 'set language auto' in this case
  10808. frees you from having to set the working language manually.
  10809. 
  10810. File: gdb.info, Node: Show, Next: Checks, Prev: Setting, Up: Languages
  10811. 15.2 Displaying the Language
  10812. ============================
  10813. The following commands help you find out which language is the working
  10814. language, and also what language source files were written in.
  10815. 'show language'
  10816. Display the current working language. This is the language you can
  10817. use with commands such as 'print' to build and compute expressions
  10818. that may involve variables in your program.
  10819. 'info frame'
  10820. Display the source language for this frame. This language becomes
  10821. the working language if you use an identifier from this frame.
  10822. *Note Information about a Frame: Frame Info, to identify the other
  10823. information listed here.
  10824. 'info source'
  10825. Display the source language of this source file. *Note Examining
  10826. the Symbol Table: Symbols, to identify the other information listed
  10827. here.
  10828. In unusual circumstances, you may have source files with extensions
  10829. not in the standard list. You can then set the extension associated
  10830. with a language explicitly:
  10831. 'set extension-language EXT LANGUAGE'
  10832. Tell GDB that source files with extension EXT are to be assumed as
  10833. written in the source language LANGUAGE.
  10834. 'info extensions'
  10835. List all the filename extensions and the associated languages.
  10836. 
  10837. File: gdb.info, Node: Checks, Next: Supported Languages, Prev: Show, Up: Languages
  10838. 15.3 Type and Range Checking
  10839. ============================
  10840. Some languages are designed to guard you against making seemingly common
  10841. errors through a series of compile- and run-time checks. These include
  10842. checking the type of arguments to functions and operators and making
  10843. sure mathematical overflows are caught at run time. Checks such as
  10844. these help to ensure a program's correctness once it has been compiled
  10845. by eliminating type mismatches and providing active checks for range
  10846. errors when your program is running.
  10847. By default GDB checks for these errors according to the rules of the
  10848. current source language. Although GDB does not check the statements in
  10849. your program, it can check expressions entered directly into GDB for
  10850. evaluation via the 'print' command, for example.
  10851. * Menu:
  10852. * Type Checking:: An overview of type checking
  10853. * Range Checking:: An overview of range checking
  10854. 
  10855. File: gdb.info, Node: Type Checking, Next: Range Checking, Up: Checks
  10856. 15.3.1 An Overview of Type Checking
  10857. -----------------------------------
  10858. Some languages, such as C and C++, are strongly typed, meaning that the
  10859. arguments to operators and functions have to be of the correct type,
  10860. otherwise an error occurs. These checks prevent type mismatch errors
  10861. from ever causing any run-time problems. For example,
  10862. int klass::my_method(char *b) { return b ? 1 : 2; }
  10863. (gdb) print obj.my_method (0)
  10864. $1 = 2
  10865. but
  10866. (gdb) print obj.my_method (0x1234)
  10867. Cannot resolve method klass::my_method to any overloaded instance
  10868. The second example fails because in C++ the integer constant '0x1234'
  10869. is not type-compatible with the pointer parameter type.
  10870. For the expressions you use in GDB commands, you can tell GDB to not
  10871. enforce strict type checking or to treat any mismatches as errors and
  10872. abandon the expression; When type checking is disabled, GDB successfully
  10873. evaluates expressions like the second example above.
  10874. Even if type checking is off, there may be other reasons related to
  10875. type that prevent GDB from evaluating an expression. For instance, GDB
  10876. does not know how to add an 'int' and a 'struct foo'. These particular
  10877. type errors have nothing to do with the language in use and usually
  10878. arise from expressions which make little sense to evaluate anyway.
  10879. GDB provides some additional commands for controlling type checking:
  10880. 'set check type on'
  10881. 'set check type off'
  10882. Set strict type checking on or off. If any type mismatches occur
  10883. in evaluating an expression while type checking is on, GDB prints a
  10884. message and aborts evaluation of the expression.
  10885. 'show check type'
  10886. Show the current setting of type checking and whether GDB is
  10887. enforcing strict type checking rules.
  10888. 
  10889. File: gdb.info, Node: Range Checking, Prev: Type Checking, Up: Checks
  10890. 15.3.2 An Overview of Range Checking
  10891. ------------------------------------
  10892. In some languages (such as Modula-2), it is an error to exceed the
  10893. bounds of a type; this is enforced with run-time checks. Such range
  10894. checking is meant to ensure program correctness by making sure
  10895. computations do not overflow, or indices on an array element access do
  10896. not exceed the bounds of the array.
  10897. For expressions you use in GDB commands, you can tell GDB to treat
  10898. range errors in one of three ways: ignore them, always treat them as
  10899. errors and abandon the expression, or issue warnings but evaluate the
  10900. expression anyway.
  10901. A range error can result from numerical overflow, from exceeding an
  10902. array index bound, or when you type a constant that is not a member of
  10903. any type. Some languages, however, do not treat overflows as an error.
  10904. In many implementations of C, mathematical overflow causes the result to
  10905. "wrap around" to lower values--for example, if M is the largest integer
  10906. value, and S is the smallest, then
  10907. M + 1 => S
  10908. This, too, is specific to individual languages, and in some cases
  10909. specific to individual compilers or machines. *Note Supported
  10910. Languages: Supported Languages, for further details on specific
  10911. languages.
  10912. GDB provides some additional commands for controlling the range
  10913. checker:
  10914. 'set check range auto'
  10915. Set range checking on or off based on the current working language.
  10916. *Note Supported Languages: Supported Languages, for the default
  10917. settings for each language.
  10918. 'set check range on'
  10919. 'set check range off'
  10920. Set range checking on or off, overriding the default setting for
  10921. the current working language. A warning is issued if the setting
  10922. does not match the language default. If a range error occurs and
  10923. range checking is on, then a message is printed and evaluation of
  10924. the expression is aborted.
  10925. 'set check range warn'
  10926. Output messages when the GDB range checker detects a range error,
  10927. but attempt to evaluate the expression anyway. Evaluating the
  10928. expression may still be impossible for other reasons, such as
  10929. accessing memory that the process does not own (a typical example
  10930. from many Unix systems).
  10931. 'show range'
  10932. Show the current setting of the range checker, and whether or not
  10933. it is being set automatically by GDB.
  10934. 
  10935. File: gdb.info, Node: Supported Languages, Next: Unsupported Languages, Prev: Checks, Up: Languages
  10936. 15.4 Supported Languages
  10937. ========================
  10938. GDB supports C, C++, D, Go, Objective-C, Fortran, OpenCL C, Pascal,
  10939. Rust, assembly, Modula-2, and Ada. Some GDB features may be used in
  10940. expressions regardless of the language you use: the GDB '@' and '::'
  10941. operators, and the '{type}addr' construct (*note Expressions:
  10942. Expressions.) can be used with the constructs of any supported language.
  10943. The following sections detail to what degree each source language is
  10944. supported by GDB. These sections are not meant to be language tutorials
  10945. or references, but serve only as a reference guide to what the GDB
  10946. expression parser accepts, and what input and output formats should look
  10947. like for different languages. There are many good books written on each
  10948. of these languages; please look to these for a language reference or
  10949. tutorial.
  10950. * Menu:
  10951. * C:: C and C++
  10952. * D:: D
  10953. * Go:: Go
  10954. * Objective-C:: Objective-C
  10955. * OpenCL C:: OpenCL C
  10956. * Fortran:: Fortran
  10957. * Pascal:: Pascal
  10958. * Rust:: Rust
  10959. * Modula-2:: Modula-2
  10960. * Ada:: Ada
  10961. 
  10962. File: gdb.info, Node: C, Next: D, Up: Supported Languages
  10963. 15.4.1 C and C++
  10964. ----------------
  10965. Since C and C++ are so closely related, many features of GDB apply to
  10966. both languages. Whenever this is the case, we discuss those languages
  10967. together.
  10968. The C++ debugging facilities are jointly implemented by the C++
  10969. compiler and GDB. Therefore, to debug your C++ code effectively, you
  10970. must compile your C++ programs with a supported C++ compiler, such as
  10971. GNU 'g++', or the HP ANSI C++ compiler ('aCC').
  10972. * Menu:
  10973. * C Operators:: C and C++ operators
  10974. * C Constants:: C and C++ constants
  10975. * C Plus Plus Expressions:: C++ expressions
  10976. * C Defaults:: Default settings for C and C++
  10977. * C Checks:: C and C++ type and range checks
  10978. * Debugging C:: GDB and C
  10979. * Debugging C Plus Plus:: GDB features for C++
  10980. * Decimal Floating Point:: Numbers in Decimal Floating Point format
  10981. 
  10982. File: gdb.info, Node: C Operators, Next: C Constants, Up: C
  10983. 15.4.1.1 C and C++ Operators
  10984. ............................
  10985. Operators must be defined on values of specific types. For instance,
  10986. '+' is defined on numbers, but not on structures. Operators are often
  10987. defined on groups of types.
  10988. For the purposes of C and C++, the following definitions hold:
  10989. * _Integral types_ include 'int' with any of its storage-class
  10990. specifiers; 'char'; 'enum'; and, for C++, 'bool'.
  10991. * _Floating-point types_ include 'float', 'double', and 'long double'
  10992. (if supported by the target platform).
  10993. * _Pointer types_ include all types defined as '(TYPE *)'.
  10994. * _Scalar types_ include all of the above.
  10995. The following operators are supported. They are listed here in order of
  10996. increasing precedence:
  10997. ','
  10998. The comma or sequencing operator. Expressions in a comma-separated
  10999. list are evaluated from left to right, with the result of the
  11000. entire expression being the last expression evaluated.
  11001. '='
  11002. Assignment. The value of an assignment expression is the value
  11003. assigned. Defined on scalar types.
  11004. 'OP='
  11005. Used in an expression of the form 'A OP= B', and translated to
  11006. 'A = A OP B'. 'OP=' and '=' have the same precedence. The
  11007. operator OP is any one of the operators '|', '^', '&', '<<', '>>',
  11008. '+', '-', '*', '/', '%'.
  11009. '?:'
  11010. The ternary operator. 'A ? B : C' can be thought of as: if A then
  11011. B else C. The argument A should be of an integral type.
  11012. '||'
  11013. Logical OR. Defined on integral types.
  11014. '&&'
  11015. Logical AND. Defined on integral types.
  11016. '|'
  11017. Bitwise OR. Defined on integral types.
  11018. '^'
  11019. Bitwise exclusive-OR. Defined on integral types.
  11020. '&'
  11021. Bitwise AND. Defined on integral types.
  11022. '==, !='
  11023. Equality and inequality. Defined on scalar types. The value of
  11024. these expressions is 0 for false and non-zero for true.
  11025. '<, >, <=, >='
  11026. Less than, greater than, less than or equal, greater than or equal.
  11027. Defined on scalar types. The value of these expressions is 0 for
  11028. false and non-zero for true.
  11029. '<<, >>'
  11030. left shift, and right shift. Defined on integral types.
  11031. '@'
  11032. The GDB "artificial array" operator (*note Expressions:
  11033. Expressions.).
  11034. '+, -'
  11035. Addition and subtraction. Defined on integral types,
  11036. floating-point types and pointer types.
  11037. '*, /, %'
  11038. Multiplication, division, and modulus. Multiplication and division
  11039. are defined on integral and floating-point types. Modulus is
  11040. defined on integral types.
  11041. '++, --'
  11042. Increment and decrement. When appearing before a variable, the
  11043. operation is performed before the variable is used in an
  11044. expression; when appearing after it, the variable's value is used
  11045. before the operation takes place.
  11046. '*'
  11047. Pointer dereferencing. Defined on pointer types. Same precedence
  11048. as '++'.
  11049. '&'
  11050. Address operator. Defined on variables. Same precedence as '++'.
  11051. For debugging C++, GDB implements a use of '&' beyond what is
  11052. allowed in the C++ language itself: you can use '&(&REF)' to
  11053. examine the address where a C++ reference variable (declared with
  11054. '&REF') is stored.
  11055. '-'
  11056. Negative. Defined on integral and floating-point types. Same
  11057. precedence as '++'.
  11058. '!'
  11059. Logical negation. Defined on integral types. Same precedence as
  11060. '++'.
  11061. '~'
  11062. Bitwise complement operator. Defined on integral types. Same
  11063. precedence as '++'.
  11064. '., ->'
  11065. Structure member, and pointer-to-structure member. For
  11066. convenience, GDB regards the two as equivalent, choosing whether to
  11067. dereference a pointer based on the stored type information.
  11068. Defined on 'struct' and 'union' data.
  11069. '.*, ->*'
  11070. Dereferences of pointers to members.
  11071. '[]'
  11072. Array indexing. 'A[I]' is defined as '*(A+I)'. Same precedence as
  11073. '->'.
  11074. '()'
  11075. Function parameter list. Same precedence as '->'.
  11076. '::'
  11077. C++ scope resolution operator. Defined on 'struct', 'union', and
  11078. 'class' types.
  11079. '::'
  11080. Doubled colons also represent the GDB scope operator (*note
  11081. Expressions: Expressions.). Same precedence as '::', above.
  11082. If an operator is redefined in the user code, GDB usually attempts to
  11083. invoke the redefined version instead of using the operator's predefined
  11084. meaning.
  11085. 
  11086. File: gdb.info, Node: C Constants, Next: C Plus Plus Expressions, Prev: C Operators, Up: C
  11087. 15.4.1.2 C and C++ Constants
  11088. ............................
  11089. GDB allows you to express the constants of C and C++ in the following
  11090. ways:
  11091. * Integer constants are a sequence of digits. Octal constants are
  11092. specified by a leading '0' (i.e. zero), and hexadecimal constants
  11093. by a leading '0x' or '0X'. Constants may also end with a letter
  11094. 'l', specifying that the constant should be treated as a 'long'
  11095. value.
  11096. * Floating point constants are a sequence of digits, followed by a
  11097. decimal point, followed by a sequence of digits, and optionally
  11098. followed by an exponent. An exponent is of the form:
  11099. 'e[[+]|-]NNN', where NNN is another sequence of digits. The '+' is
  11100. optional for positive exponents. A floating-point constant may
  11101. also end with a letter 'f' or 'F', specifying that the constant
  11102. should be treated as being of the 'float' (as opposed to the
  11103. default 'double') type; or with a letter 'l' or 'L', which
  11104. specifies a 'long double' constant.
  11105. * Enumerated constants consist of enumerated identifiers, or their
  11106. integral equivalents.
  11107. * Character constants are a single character surrounded by single
  11108. quotes ('''), or a number--the ordinal value of the corresponding
  11109. character (usually its ASCII value). Within quotes, the single
  11110. character may be represented by a letter or by "escape sequences",
  11111. which are of the form '\NNN', where NNN is the octal representation
  11112. of the character's ordinal value; or of the form '\X', where 'X' is
  11113. a predefined special character--for example, '\n' for newline.
  11114. Wide character constants can be written by prefixing a character
  11115. constant with 'L', as in C. For example, 'L'x'' is the wide form of
  11116. 'x'. The target wide character set is used when computing the
  11117. value of this constant (*note Character Sets::).
  11118. * String constants are a sequence of character constants surrounded
  11119. by double quotes ('"'). Any valid character constant (as described
  11120. above) may appear. Double quotes within the string must be
  11121. preceded by a backslash, so for instance '"a\"b'c"' is a string of
  11122. five characters.
  11123. Wide string constants can be written by prefixing a string constant
  11124. with 'L', as in C. The target wide character set is used when
  11125. computing the value of this constant (*note Character Sets::).
  11126. * Pointer constants are an integral value. You can also write
  11127. pointers to constants using the C operator '&'.
  11128. * Array constants are comma-separated lists surrounded by braces '{'
  11129. and '}'; for example, '{1,2,3}' is a three-element array of
  11130. integers, '{{1,2}, {3,4}, {5,6}}' is a three-by-two array, and
  11131. '{&"hi", &"there", &"fred"}' is a three-element array of pointers.
  11132. 
  11133. File: gdb.info, Node: C Plus Plus Expressions, Next: C Defaults, Prev: C Constants, Up: C
  11134. 15.4.1.3 C++ Expressions
  11135. ........................
  11136. GDB expression handling can interpret most C++ expressions.
  11137. _Warning:_ GDB can only debug C++ code if you use the proper
  11138. compiler and the proper debug format. Currently, GDB works best
  11139. when debugging C++ code that is compiled with the most recent
  11140. version of GCC possible. The DWARF debugging format is preferred;
  11141. GCC defaults to this on most popular platforms. Other compilers
  11142. and/or debug formats are likely to work badly or not at all when
  11143. using GDB to debug C++ code. *Note Compilation::.
  11144. 1. Member function calls are allowed; you can use expressions like
  11145. count = aml->GetOriginal(x, y)
  11146. 2. While a member function is active (in the selected stack frame),
  11147. your expressions have the same namespace available as the member
  11148. function; that is, GDB allows implicit references to the class
  11149. instance pointer 'this' following the same rules as C++. 'using'
  11150. declarations in the current scope are also respected by GDB.
  11151. 3. You can call overloaded functions; GDB resolves the function call
  11152. to the right definition, with some restrictions. GDB does not
  11153. perform overload resolution involving user-defined type
  11154. conversions, calls to constructors, or instantiations of templates
  11155. that do not exist in the program. It also cannot handle ellipsis
  11156. argument lists or default arguments.
  11157. It does perform integral conversions and promotions, floating-point
  11158. promotions, arithmetic conversions, pointer conversions,
  11159. conversions of class objects to base classes, and standard
  11160. conversions such as those of functions or arrays to pointers; it
  11161. requires an exact match on the number of function arguments.
  11162. Overload resolution is always performed, unless you have specified
  11163. 'set overload-resolution off'. *Note GDB Features for C++:
  11164. Debugging C Plus Plus.
  11165. You must specify 'set overload-resolution off' in order to use an
  11166. explicit function signature to call an overloaded function, as in
  11167. p 'foo(char,int)'('x', 13)
  11168. The GDB command-completion facility can simplify this; see *note
  11169. Command Completion: Completion.
  11170. 4. GDB understands variables declared as C++ lvalue or rvalue
  11171. references; you can use them in expressions just as you do in C++
  11172. source--they are automatically dereferenced.
  11173. In the parameter list shown when GDB displays a frame, the values
  11174. of reference variables are not displayed (unlike other variables);
  11175. this avoids clutter, since references are often used for large
  11176. structures. The _address_ of a reference variable is always shown,
  11177. unless you have specified 'set print address off'.
  11178. 5. GDB supports the C++ name resolution operator '::'--your
  11179. expressions can use it just as expressions in your program do.
  11180. Since one scope may be defined in another, you can use '::'
  11181. repeatedly if necessary, for example in an expression like
  11182. 'SCOPE1::SCOPE2::NAME'. GDB also allows resolving name scope by
  11183. reference to source files, in both C and C++ debugging (*note
  11184. Program Variables: Variables.).
  11185. 6. GDB performs argument-dependent lookup, following the C++
  11186. specification.
  11187. 
  11188. File: gdb.info, Node: C Defaults, Next: C Checks, Prev: C Plus Plus Expressions, Up: C
  11189. 15.4.1.4 C and C++ Defaults
  11190. ...........................
  11191. If you allow GDB to set range checking automatically, it defaults to
  11192. 'off' whenever the working language changes to C or C++. This happens
  11193. regardless of whether you or GDB selects the working language.
  11194. If you allow GDB to set the language automatically, it recognizes
  11195. source files whose names end with '.c', '.C', or '.cc', etc, and when
  11196. GDB enters code compiled from one of these files, it sets the working
  11197. language to C or C++. *Note Having GDB Infer the Source Language:
  11198. Automatically, for further details.
  11199. 
  11200. File: gdb.info, Node: C Checks, Next: Debugging C, Prev: C Defaults, Up: C
  11201. 15.4.1.5 C and C++ Type and Range Checks
  11202. ........................................
  11203. By default, when GDB parses C or C++ expressions, strict type checking
  11204. is used. However, if you turn type checking off, GDB will allow certain
  11205. non-standard conversions, such as promoting integer constants to
  11206. pointers.
  11207. Range checking, if turned on, is done on mathematical operations.
  11208. Array indices are not checked, since they are often used to index a
  11209. pointer that is not itself an array.
  11210. 
  11211. File: gdb.info, Node: Debugging C, Next: Debugging C Plus Plus, Prev: C Checks, Up: C
  11212. 15.4.1.6 GDB and C
  11213. ..................
  11214. The 'set print union' and 'show print union' commands apply to the
  11215. 'union' type. When set to 'on', any 'union' that is inside a 'struct'
  11216. or 'class' is also printed. Otherwise, it appears as '{...}'.
  11217. The '@' operator aids in the debugging of dynamic arrays, formed with
  11218. pointers and a memory allocation function. *Note Expressions:
  11219. Expressions.
  11220. 
  11221. File: gdb.info, Node: Debugging C Plus Plus, Next: Decimal Floating Point, Prev: Debugging C, Up: C
  11222. 15.4.1.7 GDB Features for C++
  11223. .............................
  11224. Some GDB commands are particularly useful with C++, and some are
  11225. designed specifically for use with C++. Here is a summary:
  11226. 'breakpoint menus'
  11227. When you want a breakpoint in a function whose name is overloaded,
  11228. GDB has the capability to display a menu of possible breakpoint
  11229. locations to help you specify which function definition you want.
  11230. *Note Ambiguous Expressions: Ambiguous Expressions.
  11231. 'rbreak REGEX'
  11232. Setting breakpoints using regular expressions is helpful for
  11233. setting breakpoints on overloaded functions that are not members of
  11234. any special classes. *Note Setting Breakpoints: Set Breaks.
  11235. 'catch throw'
  11236. 'catch rethrow'
  11237. 'catch catch'
  11238. Debug C++ exception handling using these commands. *Note Setting
  11239. Catchpoints: Set Catchpoints.
  11240. 'ptype TYPENAME'
  11241. Print inheritance relationships as well as other information for
  11242. type TYPENAME. *Note Examining the Symbol Table: Symbols.
  11243. 'info vtbl EXPRESSION.'
  11244. The 'info vtbl' command can be used to display the virtual method
  11245. tables of the object computed by EXPRESSION. This shows one entry
  11246. per virtual table; there may be multiple virtual tables when
  11247. multiple inheritance is in use.
  11248. 'demangle NAME'
  11249. Demangle NAME. *Note Symbols::, for a more complete description of
  11250. the 'demangle' command.
  11251. 'set print demangle'
  11252. 'show print demangle'
  11253. 'set print asm-demangle'
  11254. 'show print asm-demangle'
  11255. Control whether C++ symbols display in their source form, both when
  11256. displaying code as C++ source and when displaying disassemblies.
  11257. *Note Print Settings: Print Settings.
  11258. 'set print object'
  11259. 'show print object'
  11260. Choose whether to print derived (actual) or declared types of
  11261. objects. *Note Print Settings: Print Settings.
  11262. 'set print vtbl'
  11263. 'show print vtbl'
  11264. Control the format for printing virtual function tables. *Note
  11265. Print Settings: Print Settings. (The 'vtbl' commands do not work
  11266. on programs compiled with the HP ANSI C++ compiler ('aCC').)
  11267. 'set overload-resolution on'
  11268. Enable overload resolution for C++ expression evaluation. The
  11269. default is on. For overloaded functions, GDB evaluates the
  11270. arguments and searches for a function whose signature matches the
  11271. argument types, using the standard C++ conversion rules (see *note
  11272. C++ Expressions: C Plus Plus Expressions, for details). If it
  11273. cannot find a match, it emits a message.
  11274. 'set overload-resolution off'
  11275. Disable overload resolution for C++ expression evaluation. For
  11276. overloaded functions that are not class member functions, GDB
  11277. chooses the first function of the specified name that it finds in
  11278. the symbol table, whether or not its arguments are of the correct
  11279. type. For overloaded functions that are class member functions,
  11280. GDB searches for a function whose signature _exactly_ matches the
  11281. argument types.
  11282. 'show overload-resolution'
  11283. Show the current setting of overload resolution.
  11284. 'Overloaded symbol names'
  11285. You can specify a particular definition of an overloaded symbol,
  11286. using the same notation that is used to declare such symbols in
  11287. C++: type 'SYMBOL(TYPES)' rather than just SYMBOL. You can also
  11288. use the GDB command-line word completion facilities to list the
  11289. available choices, or to finish the type list for you. *Note
  11290. Command Completion: Completion, for details on how to do this.
  11291. 'Breakpoints in functions with ABI tags'
  11292. The GNU C++ compiler introduced the notion of ABI "tags", which
  11293. correspond to changes in the ABI of a type, function, or variable
  11294. that would not otherwise be reflected in a mangled name. See
  11295. <https://developers.redhat.com/blog/2015/02/05/gcc5-and-the-c11-abi/>
  11296. for more detail.
  11297. The ABI tags are visible in C++ demangled names. For example, a
  11298. function that returns a std::string:
  11299. std::string function(int);
  11300. when compiled for the C++11 ABI is marked with the 'cxx11' ABI tag,
  11301. and GDB displays the symbol like this:
  11302. function[abi:cxx11](int)
  11303. You can set a breakpoint on such functions simply as if they had no
  11304. tag. For example:
  11305. (gdb) b function(int)
  11306. Breakpoint 2 at 0x40060d: file main.cc, line 10.
  11307. (gdb) info breakpoints
  11308. Num Type Disp Enb Address What
  11309. 1 breakpoint keep y 0x0040060d in function[abi:cxx11](int)
  11310. at main.cc:10
  11311. On the rare occasion you need to disambiguate between different ABI
  11312. tags, you can do so by simply including the ABI tag in the function
  11313. name, like:
  11314. (gdb) b ambiguous[abi:other_tag](int)
  11315. 
  11316. File: gdb.info, Node: Decimal Floating Point, Prev: Debugging C Plus Plus, Up: C
  11317. 15.4.1.8 Decimal Floating Point format
  11318. ......................................
  11319. GDB can examine, set and perform computations with numbers in decimal
  11320. floating point format, which in the C language correspond to the
  11321. '_Decimal32', '_Decimal64' and '_Decimal128' types as specified by the
  11322. extension to support decimal floating-point arithmetic.
  11323. There are two encodings in use, depending on the architecture: BID
  11324. (Binary Integer Decimal) for x86 and x86-64, and DPD (Densely Packed
  11325. Decimal) for PowerPC and S/390. GDB will use the appropriate encoding
  11326. for the configured target.
  11327. Because of a limitation in 'libdecnumber', the library used by GDB to
  11328. manipulate decimal floating point numbers, it is not possible to convert
  11329. (using a cast, for example) integers wider than 32-bit to decimal float.
  11330. In addition, in order to imitate GDB's behaviour with binary floating
  11331. point computations, error checking in decimal float operations ignores
  11332. underflow, overflow and divide by zero exceptions.
  11333. In the PowerPC architecture, GDB provides a set of pseudo-registers
  11334. to inspect '_Decimal128' values stored in floating point registers. See
  11335. *note PowerPC: PowerPC. for more details.
  11336. 
  11337. File: gdb.info, Node: D, Next: Go, Prev: C, Up: Supported Languages
  11338. 15.4.2 D
  11339. --------
  11340. GDB can be used to debug programs written in D and compiled with GDC,
  11341. LDC or DMD compilers. Currently GDB supports only one D specific
  11342. feature -- dynamic arrays.
  11343. 
  11344. File: gdb.info, Node: Go, Next: Objective-C, Prev: D, Up: Supported Languages
  11345. 15.4.3 Go
  11346. ---------
  11347. GDB can be used to debug programs written in Go and compiled with
  11348. 'gccgo' or '6g' compilers.
  11349. Here is a summary of the Go-specific features and restrictions:
  11350. 'The current Go package'
  11351. The name of the current package does not need to be specified when
  11352. specifying global variables and functions.
  11353. For example, given the program:
  11354. package main
  11355. var myglob = "Shall we?"
  11356. func main () {
  11357. // ...
  11358. }
  11359. When stopped inside 'main' either of these work:
  11360. (gdb) p myglob
  11361. (gdb) p main.myglob
  11362. 'Builtin Go types'
  11363. The 'string' type is recognized by GDB and is printed as a string.
  11364. 'Builtin Go functions'
  11365. The GDB expression parser recognizes the 'unsafe.Sizeof' function
  11366. and handles it internally.
  11367. 'Restrictions on Go expressions'
  11368. All Go operators are supported except '&^'. The Go '_' "blank
  11369. identifier" is not supported. Automatic dereferencing of pointers
  11370. is not supported.
  11371. 
  11372. File: gdb.info, Node: Objective-C, Next: OpenCL C, Prev: Go, Up: Supported Languages
  11373. 15.4.4 Objective-C
  11374. ------------------
  11375. This section provides information about some commands and command
  11376. options that are useful for debugging Objective-C code. See also *note
  11377. info classes: Symbols, and *note info selectors: Symbols, for a few more
  11378. commands specific to Objective-C support.
  11379. * Menu:
  11380. * Method Names in Commands::
  11381. * The Print Command with Objective-C::
  11382. 
  11383. File: gdb.info, Node: Method Names in Commands, Next: The Print Command with Objective-C, Up: Objective-C
  11384. 15.4.4.1 Method Names in Commands
  11385. .................................
  11386. The following commands have been extended to accept Objective-C method
  11387. names as line specifications:
  11388. * 'clear'
  11389. * 'break'
  11390. * 'info line'
  11391. * 'jump'
  11392. * 'list'
  11393. A fully qualified Objective-C method name is specified as
  11394. -[CLASS METHODNAME]
  11395. where the minus sign is used to indicate an instance method and a
  11396. plus sign (not shown) is used to indicate a class method. The class
  11397. name CLASS and method name METHODNAME are enclosed in brackets, similar
  11398. to the way messages are specified in Objective-C source code. For
  11399. example, to set a breakpoint at the 'create' instance method of class
  11400. 'Fruit' in the program currently being debugged, enter:
  11401. break -[Fruit create]
  11402. To list ten program lines around the 'initialize' class method,
  11403. enter:
  11404. list +[NSText initialize]
  11405. In the current version of GDB, the plus or minus sign is required.
  11406. In future versions of GDB, the plus or minus sign will be optional, but
  11407. you can use it to narrow the search. It is also possible to specify
  11408. just a method name:
  11409. break create
  11410. You must specify the complete method name, including any colons. If
  11411. your program's source files contain more than one 'create' method,
  11412. you'll be presented with a numbered list of classes that implement that
  11413. method. Indicate your choice by number, or type '0' to exit if none
  11414. apply.
  11415. As another example, to clear a breakpoint established at the
  11416. 'makeKeyAndOrderFront:' method of the 'NSWindow' class, enter:
  11417. clear -[NSWindow makeKeyAndOrderFront:]
  11418. 
  11419. File: gdb.info, Node: The Print Command with Objective-C, Prev: Method Names in Commands, Up: Objective-C
  11420. 15.4.4.2 The Print Command With Objective-C
  11421. ...........................................
  11422. The print command has also been extended to accept methods. For
  11423. example:
  11424. print -[OBJECT hash]
  11425. will tell GDB to send the 'hash' message to OBJECT and print the result.
  11426. Also, an additional command has been added, 'print-object' or 'po' for
  11427. short, which is meant to print the description of an object. However,
  11428. this command may only work with certain Objective-C libraries that have
  11429. a particular hook function, '_NSPrintForDebugger', defined.
  11430. 
  11431. File: gdb.info, Node: OpenCL C, Next: Fortran, Prev: Objective-C, Up: Supported Languages
  11432. 15.4.5 OpenCL C
  11433. ---------------
  11434. This section provides information about GDBs OpenCL C support.
  11435. * Menu:
  11436. * OpenCL C Datatypes::
  11437. * OpenCL C Expressions::
  11438. * OpenCL C Operators::
  11439. 
  11440. File: gdb.info, Node: OpenCL C Datatypes, Next: OpenCL C Expressions, Up: OpenCL C
  11441. 15.4.5.1 OpenCL C Datatypes
  11442. ...........................
  11443. GDB supports the builtin scalar and vector datatypes specified by OpenCL
  11444. 1.1. In addition the half- and double-precision floating point data
  11445. types of the 'cl_khr_fp16' and 'cl_khr_fp64' OpenCL extensions are also
  11446. known to GDB.
  11447. 
  11448. File: gdb.info, Node: OpenCL C Expressions, Next: OpenCL C Operators, Prev: OpenCL C Datatypes, Up: OpenCL C
  11449. 15.4.5.2 OpenCL C Expressions
  11450. .............................
  11451. GDB supports accesses to vector components including the access as
  11452. lvalue where possible. Since OpenCL C is based on C99 most C
  11453. expressions supported by GDB can be used as well.
  11454. 
  11455. File: gdb.info, Node: OpenCL C Operators, Prev: OpenCL C Expressions, Up: OpenCL C
  11456. 15.4.5.3 OpenCL C Operators
  11457. ...........................
  11458. GDB supports the operators specified by OpenCL 1.1 for scalar and vector
  11459. data types.
  11460. 
  11461. File: gdb.info, Node: Fortran, Next: Pascal, Prev: OpenCL C, Up: Supported Languages
  11462. 15.4.6 Fortran
  11463. --------------
  11464. GDB can be used to debug programs written in Fortran, but it currently
  11465. supports only the features of Fortran 77 language.
  11466. Some Fortran compilers (GNU Fortran 77 and Fortran 95 compilers among
  11467. them) append an underscore to the names of variables and functions.
  11468. When you debug programs compiled by those compilers, you will need to
  11469. refer to variables and functions with a trailing underscore.
  11470. * Menu:
  11471. * Fortran Operators:: Fortran operators and expressions
  11472. * Fortran Defaults:: Default settings for Fortran
  11473. * Special Fortran Commands:: Special GDB commands for Fortran
  11474. 
  11475. File: gdb.info, Node: Fortran Operators, Next: Fortran Defaults, Up: Fortran
  11476. 15.4.6.1 Fortran Operators and Expressions
  11477. ..........................................
  11478. Operators must be defined on values of specific types. For instance,
  11479. '+' is defined on numbers, but not on characters or other non-
  11480. arithmetic types. Operators are often defined on groups of types.
  11481. '**'
  11482. The exponentiation operator. It raises the first operand to the
  11483. power of the second one.
  11484. ':'
  11485. The range operator. Normally used in the form of array(low:high)
  11486. to represent a section of array.
  11487. '%'
  11488. The access component operator. Normally used to access elements in
  11489. derived types. Also suitable for unions. As unions aren't part of
  11490. regular Fortran, this can only happen when accessing a register
  11491. that uses a gdbarch-defined union type.
  11492. '::'
  11493. The scope operator. Normally used to access variables in modules
  11494. or to set breakpoints on subroutines nested in modules or in other
  11495. subroutines (internal subroutines).
  11496. 
  11497. File: gdb.info, Node: Fortran Defaults, Next: Special Fortran Commands, Prev: Fortran Operators, Up: Fortran
  11498. 15.4.6.2 Fortran Defaults
  11499. .........................
  11500. Fortran symbols are usually case-insensitive, so GDB by default uses
  11501. case-insensitive matches for Fortran symbols. You can change that with
  11502. the 'set case-insensitive' command, see *note Symbols::, for the
  11503. details.
  11504. 
  11505. File: gdb.info, Node: Special Fortran Commands, Prev: Fortran Defaults, Up: Fortran
  11506. 15.4.6.3 Special Fortran Commands
  11507. .................................
  11508. GDB has some commands to support Fortran-specific features, such as
  11509. displaying common blocks.
  11510. 'info common [COMMON-NAME]'
  11511. This command prints the values contained in the Fortran 'COMMON'
  11512. block whose name is COMMON-NAME. With no argument, the names of
  11513. all 'COMMON' blocks visible at the current program location are
  11514. printed.
  11515. 
  11516. File: gdb.info, Node: Pascal, Next: Rust, Prev: Fortran, Up: Supported Languages
  11517. 15.4.7 Pascal
  11518. -------------
  11519. Debugging Pascal programs which use sets, subranges, file variables, or
  11520. nested functions does not currently work. GDB does not support entering
  11521. expressions, printing values, or similar features using Pascal syntax.
  11522. The Pascal-specific command 'set print pascal_static-members'
  11523. controls whether static members of Pascal objects are displayed. *Note
  11524. pascal_static-members: Print Settings.
  11525. 
  11526. File: gdb.info, Node: Rust, Next: Modula-2, Prev: Pascal, Up: Supported Languages
  11527. 15.4.8 Rust
  11528. -----------
  11529. GDB supports the Rust Programming Language (https://www.rust-lang.org/).
  11530. Type- and value-printing, and expression parsing, are reasonably
  11531. complete. However, there are a few peculiarities and holes to be aware
  11532. of.
  11533. * Linespecs (*note Specify Location::) are never relative to the
  11534. current crate. Instead, they act as if there were a global
  11535. namespace of crates, somewhat similar to the way 'extern crate'
  11536. behaves.
  11537. That is, if GDB is stopped at a breakpoint in a function in crate
  11538. 'A', module 'B', then 'break B::f' will attempt to set a breakpoint
  11539. in a function named 'f' in a crate named 'B'.
  11540. As a consequence of this approach, linespecs also cannot refer to
  11541. items using 'self::' or 'super::'.
  11542. * Because GDB implements Rust name-lookup semantics in expressions,
  11543. it will sometimes prepend the current crate to a name. For
  11544. example, if GDB is stopped at a breakpoint in the crate 'K', then
  11545. 'print ::x::y' will try to find the symbol 'K::x::y'.
  11546. However, since it is useful to be able to refer to other crates
  11547. when debugging, GDB provides the 'extern' extension to circumvent
  11548. this. To use the extension, just put 'extern' before a path
  11549. expression to refer to the otherwise unavailable "global" scope.
  11550. In the above example, if you wanted to refer to the symbol 'y' in
  11551. the crate 'x', you would use 'print extern x::y'.
  11552. * The Rust expression evaluator does not support "statement-like"
  11553. expressions such as 'if' or 'match', or lambda expressions.
  11554. * Tuple expressions are not implemented.
  11555. * The Rust expression evaluator does not currently implement the
  11556. 'Drop' trait. Objects that may be created by the evaluator will
  11557. never be destroyed.
  11558. * GDB does not implement type inference for generics. In order to
  11559. call generic functions or otherwise refer to generic items, you
  11560. will have to specify the type parameters manually.
  11561. * GDB currently uses the C++ demangler for Rust. In most cases this
  11562. does not cause any problems. However, in an expression context,
  11563. completing a generic function name will give syntactically invalid
  11564. results. This happens because Rust requires the '::' operator
  11565. between the function name and its generic arguments. For example,
  11566. GDB might provide a completion like 'crate::f<u32>', where the
  11567. parser would require 'crate::f::<u32>'.
  11568. * As of this writing, the Rust compiler (version 1.8) has a few holes
  11569. in the debugging information it generates. These holes prevent
  11570. certain features from being implemented by GDB:
  11571. * Method calls cannot be made via traits.
  11572. * Operator overloading is not implemented.
  11573. * When debugging in a monomorphized function, you cannot use the
  11574. generic type names.
  11575. * The type 'Self' is not available.
  11576. * 'use' statements are not available, so some names may not be
  11577. available in the crate.
  11578. 
  11579. File: gdb.info, Node: Modula-2, Next: Ada, Prev: Rust, Up: Supported Languages
  11580. 15.4.9 Modula-2
  11581. ---------------
  11582. The extensions made to GDB to support Modula-2 only support output from
  11583. the GNU Modula-2 compiler (which is currently being developed). Other
  11584. Modula-2 compilers are not currently supported, and attempting to debug
  11585. executables produced by them is most likely to give an error as GDB
  11586. reads in the executable's symbol table.
  11587. * Menu:
  11588. * M2 Operators:: Built-in operators
  11589. * Built-In Func/Proc:: Built-in functions and procedures
  11590. * M2 Constants:: Modula-2 constants
  11591. * M2 Types:: Modula-2 types
  11592. * M2 Defaults:: Default settings for Modula-2
  11593. * Deviations:: Deviations from standard Modula-2
  11594. * M2 Checks:: Modula-2 type and range checks
  11595. * M2 Scope:: The scope operators '::' and '.'
  11596. * GDB/M2:: GDB and Modula-2
  11597. 
  11598. File: gdb.info, Node: M2 Operators, Next: Built-In Func/Proc, Up: Modula-2
  11599. 15.4.9.1 Operators
  11600. ..................
  11601. Operators must be defined on values of specific types. For instance,
  11602. '+' is defined on numbers, but not on structures. Operators are often
  11603. defined on groups of types. For the purposes of Modula-2, the following
  11604. definitions hold:
  11605. * _Integral types_ consist of 'INTEGER', 'CARDINAL', and their
  11606. subranges.
  11607. * _Character types_ consist of 'CHAR' and its subranges.
  11608. * _Floating-point types_ consist of 'REAL'.
  11609. * _Pointer types_ consist of anything declared as 'POINTER TO TYPE'.
  11610. * _Scalar types_ consist of all of the above.
  11611. * _Set types_ consist of 'SET' and 'BITSET' types.
  11612. * _Boolean types_ consist of 'BOOLEAN'.
  11613. The following operators are supported, and appear in order of increasing
  11614. precedence:
  11615. ','
  11616. Function argument or array index separator.
  11617. ':='
  11618. Assignment. The value of VAR ':=' VALUE is VALUE.
  11619. '<, >'
  11620. Less than, greater than on integral, floating-point, or enumerated
  11621. types.
  11622. '<=, >='
  11623. Less than or equal to, greater than or equal to on integral,
  11624. floating-point and enumerated types, or set inclusion on set types.
  11625. Same precedence as '<'.
  11626. '=, <>, #'
  11627. Equality and two ways of expressing inequality, valid on scalar
  11628. types. Same precedence as '<'. In GDB scripts, only '<>' is
  11629. available for inequality, since '#' conflicts with the script
  11630. comment character.
  11631. 'IN'
  11632. Set membership. Defined on set types and the types of their
  11633. members. Same precedence as '<'.
  11634. 'OR'
  11635. Boolean disjunction. Defined on boolean types.
  11636. 'AND, &'
  11637. Boolean conjunction. Defined on boolean types.
  11638. '@'
  11639. The GDB "artificial array" operator (*note Expressions:
  11640. Expressions.).
  11641. '+, -'
  11642. Addition and subtraction on integral and floating-point types, or
  11643. union and difference on set types.
  11644. '*'
  11645. Multiplication on integral and floating-point types, or set
  11646. intersection on set types.
  11647. '/'
  11648. Division on floating-point types, or symmetric set difference on
  11649. set types. Same precedence as '*'.
  11650. 'DIV, MOD'
  11651. Integer division and remainder. Defined on integral types. Same
  11652. precedence as '*'.
  11653. '-'
  11654. Negative. Defined on 'INTEGER' and 'REAL' data.
  11655. '^'
  11656. Pointer dereferencing. Defined on pointer types.
  11657. 'NOT'
  11658. Boolean negation. Defined on boolean types. Same precedence as
  11659. '^'.
  11660. '.'
  11661. 'RECORD' field selector. Defined on 'RECORD' data. Same
  11662. precedence as '^'.
  11663. '[]'
  11664. Array indexing. Defined on 'ARRAY' data. Same precedence as '^'.
  11665. '()'
  11666. Procedure argument list. Defined on 'PROCEDURE' objects. Same
  11667. precedence as '^'.
  11668. '::, .'
  11669. GDB and Modula-2 scope operators.
  11670. _Warning:_ Set expressions and their operations are not yet
  11671. supported, so GDB treats the use of the operator 'IN', or the use
  11672. of operators '+', '-', '*', '/', '=', , '<>', '#', '<=', and '>='
  11673. on sets as an error.
  11674. 
  11675. File: gdb.info, Node: Built-In Func/Proc, Next: M2 Constants, Prev: M2 Operators, Up: Modula-2
  11676. 15.4.9.2 Built-in Functions and Procedures
  11677. ..........................................
  11678. Modula-2 also makes available several built-in procedures and functions.
  11679. In describing these, the following metavariables are used:
  11680. A
  11681. represents an 'ARRAY' variable.
  11682. C
  11683. represents a 'CHAR' constant or variable.
  11684. I
  11685. represents a variable or constant of integral type.
  11686. M
  11687. represents an identifier that belongs to a set. Generally used in
  11688. the same function with the metavariable S. The type of S should be
  11689. 'SET OF MTYPE' (where MTYPE is the type of M).
  11690. N
  11691. represents a variable or constant of integral or floating-point
  11692. type.
  11693. R
  11694. represents a variable or constant of floating-point type.
  11695. T
  11696. represents a type.
  11697. V
  11698. represents a variable.
  11699. X
  11700. represents a variable or constant of one of many types. See the
  11701. explanation of the function for details.
  11702. All Modula-2 built-in procedures also return a result, described
  11703. below.
  11704. 'ABS(N)'
  11705. Returns the absolute value of N.
  11706. 'CAP(C)'
  11707. If C is a lower case letter, it returns its upper case equivalent,
  11708. otherwise it returns its argument.
  11709. 'CHR(I)'
  11710. Returns the character whose ordinal value is I.
  11711. 'DEC(V)'
  11712. Decrements the value in the variable V by one. Returns the new
  11713. value.
  11714. 'DEC(V,I)'
  11715. Decrements the value in the variable V by I. Returns the new
  11716. value.
  11717. 'EXCL(M,S)'
  11718. Removes the element M from the set S. Returns the new set.
  11719. 'FLOAT(I)'
  11720. Returns the floating point equivalent of the integer I.
  11721. 'HIGH(A)'
  11722. Returns the index of the last member of A.
  11723. 'INC(V)'
  11724. Increments the value in the variable V by one. Returns the new
  11725. value.
  11726. 'INC(V,I)'
  11727. Increments the value in the variable V by I. Returns the new
  11728. value.
  11729. 'INCL(M,S)'
  11730. Adds the element M to the set S if it is not already there.
  11731. Returns the new set.
  11732. 'MAX(T)'
  11733. Returns the maximum value of the type T.
  11734. 'MIN(T)'
  11735. Returns the minimum value of the type T.
  11736. 'ODD(I)'
  11737. Returns boolean TRUE if I is an odd number.
  11738. 'ORD(X)'
  11739. Returns the ordinal value of its argument. For example, the
  11740. ordinal value of a character is its ASCII value (on machines
  11741. supporting the ASCII character set). The argument X must be of an
  11742. ordered type, which include integral, character and enumerated
  11743. types.
  11744. 'SIZE(X)'
  11745. Returns the size of its argument. The argument X can be a variable
  11746. or a type.
  11747. 'TRUNC(R)'
  11748. Returns the integral part of R.
  11749. 'TSIZE(X)'
  11750. Returns the size of its argument. The argument X can be a variable
  11751. or a type.
  11752. 'VAL(T,I)'
  11753. Returns the member of the type T whose ordinal value is I.
  11754. _Warning:_ Sets and their operations are not yet supported, so GDB
  11755. treats the use of procedures 'INCL' and 'EXCL' as an error.
  11756. 
  11757. File: gdb.info, Node: M2 Constants, Next: M2 Types, Prev: Built-In Func/Proc, Up: Modula-2
  11758. 15.4.9.3 Constants
  11759. ..................
  11760. GDB allows you to express the constants of Modula-2 in the following
  11761. ways:
  11762. * Integer constants are simply a sequence of digits. When used in an
  11763. expression, a constant is interpreted to be type-compatible with
  11764. the rest of the expression. Hexadecimal integers are specified by
  11765. a trailing 'H', and octal integers by a trailing 'B'.
  11766. * Floating point constants appear as a sequence of digits, followed
  11767. by a decimal point and another sequence of digits. An optional
  11768. exponent can then be specified, in the form 'E[+|-]NNN', where
  11769. '[+|-]NNN' is the desired exponent. All of the digits of the
  11770. floating point constant must be valid decimal (base 10) digits.
  11771. * Character constants consist of a single character enclosed by a
  11772. pair of like quotes, either single (''') or double ('"'). They may
  11773. also be expressed by their ordinal value (their ASCII value,
  11774. usually) followed by a 'C'.
  11775. * String constants consist of a sequence of characters enclosed by a
  11776. pair of like quotes, either single (''') or double ('"'). Escape
  11777. sequences in the style of C are also allowed. *Note C and C++
  11778. Constants: C Constants, for a brief explanation of escape
  11779. sequences.
  11780. * Enumerated constants consist of an enumerated identifier.
  11781. * Boolean constants consist of the identifiers 'TRUE' and 'FALSE'.
  11782. * Pointer constants consist of integral values only.
  11783. * Set constants are not yet supported.
  11784. 
  11785. File: gdb.info, Node: M2 Types, Next: M2 Defaults, Prev: M2 Constants, Up: Modula-2
  11786. 15.4.9.4 Modula-2 Types
  11787. .......................
  11788. Currently GDB can print the following data types in Modula-2 syntax:
  11789. array types, record types, set types, pointer types, procedure types,
  11790. enumerated types, subrange types and base types. You can also print the
  11791. contents of variables declared using these type. This section gives a
  11792. number of simple source code examples together with sample GDB sessions.
  11793. The first example contains the following section of code:
  11794. VAR
  11795. s: SET OF CHAR ;
  11796. r: [20..40] ;
  11797. and you can request GDB to interrogate the type and value of 'r' and
  11798. 's'.
  11799. (gdb) print s
  11800. {'A'..'C', 'Z'}
  11801. (gdb) ptype s
  11802. SET OF CHAR
  11803. (gdb) print r
  11804. 21
  11805. (gdb) ptype r
  11806. [20..40]
  11807. Likewise if your source code declares 's' as:
  11808. VAR
  11809. s: SET ['A'..'Z'] ;
  11810. then you may query the type of 's' by:
  11811. (gdb) ptype s
  11812. type = SET ['A'..'Z']
  11813. Note that at present you cannot interactively manipulate set expressions
  11814. using the debugger.
  11815. The following example shows how you might declare an array in
  11816. Modula-2 and how you can interact with GDB to print its type and
  11817. contents:
  11818. VAR
  11819. s: ARRAY [-10..10] OF CHAR ;
  11820. (gdb) ptype s
  11821. ARRAY [-10..10] OF CHAR
  11822. Note that the array handling is not yet complete and although the
  11823. type is printed correctly, expression handling still assumes that all
  11824. arrays have a lower bound of zero and not '-10' as in the example above.
  11825. Here are some more type related Modula-2 examples:
  11826. TYPE
  11827. colour = (blue, red, yellow, green) ;
  11828. t = [blue..yellow] ;
  11829. VAR
  11830. s: t ;
  11831. BEGIN
  11832. s := blue ;
  11833. The GDB interaction shows how you can query the data type and value of a
  11834. variable.
  11835. (gdb) print s
  11836. $1 = blue
  11837. (gdb) ptype t
  11838. type = [blue..yellow]
  11839. In this example a Modula-2 array is declared and its contents displayed.
  11840. Observe that the contents are written in the same way as their 'C'
  11841. counterparts.
  11842. VAR
  11843. s: ARRAY [1..5] OF CARDINAL ;
  11844. BEGIN
  11845. s[1] := 1 ;
  11846. (gdb) print s
  11847. $1 = {1, 0, 0, 0, 0}
  11848. (gdb) ptype s
  11849. type = ARRAY [1..5] OF CARDINAL
  11850. The Modula-2 language interface to GDB also understands pointer types
  11851. as shown in this example:
  11852. VAR
  11853. s: POINTER TO ARRAY [1..5] OF CARDINAL ;
  11854. BEGIN
  11855. NEW(s) ;
  11856. s^[1] := 1 ;
  11857. and you can request that GDB describes the type of 's'.
  11858. (gdb) ptype s
  11859. type = POINTER TO ARRAY [1..5] OF CARDINAL
  11860. GDB handles compound types as we can see in this example. Here we
  11861. combine array types, record types, pointer types and subrange types:
  11862. TYPE
  11863. foo = RECORD
  11864. f1: CARDINAL ;
  11865. f2: CHAR ;
  11866. f3: myarray ;
  11867. END ;
  11868. myarray = ARRAY myrange OF CARDINAL ;
  11869. myrange = [-2..2] ;
  11870. VAR
  11871. s: POINTER TO ARRAY myrange OF foo ;
  11872. and you can ask GDB to describe the type of 's' as shown below.
  11873. (gdb) ptype s
  11874. type = POINTER TO ARRAY [-2..2] OF foo = RECORD
  11875. f1 : CARDINAL;
  11876. f2 : CHAR;
  11877. f3 : ARRAY [-2..2] OF CARDINAL;
  11878. END
  11879. 
  11880. File: gdb.info, Node: M2 Defaults, Next: Deviations, Prev: M2 Types, Up: Modula-2
  11881. 15.4.9.5 Modula-2 Defaults
  11882. ..........................
  11883. If type and range checking are set automatically by GDB, they both
  11884. default to 'on' whenever the working language changes to Modula-2. This
  11885. happens regardless of whether you or GDB selected the working language.
  11886. If you allow GDB to set the language automatically, then entering
  11887. code compiled from a file whose name ends with '.mod' sets the working
  11888. language to Modula-2. *Note Having GDB Infer the Source Language:
  11889. Automatically, for further details.
  11890. 
  11891. File: gdb.info, Node: Deviations, Next: M2 Checks, Prev: M2 Defaults, Up: Modula-2
  11892. 15.4.9.6 Deviations from Standard Modula-2
  11893. ..........................................
  11894. A few changes have been made to make Modula-2 programs easier to debug.
  11895. This is done primarily via loosening its type strictness:
  11896. * Unlike in standard Modula-2, pointer constants can be formed by
  11897. integers. This allows you to modify pointer variables during
  11898. debugging. (In standard Modula-2, the actual address contained in
  11899. a pointer variable is hidden from you; it can only be modified
  11900. through direct assignment to another pointer variable or expression
  11901. that returned a pointer.)
  11902. * C escape sequences can be used in strings and characters to
  11903. represent non-printable characters. GDB prints out strings with
  11904. these escape sequences embedded. Single non-printable characters
  11905. are printed using the 'CHR(NNN)' format.
  11906. * The assignment operator (':=') returns the value of its right-hand
  11907. argument.
  11908. * All built-in procedures both modify _and_ return their argument.
  11909. 
  11910. File: gdb.info, Node: M2 Checks, Next: M2 Scope, Prev: Deviations, Up: Modula-2
  11911. 15.4.9.7 Modula-2 Type and Range Checks
  11912. .......................................
  11913. _Warning:_ in this release, GDB does not yet perform type or range
  11914. checking.
  11915. GDB considers two Modula-2 variables type equivalent if:
  11916. * They are of types that have been declared equivalent via a 'TYPE T1
  11917. = T2' statement
  11918. * They have been declared on the same line. (Note: This is true of
  11919. the GNU Modula-2 compiler, but it may not be true of other
  11920. compilers.)
  11921. As long as type checking is enabled, any attempt to combine variables
  11922. whose types are not equivalent is an error.
  11923. Range checking is done on all mathematical operations, assignment,
  11924. array index bounds, and all built-in functions and procedures.
  11925. 
  11926. File: gdb.info, Node: M2 Scope, Next: GDB/M2, Prev: M2 Checks, Up: Modula-2
  11927. 15.4.9.8 The Scope Operators '::' and '.'
  11928. .........................................
  11929. There are a few subtle differences between the Modula-2 scope operator
  11930. ('.') and the GDB scope operator ('::'). The two have similar syntax:
  11931. MODULE . ID
  11932. SCOPE :: ID
  11933. where SCOPE is the name of a module or a procedure, MODULE the name of a
  11934. module, and ID is any declared identifier within your program, except
  11935. another module.
  11936. Using the '::' operator makes GDB search the scope specified by SCOPE
  11937. for the identifier ID. If it is not found in the specified scope, then
  11938. GDB searches all scopes enclosing the one specified by SCOPE.
  11939. Using the '.' operator makes GDB search the current scope for the
  11940. identifier specified by ID that was imported from the definition module
  11941. specified by MODULE. With this operator, it is an error if the
  11942. identifier ID was not imported from definition module MODULE, or if ID
  11943. is not an identifier in MODULE.
  11944. 
  11945. File: gdb.info, Node: GDB/M2, Prev: M2 Scope, Up: Modula-2
  11946. 15.4.9.9 GDB and Modula-2
  11947. .........................
  11948. Some GDB commands have little use when debugging Modula-2 programs.
  11949. Five subcommands of 'set print' and 'show print' apply specifically to C
  11950. and C++: 'vtbl', 'demangle', 'asm-demangle', 'object', and 'union'. The
  11951. first four apply to C++, and the last to the C 'union' type, which has
  11952. no direct analogue in Modula-2.
  11953. The '@' operator (*note Expressions: Expressions.), while available
  11954. with any language, is not useful with Modula-2. Its intent is to aid
  11955. the debugging of "dynamic arrays", which cannot be created in Modula-2
  11956. as they can in C or C++. However, because an address can be specified
  11957. by an integral constant, the construct '{TYPE}ADREXP' is still useful.
  11958. In GDB scripts, the Modula-2 inequality operator '#' is interpreted
  11959. as the beginning of a comment. Use '<>' instead.
  11960. 
  11961. File: gdb.info, Node: Ada, Prev: Modula-2, Up: Supported Languages
  11962. 15.4.10 Ada
  11963. -----------
  11964. The extensions made to GDB for Ada only support output from the GNU Ada
  11965. (GNAT) compiler. Other Ada compilers are not currently supported, and
  11966. attempting to debug executables produced by them is most likely to be
  11967. difficult.
  11968. * Menu:
  11969. * Ada Mode Intro:: General remarks on the Ada syntax
  11970. and semantics supported by Ada mode
  11971. in GDB.
  11972. * Omissions from Ada:: Restrictions on the Ada expression syntax.
  11973. * Additions to Ada:: Extensions of the Ada expression syntax.
  11974. * Overloading support for Ada:: Support for expressions involving overloaded
  11975. subprograms.
  11976. * Stopping Before Main Program:: Debugging the program during elaboration.
  11977. * Ada Exceptions:: Ada Exceptions
  11978. * Ada Tasks:: Listing and setting breakpoints in tasks.
  11979. * Ada Tasks and Core Files:: Tasking Support when Debugging Core Files
  11980. * Ravenscar Profile:: Tasking Support when using the Ravenscar
  11981. Profile
  11982. * Ada Settings:: New settable GDB parameters for Ada.
  11983. * Ada Glitches:: Known peculiarities of Ada mode.
  11984. 
  11985. File: gdb.info, Node: Ada Mode Intro, Next: Omissions from Ada, Up: Ada
  11986. 15.4.10.1 Introduction
  11987. ......................
  11988. The Ada mode of GDB supports a fairly large subset of Ada expression
  11989. syntax, with some extensions. The philosophy behind the design of this
  11990. subset is
  11991. * That GDB should provide basic literals and access to operations for
  11992. arithmetic, dereferencing, field selection, indexing, and
  11993. subprogram calls, leaving more sophisticated computations to
  11994. subprograms written into the program (which therefore may be called
  11995. from GDB).
  11996. * That type safety and strict adherence to Ada language restrictions
  11997. are not particularly important to the GDB user.
  11998. * That brevity is important to the GDB user.
  11999. Thus, for brevity, the debugger acts as if all names declared in
  12000. user-written packages are directly visible, even if they are not visible
  12001. according to Ada rules, thus making it unnecessary to fully qualify most
  12002. names with their packages, regardless of context. Where this causes
  12003. ambiguity, GDB asks the user's intent.
  12004. The debugger will start in Ada mode if it detects an Ada main
  12005. program. As for other languages, it will enter Ada mode when stopped in
  12006. a program that was translated from an Ada source file.
  12007. While in Ada mode, you may use '--' for comments. This is useful
  12008. mostly for documenting command files. The standard GDB comment ('#')
  12009. still works at the beginning of a line in Ada mode, but not in the
  12010. middle (to allow based literals).
  12011. 
  12012. File: gdb.info, Node: Omissions from Ada, Next: Additions to Ada, Prev: Ada Mode Intro, Up: Ada
  12013. 15.4.10.2 Omissions from Ada
  12014. ............................
  12015. Here are the notable omissions from the subset:
  12016. * Only a subset of the attributes are supported:
  12017. - 'First, 'Last, and 'Length on array objects (not on types and
  12018. subtypes).
  12019. - 'Min and 'Max.
  12020. - 'Pos and 'Val.
  12021. - 'Tag.
  12022. - 'Range on array objects (not subtypes), but only as the right
  12023. operand of the membership ('in') operator.
  12024. - 'Access, 'Unchecked_Access, and 'Unrestricted_Access (a GNAT
  12025. extension).
  12026. - 'Address.
  12027. * The names in 'Characters.Latin_1' are not available and
  12028. concatenation is not implemented. Thus, escape characters in
  12029. strings are not currently available.
  12030. * Equality tests ('=' and '/=') on arrays test for bitwise equality
  12031. of representations. They will generally work correctly for strings
  12032. and arrays whose elements have integer or enumeration types. They
  12033. may not work correctly for arrays whose element types have
  12034. user-defined equality, for arrays of real values (in particular,
  12035. IEEE-conformant floating point, because of negative zeroes and
  12036. NaNs), and for arrays whose elements contain unused bits with
  12037. indeterminate values.
  12038. * The other component-by-component array operations ('and', 'or',
  12039. 'xor', 'not', and relational tests other than equality) are not
  12040. implemented.
  12041. * There is limited support for array and record aggregates. They are
  12042. permitted only on the right sides of assignments, as in these
  12043. examples:
  12044. (gdb) set An_Array := (1, 2, 3, 4, 5, 6)
  12045. (gdb) set An_Array := (1, others => 0)
  12046. (gdb) set An_Array := (0|4 => 1, 1..3 => 2, 5 => 6)
  12047. (gdb) set A_2D_Array := ((1, 2, 3), (4, 5, 6), (7, 8, 9))
  12048. (gdb) set A_Record := (1, "Peter", True);
  12049. (gdb) set A_Record := (Name => "Peter", Id => 1, Alive => True)
  12050. Changing a discriminant's value by assigning an aggregate has an
  12051. undefined effect if that discriminant is used within the record.
  12052. However, you can first modify discriminants by directly assigning
  12053. to them (which normally would not be allowed in Ada), and then
  12054. performing an aggregate assignment. For example, given a variable
  12055. 'A_Rec' declared to have a type such as:
  12056. type Rec (Len : Small_Integer := 0) is record
  12057. Id : Integer;
  12058. Vals : IntArray (1 .. Len);
  12059. end record;
  12060. you can assign a value with a different size of 'Vals' with two
  12061. assignments:
  12062. (gdb) set A_Rec.Len := 4
  12063. (gdb) set A_Rec := (Id => 42, Vals => (1, 2, 3, 4))
  12064. As this example also illustrates, GDB is very loose about the usual
  12065. rules concerning aggregates. You may leave out some of the
  12066. components of an array or record aggregate (such as the 'Len'
  12067. component in the assignment to 'A_Rec' above); they will retain
  12068. their original values upon assignment. You may freely use dynamic
  12069. values as indices in component associations. You may even use
  12070. overlapping or redundant component associations, although which
  12071. component values are assigned in such cases is not defined.
  12072. * Calls to dispatching subprograms are not implemented.
  12073. * The overloading algorithm is much more limited (i.e., less
  12074. selective) than that of real Ada. It makes only limited use of the
  12075. context in which a subexpression appears to resolve its meaning,
  12076. and it is much looser in its rules for allowing type matches. As a
  12077. result, some function calls will be ambiguous, and the user will be
  12078. asked to choose the proper resolution.
  12079. * The 'new' operator is not implemented.
  12080. * Entry calls are not implemented.
  12081. * Aside from printing, arithmetic operations on the native VAX
  12082. floating-point formats are not supported.
  12083. * It is not possible to slice a packed array.
  12084. * The names 'True' and 'False', when not part of a qualified name,
  12085. are interpreted as if implicitly prefixed by 'Standard', regardless
  12086. of context. Should your program redefine these names in a package
  12087. or procedure (at best a dubious practice), you will have to use
  12088. fully qualified names to access their new definitions.
  12089. 
  12090. File: gdb.info, Node: Additions to Ada, Next: Overloading support for Ada, Prev: Omissions from Ada, Up: Ada
  12091. 15.4.10.3 Additions to Ada
  12092. ..........................
  12093. As it does for other languages, GDB makes certain generic extensions to
  12094. Ada (*note Expressions::):
  12095. * If the expression E is a variable residing in memory (typically a
  12096. local variable or array element) and N is a positive integer, then
  12097. 'E@N' displays the values of E and the N-1 adjacent variables
  12098. following it in memory as an array. In Ada, this operator is
  12099. generally not necessary, since its prime use is in displaying parts
  12100. of an array, and slicing will usually do this in Ada. However,
  12101. there are occasional uses when debugging programs in which certain
  12102. debugging information has been optimized away.
  12103. * 'B::VAR' means "the variable named VAR that appears in function or
  12104. file B." When B is a file name, you must typically surround it in
  12105. single quotes.
  12106. * The expression '{TYPE} ADDR' means "the variable of type TYPE that
  12107. appears at address ADDR."
  12108. * A name starting with '$' is a convenience variable (*note
  12109. Convenience Vars::) or a machine register (*note Registers::).
  12110. In addition, GDB provides a few other shortcuts and outright
  12111. additions specific to Ada:
  12112. * The assignment statement is allowed as an expression, returning its
  12113. right-hand operand as its value. Thus, you may enter
  12114. (gdb) set x := y + 3
  12115. (gdb) print A(tmp := y + 1)
  12116. * The semicolon is allowed as an "operator," returning as its value
  12117. the value of its right-hand operand. This allows, for example,
  12118. complex conditional breaks:
  12119. (gdb) break f
  12120. (gdb) condition 1 (report(i); k += 1; A(k) > 100)
  12121. * Rather than use catenation and symbolic character names to
  12122. introduce special characters into strings, one may instead use a
  12123. special bracket notation, which is also used to print strings. A
  12124. sequence of characters of the form '["XX"]' within a string or
  12125. character literal denotes the (single) character whose numeric
  12126. encoding is XX in hexadecimal. The sequence of characters '["""]'
  12127. also denotes a single quotation mark in strings. For example,
  12128. "One line.["0a"]Next line.["0a"]"
  12129. contains an ASCII newline character ('Ada.Characters.Latin_1.LF')
  12130. after each period.
  12131. * The subtype used as a prefix for the attributes 'Pos, 'Min, and
  12132. 'Max is optional (and is ignored in any case). For example, it is
  12133. valid to write
  12134. (gdb) print 'max(x, y)
  12135. * When printing arrays, GDB uses positional notation when the array
  12136. has a lower bound of 1, and uses a modified named notation
  12137. otherwise. For example, a one-dimensional array of three integers
  12138. with a lower bound of 3 might print as
  12139. (3 => 10, 17, 1)
  12140. That is, in contrast to valid Ada, only the first component has a
  12141. '=>' clause.
  12142. * You may abbreviate attributes in expressions with any unique,
  12143. multi-character subsequence of their names (an exact match gets
  12144. preference). For example, you may use a'len, a'gth, or a'lh in
  12145. place of a'length.
  12146. * Since Ada is case-insensitive, the debugger normally maps
  12147. identifiers you type to lower case. The GNAT compiler uses
  12148. upper-case characters for some of its internal identifiers, which
  12149. are normally of no interest to users. For the rare occasions when
  12150. you actually have to look at them, enclose them in angle brackets
  12151. to avoid the lower-case mapping. For example,
  12152. (gdb) print <JMPBUF_SAVE>[0]
  12153. * Printing an object of class-wide type or dereferencing an
  12154. access-to-class-wide value will display all the components of the
  12155. object's specific type (as indicated by its run-time tag).
  12156. Likewise, component selection on such a value will operate on the
  12157. specific type of the object.
  12158. 
  12159. File: gdb.info, Node: Overloading support for Ada, Next: Stopping Before Main Program, Prev: Additions to Ada, Up: Ada
  12160. 15.4.10.4 Overloading support for Ada
  12161. .....................................
  12162. The debugger supports limited overloading. Given a subprogram call in
  12163. which the function symbol has multiple definitions, it will use the
  12164. number of actual parameters and some information about their types to
  12165. attempt to narrow the set of definitions. It also makes very limited
  12166. use of context, preferring procedures to functions in the context of the
  12167. 'call' command, and functions to procedures elsewhere.
  12168. If, after narrowing, the set of matching definitions still contains
  12169. more than one definition, GDB will display a menu to query which one it
  12170. should use, for instance:
  12171. (gdb) print f(1)
  12172. Multiple matches for f
  12173. [0] cancel
  12174. [1] foo.f (integer) return boolean at foo.adb:23
  12175. [2] foo.f (foo.new_integer) return boolean at foo.adb:28
  12176. >
  12177. In this case, just select one menu entry either to cancel expression
  12178. evaluation (type '0' and press <RET>) or to continue evaluation with a
  12179. specific instance (type the corresponding number and press <RET>).
  12180. Here are a couple of commands to customize GDB's behavior in this
  12181. case:
  12182. 'set ada print-signatures'
  12183. Control whether parameter types and return types are displayed in
  12184. overloads selection menus. It is 'on' by default. *Note
  12185. Overloading support for Ada::.
  12186. 'show ada print-signatures'
  12187. Show the current setting for displaying parameter types and return
  12188. types in overloads selection menu. *Note Overloading support for
  12189. Ada::.
  12190. 
  12191. File: gdb.info, Node: Stopping Before Main Program, Next: Ada Exceptions, Prev: Overloading support for Ada, Up: Ada
  12192. 15.4.10.5 Stopping at the Very Beginning
  12193. ........................................
  12194. It is sometimes necessary to debug the program during elaboration, and
  12195. before reaching the main procedure. As defined in the Ada Reference
  12196. Manual, the elaboration code is invoked from a procedure called
  12197. 'adainit'. To run your program up to the beginning of elaboration,
  12198. simply use the following two commands: 'tbreak adainit' and 'run'.
  12199. 
  12200. File: gdb.info, Node: Ada Exceptions, Next: Ada Tasks, Prev: Stopping Before Main Program, Up: Ada
  12201. 15.4.10.6 Ada Exceptions
  12202. ........................
  12203. A command is provided to list all Ada exceptions:
  12204. 'info exceptions'
  12205. 'info exceptions REGEXP'
  12206. The 'info exceptions' command allows you to list all Ada exceptions
  12207. defined within the program being debugged, as well as their
  12208. addresses. With a regular expression, REGEXP, as argument, only
  12209. those exceptions whose names match REGEXP are listed.
  12210. Below is a small example, showing how the command can be used, first
  12211. without argument, and next with a regular expression passed as an
  12212. argument.
  12213. (gdb) info exceptions
  12214. All defined Ada exceptions:
  12215. constraint_error: 0x613da0
  12216. program_error: 0x613d20
  12217. storage_error: 0x613ce0
  12218. tasking_error: 0x613ca0
  12219. const.aint_global_e: 0x613b00
  12220. (gdb) info exceptions const.aint
  12221. All Ada exceptions matching regular expression "const.aint":
  12222. constraint_error: 0x613da0
  12223. const.aint_global_e: 0x613b00
  12224. It is also possible to ask GDB to stop your program's execution when
  12225. an exception is raised. For more details, see *note Set Catchpoints::.
  12226. 
  12227. File: gdb.info, Node: Ada Tasks, Next: Ada Tasks and Core Files, Prev: Ada Exceptions, Up: Ada
  12228. 15.4.10.7 Extensions for Ada Tasks
  12229. ..................................
  12230. Support for Ada tasks is analogous to that for threads (*note
  12231. Threads::). GDB provides the following task-related commands:
  12232. 'info tasks'
  12233. This command shows a list of current Ada tasks, as in the following
  12234. example:
  12235. (gdb) info tasks
  12236. ID TID P-ID Pri State Name
  12237. 1 8088000 0 15 Child Activation Wait main_task
  12238. 2 80a4000 1 15 Accept Statement b
  12239. 3 809a800 1 15 Child Activation Wait a
  12240. * 4 80ae800 3 15 Runnable c
  12241. In this listing, the asterisk before the last task indicates it to
  12242. be the task currently being inspected.
  12243. ID
  12244. Represents GDB's internal task number.
  12245. TID
  12246. The Ada task ID.
  12247. P-ID
  12248. The parent's task ID (GDB's internal task number).
  12249. Pri
  12250. The base priority of the task.
  12251. State
  12252. Current state of the task.
  12253. 'Unactivated'
  12254. The task has been created but has not been activated. It
  12255. cannot be executing.
  12256. 'Runnable'
  12257. The task is not blocked for any reason known to Ada. (It
  12258. may be waiting for a mutex, though.) It is conceptually
  12259. "executing" in normal mode.
  12260. 'Terminated'
  12261. The task is terminated, in the sense of ARM 9.3 (5). Any
  12262. dependents that were waiting on terminate alternatives
  12263. have been awakened and have terminated themselves.
  12264. 'Child Activation Wait'
  12265. The task is waiting for created tasks to complete
  12266. activation.
  12267. 'Accept Statement'
  12268. The task is waiting on an accept or selective wait
  12269. statement.
  12270. 'Waiting on entry call'
  12271. The task is waiting on an entry call.
  12272. 'Async Select Wait'
  12273. The task is waiting to start the abortable part of an
  12274. asynchronous select statement.
  12275. 'Delay Sleep'
  12276. The task is waiting on a select statement with only a
  12277. delay alternative open.
  12278. 'Child Termination Wait'
  12279. The task is sleeping having completed a master within
  12280. itself, and is waiting for the tasks dependent on that
  12281. master to become terminated or waiting on a terminate
  12282. Phase.
  12283. 'Wait Child in Term Alt'
  12284. The task is sleeping waiting for tasks on terminate
  12285. alternatives to finish terminating.
  12286. 'Accepting RV with TASKNO'
  12287. The task is accepting a rendez-vous with the task TASKNO.
  12288. Name
  12289. Name of the task in the program.
  12290. 'info task TASKNO'
  12291. This command shows detailed informations on the specified task, as
  12292. in the following example:
  12293. (gdb) info tasks
  12294. ID TID P-ID Pri State Name
  12295. 1 8077880 0 15 Child Activation Wait main_task
  12296. * 2 807c468 1 15 Runnable task_1
  12297. (gdb) info task 2
  12298. Ada Task: 0x807c468
  12299. Name: "task_1"
  12300. Thread: 0
  12301. LWP: 0x1fac
  12302. Parent: 1 ("main_task")
  12303. Base Priority: 15
  12304. State: Runnable
  12305. 'task'
  12306. This command prints the ID and name of the current task.
  12307. (gdb) info tasks
  12308. ID TID P-ID Pri State Name
  12309. 1 8077870 0 15 Child Activation Wait main_task
  12310. * 2 807c458 1 15 Runnable some_task
  12311. (gdb) task
  12312. [Current task is 2 "some_task"]
  12313. 'task TASKNO'
  12314. This command is like the 'thread THREAD-ID' command (*note
  12315. Threads::). It switches the context of debugging from the current
  12316. task to the given task.
  12317. (gdb) info tasks
  12318. ID TID P-ID Pri State Name
  12319. 1 8077870 0 15 Child Activation Wait main_task
  12320. * 2 807c458 1 15 Runnable some_task
  12321. (gdb) task 1
  12322. [Switching to task 1 "main_task"]
  12323. #0 0x8067726 in pthread_cond_wait ()
  12324. (gdb) bt
  12325. #0 0x8067726 in pthread_cond_wait ()
  12326. #1 0x8056714 in system.os_interface.pthread_cond_wait ()
  12327. #2 0x805cb63 in system.task_primitives.operations.sleep ()
  12328. #3 0x806153e in system.tasking.stages.activate_tasks ()
  12329. #4 0x804aacc in un () at un.adb:5
  12330. 'break LOCATION task TASKNO'
  12331. 'break LOCATION task TASKNO if ...'
  12332. These commands are like the 'break ... thread ...' command (*note
  12333. Thread Stops::). The LOCATION argument specifies source lines, as
  12334. described in *note Specify Location::.
  12335. Use the qualifier 'task TASKNO' with a breakpoint command to
  12336. specify that you only want GDB to stop the program when a
  12337. particular Ada task reaches this breakpoint. The TASKNO is one of
  12338. the numeric task identifiers assigned by GDB, shown in the first
  12339. column of the 'info tasks' display.
  12340. If you do not specify 'task TASKNO' when you set a breakpoint, the
  12341. breakpoint applies to _all_ tasks of your program.
  12342. You can use the 'task' qualifier on conditional breakpoints as
  12343. well; in this case, place 'task TASKNO' before the breakpoint
  12344. condition (before the 'if').
  12345. For example,
  12346. (gdb) info tasks
  12347. ID TID P-ID Pri State Name
  12348. 1 140022020 0 15 Child Activation Wait main_task
  12349. 2 140045060 1 15 Accept/Select Wait t2
  12350. 3 140044840 1 15 Runnable t1
  12351. * 4 140056040 1 15 Runnable t3
  12352. (gdb) b 15 task 2
  12353. Breakpoint 5 at 0x120044cb0: file test_task_debug.adb, line 15.
  12354. (gdb) cont
  12355. Continuing.
  12356. task # 1 running
  12357. task # 2 running
  12358. Breakpoint 5, test_task_debug () at test_task_debug.adb:15
  12359. 15 flush;
  12360. (gdb) info tasks
  12361. ID TID P-ID Pri State Name
  12362. 1 140022020 0 15 Child Activation Wait main_task
  12363. * 2 140045060 1 15 Runnable t2
  12364. 3 140044840 1 15 Runnable t1
  12365. 4 140056040 1 15 Delay Sleep t3
  12366. 
  12367. File: gdb.info, Node: Ada Tasks and Core Files, Next: Ravenscar Profile, Prev: Ada Tasks, Up: Ada
  12368. 15.4.10.8 Tasking Support when Debugging Core Files
  12369. ...................................................
  12370. When inspecting a core file, as opposed to debugging a live program,
  12371. tasking support may be limited or even unavailable, depending on the
  12372. platform being used. For instance, on x86-linux, the list of tasks is
  12373. available, but task switching is not supported.
  12374. On certain platforms, the debugger needs to perform some memory
  12375. writes in order to provide Ada tasking support. When inspecting a core
  12376. file, this means that the core file must be opened with read-write
  12377. privileges, using the command '"set write on"' (*note Patching::).
  12378. Under these circumstances, you should make a backup copy of the core
  12379. file before inspecting it with GDB.
  12380. 
  12381. File: gdb.info, Node: Ravenscar Profile, Next: Ada Settings, Prev: Ada Tasks and Core Files, Up: Ada
  12382. 15.4.10.9 Tasking Support when using the Ravenscar Profile
  12383. ..........................................................
  12384. The "Ravenscar Profile" is a subset of the Ada tasking features,
  12385. specifically designed for systems with safety-critical real-time
  12386. requirements.
  12387. 'set ravenscar task-switching on'
  12388. Allows task switching when debugging a program that uses the
  12389. Ravenscar Profile. This is the default.
  12390. 'set ravenscar task-switching off'
  12391. Turn off task switching when debugging a program that uses the
  12392. Ravenscar Profile. This is mostly intended to disable the code
  12393. that adds support for the Ravenscar Profile, in case a bug in
  12394. either GDB or in the Ravenscar runtime is preventing GDB from
  12395. working properly. To be effective, this command should be run
  12396. before the program is started.
  12397. 'show ravenscar task-switching'
  12398. Show whether it is possible to switch from task to task in a
  12399. program using the Ravenscar Profile.
  12400. When Ravenscar task-switching is enabled, Ravenscar tasks are
  12401. announced by GDB as if they were threads:
  12402. (gdb) continue
  12403. [New Ravenscar Thread 0x2b8f0]
  12404. Both Ravenscar tasks and the underlying CPU threads will show up in
  12405. the output of 'info threads':
  12406. (gdb) info threads
  12407. Id Target Id Frame
  12408. 1 Thread 1 (CPU#0 [running]) simple () at simple.adb:10
  12409. 2 Thread 2 (CPU#1 [running]) 0x0000000000003d34 in __gnat_initialize_cpu_devices ()
  12410. 3 Thread 3 (CPU#2 [running]) 0x0000000000003d28 in __gnat_initialize_cpu_devices ()
  12411. 4 Thread 4 (CPU#3 [halted ]) 0x000000000000c6ec in system.task_primitives.operations.idle ()
  12412. * 5 Ravenscar Thread 0x2b8f0 simple () at simple.adb:10
  12413. 6 Ravenscar Thread 0x2f150 0x000000000000c6ec in system.task_primitives.operations.idle ()
  12414. One known limitation of the Ravenscar support in GDB is that it isn't
  12415. currently possible to single-step through the runtime initialization
  12416. sequence. If you need to debug this code, you should use 'set ravenscar
  12417. task-switching off'.
  12418. 
  12419. File: gdb.info, Node: Ada Settings, Next: Ada Glitches, Prev: Ravenscar Profile, Up: Ada
  12420. 15.4.10.10 Ada Settings
  12421. .......................
  12422. 'set varsize-limit SIZE'
  12423. Prevent GDB from attempting to evaluate objects whose size is above
  12424. the given limit (SIZE) when those sizes are computed from run-time
  12425. quantities. This is typically the case when the object has a
  12426. variable size, such as an array whose bounds are not known at
  12427. compile time for example. Setting SIZE to 'unlimited' removes the
  12428. size limitation. By default, the limit is about 65KB.
  12429. The purpose of having such a limit is to prevent GDB from trying to
  12430. grab enormous chunks of virtual memory when asked to evaluate a
  12431. quantity whose bounds have been corrupted or have not yet been
  12432. fully initialized. The limit applies to the results of some
  12433. subexpressions as well as to complete expressions. For example, an
  12434. expression denoting a simple integer component, such as 'x.y.z',
  12435. may fail if the size of 'x.y' is variable and exceeds 'size'. On
  12436. the other hand, GDB is sometimes clever; the expression 'A(i)',
  12437. where 'A' is an array variable with non-constant size, will
  12438. generally succeed regardless of the bounds on 'A', as long as the
  12439. component size is less than SIZE.
  12440. 'show varsize-limit'
  12441. Show the limit on types whose size is determined by run-time
  12442. quantities.
  12443. 
  12444. File: gdb.info, Node: Ada Glitches, Prev: Ada Settings, Up: Ada
  12445. 15.4.10.11 Known Peculiarities of Ada Mode
  12446. ..........................................
  12447. Besides the omissions listed previously (*note Omissions from Ada::), we
  12448. know of several problems with and limitations of Ada mode in GDB, some
  12449. of which will be fixed with planned future releases of the debugger and
  12450. the GNU Ada compiler.
  12451. * Static constants that the compiler chooses not to materialize as
  12452. objects in storage are invisible to the debugger.
  12453. * Named parameter associations in function argument lists are ignored
  12454. (the argument lists are treated as positional).
  12455. * Many useful library packages are currently invisible to the
  12456. debugger.
  12457. * Fixed-point arithmetic, conversions, input, and output is carried
  12458. out using floating-point arithmetic, and may give results that only
  12459. approximate those on the host machine.
  12460. * The GNAT compiler never generates the prefix 'Standard' for any of
  12461. the standard symbols defined by the Ada language. GDB knows about
  12462. this: it will strip the prefix from names when you use it, and will
  12463. never look for a name you have so qualified among local symbols,
  12464. nor match against symbols in other packages or subprograms. If you
  12465. have defined entities anywhere in your program other than
  12466. parameters and local variables whose simple names match names in
  12467. 'Standard', GNAT's lack of qualification here can cause confusion.
  12468. When this happens, you can usually resolve the confusion by
  12469. qualifying the problematic names with package 'Standard'
  12470. explicitly.
  12471. Older versions of the compiler sometimes generate erroneous debugging
  12472. information, resulting in the debugger incorrectly printing the value of
  12473. affected entities. In some cases, the debugger is able to work around
  12474. an issue automatically. In other cases, the debugger is able to work
  12475. around the issue, but the work-around has to be specifically enabled.
  12476. 'set ada trust-PAD-over-XVS on'
  12477. Configure GDB to strictly follow the GNAT encoding when computing
  12478. the value of Ada entities, particularly when 'PAD' and 'PAD___XVS'
  12479. types are involved (see 'ada/exp_dbug.ads' in the GCC sources for a
  12480. complete description of the encoding used by the GNAT compiler).
  12481. This is the default.
  12482. 'set ada trust-PAD-over-XVS off'
  12483. This is related to the encoding using by the GNAT compiler. If GDB
  12484. sometimes prints the wrong value for certain entities, changing
  12485. 'ada trust-PAD-over-XVS' to 'off' activates a work-around which may
  12486. fix the issue. It is always safe to set 'ada trust-PAD-over-XVS'
  12487. to 'off', but this incurs a slight performance penalty, so it is
  12488. recommended to leave this setting to 'on' unless necessary.
  12489. Internally, the debugger also relies on the compiler following a
  12490. number of conventions known as the 'GNAT Encoding', all documented in
  12491. 'gcc/ada/exp_dbug.ads' in the GCC sources. This encoding describes how
  12492. the debugging information should be generated for certain types. In
  12493. particular, this convention makes use of "descriptive types", which are
  12494. artificial types generated purely to help the debugger.
  12495. These encodings were defined at a time when the debugging information
  12496. format used was not powerful enough to describe some of the more complex
  12497. types available in Ada. Since DWARF allows us to express nearly all Ada
  12498. features, the long-term goal is to slowly replace these descriptive
  12499. types by their pure DWARF equivalent. To facilitate that transition, a
  12500. new maintenance option is available to force the debugger to ignore
  12501. those descriptive types. It allows the user to quickly evaluate how
  12502. well GDB works without them.
  12503. 'maintenance ada set ignore-descriptive-types [on|off]'
  12504. Control whether the debugger should ignore descriptive types. The
  12505. default is not to ignore descriptives types ('off').
  12506. 'maintenance ada show ignore-descriptive-types'
  12507. Show if descriptive types are ignored by GDB.
  12508. 
  12509. File: gdb.info, Node: Unsupported Languages, Prev: Supported Languages, Up: Languages
  12510. 15.5 Unsupported Languages
  12511. ==========================
  12512. In addition to the other fully-supported programming languages, GDB also
  12513. provides a pseudo-language, called 'minimal'. It does not represent a
  12514. real programming language, but provides a set of capabilities close to
  12515. what the C or assembly languages provide. This should allow most simple
  12516. operations to be performed while debugging an application that uses a
  12517. language currently not supported by GDB.
  12518. If the language is set to 'auto', GDB will automatically select this
  12519. language if the current frame corresponds to an unsupported language.
  12520. 
  12521. File: gdb.info, Node: Symbols, Next: Altering, Prev: Languages, Up: Top
  12522. 16 Examining the Symbol Table
  12523. *****************************
  12524. The commands described in this chapter allow you to inquire about the
  12525. symbols (names of variables, functions and types) defined in your
  12526. program. This information is inherent in the text of your program and
  12527. does not change as your program executes. GDB finds it in your
  12528. program's symbol table, in the file indicated when you started GDB
  12529. (*note Choosing Files: File Options.), or by one of the file-management
  12530. commands (*note Commands to Specify Files: Files.).
  12531. Occasionally, you may need to refer to symbols that contain unusual
  12532. characters, which GDB ordinarily treats as word delimiters. The most
  12533. frequent case is in referring to static variables in other source files
  12534. (*note Program Variables: Variables.). File names are recorded in
  12535. object files as debugging symbols, but GDB would ordinarily parse a
  12536. typical file name, like 'foo.c', as the three words 'foo' '.' 'c'. To
  12537. allow GDB to recognize 'foo.c' as a single symbol, enclose it in single
  12538. quotes; for example,
  12539. p 'foo.c'::x
  12540. looks up the value of 'x' in the scope of the file 'foo.c'.
  12541. 'set case-sensitive on'
  12542. 'set case-sensitive off'
  12543. 'set case-sensitive auto'
  12544. Normally, when GDB looks up symbols, it matches their names with
  12545. case sensitivity determined by the current source language.
  12546. Occasionally, you may wish to control that. The command 'set
  12547. case-sensitive' lets you do that by specifying 'on' for
  12548. case-sensitive matches or 'off' for case-insensitive ones. If you
  12549. specify 'auto', case sensitivity is reset to the default suitable
  12550. for the source language. The default is case-sensitive matches for
  12551. all languages except for Fortran, for which the default is
  12552. case-insensitive matches.
  12553. 'show case-sensitive'
  12554. This command shows the current setting of case sensitivity for
  12555. symbols lookups.
  12556. 'set print type methods'
  12557. 'set print type methods on'
  12558. 'set print type methods off'
  12559. Normally, when GDB prints a class, it displays any methods declared
  12560. in that class. You can control this behavior either by passing the
  12561. appropriate flag to 'ptype', or using 'set print type methods'.
  12562. Specifying 'on' will cause GDB to display the methods; this is the
  12563. default. Specifying 'off' will cause GDB to omit the methods.
  12564. 'show print type methods'
  12565. This command shows the current setting of method display when
  12566. printing classes.
  12567. 'set print type nested-type-limit LIMIT'
  12568. 'set print type nested-type-limit unlimited'
  12569. Set the limit of displayed nested types that the type printer will
  12570. show. A LIMIT of 'unlimited' or '-1' will show all nested
  12571. definitions. By default, the type printer will not show any nested
  12572. types defined in classes.
  12573. 'show print type nested-type-limit'
  12574. This command shows the current display limit of nested types when
  12575. printing classes.
  12576. 'set print type typedefs'
  12577. 'set print type typedefs on'
  12578. 'set print type typedefs off'
  12579. Normally, when GDB prints a class, it displays any typedefs defined
  12580. in that class. You can control this behavior either by passing the
  12581. appropriate flag to 'ptype', or using 'set print type typedefs'.
  12582. Specifying 'on' will cause GDB to display the typedef definitions;
  12583. this is the default. Specifying 'off' will cause GDB to omit the
  12584. typedef definitions. Note that this controls whether the typedef
  12585. definition itself is printed, not whether typedef names are
  12586. substituted when printing other types.
  12587. 'show print type typedefs'
  12588. This command shows the current setting of typedef display when
  12589. printing classes.
  12590. 'info address SYMBOL'
  12591. Describe where the data for SYMBOL is stored. For a register
  12592. variable, this says which register it is kept in. For a
  12593. non-register local variable, this prints the stack-frame offset at
  12594. which the variable is always stored.
  12595. Note the contrast with 'print &SYMBOL', which does not work at all
  12596. for a register variable, and for a stack local variable prints the
  12597. exact address of the current instantiation of the variable.
  12598. 'info symbol ADDR'
  12599. Print the name of a symbol which is stored at the address ADDR. If
  12600. no symbol is stored exactly at ADDR, GDB prints the nearest symbol
  12601. and an offset from it:
  12602. (gdb) info symbol 0x54320
  12603. _initialize_vx + 396 in section .text
  12604. This is the opposite of the 'info address' command. You can use it
  12605. to find out the name of a variable or a function given its address.
  12606. For dynamically linked executables, the name of executable or
  12607. shared library containing the symbol is also printed:
  12608. (gdb) info symbol 0x400225
  12609. _start + 5 in section .text of /tmp/a.out
  12610. (gdb) info symbol 0x2aaaac2811cf
  12611. __read_nocancel + 6 in section .text of /usr/lib64/libc.so.6
  12612. 'demangle [-l LANGUAGE] [--] NAME'
  12613. Demangle NAME. If LANGUAGE is provided it is the name of the
  12614. language to demangle NAME in. Otherwise NAME is demangled in the
  12615. current language.
  12616. The '--' option specifies the end of options, and is useful when
  12617. NAME begins with a dash.
  12618. The parameter 'demangle-style' specifies how to interpret the kind
  12619. of mangling used. *Note Print Settings::.
  12620. 'whatis[/FLAGS] [ARG]'
  12621. Print the data type of ARG, which can be either an expression or a
  12622. name of a data type. With no argument, print the data type of '$',
  12623. the last value in the value history.
  12624. If ARG is an expression (*note Expressions: Expressions.), it is
  12625. not actually evaluated, and any side-effecting operations (such as
  12626. assignments or function calls) inside it do not take place.
  12627. If ARG is a variable or an expression, 'whatis' prints its literal
  12628. type as it is used in the source code. If the type was defined
  12629. using a 'typedef', 'whatis' will _not_ print the data type
  12630. underlying the 'typedef'. If the type of the variable or the
  12631. expression is a compound data type, such as 'struct' or 'class',
  12632. 'whatis' never prints their fields or methods. It just prints the
  12633. 'struct'/'class' name (a.k.a. its "tag"). If you want to see the
  12634. members of such a compound data type, use 'ptype'.
  12635. If ARG is a type name that was defined using 'typedef', 'whatis'
  12636. "unrolls" only one level of that 'typedef'. Unrolling means that
  12637. 'whatis' will show the underlying type used in the 'typedef'
  12638. declaration of ARG. However, if that underlying type is also a
  12639. 'typedef', 'whatis' will not unroll it.
  12640. For C code, the type names may also have the form 'class
  12641. CLASS-NAME', 'struct STRUCT-TAG', 'union UNION-TAG' or 'enum
  12642. ENUM-TAG'.
  12643. FLAGS can be used to modify how the type is displayed. Available
  12644. flags are:
  12645. 'r'
  12646. Display in "raw" form. Normally, GDB substitutes template
  12647. parameters and typedefs defined in a class when printing the
  12648. class' members. The '/r' flag disables this.
  12649. 'm'
  12650. Do not print methods defined in the class.
  12651. 'M'
  12652. Print methods defined in the class. This is the default, but
  12653. the flag exists in case you change the default with 'set print
  12654. type methods'.
  12655. 't'
  12656. Do not print typedefs defined in the class. Note that this
  12657. controls whether the typedef definition itself is printed, not
  12658. whether typedef names are substituted when printing other
  12659. types.
  12660. 'T'
  12661. Print typedefs defined in the class. This is the default, but
  12662. the flag exists in case you change the default with 'set print
  12663. type typedefs'.
  12664. 'o'
  12665. Print the offsets and sizes of fields in a struct, similar to
  12666. what the 'pahole' tool does. This option implies the '/tm'
  12667. flags.
  12668. For example, given the following declarations:
  12669. struct tuv
  12670. {
  12671. int a1;
  12672. char *a2;
  12673. int a3;
  12674. };
  12675. struct xyz
  12676. {
  12677. int f1;
  12678. char f2;
  12679. void *f3;
  12680. struct tuv f4;
  12681. };
  12682. union qwe
  12683. {
  12684. struct tuv fff1;
  12685. struct xyz fff2;
  12686. };
  12687. struct tyu
  12688. {
  12689. int a1 : 1;
  12690. int a2 : 3;
  12691. int a3 : 23;
  12692. char a4 : 2;
  12693. int64_t a5;
  12694. int a6 : 5;
  12695. int64_t a7 : 3;
  12696. };
  12697. Issuing a 'ptype /o struct tuv' command would print:
  12698. (gdb) ptype /o struct tuv
  12699. /* offset | size */ type = struct tuv {
  12700. /* 0 | 4 */ int a1;
  12701. /* XXX 4-byte hole */
  12702. /* 8 | 8 */ char *a2;
  12703. /* 16 | 4 */ int a3;
  12704. /* total size (bytes): 24 */
  12705. }
  12706. Notice the format of the first column of comments. There, you
  12707. can find two parts separated by the '|' character: the
  12708. _offset_, which indicates where the field is located inside
  12709. the struct, in bytes, and the _size_ of the field. Another
  12710. interesting line is the marker of a _hole_ in the struct,
  12711. indicating that it may be possible to pack the struct and make
  12712. it use less space by reorganizing its fields.
  12713. It is also possible to print offsets inside an union:
  12714. (gdb) ptype /o union qwe
  12715. /* offset | size */ type = union qwe {
  12716. /* 24 */ struct tuv {
  12717. /* 0 | 4 */ int a1;
  12718. /* XXX 4-byte hole */
  12719. /* 8 | 8 */ char *a2;
  12720. /* 16 | 4 */ int a3;
  12721. /* total size (bytes): 24 */
  12722. } fff1;
  12723. /* 40 */ struct xyz {
  12724. /* 0 | 4 */ int f1;
  12725. /* 4 | 1 */ char f2;
  12726. /* XXX 3-byte hole */
  12727. /* 8 | 8 */ void *f3;
  12728. /* 16 | 24 */ struct tuv {
  12729. /* 16 | 4 */ int a1;
  12730. /* XXX 4-byte hole */
  12731. /* 24 | 8 */ char *a2;
  12732. /* 32 | 4 */ int a3;
  12733. /* total size (bytes): 24 */
  12734. } f4;
  12735. /* total size (bytes): 40 */
  12736. } fff2;
  12737. /* total size (bytes): 40 */
  12738. }
  12739. In this case, since 'struct tuv' and 'struct xyz' occupy the
  12740. same space (because we are dealing with an union), the offset
  12741. is not printed for them. However, you can still examine the
  12742. offset of each of these structures' fields.
  12743. Another useful scenario is printing the offsets of a struct
  12744. containing bitfields:
  12745. (gdb) ptype /o struct tyu
  12746. /* offset | size */ type = struct tyu {
  12747. /* 0:31 | 4 */ int a1 : 1;
  12748. /* 0:28 | 4 */ int a2 : 3;
  12749. /* 0: 5 | 4 */ int a3 : 23;
  12750. /* 3: 3 | 1 */ signed char a4 : 2;
  12751. /* XXX 3-bit hole */
  12752. /* XXX 4-byte hole */
  12753. /* 8 | 8 */ int64_t a5;
  12754. /* 16: 0 | 4 */ int a6 : 5;
  12755. /* 16: 5 | 8 */ int64_t a7 : 3;
  12756. "/* XXX 7-byte padding */
  12757. /* total size (bytes): 24 */
  12758. }
  12759. Note how the offset information is now extended to also
  12760. include the first bit of the bitfield.
  12761. 'ptype[/FLAGS] [ARG]'
  12762. 'ptype' accepts the same arguments as 'whatis', but prints a
  12763. detailed description of the type, instead of just the name of the
  12764. type. *Note Expressions: Expressions.
  12765. Contrary to 'whatis', 'ptype' always unrolls any 'typedef's in its
  12766. argument declaration, whether the argument is a variable,
  12767. expression, or a data type. This means that 'ptype' of a variable
  12768. or an expression will not print literally its type as present in
  12769. the source code--use 'whatis' for that. 'typedef's at the pointer
  12770. or reference targets are also unrolled. Only 'typedef's of fields,
  12771. methods and inner 'class typedef's of 'struct's, 'class'es and
  12772. 'union's are not unrolled even with 'ptype'.
  12773. For example, for this variable declaration:
  12774. typedef double real_t;
  12775. struct complex { real_t real; double imag; };
  12776. typedef struct complex complex_t;
  12777. complex_t var;
  12778. real_t *real_pointer_var;
  12779. the two commands give this output:
  12780. (gdb) whatis var
  12781. type = complex_t
  12782. (gdb) ptype var
  12783. type = struct complex {
  12784. real_t real;
  12785. double imag;
  12786. }
  12787. (gdb) whatis complex_t
  12788. type = struct complex
  12789. (gdb) whatis struct complex
  12790. type = struct complex
  12791. (gdb) ptype struct complex
  12792. type = struct complex {
  12793. real_t real;
  12794. double imag;
  12795. }
  12796. (gdb) whatis real_pointer_var
  12797. type = real_t *
  12798. (gdb) ptype real_pointer_var
  12799. type = double *
  12800. As with 'whatis', using 'ptype' without an argument refers to the
  12801. type of '$', the last value in the value history.
  12802. Sometimes, programs use opaque data types or incomplete
  12803. specifications of complex data structure. If the debug information
  12804. included in the program does not allow GDB to display a full
  12805. declaration of the data type, it will say '<incomplete type>'. For
  12806. example, given these declarations:
  12807. struct foo;
  12808. struct foo *fooptr;
  12809. but no definition for 'struct foo' itself, GDB will say:
  12810. (gdb) ptype foo
  12811. $1 = <incomplete type>
  12812. "Incomplete type" is C terminology for data types that are not
  12813. completely specified.
  12814. Othertimes, information about a variable's type is completely
  12815. absent from the debug information included in the program. This
  12816. most often happens when the program or library where the variable
  12817. is defined includes no debug information at all. GDB knows the
  12818. variable exists from inspecting the linker/loader symbol table
  12819. (e.g., the ELF dynamic symbol table), but such symbols do not
  12820. contain type information. Inspecting the type of a (global)
  12821. variable for which GDB has no type information shows:
  12822. (gdb) ptype var
  12823. type = <data variable, no debug info>
  12824. *Note no debug info variables: Variables, for how to print the
  12825. values of such variables.
  12826. 'info types [-q] [REGEXP]'
  12827. Print a brief description of all types whose names match the
  12828. regular expression REGEXP (or all types in your program, if you
  12829. supply no argument). Each complete typename is matched as though
  12830. it were a complete line; thus, 'i type value' gives information on
  12831. all types in your program whose names include the string 'value',
  12832. but 'i type ^value$' gives information only on types whose complete
  12833. name is 'value'.
  12834. In programs using different languages, GDB chooses the syntax to
  12835. print the type description according to the 'set language' value:
  12836. using 'set language auto' (see *note Set Language Automatically:
  12837. Automatically.) means to use the language of the type, other values
  12838. mean to use the manually specified language (see *note Set Language
  12839. Manually: Manually.).
  12840. This command differs from 'ptype' in two ways: first, like
  12841. 'whatis', it does not print a detailed description; second, it
  12842. lists all source files and line numbers where a type is defined.
  12843. The output from 'into types' is proceeded with a header line
  12844. describing what types are being listed. The optional flag '-q',
  12845. which stands for 'quiet', disables printing this header
  12846. information.
  12847. 'info type-printers'
  12848. Versions of GDB that ship with Python scripting enabled may have
  12849. "type printers" available. When using 'ptype' or 'whatis', these
  12850. printers are consulted when the name of a type is needed. *Note
  12851. Type Printing API::, for more information on writing type printers.
  12852. 'info type-printers' displays all the available type printers.
  12853. 'enable type-printer NAME...'
  12854. 'disable type-printer NAME...'
  12855. These commands can be used to enable or disable type printers.
  12856. 'info scope LOCATION'
  12857. List all the variables local to a particular scope. This command
  12858. accepts a LOCATION argument--a function name, a source line, or an
  12859. address preceded by a '*', and prints all the variables local to
  12860. the scope defined by that location. (*Note Specify Location::, for
  12861. details about supported forms of LOCATION.) For example:
  12862. (gdb) info scope command_line_handler
  12863. Scope for command_line_handler:
  12864. Symbol rl is an argument at stack/frame offset 8, length 4.
  12865. Symbol linebuffer is in static storage at address 0x150a18, length 4.
  12866. Symbol linelength is in static storage at address 0x150a1c, length 4.
  12867. Symbol p is a local variable in register $esi, length 4.
  12868. Symbol p1 is a local variable in register $ebx, length 4.
  12869. Symbol nline is a local variable in register $edx, length 4.
  12870. Symbol repeat is a local variable at frame offset -8, length 4.
  12871. This command is especially useful for determining what data to
  12872. collect during a "trace experiment", see *note collect: Tracepoint
  12873. Actions.
  12874. 'info source'
  12875. Show information about the current source file--that is, the source
  12876. file for the function containing the current point of execution:
  12877. * the name of the source file, and the directory containing it,
  12878. * the directory it was compiled in,
  12879. * its length, in lines,
  12880. * which programming language it is written in,
  12881. * if the debug information provides it, the program that
  12882. compiled the file (which may include, e.g., the compiler
  12883. version and command line arguments),
  12884. * whether the executable includes debugging information for that
  12885. file, and if so, what format the information is in (e.g.,
  12886. STABS, Dwarf 2, etc.), and
  12887. * whether the debugging information includes information about
  12888. preprocessor macros.
  12889. 'info sources'
  12890. Print the names of all source files in your program for which there
  12891. is debugging information, organized into two lists: files whose
  12892. symbols have already been read, and files whose symbols will be
  12893. read when needed.
  12894. 'info sources [-dirname | -basename] [--] [REGEXP]'
  12895. Like 'info sources', but only print the names of the files matching
  12896. the provided REGEXP. By default, the REGEXP is used to match
  12897. anywhere in the filename. If '-dirname', only files having a
  12898. dirname matching REGEXP are shown. If '-basename', only files
  12899. having a basename matching REGEXP are shown. The matching is
  12900. case-sensitive, except on operating systems that have
  12901. case-insensitive filesystem (e.g., MS-Windows).
  12902. 'info functions [-q] [-n]'
  12903. Print the names and data types of all defined functions. Similarly
  12904. to 'info types', this command groups its output by source files and
  12905. annotates each function definition with its source line number.
  12906. In programs using different languages, GDB chooses the syntax to
  12907. print the function name and type according to the 'set language'
  12908. value: using 'set language auto' (see *note Set Language
  12909. Automatically: Automatically.) means to use the language of the
  12910. function, other values mean to use the manually specified language
  12911. (see *note Set Language Manually: Manually.).
  12912. The '-n' flag excludes "non-debugging symbols" from the results. A
  12913. non-debugging symbol is a symbol that comes from the executable's
  12914. symbol table, not from the debug information (for example, DWARF)
  12915. associated with the executable.
  12916. The optional flag '-q', which stands for 'quiet', disables printing
  12917. header information and messages explaining why no functions have
  12918. been printed.
  12919. 'info functions [-q] [-n] [-t TYPE_REGEXP] [REGEXP]'
  12920. Like 'info functions', but only print the names and data types of
  12921. the functions selected with the provided regexp(s).
  12922. If REGEXP is provided, print only the functions whose names match
  12923. the regular expression REGEXP. Thus, 'info fun step' finds all
  12924. functions whose names include 'step'; 'info fun ^step' finds those
  12925. whose names start with 'step'. If a function name contains
  12926. characters that conflict with the regular expression language (e.g.
  12927. 'operator*()'), they may be quoted with a backslash.
  12928. If TYPE_REGEXP is provided, print only the functions whose types,
  12929. as printed by the 'whatis' command, match the regular expression
  12930. TYPE_REGEXP. If TYPE_REGEXP contains space(s), it should be
  12931. enclosed in quote characters. If needed, use backslash to escape
  12932. the meaning of special characters or quotes. Thus, 'info fun -t
  12933. '^int ('' finds the functions that return an integer; 'info fun -t
  12934. '(.*int.*'' finds the functions that have an argument type
  12935. containing int; 'info fun -t '^int (' ^step' finds the functions
  12936. whose names start with 'step' and that return int.
  12937. If both REGEXP and TYPE_REGEXP are provided, a function is printed
  12938. only if its name matches REGEXP and its type matches TYPE_REGEXP.
  12939. 'info variables [-q] [-n]'
  12940. Print the names and data types of all variables that are defined
  12941. outside of functions (i.e. excluding local variables). The printed
  12942. variables are grouped by source files and annotated with their
  12943. respective source line numbers.
  12944. In programs using different languages, GDB chooses the syntax to
  12945. print the variable name and type according to the 'set language'
  12946. value: using 'set language auto' (see *note Set Language
  12947. Automatically: Automatically.) means to use the language of the
  12948. variable, other values mean to use the manually specified language
  12949. (see *note Set Language Manually: Manually.).
  12950. The '-n' flag excludes non-debugging symbols from the results.
  12951. The optional flag '-q', which stands for 'quiet', disables printing
  12952. header information and messages explaining why no variables have
  12953. been printed.
  12954. 'info variables [-q] [-n] [-t TYPE_REGEXP] [REGEXP]'
  12955. Like 'info variables', but only print the variables selected with
  12956. the provided regexp(s).
  12957. If REGEXP is provided, print only the variables whose names match
  12958. the regular expression REGEXP.
  12959. If TYPE_REGEXP is provided, print only the variables whose types,
  12960. as printed by the 'whatis' command, match the regular expression
  12961. TYPE_REGEXP. If TYPE_REGEXP contains space(s), it should be
  12962. enclosed in quote characters. If needed, use backslash to escape
  12963. the meaning of special characters or quotes.
  12964. If both REGEXP and TYPE_REGEXP are provided, an argument is printed
  12965. only if its name matches REGEXP and its type matches TYPE_REGEXP.
  12966. 'info modules [-q] [REGEXP]'
  12967. List all Fortran modules in the program, or all modules matching
  12968. the optional regular expression REGEXP.
  12969. The optional flag '-q', which stands for 'quiet', disables printing
  12970. header information and messages explaining why no modules have been
  12971. printed.
  12972. 'info module functions [-q] [-m MODULE-REGEXP] [-t TYPE-REGEXP] [REGEXP]'
  12973. 'info module variables [-q] [-m MODULE-REGEXP] [-t TYPE-REGEXP] [REGEXP]'
  12974. List all functions or variables within all Fortran modules. The
  12975. set of functions or variables listed can be limited by providing
  12976. some or all of the optional regular expressions. If MODULE-REGEXP
  12977. is provided, then only Fortran modules matching MODULE-REGEXP will
  12978. be searched. Only functions or variables whose type matches the
  12979. optional regular expression TYPE-REGEXP will be listed. And only
  12980. functions or variables whose name matches the optional regular
  12981. expression REGEXP will be listed.
  12982. The optional flag '-q', which stands for 'quiet', disables printing
  12983. header information and messages explaining why no functions or
  12984. variables have been printed.
  12985. 'info classes'
  12986. 'info classes REGEXP'
  12987. Display all Objective-C classes in your program, or (with the
  12988. REGEXP argument) all those matching a particular regular
  12989. expression.
  12990. 'info selectors'
  12991. 'info selectors REGEXP'
  12992. Display all Objective-C selectors in your program, or (with the
  12993. REGEXP argument) all those matching a particular regular
  12994. expression.
  12995. 'set opaque-type-resolution on'
  12996. Tell GDB to resolve opaque types. An opaque type is a type
  12997. declared as a pointer to a 'struct', 'class', or 'union'--for
  12998. example, 'struct MyType *'--that is used in one source file
  12999. although the full declaration of 'struct MyType' is in another
  13000. source file. The default is on.
  13001. A change in the setting of this subcommand will not take effect
  13002. until the next time symbols for a file are loaded.
  13003. 'set opaque-type-resolution off'
  13004. Tell GDB not to resolve opaque types. In this case, the type is
  13005. printed as follows:
  13006. {<no data fields>}
  13007. 'show opaque-type-resolution'
  13008. Show whether opaque types are resolved or not.
  13009. 'set print symbol-loading'
  13010. 'set print symbol-loading full'
  13011. 'set print symbol-loading brief'
  13012. 'set print symbol-loading off'
  13013. The 'set print symbol-loading' command allows you to control the
  13014. printing of messages when GDB loads symbol information. By default
  13015. a message is printed for the executable and one for each shared
  13016. library, and normally this is what you want. However, when
  13017. debugging apps with large numbers of shared libraries these
  13018. messages can be annoying. When set to 'brief' a message is printed
  13019. for each executable, and when GDB loads a collection of shared
  13020. libraries at once it will only print one message regardless of the
  13021. number of shared libraries. When set to 'off' no messages are
  13022. printed.
  13023. 'show print symbol-loading'
  13024. Show whether messages will be printed when a GDB command entered
  13025. from the keyboard causes symbol information to be loaded.
  13026. 'maint print symbols [-pc ADDRESS] [FILENAME]'
  13027. 'maint print symbols [-objfile OBJFILE] [-source SOURCE] [--] [FILENAME]'
  13028. 'maint print psymbols [-objfile OBJFILE] [-pc ADDRESS] [--] [FILENAME]'
  13029. 'maint print psymbols [-objfile OBJFILE] [-source SOURCE] [--] [FILENAME]'
  13030. 'maint print msymbols [-objfile OBJFILE] [--] [FILENAME]'
  13031. Write a dump of debugging symbol data into the file FILENAME or the
  13032. terminal if FILENAME is unspecified. If '-objfile OBJFILE' is
  13033. specified, only dump symbols for that objfile. If '-pc ADDRESS' is
  13034. specified, only dump symbols for the file with code at that
  13035. address. Note that ADDRESS may be a symbol like 'main'. If
  13036. '-source SOURCE' is specified, only dump symbols for that source
  13037. file.
  13038. These commands are used to debug the GDB symbol-reading code.
  13039. These commands do not modify internal GDB state, therefore 'maint
  13040. print symbols' will only print symbols for already expanded symbol
  13041. tables. You can use the command 'info sources' to find out which
  13042. files these are. If you use 'maint print psymbols' instead, the
  13043. dump shows information about symbols that GDB only knows
  13044. partially--that is, symbols defined in files that GDB has skimmed,
  13045. but not yet read completely. Finally, 'maint print msymbols' just
  13046. dumps "minimal symbols", e.g., "ELF symbols".
  13047. *Note Commands to Specify Files: Files, for a discussion of how GDB
  13048. reads symbols (in the description of 'symbol-file').
  13049. 'maint info symtabs [ REGEXP ]'
  13050. 'maint info psymtabs [ REGEXP ]'
  13051. List the 'struct symtab' or 'struct partial_symtab' structures
  13052. whose names match REGEXP. If REGEXP is not given, list them all.
  13053. The output includes expressions which you can copy into a GDB
  13054. debugging this one to examine a particular structure in more
  13055. detail. For example:
  13056. (gdb) maint info psymtabs dwarf2read
  13057. { objfile /home/gnu/build/gdb/gdb
  13058. ((struct objfile *) 0x82e69d0)
  13059. { psymtab /home/gnu/src/gdb/dwarf2read.c
  13060. ((struct partial_symtab *) 0x8474b10)
  13061. readin no
  13062. fullname (null)
  13063. text addresses 0x814d3c8 -- 0x8158074
  13064. globals (* (struct partial_symbol **) 0x8507a08 @ 9)
  13065. statics (* (struct partial_symbol **) 0x40e95b78 @ 2882)
  13066. dependencies (none)
  13067. }
  13068. }
  13069. (gdb) maint info symtabs
  13070. (gdb)
  13071. We see that there is one partial symbol table whose filename
  13072. contains the string 'dwarf2read', belonging to the 'gdb'
  13073. executable; and we see that GDB has not read in any symtabs yet at
  13074. all. If we set a breakpoint on a function, that will cause GDB to
  13075. read the symtab for the compilation unit containing that function:
  13076. (gdb) break dwarf2_psymtab_to_symtab
  13077. Breakpoint 1 at 0x814e5da: file /home/gnu/src/gdb/dwarf2read.c,
  13078. line 1574.
  13079. (gdb) maint info symtabs
  13080. { objfile /home/gnu/build/gdb/gdb
  13081. ((struct objfile *) 0x82e69d0)
  13082. { symtab /home/gnu/src/gdb/dwarf2read.c
  13083. ((struct symtab *) 0x86c1f38)
  13084. dirname (null)
  13085. fullname (null)
  13086. blockvector ((struct blockvector *) 0x86c1bd0) (primary)
  13087. linetable ((struct linetable *) 0x8370fa0)
  13088. debugformat DWARF 2
  13089. }
  13090. }
  13091. (gdb)
  13092. 'maint info line-table [ REGEXP ]'
  13093. List the 'struct linetable' from all 'struct symtab' instances
  13094. whose name matches REGEXP. If REGEXP is not given, list the
  13095. 'struct linetable' from all 'struct symtab'.
  13096. 'maint set symbol-cache-size SIZE'
  13097. Set the size of the symbol cache to SIZE. The default size is
  13098. intended to be good enough for debugging most applications. This
  13099. option exists to allow for experimenting with different sizes.
  13100. 'maint show symbol-cache-size'
  13101. Show the size of the symbol cache.
  13102. 'maint print symbol-cache'
  13103. Print the contents of the symbol cache. This is useful when
  13104. debugging symbol cache issues.
  13105. 'maint print symbol-cache-statistics'
  13106. Print symbol cache usage statistics. This helps determine how well
  13107. the cache is being utilized.
  13108. 'maint flush-symbol-cache'
  13109. Flush the contents of the symbol cache, all entries are removed.
  13110. This command is useful when debugging the symbol cache. It is also
  13111. useful when collecting performance data.
  13112. 
  13113. File: gdb.info, Node: Altering, Next: GDB Files, Prev: Symbols, Up: Top
  13114. 17 Altering Execution
  13115. *********************
  13116. Once you think you have found an error in your program, you might want
  13117. to find out for certain whether correcting the apparent error would lead
  13118. to correct results in the rest of the run. You can find the answer by
  13119. experiment, using the GDB features for altering execution of the
  13120. program.
  13121. For example, you can store new values into variables or memory
  13122. locations, give your program a signal, restart it at a different
  13123. address, or even return prematurely from a function.
  13124. * Menu:
  13125. * Assignment:: Assignment to variables
  13126. * Jumping:: Continuing at a different address
  13127. * Signaling:: Giving your program a signal
  13128. * Returning:: Returning from a function
  13129. * Calling:: Calling your program's functions
  13130. * Patching:: Patching your program
  13131. * Compiling and Injecting Code:: Compiling and injecting code in GDB
  13132. 
  13133. File: gdb.info, Node: Assignment, Next: Jumping, Up: Altering
  13134. 17.1 Assignment to Variables
  13135. ============================
  13136. To alter the value of a variable, evaluate an assignment expression.
  13137. *Note Expressions: Expressions. For example,
  13138. print x=4
  13139. stores the value 4 into the variable 'x', and then prints the value of
  13140. the assignment expression (which is 4). *Note Using GDB with Different
  13141. Languages: Languages, for more information on operators in supported
  13142. languages.
  13143. If you are not interested in seeing the value of the assignment, use
  13144. the 'set' command instead of the 'print' command. 'set' is really the
  13145. same as 'print' except that the expression's value is not printed and is
  13146. not put in the value history (*note Value History: Value History.). The
  13147. expression is evaluated only for its effects.
  13148. If the beginning of the argument string of the 'set' command appears
  13149. identical to a 'set' subcommand, use the 'set variable' command instead
  13150. of just 'set'. This command is identical to 'set' except for its lack
  13151. of subcommands. For example, if your program has a variable 'width',
  13152. you get an error if you try to set a new value with just 'set width=13',
  13153. because GDB has the command 'set width':
  13154. (gdb) whatis width
  13155. type = double
  13156. (gdb) p width
  13157. $4 = 13
  13158. (gdb) set width=47
  13159. Invalid syntax in expression.
  13160. The invalid expression, of course, is '=47'. In order to actually set
  13161. the program's variable 'width', use
  13162. (gdb) set var width=47
  13163. Because the 'set' command has many subcommands that can conflict with
  13164. the names of program variables, it is a good idea to use the 'set
  13165. variable' command instead of just 'set'. For example, if your program
  13166. has a variable 'g', you run into problems if you try to set a new value
  13167. with just 'set g=4', because GDB has the command 'set gnutarget',
  13168. abbreviated 'set g':
  13169. (gdb) whatis g
  13170. type = double
  13171. (gdb) p g
  13172. $1 = 1
  13173. (gdb) set g=4
  13174. (gdb) p g
  13175. $2 = 1
  13176. (gdb) r
  13177. The program being debugged has been started already.
  13178. Start it from the beginning? (y or n) y
  13179. Starting program: /home/smith/cc_progs/a.out
  13180. "/home/smith/cc_progs/a.out": can't open to read symbols:
  13181. Invalid bfd target.
  13182. (gdb) show g
  13183. The current BFD target is "=4".
  13184. The program variable 'g' did not change, and you silently set the
  13185. 'gnutarget' to an invalid value. In order to set the variable 'g', use
  13186. (gdb) set var g=4
  13187. GDB allows more implicit conversions in assignments than C; you can
  13188. freely store an integer value into a pointer variable or vice versa, and
  13189. you can convert any structure to any other structure that is the same
  13190. length or shorter.
  13191. To store values into arbitrary places in memory, use the '{...}'
  13192. construct to generate a value of specified type at a specified address
  13193. (*note Expressions: Expressions.). For example, '{int}0x83040' refers
  13194. to memory location '0x83040' as an integer (which implies a certain size
  13195. and representation in memory), and
  13196. set {int}0x83040 = 4
  13197. stores the value 4 into that memory location.
  13198. 
  13199. File: gdb.info, Node: Jumping, Next: Signaling, Prev: Assignment, Up: Altering
  13200. 17.2 Continuing at a Different Address
  13201. ======================================
  13202. Ordinarily, when you continue your program, you do so at the place where
  13203. it stopped, with the 'continue' command. You can instead continue at an
  13204. address of your own choosing, with the following commands:
  13205. 'jump LOCATION'
  13206. 'j LOCATION'
  13207. Resume execution at LOCATION. Execution stops again immediately if
  13208. there is a breakpoint there. *Note Specify Location::, for a
  13209. description of the different forms of LOCATION. It is common
  13210. practice to use the 'tbreak' command in conjunction with 'jump'.
  13211. *Note Setting Breakpoints: Set Breaks.
  13212. The 'jump' command does not change the current stack frame, or the
  13213. stack pointer, or the contents of any memory location or any
  13214. register other than the program counter. If LOCATION is in a
  13215. different function from the one currently executing, the results
  13216. may be bizarre if the two functions expect different patterns of
  13217. arguments or of local variables. For this reason, the 'jump'
  13218. command requests confirmation if the specified line is not in the
  13219. function currently executing. However, even bizarre results are
  13220. predictable if you are well acquainted with the machine-language
  13221. code of your program.
  13222. On many systems, you can get much the same effect as the 'jump'
  13223. command by storing a new value into the register '$pc'. The difference
  13224. is that this does not start your program running; it only changes the
  13225. address of where it _will_ run when you continue. For example,
  13226. set $pc = 0x485
  13227. makes the next 'continue' command or stepping command execute at address
  13228. '0x485', rather than at the address where your program stopped. *Note
  13229. Continuing and Stepping: Continuing and Stepping.
  13230. The most common occasion to use the 'jump' command is to back
  13231. up--perhaps with more breakpoints set--over a portion of a program that
  13232. has already executed, in order to examine its execution in more detail.
  13233. 
  13234. File: gdb.info, Node: Signaling, Next: Returning, Prev: Jumping, Up: Altering
  13235. 17.3 Giving your Program a Signal
  13236. =================================
  13237. 'signal SIGNAL'
  13238. Resume execution where your program is stopped, but immediately
  13239. give it the signal SIGNAL. The SIGNAL can be the name or the
  13240. number of a signal. For example, on many systems 'signal 2' and
  13241. 'signal SIGINT' are both ways of sending an interrupt signal.
  13242. Alternatively, if SIGNAL is zero, continue execution without giving
  13243. a signal. This is useful when your program stopped on account of a
  13244. signal and would ordinarily see the signal when resumed with the
  13245. 'continue' command; 'signal 0' causes it to resume without a
  13246. signal.
  13247. _Note:_ When resuming a multi-threaded program, SIGNAL is delivered
  13248. to the currently selected thread, not the thread that last reported
  13249. a stop. This includes the situation where a thread was stopped due
  13250. to a signal. So if you want to continue execution suppressing the
  13251. signal that stopped a thread, you should select that same thread
  13252. before issuing the 'signal 0' command. If you issue the 'signal 0'
  13253. command with another thread as the selected one, GDB detects that
  13254. and asks for confirmation.
  13255. Invoking the 'signal' command is not the same as invoking the
  13256. 'kill' utility from the shell. Sending a signal with 'kill' causes
  13257. GDB to decide what to do with the signal depending on the signal
  13258. handling tables (*note Signals::). The 'signal' command passes the
  13259. signal directly to your program.
  13260. 'signal' does not repeat when you press <RET> a second time after
  13261. executing the command.
  13262. 'queue-signal SIGNAL'
  13263. Queue SIGNAL to be delivered immediately to the current thread when
  13264. execution of the thread resumes. The SIGNAL can be the name or the
  13265. number of a signal. For example, on many systems 'signal 2' and
  13266. 'signal SIGINT' are both ways of sending an interrupt signal. The
  13267. handling of the signal must be set to pass the signal to the
  13268. program, otherwise GDB will report an error. You can control the
  13269. handling of signals from GDB with the 'handle' command (*note
  13270. Signals::).
  13271. Alternatively, if SIGNAL is zero, any currently queued signal for
  13272. the current thread is discarded and when execution resumes no
  13273. signal will be delivered. This is useful when your program stopped
  13274. on account of a signal and would ordinarily see the signal when
  13275. resumed with the 'continue' command.
  13276. This command differs from the 'signal' command in that the signal
  13277. is just queued, execution is not resumed. And 'queue-signal'
  13278. cannot be used to pass a signal whose handling state has been set
  13279. to 'nopass' (*note Signals::).
  13280. *Note stepping into signal handlers::, for information on how
  13281. stepping commands behave when the thread has a signal queued.
  13282. 
  13283. File: gdb.info, Node: Returning, Next: Calling, Prev: Signaling, Up: Altering
  13284. 17.4 Returning from a Function
  13285. ==============================
  13286. 'return'
  13287. 'return EXPRESSION'
  13288. You can cancel execution of a function call with the 'return'
  13289. command. If you give an EXPRESSION argument, its value is used as
  13290. the function's return value.
  13291. When you use 'return', GDB discards the selected stack frame (and all
  13292. frames within it). You can think of this as making the discarded frame
  13293. return prematurely. If you wish to specify a value to be returned, give
  13294. that value as the argument to 'return'.
  13295. This pops the selected stack frame (*note Selecting a Frame:
  13296. Selection.), and any other frames inside of it, leaving its caller as
  13297. the innermost remaining frame. That frame becomes selected. The
  13298. specified value is stored in the registers used for returning values of
  13299. functions.
  13300. The 'return' command does not resume execution; it leaves the program
  13301. stopped in the state that would exist if the function had just returned.
  13302. In contrast, the 'finish' command (*note Continuing and Stepping:
  13303. Continuing and Stepping.) resumes execution until the selected stack
  13304. frame returns naturally.
  13305. GDB needs to know how the EXPRESSION argument should be set for the
  13306. inferior. The concrete registers assignment depends on the OS ABI and
  13307. the type being returned by the selected stack frame. For example it is
  13308. common for OS ABI to return floating point values in FPU registers while
  13309. integer values in CPU registers. Still some ABIs return even floating
  13310. point values in CPU registers. Larger integer widths (such as 'long
  13311. long int') also have specific placement rules. GDB already knows the OS
  13312. ABI from its current target so it needs to find out also the type being
  13313. returned to make the assignment into the right register(s).
  13314. Normally, the selected stack frame has debug info. GDB will always
  13315. use the debug info instead of the implicit type of EXPRESSION when the
  13316. debug info is available. For example, if you type 'return -1', and the
  13317. function in the current stack frame is declared to return a 'long long
  13318. int', GDB transparently converts the implicit 'int' value of -1 into a
  13319. 'long long int':
  13320. Breakpoint 1, func () at gdb.base/return-nodebug.c:29
  13321. 29 return 31;
  13322. (gdb) return -1
  13323. Make func return now? (y or n) y
  13324. #0 0x004004f6 in main () at gdb.base/return-nodebug.c:43
  13325. 43 printf ("result=%lld\n", func ());
  13326. (gdb)
  13327. However, if the selected stack frame does not have a debug info,
  13328. e.g., if the function was compiled without debug info, GDB has to find
  13329. out the type to return from user. Specifying a different type by
  13330. mistake may set the value in different inferior registers than the
  13331. caller code expects. For example, typing 'return -1' with its implicit
  13332. type 'int' would set only a part of a 'long long int' result for a debug
  13333. info less function (on 32-bit architectures). Therefore the user is
  13334. required to specify the return type by an appropriate cast explicitly:
  13335. Breakpoint 2, 0x0040050b in func ()
  13336. (gdb) return -1
  13337. Return value type not available for selected stack frame.
  13338. Please use an explicit cast of the value to return.
  13339. (gdb) return (long long int) -1
  13340. Make selected stack frame return now? (y or n) y
  13341. #0 0x00400526 in main ()
  13342. (gdb)
  13343. 
  13344. File: gdb.info, Node: Calling, Next: Patching, Prev: Returning, Up: Altering
  13345. 17.5 Calling Program Functions
  13346. ==============================
  13347. 'print EXPR'
  13348. Evaluate the expression EXPR and display the resulting value. The
  13349. expression may include calls to functions in the program being
  13350. debugged.
  13351. 'call EXPR'
  13352. Evaluate the expression EXPR without displaying 'void' returned
  13353. values.
  13354. You can use this variant of the 'print' command if you want to
  13355. execute a function from your program that does not return anything
  13356. (a.k.a. "a void function"), but without cluttering the output with
  13357. 'void' returned values that GDB will otherwise print. If the
  13358. result is not void, it is printed and saved in the value history.
  13359. It is possible for the function you call via the 'print' or 'call'
  13360. command to generate a signal (e.g., if there's a bug in the function, or
  13361. if you passed it incorrect arguments). What happens in that case is
  13362. controlled by the 'set unwindonsignal' command.
  13363. Similarly, with a C++ program it is possible for the function you
  13364. call via the 'print' or 'call' command to generate an exception that is
  13365. not handled due to the constraints of the dummy frame. In this case,
  13366. any exception that is raised in the frame, but has an out-of-frame
  13367. exception handler will not be found. GDB builds a dummy-frame for the
  13368. inferior function call, and the unwinder cannot seek for exception
  13369. handlers outside of this dummy-frame. What happens in that case is
  13370. controlled by the 'set unwind-on-terminating-exception' command.
  13371. 'set unwindonsignal'
  13372. Set unwinding of the stack if a signal is received while in a
  13373. function that GDB called in the program being debugged. If set to
  13374. on, GDB unwinds the stack it created for the call and restores the
  13375. context to what it was before the call. If set to off (the
  13376. default), GDB stops in the frame where the signal was received.
  13377. 'show unwindonsignal'
  13378. Show the current setting of stack unwinding in the functions called
  13379. by GDB.
  13380. 'set unwind-on-terminating-exception'
  13381. Set unwinding of the stack if a C++ exception is raised, but left
  13382. unhandled while in a function that GDB called in the program being
  13383. debugged. If set to on (the default), GDB unwinds the stack it
  13384. created for the call and restores the context to what it was before
  13385. the call. If set to off, GDB the exception is delivered to the
  13386. default C++ exception handler and the inferior terminated.
  13387. 'show unwind-on-terminating-exception'
  13388. Show the current setting of stack unwinding in the functions called
  13389. by GDB.
  13390. 'set may-call-functions'
  13391. Set permission to call functions in the program. This controls
  13392. whether GDB will attempt to call functions in the program, such as
  13393. with expressions in the 'print' command. It defaults to 'on'.
  13394. To call a function in the program, GDB has to temporarily modify
  13395. the state of the inferior. This has potentially undesired side
  13396. effects. Also, having GDB call nested functions is likely to be
  13397. erroneous and may even crash the program being debugged. You can
  13398. avoid such hazards by forbidding GDB from calling functions in the
  13399. program being debugged. If calling functions in the program is
  13400. forbidden, GDB will throw an error when a command (such as printing
  13401. an expression) starts a function call in the program.
  13402. 'show may-call-functions'
  13403. Show permission to call functions in the program.
  13404. 17.5.1 Calling functions with no debug info
  13405. -------------------------------------------
  13406. Sometimes, a function you wish to call is missing debug information. In
  13407. such case, GDB does not know the type of the function, including the
  13408. types of the function's parameters. To avoid calling the inferior
  13409. function incorrectly, which could result in the called function
  13410. functioning erroneously and even crash, GDB refuses to call the function
  13411. unless you tell it the type of the function.
  13412. For prototyped (i.e. ANSI/ISO style) functions, there are two ways to
  13413. do that. The simplest is to cast the call to the function's declared
  13414. return type. For example:
  13415. (gdb) p getenv ("PATH")
  13416. 'getenv' has unknown return type; cast the call to its declared return type
  13417. (gdb) p (char *) getenv ("PATH")
  13418. $1 = 0x7fffffffe7ba "/usr/local/bin:/"...
  13419. Casting the return type of a no-debug function is equivalent to
  13420. casting the function to a pointer to a prototyped function that has a
  13421. prototype that matches the types of the passed-in arguments, and calling
  13422. that. I.e., the call above is equivalent to:
  13423. (gdb) p ((char * (*) (const char *)) getenv) ("PATH")
  13424. and given this prototyped C or C++ function with float parameters:
  13425. float multiply (float v1, float v2) { return v1 * v2; }
  13426. these calls are equivalent:
  13427. (gdb) p (float) multiply (2.0f, 3.0f)
  13428. (gdb) p ((float (*) (float, float)) multiply) (2.0f, 3.0f)
  13429. If the function you wish to call is declared as unprototyped (i.e.
  13430. old K&R style), you must use the cast-to-function-pointer syntax, so
  13431. that GDB knows that it needs to apply default argument promotions
  13432. (promote float arguments to double). *Note float promotion: ABI. For
  13433. example, given this unprototyped C function with float parameters, and
  13434. no debug info:
  13435. float
  13436. multiply_noproto (v1, v2)
  13437. float v1, v2;
  13438. {
  13439. return v1 * v2;
  13440. }
  13441. you call it like this:
  13442. (gdb) p ((float (*) ()) multiply_noproto) (2.0f, 3.0f)
  13443. 
  13444. File: gdb.info, Node: Patching, Next: Compiling and Injecting Code, Prev: Calling, Up: Altering
  13445. 17.6 Patching Programs
  13446. ======================
  13447. By default, GDB opens the file containing your program's executable code
  13448. (or the corefile) read-only. This prevents accidental alterations to
  13449. machine code; but it also prevents you from intentionally patching your
  13450. program's binary.
  13451. If you'd like to be able to patch the binary, you can specify that
  13452. explicitly with the 'set write' command. For example, you might want to
  13453. turn on internal debugging flags, or even to make emergency repairs.
  13454. 'set write on'
  13455. 'set write off'
  13456. If you specify 'set write on', GDB opens executable and core files
  13457. for both reading and writing; if you specify 'set write off' (the
  13458. default), GDB opens them read-only.
  13459. If you have already loaded a file, you must load it again (using
  13460. the 'exec-file' or 'core-file' command) after changing 'set write',
  13461. for your new setting to take effect.
  13462. 'show write'
  13463. Display whether executable files and core files are opened for
  13464. writing as well as reading.
  13465. 
  13466. File: gdb.info, Node: Compiling and Injecting Code, Prev: Patching, Up: Altering
  13467. 17.7 Compiling and injecting code in GDB
  13468. ========================================
  13469. GDB supports on-demand compilation and code injection into programs
  13470. running under GDB. GCC 5.0 or higher built with 'libcc1.so' must be
  13471. installed for this functionality to be enabled. This functionality is
  13472. implemented with the following commands.
  13473. 'compile code SOURCE-CODE'
  13474. 'compile code -raw -- SOURCE-CODE'
  13475. Compile SOURCE-CODE with the compiler language found as the current
  13476. language in GDB (*note Languages::). If compilation and injection
  13477. is not supported with the current language specified in GDB, or the
  13478. compiler does not support this feature, an error message will be
  13479. printed. If SOURCE-CODE compiles and links successfully, GDB will
  13480. load the object-code emitted, and execute it within the context of
  13481. the currently selected inferior. It is important to note that the
  13482. compiled code is executed immediately. After execution, the
  13483. compiled code is removed from GDB and any new types or variables
  13484. you have defined will be deleted.
  13485. The command allows you to specify SOURCE-CODE in two ways. The
  13486. simplest method is to provide a single line of code to the command.
  13487. E.g.:
  13488. compile code printf ("hello world\n");
  13489. If you specify options on the command line as well as source code,
  13490. they may conflict. The '--' delimiter can be used to separate
  13491. options from actual source code. E.g.:
  13492. compile code -r -- printf ("hello world\n");
  13493. Alternatively you can enter source code as multiple lines of text.
  13494. To enter this mode, invoke the 'compile code' command without any
  13495. text following the command. This will start the multiple-line
  13496. editor and allow you to type as many lines of source code as
  13497. required. When you have completed typing, enter 'end' on its own
  13498. line to exit the editor.
  13499. compile code
  13500. >printf ("hello\n");
  13501. >printf ("world\n");
  13502. >end
  13503. Specifying '-raw', prohibits GDB from wrapping the provided
  13504. SOURCE-CODE in a callable scope. In this case, you must specify
  13505. the entry point of the code by defining a function named
  13506. '_gdb_expr_'. The '-raw' code cannot access variables of the
  13507. inferior. Using '-raw' option may be needed for example when
  13508. SOURCE-CODE requires '#include' lines which may conflict with
  13509. inferior symbols otherwise.
  13510. 'compile file FILENAME'
  13511. 'compile file -raw FILENAME'
  13512. Like 'compile code', but take the source code from FILENAME.
  13513. compile file /home/user/example.c
  13514. 'compile print [[OPTIONS] --] EXPR'
  13515. 'compile print [[OPTIONS] --] /F EXPR'
  13516. Compile and execute EXPR with the compiler language found as the
  13517. current language in GDB (*note Languages::). By default the value
  13518. of EXPR is printed in a format appropriate to its data type; you
  13519. can choose a different format by specifying '/F', where F is a
  13520. letter specifying the format; see *note Output Formats: Output
  13521. Formats. The 'compile print' command accepts the same options as
  13522. the 'print' command; see *note print options::.
  13523. 'compile print [[OPTIONS] --]'
  13524. 'compile print [[OPTIONS] --] /F'
  13525. Alternatively you can enter the expression (source code producing
  13526. it) as multiple lines of text. To enter this mode, invoke the
  13527. 'compile print' command without any text following the command.
  13528. This will start the multiple-line editor.
  13529. The process of compiling and injecting the code can be inspected using:
  13530. 'set debug compile'
  13531. Turns on or off display of GDB process of compiling and injecting
  13532. the code. The default is off.
  13533. 'show debug compile'
  13534. Displays the current state of displaying GDB process of compiling
  13535. and injecting the code.
  13536. 'set debug compile-cplus-types'
  13537. Turns on or off the display of C++ type conversion debugging
  13538. information. The default is off.
  13539. 'show debug compile-cplus-types'
  13540. Displays the current state of displaying debugging information for
  13541. C++ type conversion.
  13542. 17.7.1 Compilation options for the 'compile' command
  13543. ----------------------------------------------------
  13544. GDB needs to specify the right compilation options for the code to be
  13545. injected, in part to make its ABI compatible with the inferior and in
  13546. part to make the injected code compatible with GDB's injecting process.
  13547. The options used, in increasing precedence:
  13548. target architecture and OS options ('gdbarch')
  13549. These options depend on target processor type and target operating
  13550. system, usually they specify at least 32-bit ('-m32') or 64-bit
  13551. ('-m64') compilation option.
  13552. compilation options recorded in the target
  13553. GCC (since version 4.7) stores the options used for compilation
  13554. into 'DW_AT_producer' part of DWARF debugging information according
  13555. to the GCC option '-grecord-gcc-switches'. One has to explicitly
  13556. specify '-g' during inferior compilation otherwise GCC produces no
  13557. DWARF. This feature is only relevant for platforms where '-g'
  13558. produces DWARF by default, otherwise one may try to enforce DWARF
  13559. by using '-gdwarf-4'.
  13560. compilation options set by 'set compile-args'
  13561. You can override compilation options using the following command:
  13562. 'set compile-args'
  13563. Set compilation options used for compiling and injecting code with
  13564. the 'compile' commands. These options override any conflicting
  13565. ones from the target architecture and/or options stored during
  13566. inferior compilation.
  13567. 'show compile-args'
  13568. Displays the current state of compilation options override. This
  13569. does not show all the options actually used during compilation, use
  13570. *note set debug compile:: for that.
  13571. 17.7.2 Caveats when using the 'compile' command
  13572. -----------------------------------------------
  13573. There are a few caveats to keep in mind when using the 'compile'
  13574. command. As the caveats are different per language, the table below
  13575. highlights specific issues on a per language basis.
  13576. C code examples and caveats
  13577. When the language in GDB is set to 'C', the compiler will attempt
  13578. to compile the source code with a 'C' compiler. The source code
  13579. provided to the 'compile' command will have much the same access to
  13580. variables and types as it normally would if it were part of the
  13581. program currently being debugged in GDB.
  13582. Below is a sample program that forms the basis of the examples that
  13583. follow. This program has been compiled and loaded into GDB, much
  13584. like any other normal debugging session.
  13585. void function1 (void)
  13586. {
  13587. int i = 42;
  13588. printf ("function 1\n");
  13589. }
  13590. void function2 (void)
  13591. {
  13592. int j = 12;
  13593. function1 ();
  13594. }
  13595. int main(void)
  13596. {
  13597. int k = 6;
  13598. int *p;
  13599. function2 ();
  13600. return 0;
  13601. }
  13602. For the purposes of the examples in this section, the program above
  13603. has been compiled, loaded into GDB, stopped at the function 'main',
  13604. and GDB is awaiting input from the user.
  13605. To access variables and types for any program in GDB, the program
  13606. must be compiled and packaged with debug information. The
  13607. 'compile' command is not an exception to this rule. Without debug
  13608. information, you can still use the 'compile' command, but you will
  13609. be very limited in what variables and types you can access.
  13610. So with that in mind, the example above has been compiled with
  13611. debug information enabled. The 'compile' command will have access
  13612. to all variables and types (except those that may have been
  13613. optimized out). Currently, as GDB has stopped the program in the
  13614. 'main' function, the 'compile' command would have access to the
  13615. variable 'k'. You could invoke the 'compile' command and type some
  13616. source code to set the value of 'k'. You can also read it, or do
  13617. anything with that variable you would normally do in 'C'. Be aware
  13618. that changes to inferior variables in the 'compile' command are
  13619. persistent. In the following example:
  13620. compile code k = 3;
  13621. the variable 'k' is now 3. It will retain that value until
  13622. something else in the example program changes it, or another
  13623. 'compile' command changes it.
  13624. Normal scope and access rules apply to source code compiled and
  13625. injected by the 'compile' command. In the example, the variables
  13626. 'j' and 'k' are not accessible yet, because the program is
  13627. currently stopped in the 'main' function, where these variables are
  13628. not in scope. Therefore, the following command
  13629. compile code j = 3;
  13630. will result in a compilation error message.
  13631. Once the program is continued, execution will bring these variables
  13632. in scope, and they will become accessible; then the code you
  13633. specify via the 'compile' command will be able to access them.
  13634. You can create variables and types with the 'compile' command as
  13635. part of your source code. Variables and types that are created as
  13636. part of the 'compile' command are not visible to the rest of the
  13637. program for the duration of its run. This example is valid:
  13638. compile code int ff = 5; printf ("ff is %d\n", ff);
  13639. However, if you were to type the following into GDB after that
  13640. command has completed:
  13641. compile code printf ("ff is %d\n'', ff);
  13642. a compiler error would be raised as the variable 'ff' no longer
  13643. exists. Object code generated and injected by the 'compile'
  13644. command is removed when its execution ends. Caution is advised
  13645. when assigning to program variables values of variables created by
  13646. the code submitted to the 'compile' command. This example is
  13647. valid:
  13648. compile code int ff = 5; k = ff;
  13649. The value of the variable 'ff' is assigned to 'k'. The variable
  13650. 'k' does not require the existence of 'ff' to maintain the value it
  13651. has been assigned. However, pointers require particular care in
  13652. assignment. If the source code compiled with the 'compile' command
  13653. changed the address of a pointer in the example program, perhaps to
  13654. a variable created in the 'compile' command, that pointer would
  13655. point to an invalid location when the command exits. The following
  13656. example would likely cause issues with your debugged program:
  13657. compile code int ff = 5; p = &ff;
  13658. In this example, 'p' would point to 'ff' when the 'compile' command
  13659. is executing the source code provided to it. However, as variables
  13660. in the (example) program persist with their assigned values, the
  13661. variable 'p' would point to an invalid location when the command
  13662. exists. A general rule should be followed in that you should
  13663. either assign 'NULL' to any assigned pointers, or restore a valid
  13664. location to the pointer before the command exits.
  13665. Similar caution must be exercised with any structs, unions, and
  13666. typedefs defined in 'compile' command. Types defined in the
  13667. 'compile' command will no longer be available in the next 'compile'
  13668. command. Therefore, if you cast a variable to a type defined in
  13669. the 'compile' command, care must be taken to ensure that any future
  13670. need to resolve the type can be achieved.
  13671. (gdb) compile code static struct a { int a; } v = { 42 }; argv = &v;
  13672. (gdb) compile code printf ("%d\n", ((struct a *) argv)->a);
  13673. gdb command line:1:36: error: dereferencing pointer to incomplete type ‘struct a’
  13674. Compilation failed.
  13675. (gdb) compile code struct a { int a; }; printf ("%d\n", ((struct a *) argv)->a);
  13676. 42
  13677. Variables that have been optimized away by the compiler are not
  13678. accessible to the code submitted to the 'compile' command. Access
  13679. to those variables will generate a compiler error which GDB will
  13680. print to the console.
  13681. 17.7.3 Compiler search for the 'compile' command
  13682. ------------------------------------------------
  13683. GDB needs to find GCC for the inferior being debugged which may not be
  13684. obvious for remote targets of different architecture than where GDB is
  13685. running. Environment variable 'PATH' on GDB host is searched for GCC
  13686. binary matching the target architecture and operating system. This
  13687. search can be overriden by 'set compile-gcc' GDB command below. 'PATH'
  13688. is taken from shell that executed GDB, it is not the value set by GDB
  13689. command 'set environment'). *Note Environment::.
  13690. Specifically 'PATH' is searched for binaries matching regular
  13691. expression 'ARCH(-[^-]*)?-OS-gcc' according to the inferior target being
  13692. debugged. ARCH is processor name -- multiarch is supported, so for
  13693. example both 'i386' and 'x86_64' targets look for pattern
  13694. '(x86_64|i.86)' and both 's390' and 's390x' targets look for pattern
  13695. 's390x?'. OS is currently supported only for pattern 'linux(-gnu)?'.
  13696. On Posix hosts the compiler driver GDB needs to find also shared
  13697. library 'libcc1.so' from the compiler. It is searched in default shared
  13698. library search path (overridable with usual environment variable
  13699. 'LD_LIBRARY_PATH'), unrelated to 'PATH' or 'set compile-gcc' settings.
  13700. Contrary to it 'libcc1plugin.so' is found according to the installation
  13701. of the found compiler -- as possibly specified by the 'set compile-gcc'
  13702. command.
  13703. 'set compile-gcc'
  13704. Set compilation command used for compiling and injecting code with
  13705. the 'compile' commands. If this option is not set (it is set to an
  13706. empty string), the search described above will occur -- that is the
  13707. default.
  13708. 'show compile-gcc'
  13709. Displays the current compile command GCC driver filename. If set,
  13710. it is the main command 'gcc', found usually for example under name
  13711. 'x86_64-linux-gnu-gcc'.
  13712. 
  13713. File: gdb.info, Node: GDB Files, Next: Targets, Prev: Altering, Up: Top
  13714. 18 GDB Files
  13715. ************
  13716. GDB needs to know the file name of the program to be debugged, both in
  13717. order to read its symbol table and in order to start your program. To
  13718. debug a core dump of a previous run, you must also tell GDB the name of
  13719. the core dump file.
  13720. * Menu:
  13721. * Files:: Commands to specify files
  13722. * File Caching:: Information about GDB's file caching
  13723. * Separate Debug Files:: Debugging information in separate files
  13724. * MiniDebugInfo:: Debugging information in a special section
  13725. * Index Files:: Index files speed up GDB
  13726. * Symbol Errors:: Errors reading symbol files
  13727. * Data Files:: GDB data files
  13728. 
  13729. File: gdb.info, Node: Files, Next: File Caching, Up: GDB Files
  13730. 18.1 Commands to Specify Files
  13731. ==============================
  13732. You may want to specify executable and core dump file names. The usual
  13733. way to do this is at start-up time, using the arguments to GDB's
  13734. start-up commands (*note Getting In and Out of GDB: Invocation.).
  13735. Occasionally it is necessary to change to a different file during a
  13736. GDB session. Or you may run GDB and forget to specify a file you want
  13737. to use. Or you are debugging a remote target via 'gdbserver' (*note
  13738. file: Server.). In these situations the GDB commands to specify new
  13739. files are useful.
  13740. 'file FILENAME'
  13741. Use FILENAME as the program to be debugged. It is read for its
  13742. symbols and for the contents of pure memory. It is also the
  13743. program executed when you use the 'run' command. If you do not
  13744. specify a directory and the file is not found in the GDB working
  13745. directory, GDB uses the environment variable 'PATH' as a list of
  13746. directories to search, just as the shell does when looking for a
  13747. program to run. You can change the value of this variable, for
  13748. both GDB and your program, using the 'path' command.
  13749. You can load unlinked object '.o' files into GDB using the 'file'
  13750. command. You will not be able to "run" an object file, but you can
  13751. disassemble functions and inspect variables. Also, if the
  13752. underlying BFD functionality supports it, you could use 'gdb
  13753. -write' to patch object files using this technique. Note that GDB
  13754. can neither interpret nor modify relocations in this case, so
  13755. branches and some initialized variables will appear to go to the
  13756. wrong place. But this feature is still handy from time to time.
  13757. 'file'
  13758. 'file' with no argument makes GDB discard any information it has on
  13759. both executable file and the symbol table.
  13760. 'exec-file [ FILENAME ]'
  13761. Specify that the program to be run (but not the symbol table) is
  13762. found in FILENAME. GDB searches the environment variable 'PATH' if
  13763. necessary to locate your program. Omitting FILENAME means to
  13764. discard information on the executable file.
  13765. 'symbol-file [ FILENAME [ -o OFFSET ]]'
  13766. Read symbol table information from file FILENAME. 'PATH' is
  13767. searched when necessary. Use the 'file' command to get both symbol
  13768. table and program to run from the same file.
  13769. If an optional OFFSET is specified, it is added to the start
  13770. address of each section in the symbol file. This is useful if the
  13771. program is relocated at runtime, such as the Linux kernel with
  13772. kASLR enabled.
  13773. 'symbol-file' with no argument clears out GDB information on your
  13774. program's symbol table.
  13775. The 'symbol-file' command causes GDB to forget the contents of some
  13776. breakpoints and auto-display expressions. This is because they may
  13777. contain pointers to the internal data recording symbols and data
  13778. types, which are part of the old symbol table data being discarded
  13779. inside GDB.
  13780. 'symbol-file' does not repeat if you press <RET> again after
  13781. executing it once.
  13782. When GDB is configured for a particular environment, it understands
  13783. debugging information in whatever format is the standard generated
  13784. for that environment; you may use either a GNU compiler, or other
  13785. compilers that adhere to the local conventions. Best results are
  13786. usually obtained from GNU compilers; for example, using 'GCC' you
  13787. can generate debugging information for optimized code.
  13788. For most kinds of object files, with the exception of old SVR3
  13789. systems using COFF, the 'symbol-file' command does not normally
  13790. read the symbol table in full right away. Instead, it scans the
  13791. symbol table quickly to find which source files and which symbols
  13792. are present. The details are read later, one source file at a
  13793. time, as they are needed.
  13794. The purpose of this two-stage reading strategy is to make GDB start
  13795. up faster. For the most part, it is invisible except for
  13796. occasional pauses while the symbol table details for a particular
  13797. source file are being read. (The 'set verbose' command can turn
  13798. these pauses into messages if desired. *Note Optional Warnings and
  13799. Messages: Messages/Warnings.)
  13800. We have not implemented the two-stage strategy for COFF yet. When
  13801. the symbol table is stored in COFF format, 'symbol-file' reads the
  13802. symbol table data in full right away. Note that "stabs-in-COFF"
  13803. still does the two-stage strategy, since the debug info is actually
  13804. in stabs format.
  13805. 'symbol-file [ -readnow ] FILENAME'
  13806. 'file [ -readnow ] FILENAME'
  13807. You can override the GDB two-stage strategy for reading symbol
  13808. tables by using the '-readnow' option with any of the commands that
  13809. load symbol table information, if you want to be sure GDB has the
  13810. entire symbol table available.
  13811. 'symbol-file [ -readnever ] FILENAME'
  13812. 'file [ -readnever ] FILENAME'
  13813. You can instruct GDB to never read the symbolic information
  13814. contained in FILENAME by using the '-readnever' option. *Note
  13815. --readnever::.
  13816. 'core-file [FILENAME]'
  13817. 'core'
  13818. Specify the whereabouts of a core dump file to be used as the
  13819. "contents of memory". Traditionally, core files contain only some
  13820. parts of the address space of the process that generated them; GDB
  13821. can access the executable file itself for other parts.
  13822. 'core-file' with no argument specifies that no core file is to be
  13823. used.
  13824. Note that the core file is ignored when your program is actually
  13825. running under GDB. So, if you have been running your program and
  13826. you wish to debug a core file instead, you must kill the subprocess
  13827. in which the program is running. To do this, use the 'kill'
  13828. command (*note Killing the Child Process: Kill Process.).
  13829. 'add-symbol-file FILENAME [ -readnow | -readnever ] [ -o OFFSET ] [ TEXTADDRESS ] [ -s SECTION ADDRESS ... ]'
  13830. The 'add-symbol-file' command reads additional symbol table
  13831. information from the file FILENAME. You would use this command
  13832. when FILENAME has been dynamically loaded (by some other means)
  13833. into the program that is running. The TEXTADDRESS parameter gives
  13834. the memory address at which the file's text section has been
  13835. loaded. You can additionally specify the base address of other
  13836. sections using an arbitrary number of '-s SECTION ADDRESS' pairs.
  13837. If a section is omitted, GDB will use its default addresses as
  13838. found in FILENAME. Any ADDRESS or TEXTADDRESS can be given as an
  13839. expression.
  13840. If an optional OFFSET is specified, it is added to the start
  13841. address of each section, except those for which the address was
  13842. specified explicitly.
  13843. The symbol table of the file FILENAME is added to the symbol table
  13844. originally read with the 'symbol-file' command. You can use the
  13845. 'add-symbol-file' command any number of times; the new symbol data
  13846. thus read is kept in addition to the old.
  13847. Changes can be reverted using the command 'remove-symbol-file'.
  13848. Although FILENAME is typically a shared library file, an executable
  13849. file, or some other object file which has been fully relocated for
  13850. loading into a process, you can also load symbolic information from
  13851. relocatable '.o' files, as long as:
  13852. * the file's symbolic information refers only to linker symbols
  13853. defined in that file, not to symbols defined by other object
  13854. files,
  13855. * every section the file's symbolic information refers to has
  13856. actually been loaded into the inferior, as it appears in the
  13857. file, and
  13858. * you can determine the address at which every section was
  13859. loaded, and provide these to the 'add-symbol-file' command.
  13860. Some embedded operating systems, like Sun Chorus and VxWorks, can
  13861. load relocatable files into an already running program; such
  13862. systems typically make the requirements above easy to meet.
  13863. However, it's important to recognize that many native systems use
  13864. complex link procedures ('.linkonce' section factoring and C++
  13865. constructor table assembly, for example) that make the requirements
  13866. difficult to meet. In general, one cannot assume that using
  13867. 'add-symbol-file' to read a relocatable object file's symbolic
  13868. information will have the same effect as linking the relocatable
  13869. object file into the program in the normal way.
  13870. 'add-symbol-file' does not repeat if you press <RET> after using
  13871. it.
  13872. 'remove-symbol-file FILENAME'
  13873. 'remove-symbol-file -a ADDRESS'
  13874. Remove a symbol file added via the 'add-symbol-file' command. The
  13875. file to remove can be identified by its FILENAME or by an ADDRESS
  13876. that lies within the boundaries of this symbol file in memory.
  13877. Example:
  13878. (gdb) add-symbol-file /home/user/gdb/mylib.so 0x7ffff7ff9480
  13879. add symbol table from file "/home/user/gdb/mylib.so" at
  13880. .text_addr = 0x7ffff7ff9480
  13881. (y or n) y
  13882. Reading symbols from /home/user/gdb/mylib.so...
  13883. (gdb) remove-symbol-file -a 0x7ffff7ff9480
  13884. Remove symbol table from file "/home/user/gdb/mylib.so"? (y or n) y
  13885. (gdb)
  13886. 'remove-symbol-file' does not repeat if you press <RET> after using
  13887. it.
  13888. 'add-symbol-file-from-memory ADDRESS'
  13889. Load symbols from the given ADDRESS in a dynamically loaded object
  13890. file whose image is mapped directly into the inferior's memory.
  13891. For example, the Linux kernel maps a 'syscall DSO' into each
  13892. process's address space; this DSO provides kernel-specific code for
  13893. some system calls. The argument can be any expression whose
  13894. evaluation yields the address of the file's shared object file
  13895. header. For this command to work, you must have used 'symbol-file'
  13896. or 'exec-file' commands in advance.
  13897. 'section SECTION ADDR'
  13898. The 'section' command changes the base address of the named SECTION
  13899. of the exec file to ADDR. This can be used if the exec file does
  13900. not contain section addresses, (such as in the 'a.out' format), or
  13901. when the addresses specified in the file itself are wrong. Each
  13902. section must be changed separately. The 'info files' command,
  13903. described below, lists all the sections and their addresses.
  13904. 'info files'
  13905. 'info target'
  13906. 'info files' and 'info target' are synonymous; both print the
  13907. current target (*note Specifying a Debugging Target: Targets.),
  13908. including the names of the executable and core dump files currently
  13909. in use by GDB, and the files from which symbols were loaded. The
  13910. command 'help target' lists all possible targets rather than
  13911. current ones.
  13912. 'maint info sections'
  13913. Another command that can give you extra information about program
  13914. sections is 'maint info sections'. In addition to the section
  13915. information displayed by 'info files', this command displays the
  13916. flags and file offset of each section in the executable and core
  13917. dump files. In addition, 'maint info sections' provides the
  13918. following command options (which may be arbitrarily combined):
  13919. 'ALLOBJ'
  13920. Display sections for all loaded object files, including shared
  13921. libraries.
  13922. 'SECTIONS'
  13923. Display info only for named SECTIONS.
  13924. 'SECTION-FLAGS'
  13925. Display info only for sections for which SECTION-FLAGS are
  13926. true. The section flags that GDB currently knows about are:
  13927. 'ALLOC'
  13928. Section will have space allocated in the process when
  13929. loaded. Set for all sections except those containing
  13930. debug information.
  13931. 'LOAD'
  13932. Section will be loaded from the file into the child
  13933. process memory. Set for pre-initialized code and data,
  13934. clear for '.bss' sections.
  13935. 'RELOC'
  13936. Section needs to be relocated before loading.
  13937. 'READONLY'
  13938. Section cannot be modified by the child process.
  13939. 'CODE'
  13940. Section contains executable code only.
  13941. 'DATA'
  13942. Section contains data only (no executable code).
  13943. 'ROM'
  13944. Section will reside in ROM.
  13945. 'CONSTRUCTOR'
  13946. Section contains data for constructor/destructor lists.
  13947. 'HAS_CONTENTS'
  13948. Section is not empty.
  13949. 'NEVER_LOAD'
  13950. An instruction to the linker to not output the section.
  13951. 'COFF_SHARED_LIBRARY'
  13952. A notification to the linker that the section contains
  13953. COFF shared library information.
  13954. 'IS_COMMON'
  13955. Section contains common symbols.
  13956. 'set trust-readonly-sections on'
  13957. Tell GDB that readonly sections in your object file really are
  13958. read-only (i.e. that their contents will not change). In that
  13959. case, GDB can fetch values from these sections out of the object
  13960. file, rather than from the target program. For some targets
  13961. (notably embedded ones), this can be a significant enhancement to
  13962. debugging performance.
  13963. The default is off.
  13964. 'set trust-readonly-sections off'
  13965. Tell GDB not to trust readonly sections. This means that the
  13966. contents of the section might change while the program is running,
  13967. and must therefore be fetched from the target when needed.
  13968. 'show trust-readonly-sections'
  13969. Show the current setting of trusting readonly sections.
  13970. All file-specifying commands allow both absolute and relative file
  13971. names as arguments. GDB always converts the file name to an absolute
  13972. file name and remembers it that way.
  13973. GDB supports GNU/Linux, MS-Windows, SunOS, Darwin/Mach-O, SVr4, IBM
  13974. RS/6000 AIX, QNX Neutrino, FDPIC (FR-V), and DSBT (TIC6X) shared
  13975. libraries.
  13976. On MS-Windows GDB must be linked with the Expat library to support
  13977. shared libraries. *Note Expat::.
  13978. GDB automatically loads symbol definitions from shared libraries when
  13979. you use the 'run' command, or when you examine a core file. (Before you
  13980. issue the 'run' command, GDB does not understand references to a
  13981. function in a shared library, however--unless you are debugging a core
  13982. file).
  13983. There are times, however, when you may wish to not automatically load
  13984. symbol definitions from shared libraries, such as when they are
  13985. particularly large or there are many of them.
  13986. To control the automatic loading of shared library symbols, use the
  13987. commands:
  13988. 'set auto-solib-add MODE'
  13989. If MODE is 'on', symbols from all shared object libraries will be
  13990. loaded automatically when the inferior begins execution, you attach
  13991. to an independently started inferior, or when the dynamic linker
  13992. informs GDB that a new library has been loaded. If MODE is 'off',
  13993. symbols must be loaded manually, using the 'sharedlibrary' command.
  13994. The default value is 'on'.
  13995. If your program uses lots of shared libraries with debug info that
  13996. takes large amounts of memory, you can decrease the GDB memory
  13997. footprint by preventing it from automatically loading the symbols
  13998. from shared libraries. To that end, type 'set auto-solib-add off'
  13999. before running the inferior, then load each library whose debug
  14000. symbols you do need with 'sharedlibrary REGEXP', where REGEXP is a
  14001. regular expression that matches the libraries whose symbols you
  14002. want to be loaded.
  14003. 'show auto-solib-add'
  14004. Display the current autoloading mode.
  14005. To explicitly load shared library symbols, use the 'sharedlibrary'
  14006. command:
  14007. 'info share REGEX'
  14008. 'info sharedlibrary REGEX'
  14009. Print the names of the shared libraries which are currently loaded
  14010. that match REGEX. If REGEX is omitted then print all shared
  14011. libraries that are loaded.
  14012. 'info dll REGEX'
  14013. This is an alias of 'info sharedlibrary'.
  14014. 'sharedlibrary REGEX'
  14015. 'share REGEX'
  14016. Load shared object library symbols for files matching a Unix
  14017. regular expression. As with files loaded automatically, it only
  14018. loads shared libraries required by your program for a core file or
  14019. after typing 'run'. If REGEX is omitted all shared libraries
  14020. required by your program are loaded.
  14021. 'nosharedlibrary'
  14022. Unload all shared object library symbols. This discards all
  14023. symbols that have been loaded from all shared libraries. Symbols
  14024. from shared libraries that were loaded by explicit user requests
  14025. are not discarded.
  14026. Sometimes you may wish that GDB stops and gives you control when any
  14027. of shared library events happen. The best way to do this is to use
  14028. 'catch load' and 'catch unload' (*note Set Catchpoints::).
  14029. GDB also supports the 'set stop-on-solib-events' command for this.
  14030. This command exists for historical reasons. It is less useful than
  14031. setting a catchpoint, because it does not allow for conditions or
  14032. commands as a catchpoint does.
  14033. 'set stop-on-solib-events'
  14034. This command controls whether GDB should give you control when the
  14035. dynamic linker notifies it about some shared library event. The
  14036. most common event of interest is loading or unloading of a new
  14037. shared library.
  14038. 'show stop-on-solib-events'
  14039. Show whether GDB stops and gives you control when shared library
  14040. events happen.
  14041. Shared libraries are also supported in many cross or remote debugging
  14042. configurations. GDB needs to have access to the target's libraries;
  14043. this can be accomplished either by providing copies of the libraries on
  14044. the host system, or by asking GDB to automatically retrieve the
  14045. libraries from the target. If copies of the target libraries are
  14046. provided, they need to be the same as the target libraries, although the
  14047. copies on the target can be stripped as long as the copies on the host
  14048. are not.
  14049. For remote debugging, you need to tell GDB where the target libraries
  14050. are, so that it can load the correct copies--otherwise, it may try to
  14051. load the host's libraries. GDB has two variables to specify the search
  14052. directories for target libraries.
  14053. 'set sysroot PATH'
  14054. Use PATH as the system root for the program being debugged. Any
  14055. absolute shared library paths will be prefixed with PATH; many
  14056. runtime loaders store the absolute paths to the shared library in
  14057. the target program's memory. When starting processes remotely, and
  14058. when attaching to already-running processes (local or remote),
  14059. their executable filenames will be prefixed with PATH if reported
  14060. to GDB as absolute by the operating system. If you use 'set
  14061. sysroot' to find executables and shared libraries, they need to be
  14062. laid out in the same way that they are on the target, with e.g. a
  14063. '/bin', '/lib' and '/usr/lib' hierarchy under PATH.
  14064. If PATH starts with the sequence 'target:' and the target system is
  14065. remote then GDB will retrieve the target binaries from the remote
  14066. system. This is only supported when using a remote target that
  14067. supports the 'remote get' command (*note Sending files to a remote
  14068. system: File Transfer.). The part of PATH following the initial
  14069. 'target:' (if present) is used as system root prefix on the remote
  14070. file system. If PATH starts with the sequence 'remote:' this is
  14071. converted to the sequence 'target:' by 'set sysroot'(1). If you
  14072. want to specify a local system root using a directory that happens
  14073. to be named 'target:' or 'remote:', you need to use some equivalent
  14074. variant of the name like './target:'.
  14075. For targets with an MS-DOS based filesystem, such as MS-Windows and
  14076. SymbianOS, GDB tries prefixing a few variants of the target
  14077. absolute file name with PATH. But first, on Unix hosts, GDB
  14078. converts all backslash directory separators into forward slashes,
  14079. because the backslash is not a directory separator on Unix:
  14080. c:\foo\bar.dll => c:/foo/bar.dll
  14081. Then, GDB attempts prefixing the target file name with PATH, and
  14082. looks for the resulting file name in the host file system:
  14083. c:/foo/bar.dll => /path/to/sysroot/c:/foo/bar.dll
  14084. If that does not find the binary, GDB tries removing the ':'
  14085. character from the drive spec, both for convenience, and, for the
  14086. case of the host file system not supporting file names with colons:
  14087. c:/foo/bar.dll => /path/to/sysroot/c/foo/bar.dll
  14088. This makes it possible to have a system root that mirrors a target
  14089. with more than one drive. E.g., you may want to setup your local
  14090. copies of the target system shared libraries like so (note 'c' vs
  14091. 'z'):
  14092. /path/to/sysroot/c/sys/bin/foo.dll
  14093. /path/to/sysroot/c/sys/bin/bar.dll
  14094. /path/to/sysroot/z/sys/bin/bar.dll
  14095. and point the system root at '/path/to/sysroot', so that GDB can
  14096. find the correct copies of both 'c:\sys\bin\foo.dll', and
  14097. 'z:\sys\bin\bar.dll'.
  14098. If that still does not find the binary, GDB tries removing the
  14099. whole drive spec from the target file name:
  14100. c:/foo/bar.dll => /path/to/sysroot/foo/bar.dll
  14101. This last lookup makes it possible to not care about the drive
  14102. name, if you don't want or need to.
  14103. The 'set solib-absolute-prefix' command is an alias for 'set
  14104. sysroot'.
  14105. You can set the default system root by using the configure-time
  14106. '--with-sysroot' option. If the system root is inside GDB's
  14107. configured binary prefix (set with '--prefix' or '--exec-prefix'),
  14108. then the default system root will be updated automatically if the
  14109. installed GDB is moved to a new location.
  14110. 'show sysroot'
  14111. Display the current executable and shared library prefix.
  14112. 'set solib-search-path PATH'
  14113. If this variable is set, PATH is a colon-separated list of
  14114. directories to search for shared libraries. 'solib-search-path' is
  14115. used after 'sysroot' fails to locate the library, or if the path to
  14116. the library is relative instead of absolute. If you want to use
  14117. 'solib-search-path' instead of 'sysroot', be sure to set 'sysroot'
  14118. to a nonexistent directory to prevent GDB from finding your host's
  14119. libraries. 'sysroot' is preferred; setting it to a nonexistent
  14120. directory may interfere with automatic loading of shared library
  14121. symbols.
  14122. 'show solib-search-path'
  14123. Display the current shared library search path.
  14124. 'set target-file-system-kind KIND'
  14125. Set assumed file system kind for target reported file names.
  14126. Shared library file names as reported by the target system may not
  14127. make sense as is on the system GDB is running on. For example,
  14128. when remote debugging a target that has MS-DOS based file system
  14129. semantics, from a Unix host, the target may be reporting to GDB a
  14130. list of loaded shared libraries with file names such as
  14131. 'c:\Windows\kernel32.dll'. On Unix hosts, there's no concept of
  14132. drive letters, so the 'c:\' prefix is not normally understood as
  14133. indicating an absolute file name, and neither is the backslash
  14134. normally considered a directory separator character. In that case,
  14135. the native file system would interpret this whole absolute file
  14136. name as a relative file name with no directory components. This
  14137. would make it impossible to point GDB at a copy of the remote
  14138. target's shared libraries on the host using 'set sysroot', and
  14139. impractical with 'set solib-search-path'. Setting
  14140. 'target-file-system-kind' to 'dos-based' tells GDB to interpret
  14141. such file names similarly to how the target would, and to map them
  14142. to file names valid on GDB's native file system semantics. The
  14143. value of KIND can be '"auto"', in addition to one of the supported
  14144. file system kinds. In that case, GDB tries to determine the
  14145. appropriate file system variant based on the current target's
  14146. operating system (*note Configuring the Current ABI: ABI.). The
  14147. supported file system settings are:
  14148. 'unix'
  14149. Instruct GDB to assume the target file system is of Unix kind.
  14150. Only file names starting the forward slash ('/') character are
  14151. considered absolute, and the directory separator character is
  14152. also the forward slash.
  14153. 'dos-based'
  14154. Instruct GDB to assume the target file system is DOS based.
  14155. File names starting with either a forward slash, or a drive
  14156. letter followed by a colon (e.g., 'c:'), are considered
  14157. absolute, and both the slash ('/') and the backslash ('\\')
  14158. characters are considered directory separators.
  14159. 'auto'
  14160. Instruct GDB to use the file system kind associated with the
  14161. target operating system (*note Configuring the Current ABI:
  14162. ABI.). This is the default.
  14163. When processing file names provided by the user, GDB frequently needs
  14164. to compare them to the file names recorded in the program's debug info.
  14165. Normally, GDB compares just the "base names" of the files as strings,
  14166. which is reasonably fast even for very large programs. (The base name
  14167. of a file is the last portion of its name, after stripping all the
  14168. leading directories.) This shortcut in comparison is based upon the
  14169. assumption that files cannot have more than one base name. This is
  14170. usually true, but references to files that use symlinks or similar
  14171. filesystem facilities violate that assumption. If your program records
  14172. files using such facilities, or if you provide file names to GDB using
  14173. symlinks etc., you can set 'basenames-may-differ' to 'true' to instruct
  14174. GDB to completely canonicalize each pair of file names it needs to
  14175. compare. This will make file-name comparisons accurate, but at a price
  14176. of a significant slowdown.
  14177. 'set basenames-may-differ'
  14178. Set whether a source file may have multiple base names.
  14179. 'show basenames-may-differ'
  14180. Show whether a source file may have multiple base names.
  14181. ---------- Footnotes ----------
  14182. (1) Historically the functionality to retrieve binaries from the
  14183. remote system was provided by prefixing PATH with 'remote:'
  14184. 
  14185. File: gdb.info, Node: File Caching, Next: Separate Debug Files, Prev: Files, Up: GDB Files
  14186. 18.2 File Caching
  14187. =================
  14188. To speed up file loading, and reduce memory usage, GDB will reuse the
  14189. 'bfd' objects used to track open files. *Note BFD: (bfd)Top. The
  14190. following commands allow visibility and control of the caching behavior.
  14191. 'maint info bfds'
  14192. This prints information about each 'bfd' object that is known to
  14193. GDB.
  14194. 'maint set bfd-sharing'
  14195. 'maint show bfd-sharing'
  14196. Control whether 'bfd' objects can be shared. When sharing is
  14197. enabled GDB reuses already open 'bfd' objects rather than reopening
  14198. the same file. Turning sharing off does not cause already shared
  14199. 'bfd' objects to be unshared, but all future files that are opened
  14200. will create a new 'bfd' object. Similarly, re-enabling sharing
  14201. does not cause multiple existing 'bfd' objects to be collapsed into
  14202. a single shared 'bfd' object.
  14203. 'set debug bfd-cache LEVEL'
  14204. Turns on debugging of the bfd cache, setting the level to LEVEL.
  14205. 'show debug bfd-cache'
  14206. Show the current debugging level of the bfd cache.
  14207. 
  14208. File: gdb.info, Node: Separate Debug Files, Next: MiniDebugInfo, Prev: File Caching, Up: GDB Files
  14209. 18.3 Debugging Information in Separate Files
  14210. ============================================
  14211. GDB allows you to put a program's debugging information in a file
  14212. separate from the executable itself, in a way that allows GDB to find
  14213. and load the debugging information automatically. Since debugging
  14214. information can be very large--sometimes larger than the executable code
  14215. itself--some systems distribute debugging information for their
  14216. executables in separate files, which users can install only when they
  14217. need to debug a problem.
  14218. GDB supports two ways of specifying the separate debug info file:
  14219. * The executable contains a "debug link" that specifies the name of
  14220. the separate debug info file. The separate debug file's name is
  14221. usually 'EXECUTABLE.debug', where EXECUTABLE is the name of the
  14222. corresponding executable file without leading directories (e.g.,
  14223. 'ls.debug' for '/usr/bin/ls'). In addition, the debug link
  14224. specifies a 32-bit "Cyclic Redundancy Check" (CRC) checksum for the
  14225. debug file, which GDB uses to validate that the executable and the
  14226. debug file came from the same build.
  14227. * The executable contains a "build ID", a unique bit string that is
  14228. also present in the corresponding debug info file. (This is
  14229. supported only on some operating systems, when using the ELF or PE
  14230. file formats for binary files and the GNU Binutils.) For more
  14231. details about this feature, see the description of the '--build-id'
  14232. command-line option in *note Command Line Options: (ld)Options.
  14233. The debug info file's name is not specified explicitly by the build
  14234. ID, but can be computed from the build ID, see below.
  14235. Depending on the way the debug info file is specified, GDB uses two
  14236. different methods of looking for the debug file:
  14237. * For the "debug link" method, GDB looks up the named file in the
  14238. directory of the executable file, then in a subdirectory of that
  14239. directory named '.debug', and finally under each one of the global
  14240. debug directories, in a subdirectory whose name is identical to the
  14241. leading directories of the executable's absolute file name. (On
  14242. MS-Windows/MS-DOS, the drive letter of the executable's leading
  14243. directories is converted to a one-letter subdirectory, i.e.
  14244. 'd:/usr/bin/' is converted to '/d/usr/bin/', because Windows
  14245. filesystems disallow colons in file names.)
  14246. * For the "build ID" method, GDB looks in the '.build-id'
  14247. subdirectory of each one of the global debug directories for a file
  14248. named 'NN/NNNNNNNN.debug', where NN are the first 2 hex characters
  14249. of the build ID bit string, and NNNNNNNN are the rest of the bit
  14250. string. (Real build ID strings are 32 or more hex characters, not
  14251. 10.)
  14252. So, for example, suppose you ask GDB to debug '/usr/bin/ls', which
  14253. has a debug link that specifies the file 'ls.debug', and a build ID
  14254. whose value in hex is 'abcdef1234'. If the list of the global debug
  14255. directories includes '/usr/lib/debug', then GDB will look for the
  14256. following debug information files, in the indicated order:
  14257. - '/usr/lib/debug/.build-id/ab/cdef1234.debug'
  14258. - '/usr/bin/ls.debug'
  14259. - '/usr/bin/.debug/ls.debug'
  14260. - '/usr/lib/debug/usr/bin/ls.debug'.
  14261. Global debugging info directories default to what is set by GDB
  14262. configure option '--with-separate-debug-dir'. During GDB run you can
  14263. also set the global debugging info directories, and view the list GDB is
  14264. currently using.
  14265. 'set debug-file-directory DIRECTORIES'
  14266. Set the directories which GDB searches for separate debugging
  14267. information files to DIRECTORY. Multiple path components can be
  14268. set concatenating them by a path separator.
  14269. 'show debug-file-directory'
  14270. Show the directories GDB searches for separate debugging
  14271. information files.
  14272. A debug link is a special section of the executable file named
  14273. '.gnu_debuglink'. The section must contain:
  14274. * A filename, with any leading directory components removed, followed
  14275. by a zero byte,
  14276. * zero to three bytes of padding, as needed to reach the next
  14277. four-byte boundary within the section, and
  14278. * a four-byte CRC checksum, stored in the same endianness used for
  14279. the executable file itself. The checksum is computed on the
  14280. debugging information file's full contents by the function given
  14281. below, passing zero as the CRC argument.
  14282. Any executable file format can carry a debug link, as long as it can
  14283. contain a section named '.gnu_debuglink' with the contents described
  14284. above.
  14285. The build ID is a special section in the executable file (and in
  14286. other ELF binary files that GDB may consider). This section is often
  14287. named '.note.gnu.build-id', but that name is not mandatory. It contains
  14288. unique identification for the built files--the ID remains the same
  14289. across multiple builds of the same build tree. The default algorithm
  14290. SHA1 produces 160 bits (40 hexadecimal characters) of the content for
  14291. the build ID string. The same section with an identical value is
  14292. present in the original built binary with symbols, in its stripped
  14293. variant, and in the separate debugging information file.
  14294. The debugging information file itself should be an ordinary
  14295. executable, containing a full set of linker symbols, sections, and
  14296. debugging information. The sections of the debugging information file
  14297. should have the same names, addresses, and sizes as the original file,
  14298. but they need not contain any data--much like a '.bss' section in an
  14299. ordinary executable.
  14300. The GNU binary utilities (Binutils) package includes the 'objcopy'
  14301. utility that can produce the separated executable / debugging
  14302. information file pairs using the following commands:
  14303. objcopy --only-keep-debug foo foo.debug
  14304. strip -g foo
  14305. These commands remove the debugging information from the executable file
  14306. 'foo' and place it in the file 'foo.debug'. You can use the first,
  14307. second or both methods to link the two files:
  14308. * The debug link method needs the following additional command to
  14309. also leave behind a debug link in 'foo':
  14310. objcopy --add-gnu-debuglink=foo.debug foo
  14311. Ulrich Drepper's 'elfutils' package, starting with version 0.53,
  14312. contains a version of the 'strip' command such that the command
  14313. 'strip foo -f foo.debug' has the same functionality as the two
  14314. 'objcopy' commands and the 'ln -s' command above, together.
  14315. * Build ID gets embedded into the main executable using 'ld
  14316. --build-id' or the GCC counterpart 'gcc -Wl,--build-id'. Build ID
  14317. support plus compatibility fixes for debug files separation are
  14318. present in GNU binary utilities (Binutils) package since version
  14319. 2.18.
  14320. The CRC used in '.gnu_debuglink' is the CRC-32 defined in IEEE 802.3
  14321. using the polynomial:
  14322. x^{32} + x^{26} + x^{23} + x^{22} + x^{16} + x^{12} + x^{11}
  14323. + x^{10} + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1
  14324. The function is computed byte at a time, taking the least significant
  14325. bit of each byte first. The initial pattern '0xffffffff' is used, to
  14326. ensure leading zeros affect the CRC and the final result is inverted to
  14327. ensure trailing zeros also affect the CRC.
  14328. _Note:_ This is the same CRC polynomial as used in handling the
  14329. "Remote Serial Protocol" 'qCRC' packet (*note qCRC packet::). However
  14330. in the case of the Remote Serial Protocol, the CRC is computed _most_
  14331. significant bit first, and the result is not inverted, so trailing zeros
  14332. have no effect on the CRC value.
  14333. To complete the description, we show below the code of the function
  14334. which produces the CRC used in '.gnu_debuglink'. Inverting the
  14335. initially supplied 'crc' argument means that an initial call to this
  14336. function passing in zero will start computing the CRC using
  14337. '0xffffffff'.
  14338. unsigned long
  14339. gnu_debuglink_crc32 (unsigned long crc,
  14340. unsigned char *buf, size_t len)
  14341. {
  14342. static const unsigned long crc32_table[256] =
  14343. {
  14344. 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
  14345. 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
  14346. 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
  14347. 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
  14348. 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
  14349. 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
  14350. 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
  14351. 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
  14352. 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
  14353. 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
  14354. 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
  14355. 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
  14356. 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
  14357. 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
  14358. 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
  14359. 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
  14360. 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
  14361. 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
  14362. 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
  14363. 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
  14364. 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
  14365. 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
  14366. 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
  14367. 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
  14368. 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
  14369. 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
  14370. 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
  14371. 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
  14372. 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
  14373. 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
  14374. 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
  14375. 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
  14376. 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
  14377. 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
  14378. 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
  14379. 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
  14380. 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
  14381. 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
  14382. 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
  14383. 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
  14384. 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
  14385. 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
  14386. 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
  14387. 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
  14388. 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
  14389. 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
  14390. 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
  14391. 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
  14392. 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
  14393. 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
  14394. 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
  14395. 0x2d02ef8d
  14396. };
  14397. unsigned char *end;
  14398. crc = ~crc & 0xffffffff;
  14399. for (end = buf + len; buf < end; ++buf)
  14400. crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
  14401. return ~crc & 0xffffffff;
  14402. }
  14403. This computation does not apply to the "build ID" method.
  14404. 
  14405. File: gdb.info, Node: MiniDebugInfo, Next: Index Files, Prev: Separate Debug Files, Up: GDB Files
  14406. 18.4 Debugging information in a special section
  14407. ===============================================
  14408. Some systems ship pre-built executables and libraries that have a
  14409. special '.gnu_debugdata' section. This feature is called
  14410. "MiniDebugInfo". This section holds an LZMA-compressed object and is
  14411. used to supply extra symbols for backtraces.
  14412. The intent of this section is to provide extra minimal debugging
  14413. information for use in simple backtraces. It is not intended to be a
  14414. replacement for full separate debugging information (*note Separate
  14415. Debug Files::). The example below shows the intended use; however, GDB
  14416. does not currently put restrictions on what sort of debugging
  14417. information might be included in the section.
  14418. GDB has support for this extension. If the section exists, then it
  14419. is used provided that no other source of debugging information can be
  14420. found, and that GDB was configured with LZMA support.
  14421. This section can be easily created using 'objcopy' and other standard
  14422. utilities:
  14423. # Extract the dynamic symbols from the main binary, there is no need
  14424. # to also have these in the normal symbol table.
  14425. nm -D BINARY --format=posix --defined-only \
  14426. | awk '{ print $1 }' | sort > dynsyms
  14427. # Extract all the text (i.e. function) symbols from the debuginfo.
  14428. # (Note that we actually also accept "D" symbols, for the benefit
  14429. # of platforms like PowerPC64 that use function descriptors.)
  14430. nm BINARY --format=posix --defined-only \
  14431. | awk '{ if ($2 == "T" || $2 == "t" || $2 == "D") print $1 }' \
  14432. | sort > funcsyms
  14433. # Keep all the function symbols not already in the dynamic symbol
  14434. # table.
  14435. comm -13 dynsyms funcsyms > keep_symbols
  14436. # Separate full debug info into debug binary.
  14437. objcopy --only-keep-debug BINARY debug
  14438. # Copy the full debuginfo, keeping only a minimal set of symbols and
  14439. # removing some unnecessary sections.
  14440. objcopy -S --remove-section .gdb_index --remove-section .comment \
  14441. --keep-symbols=keep_symbols debug mini_debuginfo
  14442. # Drop the full debug info from the original binary.
  14443. strip --strip-all -R .comment BINARY
  14444. # Inject the compressed data into the .gnu_debugdata section of the
  14445. # original binary.
  14446. xz mini_debuginfo
  14447. objcopy --add-section .gnu_debugdata=mini_debuginfo.xz BINARY
  14448. 
  14449. File: gdb.info, Node: Index Files, Next: Symbol Errors, Prev: MiniDebugInfo, Up: GDB Files
  14450. 18.5 Index Files Speed Up GDB
  14451. =============================
  14452. When GDB finds a symbol file, it scans the symbols in the file in order
  14453. to construct an internal symbol table. This lets most GDB operations
  14454. work quickly--at the cost of a delay early on. For large programs, this
  14455. delay can be quite lengthy, so GDB provides a way to build an index,
  14456. which speeds up startup.
  14457. For convenience, GDB comes with a program, 'gdb-add-index', which can
  14458. be used to add the index to a symbol file. It takes the symbol file as
  14459. its only argument:
  14460. $ gdb-add-index symfile
  14461. *Note gdb-add-index::.
  14462. It is also possible to do the work manually. Here is what
  14463. 'gdb-add-index' does behind the curtains.
  14464. The index is stored as a section in the symbol file. GDB can write
  14465. the index to a file, then you can put it into the symbol file using
  14466. 'objcopy'.
  14467. To create an index file, use the 'save gdb-index' command:
  14468. 'save gdb-index [-dwarf-5] DIRECTORY'
  14469. Create index files for all symbol files currently known by GDB.
  14470. For each known SYMBOL-FILE, this command by default creates it
  14471. produces a single file 'SYMBOL-FILE.gdb-index'. If you invoke this
  14472. command with the '-dwarf-5' option, it produces 2 files:
  14473. 'SYMBOL-FILE.debug_names' and 'SYMBOL-FILE.debug_str'. The files
  14474. are created in the given DIRECTORY.
  14475. Once you have created an index file you can merge it into your symbol
  14476. file, here named 'symfile', using 'objcopy':
  14477. $ objcopy --add-section .gdb_index=symfile.gdb-index \
  14478. --set-section-flags .gdb_index=readonly symfile symfile
  14479. Or for '-dwarf-5':
  14480. $ objcopy --dump-section .debug_str=symfile.debug_str.new symfile
  14481. $ cat symfile.debug_str >>symfile.debug_str.new
  14482. $ objcopy --add-section .debug_names=symfile.gdb-index \
  14483. --set-section-flags .debug_names=readonly \
  14484. --update-section .debug_str=symfile.debug_str.new symfile symfile
  14485. GDB will normally ignore older versions of '.gdb_index' sections that
  14486. have been deprecated. Usually they are deprecated because they are
  14487. missing a new feature or have performance issues. To tell GDB to use a
  14488. deprecated index section anyway specify 'set
  14489. use-deprecated-index-sections on'. The default is 'off'. This can
  14490. speed up startup, but may result in some functionality being lost.
  14491. *Note Index Section Format::.
  14492. _Warning:_ Setting 'use-deprecated-index-sections' to 'on' must be
  14493. done before gdb reads the file. The following will not work:
  14494. $ gdb -ex "set use-deprecated-index-sections on" <program>
  14495. Instead you must do, for example,
  14496. $ gdb -iex "set use-deprecated-index-sections on" <program>
  14497. Indices only work when using DWARF debugging information, not stabs.
  14498. 18.5.1 Automatic symbol index cache
  14499. -----------------------------------
  14500. It is possible for GDB to automatically save a copy of this index in a
  14501. cache on disk and retrieve it from there when loading the same binary in
  14502. the future. This feature can be turned on with 'set index-cache on'.
  14503. The following commands can be used to tweak the behavior of the index
  14504. cache.
  14505. 'set index-cache on'
  14506. 'set index-cache off'
  14507. Enable or disable the use of the symbol index cache.
  14508. 'set index-cache directory DIRECTORY'
  14509. 'show index-cache directory'
  14510. Set/show the directory where index files will be saved.
  14511. The default value for this directory depends on the host platform.
  14512. On most systems, the index is cached in the 'gdb' subdirectory of
  14513. the directory pointed to by the 'XDG_CACHE_HOME' environment
  14514. variable, if it is defined, else in the '.cache/gdb' subdirectory
  14515. of your home directory. However, on some systems, the default may
  14516. differ according to local convention.
  14517. There is no limit on the disk space used by index cache. It is
  14518. perfectly safe to delete the content of that directory to free up
  14519. disk space.
  14520. 'show index-cache stats'
  14521. Print the number of cache hits and misses since the launch of GDB.
  14522. 
  14523. File: gdb.info, Node: Symbol Errors, Next: Data Files, Prev: Index Files, Up: GDB Files
  14524. 18.6 Errors Reading Symbol Files
  14525. ================================
  14526. While reading a symbol file, GDB occasionally encounters problems, such
  14527. as symbol types it does not recognize, or known bugs in compiler output.
  14528. By default, GDB does not notify you of such problems, since they are
  14529. relatively common and primarily of interest to people debugging
  14530. compilers. If you are interested in seeing information about
  14531. ill-constructed symbol tables, you can either ask GDB to print only one
  14532. message about each such type of problem, no matter how many times the
  14533. problem occurs; or you can ask GDB to print more messages, to see how
  14534. many times the problems occur, with the 'set complaints' command (*note
  14535. Optional Warnings and Messages: Messages/Warnings.).
  14536. The messages currently printed, and their meanings, include:
  14537. 'inner block not inside outer block in SYMBOL'
  14538. The symbol information shows where symbol scopes begin and end
  14539. (such as at the start of a function or a block of statements).
  14540. This error indicates that an inner scope block is not fully
  14541. contained in its outer scope blocks.
  14542. GDB circumvents the problem by treating the inner block as if it
  14543. had the same scope as the outer block. In the error message,
  14544. SYMBOL may be shown as "'(don't know)'" if the outer block is not a
  14545. function.
  14546. 'block at ADDRESS out of order'
  14547. The symbol information for symbol scope blocks should occur in
  14548. order of increasing addresses. This error indicates that it does
  14549. not do so.
  14550. GDB does not circumvent this problem, and has trouble locating
  14551. symbols in the source file whose symbols it is reading. (You can
  14552. often determine what source file is affected by specifying 'set
  14553. verbose on'. *Note Optional Warnings and Messages:
  14554. Messages/Warnings.)
  14555. 'bad block start address patched'
  14556. The symbol information for a symbol scope block has a start address
  14557. smaller than the address of the preceding source line. This is
  14558. known to occur in the SunOS 4.1.1 (and earlier) C compiler.
  14559. GDB circumvents the problem by treating the symbol scope block as
  14560. starting on the previous source line.
  14561. 'bad string table offset in symbol N'
  14562. Symbol number N contains a pointer into the string table which is
  14563. larger than the size of the string table.
  14564. GDB circumvents the problem by considering the symbol to have the
  14565. name 'foo', which may cause other problems if many symbols end up
  14566. with this name.
  14567. 'unknown symbol type 0xNN'
  14568. The symbol information contains new data types that GDB does not
  14569. yet know how to read. '0xNN' is the symbol type of the
  14570. uncomprehended information, in hexadecimal.
  14571. GDB circumvents the error by ignoring this symbol information.
  14572. This usually allows you to debug your program, though certain
  14573. symbols are not accessible. If you encounter such a problem and
  14574. feel like debugging it, you can debug 'gdb' with itself, breakpoint
  14575. on 'complain', then go up to the function 'read_dbx_symtab' and
  14576. examine '*bufp' to see the symbol.
  14577. 'stub type has NULL name'
  14578. GDB could not find the full definition for a struct or class.
  14579. 'const/volatile indicator missing (ok if using g++ v1.x), got...'
  14580. The symbol information for a C++ member function is missing some
  14581. information that recent versions of the compiler should have output
  14582. for it.
  14583. 'info mismatch between compiler and debugger'
  14584. GDB could not parse a type specification output by the compiler.
  14585. 
  14586. File: gdb.info, Node: Data Files, Prev: Symbol Errors, Up: GDB Files
  14587. 18.7 GDB Data Files
  14588. ===================
  14589. GDB will sometimes read an auxiliary data file. These files are kept in
  14590. a directory known as the "data directory".
  14591. You can set the data directory's name, and view the name GDB is
  14592. currently using.
  14593. 'set data-directory DIRECTORY'
  14594. Set the directory which GDB searches for auxiliary data files to
  14595. DIRECTORY.
  14596. 'show data-directory'
  14597. Show the directory GDB searches for auxiliary data files.
  14598. You can set the default data directory by using the configure-time
  14599. '--with-gdb-datadir' option. If the data directory is inside GDB's
  14600. configured binary prefix (set with '--prefix' or '--exec-prefix'), then
  14601. the default data directory will be updated automatically if the
  14602. installed GDB is moved to a new location.
  14603. The data directory may also be specified with the '--data-directory'
  14604. command line option. *Note Mode Options::.
  14605. 
  14606. File: gdb.info, Node: Targets, Next: Remote Debugging, Prev: GDB Files, Up: Top
  14607. 19 Specifying a Debugging Target
  14608. ********************************
  14609. A "target" is the execution environment occupied by your program.
  14610. Often, GDB runs in the same host environment as your program; in that
  14611. case, the debugging target is specified as a side effect when you use
  14612. the 'file' or 'core' commands. When you need more flexibility--for
  14613. example, running GDB on a physically separate host, or controlling a
  14614. standalone system over a serial port or a realtime system over a TCP/IP
  14615. connection--you can use the 'target' command to specify one of the
  14616. target types configured for GDB (*note Commands for Managing Targets:
  14617. Target Commands.).
  14618. It is possible to build GDB for several different "target
  14619. architectures". When GDB is built like that, you can choose one of the
  14620. available architectures with the 'set architecture' command.
  14621. 'set architecture ARCH'
  14622. This command sets the current target architecture to ARCH. The
  14623. value of ARCH can be '"auto"', in addition to one of the supported
  14624. architectures.
  14625. 'show architecture'
  14626. Show the current target architecture.
  14627. 'set processor'
  14628. 'processor'
  14629. These are alias commands for, respectively, 'set architecture' and
  14630. 'show architecture'.
  14631. * Menu:
  14632. * Active Targets:: Active targets
  14633. * Target Commands:: Commands for managing targets
  14634. * Byte Order:: Choosing target byte order
  14635. 
  14636. File: gdb.info, Node: Active Targets, Next: Target Commands, Up: Targets
  14637. 19.1 Active Targets
  14638. ===================
  14639. There are multiple classes of targets such as: processes, executable
  14640. files or recording sessions. Core files belong to the process class,
  14641. making core file and process mutually exclusive. Otherwise, GDB can
  14642. work concurrently on multiple active targets, one in each class. This
  14643. allows you to (for example) start a process and inspect its activity,
  14644. while still having access to the executable file after the process
  14645. finishes. Or if you start process recording (*note Reverse Execution::)
  14646. and 'reverse-step' there, you are presented a virtual layer of the
  14647. recording target, while the process target remains stopped at the
  14648. chronologically last point of the process execution.
  14649. Use the 'core-file' and 'exec-file' commands to select a new core
  14650. file or executable target (*note Commands to Specify Files: Files.). To
  14651. specify as a target a process that is already running, use the 'attach'
  14652. command (*note Debugging an Already-running Process: Attach.).
  14653. 
  14654. File: gdb.info, Node: Target Commands, Next: Byte Order, Prev: Active Targets, Up: Targets
  14655. 19.2 Commands for Managing Targets
  14656. ==================================
  14657. 'target TYPE PARAMETERS'
  14658. Connects the GDB host environment to a target machine or process.
  14659. A target is typically a protocol for talking to debugging
  14660. facilities. You use the argument TYPE to specify the type or
  14661. protocol of the target machine.
  14662. Further PARAMETERS are interpreted by the target protocol, but
  14663. typically include things like device names or host names to connect
  14664. with, process numbers, and baud rates.
  14665. The 'target' command does not repeat if you press <RET> again after
  14666. executing the command.
  14667. 'help target'
  14668. Displays the names of all targets available. To display targets
  14669. currently selected, use either 'info target' or 'info files' (*note
  14670. Commands to Specify Files: Files.).
  14671. 'help target NAME'
  14672. Describe a particular target, including any parameters necessary to
  14673. select it.
  14674. 'set gnutarget ARGS'
  14675. GDB uses its own library BFD to read your files. GDB knows whether
  14676. it is reading an "executable", a "core", or a ".o" file; however,
  14677. you can specify the file format with the 'set gnutarget' command.
  14678. Unlike most 'target' commands, with 'gnutarget' the 'target' refers
  14679. to a program, not a machine.
  14680. _Warning:_ To specify a file format with 'set gnutarget', you
  14681. must know the actual BFD name.
  14682. *Note Commands to Specify Files: Files.
  14683. 'show gnutarget'
  14684. Use the 'show gnutarget' command to display what file format
  14685. 'gnutarget' is set to read. If you have not set 'gnutarget', GDB
  14686. will determine the file format for each file automatically, and
  14687. 'show gnutarget' displays 'The current BFD target is "auto"'.
  14688. Here are some common targets (available, or not, depending on the GDB
  14689. configuration):
  14690. 'target exec PROGRAM'
  14691. An executable file. 'target exec PROGRAM' is the same as
  14692. 'exec-file PROGRAM'.
  14693. 'target core FILENAME'
  14694. A core dump file. 'target core FILENAME' is the same as 'core-file
  14695. FILENAME'.
  14696. 'target remote MEDIUM'
  14697. A remote system connected to GDB via a serial line or network
  14698. connection. This command tells GDB to use its own remote protocol
  14699. over MEDIUM for debugging. *Note Remote Debugging::.
  14700. For example, if you have a board connected to '/dev/ttya' on the
  14701. machine running GDB, you could say:
  14702. target remote /dev/ttya
  14703. 'target remote' supports the 'load' command. This is only useful
  14704. if you have some other way of getting the stub to the target
  14705. system, and you can put it somewhere in memory where it won't get
  14706. clobbered by the download.
  14707. 'target sim [SIMARGS] ...'
  14708. Builtin CPU simulator. GDB includes simulators for most
  14709. architectures. In general,
  14710. target sim
  14711. load
  14712. run
  14713. works; however, you cannot assume that a specific memory map,
  14714. device drivers, or even basic I/O is available, although some
  14715. simulators do provide these. For info about any processor-specific
  14716. simulator details, see the appropriate section in *note Embedded
  14717. Processors: Embedded Processors.
  14718. 'target native'
  14719. Setup for local/native process debugging. Useful to make the 'run'
  14720. command spawn native processes (likewise 'attach', etc.) even when
  14721. 'set auto-connect-native-target' is 'off' (*note set
  14722. auto-connect-native-target::).
  14723. Different targets are available on different configurations of GDB;
  14724. your configuration may have more or fewer targets.
  14725. Many remote targets require you to download the executable's code
  14726. once you've successfully established a connection. You may wish to
  14727. control various aspects of this process.
  14728. 'set hash'
  14729. This command controls whether a hash mark '#' is displayed while
  14730. downloading a file to the remote monitor. If on, a hash mark is
  14731. displayed after each S-record is successfully downloaded to the
  14732. monitor.
  14733. 'show hash'
  14734. Show the current status of displaying the hash mark.
  14735. 'set debug monitor'
  14736. Enable or disable display of communications messages between GDB
  14737. and the remote monitor.
  14738. 'show debug monitor'
  14739. Show the current status of displaying communications between GDB
  14740. and the remote monitor.
  14741. 'load FILENAME OFFSET'
  14742. Depending on what remote debugging facilities are configured into
  14743. GDB, the 'load' command may be available. Where it exists, it is
  14744. meant to make FILENAME (an executable) available for debugging on
  14745. the remote system--by downloading, or dynamic linking, for example.
  14746. 'load' also records the FILENAME symbol table in GDB, like the
  14747. 'add-symbol-file' command.
  14748. If your GDB does not have a 'load' command, attempting to execute
  14749. it gets the error message "'You can't do that when your target is
  14750. ...'"
  14751. The file is loaded at whatever address is specified in the
  14752. executable. For some object file formats, you can specify the load
  14753. address when you link the program; for other formats, like a.out,
  14754. the object file format specifies a fixed address.
  14755. It is also possible to tell GDB to load the executable file at a
  14756. specific offset described by the optional argument OFFSET. When
  14757. OFFSET is provided, FILENAME must also be provided.
  14758. Depending on the remote side capabilities, GDB may be able to load
  14759. programs into flash memory.
  14760. 'load' does not repeat if you press <RET> again after using it.
  14761. 'flash-erase'
  14762. Erases all known flash memory regions on the target.
  14763. 
  14764. File: gdb.info, Node: Byte Order, Prev: Target Commands, Up: Targets
  14765. 19.3 Choosing Target Byte Order
  14766. ===============================
  14767. Some types of processors, such as the MIPS, PowerPC, and Renesas SH,
  14768. offer the ability to run either big-endian or little-endian byte orders.
  14769. Usually the executable or symbol will include a bit to designate the
  14770. endian-ness, and you will not need to worry about which to use.
  14771. However, you may still find it useful to adjust GDB's idea of processor
  14772. endian-ness manually.
  14773. 'set endian big'
  14774. Instruct GDB to assume the target is big-endian.
  14775. 'set endian little'
  14776. Instruct GDB to assume the target is little-endian.
  14777. 'set endian auto'
  14778. Instruct GDB to use the byte order associated with the executable.
  14779. 'show endian'
  14780. Display GDB's current idea of the target byte order.
  14781. If the 'set endian auto' mode is in effect and no executable has been
  14782. selected, then the endianness used is the last one chosen either by one
  14783. of the 'set endian big' and 'set endian little' commands or by inferring
  14784. from the last executable used. If no endianness has been previously
  14785. chosen, then the default for this mode is inferred from the target GDB
  14786. has been built for, and is 'little' if the name of the target CPU has an
  14787. 'el' suffix and 'big' otherwise.
  14788. Note that these commands merely adjust interpretation of symbolic
  14789. data on the host, and that they have absolutely no effect on the target
  14790. system.
  14791. 
  14792. File: gdb.info, Node: Remote Debugging, Next: Configurations, Prev: Targets, Up: Top
  14793. 20 Debugging Remote Programs
  14794. ****************************
  14795. If you are trying to debug a program running on a machine that cannot
  14796. run GDB in the usual way, it is often useful to use remote debugging.
  14797. For example, you might use remote debugging on an operating system
  14798. kernel, or on a small system which does not have a general purpose
  14799. operating system powerful enough to run a full-featured debugger.
  14800. Some configurations of GDB have special serial or TCP/IP interfaces
  14801. to make this work with particular debugging targets. In addition, GDB
  14802. comes with a generic serial protocol (specific to GDB, but not specific
  14803. to any particular target system) which you can use if you write the
  14804. remote stubs--the code that runs on the remote system to communicate
  14805. with GDB.
  14806. Other remote targets may be available in your configuration of GDB;
  14807. use 'help target' to list them.
  14808. * Menu:
  14809. * Connecting:: Connecting to a remote target
  14810. * File Transfer:: Sending files to a remote system
  14811. * Server:: Using the gdbserver program
  14812. * Remote Configuration:: Remote configuration
  14813. * Remote Stub:: Implementing a remote stub
  14814. 
  14815. File: gdb.info, Node: Connecting, Next: File Transfer, Up: Remote Debugging
  14816. 20.1 Connecting to a Remote Target
  14817. ==================================
  14818. This section describes how to connect to a remote target, including the
  14819. types of connections and their differences, how to set up executable and
  14820. symbol files on the host and target, and the commands used for
  14821. connecting to and disconnecting from the remote target.
  14822. 20.1.1 Types of Remote Connections
  14823. ----------------------------------
  14824. GDB supports two types of remote connections, 'target remote' mode and
  14825. 'target extended-remote' mode. Note that many remote targets support
  14826. only 'target remote' mode. There are several major differences between
  14827. the two types of connections, enumerated here:
  14828. Result of detach or program exit
  14829. *With target remote mode:* When the debugged program exits or you
  14830. detach from it, GDB disconnects from the target. When using
  14831. 'gdbserver', 'gdbserver' will exit.
  14832. *With target extended-remote mode:* When the debugged program exits
  14833. or you detach from it, GDB remains connected to the target, even
  14834. though no program is running. You can rerun the program, attach to
  14835. a running program, or use 'monitor' commands specific to the
  14836. target.
  14837. When using 'gdbserver' in this case, it does not exit unless it was
  14838. invoked using the '--once' option. If the '--once' option was not
  14839. used, you can ask 'gdbserver' to exit using the 'monitor exit'
  14840. command (*note Monitor Commands for gdbserver::).
  14841. Specifying the program to debug
  14842. For both connection types you use the 'file' command to specify the
  14843. program on the host system. If you are using 'gdbserver' there are
  14844. some differences in how to specify the location of the program on
  14845. the target.
  14846. *With target remote mode:* You must either specify the program to
  14847. debug on the 'gdbserver' command line or use the '--attach' option
  14848. (*note Attaching to a Running Program: Attaching to a program.).
  14849. *With target extended-remote mode:* You may specify the program to
  14850. debug on the 'gdbserver' command line, or you can load the program
  14851. or attach to it using GDB commands after connecting to 'gdbserver'.
  14852. You can start 'gdbserver' without supplying an initial command to
  14853. run or process ID to attach. To do this, use the '--multi' command
  14854. line option. Then you can connect using 'target extended-remote'
  14855. and start the program you want to debug (see below for details on
  14856. using the 'run' command in this scenario). Note that the
  14857. conditions under which 'gdbserver' terminates depend on how GDB
  14858. connects to it ('target remote' or 'target extended-remote'). The
  14859. '--multi' option to 'gdbserver' has no influence on that.
  14860. The 'run' command
  14861. *With target remote mode:* The 'run' command is not supported.
  14862. Once a connection has been established, you can use all the usual
  14863. GDB commands to examine and change data. The remote program is
  14864. already running, so you can use commands like 'step' and
  14865. 'continue'.
  14866. *With target extended-remote mode:* The 'run' command is supported.
  14867. The 'run' command uses the value set by 'set remote exec-file'
  14868. (*note set remote exec-file::) to select the program to run.
  14869. Command line arguments are supported, except for wildcard expansion
  14870. and I/O redirection (*note Arguments::).
  14871. If you specify the program to debug on the command line, then the
  14872. 'run' command is not required to start execution, and you can
  14873. resume using commands like 'step' and 'continue' as with 'target
  14874. remote' mode.
  14875. Attaching
  14876. *With target remote mode:* The GDB command 'attach' is not
  14877. supported. To attach to a running program using 'gdbserver', you
  14878. must use the '--attach' option (*note Running gdbserver::).
  14879. *With target extended-remote mode:* To attach to a running program,
  14880. you may use the 'attach' command after the connection has been
  14881. established. If you are using 'gdbserver', you may also invoke
  14882. 'gdbserver' using the '--attach' option (*note Running
  14883. gdbserver::).
  14884. Some remote targets allow GDB to determine the executable file
  14885. running in the process the debugger is attaching to. In such a
  14886. case, GDB uses the value of 'exec-file-mismatch' to handle a
  14887. possible mismatch between the executable file name running in the
  14888. process and the name of the current exec-file loaded by GDB (*note
  14889. set exec-file-mismatch::).
  14890. 20.1.2 Host and Target Files
  14891. ----------------------------
  14892. GDB, running on the host, needs access to symbol and debugging
  14893. information for your program running on the target. This requires
  14894. access to an unstripped copy of your program, and possibly any
  14895. associated symbol files. Note that this section applies equally to both
  14896. 'target remote' mode and 'target extended-remote' mode.
  14897. Some remote targets (*note qXfer executable filename read::, and
  14898. *note Host I/O Packets::) allow GDB to access program files over the
  14899. same connection used to communicate with GDB. With such a target, if
  14900. the remote program is unstripped, the only command you need is 'target
  14901. remote' (or 'target extended-remote').
  14902. If the remote program is stripped, or the target does not support
  14903. remote program file access, start up GDB using the name of the local
  14904. unstripped copy of your program as the first argument, or use the 'file'
  14905. command. Use 'set sysroot' to specify the location (on the host) of
  14906. target libraries (unless your GDB was compiled with the correct sysroot
  14907. using '--with-sysroot'). Alternatively, you may use 'set
  14908. solib-search-path' to specify how GDB locates target libraries.
  14909. The symbol file and target libraries must exactly match the
  14910. executable and libraries on the target, with one exception: the files on
  14911. the host system should not be stripped, even if the files on the target
  14912. system are. Mismatched or missing files will lead to confusing results
  14913. during debugging. On GNU/Linux targets, mismatched or missing files may
  14914. also prevent 'gdbserver' from debugging multi-threaded programs.
  14915. 20.1.3 Remote Connection Commands
  14916. ---------------------------------
  14917. GDB can communicate with the target over a serial line, a local Unix
  14918. domain socket, or over an IP network using TCP or UDP. In each case,
  14919. GDB uses the same protocol for debugging your program; only the medium
  14920. carrying the debugging packets varies. The 'target remote' and 'target
  14921. extended-remote' commands establish a connection to the target. Both
  14922. commands accept the same arguments, which indicate the medium to use:
  14923. 'target remote SERIAL-DEVICE'
  14924. 'target extended-remote SERIAL-DEVICE'
  14925. Use SERIAL-DEVICE to communicate with the target. For example, to
  14926. use a serial line connected to the device named '/dev/ttyb':
  14927. target remote /dev/ttyb
  14928. If you're using a serial line, you may want to give GDB the
  14929. '--baud' option, or use the 'set serial baud' command (*note set
  14930. serial baud: Remote Configuration.) before the 'target' command.
  14931. 'target remote LOCAL-SOCKET'
  14932. 'target extended-remote LOCAL-SOCKET'
  14933. Use LOCAL-SOCKET to communicate with the target. For example, to
  14934. use a local Unix domain socket bound to the file system entry
  14935. '/tmp/gdb-socket0':
  14936. target remote /tmp/gdb-socket0
  14937. Note that this command has the same form as the command to connect
  14938. to a serial line. GDB will automatically determine which kind of
  14939. file you have specified and will make the appropriate kind of
  14940. connection. This feature is not available if the host system does
  14941. not support Unix domain sockets.
  14942. 'target remote HOST:PORT'
  14943. 'target remote [HOST]:PORT'
  14944. 'target remote tcp:HOST:PORT'
  14945. 'target remote tcp:[HOST]:PORT'
  14946. 'target remote tcp4:HOST:PORT'
  14947. 'target remote tcp6:HOST:PORT'
  14948. 'target remote tcp6:[HOST]:PORT'
  14949. 'target extended-remote HOST:PORT'
  14950. 'target extended-remote [HOST]:PORT'
  14951. 'target extended-remote tcp:HOST:PORT'
  14952. 'target extended-remote tcp:[HOST]:PORT'
  14953. 'target extended-remote tcp4:HOST:PORT'
  14954. 'target extended-remote tcp6:HOST:PORT'
  14955. 'target extended-remote tcp6:[HOST]:PORT'
  14956. Debug using a TCP connection to PORT on HOST. The HOST may be
  14957. either a host name, a numeric IPv4 address, or a numeric IPv6
  14958. address (with or without the square brackets to separate the
  14959. address from the port); PORT must be a decimal number. The HOST
  14960. could be the target machine itself, if it is directly connected to
  14961. the net, or it might be a terminal server which in turn has a
  14962. serial line to the target.
  14963. For example, to connect to port 2828 on a terminal server named
  14964. 'manyfarms':
  14965. target remote manyfarms:2828
  14966. To connect to port 2828 on a terminal server whose address is
  14967. '2001:0db8:85a3:0000:0000:8a2e:0370:7334', you can either use the
  14968. square bracket syntax:
  14969. target remote [2001:0db8:85a3:0000:0000:8a2e:0370:7334]:2828
  14970. or explicitly specify the IPv6 protocol:
  14971. target remote tcp6:2001:0db8:85a3:0000:0000:8a2e:0370:7334:2828
  14972. This last example may be confusing to the reader, because there is
  14973. no visible separation between the hostname and the port number.
  14974. Therefore, we recommend the user to provide IPv6 addresses using
  14975. square brackets for clarity. However, it is important to mention
  14976. that for GDB there is no ambiguity: the number after the last colon
  14977. is considered to be the port number.
  14978. If your remote target is actually running on the same machine as
  14979. your debugger session (e.g. a simulator for your target running on
  14980. the same host), you can omit the hostname. For example, to connect
  14981. to port 1234 on your local machine:
  14982. target remote :1234
  14983. Note that the colon is still required here.
  14984. 'target remote udp:HOST:PORT'
  14985. 'target remote udp:[HOST]:PORT'
  14986. 'target remote udp4:HOST:PORT'
  14987. 'target remote udp6:[HOST]:PORT'
  14988. 'target extended-remote udp:HOST:PORT'
  14989. 'target extended-remote udp:HOST:PORT'
  14990. 'target extended-remote udp:[HOST]:PORT'
  14991. 'target extended-remote udp4:HOST:PORT'
  14992. 'target extended-remote udp6:HOST:PORT'
  14993. 'target extended-remote udp6:[HOST]:PORT'
  14994. Debug using UDP packets to PORT on HOST. For example, to connect
  14995. to UDP port 2828 on a terminal server named 'manyfarms':
  14996. target remote udp:manyfarms:2828
  14997. When using a UDP connection for remote debugging, you should keep
  14998. in mind that the 'U' stands for "Unreliable". UDP can silently
  14999. drop packets on busy or unreliable networks, which will cause havoc
  15000. with your debugging session.
  15001. 'target remote | COMMAND'
  15002. 'target extended-remote | COMMAND'
  15003. Run COMMAND in the background and communicate with it using a pipe.
  15004. The COMMAND is a shell command, to be parsed and expanded by the
  15005. system's command shell, '/bin/sh'; it should expect remote protocol
  15006. packets on its standard input, and send replies on its standard
  15007. output. You could use this to run a stand-alone simulator that
  15008. speaks the remote debugging protocol, to make net connections using
  15009. programs like 'ssh', or for other similar tricks.
  15010. If COMMAND closes its standard output (perhaps by exiting), GDB
  15011. will try to send it a 'SIGTERM' signal. (If the program has
  15012. already exited, this will have no effect.)
  15013. Whenever GDB is waiting for the remote program, if you type the
  15014. interrupt character (often 'Ctrl-c'), GDB attempts to stop the program.
  15015. This may or may not succeed, depending in part on the hardware and the
  15016. serial drivers the remote system uses. If you type the interrupt
  15017. character once again, GDB displays this prompt:
  15018. Interrupted while waiting for the program.
  15019. Give up (and stop debugging it)? (y or n)
  15020. In 'target remote' mode, if you type 'y', GDB abandons the remote
  15021. debugging session. (If you decide you want to try again later, you can
  15022. use 'target remote' again to connect once more.) If you type 'n', GDB
  15023. goes back to waiting.
  15024. In 'target extended-remote' mode, typing 'n' will leave GDB connected
  15025. to the target.
  15026. 'detach'
  15027. When you have finished debugging the remote program, you can use
  15028. the 'detach' command to release it from GDB control. Detaching
  15029. from the target normally resumes its execution, but the results
  15030. will depend on your particular remote stub. After the 'detach'
  15031. command in 'target remote' mode, GDB is free to connect to another
  15032. target. In 'target extended-remote' mode, GDB is still connected
  15033. to the target.
  15034. 'disconnect'
  15035. The 'disconnect' command closes the connection to the target, and
  15036. the target is generally not resumed. It will wait for GDB (this
  15037. instance or another one) to connect and continue debugging. After
  15038. the 'disconnect' command, GDB is again free to connect to another
  15039. target.
  15040. 'monitor CMD'
  15041. This command allows you to send arbitrary commands directly to the
  15042. remote monitor. Since GDB doesn't care about the commands it sends
  15043. like this, this command is the way to extend GDB--you can add new
  15044. commands that only the external monitor will understand and
  15045. implement.
  15046. 
  15047. File: gdb.info, Node: File Transfer, Next: Server, Prev: Connecting, Up: Remote Debugging
  15048. 20.2 Sending files to a remote system
  15049. =====================================
  15050. Some remote targets offer the ability to transfer files over the same
  15051. connection used to communicate with GDB. This is convenient for targets
  15052. accessible through other means, e.g. GNU/Linux systems running
  15053. 'gdbserver' over a network interface. For other targets, e.g. embedded
  15054. devices with only a single serial port, this may be the only way to
  15055. upload or download files.
  15056. Not all remote targets support these commands.
  15057. 'remote put HOSTFILE TARGETFILE'
  15058. Copy file HOSTFILE from the host system (the machine running GDB)
  15059. to TARGETFILE on the target system.
  15060. 'remote get TARGETFILE HOSTFILE'
  15061. Copy file TARGETFILE from the target system to HOSTFILE on the host
  15062. system.
  15063. 'remote delete TARGETFILE'
  15064. Delete TARGETFILE from the target system.
  15065. 
  15066. File: gdb.info, Node: Server, Next: Remote Configuration, Prev: File Transfer, Up: Remote Debugging
  15067. 20.3 Using the 'gdbserver' Program
  15068. ==================================
  15069. 'gdbserver' is a control program for Unix-like systems, which allows you
  15070. to connect your program with a remote GDB via 'target remote' or 'target
  15071. extended-remote'--but without linking in the usual debugging stub.
  15072. 'gdbserver' is not a complete replacement for the debugging stubs,
  15073. because it requires essentially the same operating-system facilities
  15074. that GDB itself does. In fact, a system that can run 'gdbserver' to
  15075. connect to a remote GDB could also run GDB locally! 'gdbserver' is
  15076. sometimes useful nevertheless, because it is a much smaller program than
  15077. GDB itself. It is also easier to port than all of GDB, so you may be
  15078. able to get started more quickly on a new system by using 'gdbserver'.
  15079. Finally, if you develop code for real-time systems, you may find that
  15080. the tradeoffs involved in real-time operation make it more convenient to
  15081. do as much development work as possible on another system, for example
  15082. by cross-compiling. You can use 'gdbserver' to make a similar choice
  15083. for debugging.
  15084. GDB and 'gdbserver' communicate via either a serial line or a TCP
  15085. connection, using the standard GDB remote serial protocol.
  15086. _Warning:_ 'gdbserver' does not have any built-in security. Do not
  15087. run 'gdbserver' connected to any public network; a GDB connection
  15088. to 'gdbserver' provides access to the target system with the same
  15089. privileges as the user running 'gdbserver'.
  15090. 20.3.1 Running 'gdbserver'
  15091. --------------------------
  15092. Run 'gdbserver' on the target system. You need a copy of the program
  15093. you want to debug, including any libraries it requires. 'gdbserver'
  15094. does not need your program's symbol table, so you can strip the program
  15095. if necessary to save space. GDB on the host system does all the symbol
  15096. handling.
  15097. To use the server, you must tell it how to communicate with GDB; the
  15098. name of your program; and the arguments for your program. The usual
  15099. syntax is:
  15100. target> gdbserver COMM PROGRAM [ ARGS ... ]
  15101. COMM is either a device name (to use a serial line), or a TCP
  15102. hostname and portnumber, or '-' or 'stdio' to use stdin/stdout of
  15103. 'gdbserver'. For example, to debug Emacs with the argument 'foo.txt'
  15104. and communicate with GDB over the serial port '/dev/com1':
  15105. target> gdbserver /dev/com1 emacs foo.txt
  15106. 'gdbserver' waits passively for the host GDB to communicate with it.
  15107. To use a TCP connection instead of a serial line:
  15108. target> gdbserver host:2345 emacs foo.txt
  15109. The only difference from the previous example is the first argument,
  15110. specifying that you are communicating with the host GDB via TCP. The
  15111. 'host:2345' argument means that 'gdbserver' is to expect a TCP
  15112. connection from machine 'host' to local TCP port 2345. (Currently, the
  15113. 'host' part is ignored.) You can choose any number you want for the
  15114. port number as long as it does not conflict with any TCP ports already
  15115. in use on the target system (for example, '23' is reserved for
  15116. 'telnet').(1) You must use the same port number with the host GDB
  15117. 'target remote' command.
  15118. The 'stdio' connection is useful when starting 'gdbserver' with ssh:
  15119. (gdb) target remote | ssh -T hostname gdbserver - hello
  15120. The '-T' option to ssh is provided because we don't need a remote
  15121. pty, and we don't want escape-character handling. Ssh does this by
  15122. default when a command is provided, the flag is provided to make it
  15123. explicit. You could elide it if you want to.
  15124. Programs started with stdio-connected gdbserver have '/dev/null' for
  15125. 'stdin', and 'stdout','stderr' are sent back to gdb for display through
  15126. a pipe connected to gdbserver. Both 'stdout' and 'stderr' use the same
  15127. pipe.
  15128. 20.3.1.1 Attaching to a Running Program
  15129. .......................................
  15130. On some targets, 'gdbserver' can also attach to running programs. This
  15131. is accomplished via the '--attach' argument. The syntax is:
  15132. target> gdbserver --attach COMM PID
  15133. PID is the process ID of a currently running process. It isn't
  15134. necessary to point 'gdbserver' at a binary for the running process.
  15135. In 'target extended-remote' mode, you can also attach using the GDB
  15136. attach command (*note Attaching in Types of Remote Connections::).
  15137. You can debug processes by name instead of process ID if your target
  15138. has the 'pidof' utility:
  15139. target> gdbserver --attach COMM `pidof PROGRAM`
  15140. In case more than one copy of PROGRAM is running, or PROGRAM has
  15141. multiple threads, most versions of 'pidof' support the '-s' option to
  15142. only return the first process ID.
  15143. 20.3.1.2 TCP port allocation lifecycle of 'gdbserver'
  15144. .....................................................
  15145. This section applies only when 'gdbserver' is run to listen on a TCP
  15146. port.
  15147. 'gdbserver' normally terminates after all of its debugged processes
  15148. have terminated in 'target remote' mode. On the other hand, for 'target
  15149. extended-remote', 'gdbserver' stays running even with no processes left.
  15150. GDB normally terminates the spawned debugged process on its exit, which
  15151. normally also terminates 'gdbserver' in the 'target remote' mode.
  15152. Therefore, when the connection drops unexpectedly, and GDB cannot ask
  15153. 'gdbserver' to kill its debugged processes, 'gdbserver' stays running
  15154. even in the 'target remote' mode.
  15155. When 'gdbserver' stays running, GDB can connect to it again later.
  15156. Such reconnecting is useful for features like *note disconnected
  15157. tracing::. For completeness, at most one GDB can be connected at a
  15158. time.
  15159. By default, 'gdbserver' keeps the listening TCP port open, so that
  15160. subsequent connections are possible. However, if you start 'gdbserver'
  15161. with the '--once' option, it will stop listening for any further
  15162. connection attempts after connecting to the first GDB session. This
  15163. means no further connections to 'gdbserver' will be possible after the
  15164. first one. It also means 'gdbserver' will terminate after the first
  15165. connection with remote GDB has closed, even for unexpectedly closed
  15166. connections and even in the 'target extended-remote' mode. The '--once'
  15167. option allows reusing the same port number for connecting to multiple
  15168. instances of 'gdbserver' running on the same host, since each instance
  15169. closes its port after the first connection.
  15170. 20.3.1.3 Other Command-Line Arguments for 'gdbserver'
  15171. .....................................................
  15172. You can use the '--multi' option to start 'gdbserver' without specifying
  15173. a program to debug or a process to attach to. Then you can attach in
  15174. 'target extended-remote' mode and run or attach to a program. For more
  15175. information, *note --multi Option in Types of Remote Connnections::.
  15176. The '--debug' option tells 'gdbserver' to display extra status
  15177. information about the debugging process. The '--remote-debug' option
  15178. tells 'gdbserver' to display remote protocol debug output. The
  15179. '--debug-file=FILENAME' option tells 'gdbserver' to write any debug
  15180. output to the given FILENAME. These options are intended for
  15181. 'gdbserver' development and for bug reports to the developers.
  15182. The '--debug-format=option1[,option2,...]' option tells 'gdbserver'
  15183. to include additional information in each output. Possible options are:
  15184. 'none'
  15185. Turn off all extra information in debugging output.
  15186. 'all'
  15187. Turn on all extra information in debugging output.
  15188. 'timestamps'
  15189. Include a timestamp in each line of debugging output.
  15190. Options are processed in order. Thus, for example, if 'none' appears
  15191. last then no additional information is added to debugging output.
  15192. The '--wrapper' option specifies a wrapper to launch programs for
  15193. debugging. The option should be followed by the name of the wrapper,
  15194. then any command-line arguments to pass to the wrapper, then '--'
  15195. indicating the end of the wrapper arguments.
  15196. 'gdbserver' runs the specified wrapper program with a combined
  15197. command line including the wrapper arguments, then the name of the
  15198. program to debug, then any arguments to the program. The wrapper runs
  15199. until it executes your program, and then GDB gains control.
  15200. You can use any program that eventually calls 'execve' with its
  15201. arguments as a wrapper. Several standard Unix utilities do this, e.g.
  15202. 'env' and 'nohup'. Any Unix shell script ending with 'exec "$@"' will
  15203. also work.
  15204. For example, you can use 'env' to pass an environment variable to the
  15205. debugged program, without setting the variable in 'gdbserver''s
  15206. environment:
  15207. $ gdbserver --wrapper env LD_PRELOAD=libtest.so -- :2222 ./testprog
  15208. The '--selftest' option runs the self tests in 'gdbserver':
  15209. $ gdbserver --selftest
  15210. Ran 2 unit tests, 0 failed
  15211. These tests are disabled in release.
  15212. 20.3.2 Connecting to 'gdbserver'
  15213. --------------------------------
  15214. The basic procedure for connecting to the remote target is:
  15215. * Run GDB on the host system.
  15216. * Make sure you have the necessary symbol files (*note Host and
  15217. target files::). Load symbols for your application using the
  15218. 'file' command before you connect. Use 'set sysroot' to locate
  15219. target libraries (unless your GDB was compiled with the correct
  15220. sysroot using '--with-sysroot').
  15221. * Connect to your target (*note Connecting to a Remote Target:
  15222. Connecting.). For TCP connections, you must start up 'gdbserver'
  15223. prior to using the 'target' command. Otherwise you may get an
  15224. error whose text depends on the host system, but which usually
  15225. looks something like 'Connection refused'. Don't use the 'load'
  15226. command in GDB when using 'target remote' mode, since the program
  15227. is already on the target.
  15228. 20.3.3 Monitor Commands for 'gdbserver'
  15229. ---------------------------------------
  15230. During a GDB session using 'gdbserver', you can use the 'monitor'
  15231. command to send special requests to 'gdbserver'. Here are the available
  15232. commands.
  15233. 'monitor help'
  15234. List the available monitor commands.
  15235. 'monitor set debug 0'
  15236. 'monitor set debug 1'
  15237. Disable or enable general debugging messages.
  15238. 'monitor set remote-debug 0'
  15239. 'monitor set remote-debug 1'
  15240. Disable or enable specific debugging messages associated with the
  15241. remote protocol (*note Remote Protocol::).
  15242. 'monitor set debug-file filename'
  15243. 'monitor set debug-file'
  15244. Send any debug output to the given file, or to stderr.
  15245. 'monitor set debug-format option1[,option2,...]'
  15246. Specify additional text to add to debugging messages. Possible
  15247. options are:
  15248. 'none'
  15249. Turn off all extra information in debugging output.
  15250. 'all'
  15251. Turn on all extra information in debugging output.
  15252. 'timestamps'
  15253. Include a timestamp in each line of debugging output.
  15254. Options are processed in order. Thus, for example, if 'none'
  15255. appears last then no additional information is added to debugging
  15256. output.
  15257. 'monitor set libthread-db-search-path [PATH]'
  15258. When this command is issued, PATH is a colon-separated list of
  15259. directories to search for 'libthread_db' (*note set
  15260. libthread-db-search-path: Threads.). If you omit PATH,
  15261. 'libthread-db-search-path' will be reset to its default value.
  15262. The special entry '$pdir' for 'libthread-db-search-path' is not
  15263. supported in 'gdbserver'.
  15264. 'monitor exit'
  15265. Tell gdbserver to exit immediately. This command should be
  15266. followed by 'disconnect' to close the debugging session.
  15267. 'gdbserver' will detach from any attached processes and kill any
  15268. processes it created. Use 'monitor exit' to terminate 'gdbserver'
  15269. at the end of a multi-process mode debug session.
  15270. 20.3.4 Tracepoints support in 'gdbserver'
  15271. -----------------------------------------
  15272. On some targets, 'gdbserver' supports tracepoints, fast tracepoints and
  15273. static tracepoints.
  15274. For fast or static tracepoints to work, a special library called the
  15275. "in-process agent" (IPA), must be loaded in the inferior process. This
  15276. library is built and distributed as an integral part of 'gdbserver'. In
  15277. addition, support for static tracepoints requires building the
  15278. in-process agent library with static tracepoints support. At present,
  15279. the UST (LTTng Userspace Tracer, <http://lttng.org/ust>) tracing engine
  15280. is supported. This support is automatically available if UST
  15281. development headers are found in the standard include path when
  15282. 'gdbserver' is built, or if 'gdbserver' was explicitly configured using
  15283. '--with-ust' to point at such headers. You can explicitly disable the
  15284. support using '--with-ust=no'.
  15285. There are several ways to load the in-process agent in your program:
  15286. 'Specifying it as dependency at link time'
  15287. You can link your program dynamically with the in-process agent
  15288. library. On most systems, this is accomplished by adding
  15289. '-linproctrace' to the link command.
  15290. 'Using the system's preloading mechanisms'
  15291. You can force loading the in-process agent at startup time by using
  15292. your system's support for preloading shared libraries. Many Unixes
  15293. support the concept of preloading user defined libraries. In most
  15294. cases, you do that by specifying 'LD_PRELOAD=libinproctrace.so' in
  15295. the environment. See also the description of 'gdbserver''s
  15296. '--wrapper' command line option.
  15297. 'Using GDB to force loading the agent at run time'
  15298. On some systems, you can force the inferior to load a shared
  15299. library, by calling a dynamic loader function in the inferior that
  15300. takes care of dynamically looking up and loading a shared library.
  15301. On most Unix systems, the function is 'dlopen'. You'll use the
  15302. 'call' command for that. For example:
  15303. (gdb) call dlopen ("libinproctrace.so", ...)
  15304. Note that on most Unix systems, for the 'dlopen' function to be
  15305. available, the program needs to be linked with '-ldl'.
  15306. On systems that have a userspace dynamic loader, like most Unix
  15307. systems, when you connect to 'gdbserver' using 'target remote', you'll
  15308. find that the program is stopped at the dynamic loader's entry point,
  15309. and no shared library has been loaded in the program's address space
  15310. yet, including the in-process agent. In that case, before being able to
  15311. use any of the fast or static tracepoints features, you need to let the
  15312. loader run and load the shared libraries. The simplest way to do that
  15313. is to run the program to the main procedure. E.g., if debugging a C or
  15314. C++ program, start 'gdbserver' like so:
  15315. $ gdbserver :9999 myprogram
  15316. Start GDB and connect to 'gdbserver' like so, and run to main:
  15317. $ gdb myprogram
  15318. (gdb) target remote myhost:9999
  15319. 0x00007f215893ba60 in ?? () from /lib64/ld-linux-x86-64.so.2
  15320. (gdb) b main
  15321. (gdb) continue
  15322. The in-process tracing agent library should now be loaded into the
  15323. process; you can confirm it with the 'info sharedlibrary' command, which
  15324. will list 'libinproctrace.so' as loaded in the process. You are now
  15325. ready to install fast tracepoints, list static tracepoint markers, probe
  15326. static tracepoints markers, and start tracing.
  15327. ---------- Footnotes ----------
  15328. (1) If you choose a port number that conflicts with another service,
  15329. 'gdbserver' prints an error message and exits.
  15330. 
  15331. File: gdb.info, Node: Remote Configuration, Next: Remote Stub, Prev: Server, Up: Remote Debugging
  15332. 20.4 Remote Configuration
  15333. =========================
  15334. This section documents the configuration options available when
  15335. debugging remote programs. For the options related to the File I/O
  15336. extensions of the remote protocol, see *note system-call-allowed:
  15337. system.
  15338. 'set remoteaddresssize BITS'
  15339. Set the maximum size of address in a memory packet to the specified
  15340. number of bits. GDB will mask off the address bits above that
  15341. number, when it passes addresses to the remote target. The default
  15342. value is the number of bits in the target's address.
  15343. 'show remoteaddresssize'
  15344. Show the current value of remote address size in bits.
  15345. 'set serial baud N'
  15346. Set the baud rate for the remote serial I/O to N baud. The value
  15347. is used to set the speed of the serial port used for debugging
  15348. remote targets.
  15349. 'show serial baud'
  15350. Show the current speed of the remote connection.
  15351. 'set serial parity PARITY'
  15352. Set the parity for the remote serial I/O. Supported values of
  15353. PARITY are: 'even', 'none', and 'odd'. The default is 'none'.
  15354. 'show serial parity'
  15355. Show the current parity of the serial port.
  15356. 'set remotebreak'
  15357. If set to on, GDB sends a 'BREAK' signal to the remote when you
  15358. type 'Ctrl-c' to interrupt the program running on the remote. If
  15359. set to off, GDB sends the 'Ctrl-C' character instead. The default
  15360. is off, since most remote systems expect to see 'Ctrl-C' as the
  15361. interrupt signal.
  15362. 'show remotebreak'
  15363. Show whether GDB sends 'BREAK' or 'Ctrl-C' to interrupt the remote
  15364. program.
  15365. 'set remoteflow on'
  15366. 'set remoteflow off'
  15367. Enable or disable hardware flow control ('RTS'/'CTS') on the serial
  15368. port used to communicate to the remote target.
  15369. 'show remoteflow'
  15370. Show the current setting of hardware flow control.
  15371. 'set remotelogbase BASE'
  15372. Set the base (a.k.a. radix) of logging serial protocol
  15373. communications to BASE. Supported values of BASE are: 'ascii',
  15374. 'octal', and 'hex'. The default is 'ascii'.
  15375. 'show remotelogbase'
  15376. Show the current setting of the radix for logging remote serial
  15377. protocol.
  15378. 'set remotelogfile FILE'
  15379. Record remote serial communications on the named FILE. The default
  15380. is not to record at all.
  15381. 'show remotelogfile'
  15382. Show the current setting of the file name on which to record the
  15383. serial communications.
  15384. 'set remotetimeout NUM'
  15385. Set the timeout limit to wait for the remote target to respond to
  15386. NUM seconds. The default is 2 seconds.
  15387. 'show remotetimeout'
  15388. Show the current number of seconds to wait for the remote target
  15389. responses.
  15390. 'set remote hardware-watchpoint-limit LIMIT'
  15391. 'set remote hardware-breakpoint-limit LIMIT'
  15392. Restrict GDB to using LIMIT remote hardware watchpoints or
  15393. breakpoints. The LIMIT can be set to 0 to disable hardware
  15394. watchpoints or breakpoints, and 'unlimited' for unlimited
  15395. watchpoints or breakpoints.
  15396. 'show remote hardware-watchpoint-limit'
  15397. 'show remote hardware-breakpoint-limit'
  15398. Show the current limit for the number of hardware watchpoints or
  15399. breakpoints that GDB can use.
  15400. 'set remote hardware-watchpoint-length-limit LIMIT'
  15401. Restrict GDB to using LIMIT bytes for the maximum length of a
  15402. remote hardware watchpoint. A LIMIT of 0 disables hardware
  15403. watchpoints and 'unlimited' allows watchpoints of any length.
  15404. 'show remote hardware-watchpoint-length-limit'
  15405. Show the current limit (in bytes) of the maximum length of a remote
  15406. hardware watchpoint.
  15407. 'set remote exec-file FILENAME'
  15408. 'show remote exec-file'
  15409. Select the file used for 'run' with 'target extended-remote'. This
  15410. should be set to a filename valid on the target system. If it is
  15411. not set, the target will use a default filename (e.g. the last
  15412. program run).
  15413. 'set remote interrupt-sequence'
  15414. Allow the user to select one of 'Ctrl-C', a 'BREAK' or 'BREAK-g' as
  15415. the sequence to the remote target in order to interrupt the
  15416. execution. 'Ctrl-C' is a default. Some system prefers 'BREAK'
  15417. which is high level of serial line for some certain time. Linux
  15418. kernel prefers 'BREAK-g', a.k.a Magic SysRq g. It is 'BREAK'
  15419. signal followed by character 'g'.
  15420. 'show interrupt-sequence'
  15421. Show which of 'Ctrl-C', 'BREAK' or 'BREAK-g' is sent by GDB to
  15422. interrupt the remote program. 'BREAK-g' is BREAK signal followed
  15423. by 'g' and also known as Magic SysRq g.
  15424. 'set remote interrupt-on-connect'
  15425. Specify whether interrupt-sequence is sent to remote target when
  15426. GDB connects to it. This is mostly needed when you debug Linux
  15427. kernel. Linux kernel expects 'BREAK' followed by 'g' which is
  15428. known as Magic SysRq g in order to connect GDB.
  15429. 'show interrupt-on-connect'
  15430. Show whether interrupt-sequence is sent to remote target when GDB
  15431. connects to it.
  15432. 'set tcp auto-retry on'
  15433. Enable auto-retry for remote TCP connections. This is useful if
  15434. the remote debugging agent is launched in parallel with GDB; there
  15435. is a race condition because the agent may not become ready to
  15436. accept the connection before GDB attempts to connect. When
  15437. auto-retry is enabled, if the initial attempt to connect fails, GDB
  15438. reattempts to establish the connection using the timeout specified
  15439. by 'set tcp connect-timeout'.
  15440. 'set tcp auto-retry off'
  15441. Do not auto-retry failed TCP connections.
  15442. 'show tcp auto-retry'
  15443. Show the current auto-retry setting.
  15444. 'set tcp connect-timeout SECONDS'
  15445. 'set tcp connect-timeout unlimited'
  15446. Set the timeout for establishing a TCP connection to the remote
  15447. target to SECONDS. The timeout affects both polling to retry
  15448. failed connections (enabled by 'set tcp auto-retry on') and waiting
  15449. for connections that are merely slow to complete, and represents an
  15450. approximate cumulative value. If SECONDS is 'unlimited', there is
  15451. no timeout and GDB will keep attempting to establish a connection
  15452. forever, unless interrupted with 'Ctrl-c'. The default is 15
  15453. seconds.
  15454. 'show tcp connect-timeout'
  15455. Show the current connection timeout setting.
  15456. The GDB remote protocol autodetects the packets supported by your
  15457. debugging stub. If you need to override the autodetection, you can use
  15458. these commands to enable or disable individual packets. Each packet can
  15459. be set to 'on' (the remote target supports this packet), 'off' (the
  15460. remote target does not support this packet), or 'auto' (detect remote
  15461. target support for this packet). They all default to 'auto'. For more
  15462. information about each packet, see *note Remote Protocol::.
  15463. During normal use, you should not have to use any of these commands.
  15464. If you do, that may be a bug in your remote debugging stub, or a bug in
  15465. GDB. You may want to report the problem to the GDB developers.
  15466. For each packet NAME, the command to enable or disable the packet is
  15467. 'set remote NAME-packet'. The available settings are:
  15468. Command Name Remote Packet Related Features
  15469. 'fetch-register' 'p' 'info registers'
  15470. 'set-register' 'P' 'set'
  15471. 'binary-download' 'X' 'load', 'set'
  15472. 'read-aux-vector' 'qXfer:auxv:read' 'info auxv'
  15473. 'symbol-lookup' 'qSymbol' Detecting
  15474. multiple threads
  15475. 'attach' 'vAttach' 'attach'
  15476. 'verbose-resume' 'vCont' Stepping or
  15477. resuming
  15478. multiple threads
  15479. 'run' 'vRun' 'run'
  15480. 'software-breakpoint''Z0' 'break'
  15481. 'hardware-breakpoint''Z1' 'hbreak'
  15482. 'write-watchpoint' 'Z2' 'watch'
  15483. 'read-watchpoint' 'Z3' 'rwatch'
  15484. 'access-watchpoint' 'Z4' 'awatch'
  15485. 'pid-to-exec-file' 'qXfer:exec-file:read' 'attach', 'run'
  15486. 'target-features' 'qXfer:features:read' 'set
  15487. architecture'
  15488. 'library-info' 'qXfer:libraries:read' 'info
  15489. sharedlibrary'
  15490. 'memory-map' 'qXfer:memory-map:read' 'info mem'
  15491. 'read-sdata-object' 'qXfer:sdata:read' 'print $_sdata'
  15492. 'read-siginfo-object''qXfer:siginfo:read' 'print
  15493. $_siginfo'
  15494. 'write-siginfo-object''qXfer:siginfo:write' 'set $_siginfo'
  15495. 'threads' 'qXfer:threads:read' 'info threads'
  15496. 'get-thread-local- 'qGetTLSAddr' Displaying
  15497. storage-address' '__thread'
  15498. variables
  15499. 'get-thread-information-block-address''qGetTIBAddr'Display
  15500. MS-Windows
  15501. Thread
  15502. Information
  15503. Block.
  15504. 'search-memory' 'qSearch:memory' 'find'
  15505. 'supported-packets' 'qSupported' Remote
  15506. communications
  15507. parameters
  15508. 'catch-syscalls' 'QCatchSyscalls' 'catch syscall'
  15509. 'pass-signals' 'QPassSignals' 'handle SIGNAL'
  15510. 'program-signals' 'QProgramSignals' 'handle SIGNAL'
  15511. 'hostio-close-packet''vFile:close' 'remote get',
  15512. 'remote put'
  15513. 'hostio-open-packet' 'vFile:open' 'remote get',
  15514. 'remote put'
  15515. 'hostio-pread-packet''vFile:pread' 'remote get',
  15516. 'remote put'
  15517. 'hostio-pwrite-packet''vFile:pwrite' 'remote get',
  15518. 'remote put'
  15519. 'hostio-unlink-packet''vFile:unlink' 'remote delete'
  15520. 'hostio-readlink-packet''vFile:readlink' Host I/O
  15521. 'hostio-fstat-packet''vFile:fstat' Host I/O
  15522. 'hostio-setfs-packet''vFile:setfs' Host I/O
  15523. 'noack-packet' 'QStartNoAckMode' Packet
  15524. acknowledgment
  15525. 'osdata' 'qXfer:osdata:read' 'info os'
  15526. 'query-attached' 'qAttached' Querying remote
  15527. process attach
  15528. state.
  15529. 'trace-buffer-size' 'QTBuffer:size' 'set
  15530. trace-buffer-size'
  15531. 'trace-status' 'qTStatus' 'tstatus'
  15532. 'traceframe-info' 'qXfer:traceframe-info:read'Traceframe info
  15533. 'install-in-trace' 'InstallInTrace' Install
  15534. tracepoint in
  15535. tracing
  15536. 'disable-randomization''QDisableRandomization''set
  15537. disable-randomization'
  15538. 'startup-with-shell' 'QStartupWithShell' 'set
  15539. startup-with-shell'
  15540. 'environment-hex-encoded''QEnvironmentHexEncoded''set
  15541. environment'
  15542. 'environment-unset' 'QEnvironmentUnset' 'unset
  15543. environment'
  15544. 'environment-reset' 'QEnvironmentReset' 'Reset the
  15545. inferior
  15546. environment
  15547. (i.e., unset
  15548. user-set
  15549. variables)'
  15550. 'set-working-dir' 'QSetWorkingDir' 'set cwd'
  15551. 'conditional-breakpoints-packet''Z0 and Z1' 'Support for
  15552. target-side
  15553. breakpoint
  15554. condition
  15555. evaluation'
  15556. 'multiprocess-extensions''multiprocess Debug multiple
  15557. extensions' processes and
  15558. remote process
  15559. PID awareness
  15560. 'swbreak-feature' 'swbreak stop reason' 'break'
  15561. 'hwbreak-feature' 'hwbreak stop reason' 'hbreak'
  15562. 'fork-event-feature' 'fork stop reason' 'fork'
  15563. 'vfork-event-feature''vfork stop reason' 'vfork'
  15564. 'exec-event-feature' 'exec stop reason' 'exec'
  15565. 'thread-events' 'QThreadEvents' Tracking thread
  15566. lifetime.
  15567. 'no-resumed-stop-reply''no resumed thread Tracking thread
  15568. left stop reply' lifetime.
  15569. 
  15570. File: gdb.info, Node: Remote Stub, Prev: Remote Configuration, Up: Remote Debugging
  15571. 20.5 Implementing a Remote Stub
  15572. ===============================
  15573. The stub files provided with GDB implement the target side of the
  15574. communication protocol, and the GDB side is implemented in the GDB
  15575. source file 'remote.c'. Normally, you can simply allow these
  15576. subroutines to communicate, and ignore the details. (If you're
  15577. implementing your own stub file, you can still ignore the details: start
  15578. with one of the existing stub files. 'sparc-stub.c' is the best
  15579. organized, and therefore the easiest to read.)
  15580. To debug a program running on another machine (the debugging "target"
  15581. machine), you must first arrange for all the usual prerequisites for the
  15582. program to run by itself. For example, for a C program, you need:
  15583. 1. A startup routine to set up the C runtime environment; these
  15584. usually have a name like 'crt0'. The startup routine may be
  15585. supplied by your hardware supplier, or you may have to write your
  15586. own.
  15587. 2. A C subroutine library to support your program's subroutine calls,
  15588. notably managing input and output.
  15589. 3. A way of getting your program to the other machine--for example, a
  15590. download program. These are often supplied by the hardware
  15591. manufacturer, but you may have to write your own from hardware
  15592. documentation.
  15593. The next step is to arrange for your program to use a serial port to
  15594. communicate with the machine where GDB is running (the "host" machine).
  15595. In general terms, the scheme looks like this:
  15596. _On the host,_
  15597. GDB already understands how to use this protocol; when everything
  15598. else is set up, you can simply use the 'target remote' command
  15599. (*note Specifying a Debugging Target: Targets.).
  15600. _On the target,_
  15601. you must link with your program a few special-purpose subroutines
  15602. that implement the GDB remote serial protocol. The file containing
  15603. these subroutines is called a "debugging stub".
  15604. On certain remote targets, you can use an auxiliary program
  15605. 'gdbserver' instead of linking a stub into your program. *Note
  15606. Using the 'gdbserver' Program: Server, for details.
  15607. The debugging stub is specific to the architecture of the remote
  15608. machine; for example, use 'sparc-stub.c' to debug programs on SPARC
  15609. boards.
  15610. These working remote stubs are distributed with GDB:
  15611. 'i386-stub.c'
  15612. For Intel 386 and compatible architectures.
  15613. 'm68k-stub.c'
  15614. For Motorola 680x0 architectures.
  15615. 'sh-stub.c'
  15616. For Renesas SH architectures.
  15617. 'sparc-stub.c'
  15618. For SPARC architectures.
  15619. 'sparcl-stub.c'
  15620. For Fujitsu SPARCLITE architectures.
  15621. The 'README' file in the GDB distribution may list other recently
  15622. added stubs.
  15623. * Menu:
  15624. * Stub Contents:: What the stub can do for you
  15625. * Bootstrapping:: What you must do for the stub
  15626. * Debug Session:: Putting it all together
  15627. 
  15628. File: gdb.info, Node: Stub Contents, Next: Bootstrapping, Up: Remote Stub
  15629. 20.5.1 What the Stub Can Do for You
  15630. -----------------------------------
  15631. The debugging stub for your architecture supplies these three
  15632. subroutines:
  15633. 'set_debug_traps'
  15634. This routine arranges for 'handle_exception' to run when your
  15635. program stops. You must call this subroutine explicitly in your
  15636. program's startup code.
  15637. 'handle_exception'
  15638. This is the central workhorse, but your program never calls it
  15639. explicitly--the setup code arranges for 'handle_exception' to run
  15640. when a trap is triggered.
  15641. 'handle_exception' takes control when your program stops during
  15642. execution (for example, on a breakpoint), and mediates
  15643. communications with GDB on the host machine. This is where the
  15644. communications protocol is implemented; 'handle_exception' acts as
  15645. the GDB representative on the target machine. It begins by sending
  15646. summary information on the state of your program, then continues to
  15647. execute, retrieving and transmitting any information GDB needs,
  15648. until you execute a GDB command that makes your program resume; at
  15649. that point, 'handle_exception' returns control to your own code on
  15650. the target machine.
  15651. 'breakpoint'
  15652. Use this auxiliary subroutine to make your program contain a
  15653. breakpoint. Depending on the particular situation, this may be the
  15654. only way for GDB to get control. For instance, if your target
  15655. machine has some sort of interrupt button, you won't need to call
  15656. this; pressing the interrupt button transfers control to
  15657. 'handle_exception'--in effect, to GDB. On some machines, simply
  15658. receiving characters on the serial port may also trigger a trap;
  15659. again, in that situation, you don't need to call 'breakpoint' from
  15660. your own program--simply running 'target remote' from the host GDB
  15661. session gets control.
  15662. Call 'breakpoint' if none of these is true, or if you simply want
  15663. to make certain your program stops at a predetermined point for the
  15664. start of your debugging session.
  15665. 
  15666. File: gdb.info, Node: Bootstrapping, Next: Debug Session, Prev: Stub Contents, Up: Remote Stub
  15667. 20.5.2 What You Must Do for the Stub
  15668. ------------------------------------
  15669. The debugging stubs that come with GDB are set up for a particular chip
  15670. architecture, but they have no information about the rest of your
  15671. debugging target machine.
  15672. First of all you need to tell the stub how to communicate with the
  15673. serial port.
  15674. 'int getDebugChar()'
  15675. Write this subroutine to read a single character from the serial
  15676. port. It may be identical to 'getchar' for your target system; a
  15677. different name is used to allow you to distinguish the two if you
  15678. wish.
  15679. 'void putDebugChar(int)'
  15680. Write this subroutine to write a single character to the serial
  15681. port. It may be identical to 'putchar' for your target system; a
  15682. different name is used to allow you to distinguish the two if you
  15683. wish.
  15684. If you want GDB to be able to stop your program while it is running,
  15685. you need to use an interrupt-driven serial driver, and arrange for it to
  15686. stop when it receives a '^C' ('\003', the control-C character). That is
  15687. the character which GDB uses to tell the remote system to stop.
  15688. Getting the debugging target to return the proper status to GDB
  15689. probably requires changes to the standard stub; one quick and dirty way
  15690. is to just execute a breakpoint instruction (the "dirty" part is that
  15691. GDB reports a 'SIGTRAP' instead of a 'SIGINT').
  15692. Other routines you need to supply are:
  15693. 'void exceptionHandler (int EXCEPTION_NUMBER, void *EXCEPTION_ADDRESS)'
  15694. Write this function to install EXCEPTION_ADDRESS in the exception
  15695. handling tables. You need to do this because the stub does not
  15696. have any way of knowing what the exception handling tables on your
  15697. target system are like (for example, the processor's table might be
  15698. in ROM, containing entries which point to a table in RAM). The
  15699. EXCEPTION_NUMBER specifies the exception which should be changed;
  15700. its meaning is architecture-dependent (for example, different
  15701. numbers might represent divide by zero, misaligned access, etc).
  15702. When this exception occurs, control should be transferred directly
  15703. to EXCEPTION_ADDRESS, and the processor state (stack, registers,
  15704. and so on) should be just as it is when a processor exception
  15705. occurs. So if you want to use a jump instruction to reach
  15706. EXCEPTION_ADDRESS, it should be a simple jump, not a jump to
  15707. subroutine.
  15708. For the 386, EXCEPTION_ADDRESS should be installed as an interrupt
  15709. gate so that interrupts are masked while the handler runs. The
  15710. gate should be at privilege level 0 (the most privileged level).
  15711. The SPARC and 68k stubs are able to mask interrupts themselves
  15712. without help from 'exceptionHandler'.
  15713. 'void flush_i_cache()'
  15714. On SPARC and SPARCLITE only, write this subroutine to flush the
  15715. instruction cache, if any, on your target machine. If there is no
  15716. instruction cache, this subroutine may be a no-op.
  15717. On target machines that have instruction caches, GDB requires this
  15718. function to make certain that the state of your program is stable.
  15719. You must also make sure this library routine is available:
  15720. 'void *memset(void *, int, int)'
  15721. This is the standard library function 'memset' that sets an area of
  15722. memory to a known value. If you have one of the free versions of
  15723. 'libc.a', 'memset' can be found there; otherwise, you must either
  15724. obtain it from your hardware manufacturer, or write your own.
  15725. If you do not use the GNU C compiler, you may need other standard
  15726. library subroutines as well; this varies from one stub to another, but
  15727. in general the stubs are likely to use any of the common library
  15728. subroutines which 'GCC' generates as inline code.
  15729. 
  15730. File: gdb.info, Node: Debug Session, Prev: Bootstrapping, Up: Remote Stub
  15731. 20.5.3 Putting it All Together
  15732. ------------------------------
  15733. In summary, when your program is ready to debug, you must follow these
  15734. steps.
  15735. 1. Make sure you have defined the supporting low-level routines (*note
  15736. What You Must Do for the Stub: Bootstrapping.):
  15737. 'getDebugChar', 'putDebugChar',
  15738. 'flush_i_cache', 'memset', 'exceptionHandler'.
  15739. 2. Insert these lines in your program's startup code, before the main
  15740. procedure is called:
  15741. set_debug_traps();
  15742. breakpoint();
  15743. On some machines, when a breakpoint trap is raised, the hardware
  15744. automatically makes the PC point to the instruction after the
  15745. breakpoint. If your machine doesn't do that, you may need to
  15746. adjust 'handle_exception' to arrange for it to return to the
  15747. instruction after the breakpoint on this first invocation, so that
  15748. your program doesn't keep hitting the initial breakpoint instead of
  15749. making progress.
  15750. 3. For the 680x0 stub only, you need to provide a variable called
  15751. 'exceptionHook'. Normally you just use:
  15752. void (*exceptionHook)() = 0;
  15753. but if before calling 'set_debug_traps', you set it to point to a
  15754. function in your program, that function is called when 'GDB'
  15755. continues after stopping on a trap (for example, bus error). The
  15756. function indicated by 'exceptionHook' is called with one parameter:
  15757. an 'int' which is the exception number.
  15758. 4. Compile and link together: your program, the GDB debugging stub for
  15759. your target architecture, and the supporting subroutines.
  15760. 5. Make sure you have a serial connection between your target machine
  15761. and the GDB host, and identify the serial port on the host.
  15762. 6. Download your program to your target machine (or get it there by
  15763. whatever means the manufacturer provides), and start it.
  15764. 7. Start GDB on the host, and connect to the target (*note Connecting
  15765. to a Remote Target: Connecting.).
  15766. 
  15767. File: gdb.info, Node: Configurations, Next: Controlling GDB, Prev: Remote Debugging, Up: Top
  15768. 21 Configuration-Specific Information
  15769. *************************************
  15770. While nearly all GDB commands are available for all native and cross
  15771. versions of the debugger, there are some exceptions. This chapter
  15772. describes things that are only available in certain configurations.
  15773. There are three major categories of configurations: native
  15774. configurations, where the host and target are the same, embedded
  15775. operating system configurations, which are usually the same for several
  15776. different processor architectures, and bare embedded processors, which
  15777. are quite different from each other.
  15778. * Menu:
  15779. * Native::
  15780. * Embedded OS::
  15781. * Embedded Processors::
  15782. * Architectures::
  15783. 
  15784. File: gdb.info, Node: Native, Next: Embedded OS, Up: Configurations
  15785. 21.1 Native
  15786. ===========
  15787. This section describes details specific to particular native
  15788. configurations.
  15789. * Menu:
  15790. * BSD libkvm Interface:: Debugging BSD kernel memory images
  15791. * Process Information:: Process information
  15792. * DJGPP Native:: Features specific to the DJGPP port
  15793. * Cygwin Native:: Features specific to the Cygwin port
  15794. * Hurd Native:: Features specific to GNU Hurd
  15795. * Darwin:: Features specific to Darwin
  15796. * FreeBSD:: Features specific to FreeBSD
  15797. 
  15798. File: gdb.info, Node: BSD libkvm Interface, Next: Process Information, Up: Native
  15799. 21.1.1 BSD libkvm Interface
  15800. ---------------------------
  15801. BSD-derived systems (FreeBSD/NetBSD/OpenBSD) have a kernel memory
  15802. interface that provides a uniform interface for accessing kernel virtual
  15803. memory images, including live systems and crash dumps. GDB uses this
  15804. interface to allow you to debug live kernels and kernel crash dumps on
  15805. many native BSD configurations. This is implemented as a special 'kvm'
  15806. debugging target. For debugging a live system, load the currently
  15807. running kernel into GDB and connect to the 'kvm' target:
  15808. (gdb) target kvm
  15809. For debugging crash dumps, provide the file name of the crash dump as
  15810. an argument:
  15811. (gdb) target kvm /var/crash/bsd.0
  15812. Once connected to the 'kvm' target, the following commands are
  15813. available:
  15814. 'kvm pcb'
  15815. Set current context from the "Process Control Block" (PCB) address.
  15816. 'kvm proc'
  15817. Set current context from proc address. This command isn't
  15818. available on modern FreeBSD systems.
  15819. 
  15820. File: gdb.info, Node: Process Information, Next: DJGPP Native, Prev: BSD libkvm Interface, Up: Native
  15821. 21.1.2 Process Information
  15822. --------------------------
  15823. Some operating systems provide interfaces to fetch additional
  15824. information about running processes beyond memory and per-thread
  15825. register state. If GDB is configured for an operating system with a
  15826. supported interface, the command 'info proc' is available to report
  15827. information about the process running your program, or about any process
  15828. running on your system.
  15829. One supported interface is a facility called '/proc' that can be used
  15830. to examine the image of a running process using file-system subroutines.
  15831. This facility is supported on GNU/Linux and Solaris systems.
  15832. On FreeBSD and NetBSD systems, system control nodes are used to query
  15833. process information.
  15834. In addition, some systems may provide additional process information
  15835. in core files. Note that a core file may include a subset of the
  15836. information available from a live process. Process information is
  15837. currently available from cores created on GNU/Linux and FreeBSD systems.
  15838. 'info proc'
  15839. 'info proc PROCESS-ID'
  15840. Summarize available information about a process. If a process ID
  15841. is specified by PROCESS-ID, display information about that process;
  15842. otherwise display information about the program being debugged.
  15843. The summary includes the debugged process ID, the command line used
  15844. to invoke it, its current working directory, and its executable
  15845. file's absolute file name.
  15846. On some systems, PROCESS-ID can be of the form '[PID]/TID' which
  15847. specifies a certain thread ID within a process. If the optional
  15848. PID part is missing, it means a thread from the process being
  15849. debugged (the leading '/' still needs to be present, or else GDB
  15850. will interpret the number as a process ID rather than a thread ID).
  15851. 'info proc cmdline'
  15852. Show the original command line of the process. This command is
  15853. supported on GNU/Linux, FreeBSD and NetBSD.
  15854. 'info proc cwd'
  15855. Show the current working directory of the process. This command is
  15856. supported on GNU/Linux, FreeBSD and NetBSD.
  15857. 'info proc exe'
  15858. Show the name of executable of the process. This command is
  15859. supported on GNU/Linux, FreeBSD and NetBSD.
  15860. 'info proc files'
  15861. Show the file descriptors open by the process. For each open file
  15862. descriptor, GDB shows its number, type (file, directory, character
  15863. device, socket), file pointer offset, and the name of the resource
  15864. open on the descriptor. The resource name can be a file name (for
  15865. files, directories, and devices) or a protocol followed by socket
  15866. address (for network connections). This command is supported on
  15867. FreeBSD.
  15868. This example shows the open file descriptors for a process using a
  15869. tty for standard input and output as well as two network sockets:
  15870. (gdb) info proc files 22136
  15871. process 22136
  15872. Open files:
  15873. FD Type Offset Flags Name
  15874. text file - r-------- /usr/bin/ssh
  15875. ctty chr - rw------- /dev/pts/20
  15876. cwd dir - r-------- /usr/home/john
  15877. root dir - r-------- /
  15878. 0 chr 0x32933a4 rw------- /dev/pts/20
  15879. 1 chr 0x32933a4 rw------- /dev/pts/20
  15880. 2 chr 0x32933a4 rw------- /dev/pts/20
  15881. 3 socket 0x0 rw----n-- tcp4 10.0.1.2:53014 -> 10.0.1.10:22
  15882. 4 socket 0x0 rw------- unix stream:/tmp/ssh-FIt89oAzOn5f/agent.2456
  15883. 'info proc mappings'
  15884. Report the memory address space ranges accessible in a process. On
  15885. Solaris, FreeBSD and NetBSD systems, each memory range includes
  15886. information on whether the process has read, write, or execute
  15887. access rights to each range. On GNU/Linux, FreeBSD and NetBSD
  15888. systems, each memory range includes the object file which is mapped
  15889. to that range.
  15890. 'info proc stat'
  15891. 'info proc status'
  15892. Show additional process-related information, including the user ID
  15893. and group ID; virtual memory usage; the signals that are pending,
  15894. blocked, and ignored; its TTY; its consumption of system and user
  15895. time; its stack size; its 'nice' value; etc. These commands are
  15896. supported on GNU/Linux, FreeBSD and NetBSD.
  15897. For GNU/Linux systems, see the 'proc' man page for more information
  15898. (type 'man 5 proc' from your shell prompt).
  15899. For FreeBSD and NetBSD systems, 'info proc stat' is an alias for
  15900. 'info proc status'.
  15901. 'info proc all'
  15902. Show all the information about the process described under all of
  15903. the above 'info proc' subcommands.
  15904. 'set procfs-trace'
  15905. This command enables and disables tracing of 'procfs' API calls.
  15906. 'show procfs-trace'
  15907. Show the current state of 'procfs' API call tracing.
  15908. 'set procfs-file FILE'
  15909. Tell GDB to write 'procfs' API trace to the named FILE. GDB
  15910. appends the trace info to the previous contents of the file. The
  15911. default is to display the trace on the standard output.
  15912. 'show procfs-file'
  15913. Show the file to which 'procfs' API trace is written.
  15914. 'proc-trace-entry'
  15915. 'proc-trace-exit'
  15916. 'proc-untrace-entry'
  15917. 'proc-untrace-exit'
  15918. These commands enable and disable tracing of entries into and exits
  15919. from the 'syscall' interface.
  15920. 'info pidlist'
  15921. For QNX Neutrino only, this command displays the list of all the
  15922. processes and all the threads within each process.
  15923. 'info meminfo'
  15924. For QNX Neutrino only, this command displays the list of all
  15925. mapinfos.
  15926. 
  15927. File: gdb.info, Node: DJGPP Native, Next: Cygwin Native, Prev: Process Information, Up: Native
  15928. 21.1.3 Features for Debugging DJGPP Programs
  15929. --------------------------------------------
  15930. DJGPP is a port of the GNU development tools to MS-DOS and MS-Windows.
  15931. DJGPP programs are 32-bit protected-mode programs that use the "DPMI"
  15932. (DOS Protected-Mode Interface) API to run on top of real-mode DOS
  15933. systems and their emulations.
  15934. GDB supports native debugging of DJGPP programs, and defines a few
  15935. commands specific to the DJGPP port. This subsection describes those
  15936. commands.
  15937. 'info dos'
  15938. This is a prefix of DJGPP-specific commands which print information
  15939. about the target system and important OS structures.
  15940. 'info dos sysinfo'
  15941. This command displays assorted information about the underlying
  15942. platform: the CPU type and features, the OS version and flavor, the
  15943. DPMI version, and the available conventional and DPMI memory.
  15944. 'info dos gdt'
  15945. 'info dos ldt'
  15946. 'info dos idt'
  15947. These 3 commands display entries from, respectively, Global, Local,
  15948. and Interrupt Descriptor Tables (GDT, LDT, and IDT). The descriptor
  15949. tables are data structures which store a descriptor for each
  15950. segment that is currently in use. The segment's selector is an
  15951. index into a descriptor table; the table entry for that index holds
  15952. the descriptor's base address and limit, and its attributes and
  15953. access rights.
  15954. A typical DJGPP program uses 3 segments: a code segment, a data
  15955. segment (used for both data and the stack), and a DOS segment
  15956. (which allows access to DOS/BIOS data structures and absolute
  15957. addresses in conventional memory). However, the DPMI host will
  15958. usually define additional segments in order to support the DPMI
  15959. environment.
  15960. These commands allow to display entries from the descriptor tables.
  15961. Without an argument, all entries from the specified table are
  15962. displayed. An argument, which should be an integer expression,
  15963. means display a single entry whose index is given by the argument.
  15964. For example, here's a convenient way to display information about
  15965. the debugged program's data segment:
  15966. (gdb) info dos ldt $ds
  15967. 0x13f: base=0x11970000 limit=0x0009ffff 32-Bit Data (Read/Write, Exp-up)
  15968. This comes in handy when you want to see whether a pointer is
  15969. outside the data segment's limit (i.e. "garbled").
  15970. 'info dos pde'
  15971. 'info dos pte'
  15972. These two commands display entries from, respectively, the Page
  15973. Directory and the Page Tables. Page Directories and Page Tables
  15974. are data structures which control how virtual memory addresses are
  15975. mapped into physical addresses. A Page Table includes an entry for
  15976. every page of memory that is mapped into the program's address
  15977. space; there may be several Page Tables, each one holding up to
  15978. 4096 entries. A Page Directory has up to 4096 entries, one each
  15979. for every Page Table that is currently in use.
  15980. Without an argument, 'info dos pde' displays the entire Page
  15981. Directory, and 'info dos pte' displays all the entries in all of
  15982. the Page Tables. An argument, an integer expression, given to the
  15983. 'info dos pde' command means display only that entry from the Page
  15984. Directory table. An argument given to the 'info dos pte' command
  15985. means display entries from a single Page Table, the one pointed to
  15986. by the specified entry in the Page Directory.
  15987. These commands are useful when your program uses "DMA" (Direct
  15988. Memory Access), which needs physical addresses to program the DMA
  15989. controller.
  15990. These commands are supported only with some DPMI servers.
  15991. 'info dos address-pte ADDR'
  15992. This command displays the Page Table entry for a specified linear
  15993. address. The argument ADDR is a linear address which should
  15994. already have the appropriate segment's base address added to it,
  15995. because this command accepts addresses which may belong to _any_
  15996. segment. For example, here's how to display the Page Table entry
  15997. for the page where a variable 'i' is stored:
  15998. (gdb) info dos address-pte __djgpp_base_address + (char *)&i
  15999. Page Table entry for address 0x11a00d30:
  16000. Base=0x02698000 Dirty Acc. Not-Cached Write-Back Usr Read-Write +0xd30
  16001. This says that 'i' is stored at offset '0xd30' from the page whose
  16002. physical base address is '0x02698000', and shows all the attributes
  16003. of that page.
  16004. Note that you must cast the addresses of variables to a 'char *',
  16005. since otherwise the value of '__djgpp_base_address', the base
  16006. address of all variables and functions in a DJGPP program, will be
  16007. added using the rules of C pointer arithmetics: if 'i' is declared
  16008. an 'int', GDB will add 4 times the value of '__djgpp_base_address'
  16009. to the address of 'i'.
  16010. Here's another example, it displays the Page Table entry for the
  16011. transfer buffer:
  16012. (gdb) info dos address-pte *((unsigned *)&_go32_info_block + 3)
  16013. Page Table entry for address 0x29110:
  16014. Base=0x00029000 Dirty Acc. Not-Cached Write-Back Usr Read-Write +0x110
  16015. (The '+ 3' offset is because the transfer buffer's address is the
  16016. 3rd member of the '_go32_info_block' structure.) The output
  16017. clearly shows that this DPMI server maps the addresses in
  16018. conventional memory 1:1, i.e. the physical ('0x00029000' + '0x110')
  16019. and linear ('0x29110') addresses are identical.
  16020. This command is supported only with some DPMI servers.
  16021. In addition to native debugging, the DJGPP port supports remote
  16022. debugging via a serial data link. The following commands are specific
  16023. to remote serial debugging in the DJGPP port of GDB.
  16024. 'set com1base ADDR'
  16025. This command sets the base I/O port address of the 'COM1' serial
  16026. port.
  16027. 'set com1irq IRQ'
  16028. This command sets the "Interrupt Request" ('IRQ') line to use for
  16029. the 'COM1' serial port.
  16030. There are similar commands 'set com2base', 'set com3irq', etc. for
  16031. setting the port address and the 'IRQ' lines for the other 3 COM
  16032. ports.
  16033. The related commands 'show com1base', 'show com1irq' etc. display
  16034. the current settings of the base address and the 'IRQ' lines used
  16035. by the COM ports.
  16036. 'info serial'
  16037. This command prints the status of the 4 DOS serial ports. For each
  16038. port, it prints whether it's active or not, its I/O base address
  16039. and IRQ number, whether it uses a 16550-style FIFO, its baudrate,
  16040. and the counts of various errors encountered so far.
  16041. 
  16042. File: gdb.info, Node: Cygwin Native, Next: Hurd Native, Prev: DJGPP Native, Up: Native
  16043. 21.1.4 Features for Debugging MS Windows PE Executables
  16044. -------------------------------------------------------
  16045. GDB supports native debugging of MS Windows programs, including DLLs
  16046. with and without symbolic debugging information.
  16047. MS-Windows programs that call 'SetConsoleMode' to switch off the
  16048. special meaning of the 'Ctrl-C' keystroke cannot be interrupted by
  16049. typing 'C-c'. For this reason, GDB on MS-Windows supports 'C-<BREAK>'
  16050. as an alternative interrupt key sequence, which can be used to interrupt
  16051. the debuggee even if it ignores 'C-c'.
  16052. There are various additional Cygwin-specific commands, described in
  16053. this section. Working with DLLs that have no debugging symbols is
  16054. described in *note Non-debug DLL Symbols::.
  16055. 'info w32'
  16056. This is a prefix of MS Windows-specific commands which print
  16057. information about the target system and important OS structures.
  16058. 'info w32 selector'
  16059. This command displays information returned by the Win32 API
  16060. 'GetThreadSelectorEntry' function. It takes an optional argument
  16061. that is evaluated to a long value to give the information about
  16062. this given selector. Without argument, this command displays
  16063. information about the six segment registers.
  16064. 'info w32 thread-information-block'
  16065. This command displays thread specific information stored in the
  16066. Thread Information Block (readable on the X86 CPU family using
  16067. '$fs' selector for 32-bit programs and '$gs' for 64-bit programs).
  16068. 'signal-event ID'
  16069. This command signals an event with user-provided ID. Used to
  16070. resume crashing process when attached to it using MS-Windows JIT
  16071. debugging (AeDebug).
  16072. To use it, create or edit the following keys in
  16073. 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug' and/or
  16074. 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows
  16075. NT\CurrentVersion\AeDebug' (for x86_64 versions):
  16076. - 'Debugger' (REG_SZ) -- a command to launch the debugger.
  16077. Suggested command is: 'FULLY-QUALIFIED-PATH-TO-GDB.EXE -ex
  16078. "attach %ld" -ex "signal-event %ld" -ex "continue"'.
  16079. The first '%ld' will be replaced by the process ID of the
  16080. crashing process, the second '%ld' will be replaced by the ID
  16081. of the event that blocks the crashing process, waiting for GDB
  16082. to attach.
  16083. - 'Auto' (REG_SZ) -- either '1' or '0'. '1' will make the
  16084. system run debugger specified by the Debugger key
  16085. automatically, '0' will cause a dialog box with "OK" and
  16086. "Cancel" buttons to appear, which allows the user to either
  16087. terminate the crashing process (OK) or debug it (Cancel).
  16088. 'set cygwin-exceptions MODE'
  16089. If MODE is 'on', GDB will break on exceptions that happen inside
  16090. the Cygwin DLL. If MODE is 'off', GDB will delay recognition of
  16091. exceptions, and may ignore some exceptions which seem to be caused
  16092. by internal Cygwin DLL "bookkeeping". This option is meant
  16093. primarily for debugging the Cygwin DLL itself; the default value is
  16094. 'off' to avoid annoying GDB users with false 'SIGSEGV' signals.
  16095. 'show cygwin-exceptions'
  16096. Displays whether GDB will break on exceptions that happen inside
  16097. the Cygwin DLL itself.
  16098. 'set new-console MODE'
  16099. If MODE is 'on' the debuggee will be started in a new console on
  16100. next start. If MODE is 'off', the debuggee will be started in the
  16101. same console as the debugger.
  16102. 'show new-console'
  16103. Displays whether a new console is used when the debuggee is
  16104. started.
  16105. 'set new-group MODE'
  16106. This boolean value controls whether the debuggee should start a new
  16107. group or stay in the same group as the debugger. This affects the
  16108. way the Windows OS handles 'Ctrl-C'.
  16109. 'show new-group'
  16110. Displays current value of new-group boolean.
  16111. 'set debugevents'
  16112. This boolean value adds debug output concerning kernel events
  16113. related to the debuggee seen by the debugger. This includes events
  16114. that signal thread and process creation and exit, DLL loading and
  16115. unloading, console interrupts, and debugging messages produced by
  16116. the Windows 'OutputDebugString' API call.
  16117. 'set debugexec'
  16118. This boolean value adds debug output concerning execute events
  16119. (such as resume thread) seen by the debugger.
  16120. 'set debugexceptions'
  16121. This boolean value adds debug output concerning exceptions in the
  16122. debuggee seen by the debugger.
  16123. 'set debugmemory'
  16124. This boolean value adds debug output concerning debuggee memory
  16125. reads and writes by the debugger.
  16126. 'set shell'
  16127. This boolean values specifies whether the debuggee is called via a
  16128. shell or directly (default value is on).
  16129. 'show shell'
  16130. Displays if the debuggee will be started with a shell.
  16131. * Menu:
  16132. * Non-debug DLL Symbols:: Support for DLLs without debugging symbols
  16133. 
  16134. File: gdb.info, Node: Non-debug DLL Symbols, Up: Cygwin Native
  16135. 21.1.4.1 Support for DLLs without Debugging Symbols
  16136. ...................................................
  16137. Very often on windows, some of the DLLs that your program relies on do
  16138. not include symbolic debugging information (for example,
  16139. 'kernel32.dll'). When GDB doesn't recognize any debugging symbols in a
  16140. DLL, it relies on the minimal amount of symbolic information contained
  16141. in the DLL's export table. This section describes working with such
  16142. symbols, known internally to GDB as "minimal symbols".
  16143. Note that before the debugged program has started execution, no DLLs
  16144. will have been loaded. The easiest way around this problem is simply to
  16145. start the program -- either by setting a breakpoint or letting the
  16146. program run once to completion.
  16147. 21.1.4.2 DLL Name Prefixes
  16148. ..........................
  16149. In keeping with the naming conventions used by the Microsoft debugging
  16150. tools, DLL export symbols are made available with a prefix based on the
  16151. DLL name, for instance 'KERNEL32!CreateFileA'. The plain name is also
  16152. entered into the symbol table, so 'CreateFileA' is often sufficient. In
  16153. some cases there will be name clashes within a program (particularly if
  16154. the executable itself includes full debugging symbols) necessitating the
  16155. use of the fully qualified name when referring to the contents of the
  16156. DLL. Use single-quotes around the name to avoid the exclamation mark
  16157. ("!") being interpreted as a language operator.
  16158. Note that the internal name of the DLL may be all upper-case, even
  16159. though the file name of the DLL is lower-case, or vice-versa. Since
  16160. symbols within GDB are _case-sensitive_ this may cause some confusion.
  16161. If in doubt, try the 'info functions' and 'info variables' commands or
  16162. even 'maint print msymbols' (*note Symbols::). Here's an example:
  16163. (gdb) info function CreateFileA
  16164. All functions matching regular expression "CreateFileA":
  16165. Non-debugging symbols:
  16166. 0x77e885f4 CreateFileA
  16167. 0x77e885f4 KERNEL32!CreateFileA
  16168. (gdb) info function !
  16169. All functions matching regular expression "!":
  16170. Non-debugging symbols:
  16171. 0x6100114c cygwin1!__assert
  16172. 0x61004034 cygwin1!_dll_crt0@0
  16173. 0x61004240 cygwin1!dll_crt0(per_process *)
  16174. [etc...]
  16175. 21.1.4.3 Working with Minimal Symbols
  16176. .....................................
  16177. Symbols extracted from a DLL's export table do not contain very much
  16178. type information. All that GDB can do is guess whether a symbol refers
  16179. to a function or variable depending on the linker section that contains
  16180. the symbol. Also note that the actual contents of the memory contained
  16181. in a DLL are not available unless the program is running. This means
  16182. that you cannot examine the contents of a variable or disassemble a
  16183. function within a DLL without a running program.
  16184. Variables are generally treated as pointers and dereferenced
  16185. automatically. For this reason, it is often necessary to prefix a
  16186. variable name with the address-of operator ("&") and provide explicit
  16187. type information in the command. Here's an example of the type of
  16188. problem:
  16189. (gdb) print 'cygwin1!__argv'
  16190. 'cygwin1!__argv' has unknown type; cast it to its declared type
  16191. (gdb) x 'cygwin1!__argv'
  16192. 'cygwin1!__argv' has unknown type; cast it to its declared type
  16193. And two possible solutions:
  16194. (gdb) print ((char **)'cygwin1!__argv')[0]
  16195. $2 = 0x22fd98 "/cygdrive/c/mydirectory/myprogram"
  16196. (gdb) x/2x &'cygwin1!__argv'
  16197. 0x610c0aa8 <cygwin1!__argv>: 0x10021608 0x00000000
  16198. (gdb) x/x 0x10021608
  16199. 0x10021608: 0x0022fd98
  16200. (gdb) x/s 0x0022fd98
  16201. 0x22fd98: "/cygdrive/c/mydirectory/myprogram"
  16202. Setting a break point within a DLL is possible even before the
  16203. program starts execution. However, under these circumstances, GDB can't
  16204. examine the initial instructions of the function in order to skip the
  16205. function's frame set-up code. You can work around this by using "*&" to
  16206. set the breakpoint at a raw memory address:
  16207. (gdb) break *&'python22!PyOS_Readline'
  16208. Breakpoint 1 at 0x1e04eff0
  16209. The author of these extensions is not entirely convinced that setting
  16210. a break point within a shared DLL like 'kernel32.dll' is completely
  16211. safe.
  16212. 
  16213. File: gdb.info, Node: Hurd Native, Next: Darwin, Prev: Cygwin Native, Up: Native
  16214. 21.1.5 Commands Specific to GNU Hurd Systems
  16215. --------------------------------------------
  16216. This subsection describes GDB commands specific to the GNU Hurd native
  16217. debugging.
  16218. 'set signals'
  16219. 'set sigs'
  16220. This command toggles the state of inferior signal interception by
  16221. GDB. Mach exceptions, such as breakpoint traps, are not affected
  16222. by this command. 'sigs' is a shorthand alias for 'signals'.
  16223. 'show signals'
  16224. 'show sigs'
  16225. Show the current state of intercepting inferior's signals.
  16226. 'set signal-thread'
  16227. 'set sigthread'
  16228. This command tells GDB which thread is the 'libc' signal thread.
  16229. That thread is run when a signal is delivered to a running process.
  16230. 'set sigthread' is the shorthand alias of 'set signal-thread'.
  16231. 'show signal-thread'
  16232. 'show sigthread'
  16233. These two commands show which thread will run when the inferior is
  16234. delivered a signal.
  16235. 'set stopped'
  16236. This commands tells GDB that the inferior process is stopped, as
  16237. with the 'SIGSTOP' signal. The stopped process can be continued by
  16238. delivering a signal to it.
  16239. 'show stopped'
  16240. This command shows whether GDB thinks the debuggee is stopped.
  16241. 'set exceptions'
  16242. Use this command to turn off trapping of exceptions in the
  16243. inferior. When exception trapping is off, neither breakpoints nor
  16244. single-stepping will work. To restore the default, set exception
  16245. trapping on.
  16246. 'show exceptions'
  16247. Show the current state of trapping exceptions in the inferior.
  16248. 'set task pause'
  16249. This command toggles task suspension when GDB has control. Setting
  16250. it to on takes effect immediately, and the task is suspended
  16251. whenever GDB gets control. Setting it to off will take effect the
  16252. next time the inferior is continued. If this option is set to off,
  16253. you can use 'set thread default pause on' or 'set thread pause on'
  16254. (see below) to pause individual threads.
  16255. 'show task pause'
  16256. Show the current state of task suspension.
  16257. 'set task detach-suspend-count'
  16258. This command sets the suspend count the task will be left with when
  16259. GDB detaches from it.
  16260. 'show task detach-suspend-count'
  16261. Show the suspend count the task will be left with when detaching.
  16262. 'set task exception-port'
  16263. 'set task excp'
  16264. This command sets the task exception port to which GDB will forward
  16265. exceptions. The argument should be the value of the "send rights"
  16266. of the task. 'set task excp' is a shorthand alias.
  16267. 'set noninvasive'
  16268. This command switches GDB to a mode that is the least invasive as
  16269. far as interfering with the inferior is concerned. This is the
  16270. same as using 'set task pause', 'set exceptions', and 'set signals'
  16271. to values opposite to the defaults.
  16272. 'info send-rights'
  16273. 'info receive-rights'
  16274. 'info port-rights'
  16275. 'info port-sets'
  16276. 'info dead-names'
  16277. 'info ports'
  16278. 'info psets'
  16279. These commands display information about, respectively, send
  16280. rights, receive rights, port rights, port sets, and dead names of a
  16281. task. There are also shorthand aliases: 'info ports' for 'info
  16282. port-rights' and 'info psets' for 'info port-sets'.
  16283. 'set thread pause'
  16284. This command toggles current thread suspension when GDB has
  16285. control. Setting it to on takes effect immediately, and the
  16286. current thread is suspended whenever GDB gets control. Setting it
  16287. to off will take effect the next time the inferior is continued.
  16288. Normally, this command has no effect, since when GDB has control,
  16289. the whole task is suspended. However, if you used 'set task pause
  16290. off' (see above), this command comes in handy to suspend only the
  16291. current thread.
  16292. 'show thread pause'
  16293. This command shows the state of current thread suspension.
  16294. 'set thread run'
  16295. This command sets whether the current thread is allowed to run.
  16296. 'show thread run'
  16297. Show whether the current thread is allowed to run.
  16298. 'set thread detach-suspend-count'
  16299. This command sets the suspend count GDB will leave on a thread when
  16300. detaching. This number is relative to the suspend count found by
  16301. GDB when it notices the thread; use 'set thread
  16302. takeover-suspend-count' to force it to an absolute value.
  16303. 'show thread detach-suspend-count'
  16304. Show the suspend count GDB will leave on the thread when detaching.
  16305. 'set thread exception-port'
  16306. 'set thread excp'
  16307. Set the thread exception port to which to forward exceptions. This
  16308. overrides the port set by 'set task exception-port' (see above).
  16309. 'set thread excp' is the shorthand alias.
  16310. 'set thread takeover-suspend-count'
  16311. Normally, GDB's thread suspend counts are relative to the value GDB
  16312. finds when it notices each thread. This command changes the
  16313. suspend counts to be absolute instead.
  16314. 'set thread default'
  16315. 'show thread default'
  16316. Each of the above 'set thread' commands has a 'set thread default'
  16317. counterpart (e.g., 'set thread default pause', 'set thread default
  16318. exception-port', etc.). The 'thread default' variety of commands
  16319. sets the default thread properties for all threads; you can then
  16320. change the properties of individual threads with the non-default
  16321. commands.
  16322. 
  16323. File: gdb.info, Node: Darwin, Next: FreeBSD, Prev: Hurd Native, Up: Native
  16324. 21.1.6 Darwin
  16325. -------------
  16326. GDB provides the following commands specific to the Darwin target:
  16327. 'set debug darwin NUM'
  16328. When set to a non zero value, enables debugging messages specific
  16329. to the Darwin support. Higher values produce more verbose output.
  16330. 'show debug darwin'
  16331. Show the current state of Darwin messages.
  16332. 'set debug mach-o NUM'
  16333. When set to a non zero value, enables debugging messages while GDB
  16334. is reading Darwin object files. ("Mach-O" is the file format used
  16335. on Darwin for object and executable files.) Higher values produce
  16336. more verbose output. This is a command to diagnose problems
  16337. internal to GDB and should not be needed in normal usage.
  16338. 'show debug mach-o'
  16339. Show the current state of Mach-O file messages.
  16340. 'set mach-exceptions on'
  16341. 'set mach-exceptions off'
  16342. On Darwin, faults are first reported as a Mach exception and are
  16343. then mapped to a Posix signal. Use this command to turn on
  16344. trapping of Mach exceptions in the inferior. This might be
  16345. sometimes useful to better understand the cause of a fault. The
  16346. default is off.
  16347. 'show mach-exceptions'
  16348. Show the current state of exceptions trapping.
  16349. 
  16350. File: gdb.info, Node: FreeBSD, Prev: Darwin, Up: Native
  16351. 21.1.7 FreeBSD
  16352. --------------
  16353. When the ABI of a system call is changed in the FreeBSD kernel, this is
  16354. implemented by leaving a compatibility system call using the old ABI at
  16355. the existing number and allocating a new system call number for the
  16356. version using the new ABI. As a convenience, when a system call is
  16357. caught by name (*note catch syscall::), compatibility system calls are
  16358. also caught.
  16359. For example, FreeBSD 12 introduced a new variant of the 'kevent'
  16360. system call and catching the 'kevent' system call by name catches both
  16361. variants:
  16362. (gdb) catch syscall kevent
  16363. Catchpoint 1 (syscalls 'freebsd11_kevent' [363] 'kevent' [560])
  16364. (gdb)
  16365. 
  16366. File: gdb.info, Node: Embedded OS, Next: Embedded Processors, Prev: Native, Up: Configurations
  16367. 21.2 Embedded Operating Systems
  16368. ===============================
  16369. This section describes configurations involving the debugging of
  16370. embedded operating systems that are available for several different
  16371. architectures.
  16372. GDB includes the ability to debug programs running on various
  16373. real-time operating systems.
  16374. 
  16375. File: gdb.info, Node: Embedded Processors, Next: Architectures, Prev: Embedded OS, Up: Configurations
  16376. 21.3 Embedded Processors
  16377. ========================
  16378. This section goes into details specific to particular embedded
  16379. configurations.
  16380. Whenever a specific embedded processor has a simulator, GDB allows to
  16381. send an arbitrary command to the simulator.
  16382. 'sim COMMAND'
  16383. Send an arbitrary COMMAND string to the simulator. Consult the
  16384. documentation for the specific simulator in use for information
  16385. about acceptable commands.
  16386. * Menu:
  16387. * ARC:: Synopsys ARC
  16388. * ARM:: ARM
  16389. * BPF:: eBPF
  16390. * M68K:: Motorola M68K
  16391. * MicroBlaze:: Xilinx MicroBlaze
  16392. * MIPS Embedded:: MIPS Embedded
  16393. * OpenRISC 1000:: OpenRISC 1000 (or1k)
  16394. * PowerPC Embedded:: PowerPC Embedded
  16395. * AVR:: Atmel AVR
  16396. * CRIS:: CRIS
  16397. * Super-H:: Renesas Super-H
  16398. 
  16399. File: gdb.info, Node: ARC, Next: ARM, Up: Embedded Processors
  16400. 21.3.1 Synopsys ARC
  16401. -------------------
  16402. GDB provides the following ARC-specific commands:
  16403. 'set debug arc'
  16404. Control the level of ARC specific debug messages. Use 0 for no
  16405. messages (the default), 1 for debug messages, and 2 for even more
  16406. debug messages.
  16407. 'show debug arc'
  16408. Show the level of ARC specific debugging in operation.
  16409. 'maint print arc arc-instruction ADDRESS'
  16410. Print internal disassembler information about instruction at a
  16411. given address.
  16412. 
  16413. File: gdb.info, Node: ARM, Next: BPF, Prev: ARC, Up: Embedded Processors
  16414. 21.3.2 ARM
  16415. ----------
  16416. GDB provides the following ARM-specific commands:
  16417. 'set arm disassembler'
  16418. This commands selects from a list of disassembly styles. The
  16419. '"std"' style is the standard style.
  16420. 'show arm disassembler'
  16421. Show the current disassembly style.
  16422. 'set arm apcs32'
  16423. This command toggles ARM operation mode between 32-bit and 26-bit.
  16424. 'show arm apcs32'
  16425. Display the current usage of the ARM 32-bit mode.
  16426. 'set arm fpu FPUTYPE'
  16427. This command sets the ARM floating-point unit (FPU) type. The
  16428. argument FPUTYPE can be one of these:
  16429. 'auto'
  16430. Determine the FPU type by querying the OS ABI.
  16431. 'softfpa'
  16432. Software FPU, with mixed-endian doubles on little-endian ARM
  16433. processors.
  16434. 'fpa'
  16435. GCC-compiled FPA co-processor.
  16436. 'softvfp'
  16437. Software FPU with pure-endian doubles.
  16438. 'vfp'
  16439. VFP co-processor.
  16440. 'show arm fpu'
  16441. Show the current type of the FPU.
  16442. 'set arm abi'
  16443. This command forces GDB to use the specified ABI.
  16444. 'show arm abi'
  16445. Show the currently used ABI.
  16446. 'set arm fallback-mode (arm|thumb|auto)'
  16447. GDB uses the symbol table, when available, to determine whether
  16448. instructions are ARM or Thumb. This command controls GDB's default
  16449. behavior when the symbol table is not available. The default is
  16450. 'auto', which causes GDB to use the current execution mode (from
  16451. the 'T' bit in the 'CPSR' register).
  16452. 'show arm fallback-mode'
  16453. Show the current fallback instruction mode.
  16454. 'set arm force-mode (arm|thumb|auto)'
  16455. This command overrides use of the symbol table to determine whether
  16456. instructions are ARM or Thumb. The default is 'auto', which causes
  16457. GDB to use the symbol table and then the setting of 'set arm
  16458. fallback-mode'.
  16459. 'show arm force-mode'
  16460. Show the current forced instruction mode.
  16461. 'set debug arm'
  16462. Toggle whether to display ARM-specific debugging messages from the
  16463. ARM target support subsystem.
  16464. 'show debug arm'
  16465. Show whether ARM-specific debugging messages are enabled.
  16466. 'target sim [SIMARGS] ...'
  16467. The GDB ARM simulator accepts the following optional arguments.
  16468. '--swi-support=TYPE'
  16469. Tell the simulator which SWI interfaces to support. The
  16470. argument TYPE may be a comma separated list of the following
  16471. values. The default value is 'all'.
  16472. 'none'
  16473. 'demon'
  16474. 'angel'
  16475. 'redboot'
  16476. 'all'
  16477. 
  16478. File: gdb.info, Node: BPF, Next: M68K, Prev: ARM, Up: Embedded Processors
  16479. 21.3.3 BPF
  16480. ----------
  16481. 'target sim [SIMARGS] ...'
  16482. The GDB BPF simulator accepts the following optional arguments.
  16483. '--skb-data-offset=OFFSET'
  16484. Tell the simulator the offset, measured in bytes, of the
  16485. 'skb_data' field in the kernel 'struct sk_buff' structure.
  16486. This offset is used by some BPF specific-purpose load/store
  16487. instructions. Defaults to 0.
  16488. 
  16489. File: gdb.info, Node: M68K, Next: MicroBlaze, Prev: BPF, Up: Embedded Processors
  16490. 21.3.4 M68k
  16491. -----------
  16492. The Motorola m68k configuration includes ColdFire support.
  16493. 
  16494. File: gdb.info, Node: MicroBlaze, Next: MIPS Embedded, Prev: M68K, Up: Embedded Processors
  16495. 21.3.5 MicroBlaze
  16496. -----------------
  16497. The MicroBlaze is a soft-core processor supported on various Xilinx
  16498. FPGAs, such as Spartan or Virtex series. Boards with these processors
  16499. usually have JTAG ports which connect to a host system running the
  16500. Xilinx Embedded Development Kit (EDK) or Software Development Kit (SDK).
  16501. This host system is used to download the configuration bitstream to the
  16502. target FPGA. The Xilinx Microprocessor Debugger (XMD) program
  16503. communicates with the target board using the JTAG interface and presents
  16504. a 'gdbserver' interface to the board. By default 'xmd' uses port
  16505. '1234'. (While it is possible to change this default port, it requires
  16506. the use of undocumented 'xmd' commands. Contact Xilinx support if you
  16507. need to do this.)
  16508. Use these GDB commands to connect to the MicroBlaze target processor.
  16509. 'target remote :1234'
  16510. Use this command to connect to the target if you are running GDB on
  16511. the same system as 'xmd'.
  16512. 'target remote XMD-HOST:1234'
  16513. Use this command to connect to the target if it is connected to
  16514. 'xmd' running on a different system named XMD-HOST.
  16515. 'load'
  16516. Use this command to download a program to the MicroBlaze target.
  16517. 'set debug microblaze N'
  16518. Enable MicroBlaze-specific debugging messages if non-zero.
  16519. 'show debug microblaze N'
  16520. Show MicroBlaze-specific debugging level.
  16521. 
  16522. File: gdb.info, Node: MIPS Embedded, Next: OpenRISC 1000, Prev: MicroBlaze, Up: Embedded Processors
  16523. 21.3.6 MIPS Embedded
  16524. --------------------
  16525. GDB supports these special commands for MIPS targets:
  16526. 'set mipsfpu double'
  16527. 'set mipsfpu single'
  16528. 'set mipsfpu none'
  16529. 'set mipsfpu auto'
  16530. 'show mipsfpu'
  16531. If your target board does not support the MIPS floating point
  16532. coprocessor, you should use the command 'set mipsfpu none' (if you
  16533. need this, you may wish to put the command in your GDB init file).
  16534. This tells GDB how to find the return value of functions which
  16535. return floating point values. It also allows GDB to avoid saving
  16536. the floating point registers when calling functions on the board.
  16537. If you are using a floating point coprocessor with only single
  16538. precision floating point support, as on the R4650 processor, use
  16539. the command 'set mipsfpu single'. The default double precision
  16540. floating point coprocessor may be selected using 'set mipsfpu
  16541. double'.
  16542. In previous versions the only choices were double precision or no
  16543. floating point, so 'set mipsfpu on' will select double precision
  16544. and 'set mipsfpu off' will select no floating point.
  16545. As usual, you can inquire about the 'mipsfpu' variable with 'show
  16546. mipsfpu'.
  16547. 
  16548. File: gdb.info, Node: OpenRISC 1000, Next: PowerPC Embedded, Prev: MIPS Embedded, Up: Embedded Processors
  16549. 21.3.7 OpenRISC 1000
  16550. --------------------
  16551. The OpenRISC 1000 provides a free RISC instruction set architecture. It
  16552. is mainly provided as a soft-core which can run on Xilinx, Altera and
  16553. other FPGA's.
  16554. GDB for OpenRISC supports the below commands when connecting to a
  16555. target:
  16556. 'target sim'
  16557. Runs the builtin CPU simulator which can run very basic programs
  16558. but does not support most hardware functions like MMU. For more
  16559. complex use cases the user is advised to run an external target,
  16560. and connect using 'target remote'.
  16561. Example: 'target sim'
  16562. 'set debug or1k'
  16563. Toggle whether to display OpenRISC-specific debugging messages from
  16564. the OpenRISC target support subsystem.
  16565. 'show debug or1k'
  16566. Show whether OpenRISC-specific debugging messages are enabled.
  16567. 
  16568. File: gdb.info, Node: PowerPC Embedded, Next: AVR, Prev: OpenRISC 1000, Up: Embedded Processors
  16569. 21.3.8 PowerPC Embedded
  16570. -----------------------
  16571. GDB supports using the DVC (Data Value Compare) register to implement in
  16572. hardware simple hardware watchpoint conditions of the form:
  16573. (gdb) watch ADDRESS|VARIABLE \
  16574. if ADDRESS|VARIABLE == CONSTANT EXPRESSION
  16575. The DVC register will be automatically used when GDB detects such
  16576. pattern in a condition expression, and the created watchpoint uses one
  16577. debug register (either the 'exact-watchpoints' option is on and the
  16578. variable is scalar, or the variable has a length of one byte). This
  16579. feature is available in native GDB running on a Linux kernel version
  16580. 2.6.34 or newer.
  16581. When running on PowerPC embedded processors, GDB automatically uses
  16582. ranged hardware watchpoints, unless the 'exact-watchpoints' option is
  16583. on, in which case watchpoints using only one debug register are created
  16584. when watching variables of scalar types.
  16585. You can create an artificial array to watch an arbitrary memory
  16586. region using one of the following commands (*note Expressions::):
  16587. (gdb) watch *((char *) ADDRESS)@LENGTH
  16588. (gdb) watch {char[LENGTH]} ADDRESS
  16589. PowerPC embedded processors support masked watchpoints. See the
  16590. discussion about the 'mask' argument in *note Set Watchpoints::.
  16591. PowerPC embedded processors support hardware accelerated "ranged
  16592. breakpoints". A ranged breakpoint stops execution of the inferior
  16593. whenever it executes an instruction at any address within the range it
  16594. specifies. To set a ranged breakpoint in GDB, use the 'break-range'
  16595. command.
  16596. GDB provides the following PowerPC-specific commands:
  16597. 'break-range START-LOCATION, END-LOCATION'
  16598. Set a breakpoint for an address range given by START-LOCATION and
  16599. END-LOCATION, which can specify a function name, a line number, an
  16600. offset of lines from the current line or from the start location,
  16601. or an address of an instruction (see *note Specify Location::, for
  16602. a list of all the possible ways to specify a LOCATION.) The
  16603. breakpoint will stop execution of the inferior whenever it executes
  16604. an instruction at any address within the specified range,
  16605. (including START-LOCATION and END-LOCATION.)
  16606. 'set powerpc soft-float'
  16607. 'show powerpc soft-float'
  16608. Force GDB to use (or not use) a software floating point calling
  16609. convention. By default, GDB selects the calling convention based
  16610. on the selected architecture and the provided executable file.
  16611. 'set powerpc vector-abi'
  16612. 'show powerpc vector-abi'
  16613. Force GDB to use the specified calling convention for vector
  16614. arguments and return values. The valid options are 'auto';
  16615. 'generic', to avoid vector registers even if they are present;
  16616. 'altivec', to use AltiVec registers; and 'spe' to use SPE
  16617. registers. By default, GDB selects the calling convention based on
  16618. the selected architecture and the provided executable file.
  16619. 'set powerpc exact-watchpoints'
  16620. 'show powerpc exact-watchpoints'
  16621. Allow GDB to use only one debug register when watching a variable
  16622. of scalar type, thus assuming that the variable is accessed through
  16623. the address of its first byte.
  16624. 
  16625. File: gdb.info, Node: AVR, Next: CRIS, Prev: PowerPC Embedded, Up: Embedded Processors
  16626. 21.3.9 Atmel AVR
  16627. ----------------
  16628. When configured for debugging the Atmel AVR, GDB supports the following
  16629. AVR-specific commands:
  16630. 'info io_registers'
  16631. This command displays information about the AVR I/O registers. For
  16632. each register, GDB prints its number and value.
  16633. 
  16634. File: gdb.info, Node: CRIS, Next: Super-H, Prev: AVR, Up: Embedded Processors
  16635. 21.3.10 CRIS
  16636. ------------
  16637. When configured for debugging CRIS, GDB provides the following
  16638. CRIS-specific commands:
  16639. 'set cris-version VER'
  16640. Set the current CRIS version to VER, either '10' or '32'. The CRIS
  16641. version affects register names and sizes. This command is useful
  16642. in case autodetection of the CRIS version fails.
  16643. 'show cris-version'
  16644. Show the current CRIS version.
  16645. 'set cris-dwarf2-cfi'
  16646. Set the usage of DWARF-2 CFI for CRIS debugging. The default is
  16647. 'on'. Change to 'off' when using 'gcc-cris' whose version is below
  16648. 'R59'.
  16649. 'show cris-dwarf2-cfi'
  16650. Show the current state of using DWARF-2 CFI.
  16651. 'set cris-mode MODE'
  16652. Set the current CRIS mode to MODE. It should only be changed when
  16653. debugging in guru mode, in which case it should be set to 'guru'
  16654. (the default is 'normal').
  16655. 'show cris-mode'
  16656. Show the current CRIS mode.
  16657. 
  16658. File: gdb.info, Node: Super-H, Prev: CRIS, Up: Embedded Processors
  16659. 21.3.11 Renesas Super-H
  16660. -----------------------
  16661. For the Renesas Super-H processor, GDB provides these commands:
  16662. 'set sh calling-convention CONVENTION'
  16663. Set the calling-convention used when calling functions from GDB.
  16664. Allowed values are 'gcc', which is the default setting, and
  16665. 'renesas'. With the 'gcc' setting, functions are called using the
  16666. GCC calling convention. If the DWARF-2 information of the called
  16667. function specifies that the function follows the Renesas calling
  16668. convention, the function is called using the Renesas calling
  16669. convention. If the calling convention is set to 'renesas', the
  16670. Renesas calling convention is always used, regardless of the
  16671. DWARF-2 information. This can be used to override the default of
  16672. 'gcc' if debug information is missing, or the compiler does not
  16673. emit the DWARF-2 calling convention entry for a function.
  16674. 'show sh calling-convention'
  16675. Show the current calling convention setting.
  16676. 
  16677. File: gdb.info, Node: Architectures, Prev: Embedded Processors, Up: Configurations
  16678. 21.4 Architectures
  16679. ==================
  16680. This section describes characteristics of architectures that affect all
  16681. uses of GDB with the architecture, both native and cross.
  16682. * Menu:
  16683. * AArch64::
  16684. * i386::
  16685. * Alpha::
  16686. * MIPS::
  16687. * HPPA:: HP PA architecture
  16688. * PowerPC::
  16689. * Nios II::
  16690. * Sparc64::
  16691. * S12Z::
  16692. 
  16693. File: gdb.info, Node: AArch64, Next: i386, Up: Architectures
  16694. 21.4.1 AArch64
  16695. --------------
  16696. When GDB is debugging the AArch64 architecture, it provides the
  16697. following special commands:
  16698. 'set debug aarch64'
  16699. This command determines whether AArch64 architecture-specific
  16700. debugging messages are to be displayed.
  16701. 'show debug aarch64'
  16702. Show whether AArch64 debugging messages are displayed.
  16703. 21.4.1.1 AArch64 SVE.
  16704. .....................
  16705. When GDB is debugging the AArch64 architecture, if the Scalable Vector
  16706. Extension (SVE) is present, then GDB will provide the vector registers
  16707. '$z0' through '$z31', vector predicate registers '$p0' through '$p15',
  16708. and the '$ffr' register. In addition, the pseudo register '$vg' will be
  16709. provided. This is the vector granule for the current thread and
  16710. represents the number of 64-bit chunks in an SVE 'z' register.
  16711. If the vector length changes, then the '$vg' register will be
  16712. updated, but the lengths of the 'z' and 'p' registers will not change.
  16713. This is a known limitation of GDB and does not affect the execution of
  16714. the target process.
  16715. 21.4.1.2 AArch64 Pointer Authentication.
  16716. ........................................
  16717. When GDB is debugging the AArch64 architecture, and the program is using
  16718. the v8.3-A feature Pointer Authentication (PAC), then whenever the link
  16719. register '$lr' is pointing to an PAC function its value will be masked.
  16720. When GDB prints a backtrace, any addresses that required unmasking will
  16721. be postfixed with the marker [PAC]. When using the MI, this is printed
  16722. as part of the 'addr_flags' field.
  16723. 
  16724. File: gdb.info, Node: i386, Next: Alpha, Prev: AArch64, Up: Architectures
  16725. 21.4.2 x86 Architecture-specific Issues
  16726. ---------------------------------------
  16727. 'set struct-convention MODE'
  16728. Set the convention used by the inferior to return 'struct's and
  16729. 'union's from functions to MODE. Possible values of MODE are
  16730. '"pcc"', '"reg"', and '"default"' (the default). '"default"' or
  16731. '"pcc"' means that 'struct's are returned on the stack, while
  16732. '"reg"' means that a 'struct' or a 'union' whose size is 1, 2, 4,
  16733. or 8 bytes will be returned in a register.
  16734. 'show struct-convention'
  16735. Show the current setting of the convention to return 'struct's from
  16736. functions.
  16737. 21.4.2.1 Intel "Memory Protection Extensions" (MPX).
  16738. ....................................................
  16739. Memory Protection Extension (MPX) adds the bound registers 'BND0' (1)
  16740. through 'BND3'. Bound registers store a pair of 64-bit values which are
  16741. the lower bound and upper bound. Bounds are effective addresses or
  16742. memory locations. The upper bounds are architecturally represented in
  16743. 1's complement form. A bound having lower bound = 0, and upper bound =
  16744. 0 (1's complement of all bits set) will allow access to the entire
  16745. address space.
  16746. 'BND0' through 'BND3' are represented in GDB as 'bnd0raw' through
  16747. 'bnd3raw'. Pseudo registers 'bnd0' through 'bnd3' display the upper
  16748. bound performing the complement of one operation on the upper bound
  16749. value, i.e. when upper bound in 'bnd0raw' is 0 in the GDB 'bnd0' it will
  16750. be '0xfff...'. In this sense it can also be noted that the upper bounds
  16751. are inclusive.
  16752. As an example, assume that the register BND0 holds bounds for a
  16753. pointer having access allowed for the range between 0x32 and 0x71. The
  16754. values present on bnd0raw and bnd registers are presented as follows:
  16755. bnd0raw = {0x32, 0xffffffff8e}
  16756. bnd0 = {lbound = 0x32, ubound = 0x71} : size 64
  16757. This way the raw value can be accessed via bnd0raw...bnd3raw. Any
  16758. change on bnd0...bnd3 or bnd0raw...bnd3raw is reflect on its
  16759. counterpart. When the bnd0...bnd3 registers are displayed via Python,
  16760. the display includes the memory size, in bits, accessible to the
  16761. pointer.
  16762. Bounds can also be stored in bounds tables, which are stored in
  16763. application memory. These tables store bounds for pointers by
  16764. specifying the bounds pointer's value along with its bounds. Evaluating
  16765. and changing bounds located in bound tables is therefore interesting
  16766. while investigating bugs on MPX context. GDB provides commands for this
  16767. purpose:
  16768. 'show mpx bound POINTER'
  16769. Display bounds of the given POINTER.
  16770. 'set mpx bound POINTER, LBOUND, UBOUND'
  16771. Set the bounds of a pointer in the bound table. This command takes
  16772. three parameters: POINTER is the pointers whose bounds are to be
  16773. changed, LBOUND and UBOUND are new values for lower and upper
  16774. bounds respectively.
  16775. When you call an inferior function on an Intel MPX enabled program,
  16776. GDB sets the inferior's bound registers to the init (disabled) state
  16777. before calling the function. As a consequence, bounds checks for the
  16778. pointer arguments passed to the function will always pass.
  16779. This is necessary because when you call an inferior function, the
  16780. program is usually in the middle of the execution of other function.
  16781. Since at that point bound registers are in an arbitrary state, not
  16782. clearing them would lead to random bound violations in the called
  16783. function.
  16784. You can still examine the influence of the bound registers on the
  16785. execution of the called function by stopping the execution of the called
  16786. function at its prologue, setting bound registers, and continuing the
  16787. execution. For example:
  16788. $ break *upper
  16789. Breakpoint 2 at 0x4009de: file i386-mpx-call.c, line 47.
  16790. $ print upper (a, b, c, d, 1)
  16791. Breakpoint 2, upper (a=0x0, b=0x6e0000005b, c=0x0, d=0x0, len=48)....
  16792. $ print $bnd0
  16793. {lbound = 0x0, ubound = ffffffff} : size -1
  16794. At this last step the value of bnd0 can be changed for investigation
  16795. of bound violations caused along the execution of the call. In order to
  16796. know how to set the bound registers or bound table for the call consult
  16797. the ABI.
  16798. ---------- Footnotes ----------
  16799. (1) The register named with capital letters represent the
  16800. architecture registers.
  16801. 
  16802. File: gdb.info, Node: Alpha, Next: MIPS, Prev: i386, Up: Architectures
  16803. 21.4.3 Alpha
  16804. ------------
  16805. See the following section.
  16806. 
  16807. File: gdb.info, Node: MIPS, Next: HPPA, Prev: Alpha, Up: Architectures
  16808. 21.4.4 MIPS
  16809. -----------
  16810. Alpha- and MIPS-based computers use an unusual stack frame, which
  16811. sometimes requires GDB to search backward in the object code to find the
  16812. beginning of a function.
  16813. To improve response time (especially for embedded applications, where
  16814. GDB may be restricted to a slow serial line for this search) you may
  16815. want to limit the size of this search, using one of these commands:
  16816. 'set heuristic-fence-post LIMIT'
  16817. Restrict GDB to examining at most LIMIT bytes in its search for the
  16818. beginning of a function. A value of 0 (the default) means there is
  16819. no limit. However, except for 0, the larger the limit the more
  16820. bytes 'heuristic-fence-post' must search and therefore the longer
  16821. it takes to run. You should only need to use this command when
  16822. debugging a stripped executable.
  16823. 'show heuristic-fence-post'
  16824. Display the current limit.
  16825. These commands are available _only_ when GDB is configured for debugging
  16826. programs on Alpha or MIPS processors.
  16827. Several MIPS-specific commands are available when debugging MIPS
  16828. programs:
  16829. 'set mips abi ARG'
  16830. Tell GDB which MIPS ABI is used by the inferior. Possible values
  16831. of ARG are:
  16832. 'auto'
  16833. The default ABI associated with the current binary (this is
  16834. the default).
  16835. 'o32'
  16836. 'o64'
  16837. 'n32'
  16838. 'n64'
  16839. 'eabi32'
  16840. 'eabi64'
  16841. 'show mips abi'
  16842. Show the MIPS ABI used by GDB to debug the inferior.
  16843. 'set mips compression ARG'
  16844. Tell GDB which MIPS compressed ISA (Instruction Set Architecture)
  16845. encoding is used by the inferior. GDB uses this for code
  16846. disassembly and other internal interpretation purposes. This
  16847. setting is only referred to when no executable has been associated
  16848. with the debugging session or the executable does not provide
  16849. information about the encoding it uses. Otherwise this setting is
  16850. automatically updated from information provided by the executable.
  16851. Possible values of ARG are 'mips16' and 'micromips'. The default
  16852. compressed ISA encoding is 'mips16', as executables containing
  16853. MIPS16 code frequently are not identified as such.
  16854. This setting is "sticky"; that is, it retains its value across
  16855. debugging sessions until reset either explicitly with this command
  16856. or implicitly from an executable.
  16857. The compiler and/or assembler typically add symbol table
  16858. annotations to identify functions compiled for the MIPS16 or
  16859. microMIPS ISAs. If these function-scope annotations are present,
  16860. GDB uses them in preference to the global compressed ISA encoding
  16861. setting.
  16862. 'show mips compression'
  16863. Show the MIPS compressed ISA encoding used by GDB to debug the
  16864. inferior.
  16865. 'set mipsfpu'
  16866. 'show mipsfpu'
  16867. *Note set mipsfpu: MIPS Embedded.
  16868. 'set mips mask-address ARG'
  16869. This command determines whether the most-significant 32 bits of
  16870. 64-bit MIPS addresses are masked off. The argument ARG can be
  16871. 'on', 'off', or 'auto'. The latter is the default setting, which
  16872. lets GDB determine the correct value.
  16873. 'show mips mask-address'
  16874. Show whether the upper 32 bits of MIPS addresses are masked off or
  16875. not.
  16876. 'set remote-mips64-transfers-32bit-regs'
  16877. This command controls compatibility with 64-bit MIPS targets that
  16878. transfer data in 32-bit quantities. If you have an old MIPS 64
  16879. target that transfers 32 bits for some registers, like SR and FSR,
  16880. and 64 bits for other registers, set this option to 'on'.
  16881. 'show remote-mips64-transfers-32bit-regs'
  16882. Show the current setting of compatibility with older MIPS 64
  16883. targets.
  16884. 'set debug mips'
  16885. This command turns on and off debugging messages for the
  16886. MIPS-specific target code in GDB.
  16887. 'show debug mips'
  16888. Show the current setting of MIPS debugging messages.
  16889. 
  16890. File: gdb.info, Node: HPPA, Next: PowerPC, Prev: MIPS, Up: Architectures
  16891. 21.4.5 HPPA
  16892. -----------
  16893. When GDB is debugging the HP PA architecture, it provides the following
  16894. special commands:
  16895. 'set debug hppa'
  16896. This command determines whether HPPA architecture-specific
  16897. debugging messages are to be displayed.
  16898. 'show debug hppa'
  16899. Show whether HPPA debugging messages are displayed.
  16900. 'maint print unwind ADDRESS'
  16901. This command displays the contents of the unwind table entry at the
  16902. given ADDRESS.
  16903. 
  16904. File: gdb.info, Node: PowerPC, Next: Nios II, Prev: HPPA, Up: Architectures
  16905. 21.4.6 PowerPC
  16906. --------------
  16907. When GDB is debugging the PowerPC architecture, it provides a set of
  16908. pseudo-registers to enable inspection of 128-bit wide Decimal Floating
  16909. Point numbers stored in the floating point registers. These values must
  16910. be stored in two consecutive registers, always starting at an even
  16911. register like 'f0' or 'f2'.
  16912. The pseudo-registers go from '$dl0' through '$dl15', and are formed
  16913. by joining the even/odd register pairs 'f0' and 'f1' for '$dl0', 'f2'
  16914. and 'f3' for '$dl1' and so on.
  16915. For POWER7 processors, GDB provides a set of pseudo-registers, the
  16916. 64-bit wide Extended Floating Point Registers ('f32' through 'f63').
  16917. 
  16918. File: gdb.info, Node: Nios II, Next: Sparc64, Prev: PowerPC, Up: Architectures
  16919. 21.4.7 Nios II
  16920. --------------
  16921. When GDB is debugging the Nios II architecture, it provides the
  16922. following special commands:
  16923. 'set debug nios2'
  16924. This command turns on and off debugging messages for the Nios II
  16925. target code in GDB.
  16926. 'show debug nios2'
  16927. Show the current setting of Nios II debugging messages.
  16928. 
  16929. File: gdb.info, Node: Sparc64, Next: S12Z, Prev: Nios II, Up: Architectures
  16930. 21.4.8 Sparc64
  16931. --------------
  16932. 21.4.8.1 ADI Support
  16933. ....................
  16934. The M7 processor supports an Application Data Integrity (ADI) feature
  16935. that detects invalid data accesses. When software allocates memory and
  16936. enables ADI on the allocated memory, it chooses a 4-bit version number,
  16937. sets the version in the upper 4 bits of the 64-bit pointer to that data,
  16938. and stores the 4-bit version in every cacheline of that data. Hardware
  16939. saves the latter in spare bits in the cache and memory hierarchy. On
  16940. each load and store, the processor compares the upper 4 VA (virtual
  16941. address) bits to the cacheline's version. If there is a mismatch, the
  16942. processor generates a version mismatch trap which can be either precise
  16943. or disrupting. The trap is an error condition which the kernel delivers
  16944. to the process as a SIGSEGV signal.
  16945. Note that only 64-bit applications can use ADI and need to be built
  16946. with ADI-enabled.
  16947. Values of the ADI version tags, which are in granularity of a
  16948. cacheline (64 bytes), can be viewed or modified.
  16949. 'adi (examine | x) [ / N ] ADDR'
  16950. The 'adi examine' command displays the value of one ADI version tag
  16951. per cacheline.
  16952. N is a decimal integer specifying the number in bytes; the default
  16953. is 1. It specifies how much ADI version information, at the ratio
  16954. of 1:ADI block size, to display.
  16955. ADDR is the address in user address space where you want GDB to
  16956. begin displaying the ADI version tags.
  16957. Below is an example of displaying ADI versions of variable
  16958. "shmaddr".
  16959. (gdb) adi x/100 shmaddr
  16960. 0xfff800010002c000: 0 0
  16961. 'adi (assign | a) [ / N ] ADDR = TAG'
  16962. The 'adi assign' command is used to assign new ADI version tag to
  16963. an address.
  16964. N is a decimal integer specifying the number in bytes; the default
  16965. is 1. It specifies how much ADI version information, at the ratio
  16966. of 1:ADI block size, to modify.
  16967. ADDR is the address in user address space where you want GDB to
  16968. begin modifying the ADI version tags.
  16969. TAG is the new ADI version tag.
  16970. For example, do the following to modify then verify ADI versions of
  16971. variable "shmaddr":
  16972. (gdb) adi a/100 shmaddr = 7
  16973. (gdb) adi x/100 shmaddr
  16974. 0xfff800010002c000: 7 7
  16975. 
  16976. File: gdb.info, Node: S12Z, Prev: Sparc64, Up: Architectures
  16977. 21.4.9 S12Z
  16978. -----------
  16979. When GDB is debugging the S12Z architecture, it provides the following
  16980. special command:
  16981. 'maint info bdccsr'
  16982. This command displays the current value of the microprocessor's
  16983. BDCCSR register.
  16984. 
  16985. File: gdb.info, Node: Controlling GDB, Next: Extending GDB, Prev: Configurations, Up: Top
  16986. 22 Controlling GDB
  16987. ******************
  16988. You can alter the way GDB interacts with you by using the 'set' command.
  16989. For commands controlling how GDB displays data, see *note Print
  16990. Settings: Print Settings. Other settings are described here.
  16991. * Menu:
  16992. * Prompt:: Prompt
  16993. * Editing:: Command editing
  16994. * Command History:: Command history
  16995. * Screen Size:: Screen size
  16996. * Output Styling:: Output styling
  16997. * Numbers:: Numbers
  16998. * ABI:: Configuring the current ABI
  16999. * Auto-loading:: Automatically loading associated files
  17000. * Messages/Warnings:: Optional warnings and messages
  17001. * Debugging Output:: Optional messages about internal happenings
  17002. * Other Misc Settings:: Other Miscellaneous Settings
  17003. 
  17004. File: gdb.info, Node: Prompt, Next: Editing, Up: Controlling GDB
  17005. 22.1 Prompt
  17006. ===========
  17007. GDB indicates its readiness to read a command by printing a string
  17008. called the "prompt". This string is normally '(gdb)'. You can change
  17009. the prompt string with the 'set prompt' command. For instance, when
  17010. debugging GDB with GDB, it is useful to change the prompt in one of the
  17011. GDB sessions so that you can always tell which one you are talking to.
  17012. _Note:_ 'set prompt' does not add a space for you after the prompt
  17013. you set. This allows you to set a prompt which ends in a space or a
  17014. prompt that does not.
  17015. 'set prompt NEWPROMPT'
  17016. Directs GDB to use NEWPROMPT as its prompt string henceforth.
  17017. 'show prompt'
  17018. Prints a line of the form: 'Gdb's prompt is: YOUR-PROMPT'
  17019. Versions of GDB that ship with Python scripting enabled have prompt
  17020. extensions. The commands for interacting with these extensions are:
  17021. 'set extended-prompt PROMPT'
  17022. Set an extended prompt that allows for substitutions. *Note
  17023. gdb.prompt::, for a list of escape sequences that can be used for
  17024. substitution. Any escape sequences specified as part of the prompt
  17025. string are replaced with the corresponding strings each time the
  17026. prompt is displayed.
  17027. For example:
  17028. set extended-prompt Current working directory: \w (gdb)
  17029. Note that when an extended-prompt is set, it takes control of the
  17030. PROMPT_HOOK hook. *Note prompt_hook::, for further information.
  17031. 'show extended-prompt'
  17032. Prints the extended prompt. Any escape sequences specified as part
  17033. of the prompt string with 'set extended-prompt', are replaced with
  17034. the corresponding strings each time the prompt is displayed.
  17035. 
  17036. File: gdb.info, Node: Editing, Next: Command History, Prev: Prompt, Up: Controlling GDB
  17037. 22.2 Command Editing
  17038. ====================
  17039. GDB reads its input commands via the "Readline" interface. This GNU
  17040. library provides consistent behavior for programs which provide a
  17041. command line interface to the user. Advantages are GNU Emacs-style or
  17042. "vi"-style inline editing of commands, 'csh'-like history substitution,
  17043. and a storage and recall of command history across debugging sessions.
  17044. You may control the behavior of command line editing in GDB with the
  17045. command 'set'.
  17046. 'set editing'
  17047. 'set editing on'
  17048. Enable command line editing (enabled by default).
  17049. 'set editing off'
  17050. Disable command line editing.
  17051. 'show editing'
  17052. Show whether command line editing is enabled.
  17053. *Note Command Line Editing::, for more details about the Readline
  17054. interface. Users unfamiliar with GNU Emacs or 'vi' are encouraged to
  17055. read that chapter.
  17056. GDB sets the Readline application name to 'gdb'. This is useful for
  17057. conditions in '.inputrc'.
  17058. GDB defines a bindable Readline command, 'operate-and-get-next'.
  17059. This is bound to 'C-o' by default. This command accepts the current
  17060. line for execution and fetches the next line relative to the current
  17061. line from the history for editing. Any argument is ignored.
  17062. 
  17063. File: gdb.info, Node: Command History, Next: Screen Size, Prev: Editing, Up: Controlling GDB
  17064. 22.3 Command History
  17065. ====================
  17066. GDB can keep track of the commands you type during your debugging
  17067. sessions, so that you can be certain of precisely what happened. Use
  17068. these commands to manage the GDB command history facility.
  17069. GDB uses the GNU History library, a part of the Readline package, to
  17070. provide the history facility. *Note Using History Interactively::, for
  17071. the detailed description of the History library.
  17072. To issue a command to GDB without affecting certain aspects of the
  17073. state which is seen by users, prefix it with 'server ' (*note Server
  17074. Prefix::). This means that this command will not affect the command
  17075. history, nor will it affect GDB's notion of which command to repeat if
  17076. <RET> is pressed on a line by itself.
  17077. The server prefix does not affect the recording of values into the
  17078. value history; to print a value without recording it into the value
  17079. history, use the 'output' command instead of the 'print' command.
  17080. Here is the description of GDB commands related to command history.
  17081. 'set history filename [FNAME]'
  17082. Set the name of the GDB command history file to FNAME. This is the
  17083. file where GDB reads an initial command history list, and where it
  17084. writes the command history from this session when it exits. You
  17085. can access this list through history expansion or through the
  17086. history command editing characters listed below. This file
  17087. defaults to the value of the environment variable 'GDBHISTFILE', or
  17088. to './.gdb_history' ('./_gdb_history' on MS-DOS) if this variable
  17089. is not set.
  17090. The 'GDBHISTFILE' environment variable is read after processing any
  17091. GDB initialization files (*note Startup::) and after processing any
  17092. commands passed using command line options (for example, '-ex').
  17093. If the FNAME argument is not given, or if the 'GDBHISTFILE' is the
  17094. empty string then GDB will neither try to load an existing history
  17095. file, nor will it try to save the history on exit.
  17096. 'set history save'
  17097. 'set history save on'
  17098. Record command history in a file, whose name may be specified with
  17099. the 'set history filename' command. By default, this option is
  17100. disabled. The command history will be recorded when GDB exits. If
  17101. 'set history filename' is set to the empty string then history
  17102. saving is disabled, even when 'set history save' is 'on'.
  17103. 'set history save off'
  17104. Don't record the command history into the file specified by 'set
  17105. history filename' when GDB exits.
  17106. 'set history size SIZE'
  17107. 'set history size unlimited'
  17108. Set the number of commands which GDB keeps in its history list.
  17109. This defaults to the value of the environment variable
  17110. 'GDBHISTSIZE', or to 256 if this variable is not set. Non-numeric
  17111. values of 'GDBHISTSIZE' are ignored. If SIZE is 'unlimited' or if
  17112. 'GDBHISTSIZE' is either a negative number or the empty string, then
  17113. the number of commands GDB keeps in the history list is unlimited.
  17114. The 'GDBHISTSIZE' environment variable is read after processing any
  17115. GDB initialization files (*note Startup::) and after processing any
  17116. commands passed using command line options (for example, '-ex').
  17117. 'set history remove-duplicates COUNT'
  17118. 'set history remove-duplicates unlimited'
  17119. Control the removal of duplicate history entries in the command
  17120. history list. If COUNT is non-zero, GDB will look back at the last
  17121. COUNT history entries and remove the first entry that is a
  17122. duplicate of the current entry being added to the command history
  17123. list. If COUNT is 'unlimited' then this lookbehind is unbounded.
  17124. If COUNT is 0, then removal of duplicate history entries is
  17125. disabled.
  17126. Only history entries added during the current session are
  17127. considered for removal. This option is set to 0 by default.
  17128. History expansion assigns special meaning to the character '!'.
  17129. *Note Event Designators::, for more details.
  17130. Since '!' is also the logical not operator in C, history expansion is
  17131. off by default. If you decide to enable history expansion with the 'set
  17132. history expansion on' command, you may sometimes need to follow '!'
  17133. (when it is used as logical not, in an expression) with a space or a tab
  17134. to prevent it from being expanded. The readline history facilities do
  17135. not attempt substitution on the strings '!=' and '!(', even when history
  17136. expansion is enabled.
  17137. The commands to control history expansion are:
  17138. 'set history expansion on'
  17139. 'set history expansion'
  17140. Enable history expansion. History expansion is off by default.
  17141. 'set history expansion off'
  17142. Disable history expansion.
  17143. 'show history'
  17144. 'show history filename'
  17145. 'show history save'
  17146. 'show history size'
  17147. 'show history expansion'
  17148. These commands display the state of the GDB history parameters.
  17149. 'show history' by itself displays all four states.
  17150. 'show commands'
  17151. Display the last ten commands in the command history.
  17152. 'show commands N'
  17153. Print ten commands centered on command number N.
  17154. 'show commands +'
  17155. Print ten commands just after the commands last printed.
  17156. 
  17157. File: gdb.info, Node: Screen Size, Next: Output Styling, Prev: Command History, Up: Controlling GDB
  17158. 22.4 Screen Size
  17159. ================
  17160. Certain commands to GDB may produce large amounts of information output
  17161. to the screen. To help you read all of it, GDB pauses and asks you for
  17162. input at the end of each page of output. Type <RET> when you want to
  17163. see one more page of output, 'q' to discard the remaining output, or 'c'
  17164. to continue without paging for the rest of the current command. Also,
  17165. the screen width setting determines when to wrap lines of output.
  17166. Depending on what is being printed, GDB tries to break the line at a
  17167. readable place, rather than simply letting it overflow onto the
  17168. following line.
  17169. Normally GDB knows the size of the screen from the terminal driver
  17170. software. For example, on Unix GDB uses the termcap data base together
  17171. with the value of the 'TERM' environment variable and the 'stty rows'
  17172. and 'stty cols' settings. If this is not correct, you can override it
  17173. with the 'set height' and 'set width' commands:
  17174. 'set height LPP'
  17175. 'set height unlimited'
  17176. 'show height'
  17177. 'set width CPL'
  17178. 'set width unlimited'
  17179. 'show width'
  17180. These 'set' commands specify a screen height of LPP lines and a
  17181. screen width of CPL characters. The associated 'show' commands
  17182. display the current settings.
  17183. If you specify a height of either 'unlimited' or zero lines, GDB
  17184. does not pause during output no matter how long the output is.
  17185. This is useful if output is to a file or to an editor buffer.
  17186. Likewise, you can specify 'set width unlimited' or 'set width 0' to
  17187. prevent GDB from wrapping its output.
  17188. 'set pagination on'
  17189. 'set pagination off'
  17190. Turn the output pagination on or off; the default is on. Turning
  17191. pagination off is the alternative to 'set height unlimited'. Note
  17192. that running GDB with the '--batch' option (*note -batch: Mode
  17193. Options.) also automatically disables pagination.
  17194. 'show pagination'
  17195. Show the current pagination mode.
  17196. 
  17197. File: gdb.info, Node: Output Styling, Next: Numbers, Prev: Screen Size, Up: Controlling GDB
  17198. 22.5 Output Styling
  17199. ===================
  17200. GDB can style its output on a capable terminal. This is enabled by
  17201. default on most systems, but disabled by default when in batch mode
  17202. (*note Mode Options::). Various style settings are available; and
  17203. styles can also be disabled entirely.
  17204. 'set style enabled 'on|off''
  17205. Enable or disable all styling. The default is host-dependent, with
  17206. most hosts defaulting to 'on'.
  17207. 'show style enabled'
  17208. Show the current state of styling.
  17209. 'set style sources 'on|off''
  17210. Enable or disable source code styling. This affects whether source
  17211. code, such as the output of the 'list' command, is styled. Note
  17212. that source styling only works if styling in general is enabled,
  17213. and if GDB was linked with the GNU Source Highlight library. The
  17214. default is 'on'.
  17215. 'show style sources'
  17216. Show the current state of source code styling.
  17217. Subcommands of 'set style' control specific forms of styling. These
  17218. subcommands all follow the same pattern: each style-able object can be
  17219. styled with a foreground color, a background color, and an intensity.
  17220. For example, the style of file names can be controlled using the 'set
  17221. style filename' group of commands:
  17222. 'set style filename background COLOR'
  17223. Set the background to COLOR. Valid colors are 'none' (meaning the
  17224. terminal's default color), 'black', 'red', 'green', 'yellow',
  17225. 'blue', 'magenta', 'cyan', and'white'.
  17226. 'set style filename foreground COLOR'
  17227. Set the foreground to COLOR. Valid colors are 'none' (meaning the
  17228. terminal's default color), 'black', 'red', 'green', 'yellow',
  17229. 'blue', 'magenta', 'cyan', and'white'.
  17230. 'set style filename intensity VALUE'
  17231. Set the intensity to VALUE. Valid intensities are 'normal' (the
  17232. default), 'bold', and 'dim'.
  17233. The 'show style' command and its subcommands are styling a style name
  17234. in their output using its own style. So, use 'show style' to see the
  17235. complete list of styles, their characteristics and the visual aspect of
  17236. each style.
  17237. The style-able objects are:
  17238. 'filename'
  17239. Control the styling of file names. By default, this style's
  17240. foreground color is green.
  17241. 'function'
  17242. Control the styling of function names. These are managed with the
  17243. 'set style function' family of commands. By default, this style's
  17244. foreground color is yellow.
  17245. 'variable'
  17246. Control the styling of variable names. These are managed with the
  17247. 'set style variable' family of commands. By default, this style's
  17248. foreground color is cyan.
  17249. 'address'
  17250. Control the styling of addresses. These are managed with the 'set
  17251. style address' family of commands. By default, this style's
  17252. foreground color is blue.
  17253. 'title'
  17254. Control the styling of titles. These are managed with the 'set
  17255. style title' family of commands. By default, this style's
  17256. intensity is bold. Commands are using the title style to improve
  17257. the readability of large output. For example, the commands
  17258. 'apropos' and 'help' are using the title style for the command
  17259. names.
  17260. 'highlight'
  17261. Control the styling of highlightings. These are managed with the
  17262. 'set style highlight' family of commands. By default, this style's
  17263. foreground color is red. Commands are using the highlight style to
  17264. draw the user attention to some specific parts of their output.
  17265. For example, the command 'apropos -v REGEXP' uses the highlight
  17266. style to mark the documentation parts matching REGEXP.
  17267. 'tui-border'
  17268. Control the styling of the TUI border. Note that, unlike other
  17269. styling options, only the color of the border can be controlled via
  17270. 'set style'. This was done for compatibility reasons, as TUI
  17271. controls to set the border's intensity predated the addition of
  17272. general styling to GDB. *Note TUI Configuration::.
  17273. 'tui-active-border'
  17274. Control the styling of the active TUI border; that is, the TUI
  17275. window that has the focus.
  17276. 
  17277. File: gdb.info, Node: Numbers, Next: ABI, Prev: Output Styling, Up: Controlling GDB
  17278. 22.6 Numbers
  17279. ============
  17280. You can always enter numbers in octal, decimal, or hexadecimal in GDB by
  17281. the usual conventions: octal numbers begin with '0', decimal numbers end
  17282. with '.', and hexadecimal numbers begin with '0x'. Numbers that neither
  17283. begin with '0' or '0x', nor end with a '.' are, by default, entered in
  17284. base 10; likewise, the default display for numbers--when no particular
  17285. format is specified--is base 10. You can change the default base for
  17286. both input and output with the commands described below.
  17287. 'set input-radix BASE'
  17288. Set the default base for numeric input. Supported choices for BASE
  17289. are decimal 8, 10, or 16. The base must itself be specified either
  17290. unambiguously or using the current input radix; for example, any of
  17291. set input-radix 012
  17292. set input-radix 10.
  17293. set input-radix 0xa
  17294. sets the input base to decimal. On the other hand, 'set
  17295. input-radix 10' leaves the input radix unchanged, no matter what it
  17296. was, since '10', being without any leading or trailing signs of its
  17297. base, is interpreted in the current radix. Thus, if the current
  17298. radix is 16, '10' is interpreted in hex, i.e. as 16 decimal, which
  17299. doesn't change the radix.
  17300. 'set output-radix BASE'
  17301. Set the default base for numeric display. Supported choices for
  17302. BASE are decimal 8, 10, or 16. The base must itself be specified
  17303. either unambiguously or using the current input radix.
  17304. 'show input-radix'
  17305. Display the current default base for numeric input.
  17306. 'show output-radix'
  17307. Display the current default base for numeric display.
  17308. 'set radix [BASE]'
  17309. 'show radix'
  17310. These commands set and show the default base for both input and
  17311. output of numbers. 'set radix' sets the radix of input and output
  17312. to the same base; without an argument, it resets the radix back to
  17313. its default value of 10.
  17314. 
  17315. File: gdb.info, Node: ABI, Next: Auto-loading, Prev: Numbers, Up: Controlling GDB
  17316. 22.7 Configuring the Current ABI
  17317. ================================
  17318. GDB can determine the "ABI" (Application Binary Interface) of your
  17319. application automatically. However, sometimes you need to override its
  17320. conclusions. Use these commands to manage GDB's view of the current
  17321. ABI.
  17322. One GDB configuration can debug binaries for multiple operating
  17323. system targets, either via remote debugging or native emulation. GDB
  17324. will autodetect the "OS ABI" (Operating System ABI) in use, but you can
  17325. override its conclusion using the 'set osabi' command. One example
  17326. where this is useful is in debugging of binaries which use an alternate
  17327. C library (e.g. UCLIBC for GNU/Linux) which does not have the same
  17328. identifying marks that the standard C library for your platform
  17329. provides.
  17330. When GDB is debugging the AArch64 architecture, it provides a
  17331. "Newlib" OS ABI. This is useful for handling 'setjmp' and 'longjmp' when
  17332. debugging binaries that use the NEWLIB C library. The "Newlib" OS ABI
  17333. can be selected by 'set osabi Newlib'.
  17334. 'show osabi'
  17335. Show the OS ABI currently in use.
  17336. 'set osabi'
  17337. With no argument, show the list of registered available OS ABI's.
  17338. 'set osabi ABI'
  17339. Set the current OS ABI to ABI.
  17340. Generally, the way that an argument of type 'float' is passed to a
  17341. function depends on whether the function is prototyped. For a
  17342. prototyped (i.e. ANSI/ISO style) function, 'float' arguments are passed
  17343. unchanged, according to the architecture's convention for 'float'. For
  17344. unprototyped (i.e. K&R style) functions, 'float' arguments are first
  17345. promoted to type 'double' and then passed.
  17346. Unfortunately, some forms of debug information do not reliably
  17347. indicate whether a function is prototyped. If GDB calls a function that
  17348. is not marked as prototyped, it consults 'set coerce-float-to-double'.
  17349. 'set coerce-float-to-double'
  17350. 'set coerce-float-to-double on'
  17351. Arguments of type 'float' will be promoted to 'double' when passed
  17352. to an unprototyped function. This is the default setting.
  17353. 'set coerce-float-to-double off'
  17354. Arguments of type 'float' will be passed directly to unprototyped
  17355. functions.
  17356. 'show coerce-float-to-double'
  17357. Show the current setting of promoting 'float' to 'double'.
  17358. GDB needs to know the ABI used for your program's C++ objects. The
  17359. correct C++ ABI depends on which C++ compiler was used to build your
  17360. application. GDB only fully supports programs with a single C++ ABI; if
  17361. your program contains code using multiple C++ ABI's or if GDB can not
  17362. identify your program's ABI correctly, you can tell GDB which ABI to
  17363. use. Currently supported ABI's include "gnu-v2", for 'g++' versions
  17364. before 3.0, "gnu-v3", for 'g++' versions 3.0 and later, and "hpaCC" for
  17365. the HP ANSI C++ compiler. Other C++ compilers may use the "gnu-v2" or
  17366. "gnu-v3" ABI's as well. The default setting is "auto".
  17367. 'show cp-abi'
  17368. Show the C++ ABI currently in use.
  17369. 'set cp-abi'
  17370. With no argument, show the list of supported C++ ABI's.
  17371. 'set cp-abi ABI'
  17372. 'set cp-abi auto'
  17373. Set the current C++ ABI to ABI, or return to automatic detection.
  17374. 
  17375. File: gdb.info, Node: Auto-loading, Next: Messages/Warnings, Prev: ABI, Up: Controlling GDB
  17376. 22.8 Automatically loading associated files
  17377. ===========================================
  17378. GDB sometimes reads files with commands and settings automatically,
  17379. without being explicitly told so by the user. We call this feature
  17380. "auto-loading". While auto-loading is useful for automatically adapting
  17381. GDB to the needs of your project, it can sometimes produce unexpected
  17382. results or introduce security risks (e.g., if the file comes from
  17383. untrusted sources).
  17384. * Menu:
  17385. * Init File in the Current Directory:: 'set/show/info auto-load local-gdbinit'
  17386. * libthread_db.so.1 file:: 'set/show/info auto-load libthread-db'
  17387. * Auto-loading safe path:: 'set/show/info auto-load safe-path'
  17388. * Auto-loading verbose mode:: 'set/show debug auto-load'
  17389. There are various kinds of files GDB can automatically load. In
  17390. addition to these files, GDB supports auto-loading code written in
  17391. various extension languages. *Note Auto-loading extensions::.
  17392. Note that loading of these associated files (including the local
  17393. '.gdbinit' file) requires accordingly configured 'auto-load safe-path'
  17394. (*note Auto-loading safe path::).
  17395. For these reasons, GDB includes commands and options to let you
  17396. control when to auto-load files and which files should be auto-loaded.
  17397. 'set auto-load off'
  17398. Globally disable loading of all auto-loaded files. You may want to
  17399. use this command with the '-iex' option (*note Option
  17400. -init-eval-command::) such as:
  17401. $ gdb -iex "set auto-load off" untrusted-executable corefile
  17402. Be aware that system init file (*note System-wide configuration::)
  17403. and init files from your home directory (*note Home Directory Init
  17404. File::) still get read (as they come from generally trusted
  17405. directories). To prevent GDB from auto-loading even those init
  17406. files, use the '-nx' option (*note Mode Options::), in addition to
  17407. 'set auto-load no'.
  17408. 'show auto-load'
  17409. Show whether auto-loading of each specific 'auto-load' file(s) is
  17410. enabled or disabled.
  17411. (gdb) show auto-load
  17412. gdb-scripts: Auto-loading of canned sequences of commands scripts is on.
  17413. libthread-db: Auto-loading of inferior specific libthread_db is on.
  17414. local-gdbinit: Auto-loading of .gdbinit script from current directory
  17415. is on.
  17416. python-scripts: Auto-loading of Python scripts is on.
  17417. safe-path: List of directories from which it is safe to auto-load files
  17418. is $debugdir:$datadir/auto-load.
  17419. scripts-directory: List of directories from which to load auto-loaded scripts
  17420. is $debugdir:$datadir/auto-load.
  17421. 'info auto-load'
  17422. Print whether each specific 'auto-load' file(s) have been
  17423. auto-loaded or not.
  17424. (gdb) info auto-load
  17425. gdb-scripts:
  17426. Loaded Script
  17427. Yes /home/user/gdb/gdb-gdb.gdb
  17428. libthread-db: No auto-loaded libthread-db.
  17429. local-gdbinit: Local .gdbinit file "/home/user/gdb/.gdbinit" has been
  17430. loaded.
  17431. python-scripts:
  17432. Loaded Script
  17433. Yes /home/user/gdb/gdb-gdb.py
  17434. These are GDB control commands for the auto-loading:
  17435. *Note set auto-load off::. Disable auto-loading globally.
  17436. *Note show auto-load::. Show setting of all kinds of
  17437. files.
  17438. *Note info auto-load::. Show state of all kinds of files.
  17439. *Note set auto-load gdb-scripts::. Control for GDB command scripts.
  17440. *Note show auto-load gdb-scripts::. Show setting of GDB command
  17441. scripts.
  17442. *Note info auto-load gdb-scripts::. Show state of GDB command scripts.
  17443. *Note set auto-load python-scripts::.Control for GDB Python scripts.
  17444. *Note show auto-load python-scripts::.Show setting of GDB Python
  17445. scripts.
  17446. *Note info auto-load python-scripts::.Show state of GDB Python scripts.
  17447. *Note set auto-load guile-scripts::. Control for GDB Guile scripts.
  17448. *Note show auto-load guile-scripts::.Show setting of GDB Guile scripts.
  17449. *Note info auto-load guile-scripts::.Show state of GDB Guile scripts.
  17450. *Note set auto-load scripts-directory::.Control for GDB auto-loaded
  17451. scripts location.
  17452. *Note show auto-load scripts-directory::.Show GDB auto-loaded scripts
  17453. location.
  17454. *Note add-auto-load-scripts-directory::.Add directory for auto-loaded
  17455. scripts location list.
  17456. *Note set auto-load local-gdbinit::. Control for init file in the
  17457. current directory.
  17458. *Note show auto-load local-gdbinit::.Show setting of init file in the
  17459. current directory.
  17460. *Note info auto-load local-gdbinit::.Show state of init file in the
  17461. current directory.
  17462. *Note set auto-load libthread-db::. Control for thread debugging
  17463. library.
  17464. *Note show auto-load libthread-db::. Show setting of thread debugging
  17465. library.
  17466. *Note info auto-load libthread-db::. Show state of thread debugging
  17467. library.
  17468. *Note set auto-load safe-path::. Control directories trusted for
  17469. automatic loading.
  17470. *Note show auto-load safe-path::. Show directories trusted for
  17471. automatic loading.
  17472. *Note add-auto-load-safe-path::. Add directory trusted for
  17473. automatic loading.
  17474. 
  17475. File: gdb.info, Node: Init File in the Current Directory, Next: libthread_db.so.1 file, Up: Auto-loading
  17476. 22.8.1 Automatically loading init file in the current directory
  17477. ---------------------------------------------------------------
  17478. By default, GDB reads and executes the canned sequences of commands from
  17479. init file (if any) in the current working directory, see *note Init File
  17480. in the Current Directory during Startup::.
  17481. Note that loading of this local '.gdbinit' file also requires
  17482. accordingly configured 'auto-load safe-path' (*note Auto-loading safe
  17483. path::).
  17484. 'set auto-load local-gdbinit [on|off]'
  17485. Enable or disable the auto-loading of canned sequences of commands
  17486. (*note Sequences::) found in init file in the current directory.
  17487. 'show auto-load local-gdbinit'
  17488. Show whether auto-loading of canned sequences of commands from init
  17489. file in the current directory is enabled or disabled.
  17490. 'info auto-load local-gdbinit'
  17491. Print whether canned sequences of commands from init file in the
  17492. current directory have been auto-loaded.
  17493. 
  17494. File: gdb.info, Node: libthread_db.so.1 file, Next: Auto-loading safe path, Prev: Init File in the Current Directory, Up: Auto-loading
  17495. 22.8.2 Automatically loading thread debugging library
  17496. -----------------------------------------------------
  17497. This feature is currently present only on GNU/Linux native hosts.
  17498. GDB reads in some cases thread debugging library from places specific
  17499. to the inferior (*note set libthread-db-search-path::).
  17500. The special 'libthread-db-search-path' entry '$sdir' is processed
  17501. without checking this 'set auto-load libthread-db' switch as system
  17502. libraries have to be trusted in general. In all other cases of
  17503. 'libthread-db-search-path' entries GDB checks first if 'set auto-load
  17504. libthread-db' is enabled before trying to open such thread debugging
  17505. library.
  17506. Note that loading of this debugging library also requires accordingly
  17507. configured 'auto-load safe-path' (*note Auto-loading safe path::).
  17508. 'set auto-load libthread-db [on|off]'
  17509. Enable or disable the auto-loading of inferior specific thread
  17510. debugging library.
  17511. 'show auto-load libthread-db'
  17512. Show whether auto-loading of inferior specific thread debugging
  17513. library is enabled or disabled.
  17514. 'info auto-load libthread-db'
  17515. Print the list of all loaded inferior specific thread debugging
  17516. libraries and for each such library print list of inferior PIDs
  17517. using it.
  17518. 
  17519. File: gdb.info, Node: Auto-loading safe path, Next: Auto-loading verbose mode, Prev: libthread_db.so.1 file, Up: Auto-loading
  17520. 22.8.3 Security restriction for auto-loading
  17521. --------------------------------------------
  17522. As the files of inferior can come from untrusted source (such as
  17523. submitted by an application user) GDB does not always load any files
  17524. automatically. GDB provides the 'set auto-load safe-path' setting to
  17525. list directories trusted for loading files not explicitly requested by
  17526. user. Each directory can also be a shell wildcard pattern.
  17527. If the path is not set properly you will see a warning and the file
  17528. will not get loaded:
  17529. $ ./gdb -q ./gdb
  17530. Reading symbols from /home/user/gdb/gdb...
  17531. warning: File "/home/user/gdb/gdb-gdb.gdb" auto-loading has been
  17532. declined by your `auto-load safe-path' set
  17533. to "$debugdir:$datadir/auto-load".
  17534. warning: File "/home/user/gdb/gdb-gdb.py" auto-loading has been
  17535. declined by your `auto-load safe-path' set
  17536. to "$debugdir:$datadir/auto-load".
  17537. To instruct GDB to go ahead and use the init files anyway, invoke GDB
  17538. like this:
  17539. $ gdb -q -iex "set auto-load safe-path /home/user/gdb" ./gdb
  17540. The list of trusted directories is controlled by the following
  17541. commands:
  17542. 'set auto-load safe-path [DIRECTORIES]'
  17543. Set the list of directories (and their subdirectories) trusted for
  17544. automatic loading and execution of scripts. You can also enter a
  17545. specific trusted file. Each directory can also be a shell wildcard
  17546. pattern; wildcards do not match directory separator - see
  17547. 'FNM_PATHNAME' for system function 'fnmatch' (*note fnmatch:
  17548. (libc)Wildcard Matching.). If you omit DIRECTORIES, 'auto-load
  17549. safe-path' will be reset to its default value as specified during
  17550. GDB compilation.
  17551. The list of directories uses path separator (':' on GNU and Unix
  17552. systems, ';' on MS-Windows and MS-DOS) to separate directories,
  17553. similarly to the 'PATH' environment variable.
  17554. 'show auto-load safe-path'
  17555. Show the list of directories trusted for automatic loading and
  17556. execution of scripts.
  17557. 'add-auto-load-safe-path'
  17558. Add an entry (or list of entries) to the list of directories
  17559. trusted for automatic loading and execution of scripts. Multiple
  17560. entries may be delimited by the host platform path separator in
  17561. use.
  17562. This variable defaults to what '--with-auto-load-dir' has been
  17563. configured to (*note with-auto-load-dir::). '$debugdir' and '$datadir'
  17564. substitution applies the same as for *note set auto-load
  17565. scripts-directory::. The default 'set auto-load safe-path' value can be
  17566. also overriden by GDB configuration option '--with-auto-load-safe-path'.
  17567. Setting this variable to '/' disables this security protection,
  17568. corresponding GDB configuration option is
  17569. '--without-auto-load-safe-path'. This variable is supposed to be set to
  17570. the system directories writable by the system superuser only. Users can
  17571. add their source directories in init files in their home directories
  17572. (*note Home Directory Init File::). See also deprecated init file in
  17573. the current directory (*note Init File in the Current Directory during
  17574. Startup::).
  17575. To force GDB to load the files it declined to load in the previous
  17576. example, you could use one of the following ways:
  17577. '~/.gdbinit': 'add-auto-load-safe-path ~/src/gdb'
  17578. Specify this trusted directory (or a file) as additional component
  17579. of the list. You have to specify also any existing directories
  17580. displayed by by 'show auto-load safe-path' (such as '/usr:/bin' in
  17581. this example).
  17582. 'gdb -iex "set auto-load safe-path /usr:/bin:~/src/gdb" ...'
  17583. Specify this directory as in the previous case but just for a
  17584. single GDB session.
  17585. 'gdb -iex "set auto-load safe-path /" ...'
  17586. Disable auto-loading safety for a single GDB session. This assumes
  17587. all the files you debug during this GDB session will come from
  17588. trusted sources.
  17589. './configure --without-auto-load-safe-path'
  17590. During compilation of GDB you may disable any auto-loading safety.
  17591. This assumes all the files you will ever debug with this GDB come
  17592. from trusted sources.
  17593. On the other hand you can also explicitly forbid automatic files
  17594. loading which also suppresses any such warning messages:
  17595. 'gdb -iex "set auto-load no" ...'
  17596. You can use GDB command-line option for a single GDB session.
  17597. '~/.gdbinit': 'set auto-load no'
  17598. Disable auto-loading globally for the user (*note Home Directory
  17599. Init File::). While it is improbable, you could also use system
  17600. init file instead (*note System-wide configuration::).
  17601. This setting applies to the file names as entered by user. If no
  17602. entry matches GDB tries as a last resort to also resolve all the file
  17603. names into their canonical form (typically resolving symbolic links) and
  17604. compare the entries again. GDB already canonicalizes most of the
  17605. filenames on its own before starting the comparison so a canonical form
  17606. of directories is recommended to be entered.
  17607. 
  17608. File: gdb.info, Node: Auto-loading verbose mode, Prev: Auto-loading safe path, Up: Auto-loading
  17609. 22.8.4 Displaying files tried for auto-load
  17610. -------------------------------------------
  17611. For better visibility of all the file locations where you can place
  17612. scripts to be auto-loaded with inferior -- or to protect yourself
  17613. against accidental execution of untrusted scripts -- GDB provides a
  17614. feature for printing all the files attempted to be loaded. Both
  17615. existing and non-existing files may be printed.
  17616. For example the list of directories from which it is safe to
  17617. auto-load files (*note Auto-loading safe path::) applies also to
  17618. canonicalized filenames which may not be too obvious while setting it
  17619. up.
  17620. (gdb) set debug auto-load on
  17621. (gdb) file ~/src/t/true
  17622. auto-load: Loading canned sequences of commands script "/tmp/true-gdb.gdb"
  17623. for objfile "/tmp/true".
  17624. auto-load: Updating directories of "/usr:/opt".
  17625. auto-load: Using directory "/usr".
  17626. auto-load: Using directory "/opt".
  17627. warning: File "/tmp/true-gdb.gdb" auto-loading has been declined
  17628. by your `auto-load safe-path' set to "/usr:/opt".
  17629. 'set debug auto-load [on|off]'
  17630. Set whether to print the filenames attempted to be auto-loaded.
  17631. 'show debug auto-load'
  17632. Show whether printing of the filenames attempted to be auto-loaded
  17633. is turned on or off.
  17634. 
  17635. File: gdb.info, Node: Messages/Warnings, Next: Debugging Output, Prev: Auto-loading, Up: Controlling GDB
  17636. 22.9 Optional Warnings and Messages
  17637. ===================================
  17638. By default, GDB is silent about its inner workings. If you are running
  17639. on a slow machine, you may want to use the 'set verbose' command. This
  17640. makes GDB tell you when it does a lengthy internal operation, so you
  17641. will not think it has crashed.
  17642. Currently, the messages controlled by 'set verbose' are those which
  17643. announce that the symbol table for a source file is being read; see
  17644. 'symbol-file' in *note Commands to Specify Files: Files.
  17645. 'set verbose on'
  17646. Enables GDB output of certain informational messages.
  17647. 'set verbose off'
  17648. Disables GDB output of certain informational messages.
  17649. 'show verbose'
  17650. Displays whether 'set verbose' is on or off.
  17651. By default, if GDB encounters bugs in the symbol table of an object
  17652. file, it is silent; but if you are debugging a compiler, you may find
  17653. this information useful (*note Errors Reading Symbol Files: Symbol
  17654. Errors.).
  17655. 'set complaints LIMIT'
  17656. Permits GDB to output LIMIT complaints about each type of unusual
  17657. symbols before becoming silent about the problem. Set LIMIT to
  17658. zero to suppress all complaints; set it to a large number to
  17659. prevent complaints from being suppressed.
  17660. 'show complaints'
  17661. Displays how many symbol complaints GDB is permitted to produce.
  17662. By default, GDB is cautious, and asks what sometimes seems to be a
  17663. lot of stupid questions to confirm certain commands. For example, if
  17664. you try to run a program which is already running:
  17665. (gdb) run
  17666. The program being debugged has been started already.
  17667. Start it from the beginning? (y or n)
  17668. If you are willing to unflinchingly face the consequences of your own
  17669. commands, you can disable this "feature":
  17670. 'set confirm off'
  17671. Disables confirmation requests. Note that running GDB with the
  17672. '--batch' option (*note -batch: Mode Options.) also automatically
  17673. disables confirmation requests.
  17674. 'set confirm on'
  17675. Enables confirmation requests (the default).
  17676. 'show confirm'
  17677. Displays state of confirmation requests.
  17678. If you need to debug user-defined commands or sourced files you may
  17679. find it useful to enable "command tracing". In this mode each command
  17680. will be printed as it is executed, prefixed with one or more '+'
  17681. symbols, the quantity denoting the call depth of each command.
  17682. 'set trace-commands on'
  17683. Enable command tracing.
  17684. 'set trace-commands off'
  17685. Disable command tracing.
  17686. 'show trace-commands'
  17687. Display the current state of command tracing.
  17688. 
  17689. File: gdb.info, Node: Debugging Output, Next: Other Misc Settings, Prev: Messages/Warnings, Up: Controlling GDB
  17690. 22.10 Optional Messages about Internal Happenings
  17691. =================================================
  17692. GDB has commands that enable optional debugging messages from various
  17693. GDB subsystems; normally these commands are of interest to GDB
  17694. maintainers, or when reporting a bug. This section documents those
  17695. commands.
  17696. 'set exec-done-display'
  17697. Turns on or off the notification of asynchronous commands'
  17698. completion. When on, GDB will print a message when an asynchronous
  17699. command finishes its execution. The default is off.
  17700. 'show exec-done-display'
  17701. Displays the current setting of asynchronous command completion
  17702. notification.
  17703. 'set debug aarch64'
  17704. Turns on or off display of debugging messages related to ARM
  17705. AArch64. The default is off.
  17706. 'show debug aarch64'
  17707. Displays the current state of displaying debugging messages related
  17708. to ARM AArch64.
  17709. 'set debug arch'
  17710. Turns on or off display of gdbarch debugging info. The default is
  17711. off
  17712. 'show debug arch'
  17713. Displays the current state of displaying gdbarch debugging info.
  17714. 'set debug aix-solib'
  17715. Control display of debugging messages from the AIX shared library
  17716. support module. The default is off.
  17717. 'show debug aix-thread'
  17718. Show the current state of displaying AIX shared library debugging
  17719. messages.
  17720. 'set debug aix-thread'
  17721. Display debugging messages about inner workings of the AIX thread
  17722. module.
  17723. 'show debug aix-thread'
  17724. Show the current state of AIX thread debugging info display.
  17725. 'set debug check-physname'
  17726. Check the results of the "physname" computation. When reading
  17727. DWARF debugging information for C++, GDB attempts to compute each
  17728. entity's name. GDB can do this computation in two different ways,
  17729. depending on exactly what information is present. When enabled,
  17730. this setting causes GDB to compute the names both ways and display
  17731. any discrepancies.
  17732. 'show debug check-physname'
  17733. Show the current state of "physname" checking.
  17734. 'set debug coff-pe-read'
  17735. Control display of debugging messages related to reading of COFF/PE
  17736. exported symbols. The default is off.
  17737. 'show debug coff-pe-read'
  17738. Displays the current state of displaying debugging messages related
  17739. to reading of COFF/PE exported symbols.
  17740. 'set debug dwarf-die'
  17741. Dump DWARF DIEs after they are read in. The value is the number of
  17742. nesting levels to print. A value of zero turns off the display.
  17743. 'show debug dwarf-die'
  17744. Show the current state of DWARF DIE debugging.
  17745. 'set debug dwarf-line'
  17746. Turns on or off display of debugging messages related to reading
  17747. DWARF line tables. The default is 0 (off). A value of 1 provides
  17748. basic information. A value greater than 1 provides more verbose
  17749. information.
  17750. 'show debug dwarf-line'
  17751. Show the current state of DWARF line table debugging.
  17752. 'set debug dwarf-read'
  17753. Turns on or off display of debugging messages related to reading
  17754. DWARF debug info. The default is 0 (off). A value of 1 provides
  17755. basic information. A value greater than 1 provides more verbose
  17756. information.
  17757. 'show debug dwarf-read'
  17758. Show the current state of DWARF reader debugging.
  17759. 'set debug displaced'
  17760. Turns on or off display of GDB debugging info for the displaced
  17761. stepping support. The default is off.
  17762. 'show debug displaced'
  17763. Displays the current state of displaying GDB debugging info related
  17764. to displaced stepping.
  17765. 'set debug event'
  17766. Turns on or off display of GDB event debugging info. The default
  17767. is off.
  17768. 'show debug event'
  17769. Displays the current state of displaying GDB event debugging info.
  17770. 'set debug expression'
  17771. Turns on or off display of debugging info about GDB expression
  17772. parsing. The default is off.
  17773. 'show debug expression'
  17774. Displays the current state of displaying debugging info about GDB
  17775. expression parsing.
  17776. 'set debug fbsd-lwp'
  17777. Turns on or off debugging messages from the FreeBSD LWP debug
  17778. support.
  17779. 'show debug fbsd-lwp'
  17780. Show the current state of FreeBSD LWP debugging messages.
  17781. 'set debug fbsd-nat'
  17782. Turns on or off debugging messages from the FreeBSD native target.
  17783. 'show debug fbsd-nat'
  17784. Show the current state of FreeBSD native target debugging messages.
  17785. 'set debug frame'
  17786. Turns on or off display of GDB frame debugging info. The default
  17787. is off.
  17788. 'show debug frame'
  17789. Displays the current state of displaying GDB frame debugging info.
  17790. 'set debug gnu-nat'
  17791. Turn on or off debugging messages from the GNU/Hurd debug support.
  17792. 'show debug gnu-nat'
  17793. Show the current state of GNU/Hurd debugging messages.
  17794. 'set debug infrun'
  17795. Turns on or off display of GDB debugging info for running the
  17796. inferior. The default is off. 'infrun.c' contains GDB's runtime
  17797. state machine used for implementing operations such as
  17798. single-stepping the inferior.
  17799. 'show debug infrun'
  17800. Displays the current state of GDB inferior debugging.
  17801. 'set debug jit'
  17802. Turn on or off debugging messages from JIT debug support.
  17803. 'show debug jit'
  17804. Displays the current state of GDB JIT debugging.
  17805. 'set debug lin-lwp'
  17806. Turn on or off debugging messages from the Linux LWP debug support.
  17807. 'show debug lin-lwp'
  17808. Show the current state of Linux LWP debugging messages.
  17809. 'set debug linux-namespaces'
  17810. Turn on or off debugging messages from the Linux namespaces debug
  17811. support.
  17812. 'show debug linux-namespaces'
  17813. Show the current state of Linux namespaces debugging messages.
  17814. 'set debug mach-o'
  17815. Control display of debugging messages related to Mach-O symbols
  17816. processing. The default is off.
  17817. 'show debug mach-o'
  17818. Displays the current state of displaying debugging messages related
  17819. to reading of COFF/PE exported symbols.
  17820. 'set debug notification'
  17821. Turn on or off debugging messages about remote async notification.
  17822. The default is off.
  17823. 'show debug notification'
  17824. Displays the current state of remote async notification debugging
  17825. messages.
  17826. 'set debug observer'
  17827. Turns on or off display of GDB observer debugging. This includes
  17828. info such as the notification of observable events.
  17829. 'show debug observer'
  17830. Displays the current state of observer debugging.
  17831. 'set debug overload'
  17832. Turns on or off display of GDB C++ overload debugging info. This
  17833. includes info such as ranking of functions, etc. The default is
  17834. off.
  17835. 'show debug overload'
  17836. Displays the current state of displaying GDB C++ overload debugging
  17837. info.
  17838. 'set debug parser'
  17839. Turns on or off the display of expression parser debugging output.
  17840. Internally, this sets the 'yydebug' variable in the expression
  17841. parser. *Note Tracing Your Parser: (bison)Tracing, for details.
  17842. The default is off.
  17843. 'show debug parser'
  17844. Show the current state of expression parser debugging.
  17845. 'set debug remote'
  17846. Turns on or off display of reports on all packets sent back and
  17847. forth across the serial line to the remote machine. The info is
  17848. printed on the GDB standard output stream. The default is off.
  17849. 'show debug remote'
  17850. Displays the state of display of remote packets.
  17851. 'set debug remote-packet-max-chars'
  17852. Sets the maximum number of characters to display for each remote
  17853. packet when 'set debug remote' is on. This is useful to prevent
  17854. GDB from displaying lengthy remote packets and polluting the
  17855. console.
  17856. The default value is '512', which means GDB will truncate each
  17857. remote packet after 512 bytes.
  17858. Setting this option to 'unlimited' will disable truncation and will
  17859. output the full length of the remote packets.
  17860. 'show debug remote-packet-max-chars'
  17861. Displays the number of bytes to output for remote packet debugging.
  17862. 'set debug separate-debug-file'
  17863. Turns on or off display of debug output about separate debug file
  17864. search.
  17865. 'show debug separate-debug-file'
  17866. Displays the state of separate debug file search debug output.
  17867. 'set debug serial'
  17868. Turns on or off display of GDB serial debugging info. The default
  17869. is off.
  17870. 'show debug serial'
  17871. Displays the current state of displaying GDB serial debugging info.
  17872. 'set debug solib-frv'
  17873. Turn on or off debugging messages for FR-V shared-library code.
  17874. 'show debug solib-frv'
  17875. Display the current state of FR-V shared-library code debugging
  17876. messages.
  17877. 'set debug symbol-lookup'
  17878. Turns on or off display of debugging messages related to symbol
  17879. lookup. The default is 0 (off). A value of 1 provides basic
  17880. information. A value greater than 1 provides more verbose
  17881. information.
  17882. 'show debug symbol-lookup'
  17883. Show the current state of symbol lookup debugging messages.
  17884. 'set debug symfile'
  17885. Turns on or off display of debugging messages related to symbol
  17886. file functions. The default is off. *Note Files::.
  17887. 'show debug symfile'
  17888. Show the current state of symbol file debugging messages.
  17889. 'set debug symtab-create'
  17890. Turns on or off display of debugging messages related to symbol
  17891. table creation. The default is 0 (off). A value of 1 provides
  17892. basic information. A value greater than 1 provides more verbose
  17893. information.
  17894. 'show debug symtab-create'
  17895. Show the current state of symbol table creation debugging.
  17896. 'set debug target'
  17897. Turns on or off display of GDB target debugging info. This info
  17898. includes what is going on at the target level of GDB, as it
  17899. happens. The default is 0. Set it to 1 to track events, and to 2
  17900. to also track the value of large memory transfers.
  17901. 'show debug target'
  17902. Displays the current state of displaying GDB target debugging info.
  17903. 'set debug timestamp'
  17904. Turns on or off display of timestamps with GDB debugging info.
  17905. When enabled, seconds and microseconds are displayed before each
  17906. debugging message.
  17907. 'show debug timestamp'
  17908. Displays the current state of displaying timestamps with GDB
  17909. debugging info.
  17910. 'set debug varobj'
  17911. Turns on or off display of GDB variable object debugging info. The
  17912. default is off.
  17913. 'show debug varobj'
  17914. Displays the current state of displaying GDB variable object
  17915. debugging info.
  17916. 'set debug xml'
  17917. Turn on or off debugging messages for built-in XML parsers.
  17918. 'show debug xml'
  17919. Displays the current state of XML debugging messages.
  17920. 
  17921. File: gdb.info, Node: Other Misc Settings, Prev: Debugging Output, Up: Controlling GDB
  17922. 22.11 Other Miscellaneous Settings
  17923. ==================================
  17924. 'set interactive-mode'
  17925. If 'on', forces GDB to assume that GDB was started in a terminal.
  17926. In practice, this means that GDB should wait for the user to answer
  17927. queries generated by commands entered at the command prompt. If
  17928. 'off', forces GDB to operate in the opposite mode, and it uses the
  17929. default answers to all queries. If 'auto' (the default), GDB tries
  17930. to determine whether its standard input is a terminal, and works in
  17931. interactive-mode if it is, non-interactively otherwise.
  17932. In the vast majority of cases, the debugger should be able to guess
  17933. correctly which mode should be used. But this setting can be
  17934. useful in certain specific cases, such as running a MinGW GDB
  17935. inside a cygwin window.
  17936. 'show interactive-mode'
  17937. Displays whether the debugger is operating in interactive mode or
  17938. not.
  17939. 
  17940. File: gdb.info, Node: Extending GDB, Next: Interpreters, Prev: Controlling GDB, Up: Top
  17941. 23 Extending GDB
  17942. ****************
  17943. GDB provides several mechanisms for extension. GDB also provides the
  17944. ability to automatically load extensions when it reads a file for
  17945. debugging. This allows the user to automatically customize GDB for the
  17946. program being debugged.
  17947. * Menu:
  17948. * Sequences:: Canned Sequences of GDB Commands
  17949. * Python:: Extending GDB using Python
  17950. * Guile:: Extending GDB using Guile
  17951. * Auto-loading extensions:: Automatically loading extensions
  17952. * Multiple Extension Languages:: Working with multiple extension languages
  17953. * Aliases:: Creating new spellings of existing commands
  17954. To facilitate the use of extension languages, GDB is capable of
  17955. evaluating the contents of a file. When doing so, GDB can recognize
  17956. which extension language is being used by looking at the filename
  17957. extension. Files with an unrecognized filename extension are always
  17958. treated as a GDB Command Files. *Note Command files: Command Files.
  17959. You can control how GDB evaluates these files with the following
  17960. setting:
  17961. 'set script-extension off'
  17962. All scripts are always evaluated as GDB Command Files.
  17963. 'set script-extension soft'
  17964. The debugger determines the scripting language based on filename
  17965. extension. If this scripting language is supported, GDB evaluates
  17966. the script using that language. Otherwise, it evaluates the file
  17967. as a GDB Command File.
  17968. 'set script-extension strict'
  17969. The debugger determines the scripting language based on filename
  17970. extension, and evaluates the script using that language. If the
  17971. language is not supported, then the evaluation fails.
  17972. 'show script-extension'
  17973. Display the current value of the 'script-extension' option.
  17974. 
  17975. File: gdb.info, Node: Sequences, Next: Python, Up: Extending GDB
  17976. 23.1 Canned Sequences of Commands
  17977. =================================
  17978. Aside from breakpoint commands (*note Breakpoint Command Lists: Break
  17979. Commands.), GDB provides two ways to store sequences of commands for
  17980. execution as a unit: user-defined commands and command files.
  17981. * Menu:
  17982. * Define:: How to define your own commands
  17983. * Hooks:: Hooks for user-defined commands
  17984. * Command Files:: How to write scripts of commands to be stored in a file
  17985. * Output:: Commands for controlled output
  17986. * Auto-loading sequences:: Controlling auto-loaded command files
  17987. 
  17988. File: gdb.info, Node: Define, Next: Hooks, Up: Sequences
  17989. 23.1.1 User-defined Commands
  17990. ----------------------------
  17991. A "user-defined command" is a sequence of GDB commands to which you
  17992. assign a new name as a command. This is done with the 'define' command.
  17993. User commands may accept an unlimited number of arguments separated by
  17994. whitespace. Arguments are accessed within the user command via
  17995. '$arg0...$argN'. A trivial example:
  17996. define adder
  17997. print $arg0 + $arg1 + $arg2
  17998. end
  17999. To execute the command use:
  18000. adder 1 2 3
  18001. This defines the command 'adder', which prints the sum of its three
  18002. arguments. Note the arguments are text substitutions, so they may
  18003. reference variables, use complex expressions, or even perform inferior
  18004. functions calls.
  18005. In addition, '$argc' may be used to find out how many arguments have
  18006. been passed.
  18007. define adder
  18008. if $argc == 2
  18009. print $arg0 + $arg1
  18010. end
  18011. if $argc == 3
  18012. print $arg0 + $arg1 + $arg2
  18013. end
  18014. end
  18015. Combining with the 'eval' command (*note eval::) makes it easier to
  18016. process a variable number of arguments:
  18017. define adder
  18018. set $i = 0
  18019. set $sum = 0
  18020. while $i < $argc
  18021. eval "set $sum = $sum + $arg%d", $i
  18022. set $i = $i + 1
  18023. end
  18024. print $sum
  18025. end
  18026. 'define COMMANDNAME'
  18027. Define a command named COMMANDNAME. If there is already a command
  18028. by that name, you are asked to confirm that you want to redefine
  18029. it. The argument COMMANDNAME may be a bare command name consisting
  18030. of letters, numbers, dashes, dots, and underscores. It may also
  18031. start with any predefined or user-defined prefix command. For
  18032. example, 'define target my-target' creates a user-defined 'target
  18033. my-target' command.
  18034. The definition of the command is made up of other GDB command
  18035. lines, which are given following the 'define' command. The end of
  18036. these commands is marked by a line containing 'end'.
  18037. 'document COMMANDNAME'
  18038. Document the user-defined command COMMANDNAME, so that it can be
  18039. accessed by 'help'. The command COMMANDNAME must already be
  18040. defined. This command reads lines of documentation just as
  18041. 'define' reads the lines of the command definition, ending with
  18042. 'end'. After the 'document' command is finished, 'help' on command
  18043. COMMANDNAME displays the documentation you have written.
  18044. You may use the 'document' command again to change the
  18045. documentation of a command. Redefining the command with 'define'
  18046. does not change the documentation.
  18047. 'define-prefix COMMANDNAME'
  18048. Define or mark the command COMMANDNAME as a user-defined prefix
  18049. command. Once marked, COMMANDNAME can be used as prefix command by
  18050. the 'define' command. Note that 'define-prefix' can be used with a
  18051. not yet defined COMMANDNAME. In such a case, COMMANDNAME is
  18052. defined as an empty user-defined command. In case you redefine a
  18053. command that was marked as a user-defined prefix command, the
  18054. subcommands of the redefined command are kept (and GDB indicates so
  18055. to the user).
  18056. Example:
  18057. (gdb) define-prefix abc
  18058. (gdb) define-prefix abc def
  18059. (gdb) define abc def
  18060. Type commands for definition of "abc def".
  18061. End with a line saying just "end".
  18062. >echo command initial def\n
  18063. >end
  18064. (gdb) define abc def ghi
  18065. Type commands for definition of "abc def ghi".
  18066. End with a line saying just "end".
  18067. >echo command ghi\n
  18068. >end
  18069. (gdb) define abc def
  18070. Keeping subcommands of prefix command "def".
  18071. Redefine command "def"? (y or n) y
  18072. Type commands for definition of "abc def".
  18073. End with a line saying just "end".
  18074. >echo command def\n
  18075. >end
  18076. (gdb) abc def ghi
  18077. command ghi
  18078. (gdb) abc def
  18079. command def
  18080. (gdb)
  18081. 'dont-repeat'
  18082. Used inside a user-defined command, this tells GDB that this
  18083. command should not be repeated when the user hits <RET> (*note
  18084. repeat last command: Command Syntax.).
  18085. 'help user-defined'
  18086. List all user-defined commands and all python commands defined in
  18087. class COMMAND_USER. The first line of the documentation or
  18088. docstring is included (if any).
  18089. 'show user'
  18090. 'show user COMMANDNAME'
  18091. Display the GDB commands used to define COMMANDNAME (but not its
  18092. documentation). If no COMMANDNAME is given, display the
  18093. definitions for all user-defined commands. This does not work for
  18094. user-defined python commands.
  18095. 'show max-user-call-depth'
  18096. 'set max-user-call-depth'
  18097. The value of 'max-user-call-depth' controls how many recursion
  18098. levels are allowed in user-defined commands before GDB suspects an
  18099. infinite recursion and aborts the command. This does not apply to
  18100. user-defined python commands.
  18101. In addition to the above commands, user-defined commands frequently
  18102. use control flow commands, described in *note Command Files::.
  18103. When user-defined commands are executed, the commands of the
  18104. definition are not printed. An error in any command stops execution of
  18105. the user-defined command.
  18106. If used interactively, commands that would ask for confirmation
  18107. proceed without asking when used inside a user-defined command. Many
  18108. GDB commands that normally print messages to say what they are doing
  18109. omit the messages when used in a user-defined command.
  18110. 
  18111. File: gdb.info, Node: Hooks, Next: Command Files, Prev: Define, Up: Sequences
  18112. 23.1.2 User-defined Command Hooks
  18113. ---------------------------------
  18114. You may define "hooks", which are a special kind of user-defined
  18115. command. Whenever you run the command 'foo', if the user-defined
  18116. command 'hook-foo' exists, it is executed (with no arguments) before
  18117. that command.
  18118. A hook may also be defined which is run after the command you
  18119. executed. Whenever you run the command 'foo', if the user-defined
  18120. command 'hookpost-foo' exists, it is executed (with no arguments) after
  18121. that command. Post-execution hooks may exist simultaneously with
  18122. pre-execution hooks, for the same command.
  18123. It is valid for a hook to call the command which it hooks. If this
  18124. occurs, the hook is not re-executed, thereby avoiding infinite
  18125. recursion.
  18126. In addition, a pseudo-command, 'stop' exists. Defining ('hook-stop')
  18127. makes the associated commands execute every time execution stops in your
  18128. program: before breakpoint commands are run, displays are printed, or
  18129. the stack frame is printed.
  18130. For example, to ignore 'SIGALRM' signals while single-stepping, but
  18131. treat them normally during normal execution, you could define:
  18132. define hook-stop
  18133. handle SIGALRM nopass
  18134. end
  18135. define hook-run
  18136. handle SIGALRM pass
  18137. end
  18138. define hook-continue
  18139. handle SIGALRM pass
  18140. end
  18141. As a further example, to hook at the beginning and end of the 'echo'
  18142. command, and to add extra text to the beginning and end of the message,
  18143. you could define:
  18144. define hook-echo
  18145. echo <<<---
  18146. end
  18147. define hookpost-echo
  18148. echo --->>>\n
  18149. end
  18150. (gdb) echo Hello World
  18151. <<<---Hello World--->>>
  18152. (gdb)
  18153. You can define a hook for any single-word command in GDB, but not for
  18154. command aliases; you should define a hook for the basic command name,
  18155. e.g. 'backtrace' rather than 'bt'. You can hook a multi-word command by
  18156. adding 'hook-' or 'hookpost-' to the last word of the command, e.g.
  18157. 'define target hook-remote' to add a hook to 'target remote'.
  18158. If an error occurs during the execution of your hook, execution of
  18159. GDB commands stops and GDB issues a prompt (before the command that you
  18160. actually typed had a chance to run).
  18161. If you try to define a hook which does not match any known command,
  18162. you get a warning from the 'define' command.
  18163. 
  18164. File: gdb.info, Node: Command Files, Next: Output, Prev: Hooks, Up: Sequences
  18165. 23.1.3 Command Files
  18166. --------------------
  18167. A command file for GDB is a text file made of lines that are GDB
  18168. commands. Comments (lines starting with '#') may also be included. An
  18169. empty line in a command file does nothing; it does not mean to repeat
  18170. the last command, as it would from the terminal.
  18171. You can request the execution of a command file with the 'source'
  18172. command. Note that the 'source' command is also used to evaluate
  18173. scripts that are not Command Files. The exact behavior can be
  18174. configured using the 'script-extension' setting. *Note Extending GDB:
  18175. Extending GDB.
  18176. 'source [-s] [-v] FILENAME'
  18177. Execute the command file FILENAME.
  18178. The lines in a command file are generally executed sequentially,
  18179. unless the order of execution is changed by one of the _flow-control
  18180. commands_ described below. The commands are not printed as they are
  18181. executed. An error in any command terminates execution of the command
  18182. file and control is returned to the console.
  18183. GDB first searches for FILENAME in the current directory. If the
  18184. file is not found there, and FILENAME does not specify a directory, then
  18185. GDB also looks for the file on the source search path (specified with
  18186. the 'directory' command); except that '$cdir' is not searched because
  18187. the compilation directory is not relevant to scripts.
  18188. If '-s' is specified, then GDB searches for FILENAME on the search
  18189. path even if FILENAME specifies a directory. The search is done by
  18190. appending FILENAME to each element of the search path. So, for example,
  18191. if FILENAME is 'mylib/myscript' and the search path contains
  18192. '/home/user' then GDB will look for the script
  18193. '/home/user/mylib/myscript'. The search is also done if FILENAME is an
  18194. absolute path. For example, if FILENAME is '/tmp/myscript' and the
  18195. search path contains '/home/user' then GDB will look for the script
  18196. '/home/user/tmp/myscript'. For DOS-like systems, if FILENAME contains a
  18197. drive specification, it is stripped before concatenation. For example,
  18198. if FILENAME is 'd:myscript' and the search path contains 'c:/tmp' then
  18199. GDB will look for the script 'c:/tmp/myscript'.
  18200. If '-v', for verbose mode, is given then GDB displays each command as
  18201. it is executed. The option must be given before FILENAME, and is
  18202. interpreted as part of the filename anywhere else.
  18203. Commands that would ask for confirmation if used interactively
  18204. proceed without asking when used in a command file. Many GDB commands
  18205. that normally print messages to say what they are doing omit the
  18206. messages when called from command files.
  18207. GDB also accepts command input from standard input. In this mode,
  18208. normal output goes to standard output and error output goes to standard
  18209. error. Errors in a command file supplied on standard input do not
  18210. terminate execution of the command file--execution continues with the
  18211. next command.
  18212. gdb < cmds > log 2>&1
  18213. (The syntax above will vary depending on the shell used.) This
  18214. example will execute commands from the file 'cmds'. All output and
  18215. errors would be directed to 'log'.
  18216. Since commands stored on command files tend to be more general than
  18217. commands typed interactively, they frequently need to deal with
  18218. complicated situations, such as different or unexpected values of
  18219. variables and symbols, changes in how the program being debugged is
  18220. built, etc. GDB provides a set of flow-control commands to deal with
  18221. these complexities. Using these commands, you can write complex scripts
  18222. that loop over data structures, execute commands conditionally, etc.
  18223. 'if'
  18224. 'else'
  18225. This command allows to include in your script conditionally
  18226. executed commands. The 'if' command takes a single argument, which
  18227. is an expression to evaluate. It is followed by a series of
  18228. commands that are executed only if the expression is true (its
  18229. value is nonzero). There can then optionally be an 'else' line,
  18230. followed by a series of commands that are only executed if the
  18231. expression was false. The end of the list is marked by a line
  18232. containing 'end'.
  18233. 'while'
  18234. This command allows to write loops. Its syntax is similar to 'if':
  18235. the command takes a single argument, which is an expression to
  18236. evaluate, and must be followed by the commands to execute, one per
  18237. line, terminated by an 'end'. These commands are called the "body"
  18238. of the loop. The commands in the body of 'while' are executed
  18239. repeatedly as long as the expression evaluates to true.
  18240. 'loop_break'
  18241. This command exits the 'while' loop in whose body it is included.
  18242. Execution of the script continues after that 'while's 'end' line.
  18243. 'loop_continue'
  18244. This command skips the execution of the rest of the body of
  18245. commands in the 'while' loop in whose body it is included.
  18246. Execution branches to the beginning of the 'while' loop, where it
  18247. evaluates the controlling expression.
  18248. 'end'
  18249. Terminate the block of commands that are the body of 'if', 'else',
  18250. or 'while' flow-control commands.
  18251. 
  18252. File: gdb.info, Node: Output, Next: Auto-loading sequences, Prev: Command Files, Up: Sequences
  18253. 23.1.4 Commands for Controlled Output
  18254. -------------------------------------
  18255. During the execution of a command file or a user-defined command, normal
  18256. GDB output is suppressed; the only output that appears is what is
  18257. explicitly printed by the commands in the definition. This section
  18258. describes three commands useful for generating exactly the output you
  18259. want.
  18260. 'echo TEXT'
  18261. Print TEXT. Nonprinting characters can be included in TEXT using C
  18262. escape sequences, such as '\n' to print a newline. *No newline is
  18263. printed unless you specify one.* In addition to the standard C
  18264. escape sequences, a backslash followed by a space stands for a
  18265. space. This is useful for displaying a string with spaces at the
  18266. beginning or the end, since leading and trailing spaces are
  18267. otherwise trimmed from all arguments. To print ' and foo = ', use
  18268. the command 'echo \ and foo = \ '.
  18269. A backslash at the end of TEXT can be used, as in C, to continue
  18270. the command onto subsequent lines. For example,
  18271. echo This is some text\n\
  18272. which is continued\n\
  18273. onto several lines.\n
  18274. produces the same output as
  18275. echo This is some text\n
  18276. echo which is continued\n
  18277. echo onto several lines.\n
  18278. 'output EXPRESSION'
  18279. Print the value of EXPRESSION and nothing but that value: no
  18280. newlines, no '$NN = '. The value is not entered in the value
  18281. history either. *Note Expressions: Expressions, for more
  18282. information on expressions.
  18283. 'output/FMT EXPRESSION'
  18284. Print the value of EXPRESSION in format FMT. You can use the same
  18285. formats as for 'print'. *Note Output Formats: Output Formats, for
  18286. more information.
  18287. 'printf TEMPLATE, EXPRESSIONS...'
  18288. Print the values of one or more EXPRESSIONS under the control of
  18289. the string TEMPLATE. To print several values, make EXPRESSIONS be
  18290. a comma-separated list of individual expressions, which may be
  18291. either numbers or pointers. Their values are printed as specified
  18292. by TEMPLATE, exactly as a C program would do by executing the code
  18293. below:
  18294. printf (TEMPLATE, EXPRESSIONS...);
  18295. As in 'C' 'printf', ordinary characters in TEMPLATE are printed
  18296. verbatim, while "conversion specification" introduced by the '%'
  18297. character cause subsequent EXPRESSIONS to be evaluated, their
  18298. values converted and formatted according to type and style
  18299. information encoded in the conversion specifications, and then
  18300. printed.
  18301. For example, you can print two values in hex like this:
  18302. printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo
  18303. 'printf' supports all the standard 'C' conversion specifications,
  18304. including the flags and modifiers between the '%' character and the
  18305. conversion letter, with the following exceptions:
  18306. * The argument-ordering modifiers, such as '2$', are not
  18307. supported.
  18308. * The modifier '*' is not supported for specifying precision or
  18309. width.
  18310. * The ''' flag (for separation of digits into groups according
  18311. to 'LC_NUMERIC'') is not supported.
  18312. * The type modifiers 'hh', 'j', 't', and 'z' are not supported.
  18313. * The conversion letter 'n' (as in '%n') is not supported.
  18314. * The conversion letters 'a' and 'A' are not supported.
  18315. Note that the 'll' type modifier is supported only if the
  18316. underlying 'C' implementation used to build GDB supports the 'long
  18317. long int' type, and the 'L' type modifier is supported only if
  18318. 'long double' type is available.
  18319. As in 'C', 'printf' supports simple backslash-escape sequences,
  18320. such as '\n', '\t', '\\', '\"', '\a', and '\f', that consist of
  18321. backslash followed by a single character. Octal and hexadecimal
  18322. escape sequences are not supported.
  18323. Additionally, 'printf' supports conversion specifications for DFP
  18324. ("Decimal Floating Point") types using the following length
  18325. modifiers together with a floating point specifier. letters:
  18326. * 'H' for printing 'Decimal32' types.
  18327. * 'D' for printing 'Decimal64' types.
  18328. * 'DD' for printing 'Decimal128' types.
  18329. If the underlying 'C' implementation used to build GDB has support
  18330. for the three length modifiers for DFP types, other modifiers such
  18331. as width and precision will also be available for GDB to use.
  18332. In case there is no such 'C' support, no additional modifiers will
  18333. be available and the value will be printed in the standard way.
  18334. Here's an example of printing DFP types using the above conversion
  18335. letters:
  18336. printf "D32: %Hf - D64: %Df - D128: %DDf\n",1.2345df,1.2E10dd,1.2E1dl
  18337. 'eval TEMPLATE, EXPRESSIONS...'
  18338. Convert the values of one or more EXPRESSIONS under the control of
  18339. the string TEMPLATE to a command line, and call it.
  18340. 
  18341. File: gdb.info, Node: Auto-loading sequences, Prev: Output, Up: Sequences
  18342. 23.1.5 Controlling auto-loading native GDB scripts
  18343. --------------------------------------------------
  18344. When a new object file is read (for example, due to the 'file' command,
  18345. or because the inferior has loaded a shared library), GDB will look for
  18346. the command file 'OBJFILE-gdb.gdb'. *Note Auto-loading extensions::.
  18347. Auto-loading can be enabled or disabled, and the list of auto-loaded
  18348. scripts can be printed.
  18349. 'set auto-load gdb-scripts [on|off]'
  18350. Enable or disable the auto-loading of canned sequences of commands
  18351. scripts.
  18352. 'show auto-load gdb-scripts'
  18353. Show whether auto-loading of canned sequences of commands scripts
  18354. is enabled or disabled.
  18355. 'info auto-load gdb-scripts [REGEXP]'
  18356. Print the list of all canned sequences of commands scripts that GDB
  18357. auto-loaded.
  18358. If REGEXP is supplied only canned sequences of commands scripts with
  18359. matching names are printed.
  18360. 
  18361. File: gdb.info, Node: Python, Next: Guile, Prev: Sequences, Up: Extending GDB
  18362. 23.2 Extending GDB using Python
  18363. ===============================
  18364. You can extend GDB using the Python programming language
  18365. (http://www.python.org/). This feature is available only if GDB was
  18366. configured using '--with-python'. GDB can be built against either
  18367. Python 2 or Python 3; which one you have depends on this configure-time
  18368. option.
  18369. Python scripts used by GDB should be installed in
  18370. 'DATA-DIRECTORY/python', where DATA-DIRECTORY is the data directory as
  18371. determined at GDB startup (*note Data Files::). This directory, known
  18372. as the "python directory", is automatically added to the Python Search
  18373. Path in order to allow the Python interpreter to locate all scripts
  18374. installed at this location.
  18375. Additionally, GDB commands and convenience functions which are
  18376. written in Python and are located in the
  18377. 'DATA-DIRECTORY/python/gdb/command' or
  18378. 'DATA-DIRECTORY/python/gdb/function' directories are automatically
  18379. imported when GDB starts.
  18380. * Menu:
  18381. * Python Commands:: Accessing Python from GDB.
  18382. * Python API:: Accessing GDB from Python.
  18383. * Python Auto-loading:: Automatically loading Python code.
  18384. * Python modules:: Python modules provided by GDB.
  18385. 
  18386. File: gdb.info, Node: Python Commands, Next: Python API, Up: Python
  18387. 23.2.1 Python Commands
  18388. ----------------------
  18389. GDB provides two commands for accessing the Python interpreter, and one
  18390. related setting:
  18391. 'python-interactive [COMMAND]'
  18392. 'pi [COMMAND]'
  18393. Without an argument, the 'python-interactive' command can be used
  18394. to start an interactive Python prompt. To return to GDB, type the
  18395. 'EOF' character (e.g., 'Ctrl-D' on an empty prompt).
  18396. Alternatively, a single-line Python command can be given as an
  18397. argument and evaluated. If the command is an expression, the
  18398. result will be printed; otherwise, nothing will be printed. For
  18399. example:
  18400. (gdb) python-interactive 2 + 3
  18401. 5
  18402. 'python [COMMAND]'
  18403. 'py [COMMAND]'
  18404. The 'python' command can be used to evaluate Python code.
  18405. If given an argument, the 'python' command will evaluate the
  18406. argument as a Python command. For example:
  18407. (gdb) python print 23
  18408. 23
  18409. If you do not provide an argument to 'python', it will act as a
  18410. multi-line command, like 'define'. In this case, the Python script
  18411. is made up of subsequent command lines, given after the 'python'
  18412. command. This command list is terminated using a line containing
  18413. 'end'. For example:
  18414. (gdb) python
  18415. >print 23
  18416. >end
  18417. 23
  18418. 'set python print-stack'
  18419. By default, GDB will print only the message component of a Python
  18420. exception when an error occurs in a Python script. This can be
  18421. controlled using 'set python print-stack': if 'full', then full
  18422. Python stack printing is enabled; if 'none', then Python stack and
  18423. message printing is disabled; if 'message', the default, only the
  18424. message component of the error is printed.
  18425. It is also possible to execute a Python script from the GDB
  18426. interpreter:
  18427. 'source script-name'
  18428. The script name must end with '.py' and GDB must be configured to
  18429. recognize the script language based on filename extension using the
  18430. 'script-extension' setting. *Note Extending GDB: Extending GDB.
  18431. 
  18432. File: gdb.info, Node: Python API, Next: Python Auto-loading, Prev: Python Commands, Up: Python
  18433. 23.2.2 Python API
  18434. -----------------
  18435. You can get quick online help for GDB's Python API by issuing the
  18436. command 'python help (gdb)'.
  18437. Functions and methods which have two or more optional arguments allow
  18438. them to be specified using keyword syntax. This allows passing some
  18439. optional arguments while skipping others. Example:
  18440. 'gdb.some_function ('foo', bar = 1, baz = 2)'.
  18441. * Menu:
  18442. * Basic Python:: Basic Python Functions.
  18443. * Exception Handling:: How Python exceptions are translated.
  18444. * Values From Inferior:: Python representation of values.
  18445. * Types In Python:: Python representation of types.
  18446. * Pretty Printing API:: Pretty-printing values.
  18447. * Selecting Pretty-Printers:: How GDB chooses a pretty-printer.
  18448. * Writing a Pretty-Printer:: Writing a Pretty-Printer.
  18449. * Type Printing API:: Pretty-printing types.
  18450. * Frame Filter API:: Filtering Frames.
  18451. * Frame Decorator API:: Decorating Frames.
  18452. * Writing a Frame Filter:: Writing a Frame Filter.
  18453. * Unwinding Frames in Python:: Writing frame unwinder.
  18454. * Xmethods In Python:: Adding and replacing methods of C++ classes.
  18455. * Xmethod API:: Xmethod types.
  18456. * Writing an Xmethod:: Writing an xmethod.
  18457. * Inferiors In Python:: Python representation of inferiors (processes)
  18458. * Events In Python:: Listening for events from GDB.
  18459. * Threads In Python:: Accessing inferior threads from Python.
  18460. * Recordings In Python:: Accessing recordings from Python.
  18461. * Commands In Python:: Implementing new commands in Python.
  18462. * Parameters In Python:: Adding new GDB parameters.
  18463. * Functions In Python:: Writing new convenience functions.
  18464. * Progspaces In Python:: Program spaces.
  18465. * Objfiles In Python:: Object files.
  18466. * Frames In Python:: Accessing inferior stack frames from Python.
  18467. * Blocks In Python:: Accessing blocks from Python.
  18468. * Symbols In Python:: Python representation of symbols.
  18469. * Symbol Tables In Python:: Python representation of symbol tables.
  18470. * Line Tables In Python:: Python representation of line tables.
  18471. * Breakpoints In Python:: Manipulating breakpoints using Python.
  18472. * Finish Breakpoints in Python:: Setting Breakpoints on function return
  18473. using Python.
  18474. * Lazy Strings In Python:: Python representation of lazy strings.
  18475. * Architectures In Python:: Python representation of architectures.
  18476. * Registers In Python:: Python representation of registers.
  18477. * TUI Windows In Python:: Implementing new TUI windows.
  18478. 
  18479. File: gdb.info, Node: Basic Python, Next: Exception Handling, Up: Python API
  18480. 23.2.2.1 Basic Python
  18481. .....................
  18482. At startup, GDB overrides Python's 'sys.stdout' and 'sys.stderr' to
  18483. print using GDB's output-paging streams. A Python program which outputs
  18484. to one of these streams may have its output interrupted by the user
  18485. (*note Screen Size::). In this situation, a Python 'KeyboardInterrupt'
  18486. exception is thrown.
  18487. Some care must be taken when writing Python code to run in GDB. Two
  18488. things worth noting in particular:
  18489. * GDB install handlers for 'SIGCHLD' and 'SIGINT'. Python code must
  18490. not override these, or even change the options using 'sigaction'.
  18491. If your program changes the handling of these signals, GDB will
  18492. most likely stop working correctly. Note that it is unfortunately
  18493. common for GUI toolkits to install a 'SIGCHLD' handler.
  18494. * GDB takes care to mark its internal file descriptors as
  18495. close-on-exec. However, this cannot be done in a thread-safe way
  18496. on all platforms. Your Python programs should be aware of this and
  18497. should both create new file descriptors with the close-on-exec flag
  18498. set and arrange to close unneeded file descriptors before starting
  18499. a child process.
  18500. GDB introduces a new Python module, named 'gdb'. All methods and
  18501. classes added by GDB are placed in this module. GDB automatically
  18502. 'import's the 'gdb' module for use in all scripts evaluated by the
  18503. 'python' command.
  18504. Some types of the 'gdb' module come with a textual representation
  18505. (accessible through the 'repr' or 'str' functions). These are offered
  18506. for debugging purposes only, expect them to change over time.
  18507. -- Variable: gdb.PYTHONDIR
  18508. A string containing the python directory (*note Python::).
  18509. -- Function: gdb.execute (command [, from_tty [, to_string]])
  18510. Evaluate COMMAND, a string, as a GDB CLI command. If a GDB
  18511. exception happens while COMMAND runs, it is translated as described
  18512. in *note Exception Handling: Exception Handling.
  18513. The FROM_TTY flag specifies whether GDB ought to consider this
  18514. command as having originated from the user invoking it
  18515. interactively. It must be a boolean value. If omitted, it
  18516. defaults to 'False'.
  18517. By default, any output produced by COMMAND is sent to GDB's
  18518. standard output (and to the log output if logging is turned on).
  18519. If the TO_STRING parameter is 'True', then output will be collected
  18520. by 'gdb.execute' and returned as a string. The default is 'False',
  18521. in which case the return value is 'None'. If TO_STRING is 'True',
  18522. the GDB virtual terminal will be temporarily set to unlimited width
  18523. and height, and its pagination will be disabled; *note Screen
  18524. Size::.
  18525. -- Function: gdb.breakpoints ()
  18526. Return a sequence holding all of GDB's breakpoints. *Note
  18527. Breakpoints In Python::, for more information. In GDB version 7.11
  18528. and earlier, this function returned 'None' if there were no
  18529. breakpoints. This peculiarity was subsequently fixed, and now
  18530. 'gdb.breakpoints' returns an empty sequence in this case.
  18531. -- Function: gdb.rbreak (regex [, minsyms [, throttle, [, symtabs ]]])
  18532. Return a Python list holding a collection of newly set
  18533. 'gdb.Breakpoint' objects matching function names defined by the
  18534. REGEX pattern. If the MINSYMS keyword is 'True', all system
  18535. functions (those not explicitly defined in the inferior) will also
  18536. be included in the match. The THROTTLE keyword takes an integer
  18537. that defines the maximum number of pattern matches for functions
  18538. matched by the REGEX pattern. If the number of matches exceeds the
  18539. integer value of THROTTLE, a 'RuntimeError' will be raised and no
  18540. breakpoints will be created. If THROTTLE is not defined then there
  18541. is no imposed limit on the maximum number of matches and
  18542. breakpoints to be created. The SYMTABS keyword takes a Python
  18543. iterable that yields a collection of 'gdb.Symtab' objects and will
  18544. restrict the search to those functions only contained within the
  18545. 'gdb.Symtab' objects.
  18546. -- Function: gdb.parameter (parameter)
  18547. Return the value of a GDB PARAMETER given by its name, a string;
  18548. the parameter name string may contain spaces if the parameter has a
  18549. multi-part name. For example, 'print object' is a valid parameter
  18550. name.
  18551. If the named parameter does not exist, this function throws a
  18552. 'gdb.error' (*note Exception Handling::). Otherwise, the
  18553. parameter's value is converted to a Python value of the appropriate
  18554. type, and returned.
  18555. -- Function: gdb.history (number)
  18556. Return a value from GDB's value history (*note Value History::).
  18557. The NUMBER argument indicates which history element to return. If
  18558. NUMBER is negative, then GDB will take its absolute value and count
  18559. backward from the last element (i.e., the most recent element) to
  18560. find the value to return. If NUMBER is zero, then GDB will return
  18561. the most recent element. If the element specified by NUMBER
  18562. doesn't exist in the value history, a 'gdb.error' exception will be
  18563. raised.
  18564. If no exception is raised, the return value is always an instance
  18565. of 'gdb.Value' (*note Values From Inferior::).
  18566. -- Function: gdb.convenience_variable (name)
  18567. Return the value of the convenience variable (*note Convenience
  18568. Vars::) named NAME. NAME must be a string. The name should not
  18569. include the '$' that is used to mark a convenience variable in an
  18570. expression. If the convenience variable does not exist, then
  18571. 'None' is returned.
  18572. -- Function: gdb.set_convenience_variable (name, value)
  18573. Set the value of the convenience variable (*note Convenience
  18574. Vars::) named NAME. NAME must be a string. The name should not
  18575. include the '$' that is used to mark a convenience variable in an
  18576. expression. If VALUE is 'None', then the convenience variable is
  18577. removed. Otherwise, if VALUE is not a 'gdb.Value' (*note Values
  18578. From Inferior::), it is is converted using the 'gdb.Value'
  18579. constructor.
  18580. -- Function: gdb.parse_and_eval (expression)
  18581. Parse EXPRESSION, which must be a string, as an expression in the
  18582. current language, evaluate it, and return the result as a
  18583. 'gdb.Value'.
  18584. This function can be useful when implementing a new command (*note
  18585. Commands In Python::), as it provides a way to parse the command's
  18586. argument as an expression. It is also useful simply to compute
  18587. values.
  18588. -- Function: gdb.find_pc_line (pc)
  18589. Return the 'gdb.Symtab_and_line' object corresponding to the PC
  18590. value. *Note Symbol Tables In Python::. If an invalid value of PC
  18591. is passed as an argument, then the 'symtab' and 'line' attributes
  18592. of the returned 'gdb.Symtab_and_line' object will be 'None' and 0
  18593. respectively. This is identical to
  18594. 'gdb.current_progspace().find_pc_line(pc)' and is included for
  18595. historical compatibility.
  18596. -- Function: gdb.post_event (event)
  18597. Put EVENT, a callable object taking no arguments, into GDB's
  18598. internal event queue. This callable will be invoked at some later
  18599. point, during GDB's event processing. Events posted using
  18600. 'post_event' will be run in the order in which they were posted;
  18601. however, there is no way to know when they will be processed
  18602. relative to other events inside GDB.
  18603. GDB is not thread-safe. If your Python program uses multiple
  18604. threads, you must be careful to only call GDB-specific functions in
  18605. the GDB thread. 'post_event' ensures this. For example:
  18606. (gdb) python
  18607. >import threading
  18608. >
  18609. >class Writer():
  18610. > def __init__(self, message):
  18611. > self.message = message;
  18612. > def __call__(self):
  18613. > gdb.write(self.message)
  18614. >
  18615. >class MyThread1 (threading.Thread):
  18616. > def run (self):
  18617. > gdb.post_event(Writer("Hello "))
  18618. >
  18619. >class MyThread2 (threading.Thread):
  18620. > def run (self):
  18621. > gdb.post_event(Writer("World\n"))
  18622. >
  18623. >MyThread1().start()
  18624. >MyThread2().start()
  18625. >end
  18626. (gdb) Hello World
  18627. -- Function: gdb.write (string [, stream])
  18628. Print a string to GDB's paginated output stream. The optional
  18629. STREAM determines the stream to print to. The default stream is
  18630. GDB's standard output stream. Possible stream values are:
  18631. 'gdb.STDOUT'
  18632. GDB's standard output stream.
  18633. 'gdb.STDERR'
  18634. GDB's standard error stream.
  18635. 'gdb.STDLOG'
  18636. GDB's log stream (*note Logging Output::).
  18637. Writing to 'sys.stdout' or 'sys.stderr' will automatically call
  18638. this function and will automatically direct the output to the
  18639. relevant stream.
  18640. -- Function: gdb.flush ()
  18641. Flush the buffer of a GDB paginated stream so that the contents are
  18642. displayed immediately. GDB will flush the contents of a stream
  18643. automatically when it encounters a newline in the buffer. The
  18644. optional STREAM determines the stream to flush. The default stream
  18645. is GDB's standard output stream. Possible stream values are:
  18646. 'gdb.STDOUT'
  18647. GDB's standard output stream.
  18648. 'gdb.STDERR'
  18649. GDB's standard error stream.
  18650. 'gdb.STDLOG'
  18651. GDB's log stream (*note Logging Output::).
  18652. Flushing 'sys.stdout' or 'sys.stderr' will automatically call this
  18653. function for the relevant stream.
  18654. -- Function: gdb.target_charset ()
  18655. Return the name of the current target character set (*note
  18656. Character Sets::). This differs from
  18657. 'gdb.parameter('target-charset')' in that 'auto' is never returned.
  18658. -- Function: gdb.target_wide_charset ()
  18659. Return the name of the current target wide character set (*note
  18660. Character Sets::). This differs from
  18661. 'gdb.parameter('target-wide-charset')' in that 'auto' is never
  18662. returned.
  18663. -- Function: gdb.solib_name (address)
  18664. Return the name of the shared library holding the given ADDRESS as
  18665. a string, or 'None'. This is identical to
  18666. 'gdb.current_progspace().solib_name(address)' and is included for
  18667. historical compatibility.
  18668. -- Function: gdb.decode_line ([expression])
  18669. Return locations of the line specified by EXPRESSION, or of the
  18670. current line if no argument was given. This function returns a
  18671. Python tuple containing two elements. The first element contains a
  18672. string holding any unparsed section of EXPRESSION (or 'None' if the
  18673. expression has been fully parsed). The second element contains
  18674. either 'None' or another tuple that contains all the locations that
  18675. match the expression represented as 'gdb.Symtab_and_line' objects
  18676. (*note Symbol Tables In Python::). If EXPRESSION is provided, it
  18677. is decoded the way that GDB's inbuilt 'break' or 'edit' commands do
  18678. (*note Specify Location::).
  18679. -- Function: gdb.prompt_hook (current_prompt)
  18680. If PROMPT_HOOK is callable, GDB will call the method assigned to
  18681. this operation before a prompt is displayed by GDB.
  18682. The parameter 'current_prompt' contains the current GDB prompt.
  18683. This method must return a Python string, or 'None'. If a string is
  18684. returned, the GDB prompt will be set to that string. If 'None' is
  18685. returned, GDB will continue to use the current prompt.
  18686. Some prompts cannot be substituted in GDB. Secondary prompts such
  18687. as those used by readline for command input, and annotation related
  18688. prompts are prohibited from being changed.
  18689. 
  18690. File: gdb.info, Node: Exception Handling, Next: Values From Inferior, Prev: Basic Python, Up: Python API
  18691. 23.2.2.2 Exception Handling
  18692. ...........................
  18693. When executing the 'python' command, Python exceptions uncaught within
  18694. the Python code are translated to calls to GDB error-reporting
  18695. mechanism. If the command that called 'python' does not handle the
  18696. error, GDB will terminate it and print an error message containing the
  18697. Python exception name, the associated value, and the Python call stack
  18698. backtrace at the point where the exception was raised. Example:
  18699. (gdb) python print foo
  18700. Traceback (most recent call last):
  18701. File "<string>", line 1, in <module>
  18702. NameError: name 'foo' is not defined
  18703. GDB errors that happen in GDB commands invoked by Python code are
  18704. converted to Python exceptions. The type of the Python exception
  18705. depends on the error.
  18706. 'gdb.error'
  18707. This is the base class for most exceptions generated by GDB. It is
  18708. derived from 'RuntimeError', for compatibility with earlier
  18709. versions of GDB.
  18710. If an error occurring in GDB does not fit into some more specific
  18711. category, then the generated exception will have this type.
  18712. 'gdb.MemoryError'
  18713. This is a subclass of 'gdb.error' which is thrown when an operation
  18714. tried to access invalid memory in the inferior.
  18715. 'KeyboardInterrupt'
  18716. User interrupt (via 'C-c' or by typing 'q' at a pagination prompt)
  18717. is translated to a Python 'KeyboardInterrupt' exception.
  18718. In all cases, your exception handler will see the GDB error message
  18719. as its value and the Python call stack backtrace at the Python statement
  18720. closest to where the GDB error occured as the traceback.
  18721. When implementing GDB commands in Python via 'gdb.Command', or
  18722. functions via 'gdb.Function', it is useful to be able to throw an
  18723. exception that doesn't cause a traceback to be printed. For example,
  18724. the user may have invoked the command incorrectly. GDB provides a
  18725. special exception class that can be used for this purpose.
  18726. 'gdb.GdbError'
  18727. When thrown from a command or function, this exception will cause
  18728. the command or function to fail, but the Python stack will not be
  18729. displayed. GDB does not throw this exception itself, but rather
  18730. recognizes it when thrown from user Python code. Example:
  18731. (gdb) python
  18732. >class HelloWorld (gdb.Command):
  18733. > """Greet the whole world."""
  18734. > def __init__ (self):
  18735. > super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
  18736. > def invoke (self, args, from_tty):
  18737. > argv = gdb.string_to_argv (args)
  18738. > if len (argv) != 0:
  18739. > raise gdb.GdbError ("hello-world takes no arguments")
  18740. > print "Hello, World!"
  18741. >HelloWorld ()
  18742. >end
  18743. (gdb) hello-world 42
  18744. hello-world takes no arguments
  18745. 
  18746. File: gdb.info, Node: Values From Inferior, Next: Types In Python, Prev: Exception Handling, Up: Python API
  18747. 23.2.2.3 Values From Inferior
  18748. .............................
  18749. GDB provides values it obtains from the inferior program in an object of
  18750. type 'gdb.Value'. GDB uses this object for its internal bookkeeping of
  18751. the inferior's values, and for fetching values when necessary.
  18752. Inferior values that are simple scalars can be used directly in
  18753. Python expressions that are valid for the value's data type. Here's an
  18754. example for an integer or floating-point value 'some_val':
  18755. bar = some_val + 2
  18756. As result of this, 'bar' will also be a 'gdb.Value' object whose values
  18757. are of the same type as those of 'some_val'. Valid Python operations
  18758. can also be performed on 'gdb.Value' objects representing a 'struct' or
  18759. 'class' object. For such cases, the overloaded operator (if present),
  18760. is used to perform the operation. For example, if 'val1' and 'val2' are
  18761. 'gdb.Value' objects representing instances of a 'class' which overloads
  18762. the '+' operator, then one can use the '+' operator in their Python
  18763. script as follows:
  18764. val3 = val1 + val2
  18765. The result of the operation 'val3' is also a 'gdb.Value' object
  18766. corresponding to the value returned by the overloaded '+' operator. In
  18767. general, overloaded operators are invoked for the following operations:
  18768. '+' (binary addition), '-' (binary subtraction), '*' (multiplication),
  18769. '/', '%', '<<', '>>', '|', '&', '^'.
  18770. Inferior values that are structures or instances of some class can be
  18771. accessed using the Python "dictionary syntax". For example, if
  18772. 'some_val' is a 'gdb.Value' instance holding a structure, you can access
  18773. its 'foo' element with:
  18774. bar = some_val['foo']
  18775. Again, 'bar' will also be a 'gdb.Value' object. Structure elements
  18776. can also be accessed by using 'gdb.Field' objects as subscripts (*note
  18777. Types In Python::, for more information on 'gdb.Field' objects). For
  18778. example, if 'foo_field' is a 'gdb.Field' object corresponding to element
  18779. 'foo' of the above structure, then 'bar' can also be accessed as
  18780. follows:
  18781. bar = some_val[foo_field]
  18782. A 'gdb.Value' that represents a function can be executed via inferior
  18783. function call. Any arguments provided to the call must match the
  18784. function's prototype, and must be provided in the order specified by
  18785. that prototype.
  18786. For example, 'some_val' is a 'gdb.Value' instance representing a
  18787. function that takes two integers as arguments. To execute this
  18788. function, call it like so:
  18789. result = some_val (10,20)
  18790. Any values returned from a function call will be stored as a
  18791. 'gdb.Value'.
  18792. The following attributes are provided:
  18793. -- Variable: Value.address
  18794. If this object is addressable, this read-only attribute holds a
  18795. 'gdb.Value' object representing the address. Otherwise, this
  18796. attribute holds 'None'.
  18797. -- Variable: Value.is_optimized_out
  18798. This read-only boolean attribute is true if the compiler optimized
  18799. out this value, thus it is not available for fetching from the
  18800. inferior.
  18801. -- Variable: Value.type
  18802. The type of this 'gdb.Value'. The value of this attribute is a
  18803. 'gdb.Type' object (*note Types In Python::).
  18804. -- Variable: Value.dynamic_type
  18805. The dynamic type of this 'gdb.Value'. This uses the object's
  18806. virtual table and the C++ run-time type information (RTTI) to
  18807. determine the dynamic type of the value. If this value is of class
  18808. type, it will return the class in which the value is embedded, if
  18809. any. If this value is of pointer or reference to a class type, it
  18810. will compute the dynamic type of the referenced object, and return
  18811. a pointer or reference to that type, respectively. In all other
  18812. cases, it will return the value's static type.
  18813. Note that this feature will only work when debugging a C++ program
  18814. that includes RTTI for the object in question. Otherwise, it will
  18815. just return the static type of the value as in 'ptype foo' (*note
  18816. ptype: Symbols.).
  18817. -- Variable: Value.is_lazy
  18818. The value of this read-only boolean attribute is 'True' if this
  18819. 'gdb.Value' has not yet been fetched from the inferior. GDB does
  18820. not fetch values until necessary, for efficiency. For example:
  18821. myval = gdb.parse_and_eval ('somevar')
  18822. The value of 'somevar' is not fetched at this time. It will be
  18823. fetched when the value is needed, or when the 'fetch_lazy' method
  18824. is invoked.
  18825. The following methods are provided:
  18826. -- Function: Value.__init__ (VAL)
  18827. Many Python values can be converted directly to a 'gdb.Value' via
  18828. this object initializer. Specifically:
  18829. Python boolean
  18830. A Python boolean is converted to the boolean type from the
  18831. current language.
  18832. Python integer
  18833. A Python integer is converted to the C 'long' type for the
  18834. current architecture.
  18835. Python long
  18836. A Python long is converted to the C 'long long' type for the
  18837. current architecture.
  18838. Python float
  18839. A Python float is converted to the C 'double' type for the
  18840. current architecture.
  18841. Python string
  18842. A Python string is converted to a target string in the current
  18843. target language using the current target encoding. If a
  18844. character cannot be represented in the current target
  18845. encoding, then an exception is thrown.
  18846. 'gdb.Value'
  18847. If 'val' is a 'gdb.Value', then a copy of the value is made.
  18848. 'gdb.LazyString'
  18849. If 'val' is a 'gdb.LazyString' (*note Lazy Strings In
  18850. Python::), then the lazy string's 'value' method is called,
  18851. and its result is used.
  18852. -- Function: Value.__init__ (VAL, TYPE)
  18853. This second form of the 'gdb.Value' constructor returns a
  18854. 'gdb.Value' of type TYPE where the value contents are taken from
  18855. the Python buffer object specified by VAL. The number of bytes in
  18856. the Python buffer object must be greater than or equal to the size
  18857. of TYPE.
  18858. -- Function: Value.cast (type)
  18859. Return a new instance of 'gdb.Value' that is the result of casting
  18860. this instance to the type described by TYPE, which must be a
  18861. 'gdb.Type' object. If the cast cannot be performed for some
  18862. reason, this method throws an exception.
  18863. -- Function: Value.dereference ()
  18864. For pointer data types, this method returns a new 'gdb.Value'
  18865. object whose contents is the object pointed to by the pointer. For
  18866. example, if 'foo' is a C pointer to an 'int', declared in your C
  18867. program as
  18868. int *foo;
  18869. then you can use the corresponding 'gdb.Value' to access what 'foo'
  18870. points to like this:
  18871. bar = foo.dereference ()
  18872. The result 'bar' will be a 'gdb.Value' object holding the value
  18873. pointed to by 'foo'.
  18874. A similar function 'Value.referenced_value' exists which also
  18875. returns 'gdb.Value' objects corresponding to the values pointed to
  18876. by pointer values (and additionally, values referenced by reference
  18877. values). However, the behavior of 'Value.dereference' differs from
  18878. 'Value.referenced_value' by the fact that the behavior of
  18879. 'Value.dereference' is identical to applying the C unary operator
  18880. '*' on a given value. For example, consider a reference to a
  18881. pointer 'ptrref', declared in your C++ program as
  18882. typedef int *intptr;
  18883. ...
  18884. int val = 10;
  18885. intptr ptr = &val;
  18886. intptr &ptrref = ptr;
  18887. Though 'ptrref' is a reference value, one can apply the method
  18888. 'Value.dereference' to the 'gdb.Value' object corresponding to it
  18889. and obtain a 'gdb.Value' which is identical to that corresponding
  18890. to 'val'. However, if you apply the method
  18891. 'Value.referenced_value', the result would be a 'gdb.Value' object
  18892. identical to that corresponding to 'ptr'.
  18893. py_ptrref = gdb.parse_and_eval ("ptrref")
  18894. py_val = py_ptrref.dereference ()
  18895. py_ptr = py_ptrref.referenced_value ()
  18896. The 'gdb.Value' object 'py_val' is identical to that corresponding
  18897. to 'val', and 'py_ptr' is identical to that corresponding to 'ptr'.
  18898. In general, 'Value.dereference' can be applied whenever the C unary
  18899. operator '*' can be applied to the corresponding C value. For
  18900. those cases where applying both 'Value.dereference' and
  18901. 'Value.referenced_value' is allowed, the results obtained need not
  18902. be identical (as we have seen in the above example). The results
  18903. are however identical when applied on 'gdb.Value' objects
  18904. corresponding to pointers ('gdb.Value' objects with type code
  18905. 'TYPE_CODE_PTR') in a C/C++ program.
  18906. -- Function: Value.referenced_value ()
  18907. For pointer or reference data types, this method returns a new
  18908. 'gdb.Value' object corresponding to the value referenced by the
  18909. pointer/reference value. For pointer data types,
  18910. 'Value.dereference' and 'Value.referenced_value' produce identical
  18911. results. The difference between these methods is that
  18912. 'Value.dereference' cannot get the values referenced by reference
  18913. values. For example, consider a reference to an 'int', declared in
  18914. your C++ program as
  18915. int val = 10;
  18916. int &ref = val;
  18917. then applying 'Value.dereference' to the 'gdb.Value' object
  18918. corresponding to 'ref' will result in an error, while applying
  18919. 'Value.referenced_value' will result in a 'gdb.Value' object
  18920. identical to that corresponding to 'val'.
  18921. py_ref = gdb.parse_and_eval ("ref")
  18922. er_ref = py_ref.dereference () # Results in error
  18923. py_val = py_ref.referenced_value () # Returns the referenced value
  18924. The 'gdb.Value' object 'py_val' is identical to that corresponding
  18925. to 'val'.
  18926. -- Function: Value.reference_value ()
  18927. Return a 'gdb.Value' object which is a reference to the value
  18928. encapsulated by this instance.
  18929. -- Function: Value.const_value ()
  18930. Return a 'gdb.Value' object which is a 'const' version of the value
  18931. encapsulated by this instance.
  18932. -- Function: Value.dynamic_cast (type)
  18933. Like 'Value.cast', but works as if the C++ 'dynamic_cast' operator
  18934. were used. Consult a C++ reference for details.
  18935. -- Function: Value.reinterpret_cast (type)
  18936. Like 'Value.cast', but works as if the C++ 'reinterpret_cast'
  18937. operator were used. Consult a C++ reference for details.
  18938. -- Function: Value.format_string (...)
  18939. Convert a 'gdb.Value' to a string, similarly to what the 'print'
  18940. command does. Invoked with no arguments, this is equivalent to
  18941. calling the 'str' function on the 'gdb.Value'. The representation
  18942. of the same value may change across different versions of GDB, so
  18943. you shouldn't, for instance, parse the strings returned by this
  18944. method.
  18945. All the arguments are keyword only. If an argument is not
  18946. specified, the current global default setting is used.
  18947. 'raw'
  18948. 'True' if pretty-printers (*note Pretty Printing::) should not
  18949. be used to format the value. 'False' if enabled
  18950. pretty-printers matching the type represented by the
  18951. 'gdb.Value' should be used to format it.
  18952. 'pretty_arrays'
  18953. 'True' if arrays should be pretty printed to be more
  18954. convenient to read, 'False' if they shouldn't (see 'set print
  18955. array' in *note Print Settings::).
  18956. 'pretty_structs'
  18957. 'True' if structs should be pretty printed to be more
  18958. convenient to read, 'False' if they shouldn't (see 'set print
  18959. pretty' in *note Print Settings::).
  18960. 'array_indexes'
  18961. 'True' if array indexes should be included in the string
  18962. representation of arrays, 'False' if they shouldn't (see 'set
  18963. print array-indexes' in *note Print Settings::).
  18964. 'symbols'
  18965. 'True' if the string representation of a pointer should
  18966. include the corresponding symbol name (if one exists), 'False'
  18967. if it shouldn't (see 'set print symbol' in *note Print
  18968. Settings::).
  18969. 'unions'
  18970. 'True' if unions which are contained in other structures or
  18971. unions should be expanded, 'False' if they shouldn't (see 'set
  18972. print union' in *note Print Settings::).
  18973. 'deref_refs'
  18974. 'True' if C++ references should be resolved to the value they
  18975. refer to, 'False' (the default) if they shouldn't. Note that,
  18976. unlike for the 'print' command, references are not
  18977. automatically expanded when using the 'format_string' method
  18978. or the 'str' function. There is no global 'print' setting to
  18979. change the default behaviour.
  18980. 'actual_objects'
  18981. 'True' if the representation of a pointer to an object should
  18982. identify the _actual_ (derived) type of the object rather than
  18983. the _declared_ type, using the virtual function table.
  18984. 'False' if the _declared_ type should be used. (See 'set
  18985. print object' in *note Print Settings::).
  18986. 'static_fields'
  18987. 'True' if static members should be included in the string
  18988. representation of a C++ object, 'False' if they shouldn't (see
  18989. 'set print static-members' in *note Print Settings::).
  18990. 'max_elements'
  18991. Number of array elements to print, or '0' to print an
  18992. unlimited number of elements (see 'set print elements' in
  18993. *note Print Settings::).
  18994. 'max_depth'
  18995. The maximum depth to print for nested structs and unions, or
  18996. '-1' to print an unlimited number of elements (see 'set print
  18997. max-depth' in *note Print Settings::).
  18998. 'repeat_threshold'
  18999. Set the threshold for suppressing display of repeated array
  19000. elements, or '0' to represent all elements, even if repeated.
  19001. (See 'set print repeats' in *note Print Settings::).
  19002. 'format'
  19003. A string containing a single character representing the format
  19004. to use for the returned string. For instance, ''x'' is
  19005. equivalent to using the GDB command 'print' with the '/x'
  19006. option and formats the value as a hexadecimal number.
  19007. -- Function: Value.string ([encoding[, errors[, length]]])
  19008. If this 'gdb.Value' represents a string, then this method converts
  19009. the contents to a Python string. Otherwise, this method will throw
  19010. an exception.
  19011. Values are interpreted as strings according to the rules of the
  19012. current language. If the optional length argument is given, the
  19013. string will be converted to that length, and will include any
  19014. embedded zeroes that the string may contain. Otherwise, for
  19015. languages where the string is zero-terminated, the entire string
  19016. will be converted.
  19017. For example, in C-like languages, a value is a string if it is a
  19018. pointer to or an array of characters or ints of type 'wchar_t',
  19019. 'char16_t', or 'char32_t'.
  19020. If the optional ENCODING argument is given, it must be a string
  19021. naming the encoding of the string in the 'gdb.Value', such as
  19022. '"ascii"', '"iso-8859-6"' or '"utf-8"'. It accepts the same
  19023. encodings as the corresponding argument to Python's 'string.decode'
  19024. method, and the Python codec machinery will be used to convert the
  19025. string. If ENCODING is not given, or if ENCODING is the empty
  19026. string, then either the 'target-charset' (*note Character Sets::)
  19027. will be used, or a language-specific encoding will be used, if the
  19028. current language is able to supply one.
  19029. The optional ERRORS argument is the same as the corresponding
  19030. argument to Python's 'string.decode' method.
  19031. If the optional LENGTH argument is given, the string will be
  19032. fetched and converted to the given length.
  19033. -- Function: Value.lazy_string ([encoding [, length]])
  19034. If this 'gdb.Value' represents a string, then this method converts
  19035. the contents to a 'gdb.LazyString' (*note Lazy Strings In
  19036. Python::). Otherwise, this method will throw an exception.
  19037. If the optional ENCODING argument is given, it must be a string
  19038. naming the encoding of the 'gdb.LazyString'. Some examples are:
  19039. 'ascii', 'iso-8859-6' or 'utf-8'. If the ENCODING argument is an
  19040. encoding that GDB does recognize, GDB will raise an error.
  19041. When a lazy string is printed, the GDB encoding machinery is used
  19042. to convert the string during printing. If the optional ENCODING
  19043. argument is not provided, or is an empty string, GDB will
  19044. automatically select the encoding most suitable for the string
  19045. type. For further information on encoding in GDB please see *note
  19046. Character Sets::.
  19047. If the optional LENGTH argument is given, the string will be
  19048. fetched and encoded to the length of characters specified. If the
  19049. LENGTH argument is not provided, the string will be fetched and
  19050. encoded until a null of appropriate width is found.
  19051. -- Function: Value.fetch_lazy ()
  19052. If the 'gdb.Value' object is currently a lazy value
  19053. ('gdb.Value.is_lazy' is 'True'), then the value is fetched from the
  19054. inferior. Any errors that occur in the process will produce a
  19055. Python exception.
  19056. If the 'gdb.Value' object is not a lazy value, this method has no
  19057. effect.
  19058. This method does not return a value.
  19059. 
  19060. File: gdb.info, Node: Types In Python, Next: Pretty Printing API, Prev: Values From Inferior, Up: Python API
  19061. 23.2.2.4 Types In Python
  19062. ........................
  19063. GDB represents types from the inferior using the class 'gdb.Type'.
  19064. The following type-related functions are available in the 'gdb'
  19065. module:
  19066. -- Function: gdb.lookup_type (name [, block])
  19067. This function looks up a type by its NAME, which must be a string.
  19068. If BLOCK is given, then NAME is looked up in that scope.
  19069. Otherwise, it is searched for globally.
  19070. Ordinarily, this function will return an instance of 'gdb.Type'.
  19071. If the named type cannot be found, it will throw an exception.
  19072. If the type is a structure or class type, or an enum type, the fields
  19073. of that type can be accessed using the Python "dictionary syntax". For
  19074. example, if 'some_type' is a 'gdb.Type' instance holding a structure
  19075. type, you can access its 'foo' field with:
  19076. bar = some_type['foo']
  19077. 'bar' will be a 'gdb.Field' object; see below under the description
  19078. of the 'Type.fields' method for a description of the 'gdb.Field' class.
  19079. An instance of 'Type' has the following attributes:
  19080. -- Variable: Type.alignof
  19081. The alignment of this type, in bytes. Type alignment comes from
  19082. the debugging information; if it was not specified, then GDB will
  19083. use the relevant ABI to try to determine the alignment. In some
  19084. cases, even this is not possible, and zero will be returned.
  19085. -- Variable: Type.code
  19086. The type code for this type. The type code will be one of the
  19087. 'TYPE_CODE_' constants defined below.
  19088. -- Variable: Type.dynamic
  19089. A boolean indicating whether this type is dynamic. In some
  19090. situations, such as Rust 'enum' types or Ada variant records, the
  19091. concrete type of a value may vary depending on its contents. That
  19092. is, the declared type of a variable, or the type returned by
  19093. 'gdb.lookup_type' may be dynamic; while the type of the variable's
  19094. value will be a concrete instance of that dynamic type.
  19095. For example, consider this code:
  19096. int n;
  19097. int array[n];
  19098. Here, at least conceptually (whether your compiler actually does
  19099. this is a separate issue), examining
  19100. 'gdb.lookup_symbol("array", ...).type' could yield a 'gdb.Type'
  19101. which reports a size of 'None'. This is the dynamic type.
  19102. However, examining 'gdb.parse_and_eval("array").type' would yield a
  19103. concrete type, whose length would be known.
  19104. -- Variable: Type.name
  19105. The name of this type. If this type has no name, then 'None' is
  19106. returned.
  19107. -- Variable: Type.sizeof
  19108. The size of this type, in target 'char' units. Usually, a target's
  19109. 'char' type will be an 8-bit byte. However, on some unusual
  19110. platforms, this type may have a different size. A dynamic type may
  19111. not have a fixed size; in this case, this attribute's value will be
  19112. 'None'.
  19113. -- Variable: Type.tag
  19114. The tag name for this type. The tag name is the name after
  19115. 'struct', 'union', or 'enum' in C and C++; not all languages have
  19116. this concept. If this type has no tag name, then 'None' is
  19117. returned.
  19118. -- Variable: Type.objfile
  19119. The 'gdb.Objfile' that this type was defined in, or 'None' if there
  19120. is no associated objfile.
  19121. The following methods are provided:
  19122. -- Function: Type.fields ()
  19123. For structure and union types, this method returns the fields.
  19124. Range types have two fields, the minimum and maximum values. Enum
  19125. types have one field per enum constant. Function and method types
  19126. have one field per parameter. The base types of C++ classes are
  19127. also represented as fields. If the type has no fields, or does not
  19128. fit into one of these categories, an empty sequence will be
  19129. returned.
  19130. Each field is a 'gdb.Field' object, with some pre-defined
  19131. attributes:
  19132. 'bitpos'
  19133. This attribute is not available for 'enum' or 'static' (as in
  19134. C++) fields. The value is the position, counting in bits,
  19135. from the start of the containing type. Note that, in a
  19136. dynamic type, the position of a field may not be constant. In
  19137. this case, the value will be 'None'. Also, a dynamic type may
  19138. have fields that do not appear in a corresponding concrete
  19139. type.
  19140. 'enumval'
  19141. This attribute is only available for 'enum' fields, and its
  19142. value is the enumeration member's integer representation.
  19143. 'name'
  19144. The name of the field, or 'None' for anonymous fields.
  19145. 'artificial'
  19146. This is 'True' if the field is artificial, usually meaning
  19147. that it was provided by the compiler and not the user. This
  19148. attribute is always provided, and is 'False' if the field is
  19149. not artificial.
  19150. 'is_base_class'
  19151. This is 'True' if the field represents a base class of a C++
  19152. structure. This attribute is always provided, and is 'False'
  19153. if the field is not a base class of the type that is the
  19154. argument of 'fields', or if that type was not a C++ class.
  19155. 'bitsize'
  19156. If the field is packed, or is a bitfield, then this will have
  19157. a non-zero value, which is the size of the field in bits.
  19158. Otherwise, this will be zero; in this case the field's size is
  19159. given by its type.
  19160. 'type'
  19161. The type of the field. This is usually an instance of 'Type',
  19162. but it can be 'None' in some situations.
  19163. 'parent_type'
  19164. The type which contains this field. This is an instance of
  19165. 'gdb.Type'.
  19166. -- Function: Type.array (N1 [, N2])
  19167. Return a new 'gdb.Type' object which represents an array of this
  19168. type. If one argument is given, it is the inclusive upper bound of
  19169. the array; in this case the lower bound is zero. If two arguments
  19170. are given, the first argument is the lower bound of the array, and
  19171. the second argument is the upper bound of the array. An array's
  19172. length must not be negative, but the bounds can be.
  19173. -- Function: Type.vector (N1 [, N2])
  19174. Return a new 'gdb.Type' object which represents a vector of this
  19175. type. If one argument is given, it is the inclusive upper bound of
  19176. the vector; in this case the lower bound is zero. If two arguments
  19177. are given, the first argument is the lower bound of the vector, and
  19178. the second argument is the upper bound of the vector. A vector's
  19179. length must not be negative, but the bounds can be.
  19180. The difference between an 'array' and a 'vector' is that arrays
  19181. behave like in C: when used in expressions they decay to a pointer
  19182. to the first element whereas vectors are treated as first class
  19183. values.
  19184. -- Function: Type.const ()
  19185. Return a new 'gdb.Type' object which represents a 'const'-qualified
  19186. variant of this type.
  19187. -- Function: Type.volatile ()
  19188. Return a new 'gdb.Type' object which represents a
  19189. 'volatile'-qualified variant of this type.
  19190. -- Function: Type.unqualified ()
  19191. Return a new 'gdb.Type' object which represents an unqualified
  19192. variant of this type. That is, the result is neither 'const' nor
  19193. 'volatile'.
  19194. -- Function: Type.range ()
  19195. Return a Python 'Tuple' object that contains two elements: the low
  19196. bound of the argument type and the high bound of that type. If the
  19197. type does not have a range, GDB will raise a 'gdb.error' exception
  19198. (*note Exception Handling::).
  19199. -- Function: Type.reference ()
  19200. Return a new 'gdb.Type' object which represents a reference to this
  19201. type.
  19202. -- Function: Type.pointer ()
  19203. Return a new 'gdb.Type' object which represents a pointer to this
  19204. type.
  19205. -- Function: Type.strip_typedefs ()
  19206. Return a new 'gdb.Type' that represents the real type, after
  19207. removing all layers of typedefs.
  19208. -- Function: Type.target ()
  19209. Return a new 'gdb.Type' object which represents the target type of
  19210. this type.
  19211. For a pointer type, the target type is the type of the pointed-to
  19212. object. For an array type (meaning C-like arrays), the target type
  19213. is the type of the elements of the array. For a function or method
  19214. type, the target type is the type of the return value. For a
  19215. complex type, the target type is the type of the elements. For a
  19216. typedef, the target type is the aliased type.
  19217. If the type does not have a target, this method will throw an
  19218. exception.
  19219. -- Function: Type.template_argument (n [, block])
  19220. If this 'gdb.Type' is an instantiation of a template, this will
  19221. return a new 'gdb.Value' or 'gdb.Type' which represents the value
  19222. of the Nth template argument (indexed starting at 0).
  19223. If this 'gdb.Type' is not a template type, or if the type has fewer
  19224. than N template arguments, this will throw an exception.
  19225. Ordinarily, only C++ code will have template types.
  19226. If BLOCK is given, then NAME is looked up in that scope.
  19227. Otherwise, it is searched for globally.
  19228. -- Function: Type.optimized_out ()
  19229. Return 'gdb.Value' instance of this type whose value is optimized
  19230. out. This allows a frame decorator to indicate that the value of
  19231. an argument or a local variable is not known.
  19232. Each type has a code, which indicates what category this type falls
  19233. into. The available type categories are represented by constants
  19234. defined in the 'gdb' module:
  19235. 'gdb.TYPE_CODE_PTR'
  19236. The type is a pointer.
  19237. 'gdb.TYPE_CODE_ARRAY'
  19238. The type is an array.
  19239. 'gdb.TYPE_CODE_STRUCT'
  19240. The type is a structure.
  19241. 'gdb.TYPE_CODE_UNION'
  19242. The type is a union.
  19243. 'gdb.TYPE_CODE_ENUM'
  19244. The type is an enum.
  19245. 'gdb.TYPE_CODE_FLAGS'
  19246. A bit flags type, used for things such as status registers.
  19247. 'gdb.TYPE_CODE_FUNC'
  19248. The type is a function.
  19249. 'gdb.TYPE_CODE_INT'
  19250. The type is an integer type.
  19251. 'gdb.TYPE_CODE_FLT'
  19252. A floating point type.
  19253. 'gdb.TYPE_CODE_VOID'
  19254. The special type 'void'.
  19255. 'gdb.TYPE_CODE_SET'
  19256. A Pascal set type.
  19257. 'gdb.TYPE_CODE_RANGE'
  19258. A range type, that is, an integer type with bounds.
  19259. 'gdb.TYPE_CODE_STRING'
  19260. A string type. Note that this is only used for certain languages
  19261. with language-defined string types; C strings are not represented
  19262. this way.
  19263. 'gdb.TYPE_CODE_BITSTRING'
  19264. A string of bits. It is deprecated.
  19265. 'gdb.TYPE_CODE_ERROR'
  19266. An unknown or erroneous type.
  19267. 'gdb.TYPE_CODE_METHOD'
  19268. A method type, as found in C++.
  19269. 'gdb.TYPE_CODE_METHODPTR'
  19270. A pointer-to-member-function.
  19271. 'gdb.TYPE_CODE_MEMBERPTR'
  19272. A pointer-to-member.
  19273. 'gdb.TYPE_CODE_REF'
  19274. A reference type.
  19275. 'gdb.TYPE_CODE_RVALUE_REF'
  19276. A C++11 rvalue reference type.
  19277. 'gdb.TYPE_CODE_CHAR'
  19278. A character type.
  19279. 'gdb.TYPE_CODE_BOOL'
  19280. A boolean type.
  19281. 'gdb.TYPE_CODE_COMPLEX'
  19282. A complex float type.
  19283. 'gdb.TYPE_CODE_TYPEDEF'
  19284. A typedef to some other type.
  19285. 'gdb.TYPE_CODE_NAMESPACE'
  19286. A C++ namespace.
  19287. 'gdb.TYPE_CODE_DECFLOAT'
  19288. A decimal floating point type.
  19289. 'gdb.TYPE_CODE_INTERNAL_FUNCTION'
  19290. A function internal to GDB. This is the type used to represent
  19291. convenience functions.
  19292. Further support for types is provided in the 'gdb.types' Python
  19293. module (*note gdb.types::).
  19294. 
  19295. File: gdb.info, Node: Pretty Printing API, Next: Selecting Pretty-Printers, Prev: Types In Python, Up: Python API
  19296. 23.2.2.5 Pretty Printing API
  19297. ............................
  19298. A pretty-printer is just an object that holds a value and implements a
  19299. specific interface, defined here. An example output is provided (*note
  19300. Pretty Printing::).
  19301. -- Function: pretty_printer.children (self)
  19302. GDB will call this method on a pretty-printer to compute the
  19303. children of the pretty-printer's value.
  19304. This method must return an object conforming to the Python iterator
  19305. protocol. Each item returned by the iterator must be a tuple
  19306. holding two elements. The first element is the "name" of the
  19307. child; the second element is the child's value. The value can be
  19308. any Python object which is convertible to a GDB value.
  19309. This method is optional. If it does not exist, GDB will act as
  19310. though the value has no children.
  19311. For efficiency, the 'children' method should lazily compute its
  19312. results. This will let GDB read as few elements as necessary, for
  19313. example when various print settings (*note Print Settings::) or
  19314. '-var-list-children' (*note GDB/MI Variable Objects::) limit the
  19315. number of elements to be displayed.
  19316. Children may be hidden from display based on the value of 'set
  19317. print max-depth' (*note Print Settings::).
  19318. -- Function: pretty_printer.display_hint (self)
  19319. The CLI may call this method and use its result to change the
  19320. formatting of a value. The result will also be supplied to an MI
  19321. consumer as a 'displayhint' attribute of the variable being
  19322. printed.
  19323. This method is optional. If it does exist, this method must return
  19324. a string or the special value 'None'.
  19325. Some display hints are predefined by GDB:
  19326. 'array'
  19327. Indicate that the object being printed is "array-like". The
  19328. CLI uses this to respect parameters such as 'set print
  19329. elements' and 'set print array'.
  19330. 'map'
  19331. Indicate that the object being printed is "map-like", and that
  19332. the children of this value can be assumed to alternate between
  19333. keys and values.
  19334. 'string'
  19335. Indicate that the object being printed is "string-like". If
  19336. the printer's 'to_string' method returns a Python string of
  19337. some kind, then GDB will call its internal language-specific
  19338. string-printing function to format the string. For the CLI
  19339. this means adding quotation marks, possibly escaping some
  19340. characters, respecting 'set print elements', and the like.
  19341. The special value 'None' causes GDB to apply the default display
  19342. rules.
  19343. -- Function: pretty_printer.to_string (self)
  19344. GDB will call this method to display the string representation of
  19345. the value passed to the object's constructor.
  19346. When printing from the CLI, if the 'to_string' method exists, then
  19347. GDB will prepend its result to the values returned by 'children'.
  19348. Exactly how this formatting is done is dependent on the display
  19349. hint, and may change as more hints are added. Also, depending on
  19350. the print settings (*note Print Settings::), the CLI may print just
  19351. the result of 'to_string' in a stack trace, omitting the result of
  19352. 'children'.
  19353. If this method returns a string, it is printed verbatim.
  19354. Otherwise, if this method returns an instance of 'gdb.Value', then
  19355. GDB prints this value. This may result in a call to another
  19356. pretty-printer.
  19357. If instead the method returns a Python value which is convertible
  19358. to a 'gdb.Value', then GDB performs the conversion and prints the
  19359. resulting value. Again, this may result in a call to another
  19360. pretty-printer. Python scalars (integers, floats, and booleans)
  19361. and strings are convertible to 'gdb.Value'; other types are not.
  19362. Finally, if this method returns 'None' then no further operations
  19363. are peformed in this method and nothing is printed.
  19364. If the result is not one of these types, an exception is raised.
  19365. GDB provides a function which can be used to look up the default
  19366. pretty-printer for a 'gdb.Value':
  19367. -- Function: gdb.default_visualizer (value)
  19368. This function takes a 'gdb.Value' object as an argument. If a
  19369. pretty-printer for this value exists, then it is returned. If no
  19370. such printer exists, then this returns 'None'.
  19371. 
  19372. File: gdb.info, Node: Selecting Pretty-Printers, Next: Writing a Pretty-Printer, Prev: Pretty Printing API, Up: Python API
  19373. 23.2.2.6 Selecting Pretty-Printers
  19374. ..................................
  19375. GDB provides several ways to register a pretty-printer: globally, per
  19376. program space, and per objfile. When choosing how to register your
  19377. pretty-printer, a good rule is to register it with the smallest scope
  19378. possible: that is prefer a specific objfile first, then a program space,
  19379. and only register a printer globally as a last resort.
  19380. -- Variable: gdb.pretty_printers
  19381. The Python list 'gdb.pretty_printers' contains an array of
  19382. functions or callable objects that have been registered via
  19383. addition as a pretty-printer. Printers in this list are called
  19384. 'global' printers, they're available when debugging all inferiors.
  19385. Each 'gdb.Progspace' contains a 'pretty_printers' attribute. Each
  19386. 'gdb.Objfile' also contains a 'pretty_printers' attribute.
  19387. Each function on these lists is passed a single 'gdb.Value' argument
  19388. and should return a pretty-printer object conforming to the interface
  19389. definition above (*note Pretty Printing API::). If a function cannot
  19390. create a pretty-printer for the value, it should return 'None'.
  19391. GDB first checks the 'pretty_printers' attribute of each
  19392. 'gdb.Objfile' in the current program space and iteratively calls each
  19393. enabled lookup routine in the list for that 'gdb.Objfile' until it
  19394. receives a pretty-printer object. If no pretty-printer is found in the
  19395. objfile lists, GDB then searches the pretty-printer list of the current
  19396. program space, calling each enabled function until an object is
  19397. returned. After these lists have been exhausted, it tries the global
  19398. 'gdb.pretty_printers' list, again calling each enabled function until an
  19399. object is returned.
  19400. The order in which the objfiles are searched is not specified. For a
  19401. given list, functions are always invoked from the head of the list, and
  19402. iterated over sequentially until the end of the list, or a printer
  19403. object is returned.
  19404. For various reasons a pretty-printer may not work. For example, the
  19405. underlying data structure may have changed and the pretty-printer is out
  19406. of date.
  19407. The consequences of a broken pretty-printer are severe enough that
  19408. GDB provides support for enabling and disabling individual printers.
  19409. For example, if 'print frame-arguments' is on, a backtrace can become
  19410. highly illegible if any argument is printed with a broken printer.
  19411. Pretty-printers are enabled and disabled by attaching an 'enabled'
  19412. attribute to the registered function or callable object. If this
  19413. attribute is present and its value is 'False', the printer is disabled,
  19414. otherwise the printer is enabled.
  19415. 
  19416. File: gdb.info, Node: Writing a Pretty-Printer, Next: Type Printing API, Prev: Selecting Pretty-Printers, Up: Python API
  19417. 23.2.2.7 Writing a Pretty-Printer
  19418. .................................
  19419. A pretty-printer consists of two parts: a lookup function to detect if
  19420. the type is supported, and the printer itself.
  19421. Here is an example showing how a 'std::string' printer might be
  19422. written. *Note Pretty Printing API::, for details on the API this class
  19423. must provide.
  19424. class StdStringPrinter(object):
  19425. "Print a std::string"
  19426. def __init__(self, val):
  19427. self.val = val
  19428. def to_string(self):
  19429. return self.val['_M_dataplus']['_M_p']
  19430. def display_hint(self):
  19431. return 'string'
  19432. And here is an example showing how a lookup function for the printer
  19433. example above might be written.
  19434. def str_lookup_function(val):
  19435. lookup_tag = val.type.tag
  19436. if lookup_tag == None:
  19437. return None
  19438. regex = re.compile("^std::basic_string<char,.*>$")
  19439. if regex.match(lookup_tag):
  19440. return StdStringPrinter(val)
  19441. return None
  19442. The example lookup function extracts the value's type, and attempts
  19443. to match it to a type that it can pretty-print. If it is a type the
  19444. printer can pretty-print, it will return a printer object. If not, it
  19445. returns 'None'.
  19446. We recommend that you put your core pretty-printers into a Python
  19447. package. If your pretty-printers are for use with a library, we further
  19448. recommend embedding a version number into the package name. This
  19449. practice will enable GDB to load multiple versions of your
  19450. pretty-printers at the same time, because they will have different
  19451. names.
  19452. You should write auto-loaded code (*note Python Auto-loading::) such
  19453. that it can be evaluated multiple times without changing its meaning.
  19454. An ideal auto-load file will consist solely of 'import's of your printer
  19455. modules, followed by a call to a register pretty-printers with the
  19456. current objfile.
  19457. Taken as a whole, this approach will scale nicely to multiple
  19458. inferiors, each potentially using a different library version.
  19459. Embedding a version number in the Python package name will ensure that
  19460. GDB is able to load both sets of printers simultaneously. Then, because
  19461. the search for pretty-printers is done by objfile, and because your
  19462. auto-loaded code took care to register your library's printers with a
  19463. specific objfile, GDB will find the correct printers for the specific
  19464. version of the library used by each inferior.
  19465. To continue the 'std::string' example (*note Pretty Printing API::),
  19466. this code might appear in 'gdb.libstdcxx.v6':
  19467. def register_printers(objfile):
  19468. objfile.pretty_printers.append(str_lookup_function)
  19469. And then the corresponding contents of the auto-load file would be:
  19470. import gdb.libstdcxx.v6
  19471. gdb.libstdcxx.v6.register_printers(gdb.current_objfile())
  19472. The previous example illustrates a basic pretty-printer. There are a
  19473. few things that can be improved on. The printer doesn't have a name,
  19474. making it hard to identify in a list of installed printers. The lookup
  19475. function has a name, but lookup functions can have arbitrary, even
  19476. identical, names.
  19477. Second, the printer only handles one type, whereas a library
  19478. typically has several types. One could install a lookup function for
  19479. each desired type in the library, but one could also have a single
  19480. lookup function recognize several types. The latter is the conventional
  19481. way this is handled. If a pretty-printer can handle multiple data
  19482. types, then its "subprinters" are the printers for the individual data
  19483. types.
  19484. The 'gdb.printing' module provides a formal way of solving these
  19485. problems (*note gdb.printing::). Here is another example that handles
  19486. multiple types.
  19487. These are the types we are going to pretty-print:
  19488. struct foo { int a, b; };
  19489. struct bar { struct foo x, y; };
  19490. Here are the printers:
  19491. class fooPrinter:
  19492. """Print a foo object."""
  19493. def __init__(self, val):
  19494. self.val = val
  19495. def to_string(self):
  19496. return ("a=<" + str(self.val["a"]) +
  19497. "> b=<" + str(self.val["b"]) + ">")
  19498. class barPrinter:
  19499. """Print a bar object."""
  19500. def __init__(self, val):
  19501. self.val = val
  19502. def to_string(self):
  19503. return ("x=<" + str(self.val["x"]) +
  19504. "> y=<" + str(self.val["y"]) + ">")
  19505. This example doesn't need a lookup function, that is handled by the
  19506. 'gdb.printing' module. Instead a function is provided to build up the
  19507. object that handles the lookup.
  19508. import gdb.printing
  19509. def build_pretty_printer():
  19510. pp = gdb.printing.RegexpCollectionPrettyPrinter(
  19511. "my_library")
  19512. pp.add_printer('foo', '^foo$', fooPrinter)
  19513. pp.add_printer('bar', '^bar$', barPrinter)
  19514. return pp
  19515. And here is the autoload support:
  19516. import gdb.printing
  19517. import my_library
  19518. gdb.printing.register_pretty_printer(
  19519. gdb.current_objfile(),
  19520. my_library.build_pretty_printer())
  19521. Finally, when this printer is loaded into GDB, here is the
  19522. corresponding output of 'info pretty-printer':
  19523. (gdb) info pretty-printer
  19524. my_library.so:
  19525. my_library
  19526. foo
  19527. bar
  19528. 
  19529. File: gdb.info, Node: Type Printing API, Next: Frame Filter API, Prev: Writing a Pretty-Printer, Up: Python API
  19530. 23.2.2.8 Type Printing API
  19531. ..........................
  19532. GDB provides a way for Python code to customize type display. This is
  19533. mainly useful for substituting canonical typedef names for types.
  19534. A "type printer" is just a Python object conforming to a certain
  19535. protocol. A simple base class implementing the protocol is provided;
  19536. see *note gdb.types::. A type printer must supply at least:
  19537. -- Instance Variable of type_printer: enabled
  19538. A boolean which is True if the printer is enabled, and False
  19539. otherwise. This is manipulated by the 'enable type-printer' and
  19540. 'disable type-printer' commands.
  19541. -- Instance Variable of type_printer: name
  19542. The name of the type printer. This must be a string. This is used
  19543. by the 'enable type-printer' and 'disable type-printer' commands.
  19544. -- Method on type_printer: instantiate (self)
  19545. This is called by GDB at the start of type-printing. It is only
  19546. called if the type printer is enabled. This method must return a
  19547. new object that supplies a 'recognize' method, as described below.
  19548. When displaying a type, say via the 'ptype' command, GDB will compute
  19549. a list of type recognizers. This is done by iterating first over the
  19550. per-objfile type printers (*note Objfiles In Python::), followed by the
  19551. per-progspace type printers (*note Progspaces In Python::), and finally
  19552. the global type printers.
  19553. GDB will call the 'instantiate' method of each enabled type printer.
  19554. If this method returns 'None', then the result is ignored; otherwise, it
  19555. is appended to the list of recognizers.
  19556. Then, when GDB is going to display a type name, it iterates over the
  19557. list of recognizers. For each one, it calls the recognition function,
  19558. stopping if the function returns a non-'None' value. The recognition
  19559. function is defined as:
  19560. -- Method on type_recognizer: recognize (self, type)
  19561. If TYPE is not recognized, return 'None'. Otherwise, return a
  19562. string which is to be printed as the name of TYPE. The TYPE
  19563. argument will be an instance of 'gdb.Type' (*note Types In
  19564. Python::).
  19565. GDB uses this two-pass approach so that type printers can efficiently
  19566. cache information without holding on to it too long. For example, it
  19567. can be convenient to look up type information in a type printer and hold
  19568. it for a recognizer's lifetime; if a single pass were done then type
  19569. printers would have to make use of the event system in order to avoid
  19570. holding information that could become stale as the inferior changed.
  19571. 
  19572. File: gdb.info, Node: Frame Filter API, Next: Frame Decorator API, Prev: Type Printing API, Up: Python API
  19573. 23.2.2.9 Filtering Frames
  19574. .........................
  19575. Frame filters are Python objects that manipulate the visibility of a
  19576. frame or frames when a backtrace (*note Backtrace::) is printed by GDB.
  19577. Only commands that print a backtrace, or, in the case of GDB/MI
  19578. commands (*note GDB/MI::), those that return a collection of frames are
  19579. affected. The commands that work with frame filters are:
  19580. 'backtrace' (*note The backtrace command: backtrace-command.),
  19581. '-stack-list-frames' (*note The -stack-list-frames command:
  19582. -stack-list-frames.), '-stack-list-variables' (*note The
  19583. -stack-list-variables command: -stack-list-variables.),
  19584. '-stack-list-arguments' *note The -stack-list-arguments command:
  19585. -stack-list-arguments.) and '-stack-list-locals' (*note The
  19586. -stack-list-locals command: -stack-list-locals.).
  19587. A frame filter works by taking an iterator as an argument, applying
  19588. actions to the contents of that iterator, and returning another iterator
  19589. (or, possibly, the same iterator it was provided in the case where the
  19590. filter does not perform any operations). Typically, frame filters
  19591. utilize tools such as the Python's 'itertools' module to work with and
  19592. create new iterators from the source iterator. Regardless of how a
  19593. filter chooses to apply actions, it must not alter the underlying GDB
  19594. frame or frames, or attempt to alter the call-stack within GDB. This
  19595. preserves data integrity within GDB. Frame filters are executed on a
  19596. priority basis and care should be taken that some frame filters may have
  19597. been executed before, and that some frame filters will be executed
  19598. after.
  19599. An important consideration when designing frame filters, and well
  19600. worth reflecting upon, is that frame filters should avoid unwinding the
  19601. call stack if possible. Some stacks can run very deep, into the tens of
  19602. thousands in some cases. To search every frame when a frame filter
  19603. executes may be too expensive at that step. The frame filter cannot
  19604. know how many frames it has to iterate over, and it may have to iterate
  19605. through them all. This ends up duplicating effort as GDB performs this
  19606. iteration when it prints the frames. If the filter can defer unwinding
  19607. frames until frame decorators are executed, after the last filter has
  19608. executed, it should. *Note Frame Decorator API::, for more information
  19609. on decorators. Also, there are examples for both frame decorators and
  19610. filters in later chapters. *Note Writing a Frame Filter::, for more
  19611. information.
  19612. The Python dictionary 'gdb.frame_filters' contains key/object
  19613. pairings that comprise a frame filter. Frame filters in this dictionary
  19614. are called 'global' frame filters, and they are available when debugging
  19615. all inferiors. These frame filters must register with the dictionary
  19616. directly. In addition to the 'global' dictionary, there are other
  19617. dictionaries that are loaded with different inferiors via auto-loading
  19618. (*note Python Auto-loading::). The two other areas where frame filter
  19619. dictionaries can be found are: 'gdb.Progspace' which contains a
  19620. 'frame_filters' dictionary attribute, and each 'gdb.Objfile' object
  19621. which also contains a 'frame_filters' dictionary attribute.
  19622. When a command is executed from GDB that is compatible with frame
  19623. filters, GDB combines the 'global', 'gdb.Progspace' and all
  19624. 'gdb.Objfile' dictionaries currently loaded. All of the 'gdb.Objfile'
  19625. dictionaries are combined, as several frames, and thus several object
  19626. files, might be in use. GDB then prunes any frame filter whose
  19627. 'enabled' attribute is 'False'. This pruned list is then sorted
  19628. according to the 'priority' attribute in each filter.
  19629. Once the dictionaries are combined, pruned and sorted, GDB creates an
  19630. iterator which wraps each frame in the call stack in a 'FrameDecorator'
  19631. object, and calls each filter in order. The output from the previous
  19632. filter will always be the input to the next filter, and so on.
  19633. Frame filters have a mandatory interface which each frame filter must
  19634. implement, defined here:
  19635. -- Function: FrameFilter.filter (iterator)
  19636. GDB will call this method on a frame filter when it has reached the
  19637. order in the priority list for that filter.
  19638. For example, if there are four frame filters:
  19639. Name Priority
  19640. Filter1 5
  19641. Filter2 10
  19642. Filter3 100
  19643. Filter4 1
  19644. The order that the frame filters will be called is:
  19645. Filter3 -> Filter2 -> Filter1 -> Filter4
  19646. Note that the output from 'Filter3' is passed to the input of
  19647. 'Filter2', and so on.
  19648. This 'filter' method is passed a Python iterator. This iterator
  19649. contains a sequence of frame decorators that wrap each 'gdb.Frame',
  19650. or a frame decorator that wraps another frame decorator. The first
  19651. filter that is executed in the sequence of frame filters will
  19652. receive an iterator entirely comprised of default 'FrameDecorator'
  19653. objects. However, after each frame filter is executed, the
  19654. previous frame filter may have wrapped some or all of the frame
  19655. decorators with their own frame decorator. As frame decorators
  19656. must also conform to a mandatory interface, these decorators can be
  19657. assumed to act in a uniform manner (*note Frame Decorator API::).
  19658. This method must return an object conforming to the Python iterator
  19659. protocol. Each item in the iterator must be an object conforming
  19660. to the frame decorator interface. If a frame filter does not wish
  19661. to perform any operations on this iterator, it should return that
  19662. iterator untouched.
  19663. This method is not optional. If it does not exist, GDB will raise
  19664. and print an error.
  19665. -- Variable: FrameFilter.name
  19666. The 'name' attribute must be Python string which contains the name
  19667. of the filter displayed by GDB (*note Frame Filter Management::).
  19668. This attribute may contain any combination of letters or numbers.
  19669. Care should be taken to ensure that it is unique. This attribute
  19670. is mandatory.
  19671. -- Variable: FrameFilter.enabled
  19672. The 'enabled' attribute must be Python boolean. This attribute
  19673. indicates to GDB whether the frame filter is enabled, and should be
  19674. considered when frame filters are executed. If 'enabled' is
  19675. 'True', then the frame filter will be executed when any of the
  19676. backtrace commands detailed earlier in this chapter are executed.
  19677. If 'enabled' is 'False', then the frame filter will not be
  19678. executed. This attribute is mandatory.
  19679. -- Variable: FrameFilter.priority
  19680. The 'priority' attribute must be Python integer. This attribute
  19681. controls the order of execution in relation to other frame filters.
  19682. There are no imposed limits on the range of 'priority' other than
  19683. it must be a valid integer. The higher the 'priority' attribute,
  19684. the sooner the frame filter will be executed in relation to other
  19685. frame filters. Although 'priority' can be negative, it is
  19686. recommended practice to assume zero is the lowest priority that a
  19687. frame filter can be assigned. Frame filters that have the same
  19688. priority are executed in unsorted order in that priority slot.
  19689. This attribute is mandatory. 100 is a good default priority.
  19690. 
  19691. File: gdb.info, Node: Frame Decorator API, Next: Writing a Frame Filter, Prev: Frame Filter API, Up: Python API
  19692. 23.2.2.10 Decorating Frames
  19693. ...........................
  19694. Frame decorators are sister objects to frame filters (*note Frame Filter
  19695. API::). Frame decorators are applied by a frame filter and can only be
  19696. used in conjunction with frame filters.
  19697. The purpose of a frame decorator is to customize the printed content
  19698. of each 'gdb.Frame' in commands where frame filters are executed. This
  19699. concept is called decorating a frame. Frame decorators decorate a
  19700. 'gdb.Frame' with Python code contained within each API call. This
  19701. separates the actual data contained in a 'gdb.Frame' from the decorated
  19702. data produced by a frame decorator. This abstraction is necessary to
  19703. maintain integrity of the data contained in each 'gdb.Frame'.
  19704. Frame decorators have a mandatory interface, defined below.
  19705. GDB already contains a frame decorator called 'FrameDecorator'. This
  19706. contains substantial amounts of boilerplate code to decorate the content
  19707. of a 'gdb.Frame'. It is recommended that other frame decorators inherit
  19708. and extend this object, and only to override the methods needed.
  19709. 'FrameDecorator' is defined in the Python module
  19710. 'gdb.FrameDecorator', so your code can import it like:
  19711. from gdb.FrameDecorator import FrameDecorator
  19712. -- Function: FrameDecorator.elided (self)
  19713. The 'elided' method groups frames together in a hierarchical
  19714. system. An example would be an interpreter, where multiple
  19715. low-level frames make up a single call in the interpreted language.
  19716. In this example, the frame filter would elide the low-level frames
  19717. and present a single high-level frame, representing the call in the
  19718. interpreted language, to the user.
  19719. The 'elided' function must return an iterable and this iterable
  19720. must contain the frames that are being elided wrapped in a suitable
  19721. frame decorator. If no frames are being elided this function may
  19722. return an empty iterable, or 'None'. Elided frames are indented
  19723. from normal frames in a 'CLI' backtrace, or in the case of
  19724. 'GDB/MI', are placed in the 'children' field of the eliding frame.
  19725. It is the frame filter's task to also filter out the elided frames
  19726. from the source iterator. This will avoid printing the frame
  19727. twice.
  19728. -- Function: FrameDecorator.function (self)
  19729. This method returns the name of the function in the frame that is
  19730. to be printed.
  19731. This method must return a Python string describing the function, or
  19732. 'None'.
  19733. If this function returns 'None', GDB will not print any data for
  19734. this field.
  19735. -- Function: FrameDecorator.address (self)
  19736. This method returns the address of the frame that is to be printed.
  19737. This method must return a Python numeric integer type of sufficient
  19738. size to describe the address of the frame, or 'None'.
  19739. If this function returns a 'None', GDB will not print any data for
  19740. this field.
  19741. -- Function: FrameDecorator.filename (self)
  19742. This method returns the filename and path associated with this
  19743. frame.
  19744. This method must return a Python string containing the filename and
  19745. the path to the object file backing the frame, or 'None'.
  19746. If this function returns a 'None', GDB will not print any data for
  19747. this field.
  19748. -- Function: FrameDecorator.line (self):
  19749. This method returns the line number associated with the current
  19750. position within the function addressed by this frame.
  19751. This method must return a Python integer type, or 'None'.
  19752. If this function returns a 'None', GDB will not print any data for
  19753. this field.
  19754. -- Function: FrameDecorator.frame_args (self)
  19755. This method must return an iterable, or 'None'. Returning an empty
  19756. iterable, or 'None' means frame arguments will not be printed for
  19757. this frame. This iterable must contain objects that implement two
  19758. methods, described here.
  19759. This object must implement a 'argument' method which takes a single
  19760. 'self' parameter and must return a 'gdb.Symbol' (*note Symbols In
  19761. Python::), or a Python string. The object must also implement a
  19762. 'value' method which takes a single 'self' parameter and must
  19763. return a 'gdb.Value' (*note Values From Inferior::), a Python
  19764. value, or 'None'. If the 'value' method returns 'None', and the
  19765. 'argument' method returns a 'gdb.Symbol', GDB will look-up and
  19766. print the value of the 'gdb.Symbol' automatically.
  19767. A brief example:
  19768. class SymValueWrapper():
  19769. def __init__(self, symbol, value):
  19770. self.sym = symbol
  19771. self.val = value
  19772. def value(self):
  19773. return self.val
  19774. def symbol(self):
  19775. return self.sym
  19776. class SomeFrameDecorator()
  19777. ...
  19778. ...
  19779. def frame_args(self):
  19780. args = []
  19781. try:
  19782. block = self.inferior_frame.block()
  19783. except:
  19784. return None
  19785. # Iterate over all symbols in a block. Only add
  19786. # symbols that are arguments.
  19787. for sym in block:
  19788. if not sym.is_argument:
  19789. continue
  19790. args.append(SymValueWrapper(sym,None))
  19791. # Add example synthetic argument.
  19792. args.append(SymValueWrapper(``foo'', 42))
  19793. return args
  19794. -- Function: FrameDecorator.frame_locals (self)
  19795. This method must return an iterable or 'None'. Returning an empty
  19796. iterable, or 'None' means frame local arguments will not be printed
  19797. for this frame.
  19798. The object interface, the description of the various strategies for
  19799. reading frame locals, and the example are largely similar to those
  19800. described in the 'frame_args' function, (*note The frame filter
  19801. frame_args function: frame_args.). Below is a modified example:
  19802. class SomeFrameDecorator()
  19803. ...
  19804. ...
  19805. def frame_locals(self):
  19806. vars = []
  19807. try:
  19808. block = self.inferior_frame.block()
  19809. except:
  19810. return None
  19811. # Iterate over all symbols in a block. Add all
  19812. # symbols, except arguments.
  19813. for sym in block:
  19814. if sym.is_argument:
  19815. continue
  19816. vars.append(SymValueWrapper(sym,None))
  19817. # Add an example of a synthetic local variable.
  19818. vars.append(SymValueWrapper(``bar'', 99))
  19819. return vars
  19820. -- Function: FrameDecorator.inferior_frame (self):
  19821. This method must return the underlying 'gdb.Frame' that this frame
  19822. decorator is decorating. GDB requires the underlying frame for
  19823. internal frame information to determine how to print certain values
  19824. when printing a frame.
  19825. 
  19826. File: gdb.info, Node: Writing a Frame Filter, Next: Unwinding Frames in Python, Prev: Frame Decorator API, Up: Python API
  19827. 23.2.2.11 Writing a Frame Filter
  19828. ................................
  19829. There are three basic elements that a frame filter must implement: it
  19830. must correctly implement the documented interface (*note Frame Filter
  19831. API::), it must register itself with GDB, and finally, it must decide if
  19832. it is to work on the data provided by GDB. In all cases, whether it
  19833. works on the iterator or not, each frame filter must return an iterator.
  19834. A bare-bones frame filter follows the pattern in the following example.
  19835. import gdb
  19836. class FrameFilter():
  19837. def __init__(self):
  19838. # Frame filter attribute creation.
  19839. #
  19840. # 'name' is the name of the filter that GDB will display.
  19841. #
  19842. # 'priority' is the priority of the filter relative to other
  19843. # filters.
  19844. #
  19845. # 'enabled' is a boolean that indicates whether this filter is
  19846. # enabled and should be executed.
  19847. self.name = "Foo"
  19848. self.priority = 100
  19849. self.enabled = True
  19850. # Register this frame filter with the global frame_filters
  19851. # dictionary.
  19852. gdb.frame_filters[self.name] = self
  19853. def filter(self, frame_iter):
  19854. # Just return the iterator.
  19855. return frame_iter
  19856. The frame filter in the example above implements the three
  19857. requirements for all frame filters. It implements the API, self
  19858. registers, and makes a decision on the iterator (in this case, it just
  19859. returns the iterator untouched).
  19860. The first step is attribute creation and assignment, and as shown in
  19861. the comments the filter assigns the following attributes: 'name',
  19862. 'priority' and whether the filter should be enabled with the 'enabled'
  19863. attribute.
  19864. The second step is registering the frame filter with the dictionary
  19865. or dictionaries that the frame filter has interest in. As shown in the
  19866. comments, this filter just registers itself with the global dictionary
  19867. 'gdb.frame_filters'. As noted earlier, 'gdb.frame_filters' is a
  19868. dictionary that is initialized in the 'gdb' module when GDB starts.
  19869. What dictionary a filter registers with is an important consideration.
  19870. Generally, if a filter is specific to a set of code, it should be
  19871. registered either in the 'objfile' or 'progspace' dictionaries as they
  19872. are specific to the program currently loaded in GDB. The global
  19873. dictionary is always present in GDB and is never unloaded. Any filters
  19874. registered with the global dictionary will exist until GDB exits. To
  19875. avoid filters that may conflict, it is generally better to register
  19876. frame filters against the dictionaries that more closely align with the
  19877. usage of the filter currently in question. *Note Python Auto-loading::,
  19878. for further information on auto-loading Python scripts.
  19879. GDB takes a hands-off approach to frame filter registration,
  19880. therefore it is the frame filter's responsibility to ensure registration
  19881. has occurred, and that any exceptions are handled appropriately. In
  19882. particular, you may wish to handle exceptions relating to Python
  19883. dictionary key uniqueness. It is mandatory that the dictionary key is
  19884. the same as frame filter's 'name' attribute. When a user manages frame
  19885. filters (*note Frame Filter Management::), the names GDB will display
  19886. are those contained in the 'name' attribute.
  19887. The final step of this example is the implementation of the 'filter'
  19888. method. As shown in the example comments, we define the 'filter' method
  19889. and note that the method must take an iterator, and also must return an
  19890. iterator. In this bare-bones example, the frame filter is not very
  19891. useful as it just returns the iterator untouched. However this is a
  19892. valid operation for frame filters that have the 'enabled' attribute set,
  19893. but decide not to operate on any frames.
  19894. In the next example, the frame filter operates on all frames and
  19895. utilizes a frame decorator to perform some work on the frames. *Note
  19896. Frame Decorator API::, for further information on the frame decorator
  19897. interface.
  19898. This example works on inlined frames. It highlights frames which are
  19899. inlined by tagging them with an "[inlined]" tag. By applying a frame
  19900. decorator to all frames with the Python 'itertools imap' method, the
  19901. example defers actions to the frame decorator. Frame decorators are
  19902. only processed when GDB prints the backtrace.
  19903. This introduces a new decision making topic: whether to perform
  19904. decision making operations at the filtering step, or at the printing
  19905. step. In this example's approach, it does not perform any filtering
  19906. decisions at the filtering step beyond mapping a frame decorator to each
  19907. frame. This allows the actual decision making to be performed when each
  19908. frame is printed. This is an important consideration, and well worth
  19909. reflecting upon when designing a frame filter. An issue that frame
  19910. filters should avoid is unwinding the stack if possible. Some stacks
  19911. can run very deep, into the tens of thousands in some cases. To search
  19912. every frame to determine if it is inlined ahead of time may be too
  19913. expensive at the filtering step. The frame filter cannot know how many
  19914. frames it has to iterate over, and it would have to iterate through them
  19915. all. This ends up duplicating effort as GDB performs this iteration
  19916. when it prints the frames.
  19917. In this example decision making can be deferred to the printing step.
  19918. As each frame is printed, the frame decorator can examine each frame in
  19919. turn when GDB iterates. From a performance viewpoint, this is the most
  19920. appropriate decision to make as it avoids duplicating the effort that
  19921. the printing step would undertake anyway. Also, if there are many frame
  19922. filters unwinding the stack during filtering, it can substantially delay
  19923. the printing of the backtrace which will result in large memory usage,
  19924. and a poor user experience.
  19925. class InlineFilter():
  19926. def __init__(self):
  19927. self.name = "InlinedFrameFilter"
  19928. self.priority = 100
  19929. self.enabled = True
  19930. gdb.frame_filters[self.name] = self
  19931. def filter(self, frame_iter):
  19932. frame_iter = itertools.imap(InlinedFrameDecorator,
  19933. frame_iter)
  19934. return frame_iter
  19935. This frame filter is somewhat similar to the earlier example, except
  19936. that the 'filter' method applies a frame decorator object called
  19937. 'InlinedFrameDecorator' to each element in the iterator. The 'imap'
  19938. Python method is light-weight. It does not proactively iterate over the
  19939. iterator, but rather creates a new iterator which wraps the existing
  19940. one.
  19941. Below is the frame decorator for this example.
  19942. class InlinedFrameDecorator(FrameDecorator):
  19943. def __init__(self, fobj):
  19944. super(InlinedFrameDecorator, self).__init__(fobj)
  19945. def function(self):
  19946. frame = fobj.inferior_frame()
  19947. name = str(frame.name())
  19948. if frame.type() == gdb.INLINE_FRAME:
  19949. name = name + " [inlined]"
  19950. return name
  19951. This frame decorator only defines and overrides the 'function'
  19952. method. It lets the supplied 'FrameDecorator', which is shipped with
  19953. GDB, perform the other work associated with printing this frame.
  19954. The combination of these two objects create this output from a
  19955. backtrace:
  19956. #0 0x004004e0 in bar () at inline.c:11
  19957. #1 0x00400566 in max [inlined] (b=6, a=12) at inline.c:21
  19958. #2 0x00400566 in main () at inline.c:31
  19959. So in the case of this example, a frame decorator is applied to all
  19960. frames, regardless of whether they may be inlined or not. As GDB
  19961. iterates over the iterator produced by the frame filters, GDB executes
  19962. each frame decorator which then makes a decision on what to print in the
  19963. 'function' callback. Using a strategy like this is a way to defer
  19964. decisions on the frame content to printing time.
  19965. Eliding Frames
  19966. --------------
  19967. It might be that the above example is not desirable for representing
  19968. inlined frames, and a hierarchical approach may be preferred. If we
  19969. want to hierarchically represent frames, the 'elided' frame decorator
  19970. interface might be preferable.
  19971. This example approaches the issue with the 'elided' method. This
  19972. example is quite long, but very simplistic. It is out-of-scope for this
  19973. section to write a complete example that comprehensively covers all
  19974. approaches of finding and printing inlined frames. However, this
  19975. example illustrates the approach an author might use.
  19976. This example comprises of three sections.
  19977. class InlineFrameFilter():
  19978. def __init__(self):
  19979. self.name = "InlinedFrameFilter"
  19980. self.priority = 100
  19981. self.enabled = True
  19982. gdb.frame_filters[self.name] = self
  19983. def filter(self, frame_iter):
  19984. return ElidingInlineIterator(frame_iter)
  19985. This frame filter is very similar to the other examples. The only
  19986. difference is this frame filter is wrapping the iterator provided to it
  19987. ('frame_iter') with a custom iterator called 'ElidingInlineIterator'.
  19988. This again defers actions to when GDB prints the backtrace, as the
  19989. iterator is not traversed until printing.
  19990. The iterator for this example is as follows. It is in this section
  19991. of the example where decisions are made on the content of the backtrace.
  19992. class ElidingInlineIterator:
  19993. def __init__(self, ii):
  19994. self.input_iterator = ii
  19995. def __iter__(self):
  19996. return self
  19997. def next(self):
  19998. frame = next(self.input_iterator)
  19999. if frame.inferior_frame().type() != gdb.INLINE_FRAME:
  20000. return frame
  20001. try:
  20002. eliding_frame = next(self.input_iterator)
  20003. except StopIteration:
  20004. return frame
  20005. return ElidingFrameDecorator(eliding_frame, [frame])
  20006. This iterator implements the Python iterator protocol. When the
  20007. 'next' function is called (when GDB prints each frame), the iterator
  20008. checks if this frame decorator, 'frame', is wrapping an inlined frame.
  20009. If it is not, it returns the existing frame decorator untouched. If it
  20010. is wrapping an inlined frame, it assumes that the inlined frame was
  20011. contained within the next oldest frame, 'eliding_frame', which it
  20012. fetches. It then creates and returns a frame decorator,
  20013. 'ElidingFrameDecorator', which contains both the elided frame, and the
  20014. eliding frame.
  20015. class ElidingInlineDecorator(FrameDecorator):
  20016. def __init__(self, frame, elided_frames):
  20017. super(ElidingInlineDecorator, self).__init__(frame)
  20018. self.frame = frame
  20019. self.elided_frames = elided_frames
  20020. def elided(self):
  20021. return iter(self.elided_frames)
  20022. This frame decorator overrides one function and returns the inlined
  20023. frame in the 'elided' method. As before it lets 'FrameDecorator' do the
  20024. rest of the work involved in printing this frame. This produces the
  20025. following output.
  20026. #0 0x004004e0 in bar () at inline.c:11
  20027. #2 0x00400529 in main () at inline.c:25
  20028. #1 0x00400529 in max (b=6, a=12) at inline.c:15
  20029. In that output, 'max' which has been inlined into 'main' is printed
  20030. hierarchically. Another approach would be to combine the 'function'
  20031. method, and the 'elided' method to both print a marker in the inlined
  20032. frame, and also show the hierarchical relationship.
  20033. 
  20034. File: gdb.info, Node: Unwinding Frames in Python, Next: Xmethods In Python, Prev: Writing a Frame Filter, Up: Python API
  20035. 23.2.2.12 Unwinding Frames in Python
  20036. ....................................
  20037. In GDB terminology "unwinding" is the process of finding the previous
  20038. frame (that is, caller's) from the current one. An unwinder has three
  20039. methods. The first one checks if it can handle given frame ("sniff"
  20040. it). For the frames it can sniff an unwinder provides two additional
  20041. methods: it can return frame's ID, and it can fetch registers from the
  20042. previous frame. A running GDB mantains a list of the unwinders and
  20043. calls each unwinder's sniffer in turn until it finds the one that
  20044. recognizes the current frame. There is an API to register an unwinder.
  20045. The unwinders that come with GDB handle standard frames. However,
  20046. mixed language applications (for example, an application running Java
  20047. Virtual Machine) sometimes use frame layouts that cannot be handled by
  20048. the GDB unwinders. You can write Python code that can handle such
  20049. custom frames.
  20050. You implement a frame unwinder in Python as a class with which has
  20051. two attributes, 'name' and 'enabled', with obvious meanings, and a
  20052. single method '__call__', which examines a given frame and returns an
  20053. object (an instance of 'gdb.UnwindInfo class)' describing it. If an
  20054. unwinder does not recognize a frame, it should return 'None'. The code
  20055. in GDB that enables writing unwinders in Python uses this object to
  20056. return frame's ID and previous frame registers when GDB core asks for
  20057. them.
  20058. An unwinder should do as little work as possible. Some otherwise
  20059. innocuous operations can cause problems (even crashes, as this code is
  20060. not not well-hardened yet). For example, making an inferior call from
  20061. an unwinder is unadvisable, as an inferior call will reset GDB's stack
  20062. unwinding process, potentially causing re-entrant unwinding.
  20063. Unwinder Input
  20064. --------------
  20065. An object passed to an unwinder (a 'gdb.PendingFrame' instance) provides
  20066. a method to read frame's registers:
  20067. -- Function: PendingFrame.read_register (reg)
  20068. This method returns the contents of the register REG in the frame
  20069. as a 'gdb.Value' object. For a description of the acceptable
  20070. values of REG see *note Frame.read_register:
  20071. gdbpy_frame_read_register. If REG does not name a register for the
  20072. current architecture, this method will throw an exception.
  20073. Note that this method will always return a 'gdb.Value' for a valid
  20074. register name. This does not mean that the value will be valid.
  20075. For example, you may request a register that an earlier unwinder
  20076. could not unwind--the value will be unavailable. Instead, the
  20077. 'gdb.Value' returned from this method will be lazy; that is, its
  20078. underlying bits will not be fetched until it is first used. So,
  20079. attempting to use such a value will cause an exception at the point
  20080. of use.
  20081. The type of the returned 'gdb.Value' depends on the register and
  20082. the architecture. It is common for registers to have a scalar
  20083. type, like 'long long'; but many other types are possible, such as
  20084. pointer, pointer-to-function, floating point or vector types.
  20085. It also provides a factory method to create a 'gdb.UnwindInfo'
  20086. instance to be returned to GDB:
  20087. -- Function: PendingFrame.create_unwind_info (frame_id)
  20088. Returns a new 'gdb.UnwindInfo' instance identified by given
  20089. FRAME_ID. The argument is used to build GDB's frame ID using one
  20090. of functions provided by GDB. FRAME_ID's attributes determine
  20091. which function will be used, as follows:
  20092. 'sp, pc'
  20093. The frame is identified by the given stack address and PC. The
  20094. stack address must be chosen so that it is constant throughout
  20095. the lifetime of the frame, so a typical choice is the value of
  20096. the stack pointer at the start of the function--in the DWARF
  20097. standard, this would be the "Call Frame Address".
  20098. This is the most common case by far. The other cases are
  20099. documented for completeness but are only useful in specialized
  20100. situations.
  20101. 'sp, pc, special'
  20102. The frame is identified by the stack address, the PC, and a
  20103. "special" address. The special address is used on
  20104. architectures that can have frames that do not change the
  20105. stack, but which are still distinct, for example the IA-64,
  20106. which has a second stack for registers. Both SP and SPECIAL
  20107. must be constant throughout the lifetime of the frame.
  20108. 'sp'
  20109. The frame is identified by the stack address only. Any other
  20110. stack frame with a matching SP will be considered to match
  20111. this frame. Inside gdb, this is called a "wild frame". You
  20112. will never need this.
  20113. Each attribute value should be an instance of 'gdb.Value'.
  20114. -- Function: PendingFrame.architecture ()
  20115. Return the 'gdb.Architecture' (*note Architectures In Python::) for
  20116. this 'gdb.PendingFrame'. This represents the architecture of the
  20117. particular frame being unwound.
  20118. Unwinder Output: UnwindInfo
  20119. ---------------------------
  20120. Use 'PendingFrame.create_unwind_info' method described above to create a
  20121. 'gdb.UnwindInfo' instance. Use the following method to specify caller
  20122. registers that have been saved in this frame:
  20123. -- Function: gdb.UnwindInfo.add_saved_register (reg, value)
  20124. REG identifies the register, for a description of the acceptable
  20125. values see *note Frame.read_register: gdbpy_frame_read_register.
  20126. VALUE is a register value (a 'gdb.Value' object).
  20127. Unwinder Skeleton Code
  20128. ----------------------
  20129. GDB comes with the module containing the base 'Unwinder' class. Derive
  20130. your unwinder class from it and structure the code as follows:
  20131. from gdb.unwinders import Unwinder
  20132. class FrameId(object):
  20133. def __init__(self, sp, pc):
  20134. self.sp = sp
  20135. self.pc = pc
  20136. class MyUnwinder(Unwinder):
  20137. def __init__(....):
  20138. super(MyUnwinder, self).__init___(<expects unwinder name argument>)
  20139. def __call__(pending_frame):
  20140. if not <we recognize frame>:
  20141. return None
  20142. # Create UnwindInfo. Usually the frame is identified by the stack
  20143. # pointer and the program counter.
  20144. sp = pending_frame.read_register(<SP number>)
  20145. pc = pending_frame.read_register(<PC number>)
  20146. unwind_info = pending_frame.create_unwind_info(FrameId(sp, pc))
  20147. # Find the values of the registers in the caller's frame and
  20148. # save them in the result:
  20149. unwind_info.add_saved_register(<register>, <value>)
  20150. ....
  20151. # Return the result:
  20152. return unwind_info
  20153. Registering a Unwinder
  20154. ----------------------
  20155. An object file, a program space, and the GDB proper can have unwinders
  20156. registered with it.
  20157. The 'gdb.unwinders' module provides the function to register a
  20158. unwinder:
  20159. -- Function: gdb.unwinder.register_unwinder (locus, unwinder,
  20160. replace=False)
  20161. LOCUS is specifies an object file or a program space to which
  20162. UNWINDER is added. Passing 'None' or 'gdb' adds UNWINDER to the
  20163. GDB's global unwinder list. The newly added UNWINDER will be
  20164. called before any other unwinder from the same locus. Two
  20165. unwinders in the same locus cannot have the same name. An attempt
  20166. to add a unwinder with already existing name raises an exception
  20167. unless REPLACE is 'True', in which case the old unwinder is
  20168. deleted.
  20169. Unwinder Precedence
  20170. -------------------
  20171. GDB first calls the unwinders from all the object files in no particular
  20172. order, then the unwinders from the current program space, and finally
  20173. the unwinders from GDB.
  20174. 
  20175. File: gdb.info, Node: Xmethods In Python, Next: Xmethod API, Prev: Unwinding Frames in Python, Up: Python API
  20176. 23.2.2.13 Xmethods In Python
  20177. ............................
  20178. "Xmethods" are additional methods or replacements for existing methods
  20179. of a C++ class. This feature is useful for those cases where a method
  20180. defined in C++ source code could be inlined or optimized out by the
  20181. compiler, making it unavailable to GDB. For such cases, one can define
  20182. an xmethod to serve as a replacement for the method defined in the C++
  20183. source code. GDB will then invoke the xmethod, instead of the C++
  20184. method, to evaluate expressions. One can also use xmethods when
  20185. debugging with core files. Moreover, when debugging live programs,
  20186. invoking an xmethod need not involve running the inferior (which can
  20187. potentially perturb its state). Hence, even if the C++ method is
  20188. available, it is better to use its replacement xmethod if one is
  20189. defined.
  20190. The xmethods feature in Python is available via the concepts of an
  20191. "xmethod matcher" and an "xmethod worker". To implement an xmethod, one
  20192. has to implement a matcher and a corresponding worker for it (more than
  20193. one worker can be implemented, each catering to a different overloaded
  20194. instance of the method). Internally, GDB invokes the 'match' method of
  20195. a matcher to match the class type and method name. On a match, the
  20196. 'match' method returns a list of matching _worker_ objects. Each worker
  20197. object typically corresponds to an overloaded instance of the xmethod.
  20198. They implement a 'get_arg_types' method which returns a sequence of
  20199. types corresponding to the arguments the xmethod requires. GDB uses
  20200. this sequence of types to perform overload resolution and picks a
  20201. winning xmethod worker. A winner is also selected from among the
  20202. methods GDB finds in the C++ source code. Next, the winning xmethod
  20203. worker and the winning C++ method are compared to select an overall
  20204. winner. In case of a tie between a xmethod worker and a C++ method, the
  20205. xmethod worker is selected as the winner. That is, if a winning xmethod
  20206. worker is found to be equivalent to the winning C++ method, then the
  20207. xmethod worker is treated as a replacement for the C++ method. GDB uses
  20208. the overall winner to invoke the method. If the winning xmethod worker
  20209. is the overall winner, then the corresponding xmethod is invoked via the
  20210. '__call__' method of the worker object.
  20211. If one wants to implement an xmethod as a replacement for an existing
  20212. C++ method, then they have to implement an equivalent xmethod which has
  20213. exactly the same name and takes arguments of exactly the same type as
  20214. the C++ method. If the user wants to invoke the C++ method even though
  20215. a replacement xmethod is available for that method, then they can
  20216. disable the xmethod.
  20217. *Note Xmethod API::, for API to implement xmethods in Python. *Note
  20218. Writing an Xmethod::, for implementing xmethods in Python.
  20219. 
  20220. File: gdb.info, Node: Xmethod API, Next: Writing an Xmethod, Prev: Xmethods In Python, Up: Python API
  20221. 23.2.2.14 Xmethod API
  20222. .....................
  20223. The GDB Python API provides classes, interfaces and functions to
  20224. implement, register and manipulate xmethods. *Note Xmethods In
  20225. Python::.
  20226. An xmethod matcher should be an instance of a class derived from
  20227. 'XMethodMatcher' defined in the module 'gdb.xmethod', or an object with
  20228. similar interface and attributes. An instance of 'XMethodMatcher' has
  20229. the following attributes:
  20230. -- Variable: name
  20231. The name of the matcher.
  20232. -- Variable: enabled
  20233. A boolean value indicating whether the matcher is enabled or
  20234. disabled.
  20235. -- Variable: methods
  20236. A list of named methods managed by the matcher. Each object in the
  20237. list is an instance of the class 'XMethod' defined in the module
  20238. 'gdb.xmethod', or any object with the following attributes:
  20239. 'name'
  20240. Name of the xmethod which should be unique for each xmethod
  20241. managed by the matcher.
  20242. 'enabled'
  20243. A boolean value indicating whether the xmethod is enabled or
  20244. disabled.
  20245. The class 'XMethod' is a convenience class with same attributes as
  20246. above along with the following constructor:
  20247. -- Function: XMethod.__init__ (self, name)
  20248. Constructs an enabled xmethod with name NAME.
  20249. The 'XMethodMatcher' class has the following methods:
  20250. -- Function: XMethodMatcher.__init__ (self, name)
  20251. Constructs an enabled xmethod matcher with name NAME. The
  20252. 'methods' attribute is initialized to 'None'.
  20253. -- Function: XMethodMatcher.match (self, class_type, method_name)
  20254. Derived classes should override this method. It should return a
  20255. xmethod worker object (or a sequence of xmethod worker objects)
  20256. matching the CLASS_TYPE and METHOD_NAME. CLASS_TYPE is a
  20257. 'gdb.Type' object, and METHOD_NAME is a string value. If the
  20258. matcher manages named methods as listed in its 'methods' attribute,
  20259. then only those worker objects whose corresponding entries in the
  20260. 'methods' list are enabled should be returned.
  20261. An xmethod worker should be an instance of a class derived from
  20262. 'XMethodWorker' defined in the module 'gdb.xmethod', or support the
  20263. following interface:
  20264. -- Function: XMethodWorker.get_arg_types (self)
  20265. This method returns a sequence of 'gdb.Type' objects corresponding
  20266. to the arguments that the xmethod takes. It can return an empty
  20267. sequence or 'None' if the xmethod does not take any arguments. If
  20268. the xmethod takes a single argument, then a single 'gdb.Type'
  20269. object corresponding to it can be returned.
  20270. -- Function: XMethodWorker.get_result_type (self, *args)
  20271. This method returns a 'gdb.Type' object representing the type of
  20272. the result of invoking this xmethod. The ARGS argument is the same
  20273. tuple of arguments that would be passed to the '__call__' method of
  20274. this worker.
  20275. -- Function: XMethodWorker.__call__ (self, *args)
  20276. This is the method which does the _work_ of the xmethod. The ARGS
  20277. arguments is the tuple of arguments to the xmethod. Each element
  20278. in this tuple is a gdb.Value object. The first element is always
  20279. the 'this' pointer value.
  20280. For GDB to lookup xmethods, the xmethod matchers should be registered
  20281. using the following function defined in the module 'gdb.xmethod':
  20282. -- Function: register_xmethod_matcher (locus, matcher, replace=False)
  20283. The 'matcher' is registered with 'locus', replacing an existing
  20284. matcher with the same name as 'matcher' if 'replace' is 'True'.
  20285. 'locus' can be a 'gdb.Objfile' object (*note Objfiles In Python::),
  20286. or a 'gdb.Progspace' object (*note Progspaces In Python::), or
  20287. 'None'. If it is 'None', then 'matcher' is registered globally.
  20288. 
  20289. File: gdb.info, Node: Writing an Xmethod, Next: Inferiors In Python, Prev: Xmethod API, Up: Python API
  20290. 23.2.2.15 Writing an Xmethod
  20291. ............................
  20292. Implementing xmethods in Python will require implementing xmethod
  20293. matchers and xmethod workers (*note Xmethods In Python::). Consider the
  20294. following C++ class:
  20295. class MyClass
  20296. {
  20297. public:
  20298. MyClass (int a) : a_(a) { }
  20299. int geta (void) { return a_; }
  20300. int operator+ (int b);
  20301. private:
  20302. int a_;
  20303. };
  20304. int
  20305. MyClass::operator+ (int b)
  20306. {
  20307. return a_ + b;
  20308. }
  20309. Let us define two xmethods for the class 'MyClass', one replacing the
  20310. method 'geta', and another adding an overloaded flavor of 'operator+'
  20311. which takes a 'MyClass' argument (the C++ code above already has an
  20312. overloaded 'operator+' which takes an 'int' argument). The xmethod
  20313. matcher can be defined as follows:
  20314. class MyClass_geta(gdb.xmethod.XMethod):
  20315. def __init__(self):
  20316. gdb.xmethod.XMethod.__init__(self, 'geta')
  20317. def get_worker(self, method_name):
  20318. if method_name == 'geta':
  20319. return MyClassWorker_geta()
  20320. class MyClass_sum(gdb.xmethod.XMethod):
  20321. def __init__(self):
  20322. gdb.xmethod.XMethod.__init__(self, 'sum')
  20323. def get_worker(self, method_name):
  20324. if method_name == 'operator+':
  20325. return MyClassWorker_plus()
  20326. class MyClassMatcher(gdb.xmethod.XMethodMatcher):
  20327. def __init__(self):
  20328. gdb.xmethod.XMethodMatcher.__init__(self, 'MyClassMatcher')
  20329. # List of methods 'managed' by this matcher
  20330. self.methods = [MyClass_geta(), MyClass_sum()]
  20331. def match(self, class_type, method_name):
  20332. if class_type.tag != 'MyClass':
  20333. return None
  20334. workers = []
  20335. for method in self.methods:
  20336. if method.enabled:
  20337. worker = method.get_worker(method_name)
  20338. if worker:
  20339. workers.append(worker)
  20340. return workers
  20341. Notice that the 'match' method of 'MyClassMatcher' returns a worker
  20342. object of type 'MyClassWorker_geta' for the 'geta' method, and a worker
  20343. object of type 'MyClassWorker_plus' for the 'operator+' method. This is
  20344. done indirectly via helper classes derived from 'gdb.xmethod.XMethod'.
  20345. One does not need to use the 'methods' attribute in a matcher as it is
  20346. optional. However, if a matcher manages more than one xmethod, it is a
  20347. good practice to list the xmethods in the 'methods' attribute of the
  20348. matcher. This will then facilitate enabling and disabling individual
  20349. xmethods via the 'enable/disable' commands. Notice also that a worker
  20350. object is returned only if the corresponding entry in the 'methods'
  20351. attribute of the matcher is enabled.
  20352. The implementation of the worker classes returned by the matcher
  20353. setup above is as follows:
  20354. class MyClassWorker_geta(gdb.xmethod.XMethodWorker):
  20355. def get_arg_types(self):
  20356. return None
  20357. def get_result_type(self, obj):
  20358. return gdb.lookup_type('int')
  20359. def __call__(self, obj):
  20360. return obj['a_']
  20361. class MyClassWorker_plus(gdb.xmethod.XMethodWorker):
  20362. def get_arg_types(self):
  20363. return gdb.lookup_type('MyClass')
  20364. def get_result_type(self, obj):
  20365. return gdb.lookup_type('int')
  20366. def __call__(self, obj, other):
  20367. return obj['a_'] + other['a_']
  20368. For GDB to actually lookup a xmethod, it has to be registered with
  20369. it. The matcher defined above is registered with GDB globally as
  20370. follows:
  20371. gdb.xmethod.register_xmethod_matcher(None, MyClassMatcher())
  20372. If an object 'obj' of type 'MyClass' is initialized in C++ code as
  20373. follows:
  20374. MyClass obj(5);
  20375. then, after loading the Python script defining the xmethod matchers and
  20376. workers into 'GDBN', invoking the method 'geta' or using the operator
  20377. '+' on 'obj' will invoke the xmethods defined above:
  20378. (gdb) p obj.geta()
  20379. $1 = 5
  20380. (gdb) p obj + obj
  20381. $2 = 10
  20382. Consider another example with a C++ template class:
  20383. template <class T>
  20384. class MyTemplate
  20385. {
  20386. public:
  20387. MyTemplate () : dsize_(10), data_ (new T [10]) { }
  20388. ~MyTemplate () { delete [] data_; }
  20389. int footprint (void)
  20390. {
  20391. return sizeof (T) * dsize_ + sizeof (MyTemplate<T>);
  20392. }
  20393. private:
  20394. int dsize_;
  20395. T *data_;
  20396. };
  20397. Let us implement an xmethod for the above class which serves as a
  20398. replacement for the 'footprint' method. The full code listing of the
  20399. xmethod workers and xmethod matchers is as follows:
  20400. class MyTemplateWorker_footprint(gdb.xmethod.XMethodWorker):
  20401. def __init__(self, class_type):
  20402. self.class_type = class_type
  20403. def get_arg_types(self):
  20404. return None
  20405. def get_result_type(self):
  20406. return gdb.lookup_type('int')
  20407. def __call__(self, obj):
  20408. return (self.class_type.sizeof +
  20409. obj['dsize_'] *
  20410. self.class_type.template_argument(0).sizeof)
  20411. class MyTemplateMatcher_footprint(gdb.xmethod.XMethodMatcher):
  20412. def __init__(self):
  20413. gdb.xmethod.XMethodMatcher.__init__(self, 'MyTemplateMatcher')
  20414. def match(self, class_type, method_name):
  20415. if (re.match('MyTemplate<[ \t\n]*[_a-zA-Z][ _a-zA-Z0-9]*>',
  20416. class_type.tag) and
  20417. method_name == 'footprint'):
  20418. return MyTemplateWorker_footprint(class_type)
  20419. Notice that, in this example, we have not used the 'methods'
  20420. attribute of the matcher as the matcher manages only one xmethod. The
  20421. user can enable/disable this xmethod by enabling/disabling the matcher
  20422. itself.
  20423. 
  20424. File: gdb.info, Node: Inferiors In Python, Next: Events In Python, Prev: Writing an Xmethod, Up: Python API
  20425. 23.2.2.16 Inferiors In Python
  20426. .............................
  20427. Programs which are being run under GDB are called inferiors (*note
  20428. Inferiors Connections and Programs::). Python scripts can access
  20429. information about and manipulate inferiors controlled by GDB via objects
  20430. of the 'gdb.Inferior' class.
  20431. The following inferior-related functions are available in the 'gdb'
  20432. module:
  20433. -- Function: gdb.inferiors ()
  20434. Return a tuple containing all inferior objects.
  20435. -- Function: gdb.selected_inferior ()
  20436. Return an object representing the current inferior.
  20437. A 'gdb.Inferior' object has the following attributes:
  20438. -- Variable: Inferior.num
  20439. ID of inferior, as assigned by GDB.
  20440. -- Variable: Inferior.pid
  20441. Process ID of the inferior, as assigned by the underlying operating
  20442. system.
  20443. -- Variable: Inferior.was_attached
  20444. Boolean signaling whether the inferior was created using 'attach',
  20445. or started by GDB itself.
  20446. -- Variable: Inferior.progspace
  20447. The inferior's program space. *Note Progspaces In Python::.
  20448. A 'gdb.Inferior' object has the following methods:
  20449. -- Function: Inferior.is_valid ()
  20450. Returns 'True' if the 'gdb.Inferior' object is valid, 'False' if
  20451. not. A 'gdb.Inferior' object will become invalid if the inferior
  20452. no longer exists within GDB. All other 'gdb.Inferior' methods will
  20453. throw an exception if it is invalid at the time the method is
  20454. called.
  20455. -- Function: Inferior.threads ()
  20456. This method returns a tuple holding all the threads which are valid
  20457. when it is called. If there are no valid threads, the method will
  20458. return an empty tuple.
  20459. -- Function: Inferior.architecture ()
  20460. Return the 'gdb.Architecture' (*note Architectures In Python::) for
  20461. this inferior. This represents the architecture of the inferior as
  20462. a whole. Some platforms can have multiple architectures in a
  20463. single address space, so this may not match the architecture of a
  20464. particular frame (*note Frames In Python::).
  20465. -- Function: Inferior.read_memory (address, length)
  20466. Read LENGTH addressable memory units from the inferior, starting at
  20467. ADDRESS. Returns a buffer object, which behaves much like an array
  20468. or a string. It can be modified and given to the
  20469. 'Inferior.write_memory' function. In Python 3, the return value is
  20470. a 'memoryview' object.
  20471. -- Function: Inferior.write_memory (address, buffer [, length])
  20472. Write the contents of BUFFER to the inferior, starting at ADDRESS.
  20473. The BUFFER parameter must be a Python object which supports the
  20474. buffer protocol, i.e., a string, an array or the object returned
  20475. from 'Inferior.read_memory'. If given, LENGTH determines the
  20476. number of addressable memory units from BUFFER to be written.
  20477. -- Function: Inferior.search_memory (address, length, pattern)
  20478. Search a region of the inferior memory starting at ADDRESS with the
  20479. given LENGTH using the search pattern supplied in PATTERN. The
  20480. PATTERN parameter must be a Python object which supports the buffer
  20481. protocol, i.e., a string, an array or the object returned from
  20482. 'gdb.read_memory'. Returns a Python 'Long' containing the address
  20483. where the pattern was found, or 'None' if the pattern could not be
  20484. found.
  20485. -- Function: Inferior.thread_from_handle (handle)
  20486. Return the thread object corresponding to HANDLE, a thread library
  20487. specific data structure such as 'pthread_t' for pthreads library
  20488. implementations.
  20489. The function 'Inferior.thread_from_thread_handle' provides the same
  20490. functionality, but use of 'Inferior.thread_from_thread_handle' is
  20491. deprecated.
  20492. 
  20493. File: gdb.info, Node: Events In Python, Next: Threads In Python, Prev: Inferiors In Python, Up: Python API
  20494. 23.2.2.17 Events In Python
  20495. ..........................
  20496. GDB provides a general event facility so that Python code can be
  20497. notified of various state changes, particularly changes that occur in
  20498. the inferior.
  20499. An "event" is just an object that describes some state change. The
  20500. type of the object and its attributes will vary depending on the details
  20501. of the change. All the existing events are described below.
  20502. In order to be notified of an event, you must register an event
  20503. handler with an "event registry". An event registry is an object in the
  20504. 'gdb.events' module which dispatches particular events. A registry
  20505. provides methods to register and unregister event handlers:
  20506. -- Function: EventRegistry.connect (object)
  20507. Add the given callable OBJECT to the registry. This object will be
  20508. called when an event corresponding to this registry occurs.
  20509. -- Function: EventRegistry.disconnect (object)
  20510. Remove the given OBJECT from the registry. Once removed, the
  20511. object will no longer receive notifications of events.
  20512. Here is an example:
  20513. def exit_handler (event):
  20514. print "event type: exit"
  20515. print "exit code: %d" % (event.exit_code)
  20516. gdb.events.exited.connect (exit_handler)
  20517. In the above example we connect our handler 'exit_handler' to the
  20518. registry 'events.exited'. Once connected, 'exit_handler' gets called
  20519. when the inferior exits. The argument "event" in this example is of
  20520. type 'gdb.ExitedEvent'. As you can see in the example the 'ExitedEvent'
  20521. object has an attribute which indicates the exit code of the inferior.
  20522. The following is a listing of the event registries that are available
  20523. and details of the events they emit:
  20524. 'events.cont'
  20525. Emits 'gdb.ThreadEvent'.
  20526. Some events can be thread specific when GDB is running in non-stop
  20527. mode. When represented in Python, these events all extend
  20528. 'gdb.ThreadEvent'. Note, this event is not emitted directly;
  20529. instead, events which are emitted by this or other modules might
  20530. extend this event. Examples of these events are
  20531. 'gdb.BreakpointEvent' and 'gdb.ContinueEvent'.
  20532. -- Variable: ThreadEvent.inferior_thread
  20533. In non-stop mode this attribute will be set to the specific
  20534. thread which was involved in the emitted event. Otherwise, it
  20535. will be set to 'None'.
  20536. Emits 'gdb.ContinueEvent' which extends 'gdb.ThreadEvent'.
  20537. This event indicates that the inferior has been continued after a
  20538. stop. For inherited attribute refer to 'gdb.ThreadEvent' above.
  20539. 'events.exited'
  20540. Emits 'events.ExitedEvent' which indicates that the inferior has
  20541. exited. 'events.ExitedEvent' has two attributes:
  20542. -- Variable: ExitedEvent.exit_code
  20543. An integer representing the exit code, if available, which the
  20544. inferior has returned. (The exit code could be unavailable
  20545. if, for example, GDB detaches from the inferior.) If the exit
  20546. code is unavailable, the attribute does not exist.
  20547. -- Variable: ExitedEvent.inferior
  20548. A reference to the inferior which triggered the 'exited'
  20549. event.
  20550. 'events.stop'
  20551. Emits 'gdb.StopEvent' which extends 'gdb.ThreadEvent'.
  20552. Indicates that the inferior has stopped. All events emitted by
  20553. this registry extend StopEvent. As a child of 'gdb.ThreadEvent',
  20554. 'gdb.StopEvent' will indicate the stopped thread when GDB is
  20555. running in non-stop mode. Refer to 'gdb.ThreadEvent' above for
  20556. more details.
  20557. Emits 'gdb.SignalEvent' which extends 'gdb.StopEvent'.
  20558. This event indicates that the inferior or one of its threads has
  20559. received as signal. 'gdb.SignalEvent' has the following
  20560. attributes:
  20561. -- Variable: SignalEvent.stop_signal
  20562. A string representing the signal received by the inferior. A
  20563. list of possible signal values can be obtained by running the
  20564. command 'info signals' in the GDB command prompt.
  20565. Also emits 'gdb.BreakpointEvent' which extends 'gdb.StopEvent'.
  20566. 'gdb.BreakpointEvent' event indicates that one or more breakpoints
  20567. have been hit, and has the following attributes:
  20568. -- Variable: BreakpointEvent.breakpoints
  20569. A sequence containing references to all the breakpoints (type
  20570. 'gdb.Breakpoint') that were hit. *Note Breakpoints In
  20571. Python::, for details of the 'gdb.Breakpoint' object.
  20572. -- Variable: BreakpointEvent.breakpoint
  20573. A reference to the first breakpoint that was hit. This
  20574. function is maintained for backward compatibility and is now
  20575. deprecated in favor of the 'gdb.BreakpointEvent.breakpoints'
  20576. attribute.
  20577. 'events.new_objfile'
  20578. Emits 'gdb.NewObjFileEvent' which indicates that a new object file
  20579. has been loaded by GDB. 'gdb.NewObjFileEvent' has one attribute:
  20580. -- Variable: NewObjFileEvent.new_objfile
  20581. A reference to the object file ('gdb.Objfile') which has been
  20582. loaded. *Note Objfiles In Python::, for details of the
  20583. 'gdb.Objfile' object.
  20584. 'events.clear_objfiles'
  20585. Emits 'gdb.ClearObjFilesEvent' which indicates that the list of
  20586. object files for a program space has been reset.
  20587. 'gdb.ClearObjFilesEvent' has one attribute:
  20588. -- Variable: ClearObjFilesEvent.progspace
  20589. A reference to the program space ('gdb.Progspace') whose
  20590. objfile list has been cleared. *Note Progspaces In Python::.
  20591. 'events.inferior_call'
  20592. Emits events just before and after a function in the inferior is
  20593. called by GDB. Before an inferior call, this emits an event of
  20594. type 'gdb.InferiorCallPreEvent', and after an inferior call, this
  20595. emits an event of type 'gdb.InferiorCallPostEvent'.
  20596. 'gdb.InferiorCallPreEvent'
  20597. Indicates that a function in the inferior is about to be
  20598. called.
  20599. -- Variable: InferiorCallPreEvent.ptid
  20600. The thread in which the call will be run.
  20601. -- Variable: InferiorCallPreEvent.address
  20602. The location of the function to be called.
  20603. 'gdb.InferiorCallPostEvent'
  20604. Indicates that a function in the inferior has just been
  20605. called.
  20606. -- Variable: InferiorCallPostEvent.ptid
  20607. The thread in which the call was run.
  20608. -- Variable: InferiorCallPostEvent.address
  20609. The location of the function that was called.
  20610. 'events.memory_changed'
  20611. Emits 'gdb.MemoryChangedEvent' which indicates that the memory of
  20612. the inferior has been modified by the GDB user, for instance via a
  20613. command like 'set *addr = value'. The event has the following
  20614. attributes:
  20615. -- Variable: MemoryChangedEvent.address
  20616. The start address of the changed region.
  20617. -- Variable: MemoryChangedEvent.length
  20618. Length in bytes of the changed region.
  20619. 'events.register_changed'
  20620. Emits 'gdb.RegisterChangedEvent' which indicates that a register in
  20621. the inferior has been modified by the GDB user.
  20622. -- Variable: RegisterChangedEvent.frame
  20623. A gdb.Frame object representing the frame in which the
  20624. register was modified.
  20625. -- Variable: RegisterChangedEvent.regnum
  20626. Denotes which register was modified.
  20627. 'events.breakpoint_created'
  20628. This is emitted when a new breakpoint has been created. The
  20629. argument that is passed is the new 'gdb.Breakpoint' object.
  20630. 'events.breakpoint_modified'
  20631. This is emitted when a breakpoint has been modified in some way.
  20632. The argument that is passed is the new 'gdb.Breakpoint' object.
  20633. 'events.breakpoint_deleted'
  20634. This is emitted when a breakpoint has been deleted. The argument
  20635. that is passed is the 'gdb.Breakpoint' object. When this event is
  20636. emitted, the 'gdb.Breakpoint' object will already be in its invalid
  20637. state; that is, the 'is_valid' method will return 'False'.
  20638. 'events.before_prompt'
  20639. This event carries no payload. It is emitted each time GDB
  20640. presents a prompt to the user.
  20641. 'events.new_inferior'
  20642. This is emitted when a new inferior is created. Note that the
  20643. inferior is not necessarily running; in fact, it may not even have
  20644. an associated executable.
  20645. The event is of type 'gdb.NewInferiorEvent'. This has a single
  20646. attribute:
  20647. -- Variable: NewInferiorEvent.inferior
  20648. The new inferior, a 'gdb.Inferior' object.
  20649. 'events.inferior_deleted'
  20650. This is emitted when an inferior has been deleted. Note that this
  20651. is not the same as process exit; it is notified when the inferior
  20652. itself is removed, say via 'remove-inferiors'.
  20653. The event is of type 'gdb.InferiorDeletedEvent'. This has a single
  20654. attribute:
  20655. -- Variable: NewInferiorEvent.inferior
  20656. The inferior that is being removed, a 'gdb.Inferior' object.
  20657. 'events.new_thread'
  20658. This is emitted when GDB notices a new thread. The event is of
  20659. type 'gdb.NewThreadEvent', which extends 'gdb.ThreadEvent'. This
  20660. has a single attribute:
  20661. -- Variable: NewThreadEvent.inferior_thread
  20662. The new thread.
  20663. 
  20664. File: gdb.info, Node: Threads In Python, Next: Recordings In Python, Prev: Events In Python, Up: Python API
  20665. 23.2.2.18 Threads In Python
  20666. ...........................
  20667. Python scripts can access information about, and manipulate inferior
  20668. threads controlled by GDB, via objects of the 'gdb.InferiorThread'
  20669. class.
  20670. The following thread-related functions are available in the 'gdb'
  20671. module:
  20672. -- Function: gdb.selected_thread ()
  20673. This function returns the thread object for the selected thread.
  20674. If there is no selected thread, this will return 'None'.
  20675. To get the list of threads for an inferior, use the
  20676. 'Inferior.threads()' method. *Note Inferiors In Python::.
  20677. A 'gdb.InferiorThread' object has the following attributes:
  20678. -- Variable: InferiorThread.name
  20679. The name of the thread. If the user specified a name using 'thread
  20680. name', then this returns that name. Otherwise, if an OS-supplied
  20681. name is available, then it is returned. Otherwise, this returns
  20682. 'None'.
  20683. This attribute can be assigned to. The new value must be a string
  20684. object, which sets the new name, or 'None', which removes any
  20685. user-specified thread name.
  20686. -- Variable: InferiorThread.num
  20687. The per-inferior number of the thread, as assigned by GDB.
  20688. -- Variable: InferiorThread.global_num
  20689. The global ID of the thread, as assigned by GDB. You can use this
  20690. to make Python breakpoints thread-specific, for example (*note The
  20691. Breakpoint.thread attribute: python_breakpoint_thread.).
  20692. -- Variable: InferiorThread.ptid
  20693. ID of the thread, as assigned by the operating system. This
  20694. attribute is a tuple containing three integers. The first is the
  20695. Process ID (PID); the second is the Lightweight Process ID (LWPID),
  20696. and the third is the Thread ID (TID). Either the LWPID or TID may
  20697. be 0, which indicates that the operating system does not use that
  20698. identifier.
  20699. -- Variable: InferiorThread.inferior
  20700. The inferior this thread belongs to. This attribute is represented
  20701. as a 'gdb.Inferior' object. This attribute is not writable.
  20702. A 'gdb.InferiorThread' object has the following methods:
  20703. -- Function: InferiorThread.is_valid ()
  20704. Returns 'True' if the 'gdb.InferiorThread' object is valid, 'False'
  20705. if not. A 'gdb.InferiorThread' object will become invalid if the
  20706. thread exits, or the inferior that the thread belongs is deleted.
  20707. All other 'gdb.InferiorThread' methods will throw an exception if
  20708. it is invalid at the time the method is called.
  20709. -- Function: InferiorThread.switch ()
  20710. This changes GDB's currently selected thread to the one represented
  20711. by this object.
  20712. -- Function: InferiorThread.is_stopped ()
  20713. Return a Boolean indicating whether the thread is stopped.
  20714. -- Function: InferiorThread.is_running ()
  20715. Return a Boolean indicating whether the thread is running.
  20716. -- Function: InferiorThread.is_exited ()
  20717. Return a Boolean indicating whether the thread is exited.
  20718. -- Function: InferiorThread.handle ()
  20719. Return the thread object's handle, represented as a Python 'bytes'
  20720. object. A 'gdb.Value' representation of the handle may be
  20721. constructed via 'gdb.Value(bufobj, type)' where BUFOBJ is the
  20722. Python 'bytes' representation of the handle and TYPE is a
  20723. 'gdb.Type' for the handle type.
  20724. 
  20725. File: gdb.info, Node: Recordings In Python, Next: Commands In Python, Prev: Threads In Python, Up: Python API
  20726. 23.2.2.19 Recordings In Python
  20727. ..............................
  20728. The following recordings-related functions (*note Process Record and
  20729. Replay::) are available in the 'gdb' module:
  20730. -- Function: gdb.start_recording ([method], [format])
  20731. Start a recording using the given METHOD and FORMAT. If no FORMAT
  20732. is given, the default format for the recording method is used. If
  20733. no METHOD is given, the default method will be used. Returns a
  20734. 'gdb.Record' object on success. Throw an exception on failure.
  20735. The following strings can be passed as METHOD:
  20736. * '"full"'
  20737. * '"btrace"': Possible values for FORMAT: '"pt"', '"bts"' or
  20738. leave out for default format.
  20739. -- Function: gdb.current_recording ()
  20740. Access a currently running recording. Return a 'gdb.Record' object
  20741. on success. Return 'None' if no recording is currently active.
  20742. -- Function: gdb.stop_recording ()
  20743. Stop the current recording. Throw an exception if no recording is
  20744. currently active. All record objects become invalid after this
  20745. call.
  20746. A 'gdb.Record' object has the following attributes:
  20747. -- Variable: Record.method
  20748. A string with the current recording method, e.g. 'full' or
  20749. 'btrace'.
  20750. -- Variable: Record.format
  20751. A string with the current recording format, e.g. 'bt', 'pts' or
  20752. 'None'.
  20753. -- Variable: Record.begin
  20754. A method specific instruction object representing the first
  20755. instruction in this recording.
  20756. -- Variable: Record.end
  20757. A method specific instruction object representing the current
  20758. instruction, that is not actually part of the recording.
  20759. -- Variable: Record.replay_position
  20760. The instruction representing the current replay position. If there
  20761. is no replay active, this will be 'None'.
  20762. -- Variable: Record.instruction_history
  20763. A list with all recorded instructions.
  20764. -- Variable: Record.function_call_history
  20765. A list with all recorded function call segments.
  20766. A 'gdb.Record' object has the following methods:
  20767. -- Function: Record.goto (instruction)
  20768. Move the replay position to the given INSTRUCTION.
  20769. The common 'gdb.Instruction' class that recording method specific
  20770. instruction objects inherit from, has the following attributes:
  20771. -- Variable: Instruction.pc
  20772. An integer representing this instruction's address.
  20773. -- Variable: Instruction.data
  20774. A buffer with the raw instruction data. In Python 3, the return
  20775. value is a 'memoryview' object.
  20776. -- Variable: Instruction.decoded
  20777. A human readable string with the disassembled instruction.
  20778. -- Variable: Instruction.size
  20779. The size of the instruction in bytes.
  20780. Additionally 'gdb.RecordInstruction' has the following attributes:
  20781. -- Variable: RecordInstruction.number
  20782. An integer identifying this instruction. 'number' corresponds to
  20783. the numbers seen in 'record instruction-history' (*note Process
  20784. Record and Replay::).
  20785. -- Variable: RecordInstruction.sal
  20786. A 'gdb.Symtab_and_line' object representing the associated symtab
  20787. and line of this instruction. May be 'None' if no debug
  20788. information is available.
  20789. -- Variable: RecordInstruction.is_speculative
  20790. A boolean indicating whether the instruction was executed
  20791. speculatively.
  20792. If an error occured during recording or decoding a recording, this
  20793. error is represented by a 'gdb.RecordGap' object in the instruction
  20794. list. It has the following attributes:
  20795. -- Variable: RecordGap.number
  20796. An integer identifying this gap. 'number' corresponds to the
  20797. numbers seen in 'record instruction-history' (*note Process Record
  20798. and Replay::).
  20799. -- Variable: RecordGap.error_code
  20800. A numerical representation of the reason for the gap. The value is
  20801. specific to the current recording method.
  20802. -- Variable: RecordGap.error_string
  20803. A human readable string with the reason for the gap.
  20804. A 'gdb.RecordFunctionSegment' object has the following attributes:
  20805. -- Variable: RecordFunctionSegment.number
  20806. An integer identifying this function segment. 'number' corresponds
  20807. to the numbers seen in 'record function-call-history' (*note
  20808. Process Record and Replay::).
  20809. -- Variable: RecordFunctionSegment.symbol
  20810. A 'gdb.Symbol' object representing the associated symbol. May be
  20811. 'None' if no debug information is available.
  20812. -- Variable: RecordFunctionSegment.level
  20813. An integer representing the function call's stack level. May be
  20814. 'None' if the function call is a gap.
  20815. -- Variable: RecordFunctionSegment.instructions
  20816. A list of 'gdb.RecordInstruction' or 'gdb.RecordGap' objects
  20817. associated with this function call.
  20818. -- Variable: RecordFunctionSegment.up
  20819. A 'gdb.RecordFunctionSegment' object representing the caller's
  20820. function segment. If the call has not been recorded, this will be
  20821. the function segment to which control returns. If neither the call
  20822. nor the return have been recorded, this will be 'None'.
  20823. -- Variable: RecordFunctionSegment.prev
  20824. A 'gdb.RecordFunctionSegment' object representing the previous
  20825. segment of this function call. May be 'None'.
  20826. -- Variable: RecordFunctionSegment.next
  20827. A 'gdb.RecordFunctionSegment' object representing the next segment
  20828. of this function call. May be 'None'.
  20829. The following example demonstrates the usage of these objects and
  20830. functions to create a function that will rewind a record to the last
  20831. time a function in a different file was executed. This would typically
  20832. be used to track the execution of user provided callback functions in a
  20833. library which typically are not visible in a back trace.
  20834. def bringback ():
  20835. rec = gdb.current_recording ()
  20836. if not rec:
  20837. return
  20838. insn = rec.instruction_history
  20839. if len (insn) == 0:
  20840. return
  20841. try:
  20842. position = insn.index (rec.replay_position)
  20843. except:
  20844. position = -1
  20845. try:
  20846. filename = insn[position].sal.symtab.fullname ()
  20847. except:
  20848. filename = None
  20849. for i in reversed (insn[:position]):
  20850. try:
  20851. current = i.sal.symtab.fullname ()
  20852. except:
  20853. current = None
  20854. if filename == current:
  20855. continue
  20856. rec.goto (i)
  20857. return
  20858. Another possible application is to write a function that counts the
  20859. number of code executions in a given line range. This line range can
  20860. contain parts of functions or span across several functions and is not
  20861. limited to be contiguous.
  20862. def countrange (filename, linerange):
  20863. count = 0
  20864. def filter_only (file_name):
  20865. for call in gdb.current_recording ().function_call_history:
  20866. try:
  20867. if file_name in call.symbol.symtab.fullname ():
  20868. yield call
  20869. except:
  20870. pass
  20871. for c in filter_only (filename):
  20872. for i in c.instructions:
  20873. try:
  20874. if i.sal.line in linerange:
  20875. count += 1
  20876. break;
  20877. except:
  20878. pass
  20879. return count
  20880. 
  20881. File: gdb.info, Node: Commands In Python, Next: Parameters In Python, Prev: Recordings In Python, Up: Python API
  20882. 23.2.2.20 Commands In Python
  20883. ............................
  20884. You can implement new GDB CLI commands in Python. A CLI command is
  20885. implemented using an instance of the 'gdb.Command' class, most commonly
  20886. using a subclass.
  20887. -- Function: Command.__init__ (name, COMMAND_CLASS [, COMPLETER_CLASS
  20888. [, PREFIX]])
  20889. The object initializer for 'Command' registers the new command with
  20890. GDB. This initializer is normally invoked from the subclass' own
  20891. '__init__' method.
  20892. NAME is the name of the command. If NAME consists of multiple
  20893. words, then the initial words are looked for as prefix commands.
  20894. In this case, if one of the prefix commands does not exist, an
  20895. exception is raised.
  20896. There is no support for multi-line commands.
  20897. COMMAND_CLASS should be one of the 'COMMAND_' constants defined
  20898. below. This argument tells GDB how to categorize the new command
  20899. in the help system.
  20900. COMPLETER_CLASS is an optional argument. If given, it should be
  20901. one of the 'COMPLETE_' constants defined below. This argument
  20902. tells GDB how to perform completion for this command. If not
  20903. given, GDB will attempt to complete using the object's 'complete'
  20904. method (see below); if no such method is found, an error will occur
  20905. when completion is attempted.
  20906. PREFIX is an optional argument. If 'True', then the new command is
  20907. a prefix command; sub-commands of this command may be registered.
  20908. The help text for the new command is taken from the Python
  20909. documentation string for the command's class, if there is one. If
  20910. no documentation string is provided, the default value "This
  20911. command is not documented." is used.
  20912. -- Function: Command.dont_repeat ()
  20913. By default, a GDB command is repeated when the user enters a blank
  20914. line at the command prompt. A command can suppress this behavior
  20915. by invoking the 'dont_repeat' method. This is similar to the user
  20916. command 'dont-repeat', see *note dont-repeat: Define.
  20917. -- Function: Command.invoke (argument, from_tty)
  20918. This method is called by GDB when this command is invoked.
  20919. ARGUMENT is a string. It is the argument to the command, after
  20920. leading and trailing whitespace has been stripped.
  20921. FROM_TTY is a boolean argument. When true, this means that the
  20922. command was entered by the user at the terminal; when false it
  20923. means that the command came from elsewhere.
  20924. If this method throws an exception, it is turned into a GDB 'error'
  20925. call. Otherwise, the return value is ignored.
  20926. To break ARGUMENT up into an argv-like string use
  20927. 'gdb.string_to_argv'. This function behaves identically to GDB's
  20928. internal argument lexer 'buildargv'. It is recommended to use this
  20929. for consistency. Arguments are separated by spaces and may be
  20930. quoted. Example:
  20931. print gdb.string_to_argv ("1 2\ \\\"3 '4 \"5' \"6 '7\"")
  20932. ['1', '2 "3', '4 "5', "6 '7"]
  20933. -- Function: Command.complete (text, word)
  20934. This method is called by GDB when the user attempts completion on
  20935. this command. All forms of completion are handled by this method,
  20936. that is, the <TAB> and <M-?> key bindings (*note Completion::), and
  20937. the 'complete' command (*note complete: Help.).
  20938. The arguments TEXT and WORD are both strings; TEXT holds the
  20939. complete command line up to the cursor's location, while WORD holds
  20940. the last word of the command line; this is computed using a
  20941. word-breaking heuristic.
  20942. The 'complete' method can return several values:
  20943. * If the return value is a sequence, the contents of the
  20944. sequence are used as the completions. It is up to 'complete'
  20945. to ensure that the contents actually do complete the word. A
  20946. zero-length sequence is allowed, it means that there were no
  20947. completions available. Only string elements of the sequence
  20948. are used; other elements in the sequence are ignored.
  20949. * If the return value is one of the 'COMPLETE_' constants
  20950. defined below, then the corresponding GDB-internal completion
  20951. function is invoked, and its result is used.
  20952. * All other results are treated as though there were no
  20953. available completions.
  20954. When a new command is registered, it must be declared as a member of
  20955. some general class of commands. This is used to classify top-level
  20956. commands in the on-line help system; note that prefix commands are not
  20957. listed under their own category but rather that of their top-level
  20958. command. The available classifications are represented by constants
  20959. defined in the 'gdb' module:
  20960. 'gdb.COMMAND_NONE'
  20961. The command does not belong to any particular class. A command in
  20962. this category will not be displayed in any of the help categories.
  20963. 'gdb.COMMAND_RUNNING'
  20964. The command is related to running the inferior. For example,
  20965. 'start', 'step', and 'continue' are in this category. Type 'help
  20966. running' at the GDB prompt to see a list of commands in this
  20967. category.
  20968. 'gdb.COMMAND_DATA'
  20969. The command is related to data or variables. For example, 'call',
  20970. 'find', and 'print' are in this category. Type 'help data' at the
  20971. GDB prompt to see a list of commands in this category.
  20972. 'gdb.COMMAND_STACK'
  20973. The command has to do with manipulation of the stack. For example,
  20974. 'backtrace', 'frame', and 'return' are in this category. Type
  20975. 'help stack' at the GDB prompt to see a list of commands in this
  20976. category.
  20977. 'gdb.COMMAND_FILES'
  20978. This class is used for file-related commands. For example, 'file',
  20979. 'list' and 'section' are in this category. Type 'help files' at
  20980. the GDB prompt to see a list of commands in this category.
  20981. 'gdb.COMMAND_SUPPORT'
  20982. This should be used for "support facilities", generally meaning
  20983. things that are useful to the user when interacting with GDB, but
  20984. not related to the state of the inferior. For example, 'help',
  20985. 'make', and 'shell' are in this category. Type 'help support' at
  20986. the GDB prompt to see a list of commands in this category.
  20987. 'gdb.COMMAND_STATUS'
  20988. The command is an 'info'-related command, that is, related to the
  20989. state of GDB itself. For example, 'info', 'macro', and 'show' are
  20990. in this category. Type 'help status' at the GDB prompt to see a
  20991. list of commands in this category.
  20992. 'gdb.COMMAND_BREAKPOINTS'
  20993. The command has to do with breakpoints. For example, 'break',
  20994. 'clear', and 'delete' are in this category. Type 'help
  20995. breakpoints' at the GDB prompt to see a list of commands in this
  20996. category.
  20997. 'gdb.COMMAND_TRACEPOINTS'
  20998. The command has to do with tracepoints. For example, 'trace',
  20999. 'actions', and 'tfind' are in this category. Type 'help
  21000. tracepoints' at the GDB prompt to see a list of commands in this
  21001. category.
  21002. 'gdb.COMMAND_TUI'
  21003. The command has to do with the text user interface (*note TUI::).
  21004. Type 'help tui' at the GDB prompt to see a list of commands in this
  21005. category.
  21006. 'gdb.COMMAND_USER'
  21007. The command is a general purpose command for the user, and
  21008. typically does not fit in one of the other categories. Type 'help
  21009. user-defined' at the GDB prompt to see a list of commands in this
  21010. category, as well as the list of gdb macros (*note Sequences::).
  21011. 'gdb.COMMAND_OBSCURE'
  21012. The command is only used in unusual circumstances, or is not of
  21013. general interest to users. For example, 'checkpoint', 'fork', and
  21014. 'stop' are in this category. Type 'help obscure' at the GDB prompt
  21015. to see a list of commands in this category.
  21016. 'gdb.COMMAND_MAINTENANCE'
  21017. The command is only useful to GDB maintainers. The 'maintenance'
  21018. and 'flushregs' commands are in this category. Type 'help
  21019. internals' at the GDB prompt to see a list of commands in this
  21020. category.
  21021. A new command can use a predefined completion function, either by
  21022. specifying it via an argument at initialization, or by returning it from
  21023. the 'complete' method. These predefined completion constants are all
  21024. defined in the 'gdb' module:
  21025. 'gdb.COMPLETE_NONE'
  21026. This constant means that no completion should be done.
  21027. 'gdb.COMPLETE_FILENAME'
  21028. This constant means that filename completion should be performed.
  21029. 'gdb.COMPLETE_LOCATION'
  21030. This constant means that location completion should be done. *Note
  21031. Specify Location::.
  21032. 'gdb.COMPLETE_COMMAND'
  21033. This constant means that completion should examine GDB command
  21034. names.
  21035. 'gdb.COMPLETE_SYMBOL'
  21036. This constant means that completion should be done using symbol
  21037. names as the source.
  21038. 'gdb.COMPLETE_EXPRESSION'
  21039. This constant means that completion should be done on expressions.
  21040. Often this means completing on symbol names, but some language
  21041. parsers also have support for completing on field names.
  21042. The following code snippet shows how a trivial CLI command can be
  21043. implemented in Python:
  21044. class HelloWorld (gdb.Command):
  21045. """Greet the whole world."""
  21046. def __init__ (self):
  21047. super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
  21048. def invoke (self, arg, from_tty):
  21049. print "Hello, World!"
  21050. HelloWorld ()
  21051. The last line instantiates the class, and is necessary to trigger the
  21052. registration of the command with GDB. Depending on how the Python code
  21053. is read into GDB, you may need to import the 'gdb' module explicitly.
  21054. 
  21055. File: gdb.info, Node: Parameters In Python, Next: Functions In Python, Prev: Commands In Python, Up: Python API
  21056. 23.2.2.21 Parameters In Python
  21057. ..............................
  21058. You can implement new GDB parameters using Python. A new parameter is
  21059. implemented as an instance of the 'gdb.Parameter' class.
  21060. Parameters are exposed to the user via the 'set' and 'show' commands.
  21061. *Note Help::.
  21062. There are many parameters that already exist and can be set in GDB.
  21063. Two examples are: 'set follow fork' and 'set charset'. Setting these
  21064. parameters influences certain behavior in GDB. Similarly, you can
  21065. define parameters that can be used to influence behavior in custom
  21066. Python scripts and commands.
  21067. -- Function: Parameter.__init__ (name, COMMAND-CLASS, PARAMETER-CLASS
  21068. [, ENUM-SEQUENCE])
  21069. The object initializer for 'Parameter' registers the new parameter
  21070. with GDB. This initializer is normally invoked from the subclass'
  21071. own '__init__' method.
  21072. NAME is the name of the new parameter. If NAME consists of
  21073. multiple words, then the initial words are looked for as prefix
  21074. parameters. An example of this can be illustrated with the 'set
  21075. print' set of parameters. If NAME is 'print foo', then 'print'
  21076. will be searched as the prefix parameter. In this case the
  21077. parameter can subsequently be accessed in GDB as 'set print foo'.
  21078. If NAME consists of multiple words, and no prefix parameter group
  21079. can be found, an exception is raised.
  21080. COMMAND-CLASS should be one of the 'COMMAND_' constants (*note
  21081. Commands In Python::). This argument tells GDB how to categorize
  21082. the new parameter in the help system.
  21083. PARAMETER-CLASS should be one of the 'PARAM_' constants defined
  21084. below. This argument tells GDB the type of the new parameter; this
  21085. information is used for input validation and completion.
  21086. If PARAMETER-CLASS is 'PARAM_ENUM', then ENUM-SEQUENCE must be a
  21087. sequence of strings. These strings represent the possible values
  21088. for the parameter.
  21089. If PARAMETER-CLASS is not 'PARAM_ENUM', then the presence of a
  21090. fourth argument will cause an exception to be thrown.
  21091. The help text for the new parameter is taken from the Python
  21092. documentation string for the parameter's class, if there is one.
  21093. If there is no documentation string, a default value is used.
  21094. -- Variable: Parameter.set_doc
  21095. If this attribute exists, and is a string, then its value is used
  21096. as the help text for this parameter's 'set' command. The value is
  21097. examined when 'Parameter.__init__' is invoked; subsequent changes
  21098. have no effect.
  21099. -- Variable: Parameter.show_doc
  21100. If this attribute exists, and is a string, then its value is used
  21101. as the help text for this parameter's 'show' command. The value is
  21102. examined when 'Parameter.__init__' is invoked; subsequent changes
  21103. have no effect.
  21104. -- Variable: Parameter.value
  21105. The 'value' attribute holds the underlying value of the parameter.
  21106. It can be read and assigned to just as any other attribute. GDB
  21107. does validation when assignments are made.
  21108. There are two methods that may be implemented in any 'Parameter'
  21109. class. These are:
  21110. -- Function: Parameter.get_set_string (self)
  21111. If this method exists, GDB will call it when a PARAMETER's value
  21112. has been changed via the 'set' API (for example, 'set foo off').
  21113. The 'value' attribute has already been populated with the new value
  21114. and may be used in output. This method must return a string. If
  21115. the returned string is not empty, GDB will present it to the user.
  21116. If this method raises the 'gdb.GdbError' exception (*note Exception
  21117. Handling::), then GDB will print the exception's string and the
  21118. 'set' command will fail. Note, however, that the 'value' attribute
  21119. will not be reset in this case. So, if your parameter must
  21120. validate values, it should store the old value internally and reset
  21121. the exposed value, like so:
  21122. class ExampleParam (gdb.Parameter):
  21123. def __init__ (self, name):
  21124. super (ExampleParam, self).__init__ (name,
  21125. gdb.COMMAND_DATA,
  21126. gdb.PARAM_BOOLEAN)
  21127. self.value = True
  21128. self.saved_value = True
  21129. def validate(self):
  21130. return False
  21131. def get_set_string (self):
  21132. if not self.validate():
  21133. self.value = self.saved_value
  21134. raise gdb.GdbError('Failed to validate')
  21135. self.saved_value = self.value
  21136. -- Function: Parameter.get_show_string (self, svalue)
  21137. GDB will call this method when a PARAMETER's 'show' API has been
  21138. invoked (for example, 'show foo'). The argument 'svalue' receives
  21139. the string representation of the current value. This method must
  21140. return a string.
  21141. When a new parameter is defined, its type must be specified. The
  21142. available types are represented by constants defined in the 'gdb'
  21143. module:
  21144. 'gdb.PARAM_BOOLEAN'
  21145. The value is a plain boolean. The Python boolean values, 'True'
  21146. and 'False' are the only valid values.
  21147. 'gdb.PARAM_AUTO_BOOLEAN'
  21148. The value has three possible states: true, false, and 'auto'. In
  21149. Python, true and false are represented using boolean constants, and
  21150. 'auto' is represented using 'None'.
  21151. 'gdb.PARAM_UINTEGER'
  21152. The value is an unsigned integer. The value of 0 should be
  21153. interpreted to mean "unlimited".
  21154. 'gdb.PARAM_INTEGER'
  21155. The value is a signed integer. The value of 0 should be
  21156. interpreted to mean "unlimited".
  21157. 'gdb.PARAM_STRING'
  21158. The value is a string. When the user modifies the string, any
  21159. escape sequences, such as '\t', '\f', and octal escapes, are
  21160. translated into corresponding characters and encoded into the
  21161. current host charset.
  21162. 'gdb.PARAM_STRING_NOESCAPE'
  21163. The value is a string. When the user modifies the string, escapes
  21164. are passed through untranslated.
  21165. 'gdb.PARAM_OPTIONAL_FILENAME'
  21166. The value is a either a filename (a string), or 'None'.
  21167. 'gdb.PARAM_FILENAME'
  21168. The value is a filename. This is just like
  21169. 'PARAM_STRING_NOESCAPE', but uses file names for completion.
  21170. 'gdb.PARAM_ZINTEGER'
  21171. The value is an integer. This is like 'PARAM_INTEGER', except 0 is
  21172. interpreted as itself.
  21173. 'gdb.PARAM_ZUINTEGER'
  21174. The value is an unsigned integer. This is like 'PARAM_INTEGER',
  21175. except 0 is interpreted as itself, and the value cannot be
  21176. negative.
  21177. 'gdb.PARAM_ZUINTEGER_UNLIMITED'
  21178. The value is a signed integer. This is like 'PARAM_ZUINTEGER',
  21179. except the special value -1 should be interpreted to mean
  21180. "unlimited". Other negative values are not allowed.
  21181. 'gdb.PARAM_ENUM'
  21182. The value is a string, which must be one of a collection string
  21183. constants provided when the parameter is created.
  21184. 
  21185. File: gdb.info, Node: Functions In Python, Next: Progspaces In Python, Prev: Parameters In Python, Up: Python API
  21186. 23.2.2.22 Writing new convenience functions
  21187. ...........................................
  21188. You can implement new convenience functions (*note Convenience Vars::)
  21189. in Python. A convenience function is an instance of a subclass of the
  21190. class 'gdb.Function'.
  21191. -- Function: Function.__init__ (name)
  21192. The initializer for 'Function' registers the new function with GDB.
  21193. The argument NAME is the name of the function, a string. The
  21194. function will be visible to the user as a convenience variable of
  21195. type 'internal function', whose name is the same as the given NAME.
  21196. The documentation for the new function is taken from the
  21197. documentation string for the new class.
  21198. -- Function: Function.invoke (*ARGS)
  21199. When a convenience function is evaluated, its arguments are
  21200. converted to instances of 'gdb.Value', and then the function's
  21201. 'invoke' method is called. Note that GDB does not predetermine the
  21202. arity of convenience functions. Instead, all available arguments
  21203. are passed to 'invoke', following the standard Python calling
  21204. convention. In particular, a convenience function can have default
  21205. values for parameters without ill effect.
  21206. The return value of this method is used as its value in the
  21207. enclosing expression. If an ordinary Python value is returned, it
  21208. is converted to a 'gdb.Value' following the usual rules.
  21209. The following code snippet shows how a trivial convenience function
  21210. can be implemented in Python:
  21211. class Greet (gdb.Function):
  21212. """Return string to greet someone.
  21213. Takes a name as argument."""
  21214. def __init__ (self):
  21215. super (Greet, self).__init__ ("greet")
  21216. def invoke (self, name):
  21217. return "Hello, %s!" % name.string ()
  21218. Greet ()
  21219. The last line instantiates the class, and is necessary to trigger the
  21220. registration of the function with GDB. Depending on how the Python code
  21221. is read into GDB, you may need to import the 'gdb' module explicitly.
  21222. Now you can use the function in an expression:
  21223. (gdb) print $greet("Bob")
  21224. $1 = "Hello, Bob!"
  21225. 
  21226. File: gdb.info, Node: Progspaces In Python, Next: Objfiles In Python, Prev: Functions In Python, Up: Python API
  21227. 23.2.2.23 Program Spaces In Python
  21228. ..................................
  21229. A program space, or "progspace", represents a symbolic view of an
  21230. address space. It consists of all of the objfiles of the program.
  21231. *Note Objfiles In Python::. *Note program spaces: Inferiors Connections
  21232. and Programs, for more details about program spaces.
  21233. The following progspace-related functions are available in the 'gdb'
  21234. module:
  21235. -- Function: gdb.current_progspace ()
  21236. This function returns the program space of the currently selected
  21237. inferior. *Note Inferiors Connections and Programs::. This is
  21238. identical to 'gdb.selected_inferior().progspace' (*note Inferiors
  21239. In Python::) and is included for historical compatibility.
  21240. -- Function: gdb.progspaces ()
  21241. Return a sequence of all the progspaces currently known to GDB.
  21242. Each progspace is represented by an instance of the 'gdb.Progspace'
  21243. class.
  21244. -- Variable: Progspace.filename
  21245. The file name of the progspace as a string.
  21246. -- Variable: Progspace.pretty_printers
  21247. The 'pretty_printers' attribute is a list of functions. It is used
  21248. to look up pretty-printers. A 'Value' is passed to each function
  21249. in order; if the function returns 'None', then the search
  21250. continues. Otherwise, the return value should be an object which
  21251. is used to format the value. *Note Pretty Printing API::, for more
  21252. information.
  21253. -- Variable: Progspace.type_printers
  21254. The 'type_printers' attribute is a list of type printer objects.
  21255. *Note Type Printing API::, for more information.
  21256. -- Variable: Progspace.frame_filters
  21257. The 'frame_filters' attribute is a dictionary of frame filter
  21258. objects. *Note Frame Filter API::, for more information.
  21259. A program space has the following methods:
  21260. -- Function: Progspace.block_for_pc (pc)
  21261. Return the innermost 'gdb.Block' containing the given PC value. If
  21262. the block cannot be found for the PC value specified, the function
  21263. will return 'None'.
  21264. -- Function: Progspace.find_pc_line (pc)
  21265. Return the 'gdb.Symtab_and_line' object corresponding to the PC
  21266. value. *Note Symbol Tables In Python::. If an invalid value of PC
  21267. is passed as an argument, then the 'symtab' and 'line' attributes
  21268. of the returned 'gdb.Symtab_and_line' object will be 'None' and 0
  21269. respectively.
  21270. -- Function: Progspace.is_valid ()
  21271. Returns 'True' if the 'gdb.Progspace' object is valid, 'False' if
  21272. not. A 'gdb.Progspace' object can become invalid if the program
  21273. space file it refers to is not referenced by any inferior. All
  21274. other 'gdb.Progspace' methods will throw an exception if it is
  21275. invalid at the time the method is called.
  21276. -- Function: Progspace.objfiles ()
  21277. Return a sequence of all the objfiles referenced by this program
  21278. space. *Note Objfiles In Python::.
  21279. -- Function: Progspace.solib_name (address)
  21280. Return the name of the shared library holding the given ADDRESS as
  21281. a string, or 'None'.
  21282. One may add arbitrary attributes to 'gdb.Progspace' objects in the
  21283. usual Python way. This is useful if, for example, one needs to do some
  21284. extra record keeping associated with the program space.
  21285. In this contrived example, we want to perform some processing when an
  21286. objfile with a certain symbol is loaded, but we only want to do this
  21287. once because it is expensive. To achieve this we record the results
  21288. with the program space because we can't predict when the desired objfile
  21289. will be loaded.
  21290. (gdb) python
  21291. def clear_objfiles_handler(event):
  21292. event.progspace.expensive_computation = None
  21293. def expensive(symbol):
  21294. """A mock routine to perform an "expensive" computation on symbol."""
  21295. print "Computing the answer to the ultimate question ..."
  21296. return 42
  21297. def new_objfile_handler(event):
  21298. objfile = event.new_objfile
  21299. progspace = objfile.progspace
  21300. if not hasattr(progspace, 'expensive_computation') or \
  21301. progspace.expensive_computation is None:
  21302. # We use 'main' for the symbol to keep the example simple.
  21303. # Note: There's no current way to constrain the lookup
  21304. # to one objfile.
  21305. symbol = gdb.lookup_global_symbol('main')
  21306. if symbol is not None:
  21307. progspace.expensive_computation = expensive(symbol)
  21308. gdb.events.clear_objfiles.connect(clear_objfiles_handler)
  21309. gdb.events.new_objfile.connect(new_objfile_handler)
  21310. end
  21311. (gdb) file /tmp/hello
  21312. Reading symbols from /tmp/hello...
  21313. Computing the answer to the ultimate question ...
  21314. (gdb) python print gdb.current_progspace().expensive_computation
  21315. 42
  21316. (gdb) run
  21317. Starting program: /tmp/hello
  21318. Hello.
  21319. [Inferior 1 (process 4242) exited normally]
  21320. 
  21321. File: gdb.info, Node: Objfiles In Python, Next: Frames In Python, Prev: Progspaces In Python, Up: Python API
  21322. 23.2.2.24 Objfiles In Python
  21323. ............................
  21324. GDB loads symbols for an inferior from various symbol-containing files
  21325. (*note Files::). These include the primary executable file, any shared
  21326. libraries used by the inferior, and any separate debug info files (*note
  21327. Separate Debug Files::). GDB calls these symbol-containing files
  21328. "objfiles".
  21329. The following objfile-related functions are available in the 'gdb'
  21330. module:
  21331. -- Function: gdb.current_objfile ()
  21332. When auto-loading a Python script (*note Python Auto-loading::),
  21333. GDB sets the "current objfile" to the corresponding objfile. This
  21334. function returns the current objfile. If there is no current
  21335. objfile, this function returns 'None'.
  21336. -- Function: gdb.objfiles ()
  21337. Return a sequence of objfiles referenced by the current program
  21338. space. *Note Objfiles In Python::, and *note Progspaces In
  21339. Python::. This is identical to
  21340. 'gdb.selected_inferior().progspace.objfiles()' and is included for
  21341. historical compatibility.
  21342. -- Function: gdb.lookup_objfile (name [, by_build_id])
  21343. Look up NAME, a file name or build ID, in the list of objfiles for
  21344. the current program space (*note Progspaces In Python::). If the
  21345. objfile is not found throw the Python 'ValueError' exception.
  21346. If NAME is a relative file name, then it will match any source file
  21347. name with the same trailing components. For example, if NAME is
  21348. 'gcc/expr.c', then it will match source file name of
  21349. '/build/trunk/gcc/expr.c', but not '/build/trunk/libcpp/expr.c' or
  21350. '/build/trunk/gcc/x-expr.c'.
  21351. If BY_BUILD_ID is provided and is 'True' then NAME is the build ID
  21352. of the objfile. Otherwise, NAME is a file name. This is supported
  21353. only on some operating systems, notably those which use the ELF
  21354. format for binary files and the GNU Binutils. For more details
  21355. about this feature, see the description of the '--build-id'
  21356. command-line option in *note Command Line Options: (ld)Options.
  21357. Each objfile is represented by an instance of the 'gdb.Objfile'
  21358. class.
  21359. -- Variable: Objfile.filename
  21360. The file name of the objfile as a string, with symbolic links
  21361. resolved.
  21362. The value is 'None' if the objfile is no longer valid. See the
  21363. 'gdb.Objfile.is_valid' method, described below.
  21364. -- Variable: Objfile.username
  21365. The file name of the objfile as specified by the user as a string.
  21366. The value is 'None' if the objfile is no longer valid. See the
  21367. 'gdb.Objfile.is_valid' method, described below.
  21368. -- Variable: Objfile.owner
  21369. For separate debug info objfiles this is the corresponding
  21370. 'gdb.Objfile' object that debug info is being provided for.
  21371. Otherwise this is 'None'. Separate debug info objfiles are added
  21372. with the 'gdb.Objfile.add_separate_debug_file' method, described
  21373. below.
  21374. -- Variable: Objfile.build_id
  21375. The build ID of the objfile as a string. If the objfile does not
  21376. have a build ID then the value is 'None'.
  21377. This is supported only on some operating systems, notably those
  21378. which use the ELF format for binary files and the GNU Binutils.
  21379. For more details about this feature, see the description of the
  21380. '--build-id' command-line option in *note Command Line Options:
  21381. (ld)Options.
  21382. -- Variable: Objfile.progspace
  21383. The containing program space of the objfile as a 'gdb.Progspace'
  21384. object. *Note Progspaces In Python::.
  21385. -- Variable: Objfile.pretty_printers
  21386. The 'pretty_printers' attribute is a list of functions. It is used
  21387. to look up pretty-printers. A 'Value' is passed to each function
  21388. in order; if the function returns 'None', then the search
  21389. continues. Otherwise, the return value should be an object which
  21390. is used to format the value. *Note Pretty Printing API::, for more
  21391. information.
  21392. -- Variable: Objfile.type_printers
  21393. The 'type_printers' attribute is a list of type printer objects.
  21394. *Note Type Printing API::, for more information.
  21395. -- Variable: Objfile.frame_filters
  21396. The 'frame_filters' attribute is a dictionary of frame filter
  21397. objects. *Note Frame Filter API::, for more information.
  21398. One may add arbitrary attributes to 'gdb.Objfile' objects in the
  21399. usual Python way. This is useful if, for example, one needs to do some
  21400. extra record keeping associated with the objfile.
  21401. In this contrived example we record the time when GDB loaded the
  21402. objfile.
  21403. (gdb) python
  21404. import datetime
  21405. def new_objfile_handler(event):
  21406. # Set the time_loaded attribute of the new objfile.
  21407. event.new_objfile.time_loaded = datetime.datetime.today()
  21408. gdb.events.new_objfile.connect(new_objfile_handler)
  21409. end
  21410. (gdb) file ./hello
  21411. Reading symbols from ./hello...
  21412. (gdb) python print gdb.objfiles()[0].time_loaded
  21413. 2014-10-09 11:41:36.770345
  21414. A 'gdb.Objfile' object has the following methods:
  21415. -- Function: Objfile.is_valid ()
  21416. Returns 'True' if the 'gdb.Objfile' object is valid, 'False' if
  21417. not. A 'gdb.Objfile' object can become invalid if the object file
  21418. it refers to is not loaded in GDB any longer. All other
  21419. 'gdb.Objfile' methods will throw an exception if it is invalid at
  21420. the time the method is called.
  21421. -- Function: Objfile.add_separate_debug_file (file)
  21422. Add FILE to the list of files that GDB will search for debug
  21423. information for the objfile. This is useful when the debug info
  21424. has been removed from the program and stored in a separate file.
  21425. GDB has built-in support for finding separate debug info files
  21426. (*note Separate Debug Files::), but if the file doesn't live in one
  21427. of the standard places that GDB searches then this function can be
  21428. used to add a debug info file from a different place.
  21429. -- Function: Objfile.lookup_global_symbol (name [, domain])
  21430. Search for a global symbol named NAME in this objfile. Optionally,
  21431. the search scope can be restricted with the DOMAIN argument. The
  21432. DOMAIN argument must be a domain constant defined in the 'gdb'
  21433. module and described in *note Symbols In Python::. This function
  21434. is similar to 'gdb.lookup_global_symbol', except that the search is
  21435. limited to this objfile.
  21436. The result is a 'gdb.Symbol' object or 'None' if the symbol is not
  21437. found.
  21438. -- Function: Objfile.lookup_static_symbol (name [, domain])
  21439. Like 'Objfile.lookup_global_symbol', but searches for a global
  21440. symbol with static linkage named NAME in this objfile.
  21441. 
  21442. File: gdb.info, Node: Frames In Python, Next: Blocks In Python, Prev: Objfiles In Python, Up: Python API
  21443. 23.2.2.25 Accessing inferior stack frames from Python
  21444. .....................................................
  21445. When the debugged program stops, GDB is able to analyze its call stack
  21446. (*note Stack frames: Frames.). The 'gdb.Frame' class represents a frame
  21447. in the stack. A 'gdb.Frame' object is only valid while its
  21448. corresponding frame exists in the inferior's stack. If you try to use
  21449. an invalid frame object, GDB will throw a 'gdb.error' exception (*note
  21450. Exception Handling::).
  21451. Two 'gdb.Frame' objects can be compared for equality with the '=='
  21452. operator, like:
  21453. (gdb) python print gdb.newest_frame() == gdb.selected_frame ()
  21454. True
  21455. The following frame-related functions are available in the 'gdb'
  21456. module:
  21457. -- Function: gdb.selected_frame ()
  21458. Return the selected frame object. (*note Selecting a Frame:
  21459. Selection.).
  21460. -- Function: gdb.newest_frame ()
  21461. Return the newest frame object for the selected thread.
  21462. -- Function: gdb.frame_stop_reason_string (reason)
  21463. Return a string explaining the reason why GDB stopped unwinding
  21464. frames, as expressed by the given REASON code (an integer, see the
  21465. 'unwind_stop_reason' method further down in this section).
  21466. -- Function: gdb.invalidate_cached_frames
  21467. GDB internally keeps a cache of the frames that have been unwound.
  21468. This function invalidates this cache.
  21469. This function should not generally be called by ordinary Python
  21470. code. It is documented for the sake of completeness.
  21471. A 'gdb.Frame' object has the following methods:
  21472. -- Function: Frame.is_valid ()
  21473. Returns true if the 'gdb.Frame' object is valid, false if not. A
  21474. frame object can become invalid if the frame it refers to doesn't
  21475. exist anymore in the inferior. All 'gdb.Frame' methods will throw
  21476. an exception if it is invalid at the time the method is called.
  21477. -- Function: Frame.name ()
  21478. Returns the function name of the frame, or 'None' if it can't be
  21479. obtained.
  21480. -- Function: Frame.architecture ()
  21481. Returns the 'gdb.Architecture' object corresponding to the frame's
  21482. architecture. *Note Architectures In Python::.
  21483. -- Function: Frame.type ()
  21484. Returns the type of the frame. The value can be one of:
  21485. 'gdb.NORMAL_FRAME'
  21486. An ordinary stack frame.
  21487. 'gdb.DUMMY_FRAME'
  21488. A fake stack frame that was created by GDB when performing an
  21489. inferior function call.
  21490. 'gdb.INLINE_FRAME'
  21491. A frame representing an inlined function. The function was
  21492. inlined into a 'gdb.NORMAL_FRAME' that is older than this one.
  21493. 'gdb.TAILCALL_FRAME'
  21494. A frame representing a tail call. *Note Tail Call Frames::.
  21495. 'gdb.SIGTRAMP_FRAME'
  21496. A signal trampoline frame. This is the frame created by the
  21497. OS when it calls into a signal handler.
  21498. 'gdb.ARCH_FRAME'
  21499. A fake stack frame representing a cross-architecture call.
  21500. 'gdb.SENTINEL_FRAME'
  21501. This is like 'gdb.NORMAL_FRAME', but it is only used for the
  21502. newest frame.
  21503. -- Function: Frame.unwind_stop_reason ()
  21504. Return an integer representing the reason why it's not possible to
  21505. find more frames toward the outermost frame. Use
  21506. 'gdb.frame_stop_reason_string' to convert the value returned by
  21507. this function to a string. The value can be one of:
  21508. 'gdb.FRAME_UNWIND_NO_REASON'
  21509. No particular reason (older frames should be available).
  21510. 'gdb.FRAME_UNWIND_NULL_ID'
  21511. The previous frame's analyzer returns an invalid result. This
  21512. is no longer used by GDB, and is kept only for backward
  21513. compatibility.
  21514. 'gdb.FRAME_UNWIND_OUTERMOST'
  21515. This frame is the outermost.
  21516. 'gdb.FRAME_UNWIND_UNAVAILABLE'
  21517. Cannot unwind further, because that would require knowing the
  21518. values of registers or memory that have not been collected.
  21519. 'gdb.FRAME_UNWIND_INNER_ID'
  21520. This frame ID looks like it ought to belong to a NEXT frame,
  21521. but we got it for a PREV frame. Normally, this is a sign of
  21522. unwinder failure. It could also indicate stack corruption.
  21523. 'gdb.FRAME_UNWIND_SAME_ID'
  21524. This frame has the same ID as the previous one. That means
  21525. that unwinding further would almost certainly give us another
  21526. frame with exactly the same ID, so break the chain. Normally,
  21527. this is a sign of unwinder failure. It could also indicate
  21528. stack corruption.
  21529. 'gdb.FRAME_UNWIND_NO_SAVED_PC'
  21530. The frame unwinder did not find any saved PC, but we needed
  21531. one to unwind further.
  21532. 'gdb.FRAME_UNWIND_MEMORY_ERROR'
  21533. The frame unwinder caused an error while trying to access
  21534. memory.
  21535. 'gdb.FRAME_UNWIND_FIRST_ERROR'
  21536. Any stop reason greater or equal to this value indicates some
  21537. kind of error. This special value facilitates writing code
  21538. that tests for errors in unwinding in a way that will work
  21539. correctly even if the list of the other values is modified in
  21540. future GDB versions. Using it, you could write:
  21541. reason = gdb.selected_frame().unwind_stop_reason ()
  21542. reason_str = gdb.frame_stop_reason_string (reason)
  21543. if reason >= gdb.FRAME_UNWIND_FIRST_ERROR:
  21544. print "An error occured: %s" % reason_str
  21545. -- Function: Frame.pc ()
  21546. Returns the frame's resume address.
  21547. -- Function: Frame.block ()
  21548. Return the frame's code block. *Note Blocks In Python::. If the
  21549. frame does not have a block - for example, if there is no debugging
  21550. information for the code in question - then this will throw an
  21551. exception.
  21552. -- Function: Frame.function ()
  21553. Return the symbol for the function corresponding to this frame.
  21554. *Note Symbols In Python::.
  21555. -- Function: Frame.older ()
  21556. Return the frame that called this frame.
  21557. -- Function: Frame.newer ()
  21558. Return the frame called by this frame.
  21559. -- Function: Frame.find_sal ()
  21560. Return the frame's symtab and line object. *Note Symbol Tables In
  21561. Python::.
  21562. -- Function: Frame.read_register (register)
  21563. Return the value of REGISTER in this frame. Returns a 'Gdb.Value'
  21564. object. Throws an exception if REGISTER does not exist. The
  21565. REGISTER argument must be one of the following:
  21566. 1. A string that is the name of a valid register (e.g., ''sp'' or
  21567. ''rax'').
  21568. 2. A 'gdb.RegisterDescriptor' object (*note Registers In
  21569. Python::).
  21570. 3. A GDB internal, platform specific number. Using these numbers
  21571. is supported for historic reasons, but is not recommended as
  21572. future changes to GDB could change the mapping between numbers
  21573. and the registers they represent, breaking any Python code
  21574. that uses the platform-specific numbers. The numbers are
  21575. usually found in the corresponding 'PLATFORM-tdep.h' file in
  21576. the GDB source tree.
  21577. Using a string to access registers will be slightly slower than the
  21578. other two methods as GDB must look up the mapping between name and
  21579. internal register number. If performance is critical consider
  21580. looking up and caching a 'gdb.RegisterDescriptor' object.
  21581. -- Function: Frame.read_var (variable [, block])
  21582. Return the value of VARIABLE in this frame. If the optional
  21583. argument BLOCK is provided, search for the variable from that
  21584. block; otherwise start at the frame's current block (which is
  21585. determined by the frame's current program counter). The VARIABLE
  21586. argument must be a string or a 'gdb.Symbol' object; BLOCK must be a
  21587. 'gdb.Block' object.
  21588. -- Function: Frame.select ()
  21589. Set this frame to be the selected frame. *Note Examining the
  21590. Stack: Stack.
  21591. 
  21592. File: gdb.info, Node: Blocks In Python, Next: Symbols In Python, Prev: Frames In Python, Up: Python API
  21593. 23.2.2.26 Accessing blocks from Python
  21594. ......................................
  21595. In GDB, symbols are stored in blocks. A block corresponds roughly to a
  21596. scope in the source code. Blocks are organized hierarchically, and are
  21597. represented individually in Python as a 'gdb.Block'. Blocks rely on
  21598. debugging information being available.
  21599. A frame has a block. Please see *note Frames In Python::, for a more
  21600. in-depth discussion of frames.
  21601. The outermost block is known as the "global block". The global block
  21602. typically holds public global variables and functions.
  21603. The block nested just inside the global block is the "static block".
  21604. The static block typically holds file-scoped variables and functions.
  21605. GDB provides a method to get a block's superblock, but there is
  21606. currently no way to examine the sub-blocks of a block, or to iterate
  21607. over all the blocks in a symbol table (*note Symbol Tables In Python::).
  21608. Here is a short example that should help explain blocks:
  21609. /* This is in the global block. */
  21610. int global;
  21611. /* This is in the static block. */
  21612. static int file_scope;
  21613. /* 'function' is in the global block, and 'argument' is
  21614. in a block nested inside of 'function'. */
  21615. int function (int argument)
  21616. {
  21617. /* 'local' is in a block inside 'function'. It may or may
  21618. not be in the same block as 'argument'. */
  21619. int local;
  21620. {
  21621. /* 'inner' is in a block whose superblock is the one holding
  21622. 'local'. */
  21623. int inner;
  21624. /* If this call is expanded by the compiler, you may see
  21625. a nested block here whose function is 'inline_function'
  21626. and whose superblock is the one holding 'inner'. */
  21627. inline_function ();
  21628. }
  21629. }
  21630. A 'gdb.Block' is iterable. The iterator returns the symbols (*note
  21631. Symbols In Python::) local to the block. Python programs should not
  21632. assume that a specific block object will always contain a given symbol,
  21633. since changes in GDB features and infrastructure may cause symbols move
  21634. across blocks in a symbol table. You can also use Python's "dictionary
  21635. syntax" to access variables in this block, e.g.:
  21636. symbol = some_block['variable'] # symbol is of type gdb.Symbol
  21637. The following block-related functions are available in the 'gdb'
  21638. module:
  21639. -- Function: gdb.block_for_pc (pc)
  21640. Return the innermost 'gdb.Block' containing the given PC value. If
  21641. the block cannot be found for the PC value specified, the function
  21642. will return 'None'. This is identical to
  21643. 'gdb.current_progspace().block_for_pc(pc)' and is included for
  21644. historical compatibility.
  21645. A 'gdb.Block' object has the following methods:
  21646. -- Function: Block.is_valid ()
  21647. Returns 'True' if the 'gdb.Block' object is valid, 'False' if not.
  21648. A block object can become invalid if the block it refers to doesn't
  21649. exist anymore in the inferior. All other 'gdb.Block' methods will
  21650. throw an exception if it is invalid at the time the method is
  21651. called. The block's validity is also checked during iteration over
  21652. symbols of the block.
  21653. A 'gdb.Block' object has the following attributes:
  21654. -- Variable: Block.start
  21655. The start address of the block. This attribute is not writable.
  21656. -- Variable: Block.end
  21657. One past the last address that appears in the block. This
  21658. attribute is not writable.
  21659. -- Variable: Block.function
  21660. The name of the block represented as a 'gdb.Symbol'. If the block
  21661. is not named, then this attribute holds 'None'. This attribute is
  21662. not writable.
  21663. For ordinary function blocks, the superblock is the static block.
  21664. However, you should note that it is possible for a function block
  21665. to have a superblock that is not the static block - for instance
  21666. this happens for an inlined function.
  21667. -- Variable: Block.superblock
  21668. The block containing this block. If this parent block does not
  21669. exist, this attribute holds 'None'. This attribute is not
  21670. writable.
  21671. -- Variable: Block.global_block
  21672. The global block associated with this block. This attribute is not
  21673. writable.
  21674. -- Variable: Block.static_block
  21675. The static block associated with this block. This attribute is not
  21676. writable.
  21677. -- Variable: Block.is_global
  21678. 'True' if the 'gdb.Block' object is a global block, 'False' if not.
  21679. This attribute is not writable.
  21680. -- Variable: Block.is_static
  21681. 'True' if the 'gdb.Block' object is a static block, 'False' if not.
  21682. This attribute is not writable.
  21683. 
  21684. File: gdb.info, Node: Symbols In Python, Next: Symbol Tables In Python, Prev: Blocks In Python, Up: Python API
  21685. 23.2.2.27 Python representation of Symbols
  21686. ..........................................
  21687. GDB represents every variable, function and type as an entry in a symbol
  21688. table. *Note Examining the Symbol Table: Symbols. Similarly, Python
  21689. represents these symbols in GDB with the 'gdb.Symbol' object.
  21690. The following symbol-related functions are available in the 'gdb'
  21691. module:
  21692. -- Function: gdb.lookup_symbol (name [, block [, domain]])
  21693. This function searches for a symbol by name. The search scope can
  21694. be restricted to the parameters defined in the optional domain and
  21695. block arguments.
  21696. NAME is the name of the symbol. It must be a string. The optional
  21697. BLOCK argument restricts the search to symbols visible in that
  21698. BLOCK. The BLOCK argument must be a 'gdb.Block' object. If
  21699. omitted, the block for the current frame is used. The optional
  21700. DOMAIN argument restricts the search to the domain type. The
  21701. DOMAIN argument must be a domain constant defined in the 'gdb'
  21702. module and described later in this chapter.
  21703. The result is a tuple of two elements. The first element is a
  21704. 'gdb.Symbol' object or 'None' if the symbol is not found. If the
  21705. symbol is found, the second element is 'True' if the symbol is a
  21706. field of a method's object (e.g., 'this' in C++), otherwise it is
  21707. 'False'. If the symbol is not found, the second element is
  21708. 'False'.
  21709. -- Function: gdb.lookup_global_symbol (name [, domain])
  21710. This function searches for a global symbol by name. The search
  21711. scope can be restricted to by the domain argument.
  21712. NAME is the name of the symbol. It must be a string. The optional
  21713. DOMAIN argument restricts the search to the domain type. The
  21714. DOMAIN argument must be a domain constant defined in the 'gdb'
  21715. module and described later in this chapter.
  21716. The result is a 'gdb.Symbol' object or 'None' if the symbol is not
  21717. found.
  21718. -- Function: gdb.lookup_static_symbol (name [, domain])
  21719. This function searches for a global symbol with static linkage by
  21720. name. The search scope can be restricted to by the domain
  21721. argument.
  21722. NAME is the name of the symbol. It must be a string. The optional
  21723. DOMAIN argument restricts the search to the domain type. The
  21724. DOMAIN argument must be a domain constant defined in the 'gdb'
  21725. module and described later in this chapter.
  21726. The result is a 'gdb.Symbol' object or 'None' if the symbol is not
  21727. found.
  21728. Note that this function will not find function-scoped static
  21729. variables. To look up such variables, iterate over the variables
  21730. of the function's 'gdb.Block' and check that 'block.addr_class' is
  21731. 'gdb.SYMBOL_LOC_STATIC'.
  21732. There can be multiple global symbols with static linkage with the
  21733. same name. This function will only return the first matching
  21734. symbol that it finds. Which symbol is found depends on where GDB
  21735. is currently stopped, as GDB will first search for matching symbols
  21736. in the current object file, and then search all other object files.
  21737. If the application is not yet running then GDB will search all
  21738. object files in the order they appear in the debug information.
  21739. -- Function: gdb.lookup_static_symbols (name [, domain])
  21740. Similar to 'gdb.lookup_static_symbol', this function searches for
  21741. global symbols with static linkage by name, and optionally
  21742. restricted by the domain argument. However, this function returns
  21743. a list of all matching symbols found, not just the first one.
  21744. NAME is the name of the symbol. It must be a string. The optional
  21745. DOMAIN argument restricts the search to the domain type. The
  21746. DOMAIN argument must be a domain constant defined in the 'gdb'
  21747. module and described later in this chapter.
  21748. The result is a list of 'gdb.Symbol' objects which could be empty
  21749. if no matching symbols were found.
  21750. Note that this function will not find function-scoped static
  21751. variables. To look up such variables, iterate over the variables
  21752. of the function's 'gdb.Block' and check that 'block.addr_class' is
  21753. 'gdb.SYMBOL_LOC_STATIC'.
  21754. A 'gdb.Symbol' object has the following attributes:
  21755. -- Variable: Symbol.type
  21756. The type of the symbol or 'None' if no type is recorded. This
  21757. attribute is represented as a 'gdb.Type' object. *Note Types In
  21758. Python::. This attribute is not writable.
  21759. -- Variable: Symbol.symtab
  21760. The symbol table in which the symbol appears. This attribute is
  21761. represented as a 'gdb.Symtab' object. *Note Symbol Tables In
  21762. Python::. This attribute is not writable.
  21763. -- Variable: Symbol.line
  21764. The line number in the source code at which the symbol was defined.
  21765. This is an integer.
  21766. -- Variable: Symbol.name
  21767. The name of the symbol as a string. This attribute is not
  21768. writable.
  21769. -- Variable: Symbol.linkage_name
  21770. The name of the symbol, as used by the linker (i.e., may be
  21771. mangled). This attribute is not writable.
  21772. -- Variable: Symbol.print_name
  21773. The name of the symbol in a form suitable for output. This is
  21774. either 'name' or 'linkage_name', depending on whether the user
  21775. asked GDB to display demangled or mangled names.
  21776. -- Variable: Symbol.addr_class
  21777. The address class of the symbol. This classifies how to find the
  21778. value of a symbol. Each address class is a constant defined in the
  21779. 'gdb' module and described later in this chapter.
  21780. -- Variable: Symbol.needs_frame
  21781. This is 'True' if evaluating this symbol's value requires a frame
  21782. (*note Frames In Python::) and 'False' otherwise. Typically, local
  21783. variables will require a frame, but other symbols will not.
  21784. -- Variable: Symbol.is_argument
  21785. 'True' if the symbol is an argument of a function.
  21786. -- Variable: Symbol.is_constant
  21787. 'True' if the symbol is a constant.
  21788. -- Variable: Symbol.is_function
  21789. 'True' if the symbol is a function or a method.
  21790. -- Variable: Symbol.is_variable
  21791. 'True' if the symbol is a variable.
  21792. A 'gdb.Symbol' object has the following methods:
  21793. -- Function: Symbol.is_valid ()
  21794. Returns 'True' if the 'gdb.Symbol' object is valid, 'False' if not.
  21795. A 'gdb.Symbol' object can become invalid if the symbol it refers to
  21796. does not exist in GDB any longer. All other 'gdb.Symbol' methods
  21797. will throw an exception if it is invalid at the time the method is
  21798. called.
  21799. -- Function: Symbol.value ([frame])
  21800. Compute the value of the symbol, as a 'gdb.Value'. For functions,
  21801. this computes the address of the function, cast to the appropriate
  21802. type. If the symbol requires a frame in order to compute its
  21803. value, then FRAME must be given. If FRAME is not given, or if
  21804. FRAME is invalid, then this method will throw an exception.
  21805. The available domain categories in 'gdb.Symbol' are represented as
  21806. constants in the 'gdb' module:
  21807. 'gdb.SYMBOL_UNDEF_DOMAIN'
  21808. This is used when a domain has not been discovered or none of the
  21809. following domains apply. This usually indicates an error either in
  21810. the symbol information or in GDB's handling of symbols.
  21811. 'gdb.SYMBOL_VAR_DOMAIN'
  21812. This domain contains variables, function names, typedef names and
  21813. enum type values.
  21814. 'gdb.SYMBOL_STRUCT_DOMAIN'
  21815. This domain holds struct, union and enum type names.
  21816. 'gdb.SYMBOL_LABEL_DOMAIN'
  21817. This domain contains names of labels (for gotos).
  21818. 'gdb.SYMBOL_MODULE_DOMAIN'
  21819. This domain contains names of Fortran module types.
  21820. 'gdb.SYMBOL_COMMON_BLOCK_DOMAIN'
  21821. This domain contains names of Fortran common blocks.
  21822. The available address class categories in 'gdb.Symbol' are
  21823. represented as constants in the 'gdb' module:
  21824. 'gdb.SYMBOL_LOC_UNDEF'
  21825. If this is returned by address class, it indicates an error either
  21826. in the symbol information or in GDB's handling of symbols.
  21827. 'gdb.SYMBOL_LOC_CONST'
  21828. Value is constant int.
  21829. 'gdb.SYMBOL_LOC_STATIC'
  21830. Value is at a fixed address.
  21831. 'gdb.SYMBOL_LOC_REGISTER'
  21832. Value is in a register.
  21833. 'gdb.SYMBOL_LOC_ARG'
  21834. Value is an argument. This value is at the offset stored within
  21835. the symbol inside the frame's argument list.
  21836. 'gdb.SYMBOL_LOC_REF_ARG'
  21837. Value address is stored in the frame's argument list. Just like
  21838. 'LOC_ARG' except that the value's address is stored at the offset,
  21839. not the value itself.
  21840. 'gdb.SYMBOL_LOC_REGPARM_ADDR'
  21841. Value is a specified register. Just like 'LOC_REGISTER' except the
  21842. register holds the address of the argument instead of the argument
  21843. itself.
  21844. 'gdb.SYMBOL_LOC_LOCAL'
  21845. Value is a local variable.
  21846. 'gdb.SYMBOL_LOC_TYPEDEF'
  21847. Value not used. Symbols in the domain 'SYMBOL_STRUCT_DOMAIN' all
  21848. have this class.
  21849. 'gdb.SYMBOL_LOC_BLOCK'
  21850. Value is a block.
  21851. 'gdb.SYMBOL_LOC_CONST_BYTES'
  21852. Value is a byte-sequence.
  21853. 'gdb.SYMBOL_LOC_UNRESOLVED'
  21854. Value is at a fixed address, but the address of the variable has to
  21855. be determined from the minimal symbol table whenever the variable
  21856. is referenced.
  21857. 'gdb.SYMBOL_LOC_OPTIMIZED_OUT'
  21858. The value does not actually exist in the program.
  21859. 'gdb.SYMBOL_LOC_COMPUTED'
  21860. The value's address is a computed location.
  21861. 'gdb.SYMBOL_LOC_COMPUTED'
  21862. The value's address is a symbol. This is only used for Fortran
  21863. common blocks.
  21864. 
  21865. File: gdb.info, Node: Symbol Tables In Python, Next: Line Tables In Python, Prev: Symbols In Python, Up: Python API
  21866. 23.2.2.28 Symbol table representation in Python
  21867. ...............................................
  21868. Access to symbol table data maintained by GDB on the inferior is exposed
  21869. to Python via two objects: 'gdb.Symtab_and_line' and 'gdb.Symtab'.
  21870. Symbol table and line data for a frame is returned from the 'find_sal'
  21871. method in 'gdb.Frame' object. *Note Frames In Python::.
  21872. For more information on GDB's symbol table management, see *note
  21873. Examining the Symbol Table: Symbols, for more information.
  21874. A 'gdb.Symtab_and_line' object has the following attributes:
  21875. -- Variable: Symtab_and_line.symtab
  21876. The symbol table object ('gdb.Symtab') for this frame. This
  21877. attribute is not writable.
  21878. -- Variable: Symtab_and_line.pc
  21879. Indicates the start of the address range occupied by code for the
  21880. current source line. This attribute is not writable.
  21881. -- Variable: Symtab_and_line.last
  21882. Indicates the end of the address range occupied by code for the
  21883. current source line. This attribute is not writable.
  21884. -- Variable: Symtab_and_line.line
  21885. Indicates the current line number for this object. This attribute
  21886. is not writable.
  21887. A 'gdb.Symtab_and_line' object has the following methods:
  21888. -- Function: Symtab_and_line.is_valid ()
  21889. Returns 'True' if the 'gdb.Symtab_and_line' object is valid,
  21890. 'False' if not. A 'gdb.Symtab_and_line' object can become invalid
  21891. if the Symbol table and line object it refers to does not exist in
  21892. GDB any longer. All other 'gdb.Symtab_and_line' methods will throw
  21893. an exception if it is invalid at the time the method is called.
  21894. A 'gdb.Symtab' object has the following attributes:
  21895. -- Variable: Symtab.filename
  21896. The symbol table's source filename. This attribute is not
  21897. writable.
  21898. -- Variable: Symtab.objfile
  21899. The symbol table's backing object file. *Note Objfiles In
  21900. Python::. This attribute is not writable.
  21901. -- Variable: Symtab.producer
  21902. The name and possibly version number of the program that compiled
  21903. the code in the symbol table. The contents of this string is up to
  21904. the compiler. If no producer information is available then 'None'
  21905. is returned. This attribute is not writable.
  21906. A 'gdb.Symtab' object has the following methods:
  21907. -- Function: Symtab.is_valid ()
  21908. Returns 'True' if the 'gdb.Symtab' object is valid, 'False' if not.
  21909. A 'gdb.Symtab' object can become invalid if the symbol table it
  21910. refers to does not exist in GDB any longer. All other 'gdb.Symtab'
  21911. methods will throw an exception if it is invalid at the time the
  21912. method is called.
  21913. -- Function: Symtab.fullname ()
  21914. Return the symbol table's source absolute file name.
  21915. -- Function: Symtab.global_block ()
  21916. Return the global block of the underlying symbol table. *Note
  21917. Blocks In Python::.
  21918. -- Function: Symtab.static_block ()
  21919. Return the static block of the underlying symbol table. *Note
  21920. Blocks In Python::.
  21921. -- Function: Symtab.linetable ()
  21922. Return the line table associated with the symbol table. *Note Line
  21923. Tables In Python::.
  21924. 
  21925. File: gdb.info, Node: Line Tables In Python, Next: Breakpoints In Python, Prev: Symbol Tables In Python, Up: Python API
  21926. 23.2.2.29 Manipulating line tables using Python
  21927. ...............................................
  21928. Python code can request and inspect line table information from a symbol
  21929. table that is loaded in GDB. A line table is a mapping of source lines
  21930. to their executable locations in memory. To acquire the line table
  21931. information for a particular symbol table, use the 'linetable' function
  21932. (*note Symbol Tables In Python::).
  21933. A 'gdb.LineTable' is iterable. The iterator returns 'LineTableEntry'
  21934. objects that correspond to the source line and address for each line
  21935. table entry. 'LineTableEntry' objects have the following attributes:
  21936. -- Variable: LineTableEntry.line
  21937. The source line number for this line table entry. This number
  21938. corresponds to the actual line of source. This attribute is not
  21939. writable.
  21940. -- Variable: LineTableEntry.pc
  21941. The address that is associated with the line table entry where the
  21942. executable code for that source line resides in memory. This
  21943. attribute is not writable.
  21944. As there can be multiple addresses for a single source line, you may
  21945. receive multiple 'LineTableEntry' objects with matching 'line'
  21946. attributes, but with different 'pc' attributes. The iterator is sorted
  21947. in ascending 'pc' order. Here is a small example illustrating iterating
  21948. over a line table.
  21949. symtab = gdb.selected_frame().find_sal().symtab
  21950. linetable = symtab.linetable()
  21951. for line in linetable:
  21952. print "Line: "+str(line.line)+" Address: "+hex(line.pc)
  21953. This will have the following output:
  21954. Line: 33 Address: 0x4005c8L
  21955. Line: 37 Address: 0x4005caL
  21956. Line: 39 Address: 0x4005d2L
  21957. Line: 40 Address: 0x4005f8L
  21958. Line: 42 Address: 0x4005ffL
  21959. Line: 44 Address: 0x400608L
  21960. Line: 42 Address: 0x40060cL
  21961. Line: 45 Address: 0x400615L
  21962. In addition to being able to iterate over a 'LineTable', it also has
  21963. the following direct access methods:
  21964. -- Function: LineTable.line (line)
  21965. Return a Python 'Tuple' of 'LineTableEntry' objects for any entries
  21966. in the line table for the given LINE, which specifies the source
  21967. code line. If there are no entries for that source code LINE, the
  21968. Python 'None' is returned.
  21969. -- Function: LineTable.has_line (line)
  21970. Return a Python 'Boolean' indicating whether there is an entry in
  21971. the line table for this source line. Return 'True' if an entry is
  21972. found, or 'False' if not.
  21973. -- Function: LineTable.source_lines ()
  21974. Return a Python 'List' of the source line numbers in the symbol
  21975. table. Only lines with executable code locations are returned.
  21976. The contents of the 'List' will just be the source line entries
  21977. represented as Python 'Long' values.
  21978. 
  21979. File: gdb.info, Node: Breakpoints In Python, Next: Finish Breakpoints in Python, Prev: Line Tables In Python, Up: Python API
  21980. 23.2.2.30 Manipulating breakpoints using Python
  21981. ...............................................
  21982. Python code can manipulate breakpoints via the 'gdb.Breakpoint' class.
  21983. A breakpoint can be created using one of the two forms of the
  21984. 'gdb.Breakpoint' constructor. The first one accepts a string like one
  21985. would pass to the 'break' (*note Setting Breakpoints: Set Breaks.) and
  21986. 'watch' (*note Setting Watchpoints: Set Watchpoints.) commands, and can
  21987. be used to create both breakpoints and watchpoints. The second accepts
  21988. separate Python arguments similar to *note Explicit Locations::, and can
  21989. only be used to create breakpoints.
  21990. -- Function: Breakpoint.__init__ (spec [, type ][, wp_class ][,
  21991. internal ][, temporary ][, qualified ])
  21992. Create a new breakpoint according to SPEC, which is a string naming
  21993. the location of a breakpoint, or an expression that defines a
  21994. watchpoint. The string should describe a location in a format
  21995. recognized by the 'break' command (*note Setting Breakpoints: Set
  21996. Breaks.) or, in the case of a watchpoint, by the 'watch' command
  21997. (*note Setting Watchpoints: Set Watchpoints.).
  21998. The optional TYPE argument specifies the type of the breakpoint to
  21999. create, as defined below.
  22000. The optional WP_CLASS argument defines the class of watchpoint to
  22001. create, if TYPE is 'gdb.BP_WATCHPOINT'. If WP_CLASS is omitted, it
  22002. defaults to 'gdb.WP_WRITE'.
  22003. The optional INTERNAL argument allows the breakpoint to become
  22004. invisible to the user. The breakpoint will neither be reported
  22005. when created, nor will it be listed in the output from 'info
  22006. breakpoints' (but will be listed with the 'maint info breakpoints'
  22007. command).
  22008. The optional TEMPORARY argument makes the breakpoint a temporary
  22009. breakpoint. Temporary breakpoints are deleted after they have been
  22010. hit. Any further access to the Python breakpoint after it has been
  22011. hit will result in a runtime error (as that breakpoint has now been
  22012. automatically deleted).
  22013. The optional QUALIFIED argument is a boolean that allows
  22014. interpreting the function passed in 'spec' as a fully-qualified
  22015. name. It is equivalent to 'break''s '-qualified' flag (*note
  22016. Linespec Locations:: and *note Explicit Locations::).
  22017. -- Function: Breakpoint.__init__ ([ source ][, function ][, label ][,
  22018. line ], ][ internal ][, temporary ][, qualified ])
  22019. This second form of creating a new breakpoint specifies the
  22020. explicit location (*note Explicit Locations::) using keywords. The
  22021. new breakpoint will be created in the specified source file SOURCE,
  22022. at the specified FUNCTION, LABEL and LINE.
  22023. INTERNAL, TEMPORARY and QUALIFIED have the same usage as explained
  22024. previously.
  22025. The available types are represented by constants defined in the 'gdb'
  22026. module:
  22027. 'gdb.BP_BREAKPOINT'
  22028. Normal code breakpoint.
  22029. 'gdb.BP_WATCHPOINT'
  22030. Watchpoint breakpoint.
  22031. 'gdb.BP_HARDWARE_WATCHPOINT'
  22032. Hardware assisted watchpoint.
  22033. 'gdb.BP_READ_WATCHPOINT'
  22034. Hardware assisted read watchpoint.
  22035. 'gdb.BP_ACCESS_WATCHPOINT'
  22036. Hardware assisted access watchpoint.
  22037. The available watchpoint types represented by constants are defined
  22038. in the 'gdb' module:
  22039. 'gdb.WP_READ'
  22040. Read only watchpoint.
  22041. 'gdb.WP_WRITE'
  22042. Write only watchpoint.
  22043. 'gdb.WP_ACCESS'
  22044. Read/Write watchpoint.
  22045. -- Function: Breakpoint.stop (self)
  22046. The 'gdb.Breakpoint' class can be sub-classed and, in particular,
  22047. you may choose to implement the 'stop' method. If this method is
  22048. defined in a sub-class of 'gdb.Breakpoint', it will be called when
  22049. the inferior reaches any location of a breakpoint which
  22050. instantiates that sub-class. If the method returns 'True', the
  22051. inferior will be stopped at the location of the breakpoint,
  22052. otherwise the inferior will continue.
  22053. If there are multiple breakpoints at the same location with a
  22054. 'stop' method, each one will be called regardless of the return
  22055. status of the previous. This ensures that all 'stop' methods have
  22056. a chance to execute at that location. In this scenario if one of
  22057. the methods returns 'True' but the others return 'False', the
  22058. inferior will still be stopped.
  22059. You should not alter the execution state of the inferior (i.e.,
  22060. step, next, etc.), alter the current frame context (i.e., change
  22061. the current active frame), or alter, add or delete any breakpoint.
  22062. As a general rule, you should not alter any data within GDB or the
  22063. inferior at this time.
  22064. Example 'stop' implementation:
  22065. class MyBreakpoint (gdb.Breakpoint):
  22066. def stop (self):
  22067. inf_val = gdb.parse_and_eval("foo")
  22068. if inf_val == 3:
  22069. return True
  22070. return False
  22071. -- Function: Breakpoint.is_valid ()
  22072. Return 'True' if this 'Breakpoint' object is valid, 'False'
  22073. otherwise. A 'Breakpoint' object can become invalid if the user
  22074. deletes the breakpoint. In this case, the object still exists, but
  22075. the underlying breakpoint does not. In the cases of watchpoint
  22076. scope, the watchpoint remains valid even if execution of the
  22077. inferior leaves the scope of that watchpoint.
  22078. -- Function: Breakpoint.delete ()
  22079. Permanently deletes the GDB breakpoint. This also invalidates the
  22080. Python 'Breakpoint' object. Any further access to this object's
  22081. attributes or methods will raise an error.
  22082. -- Variable: Breakpoint.enabled
  22083. This attribute is 'True' if the breakpoint is enabled, and 'False'
  22084. otherwise. This attribute is writable. You can use it to enable
  22085. or disable the breakpoint.
  22086. -- Variable: Breakpoint.silent
  22087. This attribute is 'True' if the breakpoint is silent, and 'False'
  22088. otherwise. This attribute is writable.
  22089. Note that a breakpoint can also be silent if it has commands and
  22090. the first command is 'silent'. This is not reported by the
  22091. 'silent' attribute.
  22092. -- Variable: Breakpoint.pending
  22093. This attribute is 'True' if the breakpoint is pending, and 'False'
  22094. otherwise. *Note Set Breaks::. This attribute is read-only.
  22095. -- Variable: Breakpoint.thread
  22096. If the breakpoint is thread-specific, this attribute holds the
  22097. thread's global id. If the breakpoint is not thread-specific, this
  22098. attribute is 'None'. This attribute is writable.
  22099. -- Variable: Breakpoint.task
  22100. If the breakpoint is Ada task-specific, this attribute holds the
  22101. Ada task id. If the breakpoint is not task-specific (or the
  22102. underlying language is not Ada), this attribute is 'None'. This
  22103. attribute is writable.
  22104. -- Variable: Breakpoint.ignore_count
  22105. This attribute holds the ignore count for the breakpoint, an
  22106. integer. This attribute is writable.
  22107. -- Variable: Breakpoint.number
  22108. This attribute holds the breakpoint's number -- the identifier used
  22109. by the user to manipulate the breakpoint. This attribute is not
  22110. writable.
  22111. -- Variable: Breakpoint.type
  22112. This attribute holds the breakpoint's type -- the identifier used
  22113. to determine the actual breakpoint type or use-case. This
  22114. attribute is not writable.
  22115. -- Variable: Breakpoint.visible
  22116. This attribute tells whether the breakpoint is visible to the user
  22117. when set, or when the 'info breakpoints' command is run. This
  22118. attribute is not writable.
  22119. -- Variable: Breakpoint.temporary
  22120. This attribute indicates whether the breakpoint was created as a
  22121. temporary breakpoint. Temporary breakpoints are automatically
  22122. deleted after that breakpoint has been hit. Access to this
  22123. attribute, and all other attributes and functions other than the
  22124. 'is_valid' function, will result in an error after the breakpoint
  22125. has been hit (as it has been automatically deleted). This
  22126. attribute is not writable.
  22127. -- Variable: Breakpoint.hit_count
  22128. This attribute holds the hit count for the breakpoint, an integer.
  22129. This attribute is writable, but currently it can only be set to
  22130. zero.
  22131. -- Variable: Breakpoint.location
  22132. This attribute holds the location of the breakpoint, as specified
  22133. by the user. It is a string. If the breakpoint does not have a
  22134. location (that is, it is a watchpoint) the attribute's value is
  22135. 'None'. This attribute is not writable.
  22136. -- Variable: Breakpoint.expression
  22137. This attribute holds a breakpoint expression, as specified by the
  22138. user. It is a string. If the breakpoint does not have an
  22139. expression (the breakpoint is not a watchpoint) the attribute's
  22140. value is 'None'. This attribute is not writable.
  22141. -- Variable: Breakpoint.condition
  22142. This attribute holds the condition of the breakpoint, as specified
  22143. by the user. It is a string. If there is no condition, this
  22144. attribute's value is 'None'. This attribute is writable.
  22145. -- Variable: Breakpoint.commands
  22146. This attribute holds the commands attached to the breakpoint. If
  22147. there are commands, this attribute's value is a string holding all
  22148. the commands, separated by newlines. If there are no commands,
  22149. this attribute is 'None'. This attribute is writable.
  22150. 
  22151. File: gdb.info, Node: Finish Breakpoints in Python, Next: Lazy Strings In Python, Prev: Breakpoints In Python, Up: Python API
  22152. 23.2.2.31 Finish Breakpoints
  22153. ............................
  22154. A finish breakpoint is a temporary breakpoint set at the return address
  22155. of a frame, based on the 'finish' command. 'gdb.FinishBreakpoint'
  22156. extends 'gdb.Breakpoint'. The underlying breakpoint will be disabled
  22157. and deleted when the execution will run out of the breakpoint scope
  22158. (i.e. 'Breakpoint.stop' or 'FinishBreakpoint.out_of_scope' triggered).
  22159. Finish breakpoints are thread specific and must be create with the right
  22160. thread selected.
  22161. -- Function: FinishBreakpoint.__init__ ([frame] [, internal])
  22162. Create a finish breakpoint at the return address of the 'gdb.Frame'
  22163. object FRAME. If FRAME is not provided, this defaults to the
  22164. newest frame. The optional INTERNAL argument allows the breakpoint
  22165. to become invisible to the user. *Note Breakpoints In Python::,
  22166. for further details about this argument.
  22167. -- Function: FinishBreakpoint.out_of_scope (self)
  22168. In some circumstances (e.g. 'longjmp', C++ exceptions, GDB 'return'
  22169. command, ...), a function may not properly terminate, and thus
  22170. never hit the finish breakpoint. When GDB notices such a
  22171. situation, the 'out_of_scope' callback will be triggered.
  22172. You may want to sub-class 'gdb.FinishBreakpoint' and override this
  22173. method:
  22174. class MyFinishBreakpoint (gdb.FinishBreakpoint)
  22175. def stop (self):
  22176. print "normal finish"
  22177. return True
  22178. def out_of_scope ():
  22179. print "abnormal finish"
  22180. -- Variable: FinishBreakpoint.return_value
  22181. When GDB is stopped at a finish breakpoint and the frame used to
  22182. build the 'gdb.FinishBreakpoint' object had debug symbols, this
  22183. attribute will contain a 'gdb.Value' object corresponding to the
  22184. return value of the function. The value will be 'None' if the
  22185. function return type is 'void' or if the return value was not
  22186. computable. This attribute is not writable.
  22187. 
  22188. File: gdb.info, Node: Lazy Strings In Python, Next: Architectures In Python, Prev: Finish Breakpoints in Python, Up: Python API
  22189. 23.2.2.32 Python representation of lazy strings
  22190. ...............................................
  22191. A "lazy string" is a string whose contents is not retrieved or encoded
  22192. until it is needed.
  22193. A 'gdb.LazyString' is represented in GDB as an 'address' that points
  22194. to a region of memory, an 'encoding' that will be used to encode that
  22195. region of memory, and a 'length' to delimit the region of memory that
  22196. represents the string. The difference between a 'gdb.LazyString' and a
  22197. string wrapped within a 'gdb.Value' is that a 'gdb.LazyString' will be
  22198. treated differently by GDB when printing. A 'gdb.LazyString' is
  22199. retrieved and encoded during printing, while a 'gdb.Value' wrapping a
  22200. string is immediately retrieved and encoded on creation.
  22201. A 'gdb.LazyString' object has the following functions:
  22202. -- Function: LazyString.value ()
  22203. Convert the 'gdb.LazyString' to a 'gdb.Value'. This value will
  22204. point to the string in memory, but will lose all the delayed
  22205. retrieval, encoding and handling that GDB applies to a
  22206. 'gdb.LazyString'.
  22207. -- Variable: LazyString.address
  22208. This attribute holds the address of the string. This attribute is
  22209. not writable.
  22210. -- Variable: LazyString.length
  22211. This attribute holds the length of the string in characters. If
  22212. the length is -1, then the string will be fetched and encoded up to
  22213. the first null of appropriate width. This attribute is not
  22214. writable.
  22215. -- Variable: LazyString.encoding
  22216. This attribute holds the encoding that will be applied to the
  22217. string when the string is printed by GDB. If the encoding is not
  22218. set, or contains an empty string, then GDB will select the most
  22219. appropriate encoding when the string is printed. This attribute is
  22220. not writable.
  22221. -- Variable: LazyString.type
  22222. This attribute holds the type that is represented by the lazy
  22223. string's type. For a lazy string this is a pointer or array type.
  22224. To resolve this to the lazy string's character type, use the type's
  22225. 'target' method. *Note Types In Python::. This attribute is not
  22226. writable.
  22227. 
  22228. File: gdb.info, Node: Architectures In Python, Next: Registers In Python, Prev: Lazy Strings In Python, Up: Python API
  22229. 23.2.2.33 Python representation of architectures
  22230. ................................................
  22231. GDB uses architecture specific parameters and artifacts in a number of
  22232. its various computations. An architecture is represented by an instance
  22233. of the 'gdb.Architecture' class.
  22234. A 'gdb.Architecture' class has the following methods:
  22235. -- Function: Architecture.name ()
  22236. Return the name (string value) of the architecture.
  22237. -- Function: Architecture.disassemble (START_PC [, END_PC [, COUNT]])
  22238. Return a list of disassembled instructions starting from the memory
  22239. address START_PC. The optional arguments END_PC and COUNT
  22240. determine the number of instructions in the returned list. If both
  22241. the optional arguments END_PC and COUNT are specified, then a list
  22242. of at most COUNT disassembled instructions whose start address
  22243. falls in the closed memory address interval from START_PC to END_PC
  22244. are returned. If END_PC is not specified, but COUNT is specified,
  22245. then COUNT number of instructions starting from the address
  22246. START_PC are returned. If COUNT is not specified but END_PC is
  22247. specified, then all instructions whose start address falls in the
  22248. closed memory address interval from START_PC to END_PC are
  22249. returned. If neither END_PC nor COUNT are specified, then a single
  22250. instruction at START_PC is returned. For all of these cases, each
  22251. element of the returned list is a Python 'dict' with the following
  22252. string keys:
  22253. 'addr'
  22254. The value corresponding to this key is a Python long integer
  22255. capturing the memory address of the instruction.
  22256. 'asm'
  22257. The value corresponding to this key is a string value which
  22258. represents the instruction with assembly language mnemonics.
  22259. The assembly language flavor used is the same as that
  22260. specified by the current CLI variable 'disassembly-flavor'.
  22261. *Note Machine Code::.
  22262. 'length'
  22263. The value corresponding to this key is the length (integer
  22264. value) of the instruction in bytes.
  22265. -- Function: Architecture.registers ([ REGGROUP ])
  22266. Return a 'gdb.RegisterDescriptorIterator' (*note Registers In
  22267. Python::) for all of the registers in REGGROUP, a string that is
  22268. the name of a register group. If REGGROUP is omitted, or is the
  22269. empty string, then the register group 'all' is assumed.
  22270. -- Function: Architecture.register_groups ()
  22271. Return a 'gdb.RegisterGroupsIterator' (*note Registers In Python::)
  22272. for all of the register groups available for the
  22273. 'gdb.Architecture'.
  22274. 
  22275. File: gdb.info, Node: Registers In Python, Next: TUI Windows In Python, Prev: Architectures In Python, Up: Python API
  22276. 23.2.2.34 Registers In Python
  22277. .............................
  22278. Python code can request from a 'gdb.Architecture' information about the
  22279. set of registers available (*note 'Architecture.registers':
  22280. gdbpy_architecture_registers.). The register information is returned as
  22281. a 'gdb.RegisterDescriptorIterator', which is an iterator that in turn
  22282. returns 'gdb.RegisterDescriptor' objects.
  22283. A 'gdb.RegisterDescriptor' does not provide the value of a register
  22284. (*note 'Frame.read_register': gdbpy_frame_read_register. for reading a
  22285. register's value), instead the 'RegisterDescriptor' is a way to discover
  22286. which registers are available for a particular architecture.
  22287. A 'gdb.RegisterDescriptor' has the following read-only properties:
  22288. -- Variable: RegisterDescriptor.name
  22289. The name of this register.
  22290. It is also possible to lookup a register descriptor based on its name
  22291. using the following 'gdb.RegisterDescriptorIterator' function:
  22292. -- Function: RegisterDescriptorIterator.find (NAME)
  22293. Takes NAME as an argument, which must be a string, and returns a
  22294. 'gdb.RegisterDescriptor' for the register with that name, or 'None'
  22295. if there is no register with that name.
  22296. Python code can also request from a 'gdb.Architecture' information
  22297. about the set of register groups available on a given architecture
  22298. (*note 'Architecture.register_groups': gdbpy_architecture_reggroups.).
  22299. Every register can be a member of zero or more register groups. Some
  22300. register groups are used internally within GDB to control things like
  22301. which registers must be saved when calling into the program being
  22302. debugged (*note Calling Program Functions: Calling.). Other register
  22303. groups exist to allow users to easily see related sets of registers in
  22304. commands like 'info registers' (*note 'info registers REGGROUP':
  22305. info_registers_reggroup.).
  22306. The register groups information is returned as a
  22307. 'gdb.RegisterGroupsIterator', which is an iterator that in turn returns
  22308. 'gdb.RegisterGroup' objects.
  22309. A 'gdb.RegisterGroup' object has the following read-only properties:
  22310. -- Variable: RegisterGroup.name
  22311. A string that is the name of this register group.
  22312. 
  22313. File: gdb.info, Node: TUI Windows In Python, Prev: Registers In Python, Up: Python API
  22314. 23.2.2.35 Implementing new TUI windows
  22315. ......................................
  22316. New TUI (*note TUI::) windows can be implemented in Python.
  22317. -- Function: gdb.register_window_type (NAME, FACTORY)
  22318. Because TUI windows are created and destroyed depending on the
  22319. layout the user chooses, new window types are implemented by
  22320. registering a factory function with GDB.
  22321. NAME is the name of the new window. It's an error to try to
  22322. replace one of the built-in windows, but other window types can be
  22323. replaced.
  22324. FUNCTION is a factory function that is called to create the TUI
  22325. window. This is called with a single argument of type
  22326. 'gdb.TuiWindow', described below. It should return an object that
  22327. implements the TUI window protocol, also described below.
  22328. As mentioned above, when a factory function is called, it is passed a
  22329. an object of type 'gdb.TuiWindow'. This object has these methods and
  22330. attributes:
  22331. -- Function: TuiWindow.is_valid ()
  22332. This method returns 'True' when this window is valid. When the
  22333. user changes the TUI layout, windows no longer visible in the new
  22334. layout will be destroyed. At this point, the 'gdb.TuiWindow' will
  22335. no longer be valid, and methods (and attributes) other than
  22336. 'is_valid' will throw an exception.
  22337. -- Variable: TuiWindow.width
  22338. This attribute holds the width of the window. It is not writable.
  22339. -- Variable: TuiWindow.height
  22340. This attribute holds the height of the window. It is not writable.
  22341. -- Variable: TuiWindow.title
  22342. This attribute holds the window's title, a string. This is
  22343. normally displayed above the window. This attribute can be
  22344. modified.
  22345. -- Function: TuiWindow.erase ()
  22346. Remove all the contents of the window.
  22347. -- Function: TuiWindow.write (STRING)
  22348. Write STRING to the window. STRING can contain ANSI terminal
  22349. escape styling sequences; GDB will translate these as appropriate
  22350. for the terminal.
  22351. The factory function that you supply should return an object
  22352. conforming to the TUI window protocol. These are the method that can be
  22353. called on this object, which is referred to below as the "window
  22354. object". The methods documented below are optional; if the object does
  22355. not implement one of these methods, GDB will not attempt to call it.
  22356. Additional new methods may be added to the window protocol in the
  22357. future. GDB guarantees that they will begin with a lower-case letter,
  22358. so you can start implementation methods with upper-case letters or
  22359. underscore to avoid any future conflicts.
  22360. -- Function: Window.close ()
  22361. When the TUI window is closed, the 'gdb.TuiWindow' object will be
  22362. put into an invalid state. At this time, GDB will call 'close'
  22363. method on the window object.
  22364. After this method is called, GDB will discard any references it
  22365. holds on this window object, and will no longer call methods on
  22366. this object.
  22367. -- Function: Window.render ()
  22368. In some situations, a TUI window can change size. For example,
  22369. this can happen if the user resizes the terminal, or changes the
  22370. layout. When this happens, GDB will call the 'render' method on
  22371. the window object.
  22372. If your window is intended to update in response to changes in the
  22373. inferior, you will probably also want to register event listeners
  22374. and send output to the 'gdb.TuiWindow'.
  22375. -- Function: Window.hscroll (NUM)
  22376. This is a request to scroll the window horizontally. NUM is the
  22377. amount by which to scroll, with negative numbers meaning to scroll
  22378. right. In the TUI model, it is the viewport that moves, not the
  22379. contents. A positive argument should cause the viewport to move
  22380. right, and so the content should appear to move to the left.
  22381. -- Function: Window.vscroll (NUM)
  22382. This is a request to scroll the window vertically. NUM is the
  22383. amount by which to scroll, with negative numbers meaning to scroll
  22384. backward. In the TUI model, it is the viewport that moves, not the
  22385. contents. A positive argument should cause the viewport to move
  22386. down, and so the content should appear to move up.
  22387. 
  22388. File: gdb.info, Node: Python Auto-loading, Next: Python modules, Prev: Python API, Up: Python
  22389. 23.2.3 Python Auto-loading
  22390. --------------------------
  22391. When a new object file is read (for example, due to the 'file' command,
  22392. or because the inferior has loaded a shared library), GDB will look for
  22393. Python support scripts in several ways: 'OBJFILE-gdb.py' and
  22394. '.debug_gdb_scripts' section. *Note Auto-loading extensions::.
  22395. The auto-loading feature is useful for supplying application-specific
  22396. debugging commands and scripts.
  22397. Auto-loading can be enabled or disabled, and the list of auto-loaded
  22398. scripts can be printed.
  22399. 'set auto-load python-scripts [on|off]'
  22400. Enable or disable the auto-loading of Python scripts.
  22401. 'show auto-load python-scripts'
  22402. Show whether auto-loading of Python scripts is enabled or disabled.
  22403. 'info auto-load python-scripts [REGEXP]'
  22404. Print the list of all Python scripts that GDB auto-loaded.
  22405. Also printed is the list of Python scripts that were mentioned in
  22406. the '.debug_gdb_scripts' section and were either not found (*note
  22407. dotdebug_gdb_scripts section::) or were not auto-loaded due to
  22408. 'auto-load safe-path' rejection (*note Auto-loading::). This is
  22409. useful because their names are not printed when GDB tries to load
  22410. them and fails. There may be many of them, and printing an error
  22411. message for each one is problematic.
  22412. If REGEXP is supplied only Python scripts with matching names are
  22413. printed.
  22414. Example:
  22415. (gdb) info auto-load python-scripts
  22416. Loaded Script
  22417. Yes py-section-script.py
  22418. full name: /tmp/py-section-script.py
  22419. No my-foo-pretty-printers.py
  22420. When reading an auto-loaded file or script, GDB sets the "current
  22421. objfile". This is available via the 'gdb.current_objfile' function
  22422. (*note Objfiles In Python::). This can be useful for registering
  22423. objfile-specific pretty-printers and frame-filters.
  22424. 
  22425. File: gdb.info, Node: Python modules, Prev: Python Auto-loading, Up: Python
  22426. 23.2.4 Python modules
  22427. ---------------------
  22428. GDB comes with several modules to assist writing Python code.
  22429. * Menu:
  22430. * gdb.printing:: Building and registering pretty-printers.
  22431. * gdb.types:: Utilities for working with types.
  22432. * gdb.prompt:: Utilities for prompt value substitution.
  22433. 
  22434. File: gdb.info, Node: gdb.printing, Next: gdb.types, Up: Python modules
  22435. 23.2.4.1 gdb.printing
  22436. .....................
  22437. This module provides a collection of utilities for working with
  22438. pretty-printers.
  22439. 'PrettyPrinter (NAME, SUBPRINTERS=None)'
  22440. This class specifies the API that makes 'info pretty-printer',
  22441. 'enable pretty-printer' and 'disable pretty-printer' work.
  22442. Pretty-printers should generally inherit from this class.
  22443. 'SubPrettyPrinter (NAME)'
  22444. For printers that handle multiple types, this class specifies the
  22445. corresponding API for the subprinters.
  22446. 'RegexpCollectionPrettyPrinter (NAME)'
  22447. Utility class for handling multiple printers, all recognized via
  22448. regular expressions. *Note Writing a Pretty-Printer::, for an
  22449. example.
  22450. 'FlagEnumerationPrinter (NAME)'
  22451. A pretty-printer which handles printing of 'enum' values. Unlike
  22452. GDB's built-in 'enum' printing, this printer attempts to work
  22453. properly when there is some overlap between the enumeration
  22454. constants. The argument NAME is the name of the printer and also
  22455. the name of the 'enum' type to look up.
  22456. 'register_pretty_printer (OBJ, PRINTER, REPLACE=False)'
  22457. Register PRINTER with the pretty-printer list of OBJ. If REPLACE
  22458. is 'True' then any existing copy of the printer is replaced.
  22459. Otherwise a 'RuntimeError' exception is raised if a printer with
  22460. the same name already exists.
  22461. 
  22462. File: gdb.info, Node: gdb.types, Next: gdb.prompt, Prev: gdb.printing, Up: Python modules
  22463. 23.2.4.2 gdb.types
  22464. ..................
  22465. This module provides a collection of utilities for working with
  22466. 'gdb.Type' objects.
  22467. 'get_basic_type (TYPE)'
  22468. Return TYPE with const and volatile qualifiers stripped, and with
  22469. typedefs and C++ references converted to the underlying type.
  22470. C++ example:
  22471. typedef const int const_int;
  22472. const_int foo (3);
  22473. const_int& foo_ref (foo);
  22474. int main () { return 0; }
  22475. Then in gdb:
  22476. (gdb) start
  22477. (gdb) python import gdb.types
  22478. (gdb) python foo_ref = gdb.parse_and_eval("foo_ref")
  22479. (gdb) python print gdb.types.get_basic_type(foo_ref.type)
  22480. int
  22481. 'has_field (TYPE, FIELD)'
  22482. Return 'True' if TYPE, assumed to be a type with fields (e.g., a
  22483. structure or union), has field FIELD.
  22484. 'make_enum_dict (ENUM_TYPE)'
  22485. Return a Python 'dictionary' type produced from ENUM_TYPE.
  22486. 'deep_items (TYPE)'
  22487. Returns a Python iterator similar to the standard
  22488. 'gdb.Type.iteritems' method, except that the iterator returned by
  22489. 'deep_items' will recursively traverse anonymous struct or union
  22490. fields. For example:
  22491. struct A
  22492. {
  22493. int a;
  22494. union {
  22495. int b0;
  22496. int b1;
  22497. };
  22498. };
  22499. Then in GDB:
  22500. (gdb) python import gdb.types
  22501. (gdb) python struct_a = gdb.lookup_type("struct A")
  22502. (gdb) python print struct_a.keys ()
  22503. {['a', '']}
  22504. (gdb) python print [k for k,v in gdb.types.deep_items(struct_a)]
  22505. {['a', 'b0', 'b1']}
  22506. 'get_type_recognizers ()'
  22507. Return a list of the enabled type recognizers for the current
  22508. context. This is called by GDB during the type-printing process
  22509. (*note Type Printing API::).
  22510. 'apply_type_recognizers (recognizers, type_obj)'
  22511. Apply the type recognizers, RECOGNIZERS, to the type object
  22512. TYPE_OBJ. If any recognizer returns a string, return that string.
  22513. Otherwise, return 'None'. This is called by GDB during the
  22514. type-printing process (*note Type Printing API::).
  22515. 'register_type_printer (locus, printer)'
  22516. This is a convenience function to register a type printer PRINTER.
  22517. The printer must implement the type printer protocol. The LOCUS
  22518. argument is either a 'gdb.Objfile', in which case the printer is
  22519. registered with that objfile; a 'gdb.Progspace', in which case the
  22520. printer is registered with that progspace; or 'None', in which case
  22521. the printer is registered globally.
  22522. 'TypePrinter'
  22523. This is a base class that implements the type printer protocol.
  22524. Type printers are encouraged, but not required, to derive from this
  22525. class. It defines a constructor:
  22526. -- Method on TypePrinter: __init__ (self, name)
  22527. Initialize the type printer with the given name. The new
  22528. printer starts in the enabled state.
  22529. 
  22530. File: gdb.info, Node: gdb.prompt, Prev: gdb.types, Up: Python modules
  22531. 23.2.4.3 gdb.prompt
  22532. ...................
  22533. This module provides a method for prompt value-substitution.
  22534. 'substitute_prompt (STRING)'
  22535. Return STRING with escape sequences substituted by values. Some
  22536. escape sequences take arguments. You can specify arguments inside
  22537. "{}" immediately following the escape sequence.
  22538. The escape sequences you can pass to this function are:
  22539. '\\'
  22540. Substitute a backslash.
  22541. '\e'
  22542. Substitute an ESC character.
  22543. '\f'
  22544. Substitute the selected frame; an argument names a frame
  22545. parameter.
  22546. '\n'
  22547. Substitute a newline.
  22548. '\p'
  22549. Substitute a parameter's value; the argument names the
  22550. parameter.
  22551. '\r'
  22552. Substitute a carriage return.
  22553. '\t'
  22554. Substitute the selected thread; an argument names a thread
  22555. parameter.
  22556. '\v'
  22557. Substitute the version of GDB.
  22558. '\w'
  22559. Substitute the current working directory.
  22560. '\['
  22561. Begin a sequence of non-printing characters. These sequences
  22562. are typically used with the ESC character, and are not counted
  22563. in the string length. Example: "\[\e[0;34m\](gdb)\[\e[0m\]"
  22564. will return a blue-colored "(gdb)" prompt where the length is
  22565. five.
  22566. '\]'
  22567. End a sequence of non-printing characters.
  22568. For example:
  22569. substitute_prompt ("frame: \f, args: \p{print frame-arguments}")
  22570. will return the string:
  22571. "frame: main, args: scalars"
  22572. 
  22573. File: gdb.info, Node: Guile, Next: Auto-loading extensions, Prev: Python, Up: Extending GDB
  22574. 23.3 Extending GDB using Guile
  22575. ==============================
  22576. You can extend GDB using the Guile implementation of the Scheme
  22577. programming language (http://www.gnu.org/software/guile/). This feature
  22578. is available only if GDB was configured using '--with-guile'.
  22579. * Menu:
  22580. * Guile Introduction:: Introduction to Guile scripting in GDB
  22581. * Guile Commands:: Accessing Guile from GDB
  22582. * Guile API:: Accessing GDB from Guile
  22583. * Guile Auto-loading:: Automatically loading Guile code
  22584. * Guile Modules:: Guile modules provided by GDB
  22585. 
  22586. File: gdb.info, Node: Guile Introduction, Next: Guile Commands, Up: Guile
  22587. 23.3.1 Guile Introduction
  22588. -------------------------
  22589. Guile is an implementation of the Scheme programming language and is the
  22590. GNU project's official extension language.
  22591. Guile support in GDB follows the Python support in GDB reasonably
  22592. closely, so concepts there should carry over. However, some things are
  22593. done differently where it makes sense.
  22594. GDB requires Guile version 3.0, 2.2, or 2.0.
  22595. Guile scripts used by GDB should be installed in
  22596. 'DATA-DIRECTORY/guile', where DATA-DIRECTORY is the data directory as
  22597. determined at GDB startup (*note Data Files::). This directory, known
  22598. as the "guile directory", is automatically added to the Guile Search
  22599. Path in order to allow the Guile interpreter to locate all scripts
  22600. installed at this location.
  22601. 
  22602. File: gdb.info, Node: Guile Commands, Next: Guile API, Prev: Guile Introduction, Up: Guile
  22603. 23.3.2 Guile Commands
  22604. ---------------------
  22605. GDB provides two commands for accessing the Guile interpreter:
  22606. 'guile-repl'
  22607. 'gr'
  22608. The 'guile-repl' command can be used to start an interactive Guile
  22609. prompt or "repl". To return to GDB, type ',q' or the 'EOF'
  22610. character (e.g., 'Ctrl-D' on an empty prompt). These commands do
  22611. not take any arguments.
  22612. 'guile [SCHEME-EXPRESSION]'
  22613. 'gu [SCHEME-EXPRESSION]'
  22614. The 'guile' command can be used to evaluate a Scheme expression.
  22615. If given an argument, GDB will pass the argument to the Guile
  22616. interpreter for evaluation.
  22617. (gdb) guile (display (+ 20 3)) (newline)
  22618. 23
  22619. The result of the Scheme expression is displayed using normal Guile
  22620. rules.
  22621. (gdb) guile (+ 20 3)
  22622. 23
  22623. If you do not provide an argument to 'guile', it will act as a
  22624. multi-line command, like 'define'. In this case, the Guile script
  22625. is made up of subsequent command lines, given after the 'guile'
  22626. command. This command list is terminated using a line containing
  22627. 'end'. For example:
  22628. (gdb) guile
  22629. >(display 23)
  22630. >(newline)
  22631. >end
  22632. 23
  22633. It is also possible to execute a Guile script from the GDB
  22634. interpreter:
  22635. 'source script-name'
  22636. The script name must end with '.scm' and GDB must be configured to
  22637. recognize the script language based on filename extension using the
  22638. 'script-extension' setting. *Note Extending GDB: Extending GDB.
  22639. 'guile (load "script-name")'
  22640. This method uses the 'load' Guile function. It takes a string
  22641. argument that is the name of the script to load. See the Guile
  22642. documentation for a description of this function. (*note
  22643. (guile)Loading::).
  22644. 
  22645. File: gdb.info, Node: Guile API, Next: Guile Auto-loading, Prev: Guile Commands, Up: Guile
  22646. 23.3.3 Guile API
  22647. ----------------
  22648. You can get quick online help for GDB's Guile API by issuing the command
  22649. 'help guile', or by issuing the command ',help' from an interactive
  22650. Guile session. Furthermore, most Guile procedures provided by GDB have
  22651. doc strings which can be obtained with ',describe PROCEDURE-NAME' or ',d
  22652. PROCEDURE-NAME' from the Guile interactive prompt.
  22653. * Menu:
  22654. * Basic Guile:: Basic Guile Functions
  22655. * Guile Configuration:: Guile configuration variables
  22656. * GDB Scheme Data Types:: Scheme representations of GDB objects
  22657. * Guile Exception Handling:: How Guile exceptions are translated
  22658. * Values From Inferior In Guile:: Guile representation of values
  22659. * Arithmetic In Guile:: Arithmetic in Guile
  22660. * Types In Guile:: Guile representation of types
  22661. * Guile Pretty Printing API:: Pretty-printing values with Guile
  22662. * Selecting Guile Pretty-Printers:: How GDB chooses a pretty-printer
  22663. * Writing a Guile Pretty-Printer:: Writing a pretty-printer
  22664. * Commands In Guile:: Implementing new commands in Guile
  22665. * Parameters In Guile:: Adding new GDB parameters
  22666. * Progspaces In Guile:: Program spaces
  22667. * Objfiles In Guile:: Object files in Guile
  22668. * Frames In Guile:: Accessing inferior stack frames from Guile
  22669. * Blocks In Guile:: Accessing blocks from Guile
  22670. * Symbols In Guile:: Guile representation of symbols
  22671. * Symbol Tables In Guile:: Guile representation of symbol tables
  22672. * Breakpoints In Guile:: Manipulating breakpoints using Guile
  22673. * Lazy Strings In Guile:: Guile representation of lazy strings
  22674. * Architectures In Guile:: Guile representation of architectures
  22675. * Disassembly In Guile:: Disassembling instructions from Guile
  22676. * I/O Ports in Guile:: GDB I/O ports
  22677. * Memory Ports in Guile:: Accessing memory through ports and bytevectors
  22678. * Iterators In Guile:: Basic iterator support
  22679. 
  22680. File: gdb.info, Node: Basic Guile, Next: Guile Configuration, Up: Guile API
  22681. 23.3.3.1 Basic Guile
  22682. ....................
  22683. At startup, GDB overrides Guile's 'current-output-port' and
  22684. 'current-error-port' to print using GDB's output-paging streams. A
  22685. Guile program which outputs to one of these streams may have its output
  22686. interrupted by the user (*note Screen Size::). In this situation, a
  22687. Guile 'signal' exception is thrown with value 'SIGINT'.
  22688. Guile's history mechanism uses the same naming as GDB's, namely the
  22689. user of dollar-variables (e.g., $1, $2, etc.). The results of
  22690. evaluations in Guile and in GDB are counted separately, '$1' in Guile is
  22691. not the same value as '$1' in GDB.
  22692. GDB is not thread-safe. If your Guile program uses multiple threads,
  22693. you must be careful to only call GDB-specific functions in the GDB
  22694. thread.
  22695. Some care must be taken when writing Guile code to run in GDB. Two
  22696. things are worth noting in particular:
  22697. * GDB installs handlers for 'SIGCHLD' and 'SIGINT'. Guile code must
  22698. not override these, or even change the options using 'sigaction'.
  22699. If your program changes the handling of these signals, GDB will
  22700. most likely stop working correctly. Note that it is unfortunately
  22701. common for GUI toolkits to install a 'SIGCHLD' handler.
  22702. * GDB takes care to mark its internal file descriptors as
  22703. close-on-exec. However, this cannot be done in a thread-safe way
  22704. on all platforms. Your Guile programs should be aware of this and
  22705. should both create new file descriptors with the close-on-exec flag
  22706. set and arrange to close unneeded file descriptors before starting
  22707. a child process.
  22708. GDB introduces a new Guile module, named 'gdb'. All methods and
  22709. classes added by GDB are placed in this module. GDB does not
  22710. automatically 'import' the 'gdb' module, scripts must do this
  22711. themselves. There are various options for how to import a module, so
  22712. GDB leaves the choice of how the 'gdb' module is imported to the user.
  22713. To simplify interactive use, it is recommended to add one of the
  22714. following to your ~/.gdbinit.
  22715. guile (use-modules (gdb))
  22716. guile (use-modules ((gdb) #:renamer (symbol-prefix-proc 'gdb:)))
  22717. Which one to choose depends on your preference. The second one adds
  22718. 'gdb:' as a prefix to all module functions and variables.
  22719. The rest of this manual assumes the 'gdb' module has been imported
  22720. without any prefix. See the Guile documentation for 'use-modules' for
  22721. more information (*note (guile)Using Guile Modules::).
  22722. Example:
  22723. (gdb) guile (value-type (make-value 1))
  22724. ERROR: Unbound variable: value-type
  22725. Error while executing Scheme code.
  22726. (gdb) guile (use-modules (gdb))
  22727. (gdb) guile (value-type (make-value 1))
  22728. int
  22729. (gdb)
  22730. The '(gdb)' module provides these basic Guile functions.
  22731. -- Scheme Procedure: execute command [#:from-tty boolean] [#:to-string
  22732. boolean]
  22733. Evaluate COMMAND, a string, as a GDB CLI command. If a GDB
  22734. exception happens while COMMAND runs, it is translated as described
  22735. in *note Guile Exception Handling: Guile Exception Handling.
  22736. FROM-TTY specifies whether GDB ought to consider this command as
  22737. having originated from the user invoking it interactively. It must
  22738. be a boolean value. If omitted, it defaults to '#f'.
  22739. By default, any output produced by COMMAND is sent to GDB's
  22740. standard output (and to the log output if logging is turned on).
  22741. If the TO-STRING parameter is '#t', then output will be collected
  22742. by 'execute' and returned as a string. The default is '#f', in
  22743. which case the return value is unspecified. If TO-STRING is '#t',
  22744. the GDB virtual terminal will be temporarily set to unlimited width
  22745. and height, and its pagination will be disabled; *note Screen
  22746. Size::.
  22747. -- Scheme Procedure: history-ref number
  22748. Return a value from GDB's value history (*note Value History::).
  22749. The NUMBER argument indicates which history element to return. If
  22750. NUMBER is negative, then GDB will take its absolute value and count
  22751. backward from the last element (i.e., the most recent element) to
  22752. find the value to return. If NUMBER is zero, then GDB will return
  22753. the most recent element. If the element specified by NUMBER
  22754. doesn't exist in the value history, a 'gdb:error' exception will be
  22755. raised.
  22756. If no exception is raised, the return value is always an instance
  22757. of '<gdb:value>' (*note Values From Inferior In Guile::).
  22758. _Note:_ GDB's value history is independent of Guile's. '$1' in
  22759. GDB's value history contains the result of evaluating an expression
  22760. from GDB's command line and '$1' from Guile's history contains the
  22761. result of evaluating an expression from Guile's command line.
  22762. -- Scheme Procedure: history-append! value
  22763. Append VALUE, an instance of '<gdb:value>', to GDB's value history.
  22764. Return its index in the history.
  22765. Putting into history values returned by Guile extensions will allow
  22766. the user convenient access to those values via CLI history
  22767. facilities.
  22768. -- Scheme Procedure: parse-and-eval expression
  22769. Parse EXPRESSION as an expression in the current language, evaluate
  22770. it, and return the result as a '<gdb:value>'. The EXPRESSION must
  22771. be a string.
  22772. This function can be useful when implementing a new command (*note
  22773. Commands In Guile::), as it provides a way to parse the command's
  22774. arguments as an expression. It is also is useful when computing
  22775. values. For example, it is the only way to get the value of a
  22776. convenience variable (*note Convenience Vars::) as a '<gdb:value>'.
  22777. 
  22778. File: gdb.info, Node: Guile Configuration, Next: GDB Scheme Data Types, Prev: Basic Guile, Up: Guile API
  22779. 23.3.3.2 Guile Configuration
  22780. ............................
  22781. GDB provides these Scheme functions to access various configuration
  22782. parameters.
  22783. -- Scheme Procedure: data-directory
  22784. Return a string containing GDB's data directory. This directory
  22785. contains GDB's ancillary files.
  22786. -- Scheme Procedure: guile-data-directory
  22787. Return a string containing GDB's Guile data directory. This
  22788. directory contains the Guile modules provided by GDB.
  22789. -- Scheme Procedure: gdb-version
  22790. Return a string containing the GDB version.
  22791. -- Scheme Procedure: host-config
  22792. Return a string containing the host configuration. This is the
  22793. string passed to '--host' when GDB was configured.
  22794. -- Scheme Procedure: target-config
  22795. Return a string containing the target configuration. This is the
  22796. string passed to '--target' when GDB was configured.
  22797. 
  22798. File: gdb.info, Node: GDB Scheme Data Types, Next: Guile Exception Handling, Prev: Guile Configuration, Up: Guile API
  22799. 23.3.3.3 GDB Scheme Data Types
  22800. ..............................
  22801. The values exposed by GDB to Guile are known as "GDB objects". There
  22802. are several kinds of GDB object, and each is disjoint from all other
  22803. types known to Guile.
  22804. -- Scheme Procedure: gdb-object-kind object
  22805. Return the kind of the GDB object, e.g., '<gdb:breakpoint>', as a
  22806. symbol.
  22807. GDB defines the following object types:
  22808. '<gdb:arch>'
  22809. *Note Architectures In Guile::.
  22810. '<gdb:block>'
  22811. *Note Blocks In Guile::.
  22812. '<gdb:block-symbols-iterator>'
  22813. *Note Blocks In Guile::.
  22814. '<gdb:breakpoint>'
  22815. *Note Breakpoints In Guile::.
  22816. '<gdb:command>'
  22817. *Note Commands In Guile::.
  22818. '<gdb:exception>'
  22819. *Note Guile Exception Handling::.
  22820. '<gdb:frame>'
  22821. *Note Frames In Guile::.
  22822. '<gdb:iterator>'
  22823. *Note Iterators In Guile::.
  22824. '<gdb:lazy-string>'
  22825. *Note Lazy Strings In Guile::.
  22826. '<gdb:objfile>'
  22827. *Note Objfiles In Guile::.
  22828. '<gdb:parameter>'
  22829. *Note Parameters In Guile::.
  22830. '<gdb:pretty-printer>'
  22831. *Note Guile Pretty Printing API::.
  22832. '<gdb:pretty-printer-worker>'
  22833. *Note Guile Pretty Printing API::.
  22834. '<gdb:progspace>'
  22835. *Note Progspaces In Guile::.
  22836. '<gdb:symbol>'
  22837. *Note Symbols In Guile::.
  22838. '<gdb:symtab>'
  22839. *Note Symbol Tables In Guile::.
  22840. '<gdb:sal>'
  22841. *Note Symbol Tables In Guile::.
  22842. '<gdb:type>'
  22843. *Note Types In Guile::.
  22844. '<gdb:field>'
  22845. *Note Types In Guile::.
  22846. '<gdb:value>'
  22847. *Note Values From Inferior In Guile::.
  22848. The following GDB objects are managed internally so that the Scheme
  22849. function 'eq?' may be applied to them.
  22850. '<gdb:arch>'
  22851. '<gdb:block>'
  22852. '<gdb:breakpoint>'
  22853. '<gdb:frame>'
  22854. '<gdb:objfile>'
  22855. '<gdb:progspace>'
  22856. '<gdb:symbol>'
  22857. '<gdb:symtab>'
  22858. '<gdb:type>'
  22859. 
  22860. File: gdb.info, Node: Guile Exception Handling, Next: Values From Inferior In Guile, Prev: GDB Scheme Data Types, Up: Guile API
  22861. 23.3.3.4 Guile Exception Handling
  22862. .................................
  22863. When executing the 'guile' command, Guile exceptions uncaught within the
  22864. Guile code are translated to calls to the GDB error-reporting mechanism.
  22865. If the command that called 'guile' does not handle the error, GDB will
  22866. terminate it and report the error according to the setting of the 'guile
  22867. print-stack' parameter.
  22868. The 'guile print-stack' parameter has three settings:
  22869. 'none'
  22870. Nothing is printed.
  22871. 'message'
  22872. An error message is printed containing the Guile exception name,
  22873. the associated value, and the Guile call stack backtrace at the
  22874. point where the exception was raised. Example:
  22875. (gdb) guile (display foo)
  22876. ERROR: In procedure memoize-variable-access!:
  22877. ERROR: Unbound variable: foo
  22878. Error while executing Scheme code.
  22879. 'full'
  22880. In addition to an error message a full backtrace is printed.
  22881. (gdb) set guile print-stack full
  22882. (gdb) guile (display foo)
  22883. Guile Backtrace:
  22884. In ice-9/boot-9.scm:
  22885. 157: 10 [catch #t #<catch-closure 2c76e20> ...]
  22886. In unknown file:
  22887. ?: 9 [apply-smob/1 #<catch-closure 2c76e20>]
  22888. In ice-9/boot-9.scm:
  22889. 157: 8 [catch #t #<catch-closure 2c76d20> ...]
  22890. In unknown file:
  22891. ?: 7 [apply-smob/1 #<catch-closure 2c76d20>]
  22892. ?: 6 [call-with-input-string "(display foo)" ...]
  22893. In ice-9/boot-9.scm:
  22894. 2320: 5 [save-module-excursion #<procedure 2c2dc30 ... ()>]
  22895. In ice-9/eval-string.scm:
  22896. 44: 4 [read-and-eval #<input: string 27cb410> #:lang ...]
  22897. 37: 3 [lp (display foo)]
  22898. In ice-9/eval.scm:
  22899. 387: 2 [eval # ()]
  22900. 393: 1 [eval #<memoized foo> ()]
  22901. In unknown file:
  22902. ?: 0 [memoize-variable-access! #<memoized foo> ...]
  22903. ERROR: In procedure memoize-variable-access!:
  22904. ERROR: Unbound variable: foo
  22905. Error while executing Scheme code.
  22906. GDB errors that happen in GDB commands invoked by Guile code are
  22907. converted to Guile exceptions. The type of the Guile exception depends
  22908. on the error.
  22909. Guile procedures provided by GDB can throw the standard Guile
  22910. exceptions like 'wrong-type-arg' and 'out-of-range'.
  22911. User interrupt (via 'C-c' or by typing 'q' at a pagination prompt) is
  22912. translated to a Guile 'signal' exception with value 'SIGINT'.
  22913. GDB Guile procedures can also throw these exceptions:
  22914. 'gdb:error'
  22915. This exception is a catch-all for errors generated from within GDB.
  22916. 'gdb:invalid-object'
  22917. This exception is thrown when accessing Guile objects that wrap
  22918. underlying GDB objects have become invalid. For example, a
  22919. '<gdb:breakpoint>' object becomes invalid if the user deletes it
  22920. from the command line. The object still exists in Guile, but the
  22921. object it represents is gone. Further operations on this
  22922. breakpoint will throw this exception.
  22923. 'gdb:memory-error'
  22924. This exception is thrown when an operation tried to access invalid
  22925. memory in the inferior.
  22926. 'gdb:pp-type-error'
  22927. This exception is thrown when a Guile pretty-printer passes a bad
  22928. object to GDB.
  22929. The following exception-related procedures are provided by the
  22930. '(gdb)' module.
  22931. -- Scheme Procedure: make-exception key args
  22932. Return a '<gdb:exception>' object given by its KEY and ARGS, which
  22933. are the standard Guile parameters of an exception. See the Guile
  22934. documentation for more information (*note (guile)Exceptions::).
  22935. -- Scheme Procedure: exception? object
  22936. Return '#t' if OBJECT is a '<gdb:exception>' object. Otherwise
  22937. return '#f'.
  22938. -- Scheme Procedure: exception-key exception
  22939. Return the ARGS field of a '<gdb:exception>' object.
  22940. -- Scheme Procedure: exception-args exception
  22941. Return the ARGS field of a '<gdb:exception>' object.
  22942. 
  22943. File: gdb.info, Node: Values From Inferior In Guile, Next: Arithmetic In Guile, Prev: Guile Exception Handling, Up: Guile API
  22944. 23.3.3.5 Values From Inferior In Guile
  22945. ......................................
  22946. GDB provides values it obtains from the inferior program in an object of
  22947. type '<gdb:value>'. GDB uses this object for its internal bookkeeping
  22948. of the inferior's values, and for fetching values when necessary.
  22949. GDB does not memoize '<gdb:value>' objects. 'make-value' always
  22950. returns a fresh object.
  22951. (gdb) guile (eq? (make-value 1) (make-value 1))
  22952. $1 = #f
  22953. (gdb) guile (equal? (make-value 1) (make-value 1))
  22954. $1 = #t
  22955. A '<gdb:value>' that represents a function can be executed via
  22956. inferior function call with 'value-call'. Any arguments provided to the
  22957. call must match the function's prototype, and must be provided in the
  22958. order specified by that prototype.
  22959. For example, 'some-val' is a '<gdb:value>' instance representing a
  22960. function that takes two integers as arguments. To execute this
  22961. function, call it like so:
  22962. (define result (value-call some-val 10 20))
  22963. Any values returned from a function call are '<gdb:value>' objects.
  22964. Note: Unlike Python scripting in GDB, inferior values that are simple
  22965. scalars cannot be used directly in Scheme expressions that are valid for
  22966. the value's data type. For example, '(+ (parse-and-eval "int_variable")
  22967. 2)' does not work. And inferior values that are structures or instances
  22968. of some class cannot be accessed using any special syntax, instead
  22969. 'value-field' must be used.
  22970. The following value-related procedures are provided by the '(gdb)'
  22971. module.
  22972. -- Scheme Procedure: value? object
  22973. Return '#t' if OBJECT is a '<gdb:value>' object. Otherwise return
  22974. '#f'.
  22975. -- Scheme Procedure: make-value value [#:type type]
  22976. Many Scheme values can be converted directly to a '<gdb:value>'
  22977. with this procedure. If TYPE is specified, the result is a value
  22978. of this type, and if VALUE can't be represented with this type an
  22979. exception is thrown. Otherwise the type of the result is
  22980. determined from VALUE as described below.
  22981. *Note Architectures In Guile::, for a list of the builtin types for
  22982. an architecture.
  22983. Here's how Scheme values are converted when TYPE argument to
  22984. 'make-value' is not specified:
  22985. Scheme boolean
  22986. A Scheme boolean is converted the boolean type for the current
  22987. language.
  22988. Scheme integer
  22989. A Scheme integer is converted to the first of a C 'int',
  22990. 'unsigned int', 'long', 'unsigned long', 'long long' or
  22991. 'unsigned long long' type for the current architecture that
  22992. can represent the value.
  22993. If the Scheme integer cannot be represented as a target
  22994. integer an 'out-of-range' exception is thrown.
  22995. Scheme real
  22996. A Scheme real is converted to the C 'double' type for the
  22997. current architecture.
  22998. Scheme string
  22999. A Scheme string is converted to a string in the current target
  23000. language using the current target encoding. Characters that
  23001. cannot be represented in the current target encoding are
  23002. replaced with the corresponding escape sequence. This is
  23003. Guile's 'SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE' conversion
  23004. strategy (*note (guile)Strings::).
  23005. Passing TYPE is not supported in this case, if it is provided
  23006. a 'wrong-type-arg' exception is thrown.
  23007. '<gdb:lazy-string>'
  23008. If VALUE is a '<gdb:lazy-string>' object (*note Lazy Strings
  23009. In Guile::), then the 'lazy-string->value' procedure is
  23010. called, and its result is used.
  23011. Passing TYPE is not supported in this case, if it is provided
  23012. a 'wrong-type-arg' exception is thrown.
  23013. Scheme bytevector
  23014. If VALUE is a Scheme bytevector and TYPE is provided, VALUE
  23015. must be the same size, in bytes, of values of type TYPE, and
  23016. the result is essentially created by using 'memcpy'.
  23017. If VALUE is a Scheme bytevector and TYPE is not provided, the
  23018. result is an array of type 'uint8' of the same length.
  23019. -- Scheme Procedure: value-optimized-out? value
  23020. Return '#t' if the compiler optimized out VALUE, thus it is not
  23021. available for fetching from the inferior. Otherwise return '#f'.
  23022. -- Scheme Procedure: value-address value
  23023. If VALUE is addressable, returns a '<gdb:value>' object
  23024. representing the address. Otherwise, '#f' is returned.
  23025. -- Scheme Procedure: value-type value
  23026. Return the type of VALUE as a '<gdb:type>' object (*note Types In
  23027. Guile::).
  23028. -- Scheme Procedure: value-dynamic-type value
  23029. Return the dynamic type of VALUE. This uses C++ run-time type
  23030. information (RTTI) to determine the dynamic type of the value. If
  23031. the value is of class type, it will return the class in which the
  23032. value is embedded, if any. If the value is of pointer or reference
  23033. to a class type, it will compute the dynamic type of the referenced
  23034. object, and return a pointer or reference to that type,
  23035. respectively. In all other cases, it will return the value's
  23036. static type.
  23037. Note that this feature will only work when debugging a C++ program
  23038. that includes RTTI for the object in question. Otherwise, it will
  23039. just return the static type of the value as in 'ptype foo'. *Note
  23040. ptype: Symbols.
  23041. -- Scheme Procedure: value-cast value type
  23042. Return a new instance of '<gdb:value>' that is the result of
  23043. casting VALUE to the type described by TYPE, which must be a
  23044. '<gdb:type>' object. If the cast cannot be performed for some
  23045. reason, this method throws an exception.
  23046. -- Scheme Procedure: value-dynamic-cast value type
  23047. Like 'value-cast', but works as if the C++ 'dynamic_cast' operator
  23048. were used. Consult a C++ reference for details.
  23049. -- Scheme Procedure: value-reinterpret-cast value type
  23050. Like 'value-cast', but works as if the C++ 'reinterpret_cast'
  23051. operator were used. Consult a C++ reference for details.
  23052. -- Scheme Procedure: value-dereference value
  23053. For pointer data types, this method returns a new '<gdb:value>'
  23054. object whose contents is the object pointed to by VALUE. For
  23055. example, if 'foo' is a C pointer to an 'int', declared in your C
  23056. program as
  23057. int *foo;
  23058. then you can use the corresponding '<gdb:value>' to access what
  23059. 'foo' points to like this:
  23060. (define bar (value-dereference foo))
  23061. The result 'bar' will be a '<gdb:value>' object holding the value
  23062. pointed to by 'foo'.
  23063. A similar function 'value-referenced-value' exists which also
  23064. returns '<gdb:value>' objects corresponding to the values pointed
  23065. to by pointer values (and additionally, values referenced by
  23066. reference values). However, the behavior of 'value-dereference'
  23067. differs from 'value-referenced-value' by the fact that the behavior
  23068. of 'value-dereference' is identical to applying the C unary
  23069. operator '*' on a given value. For example, consider a reference
  23070. to a pointer 'ptrref', declared in your C++ program as
  23071. typedef int *intptr;
  23072. ...
  23073. int val = 10;
  23074. intptr ptr = &val;
  23075. intptr &ptrref = ptr;
  23076. Though 'ptrref' is a reference value, one can apply the method
  23077. 'value-dereference' to the '<gdb:value>' object corresponding to it
  23078. and obtain a '<gdb:value>' which is identical to that corresponding
  23079. to 'val'. However, if you apply the method
  23080. 'value-referenced-value', the result would be a '<gdb:value>'
  23081. object identical to that corresponding to 'ptr'.
  23082. (define scm-ptrref (parse-and-eval "ptrref"))
  23083. (define scm-val (value-dereference scm-ptrref))
  23084. (define scm-ptr (value-referenced-value scm-ptrref))
  23085. The '<gdb:value>' object 'scm-val' is identical to that
  23086. corresponding to 'val', and 'scm-ptr' is identical to that
  23087. corresponding to 'ptr'. In general, 'value-dereference' can be
  23088. applied whenever the C unary operator '*' can be applied to the
  23089. corresponding C value. For those cases where applying both
  23090. 'value-dereference' and 'value-referenced-value' is allowed, the
  23091. results obtained need not be identical (as we have seen in the
  23092. above example). The results are however identical when applied on
  23093. '<gdb:value>' objects corresponding to pointers ('<gdb:value>'
  23094. objects with type code 'TYPE_CODE_PTR') in a C/C++ program.
  23095. -- Scheme Procedure: value-referenced-value value
  23096. For pointer or reference data types, this method returns a new
  23097. '<gdb:value>' object corresponding to the value referenced by the
  23098. pointer/reference value. For pointer data types,
  23099. 'value-dereference' and 'value-referenced-value' produce identical
  23100. results. The difference between these methods is that
  23101. 'value-dereference' cannot get the values referenced by reference
  23102. values. For example, consider a reference to an 'int', declared in
  23103. your C++ program as
  23104. int val = 10;
  23105. int &ref = val;
  23106. then applying 'value-dereference' to the '<gdb:value>' object
  23107. corresponding to 'ref' will result in an error, while applying
  23108. 'value-referenced-value' will result in a '<gdb:value>' object
  23109. identical to that corresponding to 'val'.
  23110. (define scm-ref (parse-and-eval "ref"))
  23111. (define err-ref (value-dereference scm-ref)) ;; error
  23112. (define scm-val (value-referenced-value scm-ref)) ;; ok
  23113. The '<gdb:value>' object 'scm-val' is identical to that
  23114. corresponding to 'val'.
  23115. -- Scheme Procedure: value-field value field-name
  23116. Return field FIELD-NAME from '<gdb:value>' object VALUE.
  23117. -- Scheme Procedure: value-subscript value index
  23118. Return the value of array VALUE at index INDEX. The VALUE argument
  23119. must be a subscriptable '<gdb:value>' object.
  23120. -- Scheme Procedure: value-call value arg-list
  23121. Perform an inferior function call, taking VALUE as a pointer to the
  23122. function to call. Each element of list ARG-LIST must be a
  23123. <gdb:value> object or an object that can be converted to a value.
  23124. The result is the value returned by the function.
  23125. -- Scheme Procedure: value->bool value
  23126. Return the Scheme boolean representing '<gdb:value>' VALUE. The
  23127. value must be "integer like". Pointers are ok.
  23128. -- Scheme Procedure: value->integer
  23129. Return the Scheme integer representing '<gdb:value>' VALUE. The
  23130. value must be "integer like". Pointers are ok.
  23131. -- Scheme Procedure: value->real
  23132. Return the Scheme real number representing '<gdb:value>' VALUE.
  23133. The value must be a number.
  23134. -- Scheme Procedure: value->bytevector
  23135. Return a Scheme bytevector with the raw contents of '<gdb:value>'
  23136. VALUE. No transformation, endian or otherwise, is performed.
  23137. -- Scheme Procedure: value->string value [#:encoding encoding]
  23138. [#:errors errors] [#:length length]
  23139. If VALUE> represents a string, then this method converts the
  23140. contents to a Guile string. Otherwise, this method will throw an
  23141. exception.
  23142. Values are interpreted as strings according to the rules of the
  23143. current language. If the optional length argument is given, the
  23144. string will be converted to that length, and will include any
  23145. embedded zeroes that the string may contain. Otherwise, for
  23146. languages where the string is zero-terminated, the entire string
  23147. will be converted.
  23148. For example, in C-like languages, a value is a string if it is a
  23149. pointer to or an array of characters or ints of type 'wchar_t',
  23150. 'char16_t', or 'char32_t'.
  23151. If the optional ENCODING argument is given, it must be a string
  23152. naming the encoding of the string in the '<gdb:value>', such as
  23153. '"ascii"', '"iso-8859-6"' or '"utf-8"'. It accepts the same
  23154. encodings as the corresponding argument to Guile's
  23155. 'scm_from_stringn' function, and the Guile codec machinery will be
  23156. used to convert the string. If ENCODING is not given, or if
  23157. ENCODING is the empty string, then either the 'target-charset'
  23158. (*note Character Sets::) will be used, or a language-specific
  23159. encoding will be used, if the current language is able to supply
  23160. one.
  23161. The optional ERRORS argument is one of '#f', 'error' or
  23162. 'substitute'. 'error' and 'substitute' must be symbols. If ERRORS
  23163. is not specified, or if its value is '#f', then the default
  23164. conversion strategy is used, which is set with the Scheme function
  23165. 'set-port-conversion-strategy!'. If the value is ''error' then an
  23166. exception is thrown if there is any conversion error. If the value
  23167. is ''substitute' then any conversion error is replaced with
  23168. question marks. *Note (guile)Strings::.
  23169. If the optional LENGTH argument is given, the string will be
  23170. fetched and converted to the given length. The length must be a
  23171. Scheme integer and not a '<gdb:value>' integer.
  23172. -- Scheme Procedure: value->lazy-string value [#:encoding encoding]
  23173. [#:length length]
  23174. If this '<gdb:value>' represents a string, then this method
  23175. converts VALUE to a '<gdb:lazy-string' (*note Lazy Strings In
  23176. Guile::). Otherwise, this method will throw an exception.
  23177. If the optional ENCODING argument is given, it must be a string
  23178. naming the encoding of the '<gdb:lazy-string'. Some examples are:
  23179. '"ascii"', '"iso-8859-6"' or '"utf-8"'. If the ENCODING argument
  23180. is an encoding that GDB does not recognize, GDB will raise an
  23181. error.
  23182. When a lazy string is printed, the GDB encoding machinery is used
  23183. to convert the string during printing. If the optional ENCODING
  23184. argument is not provided, or is an empty string, GDB will
  23185. automatically select the encoding most suitable for the string
  23186. type. For further information on encoding in GDB please see *note
  23187. Character Sets::.
  23188. If the optional LENGTH argument is given, the string will be
  23189. fetched and encoded to the length of characters specified. If the
  23190. LENGTH argument is not provided, the string will be fetched and
  23191. encoded until a null of appropriate width is found. The length
  23192. must be a Scheme integer and not a '<gdb:value>' integer.
  23193. -- Scheme Procedure: value-lazy? value
  23194. Return '#t' if VALUE has not yet been fetched from the inferior.
  23195. Otherwise return '#f'. GDB does not fetch values until necessary,
  23196. for efficiency. For example:
  23197. (define myval (parse-and-eval "somevar"))
  23198. The value of 'somevar' is not fetched at this time. It will be
  23199. fetched when the value is needed, or when the 'fetch-lazy'
  23200. procedure is invoked.
  23201. -- Scheme Procedure: make-lazy-value type address
  23202. Return a '<gdb:value>' that will be lazily fetched from the target.
  23203. The object of type '<gdb:type>' whose value to fetch is specified
  23204. by its TYPE and its target memory ADDRESS, which is a Scheme
  23205. integer.
  23206. -- Scheme Procedure: value-fetch-lazy! value
  23207. If VALUE is a lazy value ('(value-lazy? value)' is '#t'), then the
  23208. value is fetched from the inferior. Any errors that occur in the
  23209. process will produce a Guile exception.
  23210. If VALUE is not a lazy value, this method has no effect.
  23211. The result of this function is unspecified.
  23212. -- Scheme Procedure: value-print value
  23213. Return the string representation (print form) of '<gdb:value>'
  23214. VALUE.
  23215. 
  23216. File: gdb.info, Node: Arithmetic In Guile, Next: Types In Guile, Prev: Values From Inferior In Guile, Up: Guile API
  23217. 23.3.3.6 Arithmetic In Guile
  23218. ............................
  23219. The '(gdb)' module provides several functions for performing arithmetic
  23220. on '<gdb:value>' objects. The arithmetic is performed as if it were
  23221. done by the target, and therefore has target semantics which are not
  23222. necessarily those of Scheme. For example operations work with a fixed
  23223. precision, not the arbitrary precision of Scheme.
  23224. Wherever a function takes an integer or pointer as an operand, GDB
  23225. will convert appropriate Scheme values to perform the operation.
  23226. -- Scheme Procedure: value-add a b
  23227. -- Scheme Procedure: value-sub a b
  23228. -- Scheme Procedure: value-mul a b
  23229. -- Scheme Procedure: value-div a b
  23230. -- Scheme Procedure: value-rem a b
  23231. -- Scheme Procedure: value-mod a b
  23232. -- Scheme Procedure: value-pow a b
  23233. -- Scheme Procedure: value-not a
  23234. -- Scheme Procedure: value-neg a
  23235. -- Scheme Procedure: value-pos a
  23236. -- Scheme Procedure: value-abs a
  23237. -- Scheme Procedure: value-lsh a b
  23238. -- Scheme Procedure: value-rsh a b
  23239. -- Scheme Procedure: value-min a b
  23240. -- Scheme Procedure: value-max a b
  23241. -- Scheme Procedure: value-lognot a
  23242. -- Scheme Procedure: value-logand a b
  23243. -- Scheme Procedure: value-logior a b
  23244. -- Scheme Procedure: value-logxor a b
  23245. -- Scheme Procedure: value=? a b
  23246. -- Scheme Procedure: value<? a b
  23247. -- Scheme Procedure: value<=? a b
  23248. -- Scheme Procedure: value>? a b
  23249. -- Scheme Procedure: value>=? a b
  23250. Scheme does not provide a 'not-equal' function, and thus Guile
  23251. support in GDB does not either.
  23252. 
  23253. File: gdb.info, Node: Types In Guile, Next: Guile Pretty Printing API, Prev: Arithmetic In Guile, Up: Guile API
  23254. 23.3.3.7 Types In Guile
  23255. .......................
  23256. GDB represents types from the inferior in objects of type '<gdb:type>'.
  23257. The following type-related procedures are provided by the '(gdb)'
  23258. module.
  23259. -- Scheme Procedure: type? object
  23260. Return '#t' if OBJECT is an object of type '<gdb:type>'. Otherwise
  23261. return '#f'.
  23262. -- Scheme Procedure: lookup-type name [#:block block]
  23263. This function looks up a type by its NAME, which must be a string.
  23264. If BLOCK is given, it is an object of type '<gdb:block>', and NAME
  23265. is looked up in that scope. Otherwise, it is searched for
  23266. globally.
  23267. Ordinarily, this function will return an instance of '<gdb:type>'.
  23268. If the named type cannot be found, it will throw an exception.
  23269. -- Scheme Procedure: type-code type
  23270. Return the type code of TYPE. The type code will be one of the
  23271. 'TYPE_CODE_' constants defined below.
  23272. -- Scheme Procedure: type-tag type
  23273. Return the tag name of TYPE. The tag name is the name after
  23274. 'struct', 'union', or 'enum' in C and C++; not all languages have
  23275. this concept. If this type has no tag name, then '#f' is returned.
  23276. -- Scheme Procedure: type-name type
  23277. Return the name of TYPE. If this type has no name, then '#f' is
  23278. returned.
  23279. -- Scheme Procedure: type-print-name type
  23280. Return the print name of TYPE. This returns something even for
  23281. anonymous types. For example, for an anonymous C struct '"struct
  23282. {...}"' is returned.
  23283. -- Scheme Procedure: type-sizeof type
  23284. Return the size of this type, in target 'char' units. Usually, a
  23285. target's 'char' type will be an 8-bit byte. However, on some
  23286. unusual platforms, this type may have a different size.
  23287. -- Scheme Procedure: type-strip-typedefs type
  23288. Return a new '<gdb:type>' that represents the real type of TYPE,
  23289. after removing all layers of typedefs.
  23290. -- Scheme Procedure: type-array type n1 [n2]
  23291. Return a new '<gdb:type>' object which represents an array of this
  23292. type. If one argument is given, it is the inclusive upper bound of
  23293. the array; in this case the lower bound is zero. If two arguments
  23294. are given, the first argument is the lower bound of the array, and
  23295. the second argument is the upper bound of the array. An array's
  23296. length must not be negative, but the bounds can be.
  23297. -- Scheme Procedure: type-vector type n1 [n2]
  23298. Return a new '<gdb:type>' object which represents a vector of this
  23299. type. If one argument is given, it is the inclusive upper bound of
  23300. the vector; in this case the lower bound is zero. If two arguments
  23301. are given, the first argument is the lower bound of the vector, and
  23302. the second argument is the upper bound of the vector. A vector's
  23303. length must not be negative, but the bounds can be.
  23304. The difference between an 'array' and a 'vector' is that arrays
  23305. behave like in C: when used in expressions they decay to a pointer
  23306. to the first element whereas vectors are treated as first class
  23307. values.
  23308. -- Scheme Procedure: type-pointer type
  23309. Return a new '<gdb:type>' object which represents a pointer to
  23310. TYPE.
  23311. -- Scheme Procedure: type-range type
  23312. Return a list of two elements: the low bound and high bound of
  23313. TYPE. If TYPE does not have a range, an exception is thrown.
  23314. -- Scheme Procedure: type-reference type
  23315. Return a new '<gdb:type>' object which represents a reference to
  23316. TYPE.
  23317. -- Scheme Procedure: type-target type
  23318. Return a new '<gdb:type>' object which represents the target type
  23319. of TYPE.
  23320. For a pointer type, the target type is the type of the pointed-to
  23321. object. For an array type (meaning C-like arrays), the target type
  23322. is the type of the elements of the array. For a function or method
  23323. type, the target type is the type of the return value. For a
  23324. complex type, the target type is the type of the elements. For a
  23325. typedef, the target type is the aliased type.
  23326. If the type does not have a target, this method will throw an
  23327. exception.
  23328. -- Scheme Procedure: type-const type
  23329. Return a new '<gdb:type>' object which represents a
  23330. 'const'-qualified variant of TYPE.
  23331. -- Scheme Procedure: type-volatile type
  23332. Return a new '<gdb:type>' object which represents a
  23333. 'volatile'-qualified variant of TYPE.
  23334. -- Scheme Procedure: type-unqualified type
  23335. Return a new '<gdb:type>' object which represents an unqualified
  23336. variant of TYPE. That is, the result is neither 'const' nor
  23337. 'volatile'.
  23338. -- Scheme Procedure: type-num-fields
  23339. Return the number of fields of '<gdb:type>' TYPE.
  23340. -- Scheme Procedure: type-fields type
  23341. Return the fields of TYPE as a list. For structure and union
  23342. types, 'fields' has the usual meaning. Range types have two
  23343. fields, the minimum and maximum values. Enum types have one field
  23344. per enum constant. Function and method types have one field per
  23345. parameter. The base types of C++ classes are also represented as
  23346. fields. If the type has no fields, or does not fit into one of
  23347. these categories, an empty list will be returned. *Note Fields of
  23348. a type in Guile::.
  23349. -- Scheme Procedure: make-field-iterator type
  23350. Return the fields of TYPE as a <gdb:iterator> object. *Note
  23351. Iterators In Guile::.
  23352. -- Scheme Procedure: type-field type field-name
  23353. Return field named FIELD-NAME in TYPE. The result is an object of
  23354. type '<gdb:field>'. *Note Fields of a type in Guile::. If the
  23355. type does not have fields, or FIELD-NAME is not a field of TYPE, an
  23356. exception is thrown.
  23357. For example, if 'some-type' is a '<gdb:type>' instance holding a
  23358. structure type, you can access its 'foo' field with:
  23359. (define bar (type-field some-type "foo"))
  23360. 'bar' will be a '<gdb:field>' object.
  23361. -- Scheme Procedure: type-has-field? type name
  23362. Return '#t' if '<gdb:type>' TYPE has field named NAME. Otherwise
  23363. return '#f'.
  23364. Each type has a code, which indicates what category this type falls
  23365. into. The available type categories are represented by constants
  23366. defined in the '(gdb)' module:
  23367. 'TYPE_CODE_PTR'
  23368. The type is a pointer.
  23369. 'TYPE_CODE_ARRAY'
  23370. The type is an array.
  23371. 'TYPE_CODE_STRUCT'
  23372. The type is a structure.
  23373. 'TYPE_CODE_UNION'
  23374. The type is a union.
  23375. 'TYPE_CODE_ENUM'
  23376. The type is an enum.
  23377. 'TYPE_CODE_FLAGS'
  23378. A bit flags type, used for things such as status registers.
  23379. 'TYPE_CODE_FUNC'
  23380. The type is a function.
  23381. 'TYPE_CODE_INT'
  23382. The type is an integer type.
  23383. 'TYPE_CODE_FLT'
  23384. A floating point type.
  23385. 'TYPE_CODE_VOID'
  23386. The special type 'void'.
  23387. 'TYPE_CODE_SET'
  23388. A Pascal set type.
  23389. 'TYPE_CODE_RANGE'
  23390. A range type, that is, an integer type with bounds.
  23391. 'TYPE_CODE_STRING'
  23392. A string type. Note that this is only used for certain languages
  23393. with language-defined string types; C strings are not represented
  23394. this way.
  23395. 'TYPE_CODE_BITSTRING'
  23396. A string of bits. It is deprecated.
  23397. 'TYPE_CODE_ERROR'
  23398. An unknown or erroneous type.
  23399. 'TYPE_CODE_METHOD'
  23400. A method type, as found in C++.
  23401. 'TYPE_CODE_METHODPTR'
  23402. A pointer-to-member-function.
  23403. 'TYPE_CODE_MEMBERPTR'
  23404. A pointer-to-member.
  23405. 'TYPE_CODE_REF'
  23406. A reference type.
  23407. 'TYPE_CODE_CHAR'
  23408. A character type.
  23409. 'TYPE_CODE_BOOL'
  23410. A boolean type.
  23411. 'TYPE_CODE_COMPLEX'
  23412. A complex float type.
  23413. 'TYPE_CODE_TYPEDEF'
  23414. A typedef to some other type.
  23415. 'TYPE_CODE_NAMESPACE'
  23416. A C++ namespace.
  23417. 'TYPE_CODE_DECFLOAT'
  23418. A decimal floating point type.
  23419. 'TYPE_CODE_INTERNAL_FUNCTION'
  23420. A function internal to GDB. This is the type used to represent
  23421. convenience functions (*note Convenience Funs::).
  23422. Further support for types is provided in the '(gdb types)' Guile
  23423. module (*note Guile Types Module::).
  23424. Each field is represented as an object of type '<gdb:field>'.
  23425. The following field-related procedures are provided by the '(gdb)'
  23426. module:
  23427. -- Scheme Procedure: field? object
  23428. Return '#t' if OBJECT is an object of type '<gdb:field>'.
  23429. Otherwise return '#f'.
  23430. -- Scheme Procedure: field-name field
  23431. Return the name of the field, or '#f' for anonymous fields.
  23432. -- Scheme Procedure: field-type field
  23433. Return the type of the field. This is usually an instance of
  23434. '<gdb:type>', but it can be '#f' in some situations.
  23435. -- Scheme Procedure: field-enumval field
  23436. Return the enum value represented by '<gdb:field>' FIELD.
  23437. -- Scheme Procedure: field-bitpos field
  23438. Return the bit position of '<gdb:field>' FIELD. This attribute is
  23439. not available for 'static' fields (as in C++).
  23440. -- Scheme Procedure: field-bitsize field
  23441. If the field is packed, or is a bitfield, return the size of
  23442. '<gdb:field>' FIELD in bits. Otherwise, zero is returned; in which
  23443. case the field's size is given by its type.
  23444. -- Scheme Procedure: field-artificial? field
  23445. Return '#t' if the field is artificial, usually meaning that it was
  23446. provided by the compiler and not the user. Otherwise return '#f'.
  23447. -- Scheme Procedure: field-base-class? field
  23448. Return '#t' if the field represents a base class of a C++
  23449. structure. Otherwise return '#f'.
  23450. 
  23451. File: gdb.info, Node: Guile Pretty Printing API, Next: Selecting Guile Pretty-Printers, Prev: Types In Guile, Up: Guile API
  23452. 23.3.3.8 Guile Pretty Printing API
  23453. ..................................
  23454. An example output is provided (*note Pretty Printing::).
  23455. A pretty-printer is represented by an object of type
  23456. <gdb:pretty-printer>. Pretty-printer objects are created with
  23457. 'make-pretty-printer'.
  23458. The following pretty-printer-related procedures are provided by the
  23459. '(gdb)' module:
  23460. -- Scheme Procedure: make-pretty-printer name lookup-function
  23461. Return a '<gdb:pretty-printer>' object named NAME.
  23462. LOOKUP-FUNCTION is a function of one parameter: the value to be
  23463. printed. If the value is handled by this pretty-printer, then
  23464. LOOKUP-FUNCTION returns an object of type
  23465. <gdb:pretty-printer-worker> to perform the actual pretty-printing.
  23466. Otherwise LOOKUP-FUNCTION returns '#f'.
  23467. -- Scheme Procedure: pretty-printer? object
  23468. Return '#t' if OBJECT is a '<gdb:pretty-printer>' object.
  23469. Otherwise return '#f'.
  23470. -- Scheme Procedure: pretty-printer-enabled? pretty-printer
  23471. Return '#t' if PRETTY-PRINTER is enabled. Otherwise return '#f'.
  23472. -- Scheme Procedure: set-pretty-printer-enabled! pretty-printer flag
  23473. Set the enabled flag of PRETTY-PRINTER to FLAG. The value returned
  23474. is unspecified.
  23475. -- Scheme Procedure: pretty-printers
  23476. Return the list of global pretty-printers.
  23477. -- Scheme Procedure: set-pretty-printers! pretty-printers
  23478. Set the list of global pretty-printers to PRETTY-PRINTERS. The
  23479. value returned is unspecified.
  23480. -- Scheme Procedure: make-pretty-printer-worker display-hint to-string
  23481. children
  23482. Return an object of type '<gdb:pretty-printer-worker>'.
  23483. This function takes three parameters:
  23484. 'display-hint'
  23485. DISPLAY-HINT provides a hint to GDB or GDB front end via MI to
  23486. change the formatting of the value being printed. The value
  23487. must be a string or '#f' (meaning there is no hint). Several
  23488. values for DISPLAY-HINT are predefined by GDB:
  23489. 'array'
  23490. Indicate that the object being printed is "array-like".
  23491. The CLI uses this to respect parameters such as 'set
  23492. print elements' and 'set print array'.
  23493. 'map'
  23494. Indicate that the object being printed is "map-like", and
  23495. that the children of this value can be assumed to
  23496. alternate between keys and values.
  23497. 'string'
  23498. Indicate that the object being printed is "string-like".
  23499. If the printer's 'to-string' function returns a Guile
  23500. string of some kind, then GDB will call its internal
  23501. language-specific string-printing function to format the
  23502. string. For the CLI this means adding quotation marks,
  23503. possibly escaping some characters, respecting 'set print
  23504. elements', and the like.
  23505. 'to-string'
  23506. TO-STRING is either a function of one parameter, the
  23507. '<gdb:pretty-printer-worker>' object, or '#f'.
  23508. When printing from the CLI, if the 'to-string' method exists,
  23509. then GDB will prepend its result to the values returned by
  23510. 'children'. Exactly how this formatting is done is dependent
  23511. on the display hint, and may change as more hints are added.
  23512. Also, depending on the print settings (*note Print
  23513. Settings::), the CLI may print just the result of 'to-string'
  23514. in a stack trace, omitting the result of 'children'.
  23515. If this method returns a string, it is printed verbatim.
  23516. Otherwise, if this method returns an instance of
  23517. '<gdb:value>', then GDB prints this value. This may result in
  23518. a call to another pretty-printer.
  23519. If instead the method returns a Guile value which is
  23520. convertible to a '<gdb:value>', then GDB performs the
  23521. conversion and prints the resulting value. Again, this may
  23522. result in a call to another pretty-printer. Guile scalars
  23523. (integers, floats, and booleans) and strings are convertible
  23524. to '<gdb:value>'; other types are not.
  23525. Finally, if this method returns '#f' then no further
  23526. operations are peformed in this method and nothing is printed.
  23527. If the result is not one of these types, an exception is
  23528. raised.
  23529. TO-STRING may also be '#f' in which case it is left to
  23530. CHILDREN to print the value.
  23531. 'children'
  23532. CHILDREN is either a function of one parameter, the
  23533. '<gdb:pretty-printer-worker>' object, or '#f'.
  23534. GDB will call this function on a pretty-printer to compute the
  23535. children of the pretty-printer's value.
  23536. This function must return a <gdb:iterator> object. Each item
  23537. returned by the iterator must be a tuple holding two elements.
  23538. The first element is the "name" of the child; the second
  23539. element is the child's value. The value can be any Guile
  23540. object which is convertible to a GDB value.
  23541. If CHILDREN is '#f', GDB will act as though the value has no
  23542. children.
  23543. Children may be hidden from display based on the value of 'set
  23544. print max-depth' (*note Print Settings::).
  23545. GDB provides a function which can be used to look up the default
  23546. pretty-printer for a '<gdb:value>':
  23547. -- Scheme Procedure: default-visualizer value
  23548. This function takes a '<gdb:value>' object as an argument. If a
  23549. pretty-printer for this value exists, then it is returned. If no
  23550. such printer exists, then this returns '#f'.
  23551. 
  23552. File: gdb.info, Node: Selecting Guile Pretty-Printers, Next: Writing a Guile Pretty-Printer, Prev: Guile Pretty Printing API, Up: Guile API
  23553. 23.3.3.9 Selecting Guile Pretty-Printers
  23554. ........................................
  23555. There are three sets of pretty-printers that GDB searches:
  23556. * Per-objfile list of pretty-printers (*note Objfiles In Guile::).
  23557. * Per-progspace list of pretty-printers (*note Progspaces In
  23558. Guile::).
  23559. * The global list of pretty-printers (*note Guile Pretty Printing
  23560. API::). These printers are available when debugging any inferior.
  23561. Pretty-printer lookup is done by passing the value to be printed to
  23562. the lookup function of each enabled object in turn. Lookup stops when a
  23563. lookup function returns a non-'#f' value or when the list is exhausted.
  23564. Lookup functions must return either a '<gdb:pretty-printer-worker>'
  23565. object or '#f'. Otherwise an exception is thrown.
  23566. GDB first checks the result of 'objfile-pretty-printers' of each
  23567. '<gdb:objfile>' in the current program space and iteratively calls each
  23568. enabled lookup function in the list for that '<gdb:objfile>' until a
  23569. non-'#f' object is returned. If no pretty-printer is found in the
  23570. objfile lists, GDB then searches the result of
  23571. 'progspace-pretty-printers' of the current program space, calling each
  23572. enabled function until a non-'#f' object is returned. After these lists
  23573. have been exhausted, it tries the global pretty-printers list, obtained
  23574. with 'pretty-printers', again calling each enabled function until a
  23575. non-'#f' object is returned.
  23576. The order in which the objfiles are searched is not specified. For a
  23577. given list, functions are always invoked from the head of the list, and
  23578. iterated over sequentially until the end of the list, or a
  23579. '<gdb:pretty-printer-worker>' object is returned.
  23580. For various reasons a pretty-printer may not work. For example, the
  23581. underlying data structure may have changed and the pretty-printer is out
  23582. of date.
  23583. The consequences of a broken pretty-printer are severe enough that
  23584. GDB provides support for enabling and disabling individual printers.
  23585. For example, if 'print frame-arguments' is on, a backtrace can become
  23586. highly illegible if any argument is printed with a broken printer.
  23587. Pretty-printers are enabled and disabled from Scheme by calling
  23588. 'set-pretty-printer-enabled!'. *Note Guile Pretty Printing API::.
  23589. 
  23590. File: gdb.info, Node: Writing a Guile Pretty-Printer, Next: Commands In Guile, Prev: Selecting Guile Pretty-Printers, Up: Guile API
  23591. 23.3.3.10 Writing a Guile Pretty-Printer
  23592. ........................................
  23593. A pretty-printer consists of two basic parts: a lookup function to
  23594. determine if the type is supported, and the printer itself.
  23595. Here is an example showing how a 'std::string' printer might be
  23596. written. *Note Guile Pretty Printing API::, for details.
  23597. (define (make-my-string-printer value)
  23598. "Print a my::string string"
  23599. (make-pretty-printer-worker
  23600. "string"
  23601. (lambda (printer)
  23602. (value-field value "_data"))
  23603. #f))
  23604. And here is an example showing how a lookup function for the printer
  23605. example above might be written.
  23606. (define (str-lookup-function pretty-printer value)
  23607. (let ((tag (type-tag (value-type value))))
  23608. (and tag
  23609. (string-prefix? "std::string<" tag)
  23610. (make-my-string-printer value))))
  23611. Then to register this printer in the global printer list:
  23612. (append-pretty-printer!
  23613. (make-pretty-printer "my-string" str-lookup-function))
  23614. The example lookup function extracts the value's type, and attempts
  23615. to match it to a type that it can pretty-print. If it is a type the
  23616. printer can pretty-print, it will return a <gdb:pretty-printer-worker>
  23617. object. If not, it returns '#f'.
  23618. We recommend that you put your core pretty-printers into a Guile
  23619. package. If your pretty-printers are for use with a library, we further
  23620. recommend embedding a version number into the package name. This
  23621. practice will enable GDB to load multiple versions of your
  23622. pretty-printers at the same time, because they will have different
  23623. names.
  23624. You should write auto-loaded code (*note Guile Auto-loading::) such
  23625. that it can be evaluated multiple times without changing its meaning.
  23626. An ideal auto-load file will consist solely of 'import's of your printer
  23627. modules, followed by a call to a register pretty-printers with the
  23628. current objfile.
  23629. Taken as a whole, this approach will scale nicely to multiple
  23630. inferiors, each potentially using a different library version.
  23631. Embedding a version number in the Guile package name will ensure that
  23632. GDB is able to load both sets of printers simultaneously. Then, because
  23633. the search for pretty-printers is done by objfile, and because your
  23634. auto-loaded code took care to register your library's printers with a
  23635. specific objfile, GDB will find the correct printers for the specific
  23636. version of the library used by each inferior.
  23637. To continue the 'my::string' example, this code might appear in
  23638. '(my-project my-library v1)':
  23639. (use-modules (gdb))
  23640. (define (register-printers objfile)
  23641. (append-objfile-pretty-printer!
  23642. (make-pretty-printer "my-string" str-lookup-function)))
  23643. And then the corresponding contents of the auto-load file would be:
  23644. (use-modules (gdb) (my-project my-library v1))
  23645. (register-printers (current-objfile))
  23646. The previous example illustrates a basic pretty-printer. There are a
  23647. few things that can be improved on. The printer only handles one type,
  23648. whereas a library typically has several types. One could install a
  23649. lookup function for each desired type in the library, but one could also
  23650. have a single lookup function recognize several types. The latter is
  23651. the conventional way this is handled. If a pretty-printer can handle
  23652. multiple data types, then its "subprinters" are the printers for the
  23653. individual data types.
  23654. The '(gdb printing)' module provides a formal way of solving this
  23655. problem (*note Guile Printing Module::). Here is another example that
  23656. handles multiple types.
  23657. These are the types we are going to pretty-print:
  23658. struct foo { int a, b; };
  23659. struct bar { struct foo x, y; };
  23660. Here are the printers:
  23661. (define (make-foo-printer value)
  23662. "Print a foo object"
  23663. (make-pretty-printer-worker
  23664. "foo"
  23665. (lambda (printer)
  23666. (format #f "a=<~a> b=<~a>"
  23667. (value-field value "a") (value-field value "a")))
  23668. #f))
  23669. (define (make-bar-printer value)
  23670. "Print a bar object"
  23671. (make-pretty-printer-worker
  23672. "foo"
  23673. (lambda (printer)
  23674. (format #f "x=<~a> y=<~a>"
  23675. (value-field value "x") (value-field value "y")))
  23676. #f))
  23677. This example doesn't need a lookup function, that is handled by the
  23678. '(gdb printing)' module. Instead a function is provided to build up the
  23679. object that handles the lookup.
  23680. (use-modules (gdb printing))
  23681. (define (build-pretty-printer)
  23682. (let ((pp (make-pretty-printer-collection "my-library")))
  23683. (pp-collection-add-tag-printer "foo" make-foo-printer)
  23684. (pp-collection-add-tag-printer "bar" make-bar-printer)
  23685. pp))
  23686. And here is the autoload support:
  23687. (use-modules (gdb) (my-library))
  23688. (append-objfile-pretty-printer! (current-objfile) (build-pretty-printer))
  23689. Finally, when this printer is loaded into GDB, here is the
  23690. corresponding output of 'info pretty-printer':
  23691. (gdb) info pretty-printer
  23692. my_library.so:
  23693. my-library
  23694. foo
  23695. bar
  23696. 
  23697. File: gdb.info, Node: Commands In Guile, Next: Parameters In Guile, Prev: Writing a Guile Pretty-Printer, Up: Guile API
  23698. 23.3.3.11 Commands In Guile
  23699. ...........................
  23700. You can implement new GDB CLI commands in Guile. A CLI command object
  23701. is created with the 'make-command' Guile function, and added to GDB with
  23702. the 'register-command!' Guile function. This two-step approach is taken
  23703. to separate out the side-effect of adding the command to GDB from
  23704. 'make-command'.
  23705. There is no support for multi-line commands, that is commands that
  23706. consist of multiple lines and are terminated with 'end'.
  23707. -- Scheme Procedure: (make-command name [#:invoke invoke]
  23708. [#:command-class command-class] [#:completer-class completer]
  23709. [#:prefix? prefix] [#:doc doc-string])
  23710. The argument NAME is the name of the command. If NAME consists of
  23711. multiple words, then the initial words are looked for as prefix
  23712. commands. In this case, if one of the prefix commands does not
  23713. exist, an exception is raised.
  23714. The result is the '<gdb:command>' object representing the command.
  23715. The command is not usable until it has been registered with GDB
  23716. with 'register-command!'.
  23717. The rest of the arguments are optional.
  23718. The argument INVOKE is a procedure of three arguments: SELF, ARGS
  23719. and FROM-TTY. The argument SELF is the '<gdb:command>' object
  23720. representing the command. The argument ARGS is a string
  23721. representing the arguments passed to the command, after leading and
  23722. trailing whitespace has been stripped. The argument FROM-TTY is a
  23723. boolean flag and specifies whether the command should consider
  23724. itself to have been originated from the user invoking it
  23725. interactively. If this function throws an exception, it is turned
  23726. into a GDB 'error' call. Otherwise, the return value is ignored.
  23727. The argument COMMAND-CLASS is one of the 'COMMAND_' constants
  23728. defined below. This argument tells GDB how to categorize the new
  23729. command in the help system. The default is 'COMMAND_NONE'.
  23730. The argument COMPLETER is either '#f', one of the 'COMPLETE_'
  23731. constants defined below, or a procedure, also defined below. This
  23732. argument tells GDB how to perform completion for this command. If
  23733. not provided or if the value is '#f', then no completion is
  23734. performed on the command.
  23735. The argument PREFIX is a boolean flag indicating whether the new
  23736. command is a prefix command; sub-commands of this command may be
  23737. registered.
  23738. The argument DOC-STRING is help text for the new command. If no
  23739. documentation string is provided, the default value "This command
  23740. is not documented." is used.
  23741. -- Scheme Procedure: register-command! command
  23742. Add COMMAND, a '<gdb:command>' object, to GDB's list of commands.
  23743. It is an error to register a command more than once. The result is
  23744. unspecified.
  23745. -- Scheme Procedure: command? object
  23746. Return '#t' if OBJECT is a '<gdb:command>' object. Otherwise
  23747. return '#f'.
  23748. -- Scheme Procedure: dont-repeat
  23749. By default, a GDB command is repeated when the user enters a blank
  23750. line at the command prompt. A command can suppress this behavior
  23751. by invoking the 'dont-repeat' function. This is similar to the
  23752. user command 'dont-repeat', see *note dont-repeat: Define.
  23753. -- Scheme Procedure: string->argv string
  23754. Convert a string to a list of strings split up according to GDB's
  23755. argv parsing rules. It is recommended to use this for consistency.
  23756. Arguments are separated by spaces and may be quoted. Example:
  23757. scheme@(guile-user)> (string->argv "1 2\\ \\\"3 '4 \"5' \"6 '7\"")
  23758. $1 = ("1" "2 \"3" "4 \"5" "6 '7")
  23759. -- Scheme Procedure: throw-user-error message . args
  23760. Throw a 'gdb:user-error' exception. The argument MESSAGE is the
  23761. error message as a format string, like the FMT argument to the
  23762. 'format' Scheme function. *Note (guile)Formatted Output::. The
  23763. argument ARGS is a list of the optional arguments of MESSAGE.
  23764. This is used when the command detects a user error of some kind,
  23765. say a bad command argument.
  23766. (gdb) guile (use-modules (gdb))
  23767. (gdb) guile
  23768. (register-command! (make-command "test-user-error"
  23769. #:command-class COMMAND_OBSCURE
  23770. #:invoke (lambda (self arg from-tty)
  23771. (throw-user-error "Bad argument ~a" arg))))
  23772. end
  23773. (gdb) test-user-error ugh
  23774. ERROR: Bad argument ugh
  23775. -- completer: self text word
  23776. If the COMPLETER option to 'make-command' is a procedure, it takes
  23777. three arguments: SELF which is the '<gdb:command>' object, and TEXT
  23778. and WORD which are both strings. The argument TEXT holds the
  23779. complete command line up to the cursor's location. The argument
  23780. WORD holds the last word of the command line; this is computed
  23781. using a word-breaking heuristic.
  23782. All forms of completion are handled by this function, that is, the
  23783. <TAB> and <M-?> key bindings (*note Completion::), and the
  23784. 'complete' command (*note complete: Help.).
  23785. This procedure can return several kinds of values:
  23786. * If the return value is a list, the contents of the list are
  23787. used as the completions. It is up to COMPLETER to ensure that
  23788. the contents actually do complete the word. An empty list is
  23789. allowed, it means that there were no completions available.
  23790. Only string elements of the list are used; other elements in
  23791. the list are ignored.
  23792. * If the return value is a '<gdb:iterator>' object, it is
  23793. iterated over to obtain the completions. It is up to
  23794. 'completer-procedure' to ensure that the results actually do
  23795. complete the word. Only string elements of the result are
  23796. used; other elements in the sequence are ignored.
  23797. * All other results are treated as though there were no
  23798. available completions.
  23799. When a new command is registered, it will have been declared as a
  23800. member of some general class of commands. This is used to classify
  23801. top-level commands in the on-line help system; note that prefix commands
  23802. are not listed under their own category but rather that of their
  23803. top-level command. The available classifications are represented by
  23804. constants defined in the 'gdb' module:
  23805. 'COMMAND_NONE'
  23806. The command does not belong to any particular class. A command in
  23807. this category will not be displayed in any of the help categories.
  23808. This is the default.
  23809. 'COMMAND_RUNNING'
  23810. The command is related to running the inferior. For example,
  23811. 'start', 'step', and 'continue' are in this category. Type 'help
  23812. running' at the GDB prompt to see a list of commands in this
  23813. category.
  23814. 'COMMAND_DATA'
  23815. The command is related to data or variables. For example, 'call',
  23816. 'find', and 'print' are in this category. Type 'help data' at the
  23817. GDB prompt to see a list of commands in this category.
  23818. 'COMMAND_STACK'
  23819. The command has to do with manipulation of the stack. For example,
  23820. 'backtrace', 'frame', and 'return' are in this category. Type
  23821. 'help stack' at the GDB prompt to see a list of commands in this
  23822. category.
  23823. 'COMMAND_FILES'
  23824. This class is used for file-related commands. For example, 'file',
  23825. 'list' and 'section' are in this category. Type 'help files' at
  23826. the GDB prompt to see a list of commands in this category.
  23827. 'COMMAND_SUPPORT'
  23828. This should be used for "support facilities", generally meaning
  23829. things that are useful to the user when interacting with GDB, but
  23830. not related to the state of the inferior. For example, 'help',
  23831. 'make', and 'shell' are in this category. Type 'help support' at
  23832. the GDB prompt to see a list of commands in this category.
  23833. 'COMMAND_STATUS'
  23834. The command is an 'info'-related command, that is, related to the
  23835. state of GDB itself. For example, 'info', 'macro', and 'show' are
  23836. in this category. Type 'help status' at the GDB prompt to see a
  23837. list of commands in this category.
  23838. 'COMMAND_BREAKPOINTS'
  23839. The command has to do with breakpoints. For example, 'break',
  23840. 'clear', and 'delete' are in this category. Type 'help
  23841. breakpoints' at the GDB prompt to see a list of commands in this
  23842. category.
  23843. 'COMMAND_TRACEPOINTS'
  23844. The command has to do with tracepoints. For example, 'trace',
  23845. 'actions', and 'tfind' are in this category. Type 'help
  23846. tracepoints' at the GDB prompt to see a list of commands in this
  23847. category.
  23848. 'COMMAND_USER'
  23849. The command is a general purpose command for the user, and
  23850. typically does not fit in one of the other categories. Type 'help
  23851. user-defined' at the GDB prompt to see a list of commands in this
  23852. category, as well as the list of gdb macros (*note Sequences::).
  23853. 'COMMAND_OBSCURE'
  23854. The command is only used in unusual circumstances, or is not of
  23855. general interest to users. For example, 'checkpoint', 'fork', and
  23856. 'stop' are in this category. Type 'help obscure' at the GDB prompt
  23857. to see a list of commands in this category.
  23858. 'COMMAND_MAINTENANCE'
  23859. The command is only useful to GDB maintainers. The 'maintenance'
  23860. and 'flushregs' commands are in this category. Type 'help
  23861. internals' at the GDB prompt to see a list of commands in this
  23862. category.
  23863. A new command can use a predefined completion function, either by
  23864. specifying it via an argument at initialization, or by returning it from
  23865. the 'completer' procedure. These predefined completion constants are
  23866. all defined in the 'gdb' module:
  23867. 'COMPLETE_NONE'
  23868. This constant means that no completion should be done.
  23869. 'COMPLETE_FILENAME'
  23870. This constant means that filename completion should be performed.
  23871. 'COMPLETE_LOCATION'
  23872. This constant means that location completion should be done. *Note
  23873. Specify Location::.
  23874. 'COMPLETE_COMMAND'
  23875. This constant means that completion should examine GDB command
  23876. names.
  23877. 'COMPLETE_SYMBOL'
  23878. This constant means that completion should be done using symbol
  23879. names as the source.
  23880. 'COMPLETE_EXPRESSION'
  23881. This constant means that completion should be done on expressions.
  23882. Often this means completing on symbol names, but some language
  23883. parsers also have support for completing on field names.
  23884. The following code snippet shows how a trivial CLI command can be
  23885. implemented in Guile:
  23886. (gdb) guile
  23887. (register-command! (make-command "hello-world"
  23888. #:command-class COMMAND_USER
  23889. #:doc "Greet the whole world."
  23890. #:invoke (lambda (self args from-tty) (display "Hello, World!\n"))))
  23891. end
  23892. (gdb) hello-world
  23893. Hello, World!
  23894. 
  23895. File: gdb.info, Node: Parameters In Guile, Next: Progspaces In Guile, Prev: Commands In Guile, Up: Guile API
  23896. 23.3.3.12 Parameters In Guile
  23897. .............................
  23898. You can implement new GDB "parameters" using Guile (1).
  23899. There are many parameters that already exist and can be set in GDB.
  23900. Two examples are: 'set follow-fork' and 'set charset'. Setting these
  23901. parameters influences certain behavior in GDB. Similarly, you can
  23902. define parameters that can be used to influence behavior in custom Guile
  23903. scripts and commands.
  23904. A new parameter is defined with the 'make-parameter' Guile function,
  23905. and added to GDB with the 'register-parameter!' Guile function. This
  23906. two-step approach is taken to separate out the side-effect of adding the
  23907. parameter to GDB from 'make-parameter'.
  23908. Parameters are exposed to the user via the 'set' and 'show' commands.
  23909. *Note Help::.
  23910. -- Scheme Procedure: (make-parameter name [#:command-class
  23911. command-class] [#:parameter-type parameter-type] [#:enum-list
  23912. enum-list] [#:set-func set-func] [#:show-func show-func]
  23913. [#:doc doc] [#:set-doc set-doc] [#:show-doc show-doc]
  23914. [#:initial-value initial-value])
  23915. The argument NAME is the name of the new parameter. If NAME
  23916. consists of multiple words, then the initial words are looked for
  23917. as prefix parameters. An example of this can be illustrated with
  23918. the 'set print' set of parameters. If NAME is 'print foo', then
  23919. 'print' will be searched as the prefix parameter. In this case the
  23920. parameter can subsequently be accessed in GDB as 'set print foo'.
  23921. If NAME consists of multiple words, and no prefix parameter group
  23922. can be found, an exception is raised.
  23923. The result is the '<gdb:parameter>' object representing the
  23924. parameter. The parameter is not usable until it has been
  23925. registered with GDB with 'register-parameter!'.
  23926. The rest of the arguments are optional.
  23927. The argument COMMAND-CLASS should be one of the 'COMMAND_'
  23928. constants (*note Commands In Guile::). This argument tells GDB how
  23929. to categorize the new parameter in the help system. The default is
  23930. 'COMMAND_NONE'.
  23931. The argument PARAMETER-TYPE should be one of the 'PARAM_' constants
  23932. defined below. This argument tells GDB the type of the new
  23933. parameter; this information is used for input validation and
  23934. completion. The default is 'PARAM_BOOLEAN'.
  23935. If PARAMETER-TYPE is 'PARAM_ENUM', then ENUM-LIST must be a list of
  23936. strings. These strings represent the possible values for the
  23937. parameter.
  23938. If PARAMETER-TYPE is not 'PARAM_ENUM', then the presence of
  23939. ENUM-LIST will cause an exception to be thrown.
  23940. The argument SET-FUNC is a function of one argument: SELF which is
  23941. the '<gdb:parameter>' object representing the parameter. GDB will
  23942. call this function when a PARAMETER's value has been changed via
  23943. the 'set' API (for example, 'set foo off'). The value of the
  23944. parameter has already been set to the new value. This function
  23945. must return a string to be displayed to the user. GDB will add a
  23946. trailing newline if the string is non-empty. GDB generally doesn't
  23947. print anything when a parameter is set, thus typically this
  23948. function should return '""'. A non-empty string result should
  23949. typically be used for displaying warnings and errors.
  23950. The argument SHOW-FUNC is a function of two arguments: SELF which
  23951. is the '<gdb:parameter>' object representing the parameter, and
  23952. SVALUE which is the string representation of the current value.
  23953. GDB will call this function when a PARAMETER's 'show' API has been
  23954. invoked (for example, 'show foo'). This function must return a
  23955. string, and will be displayed to the user. GDB will add a trailing
  23956. newline.
  23957. The argument DOC is the help text for the new parameter. If there
  23958. is no documentation string, a default value is used.
  23959. The argument SET-DOC is the help text for this parameter's 'set'
  23960. command.
  23961. The argument SHOW-DOC is the help text for this parameter's 'show'
  23962. command.
  23963. The argument INITIAL-VALUE specifies the initial value of the
  23964. parameter. If it is a function, it takes one parameter, the
  23965. '<gdb:parameter>' object and its result is used as the initial
  23966. value of the parameter. The initial value must be valid for the
  23967. parameter type, otherwise an exception is thrown.
  23968. -- Scheme Procedure: register-parameter! parameter
  23969. Add PARAMETER, a '<gdb:parameter>' object, to GDB's list of
  23970. parameters. It is an error to register a parameter more than once.
  23971. The result is unspecified.
  23972. -- Scheme Procedure: parameter? object
  23973. Return '#t' if OBJECT is a '<gdb:parameter>' object. Otherwise
  23974. return '#f'.
  23975. -- Scheme Procedure: parameter-value parameter
  23976. Return the value of PARAMETER which may either be a
  23977. '<gdb:parameter>' object or a string naming the parameter.
  23978. -- Scheme Procedure: set-parameter-value! parameter new-value
  23979. Assign PARAMETER the value of NEW-VALUE. The argument PARAMETER
  23980. must be an object of type '<gdb:parameter>'. GDB does validation
  23981. when assignments are made.
  23982. When a new parameter is defined, its type must be specified. The
  23983. available types are represented by constants defined in the 'gdb'
  23984. module:
  23985. 'PARAM_BOOLEAN'
  23986. The value is a plain boolean. The Guile boolean values, '#t' and
  23987. '#f' are the only valid values.
  23988. 'PARAM_AUTO_BOOLEAN'
  23989. The value has three possible states: true, false, and 'auto'. In
  23990. Guile, true and false are represented using boolean constants, and
  23991. 'auto' is represented using '#:auto'.
  23992. 'PARAM_UINTEGER'
  23993. The value is an unsigned integer. The value of 0 should be
  23994. interpreted to mean "unlimited".
  23995. 'PARAM_ZINTEGER'
  23996. The value is an integer.
  23997. 'PARAM_ZUINTEGER'
  23998. The value is an unsigned integer.
  23999. 'PARAM_ZUINTEGER_UNLIMITED'
  24000. The value is an integer in the range '[0, INT_MAX]'. A value of
  24001. '-1' means "unlimited", and other negative numbers are not allowed.
  24002. 'PARAM_STRING'
  24003. The value is a string. When the user modifies the string, any
  24004. escape sequences, such as '\t', '\f', and octal escapes, are
  24005. translated into corresponding characters and encoded into the
  24006. current host charset.
  24007. 'PARAM_STRING_NOESCAPE'
  24008. The value is a string. When the user modifies the string, escapes
  24009. are passed through untranslated.
  24010. 'PARAM_OPTIONAL_FILENAME'
  24011. The value is a either a filename (a string), or '#f'.
  24012. 'PARAM_FILENAME'
  24013. The value is a filename. This is just like
  24014. 'PARAM_STRING_NOESCAPE', but uses file names for completion.
  24015. 'PARAM_ENUM'
  24016. The value is a string, which must be one of a collection of string
  24017. constants provided when the parameter is created.
  24018. ---------- Footnotes ----------
  24019. (1) Note that GDB parameters must not be confused with Guile’s
  24020. parameter objects (*note (guile)Parameters::).
  24021. 
  24022. File: gdb.info, Node: Progspaces In Guile, Next: Objfiles In Guile, Prev: Parameters In Guile, Up: Guile API
  24023. 23.3.3.13 Program Spaces In Guile
  24024. .................................
  24025. A program space, or "progspace", represents a symbolic view of an
  24026. address space. It consists of all of the objfiles of the program.
  24027. *Note Objfiles In Guile::. *Note program spaces: Inferiors Connections
  24028. and Programs, for more details about program spaces.
  24029. Each progspace is represented by an instance of the '<gdb:progspace>'
  24030. smob. *Note GDB Scheme Data Types::.
  24031. The following progspace-related functions are available in the
  24032. '(gdb)' module:
  24033. -- Scheme Procedure: progspace? object
  24034. Return '#t' if OBJECT is a '<gdb:progspace>' object. Otherwise
  24035. return '#f'.
  24036. -- Scheme Procedure: progspace-valid? progspace
  24037. Return '#t' if PROGSPACE is valid, '#f' if not. A
  24038. '<gdb:progspace>' object can become invalid if the program it
  24039. refers to is not loaded in GDB any longer.
  24040. -- Scheme Procedure: current-progspace
  24041. This function returns the program space of the currently selected
  24042. inferior. There is always a current progspace, this never returns
  24043. '#f'. *Note Inferiors Connections and Programs::.
  24044. -- Scheme Procedure: progspaces
  24045. Return a list of all the progspaces currently known to GDB.
  24046. -- Scheme Procedure: progspace-filename progspace
  24047. Return the absolute file name of PROGSPACE as a string. This is
  24048. the name of the file passed as the argument to the 'file' or
  24049. 'symbol-file' commands. If the program space does not have an
  24050. associated file name, then '#f' is returned. This occurs, for
  24051. example, when GDB is started without a program to debug.
  24052. A 'gdb:invalid-object-error' exception is thrown if PROGSPACE is
  24053. invalid.
  24054. -- Scheme Procedure: progspace-objfiles progspace
  24055. Return the list of objfiles of PROGSPACE. The order of objfiles in
  24056. the result is arbitrary. Each element is an object of type
  24057. '<gdb:objfile>'. *Note Objfiles In Guile::.
  24058. A 'gdb:invalid-object-error' exception is thrown if PROGSPACE is
  24059. invalid.
  24060. -- Scheme Procedure: progspace-pretty-printers progspace
  24061. Return the list of pretty-printers of PROGSPACE. Each element is
  24062. an object of type '<gdb:pretty-printer>'. *Note Guile Pretty
  24063. Printing API::, for more information.
  24064. -- Scheme Procedure: set-progspace-pretty-printers! progspace
  24065. printer-list
  24066. Set the list of registered '<gdb:pretty-printer>' objects for
  24067. PROGSPACE to PRINTER-LIST. *Note Guile Pretty Printing API::, for
  24068. more information.
  24069. 
  24070. File: gdb.info, Node: Objfiles In Guile, Next: Frames In Guile, Prev: Progspaces In Guile, Up: Guile API
  24071. 23.3.3.14 Objfiles In Guile
  24072. ...........................
  24073. GDB loads symbols for an inferior from various symbol-containing files
  24074. (*note Files::). These include the primary executable file, any shared
  24075. libraries used by the inferior, and any separate debug info files (*note
  24076. Separate Debug Files::). GDB calls these symbol-containing files
  24077. "objfiles".
  24078. Each objfile is represented as an object of type '<gdb:objfile>'.
  24079. The following objfile-related procedures are provided by the '(gdb)'
  24080. module:
  24081. -- Scheme Procedure: objfile? object
  24082. Return '#t' if OBJECT is a '<gdb:objfile>' object. Otherwise
  24083. return '#f'.
  24084. -- Scheme Procedure: objfile-valid? objfile
  24085. Return '#t' if OBJFILE is valid, '#f' if not. A '<gdb:objfile>'
  24086. object can become invalid if the object file it refers to is not
  24087. loaded in GDB any longer. All other '<gdb:objfile>' procedures
  24088. will throw an exception if it is invalid at the time the procedure
  24089. is called.
  24090. -- Scheme Procedure: objfile-filename objfile
  24091. Return the file name of OBJFILE as a string, with symbolic links
  24092. resolved.
  24093. -- Scheme Procedure: objfile-progspace objfile
  24094. Return the '<gdb:progspace>' that this object file lives in. *Note
  24095. Progspaces In Guile::, for more on progspaces.
  24096. -- Scheme Procedure: objfile-pretty-printers objfile
  24097. Return the list of registered '<gdb:pretty-printer>' objects for
  24098. OBJFILE. *Note Guile Pretty Printing API::, for more information.
  24099. -- Scheme Procedure: set-objfile-pretty-printers! objfile printer-list
  24100. Set the list of registered '<gdb:pretty-printer>' objects for
  24101. OBJFILE to PRINTER-LIST. The PRINTER-LIST must be a list of
  24102. '<gdb:pretty-printer>' objects. *Note Guile Pretty Printing API::,
  24103. for more information.
  24104. -- Scheme Procedure: current-objfile
  24105. When auto-loading a Guile script (*note Guile Auto-loading::), GDB
  24106. sets the "current objfile" to the corresponding objfile. This
  24107. function returns the current objfile. If there is no current
  24108. objfile, this function returns '#f'.
  24109. -- Scheme Procedure: objfiles
  24110. Return a list of all the objfiles in the current program space.
  24111. 
  24112. File: gdb.info, Node: Frames In Guile, Next: Blocks In Guile, Prev: Objfiles In Guile, Up: Guile API
  24113. 23.3.3.15 Accessing inferior stack frames from Guile.
  24114. .....................................................
  24115. When the debugged program stops, GDB is able to analyze its call stack
  24116. (*note Stack frames: Frames.). The '<gdb:frame>' class represents a
  24117. frame in the stack. A '<gdb:frame>' object is only valid while its
  24118. corresponding frame exists in the inferior's stack. If you try to use
  24119. an invalid frame object, GDB will throw a 'gdb:invalid-object' exception
  24120. (*note Guile Exception Handling::).
  24121. Two '<gdb:frame>' objects can be compared for equality with the
  24122. 'equal?' function, like:
  24123. (gdb) guile (equal? (newest-frame) (selected-frame))
  24124. #t
  24125. The following frame-related procedures are provided by the '(gdb)'
  24126. module:
  24127. -- Scheme Procedure: frame? object
  24128. Return '#t' if OBJECT is a '<gdb:frame>' object. Otherwise return
  24129. '#f'.
  24130. -- Scheme Procedure: frame-valid? frame
  24131. Returns '#t' if FRAME is valid, '#f' if not. A frame object can
  24132. become invalid if the frame it refers to doesn't exist anymore in
  24133. the inferior. All '<gdb:frame>' procedures will throw an exception
  24134. if the frame is invalid at the time the procedure is called.
  24135. -- Scheme Procedure: frame-name frame
  24136. Return the function name of FRAME, or '#f' if it can't be obtained.
  24137. -- Scheme Procedure: frame-arch frame
  24138. Return the '<gdb:architecture>' object corresponding to FRAME's
  24139. architecture. *Note Architectures In Guile::.
  24140. -- Scheme Procedure: frame-type frame
  24141. Return the type of FRAME. The value can be one of:
  24142. 'NORMAL_FRAME'
  24143. An ordinary stack frame.
  24144. 'DUMMY_FRAME'
  24145. A fake stack frame that was created by GDB when performing an
  24146. inferior function call.
  24147. 'INLINE_FRAME'
  24148. A frame representing an inlined function. The function was
  24149. inlined into a 'NORMAL_FRAME' that is older than this one.
  24150. 'TAILCALL_FRAME'
  24151. A frame representing a tail call. *Note Tail Call Frames::.
  24152. 'SIGTRAMP_FRAME'
  24153. A signal trampoline frame. This is the frame created by the
  24154. OS when it calls into a signal handler.
  24155. 'ARCH_FRAME'
  24156. A fake stack frame representing a cross-architecture call.
  24157. 'SENTINEL_FRAME'
  24158. This is like 'NORMAL_FRAME', but it is only used for the
  24159. newest frame.
  24160. -- Scheme Procedure: frame-unwind-stop-reason frame
  24161. Return an integer representing the reason why it's not possible to
  24162. find more frames toward the outermost frame. Use
  24163. 'unwind-stop-reason-string' to convert the value returned by this
  24164. function to a string. The value can be one of:
  24165. 'FRAME_UNWIND_NO_REASON'
  24166. No particular reason (older frames should be available).
  24167. 'FRAME_UNWIND_NULL_ID'
  24168. The previous frame's analyzer returns an invalid result.
  24169. 'FRAME_UNWIND_OUTERMOST'
  24170. This frame is the outermost.
  24171. 'FRAME_UNWIND_UNAVAILABLE'
  24172. Cannot unwind further, because that would require knowing the
  24173. values of registers or memory that have not been collected.
  24174. 'FRAME_UNWIND_INNER_ID'
  24175. This frame ID looks like it ought to belong to a NEXT frame,
  24176. but we got it for a PREV frame. Normally, this is a sign of
  24177. unwinder failure. It could also indicate stack corruption.
  24178. 'FRAME_UNWIND_SAME_ID'
  24179. This frame has the same ID as the previous one. That means
  24180. that unwinding further would almost certainly give us another
  24181. frame with exactly the same ID, so break the chain. Normally,
  24182. this is a sign of unwinder failure. It could also indicate
  24183. stack corruption.
  24184. 'FRAME_UNWIND_NO_SAVED_PC'
  24185. The frame unwinder did not find any saved PC, but we needed
  24186. one to unwind further.
  24187. 'FRAME_UNWIND_MEMORY_ERROR'
  24188. The frame unwinder caused an error while trying to access
  24189. memory.
  24190. 'FRAME_UNWIND_FIRST_ERROR'
  24191. Any stop reason greater or equal to this value indicates some
  24192. kind of error. This special value facilitates writing code
  24193. that tests for errors in unwinding in a way that will work
  24194. correctly even if the list of the other values is modified in
  24195. future GDB versions. Using it, you could write:
  24196. (define reason (frame-unwind-stop-readon (selected-frame)))
  24197. (define reason-str (unwind-stop-reason-string reason))
  24198. (if (>= reason FRAME_UNWIND_FIRST_ERROR)
  24199. (format #t "An error occured: ~s\n" reason-str))
  24200. -- Scheme Procedure: frame-pc frame
  24201. Return the frame's resume address.
  24202. -- Scheme Procedure: frame-block frame
  24203. Return the frame's code block as a '<gdb:block>' object. *Note
  24204. Blocks In Guile::.
  24205. -- Scheme Procedure: frame-function frame
  24206. Return the symbol for the function corresponding to this frame as a
  24207. '<gdb:symbol>' object, or '#f' if there isn't one. *Note Symbols
  24208. In Guile::.
  24209. -- Scheme Procedure: frame-older frame
  24210. Return the frame that called FRAME.
  24211. -- Scheme Procedure: frame-newer frame
  24212. Return the frame called by FRAME.
  24213. -- Scheme Procedure: frame-sal frame
  24214. Return the frame's '<gdb:sal>' (symtab and line) object. *Note
  24215. Symbol Tables In Guile::.
  24216. -- Scheme Procedure: frame-read-register frame register
  24217. Return the value of REGISTER in FRAME. REGISTER should be a
  24218. string, like 'pc'.
  24219. -- Scheme Procedure: frame-read-var frame variable [#:block block]
  24220. Return the value of VARIABLE in FRAME. If the optional argument
  24221. BLOCK is provided, search for the variable from that block;
  24222. otherwise start at the frame's current block (which is determined
  24223. by the frame's current program counter). The VARIABLE must be
  24224. given as a string or a '<gdb:symbol>' object, and BLOCK must be a
  24225. '<gdb:block>' object.
  24226. -- Scheme Procedure: frame-select frame
  24227. Set FRAME to be the selected frame. *Note Examining the Stack:
  24228. Stack.
  24229. -- Scheme Procedure: selected-frame
  24230. Return the selected frame object. *Note Selecting a Frame:
  24231. Selection.
  24232. -- Scheme Procedure: newest-frame
  24233. Return the newest frame object for the selected thread.
  24234. -- Scheme Procedure: unwind-stop-reason-string reason
  24235. Return a string explaining the reason why GDB stopped unwinding
  24236. frames, as expressed by the given REASON code (an integer, see the
  24237. 'frame-unwind-stop-reason' procedure above in this section).
  24238. 
  24239. File: gdb.info, Node: Blocks In Guile, Next: Symbols In Guile, Prev: Frames In Guile, Up: Guile API
  24240. 23.3.3.16 Accessing blocks from Guile.
  24241. ......................................
  24242. In GDB, symbols are stored in blocks. A block corresponds roughly to a
  24243. scope in the source code. Blocks are organized hierarchically, and are
  24244. represented individually in Guile as an object of type '<gdb:block>'.
  24245. Blocks rely on debugging information being available.
  24246. A frame has a block. Please see *note Frames In Guile::, for a more
  24247. in-depth discussion of frames.
  24248. The outermost block is known as the "global block". The global block
  24249. typically holds public global variables and functions.
  24250. The block nested just inside the global block is the "static block".
  24251. The static block typically holds file-scoped variables and functions.
  24252. GDB provides a method to get a block's superblock, but there is
  24253. currently no way to examine the sub-blocks of a block, or to iterate
  24254. over all the blocks in a symbol table (*note Symbol Tables In Guile::).
  24255. Here is a short example that should help explain blocks:
  24256. /* This is in the global block. */
  24257. int global;
  24258. /* This is in the static block. */
  24259. static int file_scope;
  24260. /* 'function' is in the global block, and 'argument' is
  24261. in a block nested inside of 'function'. */
  24262. int function (int argument)
  24263. {
  24264. /* 'local' is in a block inside 'function'. It may or may
  24265. not be in the same block as 'argument'. */
  24266. int local;
  24267. {
  24268. /* 'inner' is in a block whose superblock is the one holding
  24269. 'local'. */
  24270. int inner;
  24271. /* If this call is expanded by the compiler, you may see
  24272. a nested block here whose function is 'inline_function'
  24273. and whose superblock is the one holding 'inner'. */
  24274. inline_function ();
  24275. }
  24276. }
  24277. The following block-related procedures are provided by the '(gdb)'
  24278. module:
  24279. -- Scheme Procedure: block? object
  24280. Return '#t' if OBJECT is a '<gdb:block>' object. Otherwise return
  24281. '#f'.
  24282. -- Scheme Procedure: block-valid? block
  24283. Returns '#t' if '<gdb:block>' BLOCK is valid, '#f' if not. A block
  24284. object can become invalid if the block it refers to doesn't exist
  24285. anymore in the inferior. All other '<gdb:block>' methods will
  24286. throw an exception if it is invalid at the time the procedure is
  24287. called. The block's validity is also checked during iteration over
  24288. symbols of the block.
  24289. -- Scheme Procedure: block-start block
  24290. Return the start address of '<gdb:block>' BLOCK.
  24291. -- Scheme Procedure: block-end block
  24292. Return the end address of '<gdb:block>' BLOCK.
  24293. -- Scheme Procedure: block-function block
  24294. Return the name of '<gdb:block>' BLOCK represented as a
  24295. '<gdb:symbol>' object. If the block is not named, then '#f' is
  24296. returned.
  24297. For ordinary function blocks, the superblock is the static block.
  24298. However, you should note that it is possible for a function block
  24299. to have a superblock that is not the static block - for instance
  24300. this happens for an inlined function.
  24301. -- Scheme Procedure: block-superblock block
  24302. Return the block containing '<gdb:block>' BLOCK. If the parent
  24303. block does not exist, then '#f' is returned.
  24304. -- Scheme Procedure: block-global-block block
  24305. Return the global block associated with '<gdb:block>' BLOCK.
  24306. -- Scheme Procedure: block-static-block block
  24307. Return the static block associated with '<gdb:block>' BLOCK.
  24308. -- Scheme Procedure: block-global? block
  24309. Return '#t' if '<gdb:block>' BLOCK is a global block. Otherwise
  24310. return '#f'.
  24311. -- Scheme Procedure: block-static? block
  24312. Return '#t' if '<gdb:block>' BLOCK is a static block. Otherwise
  24313. return '#f'.
  24314. -- Scheme Procedure: block-symbols
  24315. Return a list of all symbols (as <gdb:symbol> objects) in
  24316. '<gdb:block>' BLOCK.
  24317. -- Scheme Procedure: make-block-symbols-iterator block
  24318. Return an object of type '<gdb:iterator>' that will iterate over
  24319. all symbols of the block. Guile programs should not assume that a
  24320. specific block object will always contain a given symbol, since
  24321. changes in GDB features and infrastructure may cause symbols move
  24322. across blocks in a symbol table. *Note Iterators In Guile::.
  24323. -- Scheme Procedure: block-symbols-progress?
  24324. Return #t if the object is a <gdb:block-symbols-progress> object.
  24325. This object would be obtained from the 'progress' element of the
  24326. '<gdb:iterator>' object returned by 'make-block-symbols-iterator'.
  24327. -- Scheme Procedure: lookup-block pc
  24328. Return the innermost '<gdb:block>' containing the given PC value.
  24329. If the block cannot be found for the PC value specified, the
  24330. function will return '#f'.
  24331. 
  24332. File: gdb.info, Node: Symbols In Guile, Next: Symbol Tables In Guile, Prev: Blocks In Guile, Up: Guile API
  24333. 23.3.3.17 Guile representation of Symbols.
  24334. ..........................................
  24335. GDB represents every variable, function and type as an entry in a symbol
  24336. table. *Note Examining the Symbol Table: Symbols. Guile represents
  24337. these symbols in GDB with the '<gdb:symbol>' object.
  24338. The following symbol-related procedures are provided by the '(gdb)'
  24339. module:
  24340. -- Scheme Procedure: symbol? object
  24341. Return '#t' if OBJECT is an object of type '<gdb:symbol>'.
  24342. Otherwise return '#f'.
  24343. -- Scheme Procedure: symbol-valid? symbol
  24344. Return '#t' if the '<gdb:symbol>' object is valid, '#f' if not. A
  24345. '<gdb:symbol>' object can become invalid if the symbol it refers to
  24346. does not exist in GDB any longer. All other '<gdb:symbol>'
  24347. procedures will throw an exception if it is invalid at the time the
  24348. procedure is called.
  24349. -- Scheme Procedure: symbol-type symbol
  24350. Return the type of SYMBOL or '#f' if no type is recorded. The
  24351. result is an object of type '<gdb:type>'. *Note Types In Guile::.
  24352. -- Scheme Procedure: symbol-symtab symbol
  24353. Return the symbol table in which SYMBOL appears. The result is an
  24354. object of type '<gdb:symtab>'. *Note Symbol Tables In Guile::.
  24355. -- Scheme Procedure: symbol-line symbol
  24356. Return the line number in the source code at which SYMBOL was
  24357. defined. This is an integer.
  24358. -- Scheme Procedure: symbol-name symbol
  24359. Return the name of SYMBOL as a string.
  24360. -- Scheme Procedure: symbol-linkage-name symbol
  24361. Return the name of SYMBOL, as used by the linker (i.e., may be
  24362. mangled).
  24363. -- Scheme Procedure: symbol-print-name symbol
  24364. Return the name of SYMBOL in a form suitable for output. This is
  24365. either 'name' or 'linkage_name', depending on whether the user
  24366. asked GDB to display demangled or mangled names.
  24367. -- Scheme Procedure: symbol-addr-class symbol
  24368. Return the address class of the symbol. This classifies how to
  24369. find the value of a symbol. Each address class is a constant
  24370. defined in the '(gdb)' module and described later in this chapter.
  24371. -- Scheme Procedure: symbol-needs-frame? symbol
  24372. Return '#t' if evaluating SYMBOL's value requires a frame (*note
  24373. Frames In Guile::) and '#f' otherwise. Typically, local variables
  24374. will require a frame, but other symbols will not.
  24375. -- Scheme Procedure: symbol-argument? symbol
  24376. Return '#t' if SYMBOL is an argument of a function. Otherwise
  24377. return '#f'.
  24378. -- Scheme Procedure: symbol-constant? symbol
  24379. Return '#t' if SYMBOL is a constant. Otherwise return '#f'.
  24380. -- Scheme Procedure: symbol-function? symbol
  24381. Return '#t' if SYMBOL is a function or a method. Otherwise return
  24382. '#f'.
  24383. -- Scheme Procedure: symbol-variable? symbol
  24384. Return '#t' if SYMBOL is a variable. Otherwise return '#f'.
  24385. -- Scheme Procedure: symbol-value symbol [#:frame frame]
  24386. Compute the value of SYMBOL, as a '<gdb:value>'. For functions,
  24387. this computes the address of the function, cast to the appropriate
  24388. type. If the symbol requires a frame in order to compute its
  24389. value, then FRAME must be given. If FRAME is not given, or if
  24390. FRAME is invalid, then an exception is thrown.
  24391. -- Scheme Procedure: lookup-symbol name [#:block block] [#:domain
  24392. domain]
  24393. This function searches for a symbol by name. The search scope can
  24394. be restricted to the parameters defined in the optional domain and
  24395. block arguments.
  24396. NAME is the name of the symbol. It must be a string. The optional
  24397. BLOCK argument restricts the search to symbols visible in that
  24398. BLOCK. The BLOCK argument must be a '<gdb:block>' object. If
  24399. omitted, the block for the current frame is used. The optional
  24400. DOMAIN argument restricts the search to the domain type. The
  24401. DOMAIN argument must be a domain constant defined in the '(gdb)'
  24402. module and described later in this chapter.
  24403. The result is a list of two elements. The first element is a
  24404. '<gdb:symbol>' object or '#f' if the symbol is not found. If the
  24405. symbol is found, the second element is '#t' if the symbol is a
  24406. field of a method's object (e.g., 'this' in C++), otherwise it is
  24407. '#f'. If the symbol is not found, the second element is '#f'.
  24408. -- Scheme Procedure: lookup-global-symbol name [#:domain domain]
  24409. This function searches for a global symbol by name. The search
  24410. scope can be restricted by the domain argument.
  24411. NAME is the name of the symbol. It must be a string. The optional
  24412. DOMAIN argument restricts the search to the domain type. The
  24413. DOMAIN argument must be a domain constant defined in the '(gdb)'
  24414. module and described later in this chapter.
  24415. The result is a '<gdb:symbol>' object or '#f' if the symbol is not
  24416. found.
  24417. The available domain categories in '<gdb:symbol>' are represented as
  24418. constants in the '(gdb)' module:
  24419. 'SYMBOL_UNDEF_DOMAIN'
  24420. This is used when a domain has not been discovered or none of the
  24421. following domains apply. This usually indicates an error either in
  24422. the symbol information or in GDB's handling of symbols.
  24423. 'SYMBOL_VAR_DOMAIN'
  24424. This domain contains variables, function names, typedef names and
  24425. enum type values.
  24426. 'SYMBOL_STRUCT_DOMAIN'
  24427. This domain holds struct, union and enum type names.
  24428. 'SYMBOL_LABEL_DOMAIN'
  24429. This domain contains names of labels (for gotos).
  24430. 'SYMBOL_VARIABLES_DOMAIN'
  24431. This domain holds a subset of the 'SYMBOLS_VAR_DOMAIN'; it contains
  24432. everything minus functions and types.
  24433. 'SYMBOL_FUNCTIONS_DOMAIN'
  24434. This domain contains all functions.
  24435. 'SYMBOL_TYPES_DOMAIN'
  24436. This domain contains all types.
  24437. The available address class categories in '<gdb:symbol>' are
  24438. represented as constants in the 'gdb' module:
  24439. 'SYMBOL_LOC_UNDEF'
  24440. If this is returned by address class, it indicates an error either
  24441. in the symbol information or in GDB's handling of symbols.
  24442. 'SYMBOL_LOC_CONST'
  24443. Value is constant int.
  24444. 'SYMBOL_LOC_STATIC'
  24445. Value is at a fixed address.
  24446. 'SYMBOL_LOC_REGISTER'
  24447. Value is in a register.
  24448. 'SYMBOL_LOC_ARG'
  24449. Value is an argument. This value is at the offset stored within
  24450. the symbol inside the frame's argument list.
  24451. 'SYMBOL_LOC_REF_ARG'
  24452. Value address is stored in the frame's argument list. Just like
  24453. 'LOC_ARG' except that the value's address is stored at the offset,
  24454. not the value itself.
  24455. 'SYMBOL_LOC_REGPARM_ADDR'
  24456. Value is a specified register. Just like 'LOC_REGISTER' except the
  24457. register holds the address of the argument instead of the argument
  24458. itself.
  24459. 'SYMBOL_LOC_LOCAL'
  24460. Value is a local variable.
  24461. 'SYMBOL_LOC_TYPEDEF'
  24462. Value not used. Symbols in the domain 'SYMBOL_STRUCT_DOMAIN' all
  24463. have this class.
  24464. 'SYMBOL_LOC_BLOCK'
  24465. Value is a block.
  24466. 'SYMBOL_LOC_CONST_BYTES'
  24467. Value is a byte-sequence.
  24468. 'SYMBOL_LOC_UNRESOLVED'
  24469. Value is at a fixed address, but the address of the variable has to
  24470. be determined from the minimal symbol table whenever the variable
  24471. is referenced.
  24472. 'SYMBOL_LOC_OPTIMIZED_OUT'
  24473. The value does not actually exist in the program.
  24474. 'SYMBOL_LOC_COMPUTED'
  24475. The value's address is a computed location.
  24476. 
  24477. File: gdb.info, Node: Symbol Tables In Guile, Next: Breakpoints In Guile, Prev: Symbols In Guile, Up: Guile API
  24478. 23.3.3.18 Symbol table representation in Guile.
  24479. ...............................................
  24480. Access to symbol table data maintained by GDB on the inferior is exposed
  24481. to Guile via two objects: '<gdb:sal>' (symtab-and-line) and
  24482. '<gdb:symtab>'. Symbol table and line data for a frame is returned from
  24483. the 'frame-find-sal' '<gdb:frame>' procedure. *Note Frames In Guile::.
  24484. For more information on GDB's symbol table management, see *note
  24485. Examining the Symbol Table: Symbols.
  24486. The following symtab-related procedures are provided by the '(gdb)'
  24487. module:
  24488. -- Scheme Procedure: symtab? object
  24489. Return '#t' if OBJECT is an object of type '<gdb:symtab>'.
  24490. Otherwise return '#f'.
  24491. -- Scheme Procedure: symtab-valid? symtab
  24492. Return '#t' if the '<gdb:symtab>' object is valid, '#f' if not. A
  24493. '<gdb:symtab>' object becomes invalid when the symbol table it
  24494. refers to no longer exists in GDB. All other '<gdb:symtab>'
  24495. procedures will throw an exception if it is invalid at the time the
  24496. procedure is called.
  24497. -- Scheme Procedure: symtab-filename symtab
  24498. Return the symbol table's source filename.
  24499. -- Scheme Procedure: symtab-fullname symtab
  24500. Return the symbol table's source absolute file name.
  24501. -- Scheme Procedure: symtab-objfile symtab
  24502. Return the symbol table's backing object file. *Note Objfiles In
  24503. Guile::.
  24504. -- Scheme Procedure: symtab-global-block symtab
  24505. Return the global block of the underlying symbol table. *Note
  24506. Blocks In Guile::.
  24507. -- Scheme Procedure: symtab-static-block symtab
  24508. Return the static block of the underlying symbol table. *Note
  24509. Blocks In Guile::.
  24510. The following symtab-and-line-related procedures are provided by the
  24511. '(gdb)' module:
  24512. -- Scheme Procedure: sal? object
  24513. Return '#t' if OBJECT is an object of type '<gdb:sal>'. Otherwise
  24514. return '#f'.
  24515. -- Scheme Procedure: sal-valid? sal
  24516. Return '#t' if SAL is valid, '#f' if not. A '<gdb:sal>' object
  24517. becomes invalid when the Symbol table object it refers to no longer
  24518. exists in GDB. All other '<gdb:sal>' procedures will throw an
  24519. exception if it is invalid at the time the procedure is called.
  24520. -- Scheme Procedure: sal-symtab sal
  24521. Return the symbol table object ('<gdb:symtab>') for SAL.
  24522. -- Scheme Procedure: sal-line sal
  24523. Return the line number for SAL.
  24524. -- Scheme Procedure: sal-pc sal
  24525. Return the start of the address range occupied by code for SAL.
  24526. -- Scheme Procedure: sal-last sal
  24527. Return the end of the address range occupied by code for SAL.
  24528. -- Scheme Procedure: find-pc-line pc
  24529. Return the '<gdb:sal>' object corresponding to the PC value. If an
  24530. invalid value of PC is passed as an argument, then the 'symtab' and
  24531. 'line' attributes of the returned '<gdb:sal>' object will be '#f'
  24532. and 0 respectively.
  24533. 
  24534. File: gdb.info, Node: Breakpoints In Guile, Next: Lazy Strings In Guile, Prev: Symbol Tables In Guile, Up: Guile API
  24535. 23.3.3.19 Manipulating breakpoints using Guile
  24536. ..............................................
  24537. Breakpoints in Guile are represented by objects of type
  24538. '<gdb:breakpoint>'. New breakpoints can be created with the
  24539. 'make-breakpoint' Guile function, and then added to GDB with the
  24540. 'register-breakpoint!' Guile function. This two-step approach is taken
  24541. to separate out the side-effect of adding the breakpoint to GDB from
  24542. 'make-breakpoint'.
  24543. Support is also provided to view and manipulate breakpoints created
  24544. outside of Guile.
  24545. The following breakpoint-related procedures are provided by the
  24546. '(gdb)' module:
  24547. -- Scheme Procedure: make-breakpoint location [#:type type] [#:wp-class
  24548. wp-class] [#:internal internal]
  24549. Create a new breakpoint at LOCATION, a string naming the location
  24550. of the breakpoint, or an expression that defines a watchpoint. The
  24551. contents can be any location recognized by the 'break' command, or
  24552. in the case of a watchpoint, by the 'watch' command.
  24553. The breakpoint is initially marked as 'invalid'. The breakpoint is
  24554. not usable until it has been registered with GDB with
  24555. 'register-breakpoint!', at which point it becomes 'valid'. The
  24556. result is the '<gdb:breakpoint>' object representing the
  24557. breakpoint.
  24558. The optional TYPE denotes the breakpoint to create. This argument
  24559. can be either 'BP_BREAKPOINT' or 'BP_WATCHPOINT', and defaults to
  24560. 'BP_BREAKPOINT'.
  24561. The optional WP-CLASS argument defines the class of watchpoint to
  24562. create, if TYPE is 'BP_WATCHPOINT'. If a watchpoint class is not
  24563. provided, it is assumed to be a 'WP_WRITE' class.
  24564. The optional INTERNAL argument allows the breakpoint to become
  24565. invisible to the user. The breakpoint will neither be reported
  24566. when registered, nor will it be listed in the output from 'info
  24567. breakpoints' (but will be listed with the 'maint info breakpoints'
  24568. command). If an internal flag is not provided, the breakpoint is
  24569. visible (non-internal).
  24570. When a watchpoint is created, GDB will try to create a hardware
  24571. assisted watchpoint. If successful, the type of the watchpoint is
  24572. changed from 'BP_WATCHPOINT' to 'BP_HARDWARE_WATCHPOINT' for
  24573. 'WP_WRITE', 'BP_READ_WATCHPOINT' for 'WP_READ', and
  24574. 'BP_ACCESS_WATCHPOINT' for 'WP_ACCESS'. If not successful, the
  24575. type of the watchpoint is left as 'WP_WATCHPOINT'.
  24576. The available types are represented by constants defined in the
  24577. 'gdb' module:
  24578. 'BP_BREAKPOINT'
  24579. Normal code breakpoint.
  24580. 'BP_WATCHPOINT'
  24581. Watchpoint breakpoint.
  24582. 'BP_HARDWARE_WATCHPOINT'
  24583. Hardware assisted watchpoint. This value cannot be specified
  24584. when creating the breakpoint.
  24585. 'BP_READ_WATCHPOINT'
  24586. Hardware assisted read watchpoint. This value cannot be
  24587. specified when creating the breakpoint.
  24588. 'BP_ACCESS_WATCHPOINT'
  24589. Hardware assisted access watchpoint. This value cannot be
  24590. specified when creating the breakpoint.
  24591. The available watchpoint types represented by constants are defined
  24592. in the '(gdb)' module:
  24593. 'WP_READ'
  24594. Read only watchpoint.
  24595. 'WP_WRITE'
  24596. Write only watchpoint.
  24597. 'WP_ACCESS'
  24598. Read/Write watchpoint.
  24599. -- Scheme Procedure: register-breakpoint! breakpoint
  24600. Add BREAKPOINT, a '<gdb:breakpoint>' object, to GDB's list of
  24601. breakpoints. The breakpoint must have been created with
  24602. 'make-breakpoint'. One cannot register breakpoints that have been
  24603. created outside of Guile. Once a breakpoint is registered it
  24604. becomes 'valid'. It is an error to register an already registered
  24605. breakpoint. The result is unspecified.
  24606. -- Scheme Procedure: delete-breakpoint! breakpoint
  24607. Remove BREAKPOINT from GDB's list of breakpoints. This also
  24608. invalidates the Guile BREAKPOINT object. Any further attempt to
  24609. access the object will throw an exception.
  24610. If BREAKPOINT was created from Guile with 'make-breakpoint' it may
  24611. be re-registered with GDB, in which case the breakpoint becomes
  24612. valid again.
  24613. -- Scheme Procedure: breakpoints
  24614. Return a list of all breakpoints. Each element of the list is a
  24615. '<gdb:breakpoint>' object.
  24616. -- Scheme Procedure: breakpoint? object
  24617. Return '#t' if OBJECT is a '<gdb:breakpoint>' object, and '#f'
  24618. otherwise.
  24619. -- Scheme Procedure: breakpoint-valid? breakpoint
  24620. Return '#t' if BREAKPOINT is valid, '#f' otherwise. Breakpoints
  24621. created with 'make-breakpoint' are marked as invalid until they are
  24622. registered with GDB with 'register-breakpoint!'. A
  24623. '<gdb:breakpoint>' object can become invalid if the user deletes
  24624. the breakpoint. In this case, the object still exists, but the
  24625. underlying breakpoint does not. In the cases of watchpoint scope,
  24626. the watchpoint remains valid even if execution of the inferior
  24627. leaves the scope of that watchpoint.
  24628. -- Scheme Procedure: breakpoint-number breakpoint
  24629. Return the breakpoint's number -- the identifier used by the user
  24630. to manipulate the breakpoint.
  24631. -- Scheme Procedure: breakpoint-type breakpoint
  24632. Return the breakpoint's type -- the identifier used to determine
  24633. the actual breakpoint type or use-case.
  24634. -- Scheme Procedure: breakpoint-visible? breakpoint
  24635. Return '#t' if the breakpoint is visible to the user when hit, or
  24636. when the 'info breakpoints' command is run. Otherwise return '#f'.
  24637. -- Scheme Procedure: breakpoint-location breakpoint
  24638. Return the location of the breakpoint, as specified by the user.
  24639. It is a string. If the breakpoint does not have a location (that
  24640. is, it is a watchpoint) return '#f'.
  24641. -- Scheme Procedure: breakpoint-expression breakpoint
  24642. Return the breakpoint expression, as specified by the user. It is
  24643. a string. If the breakpoint does not have an expression (the
  24644. breakpoint is not a watchpoint) return '#f'.
  24645. -- Scheme Procedure: breakpoint-enabled? breakpoint
  24646. Return '#t' if the breakpoint is enabled, and '#f' otherwise.
  24647. -- Scheme Procedure: set-breakpoint-enabled! breakpoint flag
  24648. Set the enabled state of BREAKPOINT to FLAG. If flag is '#f' it is
  24649. disabled, otherwise it is enabled.
  24650. -- Scheme Procedure: breakpoint-silent? breakpoint
  24651. Return '#t' if the breakpoint is silent, and '#f' otherwise.
  24652. Note that a breakpoint can also be silent if it has commands and
  24653. the first command is 'silent'. This is not reported by the
  24654. 'silent' attribute.
  24655. -- Scheme Procedure: set-breakpoint-silent! breakpoint flag
  24656. Set the silent state of BREAKPOINT to FLAG. If flag is '#f' the
  24657. breakpoint is made silent, otherwise it is made non-silent (or
  24658. noisy).
  24659. -- Scheme Procedure: breakpoint-ignore-count breakpoint
  24660. Return the ignore count for BREAKPOINT.
  24661. -- Scheme Procedure: set-breakpoint-ignore-count! breakpoint count
  24662. Set the ignore count for BREAKPOINT to COUNT.
  24663. -- Scheme Procedure: breakpoint-hit-count breakpoint
  24664. Return hit count of BREAKPOINT.
  24665. -- Scheme Procedure: set-breakpoint-hit-count! breakpoint count
  24666. Set the hit count of BREAKPOINT to COUNT. At present, COUNT must
  24667. be zero.
  24668. -- Scheme Procedure: breakpoint-thread breakpoint
  24669. Return the global-thread-id for thread-specific breakpoint
  24670. BREAKPOINT. Return #f if BREAKPOINT is not thread-specific.
  24671. -- Scheme Procedure: set-breakpoint-thread! breakpoint
  24672. global-thread-id|#f
  24673. Set the thread-id for BREAKPOINT to GLOBAL-THREAD-ID If set to
  24674. '#f', the breakpoint is no longer thread-specific.
  24675. -- Scheme Procedure: breakpoint-task breakpoint
  24676. If the breakpoint is Ada task-specific, return the Ada task id. If
  24677. the breakpoint is not task-specific (or the underlying language is
  24678. not Ada), return '#f'.
  24679. -- Scheme Procedure: set-breakpoint-task! breakpoint task
  24680. Set the Ada task of BREAKPOINT to TASK. If set to '#f', the
  24681. breakpoint is no longer task-specific.
  24682. -- Scheme Procedure: breakpoint-condition breakpoint
  24683. Return the condition of BREAKPOINT, as specified by the user. It
  24684. is a string. If there is no condition, return '#f'.
  24685. -- Scheme Procedure: set-breakpoint-condition! breakpoint condition
  24686. Set the condition of BREAKPOINT to CONDITION, which must be a
  24687. string. If set to '#f' then the breakpoint becomes unconditional.
  24688. -- Scheme Procedure: breakpoint-stop breakpoint
  24689. Return the stop predicate of BREAKPOINT. See
  24690. 'set-breakpoint-stop!' below in this section.
  24691. -- Scheme Procedure: set-breakpoint-stop! breakpoint procedure|#f
  24692. Set the stop predicate of BREAKPOINT. The predicate PROCEDURE
  24693. takes one argument: the <gdb:breakpoint> object. If this predicate
  24694. is set to a procedure then it is invoked whenever the inferior
  24695. reaches this breakpoint. If it returns '#t', or any non-'#f'
  24696. value, then the inferior is stopped, otherwise the inferior will
  24697. continue.
  24698. If there are multiple breakpoints at the same location with a
  24699. 'stop' predicate, each one will be called regardless of the return
  24700. status of the previous. This ensures that all 'stop' predicates
  24701. have a chance to execute at that location. In this scenario if one
  24702. of the methods returns '#t' but the others return '#f', the
  24703. inferior will still be stopped.
  24704. You should not alter the execution state of the inferior (i.e.,
  24705. step, next, etc.), alter the current frame context (i.e., change
  24706. the current active frame), or alter, add or delete any breakpoint.
  24707. As a general rule, you should not alter any data within GDB or the
  24708. inferior at this time.
  24709. Example 'stop' implementation:
  24710. (define (my-stop? bkpt)
  24711. (let ((int-val (parse-and-eval "foo")))
  24712. (value=? int-val 3)))
  24713. (define bkpt (make-breakpoint "main.c:42"))
  24714. (register-breakpoint! bkpt)
  24715. (set-breakpoint-stop! bkpt my-stop?)
  24716. -- Scheme Procedure: breakpoint-commands breakpoint
  24717. Return the commands attached to BREAKPOINT as a string, or '#f' if
  24718. there are none.
  24719. 
  24720. File: gdb.info, Node: Lazy Strings In Guile, Next: Architectures In Guile, Prev: Breakpoints In Guile, Up: Guile API
  24721. 23.3.3.20 Guile representation of lazy strings.
  24722. ...............................................
  24723. A "lazy string" is a string whose contents is not retrieved or encoded
  24724. until it is needed.
  24725. A '<gdb:lazy-string>' is represented in GDB as an 'address' that
  24726. points to a region of memory, an 'encoding' that will be used to encode
  24727. that region of memory, and a 'length' to delimit the region of memory
  24728. that represents the string. The difference between a
  24729. '<gdb:lazy-string>' and a string wrapped within a '<gdb:value>' is that
  24730. a '<gdb:lazy-string>' will be treated differently by GDB when printing.
  24731. A '<gdb:lazy-string>' is retrieved and encoded during printing, while a
  24732. '<gdb:value>' wrapping a string is immediately retrieved and encoded on
  24733. creation.
  24734. The following lazy-string-related procedures are provided by the
  24735. '(gdb)' module:
  24736. -- Scheme Procedure: lazy-string? object
  24737. Return '#t' if OBJECT is an object of type '<gdb:lazy-string>'.
  24738. Otherwise return '#f'.
  24739. -- Scheme Procedure: lazy-string-address lazy-sring
  24740. Return the address of LAZY-STRING.
  24741. -- Scheme Procedure: lazy-string-length lazy-string
  24742. Return the length of LAZY-STRING in characters. If the length is
  24743. -1, then the string will be fetched and encoded up to the first
  24744. null of appropriate width.
  24745. -- Scheme Procedure: lazy-string-encoding lazy-string
  24746. Return the encoding that will be applied to LAZY-STRING when the
  24747. string is printed by GDB. If the encoding is not set, or contains
  24748. an empty string, then GDB will select the most appropriate encoding
  24749. when the string is printed.
  24750. -- Scheme Procedure: lazy-string-type lazy-string
  24751. Return the type that is represented by LAZY-STRING's type. For a
  24752. lazy string this is a pointer or array type. To resolve this to
  24753. the lazy string's character type, use 'type-target-type'. *Note
  24754. Types In Guile::.
  24755. -- Scheme Procedure: lazy-string->value lazy-string
  24756. Convert the '<gdb:lazy-string>' to a '<gdb:value>'. This value
  24757. will point to the string in memory, but will lose all the delayed
  24758. retrieval, encoding and handling that GDB applies to a
  24759. '<gdb:lazy-string>'.
  24760. 
  24761. File: gdb.info, Node: Architectures In Guile, Next: Disassembly In Guile, Prev: Lazy Strings In Guile, Up: Guile API
  24762. 23.3.3.21 Guile representation of architectures
  24763. ...............................................
  24764. GDB uses architecture specific parameters and artifacts in a number of
  24765. its various computations. An architecture is represented by an instance
  24766. of the '<gdb:arch>' class.
  24767. The following architecture-related procedures are provided by the
  24768. '(gdb)' module:
  24769. -- Scheme Procedure: arch? object
  24770. Return '#t' if OBJECT is an object of type '<gdb:arch>'. Otherwise
  24771. return '#f'.
  24772. -- Scheme Procedure: current-arch
  24773. Return the current architecture as a '<gdb:arch>' object.
  24774. -- Scheme Procedure: arch-name arch
  24775. Return the name (string value) of '<gdb:arch>' ARCH.
  24776. -- Scheme Procedure: arch-charset arch
  24777. Return name of target character set of '<gdb:arch>' ARCH.
  24778. -- Scheme Procedure: arch-wide-charset
  24779. Return name of target wide character set of '<gdb:arch>' ARCH.
  24780. Each architecture provides a set of predefined types, obtained by the
  24781. following functions.
  24782. -- Scheme Procedure: arch-void-type arch
  24783. Return the '<gdb:type>' object for a 'void' type of architecture
  24784. ARCH.
  24785. -- Scheme Procedure: arch-char-type arch
  24786. Return the '<gdb:type>' object for a 'char' type of architecture
  24787. ARCH.
  24788. -- Scheme Procedure: arch-short-type arch
  24789. Return the '<gdb:type>' object for a 'short' type of architecture
  24790. ARCH.
  24791. -- Scheme Procedure: arch-int-type arch
  24792. Return the '<gdb:type>' object for an 'int' type of architecture
  24793. ARCH.
  24794. -- Scheme Procedure: arch-long-type arch
  24795. Return the '<gdb:type>' object for a 'long' type of architecture
  24796. ARCH.
  24797. -- Scheme Procedure: arch-schar-type arch
  24798. Return the '<gdb:type>' object for a 'signed char' type of
  24799. architecture ARCH.
  24800. -- Scheme Procedure: arch-uchar-type arch
  24801. Return the '<gdb:type>' object for an 'unsigned char' type of
  24802. architecture ARCH.
  24803. -- Scheme Procedure: arch-ushort-type arch
  24804. Return the '<gdb:type>' object for an 'unsigned short' type of
  24805. architecture ARCH.
  24806. -- Scheme Procedure: arch-uint-type arch
  24807. Return the '<gdb:type>' object for an 'unsigned int' type of
  24808. architecture ARCH.
  24809. -- Scheme Procedure: arch-ulong-type arch
  24810. Return the '<gdb:type>' object for an 'unsigned long' type of
  24811. architecture ARCH.
  24812. -- Scheme Procedure: arch-float-type arch
  24813. Return the '<gdb:type>' object for a 'float' type of architecture
  24814. ARCH.
  24815. -- Scheme Procedure: arch-double-type arch
  24816. Return the '<gdb:type>' object for a 'double' type of architecture
  24817. ARCH.
  24818. -- Scheme Procedure: arch-longdouble-type arch
  24819. Return the '<gdb:type>' object for a 'long double' type of
  24820. architecture ARCH.
  24821. -- Scheme Procedure: arch-bool-type arch
  24822. Return the '<gdb:type>' object for a 'bool' type of architecture
  24823. ARCH.
  24824. -- Scheme Procedure: arch-longlong-type arch
  24825. Return the '<gdb:type>' object for a 'long long' type of
  24826. architecture ARCH.
  24827. -- Scheme Procedure: arch-ulonglong-type arch
  24828. Return the '<gdb:type>' object for an 'unsigned long long' type of
  24829. architecture ARCH.
  24830. -- Scheme Procedure: arch-int8-type arch
  24831. Return the '<gdb:type>' object for an 'int8' type of architecture
  24832. ARCH.
  24833. -- Scheme Procedure: arch-uint8-type arch
  24834. Return the '<gdb:type>' object for a 'uint8' type of architecture
  24835. ARCH.
  24836. -- Scheme Procedure: arch-int16-type arch
  24837. Return the '<gdb:type>' object for an 'int16' type of architecture
  24838. ARCH.
  24839. -- Scheme Procedure: arch-uint16-type arch
  24840. Return the '<gdb:type>' object for a 'uint16' type of architecture
  24841. ARCH.
  24842. -- Scheme Procedure: arch-int32-type arch
  24843. Return the '<gdb:type>' object for an 'int32' type of architecture
  24844. ARCH.
  24845. -- Scheme Procedure: arch-uint32-type arch
  24846. Return the '<gdb:type>' object for a 'uint32' type of architecture
  24847. ARCH.
  24848. -- Scheme Procedure: arch-int64-type arch
  24849. Return the '<gdb:type>' object for an 'int64' type of architecture
  24850. ARCH.
  24851. -- Scheme Procedure: arch-uint64-type arch
  24852. Return the '<gdb:type>' object for a 'uint64' type of architecture
  24853. ARCH.
  24854. Example:
  24855. (gdb) guile (type-name (arch-uchar-type (current-arch)))
  24856. "unsigned char"
  24857. 
  24858. File: gdb.info, Node: Disassembly In Guile, Next: I/O Ports in Guile, Prev: Architectures In Guile, Up: Guile API
  24859. 23.3.3.22 Disassembly In Guile
  24860. ..............................
  24861. The disassembler can be invoked from Scheme code. Furthermore, the
  24862. disassembler can take a Guile port as input, allowing one to disassemble
  24863. from any source, and not just target memory.
  24864. -- Scheme Procedure: arch-disassemble arch start-pc [#:port port]
  24865. [#:offset offset] [#:size size] [#:count count]
  24866. Return a list of disassembled instructions starting from the memory
  24867. address START-PC.
  24868. The optional argument PORT specifies the input port to read bytes
  24869. from. If PORT is '#f' then bytes are read from target memory.
  24870. The optional argument OFFSET specifies the address offset of the
  24871. first byte in PORT. This is useful, for example, when PORT
  24872. specifies a 'bytevector' and you want the bytevector to be
  24873. disassembled as if it came from that address. The START-PC passed
  24874. to the reader for PORT is offset by the same amount.
  24875. Example:
  24876. (gdb) guile (use-modules (rnrs io ports))
  24877. (gdb) guile (define pc (value->integer (parse-and-eval "$pc")))
  24878. (gdb) guile (define mem (open-memory #:start pc))
  24879. (gdb) guile (define bv (get-bytevector-n mem 10))
  24880. (gdb) guile (define bv-port (open-bytevector-input-port bv))
  24881. (gdb) guile (define arch (current-arch))
  24882. (gdb) guile (arch-disassemble arch pc #:port bv-port #:offset pc)
  24883. (((address . 4195516) (asm . "mov $0x4005c8,%edi") (length . 5)))
  24884. The optional arguments SIZE and COUNT determine the number of
  24885. instructions in the returned list. If either SIZE or COUNT is
  24886. specified as zero, then no instructions are disassembled and an
  24887. empty list is returned. If both the optional arguments SIZE and
  24888. COUNT are specified, then a list of at most COUNT disassembled
  24889. instructions whose start address falls in the closed memory address
  24890. interval from START-PC to (START-PC + SIZE - 1) are returned. If
  24891. SIZE is not specified, but COUNT is specified, then COUNT number of
  24892. instructions starting from the address START-PC are returned. If
  24893. COUNT is not specified but SIZE is specified, then all instructions
  24894. whose start address falls in the closed memory address interval
  24895. from START-PC to (START-PC + SIZE - 1) are returned. If neither
  24896. SIZE nor COUNT are specified, then a single instruction at START-PC
  24897. is returned.
  24898. Each element of the returned list is an alist (associative list)
  24899. with the following keys:
  24900. 'address'
  24901. The value corresponding to this key is a Guile integer of the
  24902. memory address of the instruction.
  24903. 'asm'
  24904. The value corresponding to this key is a string value which
  24905. represents the instruction with assembly language mnemonics.
  24906. The assembly language flavor used is the same as that
  24907. specified by the current CLI variable 'disassembly-flavor'.
  24908. *Note Machine Code::.
  24909. 'length'
  24910. The value corresponding to this key is the length of the
  24911. instruction in bytes.
  24912. 
  24913. File: gdb.info, Node: I/O Ports in Guile, Next: Memory Ports in Guile, Prev: Disassembly In Guile, Up: Guile API
  24914. 23.3.3.23 I/O Ports in Guile
  24915. ............................
  24916. -- Scheme Procedure: input-port
  24917. Return GDB's input port as a Guile port object.
  24918. -- Scheme Procedure: output-port
  24919. Return GDB's output port as a Guile port object.
  24920. -- Scheme Procedure: error-port
  24921. Return GDB's error port as a Guile port object.
  24922. -- Scheme Procedure: stdio-port? object
  24923. Return '#t' if OBJECT is a GDB stdio port. Otherwise return '#f'.
  24924. 
  24925. File: gdb.info, Node: Memory Ports in Guile, Next: Iterators In Guile, Prev: I/O Ports in Guile, Up: Guile API
  24926. 23.3.3.24 Memory Ports in Guile
  24927. ...............................
  24928. GDB provides a 'port' interface to target memory. This allows Guile
  24929. code to read/write target memory using Guile's port and bytevector
  24930. functionality. The main routine is 'open-memory' which returns a port
  24931. object. One can then read/write memory using that object.
  24932. -- Scheme Procedure: open-memory [#:mode mode] [#:start address]
  24933. [#:size size]
  24934. Return a port object that can be used for reading and writing
  24935. memory. The port will be open according to MODE, which is the
  24936. standard mode argument to Guile port open routines, except that the
  24937. '"a"' and '"l"' modes are not supported. *Note (guile)File
  24938. Ports::. The '"b"' (binary) character may be present, but is
  24939. ignored: memory ports are binary only. If '"0"' is appended then
  24940. the port is marked as unbuffered. The default is '"r"', read-only
  24941. and buffered.
  24942. The chunk of memory that can be accessed can be bounded. If both
  24943. START and SIZE are unspecified, all of memory can be accessed. If
  24944. only START is specified, all of memory from that point on can be
  24945. accessed. If only SIZE if specified, all memory in the range
  24946. [0,SIZE) can be accessed. If both are specified, all memory in the
  24947. rane [START,START+SIZE) can be accessed.
  24948. -- Scheme Procedure: memory-port?
  24949. Return '#t' if OBJECT is an object of type '<gdb:memory-port>'.
  24950. Otherwise return '#f'.
  24951. -- Scheme Procedure: memory-port-range memory-port
  24952. Return the range of '<gdb:memory-port>' MEMORY-PORT as a list of
  24953. two elements: '(start end)'. The range is START to END inclusive.
  24954. -- Scheme Procedure: memory-port-read-buffer-size memory-port
  24955. Return the size of the read buffer of '<gdb:memory-port>'
  24956. MEMORY-PORT.
  24957. This procedure is deprecated and will be removed in GDB 11. It
  24958. returns 0 when using Guile 2.2 or later.
  24959. -- Scheme Procedure: set-memory-port-read-buffer-size! memory-port size
  24960. Set the size of the read buffer of '<gdb:memory-port>' MEMORY-PORT
  24961. to SIZE. The result is unspecified.
  24962. This procedure is deprecated and will be removed in GDB 11. When
  24963. GDB is built with Guile 2.2 or later, you can call 'setvbuf'
  24964. instead (*note 'setvbuf': (guile)Buffering.).
  24965. -- Scheme Procedure: memory-port-write-buffer-size memory-port
  24966. Return the size of the write buffer of '<gdb:memory-port>'
  24967. MEMORY-PORT.
  24968. This procedure is deprecated and will be removed in GDB 11. It
  24969. returns 0 when GDB is built with Guile 2.2 or later.
  24970. -- Scheme Procedure: set-memory-port-write-buffer-size! memory-port
  24971. size
  24972. Set the size of the write buffer of '<gdb:memory-port>' MEMORY-PORT
  24973. to SIZE. The result is unspecified.
  24974. This procedure is deprecated and will be removed in GDB 11. When
  24975. GDB is built with Guile 2.2 or later, you can call 'setvbuf'
  24976. instead.
  24977. A memory port is closed like any other port, with 'close-port'.
  24978. Combined with Guile's 'bytevectors', memory ports provide a lot of
  24979. utility. For example, to fill a buffer of 10 integers in memory, one
  24980. can do something like the following.
  24981. ;; In the program: int buffer[10];
  24982. (use-modules (rnrs bytevectors))
  24983. (use-modules (rnrs io ports))
  24984. (define addr (parse-and-eval "buffer"))
  24985. (define n 10)
  24986. (define byte-size (* n 4))
  24987. (define mem-port (open-memory #:mode "r+" #:start
  24988. (value->integer addr) #:size byte-size))
  24989. (define byte-vec (make-bytevector byte-size))
  24990. (do ((i 0 (+ i 1)))
  24991. ((>= i n))
  24992. (bytevector-s32-native-set! byte-vec (* i 4) (* i 42)))
  24993. (put-bytevector mem-port byte-vec)
  24994. (close-port mem-port)
  24995. 
  24996. File: gdb.info, Node: Iterators In Guile, Prev: Memory Ports in Guile, Up: Guile API
  24997. 23.3.3.25 Iterators In Guile
  24998. ............................
  24999. A simple iterator facility is provided to allow, for example, iterating
  25000. over the set of program symbols without having to first construct a list
  25001. of all of them. A useful contribution would be to add support for SRFI
  25002. 41 and SRFI 45.
  25003. -- Scheme Procedure: make-iterator object progress next!
  25004. A '<gdb:iterator>' object is constructed with the 'make-iterator'
  25005. procedure. It takes three arguments: the object to be iterated
  25006. over, an object to record the progress of the iteration, and a
  25007. procedure to return the next element in the iteration, or an
  25008. implementation chosen value to denote the end of iteration.
  25009. By convention, end of iteration is marked with
  25010. '(end-of-iteration)', and may be tested with the
  25011. 'end-of-iteration?' predicate. The result of '(end-of-iteration)'
  25012. is chosen so that it is not otherwise used by the '(gdb)' module.
  25013. If you are using '<gdb:iterator>' in your own code it is your
  25014. responsibility to maintain this invariant.
  25015. A trivial example for illustration's sake:
  25016. (use-modules (gdb iterator))
  25017. (define my-list (list 1 2 3))
  25018. (define iter
  25019. (make-iterator my-list my-list
  25020. (lambda (iter)
  25021. (let ((l (iterator-progress iter)))
  25022. (if (eq? l '())
  25023. (end-of-iteration)
  25024. (begin
  25025. (set-iterator-progress! iter (cdr l))
  25026. (car l)))))))
  25027. Here is a slightly more realistic example, which computes a list of
  25028. all the functions in 'my-global-block'.
  25029. (use-modules (gdb iterator))
  25030. (define this-sal (find-pc-line (frame-pc (selected-frame))))
  25031. (define this-symtab (sal-symtab this-sal))
  25032. (define this-global-block (symtab-global-block this-symtab))
  25033. (define syms-iter (make-block-symbols-iterator this-global-block))
  25034. (define functions (iterator-filter symbol-function? syms-iter))
  25035. -- Scheme Procedure: iterator? object
  25036. Return '#t' if OBJECT is a '<gdb:iterator>' object. Otherwise
  25037. return '#f'.
  25038. -- Scheme Procedure: iterator-object iterator
  25039. Return the first argument that was passed to 'make-iterator'. This
  25040. is the object being iterated over.
  25041. -- Scheme Procedure: iterator-progress iterator
  25042. Return the object tracking iteration progress.
  25043. -- Scheme Procedure: set-iterator-progress! iterator new-value
  25044. Set the object tracking iteration progress.
  25045. -- Scheme Procedure: iterator-next! iterator
  25046. Invoke the procedure that was the third argument to
  25047. 'make-iterator', passing it one argument, the '<gdb:iterator>'
  25048. object. The result is either the next element in the iteration, or
  25049. an end marker as implemented by the 'next!' procedure. By
  25050. convention the end marker is the result of '(end-of-iteration)'.
  25051. -- Scheme Procedure: end-of-iteration
  25052. Return the Scheme object that denotes end of iteration.
  25053. -- Scheme Procedure: end-of-iteration? object
  25054. Return '#t' if OBJECT is the end of iteration marker. Otherwise
  25055. return '#f'.
  25056. These functions are provided by the '(gdb iterator)' module to assist
  25057. in using iterators.
  25058. -- Scheme Procedure: make-list-iterator list
  25059. Return a '<gdb:iterator>' object that will iterate over LIST.
  25060. -- Scheme Procedure: iterator->list iterator
  25061. Return the elements pointed to by ITERATOR as a list.
  25062. -- Scheme Procedure: iterator-map proc iterator
  25063. Return the list of objects obtained by applying PROC to the object
  25064. pointed to by ITERATOR and to each subsequent object.
  25065. -- Scheme Procedure: iterator-for-each proc iterator
  25066. Apply PROC to each element pointed to by ITERATOR. The result is
  25067. unspecified.
  25068. -- Scheme Procedure: iterator-filter pred iterator
  25069. Return the list of elements pointed to by ITERATOR that satisfy
  25070. PRED.
  25071. -- Scheme Procedure: iterator-until pred iterator
  25072. Run ITERATOR until the result of '(pred element)' is true and
  25073. return that as the result. Otherwise return '#f'.
  25074. 
  25075. File: gdb.info, Node: Guile Auto-loading, Next: Guile Modules, Prev: Guile API, Up: Guile
  25076. 23.3.4 Guile Auto-loading
  25077. -------------------------
  25078. When a new object file is read (for example, due to the 'file' command,
  25079. or because the inferior has loaded a shared library), GDB will look for
  25080. Guile support scripts in two ways: 'OBJFILE-gdb.scm' and the
  25081. '.debug_gdb_scripts' section. *Note Auto-loading extensions::.
  25082. The auto-loading feature is useful for supplying application-specific
  25083. debugging commands and scripts.
  25084. Auto-loading can be enabled or disabled, and the list of auto-loaded
  25085. scripts can be printed.
  25086. 'set auto-load guile-scripts [on|off]'
  25087. Enable or disable the auto-loading of Guile scripts.
  25088. 'show auto-load guile-scripts'
  25089. Show whether auto-loading of Guile scripts is enabled or disabled.
  25090. 'info auto-load guile-scripts [REGEXP]'
  25091. Print the list of all Guile scripts that GDB auto-loaded.
  25092. Also printed is the list of Guile scripts that were mentioned in
  25093. the '.debug_gdb_scripts' section and were not found. This is
  25094. useful because their names are not printed when GDB tries to load
  25095. them and fails. There may be many of them, and printing an error
  25096. message for each one is problematic.
  25097. If REGEXP is supplied only Guile scripts with matching names are
  25098. printed.
  25099. Example:
  25100. (gdb) info auto-load guile-scripts
  25101. Loaded Script
  25102. Yes scm-section-script.scm
  25103. full name: /tmp/scm-section-script.scm
  25104. No my-foo-pretty-printers.scm
  25105. When reading an auto-loaded file, GDB sets the "current objfile".
  25106. This is available via the 'current-objfile' procedure (*note Objfiles In
  25107. Guile::). This can be useful for registering objfile-specific
  25108. pretty-printers.
  25109. 
  25110. File: gdb.info, Node: Guile Modules, Prev: Guile Auto-loading, Up: Guile
  25111. 23.3.5 Guile Modules
  25112. --------------------
  25113. GDB comes with several modules to assist writing Guile code.
  25114. * Menu:
  25115. * Guile Printing Module:: Building and registering pretty-printers
  25116. * Guile Types Module:: Utilities for working with types
  25117. 
  25118. File: gdb.info, Node: Guile Printing Module, Next: Guile Types Module, Up: Guile Modules
  25119. 23.3.5.1 Guile Printing Module
  25120. ..............................
  25121. This module provides a collection of utilities for working with
  25122. pretty-printers.
  25123. Usage:
  25124. (use-modules (gdb printing))
  25125. -- Scheme Procedure: prepend-pretty-printer! object printer
  25126. Add PRINTER to the front of the list of pretty-printers for OBJECT.
  25127. The OBJECT must either be a '<gdb:objfile>' object, or '#f' in
  25128. which case PRINTER is added to the global list of printers.
  25129. -- Scheme Procecure: append-pretty-printer! object printer
  25130. Add PRINTER to the end of the list of pretty-printers for OBJECT.
  25131. The OBJECT must either be a '<gdb:objfile>' object, or '#f' in
  25132. which case PRINTER is added to the global list of printers.
  25133. 
  25134. File: gdb.info, Node: Guile Types Module, Prev: Guile Printing Module, Up: Guile Modules
  25135. 23.3.5.2 Guile Types Module
  25136. ...........................
  25137. This module provides a collection of utilities for working with
  25138. '<gdb:type>' objects.
  25139. Usage:
  25140. (use-modules (gdb types))
  25141. -- Scheme Procedure: get-basic-type type
  25142. Return TYPE with const and volatile qualifiers stripped, and with
  25143. typedefs and C++ references converted to the underlying type.
  25144. C++ example:
  25145. typedef const int const_int;
  25146. const_int foo (3);
  25147. const_int& foo_ref (foo);
  25148. int main () { return 0; }
  25149. Then in gdb:
  25150. (gdb) start
  25151. (gdb) guile (use-modules (gdb) (gdb types))
  25152. (gdb) guile (define foo-ref (parse-and-eval "foo_ref"))
  25153. (gdb) guile (get-basic-type (value-type foo-ref))
  25154. int
  25155. -- Scheme Procedure: type-has-field-deep? type field
  25156. Return '#t' if TYPE, assumed to be a type with fields (e.g., a
  25157. structure or union), has field FIELD. Otherwise return '#f'. This
  25158. searches baseclasses, whereas 'type-has-field?' does not.
  25159. -- Scheme Procedure: make-enum-hashtable enum-type
  25160. Return a Guile hash table produced from ENUM-TYPE. Elements in the
  25161. hash table are referenced with 'hashq-ref'.
  25162. 
  25163. File: gdb.info, Node: Auto-loading extensions, Next: Multiple Extension Languages, Prev: Guile, Up: Extending GDB
  25164. 23.4 Auto-loading extensions
  25165. ============================
  25166. GDB provides two mechanisms for automatically loading extensions when a
  25167. new object file is read (for example, due to the 'file' command, or
  25168. because the inferior has loaded a shared library): 'OBJFILE-gdb.EXT' and
  25169. the '.debug_gdb_scripts' section of modern file formats like ELF.
  25170. * Menu:
  25171. * objfile-gdb.ext file: objfile-gdbdotext file. The 'OBJFILE-gdb.EXT' file
  25172. * .debug_gdb_scripts section: dotdebug_gdb_scripts section. The '.debug_gdb_scripts' section
  25173. * Which flavor to choose?::
  25174. The auto-loading feature is useful for supplying application-specific
  25175. debugging commands and features.
  25176. Auto-loading can be enabled or disabled, and the list of auto-loaded
  25177. scripts can be printed. See the 'auto-loading' section of each
  25178. extension language for more information. For GDB command files see
  25179. *note Auto-loading sequences::. For Python files see *note Python
  25180. Auto-loading::.
  25181. Note that loading of this script file also requires accordingly
  25182. configured 'auto-load safe-path' (*note Auto-loading safe path::).
  25183. 
  25184. File: gdb.info, Node: objfile-gdbdotext file, Next: dotdebug_gdb_scripts section, Up: Auto-loading extensions
  25185. 23.4.1 The 'OBJFILE-gdb.EXT' file
  25186. ---------------------------------
  25187. When a new object file is read, GDB looks for a file named
  25188. 'OBJFILE-gdb.EXT' (we call it SCRIPT-NAME below), where OBJFILE is the
  25189. object file's name and where EXT is the file extension for the extension
  25190. language:
  25191. 'OBJFILE-gdb.gdb'
  25192. GDB's own command language
  25193. 'OBJFILE-gdb.py'
  25194. Python
  25195. 'OBJFILE-gdb.scm'
  25196. Guile
  25197. SCRIPT-NAME is formed by ensuring that the file name of OBJFILE is
  25198. absolute, following all symlinks, and resolving '.' and '..' components,
  25199. and appending the '-gdb.EXT' suffix. If this file exists and is
  25200. readable, GDB will evaluate it as a script in the specified extension
  25201. language.
  25202. If this file does not exist, then GDB will look for SCRIPT-NAME file
  25203. in all of the directories as specified below. (On MS-Windows/MS-DOS,
  25204. the drive letter of the executable's leading directories is converted to
  25205. a one-letter subdirectory, i.e. 'd:/usr/bin/' is converted to
  25206. '/d/usr/bin/', because Windows filesystems disallow colons in file
  25207. names.)
  25208. Note that loading of these files requires an accordingly configured
  25209. 'auto-load safe-path' (*note Auto-loading safe path::).
  25210. For object files using '.exe' suffix GDB tries to load first the
  25211. scripts normally according to its '.exe' filename. But if no scripts
  25212. are found GDB also tries script filenames matching the object file
  25213. without its '.exe' suffix. This '.exe' stripping is case insensitive
  25214. and it is attempted on any platform. This makes the script filenames
  25215. compatible between Unix and MS-Windows hosts.
  25216. 'set auto-load scripts-directory [DIRECTORIES]'
  25217. Control GDB auto-loaded scripts location. Multiple directory
  25218. entries may be delimited by the host platform path separator in use
  25219. (':' on Unix, ';' on MS-Windows and MS-DOS).
  25220. Each entry here needs to be covered also by the security setting
  25221. 'set auto-load safe-path' (*note set auto-load safe-path::).
  25222. This variable defaults to '$debugdir:$datadir/auto-load'. The
  25223. default 'set auto-load safe-path' value can be also overriden by
  25224. GDB configuration option '--with-auto-load-dir'.
  25225. Any reference to '$debugdir' will get replaced by
  25226. DEBUG-FILE-DIRECTORY value (*note Separate Debug Files::) and any
  25227. reference to '$datadir' will get replaced by DATA-DIRECTORY which
  25228. is determined at GDB startup (*note Data Files::). '$debugdir' and
  25229. '$datadir' must be placed as a directory component -- either alone
  25230. or delimited by '/' or '\' directory separators, depending on the
  25231. host platform.
  25232. The list of directories uses path separator (':' on GNU and Unix
  25233. systems, ';' on MS-Windows and MS-DOS) to separate directories,
  25234. similarly to the 'PATH' environment variable.
  25235. 'show auto-load scripts-directory'
  25236. Show GDB auto-loaded scripts location.
  25237. 'add-auto-load-scripts-directory [DIRECTORIES...]'
  25238. Add an entry (or list of entries) to the list of auto-loaded
  25239. scripts locations. Multiple entries may be delimited by the host
  25240. platform path separator in use.
  25241. GDB does not track which files it has already auto-loaded this way.
  25242. GDB will load the associated script every time the corresponding OBJFILE
  25243. is opened. So your '-gdb.EXT' file should be careful to avoid errors if
  25244. it is evaluated more than once.
  25245. 
  25246. File: gdb.info, Node: dotdebug_gdb_scripts section, Next: Which flavor to choose?, Prev: objfile-gdbdotext file, Up: Auto-loading extensions
  25247. 23.4.2 The '.debug_gdb_scripts' section
  25248. ---------------------------------------
  25249. For systems using file formats like ELF and COFF, when GDB loads a new
  25250. object file it will look for a special section named
  25251. '.debug_gdb_scripts'. If this section exists, its contents is a list of
  25252. null-terminated entries specifying scripts to load. Each entry begins
  25253. with a non-null prefix byte that specifies the kind of entry, typically
  25254. the extension language and whether the script is in a file or inlined in
  25255. '.debug_gdb_scripts'.
  25256. The following entries are supported:
  25257. 'SECTION_SCRIPT_ID_PYTHON_FILE = 1'
  25258. 'SECTION_SCRIPT_ID_SCHEME_FILE = 3'
  25259. 'SECTION_SCRIPT_ID_PYTHON_TEXT = 4'
  25260. 'SECTION_SCRIPT_ID_SCHEME_TEXT = 6'
  25261. 23.4.2.1 Script File Entries
  25262. ............................
  25263. If the entry specifies a file, GDB will look for the file first in the
  25264. current directory and then along the source search path (*note
  25265. Specifying Source Directories: Source Path.), except that '$cdir' is not
  25266. searched, since the compilation directory is not relevant to scripts.
  25267. File entries can be placed in section '.debug_gdb_scripts' with, for
  25268. example, this GCC macro for Python scripts.
  25269. /* Note: The "MS" section flags are to remove duplicates. */
  25270. #define DEFINE_GDB_PY_SCRIPT(script_name) \
  25271. asm("\
  25272. .pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n\
  25273. .byte 1 /* Python */\n\
  25274. .asciz \"" script_name "\"\n\
  25275. .popsection \n\
  25276. ");
  25277. For Guile scripts, replace '.byte 1' with '.byte 3'. Then one can
  25278. reference the macro in a header or source file like this:
  25279. DEFINE_GDB_PY_SCRIPT ("my-app-scripts.py")
  25280. The script name may include directories if desired.
  25281. Note that loading of this script file also requires accordingly
  25282. configured 'auto-load safe-path' (*note Auto-loading safe path::).
  25283. If the macro invocation is put in a header, any application or
  25284. library using this header will get a reference to the specified script,
  25285. and with the use of '"MS"' attributes on the section, the linker will
  25286. remove duplicates.
  25287. 23.4.2.2 Script Text Entries
  25288. ............................
  25289. Script text entries allow to put the executable script in the entry
  25290. itself instead of loading it from a file. The first line of the entry,
  25291. everything after the prefix byte and up to the first newline ('0xa')
  25292. character, is the script name, and must not contain any kind of space
  25293. character, e.g., spaces or tabs. The rest of the entry, up to the
  25294. trailing null byte, is the script to execute in the specified language.
  25295. The name needs to be unique among all script names, as GDB executes each
  25296. script only once based on its name.
  25297. Here is an example from file 'py-section-script.c' in the GDB
  25298. testsuite.
  25299. #include "symcat.h"
  25300. #include "gdb/section-scripts.h"
  25301. asm(
  25302. ".pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n"
  25303. ".byte " XSTRING (SECTION_SCRIPT_ID_PYTHON_TEXT) "\n"
  25304. ".ascii \"gdb.inlined-script\\n\"\n"
  25305. ".ascii \"class test_cmd (gdb.Command):\\n\"\n"
  25306. ".ascii \" def __init__ (self):\\n\"\n"
  25307. ".ascii \" super (test_cmd, self).__init__ ("
  25308. "\\\"test-cmd\\\", gdb.COMMAND_OBSCURE)\\n\"\n"
  25309. ".ascii \" def invoke (self, arg, from_tty):\\n\"\n"
  25310. ".ascii \" print (\\\"test-cmd output, arg = %s\\\" % arg)\\n\"\n"
  25311. ".ascii \"test_cmd ()\\n\"\n"
  25312. ".byte 0\n"
  25313. ".popsection\n"
  25314. );
  25315. Loading of inlined scripts requires a properly configured 'auto-load
  25316. safe-path' (*note Auto-loading safe path::). The path to specify in
  25317. 'auto-load safe-path' is the path of the file containing the
  25318. '.debug_gdb_scripts' section.
  25319. 
  25320. File: gdb.info, Node: Which flavor to choose?, Prev: dotdebug_gdb_scripts section, Up: Auto-loading extensions
  25321. 23.4.3 Which flavor to choose?
  25322. ------------------------------
  25323. Given the multiple ways of auto-loading extensions, it might not always
  25324. be clear which one to choose. This section provides some guidance.
  25325. Benefits of the '-gdb.EXT' way:
  25326. * Can be used with file formats that don't support multiple sections.
  25327. * Ease of finding scripts for public libraries.
  25328. Scripts specified in the '.debug_gdb_scripts' section are searched
  25329. for in the source search path. For publicly installed libraries,
  25330. e.g., 'libstdc++', there typically isn't a source directory in
  25331. which to find the script.
  25332. * Doesn't require source code additions.
  25333. Benefits of the '.debug_gdb_scripts' way:
  25334. * Works with static linking.
  25335. Scripts for libraries done the '-gdb.EXT' way require an objfile to
  25336. trigger their loading. When an application is statically linked
  25337. the only objfile available is the executable, and it is cumbersome
  25338. to attach all the scripts from all the input libraries to the
  25339. executable's '-gdb.EXT' script.
  25340. * Works with classes that are entirely inlined.
  25341. Some classes can be entirely inlined, and thus there may not be an
  25342. associated shared library to attach a '-gdb.EXT' script to.
  25343. * Scripts needn't be copied out of the source tree.
  25344. In some circumstances, apps can be built out of large collections
  25345. of internal libraries, and the build infrastructure necessary to
  25346. install the '-gdb.EXT' scripts in a place where GDB can find them
  25347. is cumbersome. It may be easier to specify the scripts in the
  25348. '.debug_gdb_scripts' section as relative paths, and add a path to
  25349. the top of the source tree to the source search path.
  25350. 
  25351. File: gdb.info, Node: Multiple Extension Languages, Next: Aliases, Prev: Auto-loading extensions, Up: Extending GDB
  25352. 23.5 Multiple Extension Languages
  25353. =================================
  25354. The Guile and Python extension languages do not share any state, and
  25355. generally do not interfere with each other. There are some things to be
  25356. aware of, however.
  25357. 23.5.1 Python comes first
  25358. -------------------------
  25359. Python was GDB's first extension language, and to avoid breaking
  25360. existing behaviour Python comes first. This is generally solved by the
  25361. "first one wins" principle. GDB maintains a list of enabled extension
  25362. languages, and when it makes a call to an extension language, (say to
  25363. pretty-print a value), it tries each in turn until an extension language
  25364. indicates it has performed the request (e.g., has returned the
  25365. pretty-printed form of a value). This extends to errors while
  25366. performing such requests: If an error happens while, for example, trying
  25367. to pretty-print an object then the error is reported and any following
  25368. extension languages are not tried.
  25369. 
  25370. File: gdb.info, Node: Aliases, Prev: Multiple Extension Languages, Up: Extending GDB
  25371. 23.6 Creating new spellings of existing commands
  25372. ================================================
  25373. It is often useful to define alternate spellings of existing commands.
  25374. For example, if a new GDB command defined in Python has a long name to
  25375. type, it is handy to have an abbreviated version of it that involves
  25376. less typing.
  25377. GDB itself uses aliases. For example 's' is an alias of the 'step'
  25378. command even though it is otherwise an ambiguous abbreviation of other
  25379. commands like 'set' and 'show'.
  25380. Aliases are also used to provide shortened or more common versions of
  25381. multi-word commands. For example, GDB provides the 'tty' alias of the
  25382. 'set inferior-tty' command.
  25383. You can define a new alias with the 'alias' command.
  25384. 'alias [-a] [--] ALIAS = COMMAND [DEFAULT-ARGS...]'
  25385. ALIAS specifies the name of the new alias. Each word of ALIAS must
  25386. consist of letters, numbers, dashes and underscores.
  25387. COMMAND specifies the name of an existing command that is being
  25388. aliased.
  25389. COMMAND can also be the name of an existing alias. In this case,
  25390. COMMAND cannot be an alias that has default arguments.
  25391. The '-a' option specifies that the new alias is an abbreviation of
  25392. the command. Abbreviations are not used in command completion.
  25393. The '--' option specifies the end of options, and is useful when
  25394. ALIAS begins with a dash.
  25395. You can specify DEFAULT-ARGS for your alias. These DEFAULT-ARGS will
  25396. be automatically added before the alias arguments typed explicitly on
  25397. the command line.
  25398. For example, the below defines an alias 'btfullall' that shows all
  25399. local variables and all frame arguments:
  25400. (gdb) alias btfullall = backtrace -full -frame-arguments all
  25401. For more information about DEFAULT-ARGS, see *note Automatically
  25402. prepend default arguments to user-defined aliases: Command aliases
  25403. default args.
  25404. Here is a simple example showing how to make an abbreviation of a
  25405. command so that there is less to type. Suppose you were tired of typing
  25406. 'disas', the current shortest unambiguous abbreviation of the
  25407. 'disassemble' command and you wanted an even shorter version named 'di'.
  25408. The following will accomplish this.
  25409. (gdb) alias -a di = disas
  25410. Note that aliases are different from user-defined commands. With a
  25411. user-defined command, you also need to write documentation for it with
  25412. the 'document' command. An alias automatically picks up the
  25413. documentation of the existing command.
  25414. Here is an example where we make 'elms' an abbreviation of 'elements'
  25415. in the 'set print elements' command. This is to show that you can make
  25416. an abbreviation of any part of a command.
  25417. (gdb) alias -a set print elms = set print elements
  25418. (gdb) alias -a show print elms = show print elements
  25419. (gdb) set p elms 20
  25420. (gdb) show p elms
  25421. Limit on string chars or array elements to print is 200.
  25422. Note that if you are defining an alias of a 'set' command, and you
  25423. want to have an alias for the corresponding 'show' command, then you
  25424. need to define the latter separately.
  25425. Unambiguously abbreviated commands are allowed in COMMAND and ALIAS,
  25426. just as they are normally.
  25427. (gdb) alias -a set pr elms = set p ele
  25428. Finally, here is an example showing the creation of a one word alias
  25429. for a more complex command. This creates alias 'spe' of the command
  25430. 'set print elements'.
  25431. (gdb) alias spe = set print elements
  25432. (gdb) spe 20
  25433. 
  25434. File: gdb.info, Node: Interpreters, Next: TUI, Prev: Extending GDB, Up: Top
  25435. 24 Command Interpreters
  25436. ***********************
  25437. GDB supports multiple command interpreters, and some command
  25438. infrastructure to allow users or user interface writers to switch
  25439. between interpreters or run commands in other interpreters.
  25440. GDB currently supports two command interpreters, the console
  25441. interpreter (sometimes called the command-line interpreter or CLI) and
  25442. the machine interface interpreter (or GDB/MI). This manual describes
  25443. both of these interfaces in great detail.
  25444. By default, GDB will start with the console interpreter. However,
  25445. the user may choose to start GDB with another interpreter by specifying
  25446. the '-i' or '--interpreter' startup options. Defined interpreters
  25447. include:
  25448. 'console'
  25449. The traditional console or command-line interpreter. This is the
  25450. most often used interpreter with GDB. With no interpreter
  25451. specified at runtime, GDB will use this interpreter.
  25452. 'mi'
  25453. The newest GDB/MI interface (currently 'mi3'). Used primarily by
  25454. programs wishing to use GDB as a backend for a debugger GUI or an
  25455. IDE. For more information, see *note The GDB/MI Interface: GDB/MI.
  25456. 'mi3'
  25457. The GDB/MI interface introduced in GDB 9.1.
  25458. 'mi2'
  25459. The GDB/MI interface introduced in GDB 6.0.
  25460. 'mi1'
  25461. The GDB/MI interface introduced in GDB 5.1.
  25462. You may execute commands in any interpreter from the current
  25463. interpreter using the appropriate command. If you are running the
  25464. console interpreter, simply use the 'interpreter-exec' command:
  25465. interpreter-exec mi "-data-list-register-names"
  25466. GDB/MI has a similar command, although it is only available in
  25467. versions of GDB which support GDB/MI version 2 (or greater).
  25468. Note that 'interpreter-exec' only changes the interpreter for the
  25469. duration of the specified command. It does not change the interpreter
  25470. permanently.
  25471. Although you may only choose a single interpreter at startup, it is
  25472. possible to run an independent interpreter on a specified input/output
  25473. device (usually a tty).
  25474. For example, consider a debugger GUI or IDE that wants to provide a
  25475. GDB console view. It may do so by embedding a terminal emulator widget
  25476. in its GUI, starting GDB in the traditional command-line mode with
  25477. stdin/stdout/stderr redirected to that terminal, and then creating an MI
  25478. interpreter running on a specified input/output device. The console
  25479. interpreter created by GDB at startup handles commands the user types in
  25480. the terminal widget, while the GUI controls and synchronizes state with
  25481. GDB using the separate MI interpreter.
  25482. To start a new secondary "user interface" running MI, use the
  25483. 'new-ui' command:
  25484. new-ui INTERPRETER TTY
  25485. The INTERPRETER parameter specifies the interpreter to run. This
  25486. accepts the same values as the 'interpreter-exec' command. For example,
  25487. 'console', 'mi', 'mi2', etc. The TTY parameter specifies the name of
  25488. the bidirectional file the interpreter uses for input/output, usually
  25489. the name of a pseudoterminal slave on Unix systems. For example:
  25490. (gdb) new-ui mi /dev/pts/9
  25491. runs an MI interpreter on '/dev/pts/9'.
  25492. 
  25493. File: gdb.info, Node: TUI, Next: Emacs, Prev: Interpreters, Up: Top
  25494. 25 GDB Text User Interface
  25495. **************************
  25496. * Menu:
  25497. * TUI Overview:: TUI overview
  25498. * TUI Keys:: TUI key bindings
  25499. * TUI Single Key Mode:: TUI single key mode
  25500. * TUI Commands:: TUI-specific commands
  25501. * TUI Configuration:: TUI configuration variables
  25502. The GDB Text User Interface (TUI) is a terminal interface which uses the
  25503. 'curses' library to show the source file, the assembly output, the
  25504. program registers and GDB commands in separate text windows. The TUI
  25505. mode is supported only on platforms where a suitable version of the
  25506. 'curses' library is available.
  25507. The TUI mode is enabled by default when you invoke GDB as 'gdb -tui'.
  25508. You can also switch in and out of TUI mode while GDB runs by using
  25509. various TUI commands and key bindings, such as 'tui enable' or 'C-x
  25510. C-a'. *Note TUI Commands: TUI Commands, and *note TUI Key Bindings: TUI
  25511. Keys.
  25512. 
  25513. File: gdb.info, Node: TUI Overview, Next: TUI Keys, Up: TUI
  25514. 25.1 TUI Overview
  25515. =================
  25516. In TUI mode, GDB can display several text windows:
  25517. _command_
  25518. This window is the GDB command window with the GDB prompt and the
  25519. GDB output. The GDB input is still managed using readline.
  25520. _source_
  25521. The source window shows the source file of the program. The
  25522. current line and active breakpoints are displayed in this window.
  25523. _assembly_
  25524. The assembly window shows the disassembly output of the program.
  25525. _register_
  25526. This window shows the processor registers. Registers are
  25527. highlighted when their values change.
  25528. The source and assembly windows show the current program position by
  25529. highlighting the current line and marking it with a '>' marker.
  25530. Breakpoints are indicated with two markers. The first marker indicates
  25531. the breakpoint type:
  25532. 'B'
  25533. Breakpoint which was hit at least once.
  25534. 'b'
  25535. Breakpoint which was never hit.
  25536. 'H'
  25537. Hardware breakpoint which was hit at least once.
  25538. 'h'
  25539. Hardware breakpoint which was never hit.
  25540. The second marker indicates whether the breakpoint is enabled or not:
  25541. '+'
  25542. Breakpoint is enabled.
  25543. '-'
  25544. Breakpoint is disabled.
  25545. The source, assembly and register windows are updated when the
  25546. current thread changes, when the frame changes, or when the program
  25547. counter changes.
  25548. These windows are not all visible at the same time. The command
  25549. window is always visible. The others can be arranged in several
  25550. layouts:
  25551. * source only,
  25552. * assembly only,
  25553. * source and assembly,
  25554. * source and registers, or
  25555. * assembly and registers.
  25556. These are the standard layouts, but other layouts can be defined.
  25557. A status line above the command window shows the following
  25558. information:
  25559. _target_
  25560. Indicates the current GDB target. (*note Specifying a Debugging
  25561. Target: Targets.).
  25562. _process_
  25563. Gives the current process or thread number. When no process is
  25564. being debugged, this field is set to 'No process'.
  25565. _function_
  25566. Gives the current function name for the selected frame. The name
  25567. is demangled if demangling is turned on (*note Print Settings::).
  25568. When there is no symbol corresponding to the current program
  25569. counter, the string '??' is displayed.
  25570. _line_
  25571. Indicates the current line number for the selected frame. When the
  25572. current line number is not known, the string '??' is displayed.
  25573. _pc_
  25574. Indicates the current program counter address.
  25575. 
  25576. File: gdb.info, Node: TUI Keys, Next: TUI Single Key Mode, Prev: TUI Overview, Up: TUI
  25577. 25.2 TUI Key Bindings
  25578. =====================
  25579. The TUI installs several key bindings in the readline keymaps (*note
  25580. Command Line Editing::). The following key bindings are installed for
  25581. both TUI mode and the GDB standard mode.
  25582. 'C-x C-a'
  25583. 'C-x a'
  25584. 'C-x A'
  25585. Enter or leave the TUI mode. When leaving the TUI mode, the curses
  25586. window management stops and GDB operates using its standard mode,
  25587. writing on the terminal directly. When reentering the TUI mode,
  25588. control is given back to the curses windows. The screen is then
  25589. refreshed.
  25590. This key binding uses the bindable Readline function
  25591. 'tui-switch-mode'.
  25592. 'C-x 1'
  25593. Use a TUI layout with only one window. The layout will either be
  25594. 'source' or 'assembly'. When the TUI mode is not active, it will
  25595. switch to the TUI mode.
  25596. Think of this key binding as the Emacs 'C-x 1' binding.
  25597. This key binding uses the bindable Readline function
  25598. 'tui-delete-other-windows'.
  25599. 'C-x 2'
  25600. Use a TUI layout with at least two windows. When the current
  25601. layout already has two windows, the next layout with two windows is
  25602. used. When a new layout is chosen, one window will always be
  25603. common to the previous layout and the new one.
  25604. Think of it as the Emacs 'C-x 2' binding.
  25605. This key binding uses the bindable Readline function
  25606. 'tui-change-windows'.
  25607. 'C-x o'
  25608. Change the active window. The TUI associates several key bindings
  25609. (like scrolling and arrow keys) with the active window. This
  25610. command gives the focus to the next TUI window.
  25611. Think of it as the Emacs 'C-x o' binding.
  25612. This key binding uses the bindable Readline function
  25613. 'tui-other-window'.
  25614. 'C-x s'
  25615. Switch in and out of the TUI SingleKey mode that binds single keys
  25616. to GDB commands (*note TUI Single Key Mode::).
  25617. This key binding uses the bindable Readline function 'next-keymap'.
  25618. The following key bindings only work in the TUI mode:
  25619. <PgUp>
  25620. Scroll the active window one page up.
  25621. <PgDn>
  25622. Scroll the active window one page down.
  25623. <Up>
  25624. Scroll the active window one line up.
  25625. <Down>
  25626. Scroll the active window one line down.
  25627. <Left>
  25628. Scroll the active window one column left.
  25629. <Right>
  25630. Scroll the active window one column right.
  25631. 'C-L'
  25632. Refresh the screen.
  25633. Because the arrow keys scroll the active window in the TUI mode, they
  25634. are not available for their normal use by readline unless the command
  25635. window has the focus. When another window is active, you must use other
  25636. readline key bindings such as 'C-p', 'C-n', 'C-b' and 'C-f' to control
  25637. the command window.
  25638. 
  25639. File: gdb.info, Node: TUI Single Key Mode, Next: TUI Commands, Prev: TUI Keys, Up: TUI
  25640. 25.3 TUI Single Key Mode
  25641. ========================
  25642. The TUI also provides a "SingleKey" mode, which binds several frequently
  25643. used GDB commands to single keys. Type 'C-x s' to switch into this
  25644. mode, where the following key bindings are used:
  25645. 'c'
  25646. continue
  25647. 'd'
  25648. down
  25649. 'f'
  25650. finish
  25651. 'n'
  25652. next
  25653. 'o'
  25654. nexti. The shortcut letter 'o' stands for "step Over".
  25655. 'q'
  25656. exit the SingleKey mode.
  25657. 'r'
  25658. run
  25659. 's'
  25660. step
  25661. 'i'
  25662. stepi. The shortcut letter 'i' stands for "step Into".
  25663. 'u'
  25664. up
  25665. 'v'
  25666. info locals
  25667. 'w'
  25668. where
  25669. Other keys temporarily switch to the GDB command prompt. The key
  25670. that was pressed is inserted in the editing buffer so that it is
  25671. possible to type most GDB commands without interaction with the TUI
  25672. SingleKey mode. Once the command is entered the TUI SingleKey mode is
  25673. restored. The only way to permanently leave this mode is by typing 'q'
  25674. or 'C-x s'.
  25675. If GDB was built with Readline 8.0 or later, the TUI SingleKey keymap
  25676. will be named 'SingleKey'. This can be used in '.inputrc' to add
  25677. additional bindings to this keymap.
  25678. 
  25679. File: gdb.info, Node: TUI Commands, Next: TUI Configuration, Prev: TUI Single Key Mode, Up: TUI
  25680. 25.4 TUI-specific Commands
  25681. ==========================
  25682. The TUI has specific commands to control the text windows. These
  25683. commands are always available, even when GDB is not in the TUI mode.
  25684. When GDB is in the standard mode, most of these commands will
  25685. automatically switch to the TUI mode.
  25686. Note that if GDB's 'stdout' is not connected to a terminal, or GDB
  25687. has been started with the machine interface interpreter (*note The
  25688. GDB/MI Interface: GDB/MI.), most of these commands will fail with an
  25689. error, because it would not be possible or desirable to enable curses
  25690. window management.
  25691. 'tui enable'
  25692. Activate TUI mode. The last active TUI window layout will be used
  25693. if TUI mode has previously been used in the current debugging
  25694. session, otherwise a default layout is used.
  25695. 'tui disable'
  25696. Disable TUI mode, returning to the console interpreter.
  25697. 'info win'
  25698. List and give the size of all displayed windows.
  25699. 'tui new-layout NAME WINDOW WEIGHT [WINDOW WEIGHT...]'
  25700. Create a new TUI layout. The new layout will be named NAME, and
  25701. can be accessed using the 'layout' command (see below).
  25702. Each WINDOW parameter is either the name of a window to display, or
  25703. a window description. The windows will be displayed from top to
  25704. bottom in the order listed.
  25705. The names of the windows are the same as the ones given to the
  25706. 'focus' command (see below); additional, the 'status' window can be
  25707. specified. Note that, because it is of fixed height, the weight
  25708. assigned to the status window is of no importance. It is
  25709. conventional to use '0' here.
  25710. A window description looks a bit like an invocation of 'tui
  25711. new-layout', and is of the form {['-horizontal']WINDOW WEIGHT
  25712. [WINDOW WEIGHT...]}.
  25713. This specifies a sub-layout. If '-horizontal' is given, the
  25714. windows in this description will be arranged side-by-side, rather
  25715. than top-to-bottom.
  25716. Each WEIGHT is an integer. It is the weight of this window
  25717. relative to all the other windows in the layout. These numbers are
  25718. used to calculate how much of the screen is given to each window.
  25719. For example:
  25720. (gdb) tui new-layout example src 1 regs 1 status 0 cmd 1
  25721. Here, the new layout is called 'example'. It shows the source and
  25722. register windows, followed by the status window, and then finally
  25723. the command window. The non-status windows all have the same
  25724. weight, so the terminal will be split into three roughly equal
  25725. sections.
  25726. Here is a more complex example, showing a horizontal layout:
  25727. (gdb) tui new-layout example {-horizontal src 1 asm 1} 2 status 0 cmd 1
  25728. This will result in side-by-side source and assembly windows; with
  25729. the status and command window being beneath these, filling the
  25730. entire width of the terminal. Because they have weight 2, the
  25731. source and assembly windows will be twice the height of the command
  25732. window.
  25733. 'layout NAME'
  25734. Changes which TUI windows are displayed. The NAME parameter
  25735. controls which layout is shown. It can be either one of the
  25736. built-in layout names, or the name of a layout defined by the user
  25737. using 'tui new-layout'.
  25738. The built-in layouts are as follows:
  25739. 'next'
  25740. Display the next layout.
  25741. 'prev'
  25742. Display the previous layout.
  25743. 'src'
  25744. Display the source and command windows.
  25745. 'asm'
  25746. Display the assembly and command windows.
  25747. 'split'
  25748. Display the source, assembly, and command windows.
  25749. 'regs'
  25750. When in 'src' layout display the register, source, and command
  25751. windows. When in 'asm' or 'split' layout display the
  25752. register, assembler, and command windows.
  25753. 'focus NAME'
  25754. Changes which TUI window is currently active for scrolling. The
  25755. NAME parameter can be any of the following:
  25756. 'next'
  25757. Make the next window active for scrolling.
  25758. 'prev'
  25759. Make the previous window active for scrolling.
  25760. 'src'
  25761. Make the source window active for scrolling.
  25762. 'asm'
  25763. Make the assembly window active for scrolling.
  25764. 'regs'
  25765. Make the register window active for scrolling.
  25766. 'cmd'
  25767. Make the command window active for scrolling.
  25768. 'refresh'
  25769. Refresh the screen. This is similar to typing 'C-L'.
  25770. 'tui reg GROUP'
  25771. Changes the register group displayed in the tui register window to
  25772. GROUP. If the register window is not currently displayed this
  25773. command will cause the register window to be displayed. The list
  25774. of register groups, as well as their order is target specific. The
  25775. following groups are available on most targets:
  25776. 'next'
  25777. Repeatedly selecting this group will cause the display to
  25778. cycle through all of the available register groups.
  25779. 'prev'
  25780. Repeatedly selecting this group will cause the display to
  25781. cycle through all of the available register groups in the
  25782. reverse order to NEXT.
  25783. 'general'
  25784. Display the general registers.
  25785. 'float'
  25786. Display the floating point registers.
  25787. 'system'
  25788. Display the system registers.
  25789. 'vector'
  25790. Display the vector registers.
  25791. 'all'
  25792. Display all registers.
  25793. 'update'
  25794. Update the source window and the current execution point.
  25795. 'winheight NAME +COUNT'
  25796. 'winheight NAME -COUNT'
  25797. Change the height of the window NAME by COUNT lines. Positive
  25798. counts increase the height, while negative counts decrease it. The
  25799. NAME parameter can be one of 'src' (the source window), 'cmd' (the
  25800. command window), 'asm' (the disassembly window), or 'regs' (the
  25801. register display window).
  25802. 
  25803. File: gdb.info, Node: TUI Configuration, Prev: TUI Commands, Up: TUI
  25804. 25.5 TUI Configuration Variables
  25805. ================================
  25806. Several configuration variables control the appearance of TUI windows.
  25807. 'set tui border-kind KIND'
  25808. Select the border appearance for the source, assembly and register
  25809. windows. The possible values are the following:
  25810. 'space'
  25811. Use a space character to draw the border.
  25812. 'ascii'
  25813. Use ASCII characters '+', '-' and '|' to draw the border.
  25814. 'acs'
  25815. Use the Alternate Character Set to draw the border. The
  25816. border is drawn using character line graphics if the terminal
  25817. supports them.
  25818. 'set tui border-mode MODE'
  25819. 'set tui active-border-mode MODE'
  25820. Select the display attributes for the borders of the inactive
  25821. windows or the active window. The MODE can be one of the
  25822. following:
  25823. 'normal'
  25824. Use normal attributes to display the border.
  25825. 'standout'
  25826. Use standout mode.
  25827. 'reverse'
  25828. Use reverse video mode.
  25829. 'half'
  25830. Use half bright mode.
  25831. 'half-standout'
  25832. Use half bright and standout mode.
  25833. 'bold'
  25834. Use extra bright or bold mode.
  25835. 'bold-standout'
  25836. Use extra bright or bold and standout mode.
  25837. 'set tui tab-width NCHARS'
  25838. Set the width of tab stops to be NCHARS characters. This setting
  25839. affects the display of TAB characters in the source and assembly
  25840. windows.
  25841. 'set tui compact-source [on|off]'
  25842. Set whether the TUI source window is displayed in "compact" form.
  25843. The default display uses more space for line numbers and starts the
  25844. source text at the next tab stop; the compact display uses only as
  25845. much space as is needed for the line numbers in the current file,
  25846. and only a single space to separate the line numbers from the
  25847. source.
  25848. Note that the colors of the TUI borders can be controlled using the
  25849. appropriate 'set style' commands. *Note Output Styling::.
  25850. 
  25851. File: gdb.info, Node: Emacs, Next: GDB/MI, Prev: TUI, Up: Top
  25852. 26 Using GDB under GNU Emacs
  25853. ****************************
  25854. A special interface allows you to use GNU Emacs to view (and edit) the
  25855. source files for the program you are debugging with GDB.
  25856. To use this interface, use the command 'M-x gdb' in Emacs. Give the
  25857. executable file you want to debug as an argument. This command starts
  25858. GDB as a subprocess of Emacs, with input and output through a newly
  25859. created Emacs buffer.
  25860. Running GDB under Emacs can be just like running GDB normally except
  25861. for two things:
  25862. * All "terminal" input and output goes through an Emacs buffer,
  25863. called the GUD buffer.
  25864. This applies both to GDB commands and their output, and to the
  25865. input and output done by the program you are debugging.
  25866. This is useful because it means that you can copy the text of
  25867. previous commands and input them again; you can even use parts of
  25868. the output in this way.
  25869. All the facilities of Emacs' Shell mode are available for
  25870. interacting with your program. In particular, you can send signals
  25871. the usual way--for example, 'C-c C-c' for an interrupt, 'C-c C-z'
  25872. for a stop.
  25873. * GDB displays source code through Emacs.
  25874. Each time GDB displays a stack frame, Emacs automatically finds the
  25875. source file for that frame and puts an arrow ('=>') at the left
  25876. margin of the current line. Emacs uses a separate buffer for
  25877. source display, and splits the screen to show both your GDB session
  25878. and the source.
  25879. Explicit GDB 'list' or search commands still produce output as
  25880. usual, but you probably have no reason to use them from Emacs.
  25881. We call this "text command mode". Emacs 22.1, and later, also uses a
  25882. graphical mode, enabled by default, which provides further buffers that
  25883. can control the execution and describe the state of your program. *Note
  25884. (Emacs)GDB Graphical Interface::.
  25885. If you specify an absolute file name when prompted for the 'M-x gdb'
  25886. argument, then Emacs sets your current working directory to where your
  25887. program resides. If you only specify the file name, then Emacs sets
  25888. your current working directory to the directory associated with the
  25889. previous buffer. In this case, GDB may find your program by searching
  25890. your environment's 'PATH' variable, but on some operating systems it
  25891. might not find the source. So, although the GDB input and output
  25892. session proceeds normally, the auxiliary buffer does not display the
  25893. current source and line of execution.
  25894. The initial working directory of GDB is printed on the top line of
  25895. the GUD buffer and this serves as a default for the commands that
  25896. specify files for GDB to operate on. *Note Commands to Specify Files:
  25897. Files.
  25898. By default, 'M-x gdb' calls the program called 'gdb'. If you need to
  25899. call GDB by a different name (for example, if you keep several
  25900. configurations around, with different names) you can customize the Emacs
  25901. variable 'gud-gdb-command-name' to run the one you want.
  25902. In the GUD buffer, you can use these special Emacs commands in
  25903. addition to the standard Shell mode commands:
  25904. 'C-h m'
  25905. Describe the features of Emacs' GUD Mode.
  25906. 'C-c C-s'
  25907. Execute to another source line, like the GDB 'step' command; also
  25908. update the display window to show the current file and location.
  25909. 'C-c C-n'
  25910. Execute to next source line in this function, skipping all function
  25911. calls, like the GDB 'next' command. Then update the display window
  25912. to show the current file and location.
  25913. 'C-c C-i'
  25914. Execute one instruction, like the GDB 'stepi' command; update
  25915. display window accordingly.
  25916. 'C-c C-f'
  25917. Execute until exit from the selected stack frame, like the GDB
  25918. 'finish' command.
  25919. 'C-c C-r'
  25920. Continue execution of your program, like the GDB 'continue'
  25921. command.
  25922. 'C-c <'
  25923. Go up the number of frames indicated by the numeric argument (*note
  25924. Numeric Arguments: (Emacs)Arguments.), like the GDB 'up' command.
  25925. 'C-c >'
  25926. Go down the number of frames indicated by the numeric argument,
  25927. like the GDB 'down' command.
  25928. In any source file, the Emacs command 'C-x <SPC>' ('gud-break') tells
  25929. GDB to set a breakpoint on the source line point is on.
  25930. In text command mode, if you type 'M-x speedbar', Emacs displays a
  25931. separate frame which shows a backtrace when the GUD buffer is current.
  25932. Move point to any frame in the stack and type <RET> to make it become
  25933. the current frame and display the associated source in the source
  25934. buffer. Alternatively, click 'Mouse-2' to make the selected frame
  25935. become the current one. In graphical mode, the speedbar displays watch
  25936. expressions.
  25937. If you accidentally delete the source-display buffer, an easy way to
  25938. get it back is to type the command 'f' in the GDB buffer, to request a
  25939. frame display; when you run under Emacs, this recreates the source
  25940. buffer if necessary to show you the context of the current frame.
  25941. The source files displayed in Emacs are in ordinary Emacs buffers
  25942. which are visiting the source files in the usual way. You can edit the
  25943. files with these buffers if you wish; but keep in mind that GDB
  25944. communicates with Emacs in terms of line numbers. If you add or delete
  25945. lines from the text, the line numbers that GDB knows cease to correspond
  25946. properly with the code.
  25947. A more detailed description of Emacs' interaction with GDB is given
  25948. in the Emacs manual (*note (Emacs)Debuggers::).
  25949. 
  25950. File: gdb.info, Node: GDB/MI, Next: Annotations, Prev: Emacs, Up: Top
  25951. 27 The GDB/MI Interface
  25952. ***********************
  25953. * Menu:
  25954. * GDB/MI General Design::
  25955. * GDB/MI Command Syntax::
  25956. * GDB/MI Compatibility with CLI::
  25957. * GDB/MI Development and Front Ends::
  25958. * GDB/MI Output Records::
  25959. * GDB/MI Simple Examples::
  25960. * GDB/MI Command Description Format::
  25961. * GDB/MI Breakpoint Commands::
  25962. * GDB/MI Catchpoint Commands::
  25963. * GDB/MI Program Context::
  25964. * GDB/MI Thread Commands::
  25965. * GDB/MI Ada Tasking Commands::
  25966. * GDB/MI Program Execution::
  25967. * GDB/MI Stack Manipulation::
  25968. * GDB/MI Variable Objects::
  25969. * GDB/MI Data Manipulation::
  25970. * GDB/MI Tracepoint Commands::
  25971. * GDB/MI Symbol Query::
  25972. * GDB/MI File Commands::
  25973. * GDB/MI Target Manipulation::
  25974. * GDB/MI File Transfer Commands::
  25975. * GDB/MI Ada Exceptions Commands::
  25976. * GDB/MI Support Commands::
  25977. * GDB/MI Miscellaneous Commands::
  25978. Function and Purpose
  25979. ====================
  25980. GDB/MI is a line based machine oriented text interface to GDB and is
  25981. activated by specifying using the '--interpreter' command line option
  25982. (*note Mode Options::). It is specifically intended to support the
  25983. development of systems which use the debugger as just one small
  25984. component of a larger system.
  25985. This chapter is a specification of the GDB/MI interface. It is
  25986. written in the form of a reference manual.
  25987. Note that GDB/MI is still under construction, so some of the features
  25988. described below are incomplete and subject to change (*note GDB/MI
  25989. Development and Front Ends: GDB/MI Development and Front Ends.).
  25990. Notation and Terminology
  25991. ========================
  25992. This chapter uses the following notation:
  25993. * '|' separates two alternatives.
  25994. * '[ SOMETHING ]' indicates that SOMETHING is optional: it may or may
  25995. not be given.
  25996. * '( GROUP )*' means that GROUP inside the parentheses may repeat
  25997. zero or more times.
  25998. * '( GROUP )+' means that GROUP inside the parentheses may repeat one
  25999. or more times.
  26000. * '"STRING"' means a literal STRING.
  26001. * Menu:
  26002. * GDB/MI General Design::
  26003. * GDB/MI Command Syntax::
  26004. * GDB/MI Compatibility with CLI::
  26005. * GDB/MI Development and Front Ends::
  26006. * GDB/MI Output Records::
  26007. * GDB/MI Simple Examples::
  26008. * GDB/MI Command Description Format::
  26009. * GDB/MI Breakpoint Commands::
  26010. * GDB/MI Catchpoint Commands::
  26011. * GDB/MI Program Context::
  26012. * GDB/MI Thread Commands::
  26013. * GDB/MI Ada Tasking Commands::
  26014. * GDB/MI Program Execution::
  26015. * GDB/MI Stack Manipulation::
  26016. * GDB/MI Variable Objects::
  26017. * GDB/MI Data Manipulation::
  26018. * GDB/MI Tracepoint Commands::
  26019. * GDB/MI Symbol Query::
  26020. * GDB/MI File Commands::
  26021. * GDB/MI Target Manipulation::
  26022. * GDB/MI File Transfer Commands::
  26023. * GDB/MI Ada Exceptions Commands::
  26024. * GDB/MI Support Commands::
  26025. * GDB/MI Miscellaneous Commands::
  26026. 
  26027. File: gdb.info, Node: GDB/MI General Design, Next: GDB/MI Command Syntax, Up: GDB/MI
  26028. 27.1 GDB/MI General Design
  26029. ==========================
  26030. Interaction of a GDB/MI frontend with GDB involves three parts--commands
  26031. sent to GDB, responses to those commands and notifications. Each
  26032. command results in exactly one response, indicating either successful
  26033. completion of the command, or an error. For the commands that do not
  26034. resume the target, the response contains the requested information. For
  26035. the commands that resume the target, the response only indicates whether
  26036. the target was successfully resumed. Notifications is the mechanism for
  26037. reporting changes in the state of the target, or in GDB state, that
  26038. cannot conveniently be associated with a command and reported as part of
  26039. that command response.
  26040. The important examples of notifications are:
  26041. * Exec notifications. These are used to report changes in target
  26042. state--when a target is resumed, or stopped. It would not be
  26043. feasible to include this information in response of resuming
  26044. commands, because one resume commands can result in multiple events
  26045. in different threads. Also, quite some time may pass before any
  26046. event happens in the target, while a frontend needs to know whether
  26047. the resuming command itself was successfully executed.
  26048. * Console output, and status notifications. Console output
  26049. notifications are used to report output of CLI commands, as well as
  26050. diagnostics for other commands. Status notifications are used to
  26051. report the progress of a long-running operation. Naturally,
  26052. including this information in command response would mean no output
  26053. is produced until the command is finished, which is undesirable.
  26054. * General notifications. Commands may have various side effects on
  26055. the GDB or target state beyond their official purpose. For
  26056. example, a command may change the selected thread. Although such
  26057. changes can be included in command response, using notification
  26058. allows for more orthogonal frontend design.
  26059. There's no guarantee that whenever an MI command reports an error,
  26060. GDB or the target are in any specific state, and especially, the state
  26061. is not reverted to the state before the MI command was processed.
  26062. Therefore, whenever an MI command results in an error, we recommend that
  26063. the frontend refreshes all the information shown in the user interface.
  26064. * Menu:
  26065. * Context management::
  26066. * Asynchronous and non-stop modes::
  26067. * Thread groups::
  26068. 
  26069. File: gdb.info, Node: Context management, Next: Asynchronous and non-stop modes, Up: GDB/MI General Design
  26070. 27.1.1 Context management
  26071. -------------------------
  26072. 27.1.1.1 Threads and Frames
  26073. ...........................
  26074. In most cases when GDB accesses the target, this access is done in
  26075. context of a specific thread and frame (*note Frames::). Often, even
  26076. when accessing global data, the target requires that a thread be
  26077. specified. The CLI interface maintains the selected thread and frame,
  26078. and supplies them to target on each command. This is convenient,
  26079. because a command line user would not want to specify that information
  26080. explicitly on each command, and because user interacts with GDB via a
  26081. single terminal, so no confusion is possible as to what thread and frame
  26082. are the current ones.
  26083. In the case of MI, the concept of selected thread and frame is less
  26084. useful. First, a frontend can easily remember this information itself.
  26085. Second, a graphical frontend can have more than one window, each one
  26086. used for debugging a different thread, and the frontend might want to
  26087. access additional threads for internal purposes. This increases the
  26088. risk that by relying on implicitly selected thread, the frontend may be
  26089. operating on a wrong one. Therefore, each MI command should explicitly
  26090. specify which thread and frame to operate on. To make it possible, each
  26091. MI command accepts the '--thread' and '--frame' options, the value to
  26092. each is GDB global identifier for thread and frame to operate on.
  26093. Usually, each top-level window in a frontend allows the user to
  26094. select a thread and a frame, and remembers the user selection for
  26095. further operations. However, in some cases GDB may suggest that the
  26096. current thread or frame be changed. For example, when stopping on a
  26097. breakpoint it is reasonable to switch to the thread where breakpoint is
  26098. hit. For another example, if the user issues the CLI 'thread' or
  26099. 'frame' commands via the frontend, it is desirable to change the
  26100. frontend's selection to the one specified by user. GDB communicates the
  26101. suggestion to change current thread and frame using the
  26102. '=thread-selected' notification.
  26103. Note that historically, MI shares the selected thread with CLI, so
  26104. frontends used the '-thread-select' to execute commands in the right
  26105. context. However, getting this to work right is cumbersome. The
  26106. simplest way is for frontend to emit '-thread-select' command before
  26107. every command. This doubles the number of commands that need to be
  26108. sent. The alternative approach is to suppress '-thread-select' if the
  26109. selected thread in GDB is supposed to be identical to the thread the
  26110. frontend wants to operate on. However, getting this optimization right
  26111. can be tricky. In particular, if the frontend sends several commands to
  26112. GDB, and one of the commands changes the selected thread, then the
  26113. behaviour of subsequent commands will change. So, a frontend should
  26114. either wait for response from such problematic commands, or explicitly
  26115. add '-thread-select' for all subsequent commands. No frontend is known
  26116. to do this exactly right, so it is suggested to just always pass the
  26117. '--thread' and '--frame' options.
  26118. 27.1.1.2 Language
  26119. .................
  26120. The execution of several commands depends on which language is selected.
  26121. By default, the current language (*note show language::) is used. But
  26122. for commands known to be language-sensitive, it is recommended to use
  26123. the '--language' option. This option takes one argument, which is the
  26124. name of the language to use while executing the command. For instance:
  26125. -data-evaluate-expression --language c "sizeof (void*)"
  26126. ^done,value="4"
  26127. (gdb)
  26128. The valid language names are the same names accepted by the 'set
  26129. language' command (*note Manually::), excluding 'auto', 'local' or
  26130. 'unknown'.
  26131. 
  26132. File: gdb.info, Node: Asynchronous and non-stop modes, Next: Thread groups, Prev: Context management, Up: GDB/MI General Design
  26133. 27.1.2 Asynchronous command execution and non-stop mode
  26134. -------------------------------------------------------
  26135. On some targets, GDB is capable of processing MI commands even while the
  26136. target is running. This is called "asynchronous command execution"
  26137. (*note Background Execution::). The frontend may specify a preference
  26138. for asynchronous execution using the '-gdb-set mi-async 1' command,
  26139. which should be emitted before either running the executable or
  26140. attaching to the target. After the frontend has started the executable
  26141. or attached to the target, it can find if asynchronous execution is
  26142. enabled using the '-list-target-features' command.
  26143. '-gdb-set mi-async on'
  26144. '-gdb-set mi-async off'
  26145. Set whether MI is in asynchronous mode.
  26146. When 'off', which is the default, MI execution commands (e.g.,
  26147. '-exec-continue') are foreground commands, and GDB waits for the
  26148. program to stop before processing further commands.
  26149. When 'on', MI execution commands are background execution commands
  26150. (e.g., '-exec-continue' becomes the equivalent of the 'c&' CLI
  26151. command), and so GDB is capable of processing MI commands even
  26152. while the target is running.
  26153. '-gdb-show mi-async'
  26154. Show whether MI asynchronous mode is enabled.
  26155. Note: In GDB version 7.7 and earlier, this option was called
  26156. 'target-async' instead of 'mi-async', and it had the effect of both
  26157. putting MI in asynchronous mode and making CLI background commands
  26158. possible. CLI background commands are now always possible "out of the
  26159. box" if the target supports them. The old spelling is kept as a
  26160. deprecated alias for backwards compatibility.
  26161. Even if GDB can accept a command while target is running, many
  26162. commands that access the target do not work when the target is running.
  26163. Therefore, asynchronous command execution is most useful when combined
  26164. with non-stop mode (*note Non-Stop Mode::). Then, it is possible to
  26165. examine the state of one thread, while other threads are running.
  26166. When a given thread is running, MI commands that try to access the
  26167. target in the context of that thread may not work, or may work only on
  26168. some targets. In particular, commands that try to operate on thread's
  26169. stack will not work, on any target. Commands that read memory, or
  26170. modify breakpoints, may work or not work, depending on the target. Note
  26171. that even commands that operate on global state, such as 'print', 'set',
  26172. and breakpoint commands, still access the target in the context of a
  26173. specific thread, so frontend should try to find a stopped thread and
  26174. perform the operation on that thread (using the '--thread' option).
  26175. Which commands will work in the context of a running thread is highly
  26176. target dependent. However, the two commands '-exec-interrupt', to stop
  26177. a thread, and '-thread-info', to find the state of a thread, will always
  26178. work.
  26179. 
  26180. File: gdb.info, Node: Thread groups, Prev: Asynchronous and non-stop modes, Up: GDB/MI General Design
  26181. 27.1.3 Thread groups
  26182. --------------------
  26183. GDB may be used to debug several processes at the same time. On some
  26184. platforms, GDB may support debugging of several hardware systems, each
  26185. one having several cores with several different processes running on
  26186. each core. This section describes the MI mechanism to support such
  26187. debugging scenarios.
  26188. The key observation is that regardless of the structure of the
  26189. target, MI can have a global list of threads, because most commands that
  26190. accept the '--thread' option do not need to know what process that
  26191. thread belongs to. Therefore, it is not necessary to introduce neither
  26192. additional '--process' option, nor an notion of the current process in
  26193. the MI interface. The only strictly new feature that is required is the
  26194. ability to find how the threads are grouped into processes.
  26195. To allow the user to discover such grouping, and to support arbitrary
  26196. hierarchy of machines/cores/processes, MI introduces the concept of a
  26197. "thread group". Thread group is a collection of threads and other
  26198. thread groups. A thread group always has a string identifier, a type,
  26199. and may have additional attributes specific to the type. A new command,
  26200. '-list-thread-groups', returns the list of top-level thread groups,
  26201. which correspond to processes that GDB is debugging at the moment. By
  26202. passing an identifier of a thread group to the '-list-thread-groups'
  26203. command, it is possible to obtain the members of specific thread group.
  26204. To allow the user to easily discover processes, and other objects, he
  26205. wishes to debug, a concept of "available thread group" is introduced.
  26206. Available thread group is an thread group that GDB is not debugging, but
  26207. that can be attached to, using the '-target-attach' command. The list
  26208. of available top-level thread groups can be obtained using
  26209. '-list-thread-groups --available'. In general, the content of a thread
  26210. group may be only retrieved only after attaching to that thread group.
  26211. Thread groups are related to inferiors (*note Inferiors Connections
  26212. and Programs::). Each inferior corresponds to a thread group of a
  26213. special type 'process', and some additional operations are permitted on
  26214. such thread groups.
  26215. 
  26216. File: gdb.info, Node: GDB/MI Command Syntax, Next: GDB/MI Compatibility with CLI, Prev: GDB/MI General Design, Up: GDB/MI
  26217. 27.2 GDB/MI Command Syntax
  26218. ==========================
  26219. * Menu:
  26220. * GDB/MI Input Syntax::
  26221. * GDB/MI Output Syntax::
  26222. 
  26223. File: gdb.info, Node: GDB/MI Input Syntax, Next: GDB/MI Output Syntax, Up: GDB/MI Command Syntax
  26224. 27.2.1 GDB/MI Input Syntax
  26225. --------------------------
  26226. 'COMMAND ==>'
  26227. 'CLI-COMMAND | MI-COMMAND'
  26228. 'CLI-COMMAND ==>'
  26229. '[ TOKEN ] CLI-COMMAND NL', where CLI-COMMAND is any existing GDB
  26230. CLI command.
  26231. 'MI-COMMAND ==>'
  26232. '[ TOKEN ] "-" OPERATION ( " " OPTION )* [ " --" ] ( " " PARAMETER
  26233. )* NL'
  26234. 'TOKEN ==>'
  26235. "any sequence of digits"
  26236. 'OPTION ==>'
  26237. '"-" PARAMETER [ " " PARAMETER ]'
  26238. 'PARAMETER ==>'
  26239. 'NON-BLANK-SEQUENCE | C-STRING'
  26240. 'OPERATION ==>'
  26241. _any of the operations described in this chapter_
  26242. 'NON-BLANK-SEQUENCE ==>'
  26243. _anything, provided it doesn't contain special characters such as
  26244. "-", NL, """ and of course " "_
  26245. 'C-STRING ==>'
  26246. '""" SEVEN-BIT-ISO-C-STRING-CONTENT """'
  26247. 'NL ==>'
  26248. 'CR | CR-LF'
  26249. Notes:
  26250. * The CLI commands are still handled by the MI interpreter; their
  26251. output is described below.
  26252. * The 'TOKEN', when present, is passed back when the command
  26253. finishes.
  26254. * Some MI commands accept optional arguments as part of the parameter
  26255. list. Each option is identified by a leading '-' (dash) and may be
  26256. followed by an optional argument parameter. Options occur first in
  26257. the parameter list and can be delimited from normal parameters
  26258. using '--' (this is useful when some parameters begin with a dash).
  26259. Pragmatics:
  26260. * We want easy access to the existing CLI syntax (for debugging).
  26261. * We want it to be easy to spot a MI operation.
  26262. 
  26263. File: gdb.info, Node: GDB/MI Output Syntax, Prev: GDB/MI Input Syntax, Up: GDB/MI Command Syntax
  26264. 27.2.2 GDB/MI Output Syntax
  26265. ---------------------------
  26266. The output from GDB/MI consists of zero or more out-of-band records
  26267. followed, optionally, by a single result record. This result record is
  26268. for the most recent command. The sequence of output records is
  26269. terminated by '(gdb)'.
  26270. If an input command was prefixed with a 'TOKEN' then the
  26271. corresponding output for that command will also be prefixed by that same
  26272. TOKEN.
  26273. 'OUTPUT ==>'
  26274. '( OUT-OF-BAND-RECORD )* [ RESULT-RECORD ] "(gdb)" NL'
  26275. 'RESULT-RECORD ==>'
  26276. ' [ TOKEN ] "^" RESULT-CLASS ( "," RESULT )* NL'
  26277. 'OUT-OF-BAND-RECORD ==>'
  26278. 'ASYNC-RECORD | STREAM-RECORD'
  26279. 'ASYNC-RECORD ==>'
  26280. 'EXEC-ASYNC-OUTPUT | STATUS-ASYNC-OUTPUT | NOTIFY-ASYNC-OUTPUT'
  26281. 'EXEC-ASYNC-OUTPUT ==>'
  26282. '[ TOKEN ] "*" ASYNC-OUTPUT NL'
  26283. 'STATUS-ASYNC-OUTPUT ==>'
  26284. '[ TOKEN ] "+" ASYNC-OUTPUT NL'
  26285. 'NOTIFY-ASYNC-OUTPUT ==>'
  26286. '[ TOKEN ] "=" ASYNC-OUTPUT NL'
  26287. 'ASYNC-OUTPUT ==>'
  26288. 'ASYNC-CLASS ( "," RESULT )*'
  26289. 'RESULT-CLASS ==>'
  26290. '"done" | "running" | "connected" | "error" | "exit"'
  26291. 'ASYNC-CLASS ==>'
  26292. '"stopped" | OTHERS' (where OTHERS will be added depending on the
  26293. needs--this is still in development).
  26294. 'RESULT ==>'
  26295. ' VARIABLE "=" VALUE'
  26296. 'VARIABLE ==>'
  26297. ' STRING '
  26298. 'VALUE ==>'
  26299. ' CONST | TUPLE | LIST '
  26300. 'CONST ==>'
  26301. 'C-STRING'
  26302. 'TUPLE ==>'
  26303. ' "{}" | "{" RESULT ( "," RESULT )* "}" '
  26304. 'LIST ==>'
  26305. ' "[]" | "[" VALUE ( "," VALUE )* "]" | "[" RESULT ( "," RESULT )*
  26306. "]" '
  26307. 'STREAM-RECORD ==>'
  26308. 'CONSOLE-STREAM-OUTPUT | TARGET-STREAM-OUTPUT | LOG-STREAM-OUTPUT'
  26309. 'CONSOLE-STREAM-OUTPUT ==>'
  26310. '"~" C-STRING NL'
  26311. 'TARGET-STREAM-OUTPUT ==>'
  26312. '"@" C-STRING NL'
  26313. 'LOG-STREAM-OUTPUT ==>'
  26314. '"&" C-STRING NL'
  26315. 'NL ==>'
  26316. 'CR | CR-LF'
  26317. 'TOKEN ==>'
  26318. _any sequence of digits_.
  26319. Notes:
  26320. * All output sequences end in a single line containing a period.
  26321. * The 'TOKEN' is from the corresponding request. Note that for all
  26322. async output, while the token is allowed by the grammar and may be
  26323. output by future versions of GDB for select async output messages,
  26324. it is generally omitted. Frontends should treat all async output
  26325. as reporting general changes in the state of the target and there
  26326. should be no need to associate async output to any prior command.
  26327. * STATUS-ASYNC-OUTPUT contains on-going status information about the
  26328. progress of a slow operation. It can be discarded. All status
  26329. output is prefixed by '+'.
  26330. * EXEC-ASYNC-OUTPUT contains asynchronous state change on the target
  26331. (stopped, started, disappeared). All async output is prefixed by
  26332. '*'.
  26333. * NOTIFY-ASYNC-OUTPUT contains supplementary information that the
  26334. client should handle (e.g., a new breakpoint information). All
  26335. notify output is prefixed by '='.
  26336. * CONSOLE-STREAM-OUTPUT is output that should be displayed as is in
  26337. the console. It is the textual response to a CLI command. All the
  26338. console output is prefixed by '~'.
  26339. * TARGET-STREAM-OUTPUT is the output produced by the target program.
  26340. All the target output is prefixed by '@'.
  26341. * LOG-STREAM-OUTPUT is output text coming from GDB's internals, for
  26342. instance messages that should be displayed as part of an error log.
  26343. All the log output is prefixed by '&'.
  26344. * New GDB/MI commands should only output LISTS containing VALUES.
  26345. *Note GDB/MI Stream Records: GDB/MI Stream Records, for more details
  26346. about the various output records.
  26347. 
  26348. File: gdb.info, Node: GDB/MI Compatibility with CLI, Next: GDB/MI Development and Front Ends, Prev: GDB/MI Command Syntax, Up: GDB/MI
  26349. 27.3 GDB/MI Compatibility with CLI
  26350. ==================================
  26351. For the developers convenience CLI commands can be entered directly, but
  26352. there may be some unexpected behaviour. For example, commands that
  26353. query the user will behave as if the user replied yes, breakpoint
  26354. command lists are not executed and some CLI commands, such as 'if',
  26355. 'when' and 'define', prompt for further input with '>', which is not
  26356. valid MI output.
  26357. This feature may be removed at some stage in the future and it is
  26358. recommended that front ends use the '-interpreter-exec' command (*note
  26359. -interpreter-exec::).
  26360. 
  26361. File: gdb.info, Node: GDB/MI Development and Front Ends, Next: GDB/MI Output Records, Prev: GDB/MI Compatibility with CLI, Up: GDB/MI
  26362. 27.4 GDB/MI Development and Front Ends
  26363. ======================================
  26364. The application which takes the MI output and presents the state of the
  26365. program being debugged to the user is called a "front end".
  26366. Since GDB/MI is used by a variety of front ends to GDB, changes to
  26367. the MI interface may break existing usage. This section describes how
  26368. the protocol changes and how to request previous version of the protocol
  26369. when it does.
  26370. Some changes in MI need not break a carefully designed front end, and
  26371. for these the MI version will remain unchanged. The following is a list
  26372. of changes that may occur within one level, so front ends should parse
  26373. MI output in a way that can handle them:
  26374. * New MI commands may be added.
  26375. * New fields may be added to the output of any MI command.
  26376. * The range of values for fields with specified values, e.g.,
  26377. 'in_scope' (*note -var-update::) may be extended.
  26378. If the changes are likely to break front ends, the MI version level
  26379. will be increased by one. The new versions of the MI protocol are not
  26380. compatible with the old versions. Old versions of MI remain available,
  26381. allowing front ends to keep using them until they are modified to use
  26382. the latest MI version.
  26383. Since '--interpreter=mi' always points to the latest MI version, it
  26384. is recommended that front ends request a specific version of MI when
  26385. launching GDB (e.g. '--interpreter=mi2') to make sure they get an
  26386. interpreter with the MI version they expect.
  26387. The following table gives a summary of the released versions of the
  26388. MI interface: the version number, the version of GDB in which it first
  26389. appeared and the breaking changes compared to the previous version.
  26390. MI GDB Breaking changes
  26391. versionversion
  26392. ----------------------------------------------------------------------------
  26393. 1 5.1 None
  26394. 2 6.0
  26395. * The '-environment-pwd', '-environment-directory' and
  26396. '-environment-path' commands now returns values using the
  26397. MI output syntax, rather than CLI output syntax.
  26398. * '-var-list-children''s 'children' result field is now a
  26399. list, rather than a tuple.
  26400. * '-var-update''s 'changelist' result field is now a list,
  26401. rather than a tuple.
  26402. 3 9.1
  26403. * The output of information about multi-location breakpoints
  26404. has changed in the responses to the '-break-insert' and
  26405. '-break-info' commands, as well as in the
  26406. '=breakpoint-created' and '=breakpoint-modified' events.
  26407. The multiple locations are now placed in a 'locations'
  26408. field, whose value is a list.
  26409. If your front end cannot yet migrate to a more recent version of the
  26410. MI protocol, you can nevertheless selectively enable specific features
  26411. available in those recent MI versions, using the following commands:
  26412. '-fix-multi-location-breakpoint-output'
  26413. Use the output for multi-location breakpoints which was introduced
  26414. by MI 3, even when using MI versions 2 or 1. This command has no
  26415. effect when using MI version 3 or later.
  26416. The best way to avoid unexpected changes in MI that might break your
  26417. front end is to make your project known to GDB developers and follow
  26418. development on <gdb@sourceware.org> and <gdb-patches@sourceware.org>.
  26419. 
  26420. File: gdb.info, Node: GDB/MI Output Records, Next: GDB/MI Simple Examples, Prev: GDB/MI Development and Front Ends, Up: GDB/MI
  26421. 27.5 GDB/MI Output Records
  26422. ==========================
  26423. * Menu:
  26424. * GDB/MI Result Records::
  26425. * GDB/MI Stream Records::
  26426. * GDB/MI Async Records::
  26427. * GDB/MI Breakpoint Information::
  26428. * GDB/MI Frame Information::
  26429. * GDB/MI Thread Information::
  26430. * GDB/MI Ada Exception Information::
  26431. 
  26432. File: gdb.info, Node: GDB/MI Result Records, Next: GDB/MI Stream Records, Up: GDB/MI Output Records
  26433. 27.5.1 GDB/MI Result Records
  26434. ----------------------------
  26435. In addition to a number of out-of-band notifications, the response to a
  26436. GDB/MI command includes one of the following result indications:
  26437. '"^done" [ "," RESULTS ]'
  26438. The synchronous operation was successful, 'RESULTS' are the return
  26439. values.
  26440. '"^running"'
  26441. This result record is equivalent to '^done'. Historically, it was
  26442. output instead of '^done' if the command has resumed the target.
  26443. This behaviour is maintained for backward compatibility, but all
  26444. frontends should treat '^done' and '^running' identically and rely
  26445. on the '*running' output record to determine which threads are
  26446. resumed.
  26447. '"^connected"'
  26448. GDB has connected to a remote target.
  26449. '"^error" "," "msg=" C-STRING [ "," "code=" C-STRING ]'
  26450. The operation failed. The 'msg=C-STRING' variable contains the
  26451. corresponding error message.
  26452. If present, the 'code=C-STRING' variable provides an error code on
  26453. which consumers can rely on to detect the corresponding error
  26454. condition. At present, only one error code is defined:
  26455. '"undefined-command"'
  26456. Indicates that the command causing the error does not exist.
  26457. '"^exit"'
  26458. GDB has terminated.
  26459. 
  26460. File: gdb.info, Node: GDB/MI Stream Records, Next: GDB/MI Async Records, Prev: GDB/MI Result Records, Up: GDB/MI Output Records
  26461. 27.5.2 GDB/MI Stream Records
  26462. ----------------------------
  26463. GDB internally maintains a number of output streams: the console, the
  26464. target, and the log. The output intended for each of these streams is
  26465. funneled through the GDB/MI interface using "stream records".
  26466. Each stream record begins with a unique "prefix character" which
  26467. identifies its stream (*note GDB/MI Output Syntax: GDB/MI Output
  26468. Syntax.). In addition to the prefix, each stream record contains a
  26469. 'STRING-OUTPUT'. This is either raw text (with an implicit new line) or
  26470. a quoted C string (which does not contain an implicit newline).
  26471. '"~" STRING-OUTPUT'
  26472. The console output stream contains text that should be displayed in
  26473. the CLI console window. It contains the textual responses to CLI
  26474. commands.
  26475. '"@" STRING-OUTPUT'
  26476. The target output stream contains any textual output from the
  26477. running target. This is only present when GDB's event loop is
  26478. truly asynchronous, which is currently only the case for remote
  26479. targets.
  26480. '"&" STRING-OUTPUT'
  26481. The log stream contains debugging messages being produced by GDB's
  26482. internals.
  26483. 
  26484. File: gdb.info, Node: GDB/MI Async Records, Next: GDB/MI Breakpoint Information, Prev: GDB/MI Stream Records, Up: GDB/MI Output Records
  26485. 27.5.3 GDB/MI Async Records
  26486. ---------------------------
  26487. "Async" records are used to notify the GDB/MI client of additional
  26488. changes that have occurred. Those changes can either be a consequence
  26489. of GDB/MI commands (e.g., a breakpoint modified) or a result of target
  26490. activity (e.g., target stopped).
  26491. The following is the list of possible async records:
  26492. '*running,thread-id="THREAD"'
  26493. The target is now running. The THREAD field can be the global
  26494. thread ID of the thread that is now running, and it can be 'all' if
  26495. all threads are running. The frontend should assume that no
  26496. interaction with a running thread is possible after this
  26497. notification is produced. The frontend should not assume that this
  26498. notification is output only once for any command. GDB may emit
  26499. this notification several times, either for different threads,
  26500. because it cannot resume all threads together, or even for a single
  26501. thread, if the thread must be stepped though some code before
  26502. letting it run freely.
  26503. '*stopped,reason="REASON",thread-id="ID",stopped-threads="STOPPED",core="CORE"'
  26504. The target has stopped. The REASON field can have one of the
  26505. following values:
  26506. 'breakpoint-hit'
  26507. A breakpoint was reached.
  26508. 'watchpoint-trigger'
  26509. A watchpoint was triggered.
  26510. 'read-watchpoint-trigger'
  26511. A read watchpoint was triggered.
  26512. 'access-watchpoint-trigger'
  26513. An access watchpoint was triggered.
  26514. 'function-finished'
  26515. An -exec-finish or similar CLI command was accomplished.
  26516. 'location-reached'
  26517. An -exec-until or similar CLI command was accomplished.
  26518. 'watchpoint-scope'
  26519. A watchpoint has gone out of scope.
  26520. 'end-stepping-range'
  26521. An -exec-next, -exec-next-instruction, -exec-step,
  26522. -exec-step-instruction or similar CLI command was
  26523. accomplished.
  26524. 'exited-signalled'
  26525. The inferior exited because of a signal.
  26526. 'exited'
  26527. The inferior exited.
  26528. 'exited-normally'
  26529. The inferior exited normally.
  26530. 'signal-received'
  26531. A signal was received by the inferior.
  26532. 'solib-event'
  26533. The inferior has stopped due to a library being loaded or
  26534. unloaded. This can happen when 'stop-on-solib-events' (*note
  26535. Files::) is set or when a 'catch load' or 'catch unload'
  26536. catchpoint is in use (*note Set Catchpoints::).
  26537. 'fork'
  26538. The inferior has forked. This is reported when 'catch fork'
  26539. (*note Set Catchpoints::) has been used.
  26540. 'vfork'
  26541. The inferior has vforked. This is reported in when 'catch
  26542. vfork' (*note Set Catchpoints::) has been used.
  26543. 'syscall-entry'
  26544. The inferior entered a system call. This is reported when
  26545. 'catch syscall' (*note Set Catchpoints::) has been used.
  26546. 'syscall-return'
  26547. The inferior returned from a system call. This is reported
  26548. when 'catch syscall' (*note Set Catchpoints::) has been used.
  26549. 'exec'
  26550. The inferior called 'exec'. This is reported when 'catch
  26551. exec' (*note Set Catchpoints::) has been used.
  26552. The ID field identifies the global thread ID of the thread that
  26553. directly caused the stop - for example by hitting a breakpoint.
  26554. Depending on whether all-stop mode is in effect (*note All-Stop
  26555. Mode::), GDB may either stop all threads, or only the thread that
  26556. directly triggered the stop. If all threads are stopped, the
  26557. STOPPED field will have the value of '"all"'. Otherwise, the value
  26558. of the STOPPED field will be a list of thread identifiers.
  26559. Presently, this list will always include a single thread, but
  26560. frontend should be prepared to see several threads in the list.
  26561. The CORE field reports the processor core on which the stop event
  26562. has happened. This field may be absent if such information is not
  26563. available.
  26564. '=thread-group-added,id="ID"'
  26565. '=thread-group-removed,id="ID"'
  26566. A thread group was either added or removed. The ID field contains
  26567. the GDB identifier of the thread group. When a thread group is
  26568. added, it generally might not be associated with a running process.
  26569. When a thread group is removed, its id becomes invalid and cannot
  26570. be used in any way.
  26571. '=thread-group-started,id="ID",pid="PID"'
  26572. A thread group became associated with a running program, either
  26573. because the program was just started or the thread group was
  26574. attached to a program. The ID field contains the GDB identifier of
  26575. the thread group. The PID field contains process identifier,
  26576. specific to the operating system.
  26577. '=thread-group-exited,id="ID"[,exit-code="CODE"]'
  26578. A thread group is no longer associated with a running program,
  26579. either because the program has exited, or because it was detached
  26580. from. The ID field contains the GDB identifier of the thread
  26581. group. The CODE field is the exit code of the inferior; it exists
  26582. only when the inferior exited with some code.
  26583. '=thread-created,id="ID",group-id="GID"'
  26584. '=thread-exited,id="ID",group-id="GID"'
  26585. A thread either was created, or has exited. The ID field contains
  26586. the global GDB identifier of the thread. The GID field identifies
  26587. the thread group this thread belongs to.
  26588. '=thread-selected,id="ID"[,frame="FRAME"]'
  26589. Informs that the selected thread or frame were changed. This
  26590. notification is not emitted as result of the '-thread-select' or
  26591. '-stack-select-frame' commands, but is emitted whenever an MI
  26592. command that is not documented to change the selected thread and
  26593. frame actually changes them. In particular, invoking, directly or
  26594. indirectly (via user-defined command), the CLI 'thread' or 'frame'
  26595. commands, will generate this notification. Changing the thread or
  26596. frame from another user interface (see *note Interpreters::) will
  26597. also generate this notification.
  26598. The FRAME field is only present if the newly selected thread is
  26599. stopped. See *note GDB/MI Frame Information:: for the format of
  26600. its value.
  26601. We suggest that in response to this notification, front ends
  26602. highlight the selected thread and cause subsequent commands to
  26603. apply to that thread.
  26604. '=library-loaded,...'
  26605. Reports that a new library file was loaded by the program. This
  26606. notification has 5 fields--ID, TARGET-NAME, HOST-NAME,
  26607. SYMBOLS-LOADED and RANGES. The ID field is an opaque identifier of
  26608. the library. For remote debugging case, TARGET-NAME and HOST-NAME
  26609. fields give the name of the library file on the target, and on the
  26610. host respectively. For native debugging, both those fields have
  26611. the same value. The SYMBOLS-LOADED field is emitted only for
  26612. backward compatibility and should not be relied on to convey any
  26613. useful information. The THREAD-GROUP field, if present, specifies
  26614. the id of the thread group in whose context the library was loaded.
  26615. If the field is absent, it means the library was loaded in the
  26616. context of all present thread groups. The RANGES field specifies
  26617. the ranges of addresses belonging to this library.
  26618. '=library-unloaded,...'
  26619. Reports that a library was unloaded by the program. This
  26620. notification has 3 fields--ID, TARGET-NAME and HOST-NAME with the
  26621. same meaning as for the '=library-loaded' notification. The
  26622. THREAD-GROUP field, if present, specifies the id of the thread
  26623. group in whose context the library was unloaded. If the field is
  26624. absent, it means the library was unloaded in the context of all
  26625. present thread groups.
  26626. '=traceframe-changed,num=TFNUM,tracepoint=TPNUM'
  26627. '=traceframe-changed,end'
  26628. Reports that the trace frame was changed and its new number is
  26629. TFNUM. The number of the tracepoint associated with this trace
  26630. frame is TPNUM.
  26631. '=tsv-created,name=NAME,initial=INITIAL'
  26632. Reports that the new trace state variable NAME is created with
  26633. initial value INITIAL.
  26634. '=tsv-deleted,name=NAME'
  26635. '=tsv-deleted'
  26636. Reports that the trace state variable NAME is deleted or all trace
  26637. state variables are deleted.
  26638. '=tsv-modified,name=NAME,initial=INITIAL[,current=CURRENT]'
  26639. Reports that the trace state variable NAME is modified with the
  26640. initial value INITIAL. The current value CURRENT of trace state
  26641. variable is optional and is reported if the current value of trace
  26642. state variable is known.
  26643. '=breakpoint-created,bkpt={...}'
  26644. '=breakpoint-modified,bkpt={...}'
  26645. '=breakpoint-deleted,id=NUMBER'
  26646. Reports that a breakpoint was created, modified, or deleted,
  26647. respectively. Only user-visible breakpoints are reported to the MI
  26648. user.
  26649. The BKPT argument is of the same form as returned by the various
  26650. breakpoint commands; *Note GDB/MI Breakpoint Commands::. The
  26651. NUMBER is the ordinal number of the breakpoint.
  26652. Note that if a breakpoint is emitted in the result record of a
  26653. command, then it will not also be emitted in an async record.
  26654. '=record-started,thread-group="ID",method="METHOD"[,format="FORMAT"]'
  26655. '=record-stopped,thread-group="ID"'
  26656. Execution log recording was either started or stopped on an
  26657. inferior. The ID is the GDB identifier of the thread group
  26658. corresponding to the affected inferior.
  26659. The METHOD field indicates the method used to record execution. If
  26660. the method in use supports multiple recording formats, FORMAT will
  26661. be present and contain the currently used format. *Note Process
  26662. Record and Replay::, for existing method and format values.
  26663. '=cmd-param-changed,param=PARAM,value=VALUE'
  26664. Reports that a parameter of the command 'set PARAM' is changed to
  26665. VALUE. In the multi-word 'set' command, the PARAM is the whole
  26666. parameter list to 'set' command. For example, In command 'set
  26667. check type on', PARAM is 'check type' and VALUE is 'on'.
  26668. '=memory-changed,thread-group=ID,addr=ADDR,len=LEN[,type="code"]'
  26669. Reports that bytes from ADDR to DATA + LEN were written in an
  26670. inferior. The ID is the identifier of the thread group
  26671. corresponding to the affected inferior. The optional 'type="code"'
  26672. part is reported if the memory written to holds executable code.
  26673. 
  26674. File: gdb.info, Node: GDB/MI Breakpoint Information, Next: GDB/MI Frame Information, Prev: GDB/MI Async Records, Up: GDB/MI Output Records
  26675. 27.5.4 GDB/MI Breakpoint Information
  26676. ------------------------------------
  26677. When GDB reports information about a breakpoint, a tracepoint, a
  26678. watchpoint, or a catchpoint, it uses a tuple with the following fields:
  26679. 'number'
  26680. The breakpoint number.
  26681. 'type'
  26682. The type of the breakpoint. For ordinary breakpoints this will be
  26683. 'breakpoint', but many values are possible.
  26684. 'catch-type'
  26685. If the type of the breakpoint is 'catchpoint', then this indicates
  26686. the exact type of catchpoint.
  26687. 'disp'
  26688. This is the breakpoint disposition--either 'del', meaning that the
  26689. breakpoint will be deleted at the next stop, or 'keep', meaning
  26690. that the breakpoint will not be deleted.
  26691. 'enabled'
  26692. This indicates whether the breakpoint is enabled, in which case the
  26693. value is 'y', or disabled, in which case the value is 'n'. Note
  26694. that this is not the same as the field 'enable'.
  26695. 'addr'
  26696. The address of the breakpoint. This may be a hexidecimal number,
  26697. giving the address; or the string '<PENDING>', for a pending
  26698. breakpoint; or the string '<MULTIPLE>', for a breakpoint with
  26699. multiple locations. This field will not be present if no address
  26700. can be determined. For example, a watchpoint does not have an
  26701. address.
  26702. 'addr_flags'
  26703. Optional field containing any flags related to the address. These
  26704. flags are architecture-dependent; see *note Architectures:: for
  26705. their meaning for a particular CPU.
  26706. 'func'
  26707. If known, the function in which the breakpoint appears. If not
  26708. known, this field is not present.
  26709. 'filename'
  26710. The name of the source file which contains this function, if known.
  26711. If not known, this field is not present.
  26712. 'fullname'
  26713. The full file name of the source file which contains this function,
  26714. if known. If not known, this field is not present.
  26715. 'line'
  26716. The line number at which this breakpoint appears, if known. If not
  26717. known, this field is not present.
  26718. 'at'
  26719. If the source file is not known, this field may be provided. If
  26720. provided, this holds the address of the breakpoint, possibly
  26721. followed by a symbol name.
  26722. 'pending'
  26723. If this breakpoint is pending, this field is present and holds the
  26724. text used to set the breakpoint, as entered by the user.
  26725. 'evaluated-by'
  26726. Where this breakpoint's condition is evaluated, either 'host' or
  26727. 'target'.
  26728. 'thread'
  26729. If this is a thread-specific breakpoint, then this identifies the
  26730. thread in which the breakpoint can trigger.
  26731. 'task'
  26732. If this breakpoint is restricted to a particular Ada task, then
  26733. this field will hold the task identifier.
  26734. 'cond'
  26735. If the breakpoint is conditional, this is the condition expression.
  26736. 'ignore'
  26737. The ignore count of the breakpoint.
  26738. 'enable'
  26739. The enable count of the breakpoint.
  26740. 'traceframe-usage'
  26741. FIXME.
  26742. 'static-tracepoint-marker-string-id'
  26743. For a static tracepoint, the name of the static tracepoint marker.
  26744. 'mask'
  26745. For a masked watchpoint, this is the mask.
  26746. 'pass'
  26747. A tracepoint's pass count.
  26748. 'original-location'
  26749. The location of the breakpoint as originally specified by the user.
  26750. This field is optional.
  26751. 'times'
  26752. The number of times the breakpoint has been hit.
  26753. 'installed'
  26754. This field is only given for tracepoints. This is either 'y',
  26755. meaning that the tracepoint is installed, or 'n', meaning that it
  26756. is not.
  26757. 'what'
  26758. Some extra data, the exact contents of which are type-dependent.
  26759. 'locations'
  26760. This field is present if the breakpoint has multiple locations. It
  26761. is also exceptionally present if the breakpoint is enabled and has
  26762. a single, disabled location.
  26763. The value is a list of locations. The format of a location is
  26764. described below.
  26765. A location in a multi-location breakpoint is represented as a tuple
  26766. with the following fields:
  26767. 'number'
  26768. The location number as a dotted pair, like '1.2'. The first digit
  26769. is the number of the parent breakpoint. The second digit is the
  26770. number of the location within that breakpoint.
  26771. 'enabled'
  26772. This indicates whether the location is enabled, in which case the
  26773. value is 'y', or disabled, in which case the value is 'n'. Note
  26774. that this is not the same as the field 'enable'.
  26775. 'addr'
  26776. The address of this location as an hexidecimal number.
  26777. 'addr_flags'
  26778. Optional field containing any flags related to the address. These
  26779. flags are architecture-dependent; see *note Architectures:: for
  26780. their meaning for a particular CPU.
  26781. 'func'
  26782. If known, the function in which the location appears. If not
  26783. known, this field is not present.
  26784. 'file'
  26785. The name of the source file which contains this location, if known.
  26786. If not known, this field is not present.
  26787. 'fullname'
  26788. The full file name of the source file which contains this location,
  26789. if known. If not known, this field is not present.
  26790. 'line'
  26791. The line number at which this location appears, if known. If not
  26792. known, this field is not present.
  26793. 'thread-groups'
  26794. The thread groups this location is in.
  26795. For example, here is what the output of '-break-insert' (*note GDB/MI
  26796. Breakpoint Commands::) might be:
  26797. -> -break-insert main
  26798. <- ^done,bkpt={number="1",type="breakpoint",disp="keep",
  26799. enabled="y",addr="0x08048564",func="main",file="myprog.c",
  26800. fullname="/home/nickrob/myprog.c",line="68",thread-groups=["i1"],
  26801. times="0"}
  26802. <- (gdb)
  26803. 
  26804. File: gdb.info, Node: GDB/MI Frame Information, Next: GDB/MI Thread Information, Prev: GDB/MI Breakpoint Information, Up: GDB/MI Output Records
  26805. 27.5.5 GDB/MI Frame Information
  26806. -------------------------------
  26807. Response from many MI commands includes an information about stack
  26808. frame. This information is a tuple that may have the following fields:
  26809. 'level'
  26810. The level of the stack frame. The innermost frame has the level of
  26811. zero. This field is always present.
  26812. 'func'
  26813. The name of the function corresponding to the frame. This field
  26814. may be absent if GDB is unable to determine the function name.
  26815. 'addr'
  26816. The code address for the frame. This field is always present.
  26817. 'addr_flags'
  26818. Optional field containing any flags related to the address. These
  26819. flags are architecture-dependent; see *note Architectures:: for
  26820. their meaning for a particular CPU.
  26821. 'file'
  26822. The name of the source files that correspond to the frame's code
  26823. address. This field may be absent.
  26824. 'line'
  26825. The source line corresponding to the frames' code address. This
  26826. field may be absent.
  26827. 'from'
  26828. The name of the binary file (either executable or shared library)
  26829. the corresponds to the frame's code address. This field may be
  26830. absent.
  26831. 
  26832. File: gdb.info, Node: GDB/MI Thread Information, Next: GDB/MI Ada Exception Information, Prev: GDB/MI Frame Information, Up: GDB/MI Output Records
  26833. 27.5.6 GDB/MI Thread Information
  26834. --------------------------------
  26835. Whenever GDB has to report an information about a thread, it uses a
  26836. tuple with the following fields. The fields are always present unless
  26837. stated otherwise.
  26838. 'id'
  26839. The global numeric id assigned to the thread by GDB.
  26840. 'target-id'
  26841. The target-specific string identifying the thread.
  26842. 'details'
  26843. Additional information about the thread provided by the target. It
  26844. is supposed to be human-readable and not interpreted by the
  26845. frontend. This field is optional.
  26846. 'name'
  26847. The name of the thread. If the user specified a name using the
  26848. 'thread name' command, then this name is given. Otherwise, if GDB
  26849. can extract the thread name from the target, then that name is
  26850. given. If GDB cannot find the thread name, then this field is
  26851. omitted.
  26852. 'state'
  26853. The execution state of the thread, either 'stopped' or 'running',
  26854. depending on whether the thread is presently running.
  26855. 'frame'
  26856. The stack frame currently executing in the thread. This field is
  26857. only present if the thread is stopped. Its format is documented in
  26858. *note GDB/MI Frame Information::.
  26859. 'core'
  26860. The value of this field is an integer number of the processor core
  26861. the thread was last seen on. This field is optional.
  26862. 
  26863. File: gdb.info, Node: GDB/MI Ada Exception Information, Prev: GDB/MI Thread Information, Up: GDB/MI Output Records
  26864. 27.5.7 GDB/MI Ada Exception Information
  26865. ---------------------------------------
  26866. Whenever a '*stopped' record is emitted because the program stopped
  26867. after hitting an exception catchpoint (*note Set Catchpoints::), GDB
  26868. provides the name of the exception that was raised via the
  26869. 'exception-name' field. Also, for exceptions that were raised with an
  26870. exception message, GDB provides that message via the 'exception-message'
  26871. field.
  26872. 
  26873. File: gdb.info, Node: GDB/MI Simple Examples, Next: GDB/MI Command Description Format, Prev: GDB/MI Output Records, Up: GDB/MI
  26874. 27.6 Simple Examples of GDB/MI Interaction
  26875. ==========================================
  26876. This subsection presents several simple examples of interaction using
  26877. the GDB/MI interface. In these examples, '->' means that the following
  26878. line is passed to GDB/MI as input, while '<-' means the output received
  26879. from GDB/MI.
  26880. Note the line breaks shown in the examples are here only for
  26881. readability, they don't appear in the real output.
  26882. Setting a Breakpoint
  26883. --------------------
  26884. Setting a breakpoint generates synchronous output which contains
  26885. detailed information of the breakpoint.
  26886. -> -break-insert main
  26887. <- ^done,bkpt={number="1",type="breakpoint",disp="keep",
  26888. enabled="y",addr="0x08048564",func="main",file="myprog.c",
  26889. fullname="/home/nickrob/myprog.c",line="68",thread-groups=["i1"],
  26890. times="0"}
  26891. <- (gdb)
  26892. Program Execution
  26893. -----------------
  26894. Program execution generates asynchronous records and MI gives the reason
  26895. that execution stopped.
  26896. -> -exec-run
  26897. <- ^running
  26898. <- (gdb)
  26899. <- *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
  26900. frame={addr="0x08048564",func="main",
  26901. args=[{name="argc",value="1"},{name="argv",value="0xbfc4d4d4"}],
  26902. file="myprog.c",fullname="/home/nickrob/myprog.c",line="68",
  26903. arch="i386:x86_64"}
  26904. <- (gdb)
  26905. -> -exec-continue
  26906. <- ^running
  26907. <- (gdb)
  26908. <- *stopped,reason="exited-normally"
  26909. <- (gdb)
  26910. Quitting GDB
  26911. ------------
  26912. Quitting GDB just prints the result class '^exit'.
  26913. -> (gdb)
  26914. <- -gdb-exit
  26915. <- ^exit
  26916. Please note that '^exit' is printed immediately, but it might take
  26917. some time for GDB to actually exit. During that time, GDB performs
  26918. necessary cleanups, including killing programs being debugged or
  26919. disconnecting from debug hardware, so the frontend should wait till GDB
  26920. exits and should only forcibly kill GDB if it fails to exit in
  26921. reasonable time.
  26922. A Bad Command
  26923. -------------
  26924. Here's what happens if you pass a non-existent command:
  26925. -> -rubbish
  26926. <- ^error,msg="Undefined MI command: rubbish"
  26927. <- (gdb)
  26928. 
  26929. File: gdb.info, Node: GDB/MI Command Description Format, Next: GDB/MI Breakpoint Commands, Prev: GDB/MI Simple Examples, Up: GDB/MI
  26930. 27.7 GDB/MI Command Description Format
  26931. ======================================
  26932. The remaining sections describe blocks of commands. Each block of
  26933. commands is laid out in a fashion similar to this section.
  26934. Motivation
  26935. ----------
  26936. The motivation for this collection of commands.
  26937. Introduction
  26938. ------------
  26939. A brief introduction to this collection of commands as a whole.
  26940. Commands
  26941. --------
  26942. For each command in the block, the following is described:
  26943. Synopsis
  26944. ........
  26945. -command ARGS...
  26946. Result
  26947. ......
  26948. GDB Command
  26949. ...........
  26950. The corresponding GDB CLI command(s), if any.
  26951. Example
  26952. .......
  26953. Example(s) formatted for readability. Some of the described commands
  26954. have not been implemented yet and these are labeled N.A. (not
  26955. available).
  26956. 
  26957. File: gdb.info, Node: GDB/MI Breakpoint Commands, Next: GDB/MI Catchpoint Commands, Prev: GDB/MI Command Description Format, Up: GDB/MI
  26958. 27.8 GDB/MI Breakpoint Commands
  26959. ===============================
  26960. This section documents GDB/MI commands for manipulating breakpoints.
  26961. The '-break-after' Command
  26962. --------------------------
  26963. Synopsis
  26964. ........
  26965. -break-after NUMBER COUNT
  26966. The breakpoint number NUMBER is not in effect until it has been hit
  26967. COUNT times. To see how this is reflected in the output of the
  26968. '-break-list' command, see the description of the '-break-list' command
  26969. below.
  26970. GDB Command
  26971. ...........
  26972. The corresponding GDB command is 'ignore'.
  26973. Example
  26974. .......
  26975. (gdb)
  26976. -break-insert main
  26977. ^done,bkpt={number="1",type="breakpoint",disp="keep",
  26978. enabled="y",addr="0x000100d0",func="main",file="hello.c",
  26979. fullname="/home/foo/hello.c",line="5",thread-groups=["i1"],
  26980. times="0"}
  26981. (gdb)
  26982. -break-after 1 3
  26983. ~
  26984. ^done
  26985. (gdb)
  26986. -break-list
  26987. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  26988. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  26989. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  26990. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  26991. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  26992. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  26993. {width="40",alignment="2",col_name="what",colhdr="What"}],
  26994. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  26995. addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
  26996. line="5",thread-groups=["i1"],times="0",ignore="3"}]}
  26997. (gdb)
  26998. The '-break-commands' Command
  26999. -----------------------------
  27000. Synopsis
  27001. ........
  27002. -break-commands NUMBER [ COMMAND1 ... COMMANDN ]
  27003. Specifies the CLI commands that should be executed when breakpoint
  27004. NUMBER is hit. The parameters COMMAND1 to COMMANDN are the commands.
  27005. If no command is specified, any previously-set commands are cleared.
  27006. *Note Break Commands::. Typical use of this functionality is tracing a
  27007. program, that is, printing of values of some variables whenever
  27008. breakpoint is hit and then continuing.
  27009. GDB Command
  27010. ...........
  27011. The corresponding GDB command is 'commands'.
  27012. Example
  27013. .......
  27014. (gdb)
  27015. -break-insert main
  27016. ^done,bkpt={number="1",type="breakpoint",disp="keep",
  27017. enabled="y",addr="0x000100d0",func="main",file="hello.c",
  27018. fullname="/home/foo/hello.c",line="5",thread-groups=["i1"],
  27019. times="0"}
  27020. (gdb)
  27021. -break-commands 1 "print v" "continue"
  27022. ^done
  27023. (gdb)
  27024. The '-break-condition' Command
  27025. ------------------------------
  27026. Synopsis
  27027. ........
  27028. -break-condition NUMBER EXPR
  27029. Breakpoint NUMBER will stop the program only if the condition in EXPR
  27030. is true. The condition becomes part of the '-break-list' output (see
  27031. the description of the '-break-list' command below).
  27032. GDB Command
  27033. ...........
  27034. The corresponding GDB command is 'condition'.
  27035. Example
  27036. .......
  27037. (gdb)
  27038. -break-condition 1 1
  27039. ^done
  27040. (gdb)
  27041. -break-list
  27042. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  27043. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27044. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27045. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27046. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27047. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27048. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27049. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  27050. addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
  27051. line="5",cond="1",thread-groups=["i1"],times="0",ignore="3"}]}
  27052. (gdb)
  27053. The '-break-delete' Command
  27054. ---------------------------
  27055. Synopsis
  27056. ........
  27057. -break-delete ( BREAKPOINT )+
  27058. Delete the breakpoint(s) whose number(s) are specified in the
  27059. argument list. This is obviously reflected in the breakpoint list.
  27060. GDB Command
  27061. ...........
  27062. The corresponding GDB command is 'delete'.
  27063. Example
  27064. .......
  27065. (gdb)
  27066. -break-delete 1
  27067. ^done
  27068. (gdb)
  27069. -break-list
  27070. ^done,BreakpointTable={nr_rows="0",nr_cols="6",
  27071. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27072. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27073. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27074. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27075. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27076. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27077. body=[]}
  27078. (gdb)
  27079. The '-break-disable' Command
  27080. ----------------------------
  27081. Synopsis
  27082. ........
  27083. -break-disable ( BREAKPOINT )+
  27084. Disable the named BREAKPOINT(s). The field 'enabled' in the break
  27085. list is now set to 'n' for the named BREAKPOINT(s).
  27086. GDB Command
  27087. ...........
  27088. The corresponding GDB command is 'disable'.
  27089. Example
  27090. .......
  27091. (gdb)
  27092. -break-disable 2
  27093. ^done
  27094. (gdb)
  27095. -break-list
  27096. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  27097. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27098. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27099. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27100. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27101. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27102. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27103. body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="n",
  27104. addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
  27105. line="5",thread-groups=["i1"],times="0"}]}
  27106. (gdb)
  27107. The '-break-enable' Command
  27108. ---------------------------
  27109. Synopsis
  27110. ........
  27111. -break-enable ( BREAKPOINT )+
  27112. Enable (previously disabled) BREAKPOINT(s).
  27113. GDB Command
  27114. ...........
  27115. The corresponding GDB command is 'enable'.
  27116. Example
  27117. .......
  27118. (gdb)
  27119. -break-enable 2
  27120. ^done
  27121. (gdb)
  27122. -break-list
  27123. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  27124. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27125. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27126. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27127. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27128. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27129. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27130. body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="y",
  27131. addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
  27132. line="5",thread-groups=["i1"],times="0"}]}
  27133. (gdb)
  27134. The '-break-info' Command
  27135. -------------------------
  27136. Synopsis
  27137. ........
  27138. -break-info BREAKPOINT
  27139. Get information about a single breakpoint.
  27140. The result is a table of breakpoints. *Note GDB/MI Breakpoint
  27141. Information::, for details on the format of each breakpoint in the
  27142. table.
  27143. GDB Command
  27144. ...........
  27145. The corresponding GDB command is 'info break BREAKPOINT'.
  27146. Example
  27147. .......
  27148. N.A.
  27149. The '-break-insert' Command
  27150. ---------------------------
  27151. Synopsis
  27152. ........
  27153. -break-insert [ -t ] [ -h ] [ -f ] [ -d ] [ -a ]
  27154. [ -c CONDITION ] [ -i IGNORE-COUNT ]
  27155. [ -p THREAD-ID ] [ LOCATION ]
  27156. If specified, LOCATION, can be one of:
  27157. LINESPEC LOCATION
  27158. A linespec location. *Note Linespec Locations::.
  27159. EXPLICIT LOCATION
  27160. An explicit location. GDB/MI explicit locations are analogous to
  27161. the CLI's explicit locations using the option names listed below.
  27162. *Note Explicit Locations::.
  27163. '--source FILENAME'
  27164. The source file name of the location. This option requires
  27165. the use of either '--function' or '--line'.
  27166. '--function FUNCTION'
  27167. The name of a function or method.
  27168. '--label LABEL'
  27169. The name of a label.
  27170. '--line LINEOFFSET'
  27171. An absolute or relative line offset from the start of the
  27172. location.
  27173. ADDRESS LOCATION
  27174. An address location, *ADDRESS. *Note Address Locations::.
  27175. The possible optional parameters of this command are:
  27176. '-t'
  27177. Insert a temporary breakpoint.
  27178. '-h'
  27179. Insert a hardware breakpoint.
  27180. '-f'
  27181. If LOCATION cannot be parsed (for example if it refers to unknown
  27182. files or functions), create a pending breakpoint. Without this
  27183. flag, GDB will report an error, and won't create a breakpoint, if
  27184. LOCATION cannot be parsed.
  27185. '-d'
  27186. Create a disabled breakpoint.
  27187. '-a'
  27188. Create a tracepoint. *Note Tracepoints::. When this parameter is
  27189. used together with '-h', a fast tracepoint is created.
  27190. '-c CONDITION'
  27191. Make the breakpoint conditional on CONDITION.
  27192. '-i IGNORE-COUNT'
  27193. Initialize the IGNORE-COUNT.
  27194. '-p THREAD-ID'
  27195. Restrict the breakpoint to the thread with the specified global
  27196. THREAD-ID.
  27197. Result
  27198. ......
  27199. *Note GDB/MI Breakpoint Information::, for details on the format of the
  27200. resulting breakpoint.
  27201. Note: this format is open to change.
  27202. GDB Command
  27203. ...........
  27204. The corresponding GDB commands are 'break', 'tbreak', 'hbreak', and
  27205. 'thbreak'.
  27206. Example
  27207. .......
  27208. (gdb)
  27209. -break-insert main
  27210. ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",
  27211. fullname="/home/foo/recursive2.c,line="4",thread-groups=["i1"],
  27212. times="0"}
  27213. (gdb)
  27214. -break-insert -t foo
  27215. ^done,bkpt={number="2",addr="0x00010774",file="recursive2.c",
  27216. fullname="/home/foo/recursive2.c,line="11",thread-groups=["i1"],
  27217. times="0"}
  27218. (gdb)
  27219. -break-list
  27220. ^done,BreakpointTable={nr_rows="2",nr_cols="6",
  27221. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27222. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27223. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27224. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27225. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27226. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27227. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  27228. addr="0x0001072c", func="main",file="recursive2.c",
  27229. fullname="/home/foo/recursive2.c,"line="4",thread-groups=["i1"],
  27230. times="0"},
  27231. bkpt={number="2",type="breakpoint",disp="del",enabled="y",
  27232. addr="0x00010774",func="foo",file="recursive2.c",
  27233. fullname="/home/foo/recursive2.c",line="11",thread-groups=["i1"],
  27234. times="0"}]}
  27235. (gdb)
  27236. The '-dprintf-insert' Command
  27237. -----------------------------
  27238. Synopsis
  27239. ........
  27240. -dprintf-insert [ -t ] [ -f ] [ -d ]
  27241. [ -c CONDITION ] [ -i IGNORE-COUNT ]
  27242. [ -p THREAD-ID ] [ LOCATION ] [ FORMAT ]
  27243. [ ARGUMENT ]
  27244. If supplied, LOCATION may be specified the same way as for the
  27245. '-break-insert' command. *Note -break-insert::.
  27246. The possible optional parameters of this command are:
  27247. '-t'
  27248. Insert a temporary breakpoint.
  27249. '-f'
  27250. If LOCATION cannot be parsed (for example, if it refers to unknown
  27251. files or functions), create a pending breakpoint. Without this
  27252. flag, GDB will report an error, and won't create a breakpoint, if
  27253. LOCATION cannot be parsed.
  27254. '-d'
  27255. Create a disabled breakpoint.
  27256. '-c CONDITION'
  27257. Make the breakpoint conditional on CONDITION.
  27258. '-i IGNORE-COUNT'
  27259. Set the ignore count of the breakpoint (*note ignore count:
  27260. Conditions.) to IGNORE-COUNT.
  27261. '-p THREAD-ID'
  27262. Restrict the breakpoint to the thread with the specified global
  27263. THREAD-ID.
  27264. Result
  27265. ......
  27266. *Note GDB/MI Breakpoint Information::, for details on the format of the
  27267. resulting breakpoint.
  27268. GDB Command
  27269. ...........
  27270. The corresponding GDB command is 'dprintf'.
  27271. Example
  27272. .......
  27273. (gdb)
  27274. 4-dprintf-insert foo "At foo entry\n"
  27275. 4^done,bkpt={number="1",type="dprintf",disp="keep",enabled="y",
  27276. addr="0x000000000040061b",func="foo",file="mi-dprintf.c",
  27277. fullname="mi-dprintf.c",line="25",thread-groups=["i1"],
  27278. times="0",script={"printf \"At foo entry\\n\"","continue"},
  27279. original-location="foo"}
  27280. (gdb)
  27281. 5-dprintf-insert 26 "arg=%d, g=%d\n" arg g
  27282. 5^done,bkpt={number="2",type="dprintf",disp="keep",enabled="y",
  27283. addr="0x000000000040062a",func="foo",file="mi-dprintf.c",
  27284. fullname="mi-dprintf.c",line="26",thread-groups=["i1"],
  27285. times="0",script={"printf \"arg=%d, g=%d\\n\", arg, g","continue"},
  27286. original-location="mi-dprintf.c:26"}
  27287. (gdb)
  27288. The '-break-list' Command
  27289. -------------------------
  27290. Synopsis
  27291. ........
  27292. -break-list
  27293. Displays the list of inserted breakpoints, showing the following
  27294. fields:
  27295. 'Number'
  27296. number of the breakpoint
  27297. 'Type'
  27298. type of the breakpoint: 'breakpoint' or 'watchpoint'
  27299. 'Disposition'
  27300. should the breakpoint be deleted or disabled when it is hit: 'keep'
  27301. or 'nokeep'
  27302. 'Enabled'
  27303. is the breakpoint enabled or no: 'y' or 'n'
  27304. 'Address'
  27305. memory location at which the breakpoint is set
  27306. 'What'
  27307. logical location of the breakpoint, expressed by function name,
  27308. file name, line number
  27309. 'Thread-groups'
  27310. list of thread groups to which this breakpoint applies
  27311. 'Times'
  27312. number of times the breakpoint has been hit
  27313. If there are no breakpoints or watchpoints, the 'BreakpointTable'
  27314. 'body' field is an empty list.
  27315. GDB Command
  27316. ...........
  27317. The corresponding GDB command is 'info break'.
  27318. Example
  27319. .......
  27320. (gdb)
  27321. -break-list
  27322. ^done,BreakpointTable={nr_rows="2",nr_cols="6",
  27323. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27324. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27325. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27326. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27327. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27328. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27329. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  27330. addr="0x000100d0",func="main",file="hello.c",line="5",thread-groups=["i1"],
  27331. times="0"},
  27332. bkpt={number="2",type="breakpoint",disp="keep",enabled="y",
  27333. addr="0x00010114",func="foo",file="hello.c",fullname="/home/foo/hello.c",
  27334. line="13",thread-groups=["i1"],times="0"}]}
  27335. (gdb)
  27336. Here's an example of the result when there are no breakpoints:
  27337. (gdb)
  27338. -break-list
  27339. ^done,BreakpointTable={nr_rows="0",nr_cols="6",
  27340. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27341. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27342. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27343. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27344. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27345. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27346. body=[]}
  27347. (gdb)
  27348. The '-break-passcount' Command
  27349. ------------------------------
  27350. Synopsis
  27351. ........
  27352. -break-passcount TRACEPOINT-NUMBER PASSCOUNT
  27353. Set the passcount for tracepoint TRACEPOINT-NUMBER to PASSCOUNT. If
  27354. the breakpoint referred to by TRACEPOINT-NUMBER is not a tracepoint,
  27355. error is emitted. This corresponds to CLI command 'passcount'.
  27356. The '-break-watch' Command
  27357. --------------------------
  27358. Synopsis
  27359. ........
  27360. -break-watch [ -a | -r ]
  27361. Create a watchpoint. With the '-a' option it will create an "access"
  27362. watchpoint, i.e., a watchpoint that triggers either on a read from or on
  27363. a write to the memory location. With the '-r' option, the watchpoint
  27364. created is a "read" watchpoint, i.e., it will trigger only when the
  27365. memory location is accessed for reading. Without either of the options,
  27366. the watchpoint created is a regular watchpoint, i.e., it will trigger
  27367. when the memory location is accessed for writing. *Note Setting
  27368. Watchpoints: Set Watchpoints.
  27369. Note that '-break-list' will report a single list of watchpoints and
  27370. breakpoints inserted.
  27371. GDB Command
  27372. ...........
  27373. The corresponding GDB commands are 'watch', 'awatch', and 'rwatch'.
  27374. Example
  27375. .......
  27376. Setting a watchpoint on a variable in the 'main' function:
  27377. (gdb)
  27378. -break-watch x
  27379. ^done,wpt={number="2",exp="x"}
  27380. (gdb)
  27381. -exec-continue
  27382. ^running
  27383. (gdb)
  27384. *stopped,reason="watchpoint-trigger",wpt={number="2",exp="x"},
  27385. value={old="-268439212",new="55"},
  27386. frame={func="main",args=[],file="recursive2.c",
  27387. fullname="/home/foo/bar/recursive2.c",line="5",arch="i386:x86_64"}
  27388. (gdb)
  27389. Setting a watchpoint on a variable local to a function. GDB will
  27390. stop the program execution twice: first for the variable changing value,
  27391. then for the watchpoint going out of scope.
  27392. (gdb)
  27393. -break-watch C
  27394. ^done,wpt={number="5",exp="C"}
  27395. (gdb)
  27396. -exec-continue
  27397. ^running
  27398. (gdb)
  27399. *stopped,reason="watchpoint-trigger",
  27400. wpt={number="5",exp="C"},value={old="-276895068",new="3"},
  27401. frame={func="callee4",args=[],
  27402. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27403. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13",
  27404. arch="i386:x86_64"}
  27405. (gdb)
  27406. -exec-continue
  27407. ^running
  27408. (gdb)
  27409. *stopped,reason="watchpoint-scope",wpnum="5",
  27410. frame={func="callee3",args=[{name="strarg",
  27411. value="0x11940 \"A string argument.\""}],
  27412. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27413. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",
  27414. arch="i386:x86_64"}
  27415. (gdb)
  27416. Listing breakpoints and watchpoints, at different points in the
  27417. program execution. Note that once the watchpoint goes out of scope, it
  27418. is deleted.
  27419. (gdb)
  27420. -break-watch C
  27421. ^done,wpt={number="2",exp="C"}
  27422. (gdb)
  27423. -break-list
  27424. ^done,BreakpointTable={nr_rows="2",nr_cols="6",
  27425. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27426. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27427. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27428. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27429. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27430. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27431. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  27432. addr="0x00010734",func="callee4",
  27433. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27434. fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c"line="8",thread-groups=["i1"],
  27435. times="1"},
  27436. bkpt={number="2",type="watchpoint",disp="keep",
  27437. enabled="y",addr="",what="C",thread-groups=["i1"],times="0"}]}
  27438. (gdb)
  27439. -exec-continue
  27440. ^running
  27441. (gdb)
  27442. *stopped,reason="watchpoint-trigger",wpt={number="2",exp="C"},
  27443. value={old="-276895068",new="3"},
  27444. frame={func="callee4",args=[],
  27445. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27446. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13",
  27447. arch="i386:x86_64"}
  27448. (gdb)
  27449. -break-list
  27450. ^done,BreakpointTable={nr_rows="2",nr_cols="6",
  27451. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27452. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27453. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27454. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27455. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27456. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27457. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  27458. addr="0x00010734",func="callee4",
  27459. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27460. fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",thread-groups=["i1"],
  27461. times="1"},
  27462. bkpt={number="2",type="watchpoint",disp="keep",
  27463. enabled="y",addr="",what="C",thread-groups=["i1"],times="-5"}]}
  27464. (gdb)
  27465. -exec-continue
  27466. ^running
  27467. ^done,reason="watchpoint-scope",wpnum="2",
  27468. frame={func="callee3",args=[{name="strarg",
  27469. value="0x11940 \"A string argument.\""}],
  27470. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27471. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",
  27472. arch="i386:x86_64"}
  27473. (gdb)
  27474. -break-list
  27475. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  27476. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27477. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27478. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27479. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27480. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27481. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27482. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  27483. addr="0x00010734",func="callee4",
  27484. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27485. fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",
  27486. thread-groups=["i1"],times="1"}]}
  27487. (gdb)
  27488. 
  27489. File: gdb.info, Node: GDB/MI Catchpoint Commands, Next: GDB/MI Program Context, Prev: GDB/MI Breakpoint Commands, Up: GDB/MI
  27490. 27.9 GDB/MI Catchpoint Commands
  27491. ===============================
  27492. This section documents GDB/MI commands for manipulating catchpoints.
  27493. * Menu:
  27494. * Shared Library GDB/MI Catchpoint Commands::
  27495. * Ada Exception GDB/MI Catchpoint Commands::
  27496. * C++ Exception GDB/MI Catchpoint Commands::
  27497. 
  27498. File: gdb.info, Node: Shared Library GDB/MI Catchpoint Commands, Next: Ada Exception GDB/MI Catchpoint Commands, Up: GDB/MI Catchpoint Commands
  27499. 27.9.1 Shared Library GDB/MI Catchpoints
  27500. ----------------------------------------
  27501. The '-catch-load' Command
  27502. -------------------------
  27503. Synopsis
  27504. ........
  27505. -catch-load [ -t ] [ -d ] REGEXP
  27506. Add a catchpoint for library load events. If the '-t' option is
  27507. used, the catchpoint is a temporary one (*note Setting Breakpoints: Set
  27508. Breaks.). If the '-d' option is used, the catchpoint is created in a
  27509. disabled state. The 'regexp' argument is a regular expression used to
  27510. match the name of the loaded library.
  27511. GDB Command
  27512. ...........
  27513. The corresponding GDB command is 'catch load'.
  27514. Example
  27515. .......
  27516. -catch-load -t foo.so
  27517. ^done,bkpt={number="1",type="catchpoint",disp="del",enabled="y",
  27518. what="load of library matching foo.so",catch-type="load",times="0"}
  27519. (gdb)
  27520. The '-catch-unload' Command
  27521. ---------------------------
  27522. Synopsis
  27523. ........
  27524. -catch-unload [ -t ] [ -d ] REGEXP
  27525. Add a catchpoint for library unload events. If the '-t' option is
  27526. used, the catchpoint is a temporary one (*note Setting Breakpoints: Set
  27527. Breaks.). If the '-d' option is used, the catchpoint is created in a
  27528. disabled state. The 'regexp' argument is a regular expression used to
  27529. match the name of the unloaded library.
  27530. GDB Command
  27531. ...........
  27532. The corresponding GDB command is 'catch unload'.
  27533. Example
  27534. .......
  27535. -catch-unload -d bar.so
  27536. ^done,bkpt={number="2",type="catchpoint",disp="keep",enabled="n",
  27537. what="load of library matching bar.so",catch-type="unload",times="0"}
  27538. (gdb)
  27539. 
  27540. File: gdb.info, Node: Ada Exception GDB/MI Catchpoint Commands, Next: C++ Exception GDB/MI Catchpoint Commands, Prev: Shared Library GDB/MI Catchpoint Commands, Up: GDB/MI Catchpoint Commands
  27541. 27.9.2 Ada Exception GDB/MI Catchpoints
  27542. ---------------------------------------
  27543. The following GDB/MI commands can be used to create catchpoints that
  27544. stop the execution when Ada exceptions are being raised.
  27545. The '-catch-assert' Command
  27546. ---------------------------
  27547. Synopsis
  27548. ........
  27549. -catch-assert [ -c CONDITION] [ -d ] [ -t ]
  27550. Add a catchpoint for failed Ada assertions.
  27551. The possible optional parameters for this command are:
  27552. '-c CONDITION'
  27553. Make the catchpoint conditional on CONDITION.
  27554. '-d'
  27555. Create a disabled catchpoint.
  27556. '-t'
  27557. Create a temporary catchpoint.
  27558. GDB Command
  27559. ...........
  27560. The corresponding GDB command is 'catch assert'.
  27561. Example
  27562. .......
  27563. -catch-assert
  27564. ^done,bkptno="5",bkpt={number="5",type="breakpoint",disp="keep",
  27565. enabled="y",addr="0x0000000000404888",what="failed Ada assertions",
  27566. thread-groups=["i1"],times="0",
  27567. original-location="__gnat_debug_raise_assert_failure"}
  27568. (gdb)
  27569. The '-catch-exception' Command
  27570. ------------------------------
  27571. Synopsis
  27572. ........
  27573. -catch-exception [ -c CONDITION] [ -d ] [ -e EXCEPTION-NAME ]
  27574. [ -t ] [ -u ]
  27575. Add a catchpoint stopping when Ada exceptions are raised. By
  27576. default, the command stops the program when any Ada exception gets
  27577. raised. But it is also possible, by using some of the optional
  27578. parameters described below, to create more selective catchpoints.
  27579. The possible optional parameters for this command are:
  27580. '-c CONDITION'
  27581. Make the catchpoint conditional on CONDITION.
  27582. '-d'
  27583. Create a disabled catchpoint.
  27584. '-e EXCEPTION-NAME'
  27585. Only stop when EXCEPTION-NAME is raised. This option cannot be
  27586. used combined with '-u'.
  27587. '-t'
  27588. Create a temporary catchpoint.
  27589. '-u'
  27590. Stop only when an unhandled exception gets raised. This option
  27591. cannot be used combined with '-e'.
  27592. GDB Command
  27593. ...........
  27594. The corresponding GDB commands are 'catch exception' and 'catch
  27595. exception unhandled'.
  27596. Example
  27597. .......
  27598. -catch-exception -e Program_Error
  27599. ^done,bkptno="4",bkpt={number="4",type="breakpoint",disp="keep",
  27600. enabled="y",addr="0x0000000000404874",
  27601. what="`Program_Error' Ada exception", thread-groups=["i1"],
  27602. times="0",original-location="__gnat_debug_raise_exception"}
  27603. (gdb)
  27604. The '-catch-handlers' Command
  27605. -----------------------------
  27606. Synopsis
  27607. ........
  27608. -catch-handlers [ -c CONDITION] [ -d ] [ -e EXCEPTION-NAME ]
  27609. [ -t ]
  27610. Add a catchpoint stopping when Ada exceptions are handled. By
  27611. default, the command stops the program when any Ada exception gets
  27612. handled. But it is also possible, by using some of the optional
  27613. parameters described below, to create more selective catchpoints.
  27614. The possible optional parameters for this command are:
  27615. '-c CONDITION'
  27616. Make the catchpoint conditional on CONDITION.
  27617. '-d'
  27618. Create a disabled catchpoint.
  27619. '-e EXCEPTION-NAME'
  27620. Only stop when EXCEPTION-NAME is handled.
  27621. '-t'
  27622. Create a temporary catchpoint.
  27623. GDB Command
  27624. ...........
  27625. The corresponding GDB command is 'catch handlers'.
  27626. Example
  27627. .......
  27628. -catch-handlers -e Constraint_Error
  27629. ^done,bkptno="4",bkpt={number="4",type="breakpoint",disp="keep",
  27630. enabled="y",addr="0x0000000000402f68",
  27631. what="`Constraint_Error' Ada exception handlers",thread-groups=["i1"],
  27632. times="0",original-location="__gnat_begin_handler"}
  27633. (gdb)
  27634. 
  27635. File: gdb.info, Node: C++ Exception GDB/MI Catchpoint Commands, Prev: Ada Exception GDB/MI Catchpoint Commands, Up: GDB/MI Catchpoint Commands
  27636. 27.9.3 C++ Exception GDB/MI Catchpoints
  27637. ---------------------------------------
  27638. The following GDB/MI commands can be used to create catchpoints that
  27639. stop the execution when C++ exceptions are being throw, rethrown, or
  27640. caught.
  27641. The '-catch-throw' Command
  27642. --------------------------
  27643. Synopsis
  27644. ........
  27645. -catch-throw [ -t ] [ -r REGEXP]
  27646. Stop when the debuggee throws a C++ exception. If REGEXP is given,
  27647. then only exceptions whose type matches the regular expression will be
  27648. caught.
  27649. If '-t' is given, then the catchpoint is enabled only for one stop,
  27650. the catchpoint is automatically deleted after stopping once for the
  27651. event.
  27652. GDB Command
  27653. ...........
  27654. The corresponding GDB commands are 'catch throw' and 'tcatch throw'
  27655. (*note Set Catchpoints::).
  27656. Example
  27657. .......
  27658. -catch-throw -r exception_type
  27659. ^done,bkpt={number="1",type="catchpoint",disp="keep",enabled="y",
  27660. what="exception throw",catch-type="throw",
  27661. thread-groups=["i1"],
  27662. regexp="exception_type",times="0"}
  27663. (gdb)
  27664. -exec-run
  27665. ^running
  27666. (gdb)
  27667. ~"\n"
  27668. ~"Catchpoint 1 (exception thrown), 0x00007ffff7ae00ed
  27669. in __cxa_throw () from /lib64/libstdc++.so.6\n"
  27670. *stopped,bkptno="1",reason="breakpoint-hit",disp="keep",
  27671. frame={addr="0x00007ffff7ae00ed",func="__cxa_throw",
  27672. args=[],from="/lib64/libstdc++.so.6",arch="i386:x86-64"},
  27673. thread-id="1",stopped-threads="all",core="6"
  27674. (gdb)
  27675. The '-catch-rethrow' Command
  27676. ----------------------------
  27677. Synopsis
  27678. ........
  27679. -catch-rethrow [ -t ] [ -r REGEXP]
  27680. Stop when a C++ exception is re-thrown. If REGEXP is given, then
  27681. only exceptions whose type matches the regular expression will be
  27682. caught.
  27683. If '-t' is given, then the catchpoint is enabled only for one stop,
  27684. the catchpoint is automatically deleted after the first event is caught.
  27685. GDB Command
  27686. ...........
  27687. The corresponding GDB commands are 'catch rethrow' and 'tcatch rethrow'
  27688. (*note Set Catchpoints::).
  27689. Example
  27690. .......
  27691. -catch-rethrow -r exception_type
  27692. ^done,bkpt={number="1",type="catchpoint",disp="keep",enabled="y",
  27693. what="exception rethrow",catch-type="rethrow",
  27694. thread-groups=["i1"],
  27695. regexp="exception_type",times="0"}
  27696. (gdb)
  27697. -exec-run
  27698. ^running
  27699. (gdb)
  27700. ~"\n"
  27701. ~"Catchpoint 1 (exception rethrown), 0x00007ffff7ae00ed
  27702. in __cxa_rethrow () from /lib64/libstdc++.so.6\n"
  27703. *stopped,bkptno="1",reason="breakpoint-hit",disp="keep",
  27704. frame={addr="0x00007ffff7ae00ed",func="__cxa_rethrow",
  27705. args=[],from="/lib64/libstdc++.so.6",arch="i386:x86-64"},
  27706. thread-id="1",stopped-threads="all",core="6"
  27707. (gdb)
  27708. The '-catch-catch' Command
  27709. --------------------------
  27710. Synopsis
  27711. ........
  27712. -catch-catch [ -t ] [ -r REGEXP]
  27713. Stop when the debuggee catches a C++ exception. If REGEXP is given,
  27714. then only exceptions whose type matches the regular expression will be
  27715. caught.
  27716. If '-t' is given, then the catchpoint is enabled only for one stop,
  27717. the catchpoint is automatically deleted after the first event is caught.
  27718. GDB Command
  27719. ...........
  27720. The corresponding GDB commands are 'catch catch' and 'tcatch catch'
  27721. (*note Set Catchpoints::).
  27722. Example
  27723. .......
  27724. -catch-catch -r exception_type
  27725. ^done,bkpt={number="1",type="catchpoint",disp="keep",enabled="y",
  27726. what="exception catch",catch-type="catch",
  27727. thread-groups=["i1"],
  27728. regexp="exception_type",times="0"}
  27729. (gdb)
  27730. -exec-run
  27731. ^running
  27732. (gdb)
  27733. ~"\n"
  27734. ~"Catchpoint 1 (exception caught), 0x00007ffff7ae00ed
  27735. in __cxa_begin_catch () from /lib64/libstdc++.so.6\n"
  27736. *stopped,bkptno="1",reason="breakpoint-hit",disp="keep",
  27737. frame={addr="0x00007ffff7ae00ed",func="__cxa_begin_catch",
  27738. args=[],from="/lib64/libstdc++.so.6",arch="i386:x86-64"},
  27739. thread-id="1",stopped-threads="all",core="6"
  27740. (gdb)
  27741. 
  27742. File: gdb.info, Node: GDB/MI Program Context, Next: GDB/MI Thread Commands, Prev: GDB/MI Catchpoint Commands, Up: GDB/MI
  27743. 27.10 GDB/MI Program Context
  27744. ============================
  27745. The '-exec-arguments' Command
  27746. -----------------------------
  27747. Synopsis
  27748. ........
  27749. -exec-arguments ARGS
  27750. Set the inferior program arguments, to be used in the next
  27751. '-exec-run'.
  27752. GDB Command
  27753. ...........
  27754. The corresponding GDB command is 'set args'.
  27755. Example
  27756. .......
  27757. (gdb)
  27758. -exec-arguments -v word
  27759. ^done
  27760. (gdb)
  27761. The '-environment-cd' Command
  27762. -----------------------------
  27763. Synopsis
  27764. ........
  27765. -environment-cd PATHDIR
  27766. Set GDB's working directory.
  27767. GDB Command
  27768. ...........
  27769. The corresponding GDB command is 'cd'.
  27770. Example
  27771. .......
  27772. (gdb)
  27773. -environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
  27774. ^done
  27775. (gdb)
  27776. The '-environment-directory' Command
  27777. ------------------------------------
  27778. Synopsis
  27779. ........
  27780. -environment-directory [ -r ] [ PATHDIR ]+
  27781. Add directories PATHDIR to beginning of search path for source files.
  27782. If the '-r' option is used, the search path is reset to the default
  27783. search path. If directories PATHDIR are supplied in addition to the
  27784. '-r' option, the search path is first reset and then addition occurs as
  27785. normal. Multiple directories may be specified, separated by blanks.
  27786. Specifying multiple directories in a single command results in the
  27787. directories added to the beginning of the search path in the same order
  27788. they were presented in the command. If blanks are needed as part of a
  27789. directory name, double-quotes should be used around the name. In the
  27790. command output, the path will show up separated by the system
  27791. directory-separator character. The directory-separator character must
  27792. not be used in any directory name. If no directories are specified, the
  27793. current search path is displayed.
  27794. GDB Command
  27795. ...........
  27796. The corresponding GDB command is 'dir'.
  27797. Example
  27798. .......
  27799. (gdb)
  27800. -environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
  27801. ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
  27802. (gdb)
  27803. -environment-directory ""
  27804. ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
  27805. (gdb)
  27806. -environment-directory -r /home/jjohnstn/src/gdb /usr/src
  27807. ^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd"
  27808. (gdb)
  27809. -environment-directory -r
  27810. ^done,source-path="$cdir:$cwd"
  27811. (gdb)
  27812. The '-environment-path' Command
  27813. -------------------------------
  27814. Synopsis
  27815. ........
  27816. -environment-path [ -r ] [ PATHDIR ]+
  27817. Add directories PATHDIR to beginning of search path for object files.
  27818. If the '-r' option is used, the search path is reset to the original
  27819. search path that existed at gdb start-up. If directories PATHDIR are
  27820. supplied in addition to the '-r' option, the search path is first reset
  27821. and then addition occurs as normal. Multiple directories may be
  27822. specified, separated by blanks. Specifying multiple directories in a
  27823. single command results in the directories added to the beginning of the
  27824. search path in the same order they were presented in the command. If
  27825. blanks are needed as part of a directory name, double-quotes should be
  27826. used around the name. In the command output, the path will show up
  27827. separated by the system directory-separator character. The
  27828. directory-separator character must not be used in any directory name.
  27829. If no directories are specified, the current path is displayed.
  27830. GDB Command
  27831. ...........
  27832. The corresponding GDB command is 'path'.
  27833. Example
  27834. .......
  27835. (gdb)
  27836. -environment-path
  27837. ^done,path="/usr/bin"
  27838. (gdb)
  27839. -environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin
  27840. ^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin"
  27841. (gdb)
  27842. -environment-path -r /usr/local/bin
  27843. ^done,path="/usr/local/bin:/usr/bin"
  27844. (gdb)
  27845. The '-environment-pwd' Command
  27846. ------------------------------
  27847. Synopsis
  27848. ........
  27849. -environment-pwd
  27850. Show the current working directory.
  27851. GDB Command
  27852. ...........
  27853. The corresponding GDB command is 'pwd'.
  27854. Example
  27855. .......
  27856. (gdb)
  27857. -environment-pwd
  27858. ^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb"
  27859. (gdb)
  27860. 
  27861. File: gdb.info, Node: GDB/MI Thread Commands, Next: GDB/MI Ada Tasking Commands, Prev: GDB/MI Program Context, Up: GDB/MI
  27862. 27.11 GDB/MI Thread Commands
  27863. ============================
  27864. The '-thread-info' Command
  27865. --------------------------
  27866. Synopsis
  27867. ........
  27868. -thread-info [ THREAD-ID ]
  27869. Reports information about either a specific thread, if the THREAD-ID
  27870. parameter is present, or about all threads. THREAD-ID is the thread's
  27871. global thread ID. When printing information about all threads, also
  27872. reports the global ID of the current thread.
  27873. GDB Command
  27874. ...........
  27875. The 'info thread' command prints the same information about all threads.
  27876. Result
  27877. ......
  27878. The result contains the following attributes:
  27879. 'threads'
  27880. A list of threads. The format of the elements of the list is
  27881. described in *note GDB/MI Thread Information::.
  27882. 'current-thread-id'
  27883. The global id of the currently selected thread. This field is
  27884. omitted if there is no selected thread (for example, when the
  27885. selected inferior is not running, and therefore has no threads) or
  27886. if a THREAD-ID argument was passed to the command.
  27887. Example
  27888. .......
  27889. -thread-info
  27890. ^done,threads=[
  27891. {id="2",target-id="Thread 0xb7e14b90 (LWP 21257)",
  27892. frame={level="0",addr="0xffffe410",func="__kernel_vsyscall",
  27893. args=[]},state="running"},
  27894. {id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
  27895. frame={level="0",addr="0x0804891f",func="foo",
  27896. args=[{name="i",value="10"}],
  27897. file="/tmp/a.c",fullname="/tmp/a.c",line="158",arch="i386:x86_64"},
  27898. state="running"}],
  27899. current-thread-id="1"
  27900. (gdb)
  27901. The '-thread-list-ids' Command
  27902. ------------------------------
  27903. Synopsis
  27904. ........
  27905. -thread-list-ids
  27906. Produces a list of the currently known global GDB thread ids. At the
  27907. end of the list it also prints the total number of such threads.
  27908. This command is retained for historical reasons, the '-thread-info'
  27909. command should be used instead.
  27910. GDB Command
  27911. ...........
  27912. Part of 'info threads' supplies the same information.
  27913. Example
  27914. .......
  27915. (gdb)
  27916. -thread-list-ids
  27917. ^done,thread-ids={thread-id="3",thread-id="2",thread-id="1"},
  27918. current-thread-id="1",number-of-threads="3"
  27919. (gdb)
  27920. The '-thread-select' Command
  27921. ----------------------------
  27922. Synopsis
  27923. ........
  27924. -thread-select THREAD-ID
  27925. Make thread with global thread number THREAD-ID the current thread.
  27926. It prints the number of the new current thread, and the topmost frame
  27927. for that thread.
  27928. This command is deprecated in favor of explicitly using the
  27929. '--thread' option to each command.
  27930. GDB Command
  27931. ...........
  27932. The corresponding GDB command is 'thread'.
  27933. Example
  27934. .......
  27935. (gdb)
  27936. -exec-next
  27937. ^running
  27938. (gdb)
  27939. *stopped,reason="end-stepping-range",thread-id="2",line="187",
  27940. file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c"
  27941. (gdb)
  27942. -thread-list-ids
  27943. ^done,
  27944. thread-ids={thread-id="3",thread-id="2",thread-id="1"},
  27945. number-of-threads="3"
  27946. (gdb)
  27947. -thread-select 3
  27948. ^done,new-thread-id="3",
  27949. frame={level="0",func="vprintf",
  27950. args=[{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""},
  27951. {name="arg",value="0x2"}],file="vprintf.c",line="31",arch="i386:x86_64"}
  27952. (gdb)
  27953. 
  27954. File: gdb.info, Node: GDB/MI Ada Tasking Commands, Next: GDB/MI Program Execution, Prev: GDB/MI Thread Commands, Up: GDB/MI
  27955. 27.12 GDB/MI Ada Tasking Commands
  27956. =================================
  27957. The '-ada-task-info' Command
  27958. ----------------------------
  27959. Synopsis
  27960. ........
  27961. -ada-task-info [ TASK-ID ]
  27962. Reports information about either a specific Ada task, if the TASK-ID
  27963. parameter is present, or about all Ada tasks.
  27964. GDB Command
  27965. ...........
  27966. The 'info tasks' command prints the same information about all Ada tasks
  27967. (*note Ada Tasks::).
  27968. Result
  27969. ......
  27970. The result is a table of Ada tasks. The following columns are defined
  27971. for each Ada task:
  27972. 'current'
  27973. This field exists only for the current thread. It has the value
  27974. '*'.
  27975. 'id'
  27976. The identifier that GDB uses to refer to the Ada task.
  27977. 'task-id'
  27978. The identifier that the target uses to refer to the Ada task.
  27979. 'thread-id'
  27980. The global thread identifier of the thread corresponding to the Ada
  27981. task.
  27982. This field should always exist, as Ada tasks are always implemented
  27983. on top of a thread. But if GDB cannot find this corresponding
  27984. thread for any reason, the field is omitted.
  27985. 'parent-id'
  27986. This field exists only when the task was created by another task.
  27987. In this case, it provides the ID of the parent task.
  27988. 'priority'
  27989. The base priority of the task.
  27990. 'state'
  27991. The current state of the task. For a detailed description of the
  27992. possible states, see *note Ada Tasks::.
  27993. 'name'
  27994. The name of the task.
  27995. Example
  27996. .......
  27997. -ada-task-info
  27998. ^done,tasks={nr_rows="3",nr_cols="8",
  27999. hdr=[{width="1",alignment="-1",col_name="current",colhdr=""},
  28000. {width="3",alignment="1",col_name="id",colhdr="ID"},
  28001. {width="9",alignment="1",col_name="task-id",colhdr="TID"},
  28002. {width="4",alignment="1",col_name="thread-id",colhdr=""},
  28003. {width="4",alignment="1",col_name="parent-id",colhdr="P-ID"},
  28004. {width="3",alignment="1",col_name="priority",colhdr="Pri"},
  28005. {width="22",alignment="-1",col_name="state",colhdr="State"},
  28006. {width="1",alignment="2",col_name="name",colhdr="Name"}],
  28007. body=[{current="*",id="1",task-id=" 644010",thread-id="1",priority="48",
  28008. state="Child Termination Wait",name="main_task"}]}
  28009. (gdb)
  28010. 
  28011. File: gdb.info, Node: GDB/MI Program Execution, Next: GDB/MI Stack Manipulation, Prev: GDB/MI Ada Tasking Commands, Up: GDB/MI
  28012. 27.13 GDB/MI Program Execution
  28013. ==============================
  28014. These are the asynchronous commands which generate the out-of-band
  28015. record '*stopped'. Currently GDB only really executes asynchronously
  28016. with remote targets and this interaction is mimicked in other cases.
  28017. The '-exec-continue' Command
  28018. ----------------------------
  28019. Synopsis
  28020. ........
  28021. -exec-continue [--reverse] [--all|--thread-group N]
  28022. Resumes the execution of the inferior program, which will continue to
  28023. execute until it reaches a debugger stop event. If the '--reverse'
  28024. option is specified, execution resumes in reverse until it reaches a
  28025. stop event. Stop events may include
  28026. * breakpoints or watchpoints
  28027. * signals or exceptions
  28028. * the end of the process (or its beginning under '--reverse')
  28029. * the end or beginning of a replay log if one is being used.
  28030. In all-stop mode (*note All-Stop Mode::), may resume only one thread,
  28031. or all threads, depending on the value of the 'scheduler-locking'
  28032. variable. If '--all' is specified, all threads (in all inferiors) will
  28033. be resumed. The '--all' option is ignored in all-stop mode. If the
  28034. '--thread-group' options is specified, then all threads in that thread
  28035. group are resumed.
  28036. GDB Command
  28037. ...........
  28038. The corresponding GDB corresponding is 'continue'.
  28039. Example
  28040. .......
  28041. -exec-continue
  28042. ^running
  28043. (gdb)
  28044. @Hello world
  28045. *stopped,reason="breakpoint-hit",disp="keep",bkptno="2",frame={
  28046. func="foo",args=[],file="hello.c",fullname="/home/foo/bar/hello.c",
  28047. line="13",arch="i386:x86_64"}
  28048. (gdb)
  28049. The '-exec-finish' Command
  28050. --------------------------
  28051. Synopsis
  28052. ........
  28053. -exec-finish [--reverse]
  28054. Resumes the execution of the inferior program until the current
  28055. function is exited. Displays the results returned by the function. If
  28056. the '--reverse' option is specified, resumes the reverse execution of
  28057. the inferior program until the point where current function was called.
  28058. GDB Command
  28059. ...........
  28060. The corresponding GDB command is 'finish'.
  28061. Example
  28062. .......
  28063. Function returning 'void'.
  28064. -exec-finish
  28065. ^running
  28066. (gdb)
  28067. @hello from foo
  28068. *stopped,reason="function-finished",frame={func="main",args=[],
  28069. file="hello.c",fullname="/home/foo/bar/hello.c",line="7",arch="i386:x86_64"}
  28070. (gdb)
  28071. Function returning other than 'void'. The name of the internal GDB
  28072. variable storing the result is printed, together with the value itself.
  28073. -exec-finish
  28074. ^running
  28075. (gdb)
  28076. *stopped,reason="function-finished",frame={addr="0x000107b0",func="foo",
  28077. args=[{name="a",value="1"],{name="b",value="9"}},
  28078. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28079. arch="i386:x86_64"},
  28080. gdb-result-var="$1",return-value="0"
  28081. (gdb)
  28082. The '-exec-interrupt' Command
  28083. -----------------------------
  28084. Synopsis
  28085. ........
  28086. -exec-interrupt [--all|--thread-group N]
  28087. Interrupts the background execution of the target. Note how the
  28088. token associated with the stop message is the one for the execution
  28089. command that has been interrupted. The token for the interrupt itself
  28090. only appears in the '^done' output. If the user is trying to interrupt
  28091. a non-running program, an error message will be printed.
  28092. Note that when asynchronous execution is enabled, this command is
  28093. asynchronous just like other execution commands. That is, first the
  28094. '^done' response will be printed, and the target stop will be reported
  28095. after that using the '*stopped' notification.
  28096. In non-stop mode, only the context thread is interrupted by default.
  28097. All threads (in all inferiors) will be interrupted if the '--all' option
  28098. is specified. If the '--thread-group' option is specified, all threads
  28099. in that group will be interrupted.
  28100. GDB Command
  28101. ...........
  28102. The corresponding GDB command is 'interrupt'.
  28103. Example
  28104. .......
  28105. (gdb)
  28106. 111-exec-continue
  28107. 111^running
  28108. (gdb)
  28109. 222-exec-interrupt
  28110. 222^done
  28111. (gdb)
  28112. 111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
  28113. frame={addr="0x00010140",func="foo",args=[],file="try.c",
  28114. fullname="/home/foo/bar/try.c",line="13",arch="i386:x86_64"}
  28115. (gdb)
  28116. (gdb)
  28117. -exec-interrupt
  28118. ^error,msg="mi_cmd_exec_interrupt: Inferior not executing."
  28119. (gdb)
  28120. The '-exec-jump' Command
  28121. ------------------------
  28122. Synopsis
  28123. ........
  28124. -exec-jump LOCATION
  28125. Resumes execution of the inferior program at the location specified
  28126. by parameter. *Note Specify Location::, for a description of the
  28127. different forms of LOCATION.
  28128. GDB Command
  28129. ...........
  28130. The corresponding GDB command is 'jump'.
  28131. Example
  28132. .......
  28133. -exec-jump foo.c:10
  28134. *running,thread-id="all"
  28135. ^running
  28136. The '-exec-next' Command
  28137. ------------------------
  28138. Synopsis
  28139. ........
  28140. -exec-next [--reverse]
  28141. Resumes execution of the inferior program, stopping when the
  28142. beginning of the next source line is reached.
  28143. If the '--reverse' option is specified, resumes reverse execution of
  28144. the inferior program, stopping at the beginning of the previous source
  28145. line. If you issue this command on the first line of a function, it
  28146. will take you back to the caller of that function, to the source line
  28147. where the function was called.
  28148. GDB Command
  28149. ...........
  28150. The corresponding GDB command is 'next'.
  28151. Example
  28152. .......
  28153. -exec-next
  28154. ^running
  28155. (gdb)
  28156. *stopped,reason="end-stepping-range",line="8",file="hello.c"
  28157. (gdb)
  28158. The '-exec-next-instruction' Command
  28159. ------------------------------------
  28160. Synopsis
  28161. ........
  28162. -exec-next-instruction [--reverse]
  28163. Executes one machine instruction. If the instruction is a function
  28164. call, continues until the function returns. If the program stops at an
  28165. instruction in the middle of a source line, the address will be printed
  28166. as well.
  28167. If the '--reverse' option is specified, resumes reverse execution of
  28168. the inferior program, stopping at the previous instruction. If the
  28169. previously executed instruction was a return from another function, it
  28170. will continue to execute in reverse until the call to that function
  28171. (from the current stack frame) is reached.
  28172. GDB Command
  28173. ...........
  28174. The corresponding GDB command is 'nexti'.
  28175. Example
  28176. .......
  28177. (gdb)
  28178. -exec-next-instruction
  28179. ^running
  28180. (gdb)
  28181. *stopped,reason="end-stepping-range",
  28182. addr="0x000100d4",line="5",file="hello.c"
  28183. (gdb)
  28184. The '-exec-return' Command
  28185. --------------------------
  28186. Synopsis
  28187. ........
  28188. -exec-return
  28189. Makes current function return immediately. Doesn't execute the
  28190. inferior. Displays the new current frame.
  28191. GDB Command
  28192. ...........
  28193. The corresponding GDB command is 'return'.
  28194. Example
  28195. .......
  28196. (gdb)
  28197. 200-break-insert callee4
  28198. 200^done,bkpt={number="1",addr="0x00010734",
  28199. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"}
  28200. (gdb)
  28201. 000-exec-run
  28202. 000^running
  28203. (gdb)
  28204. 000*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
  28205. frame={func="callee4",args=[],
  28206. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28207. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8",
  28208. arch="i386:x86_64"}
  28209. (gdb)
  28210. 205-break-delete
  28211. 205^done
  28212. (gdb)
  28213. 111-exec-return
  28214. 111^done,frame={level="0",func="callee3",
  28215. args=[{name="strarg",
  28216. value="0x11940 \"A string argument.\""}],
  28217. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28218. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",
  28219. arch="i386:x86_64"}
  28220. (gdb)
  28221. The '-exec-run' Command
  28222. -----------------------
  28223. Synopsis
  28224. ........
  28225. -exec-run [ --all | --thread-group N ] [ --start ]
  28226. Starts execution of the inferior from the beginning. The inferior
  28227. executes until either a breakpoint is encountered or the program exits.
  28228. In the latter case the output will include an exit code, if the program
  28229. has exited exceptionally.
  28230. When neither the '--all' nor the '--thread-group' option is
  28231. specified, the current inferior is started. If the '--thread-group'
  28232. option is specified, it should refer to a thread group of type
  28233. 'process', and that thread group will be started. If the '--all' option
  28234. is specified, then all inferiors will be started.
  28235. Using the '--start' option instructs the debugger to stop the
  28236. execution at the start of the inferior's main subprogram, following the
  28237. same behavior as the 'start' command (*note Starting::).
  28238. GDB Command
  28239. ...........
  28240. The corresponding GDB command is 'run'.
  28241. Examples
  28242. ........
  28243. (gdb)
  28244. -break-insert main
  28245. ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",line="4"}
  28246. (gdb)
  28247. -exec-run
  28248. ^running
  28249. (gdb)
  28250. *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
  28251. frame={func="main",args=[],file="recursive2.c",
  28252. fullname="/home/foo/bar/recursive2.c",line="4",arch="i386:x86_64"}
  28253. (gdb)
  28254. Program exited normally:
  28255. (gdb)
  28256. -exec-run
  28257. ^running
  28258. (gdb)
  28259. x = 55
  28260. *stopped,reason="exited-normally"
  28261. (gdb)
  28262. Program exited exceptionally:
  28263. (gdb)
  28264. -exec-run
  28265. ^running
  28266. (gdb)
  28267. x = 55
  28268. *stopped,reason="exited",exit-code="01"
  28269. (gdb)
  28270. Another way the program can terminate is if it receives a signal such
  28271. as 'SIGINT'. In this case, GDB/MI displays this:
  28272. (gdb)
  28273. *stopped,reason="exited-signalled",signal-name="SIGINT",
  28274. signal-meaning="Interrupt"
  28275. The '-exec-step' Command
  28276. ------------------------
  28277. Synopsis
  28278. ........
  28279. -exec-step [--reverse]
  28280. Resumes execution of the inferior program, stopping when the
  28281. beginning of the next source line is reached, if the next source line is
  28282. not a function call. If it is, stop at the first instruction of the
  28283. called function. If the '--reverse' option is specified, resumes
  28284. reverse execution of the inferior program, stopping at the beginning of
  28285. the previously executed source line.
  28286. GDB Command
  28287. ...........
  28288. The corresponding GDB command is 'step'.
  28289. Example
  28290. .......
  28291. Stepping into a function:
  28292. -exec-step
  28293. ^running
  28294. (gdb)
  28295. *stopped,reason="end-stepping-range",
  28296. frame={func="foo",args=[{name="a",value="10"},
  28297. {name="b",value="0"}],file="recursive2.c",
  28298. fullname="/home/foo/bar/recursive2.c",line="11",arch="i386:x86_64"}
  28299. (gdb)
  28300. Regular stepping:
  28301. -exec-step
  28302. ^running
  28303. (gdb)
  28304. *stopped,reason="end-stepping-range",line="14",file="recursive2.c"
  28305. (gdb)
  28306. The '-exec-step-instruction' Command
  28307. ------------------------------------
  28308. Synopsis
  28309. ........
  28310. -exec-step-instruction [--reverse]
  28311. Resumes the inferior which executes one machine instruction. If the
  28312. '--reverse' option is specified, resumes reverse execution of the
  28313. inferior program, stopping at the previously executed instruction. The
  28314. output, once GDB has stopped, will vary depending on whether we have
  28315. stopped in the middle of a source line or not. In the former case, the
  28316. address at which the program stopped will be printed as well.
  28317. GDB Command
  28318. ...........
  28319. The corresponding GDB command is 'stepi'.
  28320. Example
  28321. .......
  28322. (gdb)
  28323. -exec-step-instruction
  28324. ^running
  28325. (gdb)
  28326. *stopped,reason="end-stepping-range",
  28327. frame={func="foo",args=[],file="try.c",
  28328. fullname="/home/foo/bar/try.c",line="10",arch="i386:x86_64"}
  28329. (gdb)
  28330. -exec-step-instruction
  28331. ^running
  28332. (gdb)
  28333. *stopped,reason="end-stepping-range",
  28334. frame={addr="0x000100f4",func="foo",args=[],file="try.c",
  28335. fullname="/home/foo/bar/try.c",line="10",arch="i386:x86_64"}
  28336. (gdb)
  28337. The '-exec-until' Command
  28338. -------------------------
  28339. Synopsis
  28340. ........
  28341. -exec-until [ LOCATION ]
  28342. Executes the inferior until the LOCATION specified in the argument is
  28343. reached. If there is no argument, the inferior executes until a source
  28344. line greater than the current one is reached. The reason for stopping
  28345. in this case will be 'location-reached'.
  28346. GDB Command
  28347. ...........
  28348. The corresponding GDB command is 'until'.
  28349. Example
  28350. .......
  28351. (gdb)
  28352. -exec-until recursive2.c:6
  28353. ^running
  28354. (gdb)
  28355. x = 55
  28356. *stopped,reason="location-reached",frame={func="main",args=[],
  28357. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="6",
  28358. arch="i386:x86_64"}
  28359. (gdb)
  28360. 
  28361. File: gdb.info, Node: GDB/MI Stack Manipulation, Next: GDB/MI Variable Objects, Prev: GDB/MI Program Execution, Up: GDB/MI
  28362. 27.14 GDB/MI Stack Manipulation Commands
  28363. ========================================
  28364. The '-enable-frame-filters' Command
  28365. -----------------------------------
  28366. -enable-frame-filters
  28367. GDB allows Python-based frame filters to affect the output of the MI
  28368. commands relating to stack traces. As there is no way to implement this
  28369. in a fully backward-compatible way, a front end must request that this
  28370. functionality be enabled.
  28371. Once enabled, this feature cannot be disabled.
  28372. Note that if Python support has not been compiled into GDB, this
  28373. command will still succeed (and do nothing).
  28374. The '-stack-info-frame' Command
  28375. -------------------------------
  28376. Synopsis
  28377. ........
  28378. -stack-info-frame
  28379. Get info on the selected frame.
  28380. GDB Command
  28381. ...........
  28382. The corresponding GDB command is 'info frame' or 'frame' (without
  28383. arguments).
  28384. Example
  28385. .......
  28386. (gdb)
  28387. -stack-info-frame
  28388. ^done,frame={level="1",addr="0x0001076c",func="callee3",
  28389. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28390. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17",
  28391. arch="i386:x86_64"}
  28392. (gdb)
  28393. The '-stack-info-depth' Command
  28394. -------------------------------
  28395. Synopsis
  28396. ........
  28397. -stack-info-depth [ MAX-DEPTH ]
  28398. Return the depth of the stack. If the integer argument MAX-DEPTH is
  28399. specified, do not count beyond MAX-DEPTH frames.
  28400. GDB Command
  28401. ...........
  28402. There's no equivalent GDB command.
  28403. Example
  28404. .......
  28405. For a stack with frame levels 0 through 11:
  28406. (gdb)
  28407. -stack-info-depth
  28408. ^done,depth="12"
  28409. (gdb)
  28410. -stack-info-depth 4
  28411. ^done,depth="4"
  28412. (gdb)
  28413. -stack-info-depth 12
  28414. ^done,depth="12"
  28415. (gdb)
  28416. -stack-info-depth 11
  28417. ^done,depth="11"
  28418. (gdb)
  28419. -stack-info-depth 13
  28420. ^done,depth="12"
  28421. (gdb)
  28422. The '-stack-list-arguments' Command
  28423. -----------------------------------
  28424. Synopsis
  28425. ........
  28426. -stack-list-arguments [ --no-frame-filters ] [ --skip-unavailable ] PRINT-VALUES
  28427. [ LOW-FRAME HIGH-FRAME ]
  28428. Display a list of the arguments for the frames between LOW-FRAME and
  28429. HIGH-FRAME (inclusive). If LOW-FRAME and HIGH-FRAME are not provided,
  28430. list the arguments for the whole call stack. If the two arguments are
  28431. equal, show the single frame at the corresponding level. It is an error
  28432. if LOW-FRAME is larger than the actual number of frames. On the other
  28433. hand, HIGH-FRAME may be larger than the actual number of frames, in
  28434. which case only existing frames will be returned.
  28435. If PRINT-VALUES is 0 or '--no-values', print only the names of the
  28436. variables; if it is 1 or '--all-values', print also their values; and if
  28437. it is 2 or '--simple-values', print the name, type and value for simple
  28438. data types, and the name and type for arrays, structures and unions. If
  28439. the option '--no-frame-filters' is supplied, then Python frame filters
  28440. will not be executed.
  28441. If the '--skip-unavailable' option is specified, arguments that are
  28442. not available are not listed. Partially available arguments are still
  28443. displayed, however.
  28444. Use of this command to obtain arguments in a single frame is
  28445. deprecated in favor of the '-stack-list-variables' command.
  28446. GDB Command
  28447. ...........
  28448. GDB does not have an equivalent command. 'gdbtk' has a 'gdb_get_args'
  28449. command which partially overlaps with the functionality of
  28450. '-stack-list-arguments'.
  28451. Example
  28452. .......
  28453. (gdb)
  28454. -stack-list-frames
  28455. ^done,
  28456. stack=[
  28457. frame={level="0",addr="0x00010734",func="callee4",
  28458. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28459. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8",
  28460. arch="i386:x86_64"},
  28461. frame={level="1",addr="0x0001076c",func="callee3",
  28462. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28463. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17",
  28464. arch="i386:x86_64"},
  28465. frame={level="2",addr="0x0001078c",func="callee2",
  28466. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28467. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="22",
  28468. arch="i386:x86_64"},
  28469. frame={level="3",addr="0x000107b4",func="callee1",
  28470. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28471. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="27",
  28472. arch="i386:x86_64"},
  28473. frame={level="4",addr="0x000107e0",func="main",
  28474. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28475. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="32",
  28476. arch="i386:x86_64"}]
  28477. (gdb)
  28478. -stack-list-arguments 0
  28479. ^done,
  28480. stack-args=[
  28481. frame={level="0",args=[]},
  28482. frame={level="1",args=[name="strarg"]},
  28483. frame={level="2",args=[name="intarg",name="strarg"]},
  28484. frame={level="3",args=[name="intarg",name="strarg",name="fltarg"]},
  28485. frame={level="4",args=[]}]
  28486. (gdb)
  28487. -stack-list-arguments 1
  28488. ^done,
  28489. stack-args=[
  28490. frame={level="0",args=[]},
  28491. frame={level="1",
  28492. args=[{name="strarg",value="0x11940 \"A string argument.\""}]},
  28493. frame={level="2",args=[
  28494. {name="intarg",value="2"},
  28495. {name="strarg",value="0x11940 \"A string argument.\""}]},
  28496. {frame={level="3",args=[
  28497. {name="intarg",value="2"},
  28498. {name="strarg",value="0x11940 \"A string argument.\""},
  28499. {name="fltarg",value="3.5"}]},
  28500. frame={level="4",args=[]}]
  28501. (gdb)
  28502. -stack-list-arguments 0 2 2
  28503. ^done,stack-args=[frame={level="2",args=[name="intarg",name="strarg"]}]
  28504. (gdb)
  28505. -stack-list-arguments 1 2 2
  28506. ^done,stack-args=[frame={level="2",
  28507. args=[{name="intarg",value="2"},
  28508. {name="strarg",value="0x11940 \"A string argument.\""}]}]
  28509. (gdb)
  28510. The '-stack-list-frames' Command
  28511. --------------------------------
  28512. Synopsis
  28513. ........
  28514. -stack-list-frames [ --no-frame-filters LOW-FRAME HIGH-FRAME ]
  28515. List the frames currently on the stack. For each frame it displays
  28516. the following info:
  28517. 'LEVEL'
  28518. The frame number, 0 being the topmost frame, i.e., the innermost
  28519. function.
  28520. 'ADDR'
  28521. The '$pc' value for that frame.
  28522. 'FUNC'
  28523. Function name.
  28524. 'FILE'
  28525. File name of the source file where the function lives.
  28526. 'FULLNAME'
  28527. The full file name of the source file where the function lives.
  28528. 'LINE'
  28529. Line number corresponding to the '$pc'.
  28530. 'FROM'
  28531. The shared library where this function is defined. This is only
  28532. given if the frame's function is not known.
  28533. 'ARCH'
  28534. Frame's architecture.
  28535. If invoked without arguments, this command prints a backtrace for the
  28536. whole stack. If given two integer arguments, it shows the frames whose
  28537. levels are between the two arguments (inclusive). If the two arguments
  28538. are equal, it shows the single frame at the corresponding level. It is
  28539. an error if LOW-FRAME is larger than the actual number of frames. On
  28540. the other hand, HIGH-FRAME may be larger than the actual number of
  28541. frames, in which case only existing frames will be returned. If the
  28542. option '--no-frame-filters' is supplied, then Python frame filters will
  28543. not be executed.
  28544. GDB Command
  28545. ...........
  28546. The corresponding GDB commands are 'backtrace' and 'where'.
  28547. Example
  28548. .......
  28549. Full stack backtrace:
  28550. (gdb)
  28551. -stack-list-frames
  28552. ^done,stack=
  28553. [frame={level="0",addr="0x0001076c",func="foo",
  28554. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="11",
  28555. arch="i386:x86_64"},
  28556. frame={level="1",addr="0x000107a4",func="foo",
  28557. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28558. arch="i386:x86_64"},
  28559. frame={level="2",addr="0x000107a4",func="foo",
  28560. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28561. arch="i386:x86_64"},
  28562. frame={level="3",addr="0x000107a4",func="foo",
  28563. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28564. arch="i386:x86_64"},
  28565. frame={level="4",addr="0x000107a4",func="foo",
  28566. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28567. arch="i386:x86_64"},
  28568. frame={level="5",addr="0x000107a4",func="foo",
  28569. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28570. arch="i386:x86_64"},
  28571. frame={level="6",addr="0x000107a4",func="foo",
  28572. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28573. arch="i386:x86_64"},
  28574. frame={level="7",addr="0x000107a4",func="foo",
  28575. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28576. arch="i386:x86_64"},
  28577. frame={level="8",addr="0x000107a4",func="foo",
  28578. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28579. arch="i386:x86_64"},
  28580. frame={level="9",addr="0x000107a4",func="foo",
  28581. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28582. arch="i386:x86_64"},
  28583. frame={level="10",addr="0x000107a4",func="foo",
  28584. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28585. arch="i386:x86_64"},
  28586. frame={level="11",addr="0x00010738",func="main",
  28587. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="4",
  28588. arch="i386:x86_64"}]
  28589. (gdb)
  28590. Show frames between LOW_FRAME and HIGH_FRAME:
  28591. (gdb)
  28592. -stack-list-frames 3 5
  28593. ^done,stack=
  28594. [frame={level="3",addr="0x000107a4",func="foo",
  28595. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28596. arch="i386:x86_64"},
  28597. frame={level="4",addr="0x000107a4",func="foo",
  28598. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28599. arch="i386:x86_64"},
  28600. frame={level="5",addr="0x000107a4",func="foo",
  28601. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28602. arch="i386:x86_64"}]
  28603. (gdb)
  28604. Show a single frame:
  28605. (gdb)
  28606. -stack-list-frames 3 3
  28607. ^done,stack=
  28608. [frame={level="3",addr="0x000107a4",func="foo",
  28609. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28610. arch="i386:x86_64"}]
  28611. (gdb)
  28612. The '-stack-list-locals' Command
  28613. --------------------------------
  28614. Synopsis
  28615. ........
  28616. -stack-list-locals [ --no-frame-filters ] [ --skip-unavailable ] PRINT-VALUES
  28617. Display the local variable names for the selected frame. If
  28618. PRINT-VALUES is 0 or '--no-values', print only the names of the
  28619. variables; if it is 1 or '--all-values', print also their values; and if
  28620. it is 2 or '--simple-values', print the name, type and value for simple
  28621. data types, and the name and type for arrays, structures and unions. In
  28622. this last case, a frontend can immediately display the value of simple
  28623. data types and create variable objects for other data types when the
  28624. user wishes to explore their values in more detail. If the option
  28625. '--no-frame-filters' is supplied, then Python frame filters will not be
  28626. executed.
  28627. If the '--skip-unavailable' option is specified, local variables that
  28628. are not available are not listed. Partially available local variables
  28629. are still displayed, however.
  28630. This command is deprecated in favor of the '-stack-list-variables'
  28631. command.
  28632. GDB Command
  28633. ...........
  28634. 'info locals' in GDB, 'gdb_get_locals' in 'gdbtk'.
  28635. Example
  28636. .......
  28637. (gdb)
  28638. -stack-list-locals 0
  28639. ^done,locals=[name="A",name="B",name="C"]
  28640. (gdb)
  28641. -stack-list-locals --all-values
  28642. ^done,locals=[{name="A",value="1"},{name="B",value="2"},
  28643. {name="C",value="{1, 2, 3}"}]
  28644. -stack-list-locals --simple-values
  28645. ^done,locals=[{name="A",type="int",value="1"},
  28646. {name="B",type="int",value="2"},{name="C",type="int [3]"}]
  28647. (gdb)
  28648. The '-stack-list-variables' Command
  28649. -----------------------------------
  28650. Synopsis
  28651. ........
  28652. -stack-list-variables [ --no-frame-filters ] [ --skip-unavailable ] PRINT-VALUES
  28653. Display the names of local variables and function arguments for the
  28654. selected frame. If PRINT-VALUES is 0 or '--no-values', print only the
  28655. names of the variables; if it is 1 or '--all-values', print also their
  28656. values; and if it is 2 or '--simple-values', print the name, type and
  28657. value for simple data types, and the name and type for arrays,
  28658. structures and unions. If the option '--no-frame-filters' is supplied,
  28659. then Python frame filters will not be executed.
  28660. If the '--skip-unavailable' option is specified, local variables and
  28661. arguments that are not available are not listed. Partially available
  28662. arguments and local variables are still displayed, however.
  28663. Example
  28664. .......
  28665. (gdb)
  28666. -stack-list-variables --thread 1 --frame 0 --all-values
  28667. ^done,variables=[{name="x",value="11"},{name="s",value="{a = 1, b = 2}"}]
  28668. (gdb)
  28669. The '-stack-select-frame' Command
  28670. ---------------------------------
  28671. Synopsis
  28672. ........
  28673. -stack-select-frame FRAMENUM
  28674. Change the selected frame. Select a different frame FRAMENUM on the
  28675. stack.
  28676. This command in deprecated in favor of passing the '--frame' option
  28677. to every command.
  28678. GDB Command
  28679. ...........
  28680. The corresponding GDB commands are 'frame', 'up', 'down',
  28681. 'select-frame', 'up-silent', and 'down-silent'.
  28682. Example
  28683. .......
  28684. (gdb)
  28685. -stack-select-frame 2
  28686. ^done
  28687. (gdb)
  28688. 
  28689. File: gdb.info, Node: GDB/MI Variable Objects, Next: GDB/MI Data Manipulation, Prev: GDB/MI Stack Manipulation, Up: GDB/MI
  28690. 27.15 GDB/MI Variable Objects
  28691. =============================
  28692. Introduction to Variable Objects
  28693. --------------------------------
  28694. Variable objects are "object-oriented" MI interface for examining and
  28695. changing values of expressions. Unlike some other MI interfaces that
  28696. work with expressions, variable objects are specifically designed for
  28697. simple and efficient presentation in the frontend. A variable object is
  28698. identified by string name. When a variable object is created, the
  28699. frontend specifies the expression for that variable object. The
  28700. expression can be a simple variable, or it can be an arbitrary complex
  28701. expression, and can even involve CPU registers. After creating a
  28702. variable object, the frontend can invoke other variable object
  28703. operations--for example to obtain or change the value of a variable
  28704. object, or to change display format.
  28705. Variable objects have hierarchical tree structure. Any variable
  28706. object that corresponds to a composite type, such as structure in C, has
  28707. a number of child variable objects, for example corresponding to each
  28708. element of a structure. A child variable object can itself have
  28709. children, recursively. Recursion ends when we reach leaf variable
  28710. objects, which always have built-in types. Child variable objects are
  28711. created only by explicit request, so if a frontend is not interested in
  28712. the children of a particular variable object, no child will be created.
  28713. For a leaf variable object it is possible to obtain its value as a
  28714. string, or set the value from a string. String value can be also
  28715. obtained for a non-leaf variable object, but it's generally a string
  28716. that only indicates the type of the object, and does not list its
  28717. contents. Assignment to a non-leaf variable object is not allowed.
  28718. A frontend does not need to read the values of all variable objects
  28719. each time the program stops. Instead, MI provides an update command
  28720. that lists all variable objects whose values has changed since the last
  28721. update operation. This considerably reduces the amount of data that
  28722. must be transferred to the frontend. As noted above, children variable
  28723. objects are created on demand, and only leaf variable objects have a
  28724. real value. As result, gdb will read target memory only for leaf
  28725. variables that frontend has created.
  28726. The automatic update is not always desirable. For example, a
  28727. frontend might want to keep a value of some expression for future
  28728. reference, and never update it. For another example, fetching memory is
  28729. relatively slow for embedded targets, so a frontend might want to
  28730. disable automatic update for the variables that are either not visible
  28731. on the screen, or "closed". This is possible using so called "frozen
  28732. variable objects". Such variable objects are never implicitly updated.
  28733. Variable objects can be either "fixed" or "floating". For the fixed
  28734. variable object, the expression is parsed when the variable object is
  28735. created, including associating identifiers to specific variables. The
  28736. meaning of expression never changes. For a floating variable object the
  28737. values of variables whose names appear in the expressions are
  28738. re-evaluated every time in the context of the current frame. Consider
  28739. this example:
  28740. void do_work(...)
  28741. {
  28742. struct work_state state;
  28743. if (...)
  28744. do_work(...);
  28745. }
  28746. If a fixed variable object for the 'state' variable is created in
  28747. this function, and we enter the recursive call, the variable object will
  28748. report the value of 'state' in the top-level 'do_work' invocation. On
  28749. the other hand, a floating variable object will report the value of
  28750. 'state' in the current frame.
  28751. If an expression specified when creating a fixed variable object
  28752. refers to a local variable, the variable object becomes bound to the
  28753. thread and frame in which the variable object is created. When such
  28754. variable object is updated, GDB makes sure that the thread/frame
  28755. combination the variable object is bound to still exists, and
  28756. re-evaluates the variable object in context of that thread/frame.
  28757. The following is the complete set of GDB/MI operations defined to
  28758. access this functionality:
  28759. *Operation* *Description*
  28760. '-enable-pretty-printing' enable Python-based pretty-printing
  28761. '-var-create' create a variable object
  28762. '-var-delete' delete the variable object and/or its
  28763. children
  28764. '-var-set-format' set the display format of this variable
  28765. '-var-show-format' show the display format of this variable
  28766. '-var-info-num-children' tells how many children this object has
  28767. '-var-list-children' return a list of the object's children
  28768. '-var-info-type' show the type of this variable object
  28769. '-var-info-expression' print parent-relative expression that
  28770. this variable object represents
  28771. '-var-info-path-expression' print full expression that this variable
  28772. object represents
  28773. '-var-show-attributes' is this variable editable? does it exist
  28774. here?
  28775. '-var-evaluate-expression' get the value of this variable
  28776. '-var-assign' set the value of this variable
  28777. '-var-update' update the variable and its children
  28778. '-var-set-frozen' set frozenness attribute
  28779. '-var-set-update-range' set range of children to display on
  28780. update
  28781. In the next subsection we describe each operation in detail and
  28782. suggest how it can be used.
  28783. Description And Use of Operations on Variable Objects
  28784. -----------------------------------------------------
  28785. The '-enable-pretty-printing' Command
  28786. -------------------------------------
  28787. -enable-pretty-printing
  28788. GDB allows Python-based visualizers to affect the output of the MI
  28789. variable object commands. However, because there was no way to
  28790. implement this in a fully backward-compatible way, a front end must
  28791. request that this functionality be enabled.
  28792. Once enabled, this feature cannot be disabled.
  28793. Note that if Python support has not been compiled into GDB, this
  28794. command will still succeed (and do nothing).
  28795. This feature is currently (as of GDB 7.0) experimental, and may work
  28796. differently in future versions of GDB.
  28797. The '-var-create' Command
  28798. -------------------------
  28799. Synopsis
  28800. ........
  28801. -var-create {NAME | "-"}
  28802. {FRAME-ADDR | "*" | "@"} EXPRESSION
  28803. This operation creates a variable object, which allows the monitoring
  28804. of a variable, the result of an expression, a memory cell or a CPU
  28805. register.
  28806. The NAME parameter is the string by which the object can be
  28807. referenced. It must be unique. If '-' is specified, the varobj system
  28808. will generate a string "varNNNNNN" automatically. It will be unique
  28809. provided that one does not specify NAME of that format. The command
  28810. fails if a duplicate name is found.
  28811. The frame under which the expression should be evaluated can be
  28812. specified by FRAME-ADDR. A '*' indicates that the current frame should
  28813. be used. A '@' indicates that a floating variable object must be
  28814. created.
  28815. EXPRESSION is any expression valid on the current language set (must
  28816. not begin with a '*'), or one of the following:
  28817. * '*ADDR', where ADDR is the address of a memory cell
  28818. * '*ADDR-ADDR' -- a memory address range (TBD)
  28819. * '$REGNAME' -- a CPU register name
  28820. A varobj's contents may be provided by a Python-based pretty-printer.
  28821. In this case the varobj is known as a "dynamic varobj". Dynamic varobjs
  28822. have slightly different semantics in some cases. If the
  28823. '-enable-pretty-printing' command is not sent, then GDB will never
  28824. create a dynamic varobj. This ensures backward compatibility for
  28825. existing clients.
  28826. Result
  28827. ......
  28828. This operation returns attributes of the newly-created varobj. These
  28829. are:
  28830. 'name'
  28831. The name of the varobj.
  28832. 'numchild'
  28833. The number of children of the varobj. This number is not
  28834. necessarily reliable for a dynamic varobj. Instead, you must
  28835. examine the 'has_more' attribute.
  28836. 'value'
  28837. The varobj's scalar value. For a varobj whose type is some sort of
  28838. aggregate (e.g., a 'struct'), or for a dynamic varobj, this value
  28839. will not be interesting.
  28840. 'type'
  28841. The varobj's type. This is a string representation of the type, as
  28842. would be printed by the GDB CLI. If 'print object' (*note set print
  28843. object: Print Settings.) is set to 'on', the _actual_ (derived)
  28844. type of the object is shown rather than the _declared_ one.
  28845. 'thread-id'
  28846. If a variable object is bound to a specific thread, then this is
  28847. the thread's global identifier.
  28848. 'has_more'
  28849. For a dynamic varobj, this indicates whether there appear to be any
  28850. children available. For a non-dynamic varobj, this will be 0.
  28851. 'dynamic'
  28852. This attribute will be present and have the value '1' if the varobj
  28853. is a dynamic varobj. If the varobj is not a dynamic varobj, then
  28854. this attribute will not be present.
  28855. 'displayhint'
  28856. A dynamic varobj can supply a display hint to the front end. The
  28857. value comes directly from the Python pretty-printer object's
  28858. 'display_hint' method. *Note Pretty Printing API::.
  28859. Typical output will look like this:
  28860. name="NAME",numchild="N",type="TYPE",thread-id="M",
  28861. has_more="HAS_MORE"
  28862. The '-var-delete' Command
  28863. -------------------------
  28864. Synopsis
  28865. ........
  28866. -var-delete [ -c ] NAME
  28867. Deletes a previously created variable object and all of its children.
  28868. With the '-c' option, just deletes the children.
  28869. Returns an error if the object NAME is not found.
  28870. The '-var-set-format' Command
  28871. -----------------------------
  28872. Synopsis
  28873. ........
  28874. -var-set-format NAME FORMAT-SPEC
  28875. Sets the output format for the value of the object NAME to be
  28876. FORMAT-SPEC.
  28877. The syntax for the FORMAT-SPEC is as follows:
  28878. FORMAT-SPEC ==>
  28879. {binary | decimal | hexadecimal | octal | natural | zero-hexadecimal}
  28880. The natural format is the default format choosen automatically based
  28881. on the variable type (like decimal for an 'int', hex for pointers,
  28882. etc.).
  28883. The zero-hexadecimal format has a representation similar to
  28884. hexadecimal but with padding zeroes to the left of the value. For
  28885. example, a 32-bit hexadecimal value of 0x1234 would be represented as
  28886. 0x00001234 in the zero-hexadecimal format.
  28887. For a variable with children, the format is set only on the variable
  28888. itself, and the children are not affected.
  28889. The '-var-show-format' Command
  28890. ------------------------------
  28891. Synopsis
  28892. ........
  28893. -var-show-format NAME
  28894. Returns the format used to display the value of the object NAME.
  28895. FORMAT ==>
  28896. FORMAT-SPEC
  28897. The '-var-info-num-children' Command
  28898. ------------------------------------
  28899. Synopsis
  28900. ........
  28901. -var-info-num-children NAME
  28902. Returns the number of children of a variable object NAME:
  28903. numchild=N
  28904. Note that this number is not completely reliable for a dynamic
  28905. varobj. It will return the current number of children, but more
  28906. children may be available.
  28907. The '-var-list-children' Command
  28908. --------------------------------
  28909. Synopsis
  28910. ........
  28911. -var-list-children [PRINT-VALUES] NAME [FROM TO]
  28912. Return a list of the children of the specified variable object and
  28913. create variable objects for them, if they do not already exist. With a
  28914. single argument or if PRINT-VALUES has a value of 0 or '--no-values',
  28915. print only the names of the variables; if PRINT-VALUES is 1 or
  28916. '--all-values', also print their values; and if it is 2 or
  28917. '--simple-values' print the name and value for simple data types and
  28918. just the name for arrays, structures and unions.
  28919. FROM and TO, if specified, indicate the range of children to report.
  28920. If FROM or TO is less than zero, the range is reset and all children
  28921. will be reported. Otherwise, children starting at FROM (zero-based) and
  28922. up to and excluding TO will be reported.
  28923. If a child range is requested, it will only affect the current call
  28924. to '-var-list-children', but not future calls to '-var-update'. For
  28925. this, you must instead use '-var-set-update-range'. The intent of this
  28926. approach is to enable a front end to implement any update approach it
  28927. likes; for example, scrolling a view may cause the front end to request
  28928. more children with '-var-list-children', and then the front end could
  28929. call '-var-set-update-range' with a different range to ensure that
  28930. future updates are restricted to just the visible items.
  28931. For each child the following results are returned:
  28932. NAME
  28933. Name of the variable object created for this child.
  28934. EXP
  28935. The expression to be shown to the user by the front end to
  28936. designate this child. For example this may be the name of a
  28937. structure member.
  28938. For a dynamic varobj, this value cannot be used to form an
  28939. expression. There is no way to do this at all with a dynamic
  28940. varobj.
  28941. For C/C++ structures there are several pseudo children returned to
  28942. designate access qualifiers. For these pseudo children EXP is
  28943. 'public', 'private', or 'protected'. In this case the type and
  28944. value are not present.
  28945. A dynamic varobj will not report the access qualifying
  28946. pseudo-children, regardless of the language. This information is
  28947. not available at all with a dynamic varobj.
  28948. NUMCHILD
  28949. Number of children this child has. For a dynamic varobj, this will
  28950. be 0.
  28951. TYPE
  28952. The type of the child. If 'print object' (*note set print object:
  28953. Print Settings.) is set to 'on', the _actual_ (derived) type of the
  28954. object is shown rather than the _declared_ one.
  28955. VALUE
  28956. If values were requested, this is the value.
  28957. THREAD-ID
  28958. If this variable object is associated with a thread, this is the
  28959. thread's global thread id. Otherwise this result is not present.
  28960. FROZEN
  28961. If the variable object is frozen, this variable will be present
  28962. with a value of 1.
  28963. DISPLAYHINT
  28964. A dynamic varobj can supply a display hint to the front end. The
  28965. value comes directly from the Python pretty-printer object's
  28966. 'display_hint' method. *Note Pretty Printing API::.
  28967. DYNAMIC
  28968. This attribute will be present and have the value '1' if the varobj
  28969. is a dynamic varobj. If the varobj is not a dynamic varobj, then
  28970. this attribute will not be present.
  28971. The result may have its own attributes:
  28972. 'displayhint'
  28973. A dynamic varobj can supply a display hint to the front end. The
  28974. value comes directly from the Python pretty-printer object's
  28975. 'display_hint' method. *Note Pretty Printing API::.
  28976. 'has_more'
  28977. This is an integer attribute which is nonzero if there are children
  28978. remaining after the end of the selected range.
  28979. Example
  28980. .......
  28981. (gdb)
  28982. -var-list-children n
  28983. ^done,numchild=N,children=[child={name=NAME,exp=EXP,
  28984. numchild=N,type=TYPE},(repeats N times)]
  28985. (gdb)
  28986. -var-list-children --all-values n
  28987. ^done,numchild=N,children=[child={name=NAME,exp=EXP,
  28988. numchild=N,value=VALUE,type=TYPE},(repeats N times)]
  28989. The '-var-info-type' Command
  28990. ----------------------------
  28991. Synopsis
  28992. ........
  28993. -var-info-type NAME
  28994. Returns the type of the specified variable NAME. The type is
  28995. returned as a string in the same format as it is output by the GDB CLI:
  28996. type=TYPENAME
  28997. The '-var-info-expression' Command
  28998. ----------------------------------
  28999. Synopsis
  29000. ........
  29001. -var-info-expression NAME
  29002. Returns a string that is suitable for presenting this variable object
  29003. in user interface. The string is generally not valid expression in the
  29004. current language, and cannot be evaluated.
  29005. For example, if 'a' is an array, and variable object 'A' was created
  29006. for 'a', then we'll get this output:
  29007. (gdb) -var-info-expression A.1
  29008. ^done,lang="C",exp="1"
  29009. Here, the value of 'lang' is the language name, which can be found in
  29010. *note Supported Languages::.
  29011. Note that the output of the '-var-list-children' command also
  29012. includes those expressions, so the '-var-info-expression' command is of
  29013. limited use.
  29014. The '-var-info-path-expression' Command
  29015. ---------------------------------------
  29016. Synopsis
  29017. ........
  29018. -var-info-path-expression NAME
  29019. Returns an expression that can be evaluated in the current context
  29020. and will yield the same value that a variable object has. Compare this
  29021. with the '-var-info-expression' command, which result can be used only
  29022. for UI presentation. Typical use of the '-var-info-path-expression'
  29023. command is creating a watchpoint from a variable object.
  29024. This command is currently not valid for children of a dynamic varobj,
  29025. and will give an error when invoked on one.
  29026. For example, suppose 'C' is a C++ class, derived from class 'Base',
  29027. and that the 'Base' class has a member called 'm_size'. Assume a
  29028. variable 'c' is has the type of 'C' and a variable object 'C' was
  29029. created for variable 'c'. Then, we'll get this output:
  29030. (gdb) -var-info-path-expression C.Base.public.m_size
  29031. ^done,path_expr=((Base)c).m_size)
  29032. The '-var-show-attributes' Command
  29033. ----------------------------------
  29034. Synopsis
  29035. ........
  29036. -var-show-attributes NAME
  29037. List attributes of the specified variable object NAME:
  29038. status=ATTR [ ( ,ATTR )* ]
  29039. where ATTR is '{ { editable | noneditable } | TBD }'.
  29040. The '-var-evaluate-expression' Command
  29041. --------------------------------------
  29042. Synopsis
  29043. ........
  29044. -var-evaluate-expression [-f FORMAT-SPEC] NAME
  29045. Evaluates the expression that is represented by the specified
  29046. variable object and returns its value as a string. The format of the
  29047. string can be specified with the '-f' option. The possible values of
  29048. this option are the same as for '-var-set-format' (*note
  29049. -var-set-format::). If the '-f' option is not specified, the current
  29050. display format will be used. The current display format can be changed
  29051. using the '-var-set-format' command.
  29052. value=VALUE
  29053. Note that one must invoke '-var-list-children' for a variable before
  29054. the value of a child variable can be evaluated.
  29055. The '-var-assign' Command
  29056. -------------------------
  29057. Synopsis
  29058. ........
  29059. -var-assign NAME EXPRESSION
  29060. Assigns the value of EXPRESSION to the variable object specified by
  29061. NAME. The object must be 'editable'. If the variable's value is
  29062. altered by the assign, the variable will show up in any subsequent
  29063. '-var-update' list.
  29064. Example
  29065. .......
  29066. (gdb)
  29067. -var-assign var1 3
  29068. ^done,value="3"
  29069. (gdb)
  29070. -var-update *
  29071. ^done,changelist=[{name="var1",in_scope="true",type_changed="false"}]
  29072. (gdb)
  29073. The '-var-update' Command
  29074. -------------------------
  29075. Synopsis
  29076. ........
  29077. -var-update [PRINT-VALUES] {NAME | "*"}
  29078. Reevaluate the expressions corresponding to the variable object NAME
  29079. and all its direct and indirect children, and return the list of
  29080. variable objects whose values have changed; NAME must be a root variable
  29081. object. Here, "changed" means that the result of
  29082. '-var-evaluate-expression' before and after the '-var-update' is
  29083. different. If '*' is used as the variable object names, all existing
  29084. variable objects are updated, except for frozen ones (*note
  29085. -var-set-frozen::). The option PRINT-VALUES determines whether both
  29086. names and values, or just names are printed. The possible values of
  29087. this option are the same as for '-var-list-children' (*note
  29088. -var-list-children::). It is recommended to use the '--all-values'
  29089. option, to reduce the number of MI commands needed on each program stop.
  29090. With the '*' parameter, if a variable object is bound to a currently
  29091. running thread, it will not be updated, without any diagnostic.
  29092. If '-var-set-update-range' was previously used on a varobj, then only
  29093. the selected range of children will be reported.
  29094. '-var-update' reports all the changed varobjs in a tuple named
  29095. 'changelist'.
  29096. Each item in the change list is itself a tuple holding:
  29097. 'name'
  29098. The name of the varobj.
  29099. 'value'
  29100. If values were requested for this update, then this field will be
  29101. present and will hold the value of the varobj.
  29102. 'in_scope'
  29103. This field is a string which may take one of three values:
  29104. '"true"'
  29105. The variable object's current value is valid.
  29106. '"false"'
  29107. The variable object does not currently hold a valid value but
  29108. it may hold one in the future if its associated expression
  29109. comes back into scope.
  29110. '"invalid"'
  29111. The variable object no longer holds a valid value. This can
  29112. occur when the executable file being debugged has changed,
  29113. either through recompilation or by using the GDB 'file'
  29114. command. The front end should normally choose to delete these
  29115. variable objects.
  29116. In the future new values may be added to this list so the front
  29117. should be prepared for this possibility. *Note GDB/MI Development
  29118. and Front Ends: GDB/MI Development and Front Ends.
  29119. 'type_changed'
  29120. This is only present if the varobj is still valid. If the type
  29121. changed, then this will be the string 'true'; otherwise it will be
  29122. 'false'.
  29123. When a varobj's type changes, its children are also likely to have
  29124. become incorrect. Therefore, the varobj's children are
  29125. automatically deleted when this attribute is 'true'. Also, the
  29126. varobj's update range, when set using the '-var-set-update-range'
  29127. command, is unset.
  29128. 'new_type'
  29129. If the varobj's type changed, then this field will be present and
  29130. will hold the new type.
  29131. 'new_num_children'
  29132. For a dynamic varobj, if the number of children changed, or if the
  29133. type changed, this will be the new number of children.
  29134. The 'numchild' field in other varobj responses is generally not
  29135. valid for a dynamic varobj - it will show the number of children
  29136. that GDB knows about, but because dynamic varobjs lazily
  29137. instantiate their children, this will not reflect the number of
  29138. children which may be available.
  29139. The 'new_num_children' attribute only reports changes to the number
  29140. of children known by GDB. This is the only way to detect whether
  29141. an update has removed children (which necessarily can only happen
  29142. at the end of the update range).
  29143. 'displayhint'
  29144. The display hint, if any.
  29145. 'has_more'
  29146. This is an integer value, which will be 1 if there are more
  29147. children available outside the varobj's update range.
  29148. 'dynamic'
  29149. This attribute will be present and have the value '1' if the varobj
  29150. is a dynamic varobj. If the varobj is not a dynamic varobj, then
  29151. this attribute will not be present.
  29152. 'new_children'
  29153. If new children were added to a dynamic varobj within the selected
  29154. update range (as set by '-var-set-update-range'), then they will be
  29155. listed in this attribute.
  29156. Example
  29157. .......
  29158. (gdb)
  29159. -var-assign var1 3
  29160. ^done,value="3"
  29161. (gdb)
  29162. -var-update --all-values var1
  29163. ^done,changelist=[{name="var1",value="3",in_scope="true",
  29164. type_changed="false"}]
  29165. (gdb)
  29166. The '-var-set-frozen' Command
  29167. -----------------------------
  29168. Synopsis
  29169. ........
  29170. -var-set-frozen NAME FLAG
  29171. Set the frozenness flag on the variable object NAME. The FLAG
  29172. parameter should be either '1' to make the variable frozen or '0' to
  29173. make it unfrozen. If a variable object is frozen, then neither itself,
  29174. nor any of its children, are implicitly updated by '-var-update' of a
  29175. parent variable or by '-var-update *'. Only '-var-update' of the
  29176. variable itself will update its value and values of its children. After
  29177. a variable object is unfrozen, it is implicitly updated by all
  29178. subsequent '-var-update' operations. Unfreezing a variable does not
  29179. update it, only subsequent '-var-update' does.
  29180. Example
  29181. .......
  29182. (gdb)
  29183. -var-set-frozen V 1
  29184. ^done
  29185. (gdb)
  29186. The '-var-set-update-range' command
  29187. -----------------------------------
  29188. Synopsis
  29189. ........
  29190. -var-set-update-range NAME FROM TO
  29191. Set the range of children to be returned by future invocations of
  29192. '-var-update'.
  29193. FROM and TO indicate the range of children to report. If FROM or TO
  29194. is less than zero, the range is reset and all children will be reported.
  29195. Otherwise, children starting at FROM (zero-based) and up to and
  29196. excluding TO will be reported.
  29197. Example
  29198. .......
  29199. (gdb)
  29200. -var-set-update-range V 1 2
  29201. ^done
  29202. The '-var-set-visualizer' command
  29203. ---------------------------------
  29204. Synopsis
  29205. ........
  29206. -var-set-visualizer NAME VISUALIZER
  29207. Set a visualizer for the variable object NAME.
  29208. VISUALIZER is the visualizer to use. The special value 'None' means
  29209. to disable any visualizer in use.
  29210. If not 'None', VISUALIZER must be a Python expression. This
  29211. expression must evaluate to a callable object which accepts a single
  29212. argument. GDB will call this object with the value of the varobj NAME
  29213. as an argument (this is done so that the same Python pretty-printing
  29214. code can be used for both the CLI and MI). When called, this object must
  29215. return an object which conforms to the pretty-printing interface (*note
  29216. Pretty Printing API::).
  29217. The pre-defined function 'gdb.default_visualizer' may be used to
  29218. select a visualizer by following the built-in process (*note Selecting
  29219. Pretty-Printers::). This is done automatically when a varobj is
  29220. created, and so ordinarily is not needed.
  29221. This feature is only available if Python support is enabled. The MI
  29222. command '-list-features' (*note GDB/MI Support Commands::) can be used
  29223. to check this.
  29224. Example
  29225. .......
  29226. Resetting the visualizer:
  29227. (gdb)
  29228. -var-set-visualizer V None
  29229. ^done
  29230. Reselecting the default (type-based) visualizer:
  29231. (gdb)
  29232. -var-set-visualizer V gdb.default_visualizer
  29233. ^done
  29234. Suppose 'SomeClass' is a visualizer class. A lambda expression can
  29235. be used to instantiate this class for a varobj:
  29236. (gdb)
  29237. -var-set-visualizer V "lambda val: SomeClass()"
  29238. ^done
  29239. 
  29240. File: gdb.info, Node: GDB/MI Data Manipulation, Next: GDB/MI Tracepoint Commands, Prev: GDB/MI Variable Objects, Up: GDB/MI
  29241. 27.16 GDB/MI Data Manipulation
  29242. ==============================
  29243. This section describes the GDB/MI commands that manipulate data: examine
  29244. memory and registers, evaluate expressions, etc.
  29245. For details about what an addressable memory unit is, *note
  29246. addressable memory unit::.
  29247. The '-data-disassemble' Command
  29248. -------------------------------
  29249. Synopsis
  29250. ........
  29251. -data-disassemble
  29252. [ -s START-ADDR -e END-ADDR ]
  29253. | [ -a ADDR ]
  29254. | [ -f FILENAME -l LINENUM [ -n LINES ] ]
  29255. -- MODE
  29256. Where:
  29257. 'START-ADDR'
  29258. is the beginning address (or '$pc')
  29259. 'END-ADDR'
  29260. is the end address
  29261. 'ADDR'
  29262. is an address anywhere within (or the name of) the function to
  29263. disassemble. If an address is specified, the whole function
  29264. surrounding that address will be disassembled. If a name is
  29265. specified, the whole function with that name will be disassembled.
  29266. 'FILENAME'
  29267. is the name of the file to disassemble
  29268. 'LINENUM'
  29269. is the line number to disassemble around
  29270. 'LINES'
  29271. is the number of disassembly lines to be produced. If it is -1,
  29272. the whole function will be disassembled, in case no END-ADDR is
  29273. specified. If END-ADDR is specified as a non-zero value, and LINES
  29274. is lower than the number of disassembly lines between START-ADDR
  29275. and END-ADDR, only LINES lines are displayed; if LINES is higher
  29276. than the number of lines between START-ADDR and END-ADDR, only the
  29277. lines up to END-ADDR are displayed.
  29278. 'MODE'
  29279. is one of:
  29280. * 0 disassembly only
  29281. * 1 mixed source and disassembly (deprecated)
  29282. * 2 disassembly with raw opcodes
  29283. * 3 mixed source and disassembly with raw opcodes (deprecated)
  29284. * 4 mixed source and disassembly
  29285. * 5 mixed source and disassembly with raw opcodes
  29286. Modes 1 and 3 are deprecated. The output is "source centric" which
  29287. hasn't proved useful in practice. *Note Machine Code::, for a
  29288. discussion of the difference between '/m' and '/s' output of the
  29289. 'disassemble' command.
  29290. Result
  29291. ......
  29292. The result of the '-data-disassemble' command will be a list named
  29293. 'asm_insns', the contents of this list depend on the MODE used with the
  29294. '-data-disassemble' command.
  29295. For modes 0 and 2 the 'asm_insns' list contains tuples with the
  29296. following fields:
  29297. 'address'
  29298. The address at which this instruction was disassembled.
  29299. 'func-name'
  29300. The name of the function this instruction is within.
  29301. 'offset'
  29302. The decimal offset in bytes from the start of 'func-name'.
  29303. 'inst'
  29304. The text disassembly for this 'address'.
  29305. 'opcodes'
  29306. This field is only present for modes 2, 3 and 5. This contains the
  29307. raw opcode bytes for the 'inst' field.
  29308. For modes 1, 3, 4 and 5 the 'asm_insns' list contains tuples named
  29309. 'src_and_asm_line', each of which has the following fields:
  29310. 'line'
  29311. The line number within 'file'.
  29312. 'file'
  29313. The file name from the compilation unit. This might be an absolute
  29314. file name or a relative file name depending on the compile command
  29315. used.
  29316. 'fullname'
  29317. Absolute file name of 'file'. It is converted to a canonical form
  29318. using the source file search path (*note Specifying Source
  29319. Directories: Source Path.) and after resolving all the symbolic
  29320. links.
  29321. If the source file is not found this field will contain the path as
  29322. present in the debug information.
  29323. 'line_asm_insn'
  29324. This is a list of tuples containing the disassembly for 'line' in
  29325. 'file'. The fields of each tuple are the same as for
  29326. '-data-disassemble' in MODE 0 and 2, so 'address', 'func-name',
  29327. 'offset', 'inst', and optionally 'opcodes'.
  29328. Note that whatever included in the 'inst' field, is not manipulated
  29329. directly by GDB/MI, i.e., it is not possible to adjust its format.
  29330. GDB Command
  29331. ...........
  29332. The corresponding GDB command is 'disassemble'.
  29333. Example
  29334. .......
  29335. Disassemble from the current value of '$pc' to '$pc + 20':
  29336. (gdb)
  29337. -data-disassemble -s $pc -e "$pc + 20" -- 0
  29338. ^done,
  29339. asm_insns=[
  29340. {address="0x000107c0",func-name="main",offset="4",
  29341. inst="mov 2, %o0"},
  29342. {address="0x000107c4",func-name="main",offset="8",
  29343. inst="sethi %hi(0x11800), %o2"},
  29344. {address="0x000107c8",func-name="main",offset="12",
  29345. inst="or %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"},
  29346. {address="0x000107cc",func-name="main",offset="16",
  29347. inst="sethi %hi(0x11800), %o2"},
  29348. {address="0x000107d0",func-name="main",offset="20",
  29349. inst="or %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"}]
  29350. (gdb)
  29351. Disassemble the whole 'main' function. Line 32 is part of 'main'.
  29352. -data-disassemble -f basics.c -l 32 -- 0
  29353. ^done,asm_insns=[
  29354. {address="0x000107bc",func-name="main",offset="0",
  29355. inst="save %sp, -112, %sp"},
  29356. {address="0x000107c0",func-name="main",offset="4",
  29357. inst="mov 2, %o0"},
  29358. {address="0x000107c4",func-name="main",offset="8",
  29359. inst="sethi %hi(0x11800), %o2"},
  29360. [...]
  29361. {address="0x0001081c",func-name="main",offset="96",inst="ret "},
  29362. {address="0x00010820",func-name="main",offset="100",inst="restore "}]
  29363. (gdb)
  29364. Disassemble 3 instructions from the start of 'main':
  29365. (gdb)
  29366. -data-disassemble -f basics.c -l 32 -n 3 -- 0
  29367. ^done,asm_insns=[
  29368. {address="0x000107bc",func-name="main",offset="0",
  29369. inst="save %sp, -112, %sp"},
  29370. {address="0x000107c0",func-name="main",offset="4",
  29371. inst="mov 2, %o0"},
  29372. {address="0x000107c4",func-name="main",offset="8",
  29373. inst="sethi %hi(0x11800), %o2"}]
  29374. (gdb)
  29375. Disassemble 3 instructions from the start of 'main' in mixed mode:
  29376. (gdb)
  29377. -data-disassemble -f basics.c -l 32 -n 3 -- 1
  29378. ^done,asm_insns=[
  29379. src_and_asm_line={line="31",
  29380. file="../../../src/gdb/testsuite/gdb.mi/basics.c",
  29381. fullname="/absolute/path/to/src/gdb/testsuite/gdb.mi/basics.c",
  29382. line_asm_insn=[{address="0x000107bc",
  29383. func-name="main",offset="0",inst="save %sp, -112, %sp"}]},
  29384. src_and_asm_line={line="32",
  29385. file="../../../src/gdb/testsuite/gdb.mi/basics.c",
  29386. fullname="/absolute/path/to/src/gdb/testsuite/gdb.mi/basics.c",
  29387. line_asm_insn=[{address="0x000107c0",
  29388. func-name="main",offset="4",inst="mov 2, %o0"},
  29389. {address="0x000107c4",func-name="main",offset="8",
  29390. inst="sethi %hi(0x11800), %o2"}]}]
  29391. (gdb)
  29392. The '-data-evaluate-expression' Command
  29393. ---------------------------------------
  29394. Synopsis
  29395. ........
  29396. -data-evaluate-expression EXPR
  29397. Evaluate EXPR as an expression. The expression could contain an
  29398. inferior function call. The function call will execute synchronously.
  29399. If the expression contains spaces, it must be enclosed in double quotes.
  29400. GDB Command
  29401. ...........
  29402. The corresponding GDB commands are 'print', 'output', and 'call'. In
  29403. 'gdbtk' only, there's a corresponding 'gdb_eval' command.
  29404. Example
  29405. .......
  29406. In the following example, the numbers that precede the commands are the
  29407. "tokens" described in *note GDB/MI Command Syntax: GDB/MI Command
  29408. Syntax. Notice how GDB/MI returns the same tokens in its output.
  29409. 211-data-evaluate-expression A
  29410. 211^done,value="1"
  29411. (gdb)
  29412. 311-data-evaluate-expression &A
  29413. 311^done,value="0xefffeb7c"
  29414. (gdb)
  29415. 411-data-evaluate-expression A+3
  29416. 411^done,value="4"
  29417. (gdb)
  29418. 511-data-evaluate-expression "A + 3"
  29419. 511^done,value="4"
  29420. (gdb)
  29421. The '-data-list-changed-registers' Command
  29422. ------------------------------------------
  29423. Synopsis
  29424. ........
  29425. -data-list-changed-registers
  29426. Display a list of the registers that have changed.
  29427. GDB Command
  29428. ...........
  29429. GDB doesn't have a direct analog for this command; 'gdbtk' has the
  29430. corresponding command 'gdb_changed_register_list'.
  29431. Example
  29432. .......
  29433. On a PPC MBX board:
  29434. (gdb)
  29435. -exec-continue
  29436. ^running
  29437. (gdb)
  29438. *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={
  29439. func="main",args=[],file="try.c",fullname="/home/foo/bar/try.c",
  29440. line="5",arch="powerpc"}
  29441. (gdb)
  29442. -data-list-changed-registers
  29443. ^done,changed-registers=["0","1","2","4","5","6","7","8","9",
  29444. "10","11","13","14","15","16","17","18","19","20","21","22","23",
  29445. "24","25","26","27","28","30","31","64","65","66","67","69"]
  29446. (gdb)
  29447. The '-data-list-register-names' Command
  29448. ---------------------------------------
  29449. Synopsis
  29450. ........
  29451. -data-list-register-names [ ( REGNO )+ ]
  29452. Show a list of register names for the current target. If no
  29453. arguments are given, it shows a list of the names of all the registers.
  29454. If integer numbers are given as arguments, it will print a list of the
  29455. names of the registers corresponding to the arguments. To ensure
  29456. consistency between a register name and its number, the output list may
  29457. include empty register names.
  29458. GDB Command
  29459. ...........
  29460. GDB does not have a command which corresponds to
  29461. '-data-list-register-names'. In 'gdbtk' there is a corresponding
  29462. command 'gdb_regnames'.
  29463. Example
  29464. .......
  29465. For the PPC MBX board:
  29466. (gdb)
  29467. -data-list-register-names
  29468. ^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7",
  29469. "r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18",
  29470. "r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29",
  29471. "r30","r31","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9",
  29472. "f10","f11","f12","f13","f14","f15","f16","f17","f18","f19","f20",
  29473. "f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31",
  29474. "", "pc","ps","cr","lr","ctr","xer"]
  29475. (gdb)
  29476. -data-list-register-names 1 2 3
  29477. ^done,register-names=["r1","r2","r3"]
  29478. (gdb)
  29479. The '-data-list-register-values' Command
  29480. ----------------------------------------
  29481. Synopsis
  29482. ........
  29483. -data-list-register-values
  29484. [ --skip-unavailable ] FMT [ ( REGNO )*]
  29485. Display the registers' contents. The format according to which the
  29486. registers' contents are to be returned is given by FMT, followed by an
  29487. optional list of numbers specifying the registers to display. A missing
  29488. list of numbers indicates that the contents of all the registers must be
  29489. returned. The '--skip-unavailable' option indicates that only the
  29490. available registers are to be returned.
  29491. Allowed formats for FMT are:
  29492. 'x'
  29493. Hexadecimal
  29494. 'o'
  29495. Octal
  29496. 't'
  29497. Binary
  29498. 'd'
  29499. Decimal
  29500. 'r'
  29501. Raw
  29502. 'N'
  29503. Natural
  29504. GDB Command
  29505. ...........
  29506. The corresponding GDB commands are 'info reg', 'info all-reg', and (in
  29507. 'gdbtk') 'gdb_fetch_registers'.
  29508. Example
  29509. .......
  29510. For a PPC MBX board (note: line breaks are for readability only, they
  29511. don't appear in the actual output):
  29512. (gdb)
  29513. -data-list-register-values r 64 65
  29514. ^done,register-values=[{number="64",value="0xfe00a300"},
  29515. {number="65",value="0x00029002"}]
  29516. (gdb)
  29517. -data-list-register-values x
  29518. ^done,register-values=[{number="0",value="0xfe0043c8"},
  29519. {number="1",value="0x3fff88"},{number="2",value="0xfffffffe"},
  29520. {number="3",value="0x0"},{number="4",value="0xa"},
  29521. {number="5",value="0x3fff68"},{number="6",value="0x3fff58"},
  29522. {number="7",value="0xfe011e98"},{number="8",value="0x2"},
  29523. {number="9",value="0xfa202820"},{number="10",value="0xfa202808"},
  29524. {number="11",value="0x1"},{number="12",value="0x0"},
  29525. {number="13",value="0x4544"},{number="14",value="0xffdfffff"},
  29526. {number="15",value="0xffffffff"},{number="16",value="0xfffffeff"},
  29527. {number="17",value="0xefffffed"},{number="18",value="0xfffffffe"},
  29528. {number="19",value="0xffffffff"},{number="20",value="0xffffffff"},
  29529. {number="21",value="0xffffffff"},{number="22",value="0xfffffff7"},
  29530. {number="23",value="0xffffffff"},{number="24",value="0xffffffff"},
  29531. {number="25",value="0xffffffff"},{number="26",value="0xfffffffb"},
  29532. {number="27",value="0xffffffff"},{number="28",value="0xf7bfffff"},
  29533. {number="29",value="0x0"},{number="30",value="0xfe010000"},
  29534. {number="31",value="0x0"},{number="32",value="0x0"},
  29535. {number="33",value="0x0"},{number="34",value="0x0"},
  29536. {number="35",value="0x0"},{number="36",value="0x0"},
  29537. {number="37",value="0x0"},{number="38",value="0x0"},
  29538. {number="39",value="0x0"},{number="40",value="0x0"},
  29539. {number="41",value="0x0"},{number="42",value="0x0"},
  29540. {number="43",value="0x0"},{number="44",value="0x0"},
  29541. {number="45",value="0x0"},{number="46",value="0x0"},
  29542. {number="47",value="0x0"},{number="48",value="0x0"},
  29543. {number="49",value="0x0"},{number="50",value="0x0"},
  29544. {number="51",value="0x0"},{number="52",value="0x0"},
  29545. {number="53",value="0x0"},{number="54",value="0x0"},
  29546. {number="55",value="0x0"},{number="56",value="0x0"},
  29547. {number="57",value="0x0"},{number="58",value="0x0"},
  29548. {number="59",value="0x0"},{number="60",value="0x0"},
  29549. {number="61",value="0x0"},{number="62",value="0x0"},
  29550. {number="63",value="0x0"},{number="64",value="0xfe00a300"},
  29551. {number="65",value="0x29002"},{number="66",value="0x202f04b5"},
  29552. {number="67",value="0xfe0043b0"},{number="68",value="0xfe00b3e4"},
  29553. {number="69",value="0x20002b03"}]
  29554. (gdb)
  29555. The '-data-read-memory' Command
  29556. -------------------------------
  29557. This command is deprecated, use '-data-read-memory-bytes' instead.
  29558. Synopsis
  29559. ........
  29560. -data-read-memory [ -o BYTE-OFFSET ]
  29561. ADDRESS WORD-FORMAT WORD-SIZE
  29562. NR-ROWS NR-COLS [ ASCHAR ]
  29563. where:
  29564. 'ADDRESS'
  29565. An expression specifying the address of the first memory word to be
  29566. read. Complex expressions containing embedded white space should
  29567. be quoted using the C convention.
  29568. 'WORD-FORMAT'
  29569. The format to be used to print the memory words. The notation is
  29570. the same as for GDB's 'print' command (*note Output Formats: Output
  29571. Formats.).
  29572. 'WORD-SIZE'
  29573. The size of each memory word in bytes.
  29574. 'NR-ROWS'
  29575. The number of rows in the output table.
  29576. 'NR-COLS'
  29577. The number of columns in the output table.
  29578. 'ASCHAR'
  29579. If present, indicates that each row should include an ASCII dump.
  29580. The value of ASCHAR is used as a padding character when a byte is
  29581. not a member of the printable ASCII character set (printable ASCII
  29582. characters are those whose code is between 32 and 126,
  29583. inclusively).
  29584. 'BYTE-OFFSET'
  29585. An offset to add to the ADDRESS before fetching memory.
  29586. This command displays memory contents as a table of NR-ROWS by
  29587. NR-COLS words, each word being WORD-SIZE bytes. In total, 'NR-ROWS *
  29588. NR-COLS * WORD-SIZE' bytes are read (returned as 'total-bytes'). Should
  29589. less than the requested number of bytes be returned by the target, the
  29590. missing words are identified using 'N/A'. The number of bytes read from
  29591. the target is returned in 'nr-bytes' and the starting address used to
  29592. read memory in 'addr'.
  29593. The address of the next/previous row or page is available in
  29594. 'next-row' and 'prev-row', 'next-page' and 'prev-page'.
  29595. GDB Command
  29596. ...........
  29597. The corresponding GDB command is 'x'. 'gdbtk' has 'gdb_get_mem' memory
  29598. read command.
  29599. Example
  29600. .......
  29601. Read six bytes of memory starting at 'bytes+6' but then offset by '-6'
  29602. bytes. Format as three rows of two columns. One byte per word.
  29603. Display each word in hex.
  29604. (gdb)
  29605. 9-data-read-memory -o -6 -- bytes+6 x 1 3 2
  29606. 9^done,addr="0x00001390",nr-bytes="6",total-bytes="6",
  29607. next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396",
  29608. prev-page="0x0000138a",memory=[
  29609. {addr="0x00001390",data=["0x00","0x01"]},
  29610. {addr="0x00001392",data=["0x02","0x03"]},
  29611. {addr="0x00001394",data=["0x04","0x05"]}]
  29612. (gdb)
  29613. Read two bytes of memory starting at address 'shorts + 64' and
  29614. display as a single word formatted in decimal.
  29615. (gdb)
  29616. 5-data-read-memory shorts+64 d 2 1 1
  29617. 5^done,addr="0x00001510",nr-bytes="2",total-bytes="2",
  29618. next-row="0x00001512",prev-row="0x0000150e",
  29619. next-page="0x00001512",prev-page="0x0000150e",memory=[
  29620. {addr="0x00001510",data=["128"]}]
  29621. (gdb)
  29622. Read thirty two bytes of memory starting at 'bytes+16' and format as
  29623. eight rows of four columns. Include a string encoding with 'x' used as
  29624. the non-printable character.
  29625. (gdb)
  29626. 4-data-read-memory bytes+16 x 1 8 4 x
  29627. 4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32",
  29628. next-row="0x000013c0",prev-row="0x0000139c",
  29629. next-page="0x000013c0",prev-page="0x00001380",memory=[
  29630. {addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"},
  29631. {addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"},
  29632. {addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"},
  29633. {addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"},
  29634. {addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"},
  29635. {addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"},
  29636. {addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"},
  29637. {addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"}]
  29638. (gdb)
  29639. The '-data-read-memory-bytes' Command
  29640. -------------------------------------
  29641. Synopsis
  29642. ........
  29643. -data-read-memory-bytes [ -o OFFSET ]
  29644. ADDRESS COUNT
  29645. where:
  29646. 'ADDRESS'
  29647. An expression specifying the address of the first addressable
  29648. memory unit to be read. Complex expressions containing embedded
  29649. white space should be quoted using the C convention.
  29650. 'COUNT'
  29651. The number of addressable memory units to read. This should be an
  29652. integer literal.
  29653. 'OFFSET'
  29654. The offset relative to ADDRESS at which to start reading. This
  29655. should be an integer literal. This option is provided so that a
  29656. frontend is not required to first evaluate address and then perform
  29657. address arithmetics itself.
  29658. This command attempts to read all accessible memory regions in the
  29659. specified range. First, all regions marked as unreadable in the memory
  29660. map (if one is defined) will be skipped. *Note Memory Region
  29661. Attributes::. Second, GDB will attempt to read the remaining regions.
  29662. For each one, if reading full region results in an errors, GDB will try
  29663. to read a subset of the region.
  29664. In general, every single memory unit in the region may be readable or
  29665. not, and the only way to read every readable unit is to try a read at
  29666. every address, which is not practical. Therefore, GDB will attempt to
  29667. read all accessible memory units at either beginning or the end of the
  29668. region, using a binary division scheme. This heuristic works well for
  29669. reading across a memory map boundary. Note that if a region has a
  29670. readable range that is neither at the beginning or the end, GDB will not
  29671. read it.
  29672. The result record (*note GDB/MI Result Records::) that is output of
  29673. the command includes a field named 'memory' whose content is a list of
  29674. tuples. Each tuple represent a successfully read memory block and has
  29675. the following fields:
  29676. 'begin'
  29677. The start address of the memory block, as hexadecimal literal.
  29678. 'end'
  29679. The end address of the memory block, as hexadecimal literal.
  29680. 'offset'
  29681. The offset of the memory block, as hexadecimal literal, relative to
  29682. the start address passed to '-data-read-memory-bytes'.
  29683. 'contents'
  29684. The contents of the memory block, in hex.
  29685. GDB Command
  29686. ...........
  29687. The corresponding GDB command is 'x'.
  29688. Example
  29689. .......
  29690. (gdb)
  29691. -data-read-memory-bytes &a 10
  29692. ^done,memory=[{begin="0xbffff154",offset="0x00000000",
  29693. end="0xbffff15e",
  29694. contents="01000000020000000300"}]
  29695. (gdb)
  29696. The '-data-write-memory-bytes' Command
  29697. --------------------------------------
  29698. Synopsis
  29699. ........
  29700. -data-write-memory-bytes ADDRESS CONTENTS
  29701. -data-write-memory-bytes ADDRESS CONTENTS [COUNT]
  29702. where:
  29703. 'ADDRESS'
  29704. An expression specifying the address of the first addressable
  29705. memory unit to be written. Complex expressions containing embedded
  29706. white space should be quoted using the C convention.
  29707. 'CONTENTS'
  29708. The hex-encoded data to write. It is an error if CONTENTS does not
  29709. represent an integral number of addressable memory units.
  29710. 'COUNT'
  29711. Optional argument indicating the number of addressable memory units
  29712. to be written. If COUNT is greater than CONTENTS' length, GDB will
  29713. repeatedly write CONTENTS until it fills COUNT memory units.
  29714. GDB Command
  29715. ...........
  29716. There's no corresponding GDB command.
  29717. Example
  29718. .......
  29719. (gdb)
  29720. -data-write-memory-bytes &a "aabbccdd"
  29721. ^done
  29722. (gdb)
  29723. (gdb)
  29724. -data-write-memory-bytes &a "aabbccdd" 16e
  29725. ^done
  29726. (gdb)
  29727. 
  29728. File: gdb.info, Node: GDB/MI Tracepoint Commands, Next: GDB/MI Symbol Query, Prev: GDB/MI Data Manipulation, Up: GDB/MI
  29729. 27.17 GDB/MI Tracepoint Commands
  29730. ================================
  29731. The commands defined in this section implement MI support for
  29732. tracepoints. For detailed introduction, see *note Tracepoints::.
  29733. The '-trace-find' Command
  29734. -------------------------
  29735. Synopsis
  29736. ........
  29737. -trace-find MODE [PARAMETERS...]
  29738. Find a trace frame using criteria defined by MODE and PARAMETERS.
  29739. The following table lists permissible modes and their parameters. For
  29740. details of operation, see *note tfind::.
  29741. 'none'
  29742. No parameters are required. Stops examining trace frames.
  29743. 'frame-number'
  29744. An integer is required as parameter. Selects tracepoint frame with
  29745. that index.
  29746. 'tracepoint-number'
  29747. An integer is required as parameter. Finds next trace frame that
  29748. corresponds to tracepoint with the specified number.
  29749. 'pc'
  29750. An address is required as parameter. Finds next trace frame that
  29751. corresponds to any tracepoint at the specified address.
  29752. 'pc-inside-range'
  29753. Two addresses are required as parameters. Finds next trace frame
  29754. that corresponds to a tracepoint at an address inside the specified
  29755. range. Both bounds are considered to be inside the range.
  29756. 'pc-outside-range'
  29757. Two addresses are required as parameters. Finds next trace frame
  29758. that corresponds to a tracepoint at an address outside the
  29759. specified range. Both bounds are considered to be inside the
  29760. range.
  29761. 'line'
  29762. Line specification is required as parameter. *Note Specify
  29763. Location::. Finds next trace frame that corresponds to a
  29764. tracepoint at the specified location.
  29765. If 'none' was passed as MODE, the response does not have fields.
  29766. Otherwise, the response may have the following fields:
  29767. 'found'
  29768. This field has either '0' or '1' as the value, depending on whether
  29769. a matching tracepoint was found.
  29770. 'traceframe'
  29771. The index of the found traceframe. This field is present iff the
  29772. 'found' field has value of '1'.
  29773. 'tracepoint'
  29774. The index of the found tracepoint. This field is present iff the
  29775. 'found' field has value of '1'.
  29776. 'frame'
  29777. The information about the frame corresponding to the found trace
  29778. frame. This field is present only if a trace frame was found.
  29779. *Note GDB/MI Frame Information::, for description of this field.
  29780. GDB Command
  29781. ...........
  29782. The corresponding GDB command is 'tfind'.
  29783. -trace-define-variable
  29784. ----------------------
  29785. Synopsis
  29786. ........
  29787. -trace-define-variable NAME [ VALUE ]
  29788. Create trace variable NAME if it does not exist. If VALUE is
  29789. specified, sets the initial value of the specified trace variable to
  29790. that value. Note that the NAME should start with the '$' character.
  29791. GDB Command
  29792. ...........
  29793. The corresponding GDB command is 'tvariable'.
  29794. The '-trace-frame-collected' Command
  29795. ------------------------------------
  29796. Synopsis
  29797. ........
  29798. -trace-frame-collected
  29799. [--var-print-values VAR_PVAL]
  29800. [--comp-print-values COMP_PVAL]
  29801. [--registers-format REGFORMAT]
  29802. [--memory-contents]
  29803. This command returns the set of collected objects, register names,
  29804. trace state variable names, memory ranges and computed expressions that
  29805. have been collected at a particular trace frame. The optional
  29806. parameters to the command affect the output format in different ways.
  29807. See the output description table below for more details.
  29808. The reported names can be used in the normal manner to create varobjs
  29809. and inspect the objects themselves. The items returned by this command
  29810. are categorized so that it is clear which is a variable, which is a
  29811. register, which is a trace state variable, which is a memory range and
  29812. which is a computed expression.
  29813. For instance, if the actions were
  29814. collect myVar, myArray[myIndex], myObj.field, myPtr->field, myCount + 2
  29815. collect *(int*)0xaf02bef0@40
  29816. the object collected in its entirety would be 'myVar'. The object
  29817. 'myArray' would be partially collected, because only the element at
  29818. index 'myIndex' would be collected. The remaining objects would be
  29819. computed expressions.
  29820. An example output would be:
  29821. (gdb)
  29822. -trace-frame-collected
  29823. ^done,
  29824. explicit-variables=[{name="myVar",value="1"}],
  29825. computed-expressions=[{name="myArray[myIndex]",value="0"},
  29826. {name="myObj.field",value="0"},
  29827. {name="myPtr->field",value="1"},
  29828. {name="myCount + 2",value="3"},
  29829. {name="$tvar1 + 1",value="43970027"}],
  29830. registers=[{number="0",value="0x7fe2c6e79ec8"},
  29831. {number="1",value="0x0"},
  29832. {number="2",value="0x4"},
  29833. ...
  29834. {number="125",value="0x0"}],
  29835. tvars=[{name="$tvar1",current="43970026"}],
  29836. memory=[{address="0x0000000000602264",length="4"},
  29837. {address="0x0000000000615bc0",length="4"}]
  29838. (gdb)
  29839. Where:
  29840. 'explicit-variables'
  29841. The set of objects that have been collected in their entirety (as
  29842. opposed to collecting just a few elements of an array or a few
  29843. struct members). For each object, its name and value are printed.
  29844. The '--var-print-values' option affects how or whether the value
  29845. field is output. If VAR_PVAL is 0, then print only the names; if
  29846. it is 1, print also their values; and if it is 2, print the name,
  29847. type and value for simple data types, and the name and type for
  29848. arrays, structures and unions.
  29849. 'computed-expressions'
  29850. The set of computed expressions that have been collected at the
  29851. current trace frame. The '--comp-print-values' option affects this
  29852. set like the '--var-print-values' option affects the
  29853. 'explicit-variables' set. See above.
  29854. 'registers'
  29855. The registers that have been collected at the current trace frame.
  29856. For each register collected, the name and current value are
  29857. returned. The value is formatted according to the
  29858. '--registers-format' option. See the '-data-list-register-values'
  29859. command for a list of the allowed formats. The default is 'x'.
  29860. 'tvars'
  29861. The trace state variables that have been collected at the current
  29862. trace frame. For each trace state variable collected, the name and
  29863. current value are returned.
  29864. 'memory'
  29865. The set of memory ranges that have been collected at the current
  29866. trace frame. Its content is a list of tuples. Each tuple
  29867. represents a collected memory range and has the following fields:
  29868. 'address'
  29869. The start address of the memory range, as hexadecimal literal.
  29870. 'length'
  29871. The length of the memory range, as decimal literal.
  29872. 'contents'
  29873. The contents of the memory block, in hex. This field is only
  29874. present if the '--memory-contents' option is specified.
  29875. GDB Command
  29876. ...........
  29877. There is no corresponding GDB command.
  29878. Example
  29879. .......
  29880. -trace-list-variables
  29881. ---------------------
  29882. Synopsis
  29883. ........
  29884. -trace-list-variables
  29885. Return a table of all defined trace variables. Each element of the
  29886. table has the following fields:
  29887. 'name'
  29888. The name of the trace variable. This field is always present.
  29889. 'initial'
  29890. The initial value. This is a 64-bit signed integer. This field is
  29891. always present.
  29892. 'current'
  29893. The value the trace variable has at the moment. This is a 64-bit
  29894. signed integer. This field is absent iff current value is not
  29895. defined, for example if the trace was never run, or is presently
  29896. running.
  29897. GDB Command
  29898. ...........
  29899. The corresponding GDB command is 'tvariables'.
  29900. Example
  29901. .......
  29902. (gdb)
  29903. -trace-list-variables
  29904. ^done,trace-variables={nr_rows="1",nr_cols="3",
  29905. hdr=[{width="15",alignment="-1",col_name="name",colhdr="Name"},
  29906. {width="11",alignment="-1",col_name="initial",colhdr="Initial"},
  29907. {width="11",alignment="-1",col_name="current",colhdr="Current"}],
  29908. body=[variable={name="$trace_timestamp",initial="0"}
  29909. variable={name="$foo",initial="10",current="15"}]}
  29910. (gdb)
  29911. -trace-save
  29912. -----------
  29913. Synopsis
  29914. ........
  29915. -trace-save [ -r ] [ -ctf ] FILENAME
  29916. Saves the collected trace data to FILENAME. Without the '-r' option,
  29917. the data is downloaded from the target and saved in a local file. With
  29918. the '-r' option the target is asked to perform the save.
  29919. By default, this command will save the trace in the tfile format.
  29920. You can supply the optional '-ctf' argument to save it the CTF format.
  29921. See *note Trace Files:: for more information about CTF.
  29922. GDB Command
  29923. ...........
  29924. The corresponding GDB command is 'tsave'.
  29925. -trace-start
  29926. ------------
  29927. Synopsis
  29928. ........
  29929. -trace-start
  29930. Starts a tracing experiment. The result of this command does not
  29931. have any fields.
  29932. GDB Command
  29933. ...........
  29934. The corresponding GDB command is 'tstart'.
  29935. -trace-status
  29936. -------------
  29937. Synopsis
  29938. ........
  29939. -trace-status
  29940. Obtains the status of a tracing experiment. The result may include
  29941. the following fields:
  29942. 'supported'
  29943. May have a value of either '0', when no tracing operations are
  29944. supported, '1', when all tracing operations are supported, or
  29945. 'file' when examining trace file. In the latter case, examining of
  29946. trace frame is possible but new tracing experiement cannot be
  29947. started. This field is always present.
  29948. 'running'
  29949. May have a value of either '0' or '1' depending on whether tracing
  29950. experiement is in progress on target. This field is present if
  29951. 'supported' field is not '0'.
  29952. 'stop-reason'
  29953. Report the reason why the tracing was stopped last time. This
  29954. field may be absent iff tracing was never stopped on target yet.
  29955. The value of 'request' means the tracing was stopped as result of
  29956. the '-trace-stop' command. The value of 'overflow' means the
  29957. tracing buffer is full. The value of 'disconnection' means tracing
  29958. was automatically stopped when GDB has disconnected. The value of
  29959. 'passcount' means tracing was stopped when a tracepoint was passed
  29960. a maximal number of times for that tracepoint. This field is
  29961. present if 'supported' field is not '0'.
  29962. 'stopping-tracepoint'
  29963. The number of tracepoint whose passcount as exceeded. This field
  29964. is present iff the 'stop-reason' field has the value of
  29965. 'passcount'.
  29966. 'frames'
  29967. 'frames-created'
  29968. The 'frames' field is a count of the total number of trace frames
  29969. in the trace buffer, while 'frames-created' is the total created
  29970. during the run, including ones that were discarded, such as when a
  29971. circular trace buffer filled up. Both fields are optional.
  29972. 'buffer-size'
  29973. 'buffer-free'
  29974. These fields tell the current size of the tracing buffer and the
  29975. remaining space. These fields are optional.
  29976. 'circular'
  29977. The value of the circular trace buffer flag. '1' means that the
  29978. trace buffer is circular and old trace frames will be discarded if
  29979. necessary to make room, '0' means that the trace buffer is linear
  29980. and may fill up.
  29981. 'disconnected'
  29982. The value of the disconnected tracing flag. '1' means that tracing
  29983. will continue after GDB disconnects, '0' means that the trace run
  29984. will stop.
  29985. 'trace-file'
  29986. The filename of the trace file being examined. This field is
  29987. optional, and only present when examining a trace file.
  29988. GDB Command
  29989. ...........
  29990. The corresponding GDB command is 'tstatus'.
  29991. -trace-stop
  29992. -----------
  29993. Synopsis
  29994. ........
  29995. -trace-stop
  29996. Stops a tracing experiment. The result of this command has the same
  29997. fields as '-trace-status', except that the 'supported' and 'running'
  29998. fields are not output.
  29999. GDB Command
  30000. ...........
  30001. The corresponding GDB command is 'tstop'.
  30002. 
  30003. File: gdb.info, Node: GDB/MI Symbol Query, Next: GDB/MI File Commands, Prev: GDB/MI Tracepoint Commands, Up: GDB/MI
  30004. 27.18 GDB/MI Symbol Query Commands
  30005. ==================================
  30006. The '-symbol-info-functions' Command
  30007. ------------------------------------
  30008. Synopsis
  30009. ........
  30010. -symbol-info-functions [--include-nondebug]
  30011. [--type TYPE_REGEXP]
  30012. [--name NAME_REGEXP]
  30013. [--max-results LIMIT]
  30014. Return a list containing the names and types for all global functions
  30015. taken from the debug information. The functions are grouped by source
  30016. file, and shown with the line number on which each function is defined.
  30017. The '--include-nondebug' option causes the output to include code
  30018. symbols from the symbol table.
  30019. The options '--type' and '--name' allow the symbols returned to be
  30020. filtered based on either the name of the function, or the type signature
  30021. of the function.
  30022. The option '--max-results' restricts the command to return no more
  30023. than LIMIT results. If exactly LIMIT results are returned then there
  30024. might be additional results available if a higher limit is used.
  30025. GDB Command
  30026. ...........
  30027. The corresponding GDB command is 'info functions'.
  30028. Example
  30029. .......
  30030. (gdb)
  30031. -symbol-info-functions
  30032. ^done,symbols=
  30033. {debug=
  30034. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30035. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30036. symbols=[{line="36", name="f4", type="void (int *)",
  30037. description="void f4(int *);"},
  30038. {line="42", name="main", type="int ()",
  30039. description="int main();"},
  30040. {line="30", name="f1", type="my_int_t (int, int)",
  30041. description="static my_int_t f1(int, int);"}]},
  30042. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30043. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30044. symbols=[{line="33", name="f2", type="float (another_float_t)",
  30045. description="float f2(another_float_t);"},
  30046. {line="39", name="f3", type="int (another_int_t)",
  30047. description="int f3(another_int_t);"},
  30048. {line="27", name="f1", type="another_float_t (int)",
  30049. description="static another_float_t f1(int);"}]}]}
  30050. (gdb)
  30051. -symbol-info-functions --name f1
  30052. ^done,symbols=
  30053. {debug=
  30054. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30055. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30056. symbols=[{line="30", name="f1", type="my_int_t (int, int)",
  30057. description="static my_int_t f1(int, int);"}]},
  30058. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30059. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30060. symbols=[{line="27", name="f1", type="another_float_t (int)",
  30061. description="static another_float_t f1(int);"}]}]}
  30062. (gdb)
  30063. -symbol-info-functions --type void
  30064. ^done,symbols=
  30065. {debug=
  30066. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30067. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30068. symbols=[{line="36", name="f4", type="void (int *)",
  30069. description="void f4(int *);"}]}]}
  30070. (gdb)
  30071. -symbol-info-functions --include-nondebug
  30072. ^done,symbols=
  30073. {debug=
  30074. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30075. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30076. symbols=[{line="36", name="f4", type="void (int *)",
  30077. description="void f4(int *);"},
  30078. {line="42", name="main", type="int ()",
  30079. description="int main();"},
  30080. {line="30", name="f1", type="my_int_t (int, int)",
  30081. description="static my_int_t f1(int, int);"}]},
  30082. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30083. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30084. symbols=[{line="33", name="f2", type="float (another_float_t)",
  30085. description="float f2(another_float_t);"},
  30086. {line="39", name="f3", type="int (another_int_t)",
  30087. description="int f3(another_int_t);"},
  30088. {line="27", name="f1", type="another_float_t (int)",
  30089. description="static another_float_t f1(int);"}]}],
  30090. nondebug=
  30091. [{address="0x0000000000400398",name="_init"},
  30092. {address="0x00000000004003b0",name="_start"},
  30093. ...
  30094. ]}
  30095. The '-symbol-info-module-functions' Command
  30096. -------------------------------------------
  30097. Synopsis
  30098. ........
  30099. -symbol-info-module-functions [--module MODULE_REGEXP]
  30100. [--name NAME_REGEXP]
  30101. [--type TYPE_REGEXP]
  30102. Return a list containing the names of all known functions within all
  30103. know Fortran modules. The functions are grouped by source file and
  30104. containing module, and shown with the line number on which each function
  30105. is defined.
  30106. The option '--module' only returns results for modules matching
  30107. MODULE_REGEXP. The option '--name' only returns functions whose name
  30108. matches NAME_REGEXP, and '--type' only returns functions whose type
  30109. matches TYPE_REGEXP.
  30110. GDB Command
  30111. ...........
  30112. The corresponding GDB command is 'info module functions'.
  30113. Example
  30114. .......
  30115. (gdb)
  30116. -symbol-info-module-functions
  30117. ^done,symbols=
  30118. [{module="mod1",
  30119. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30120. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30121. symbols=[{line="21",name="mod1::check_all",type="void (void)",
  30122. description="void mod1::check_all(void);"}]}]},
  30123. {module="mod2",
  30124. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30125. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30126. symbols=[{line="30",name="mod2::check_var_i",type="void (void)",
  30127. description="void mod2::check_var_i(void);"}]}]},
  30128. {module="mod3",
  30129. files=[{filename="/projec/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30130. fullname="/projec/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30131. symbols=[{line="21",name="mod3::check_all",type="void (void)",
  30132. description="void mod3::check_all(void);"},
  30133. {line="27",name="mod3::check_mod2",type="void (void)",
  30134. description="void mod3::check_mod2(void);"}]}]},
  30135. {module="modmany",
  30136. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30137. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30138. symbols=[{line="35",name="modmany::check_some",type="void (void)",
  30139. description="void modmany::check_some(void);"}]}]},
  30140. {module="moduse",
  30141. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30142. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30143. symbols=[{line="44",name="moduse::check_all",type="void (void)",
  30144. description="void moduse::check_all(void);"},
  30145. {line="49",name="moduse::check_var_x",type="void (void)",
  30146. description="void moduse::check_var_x(void);"}]}]}]
  30147. The '-symbol-info-module-variables' Command
  30148. -------------------------------------------
  30149. Synopsis
  30150. ........
  30151. -symbol-info-module-variables [--module MODULE_REGEXP]
  30152. [--name NAME_REGEXP]
  30153. [--type TYPE_REGEXP]
  30154. Return a list containing the names of all known variables within all
  30155. know Fortran modules. The variables are grouped by source file and
  30156. containing module, and shown with the line number on which each variable
  30157. is defined.
  30158. The option '--module' only returns results for modules matching
  30159. MODULE_REGEXP. The option '--name' only returns variables whose name
  30160. matches NAME_REGEXP, and '--type' only returns variables whose type
  30161. matches TYPE_REGEXP.
  30162. GDB Command
  30163. ...........
  30164. The corresponding GDB command is 'info module variables'.
  30165. Example
  30166. .......
  30167. (gdb)
  30168. -symbol-info-module-variables
  30169. ^done,symbols=
  30170. [{module="mod1",
  30171. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30172. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30173. symbols=[{line="18",name="mod1::var_const",type="integer(kind=4)",
  30174. description="integer(kind=4) mod1::var_const;"},
  30175. {line="17",name="mod1::var_i",type="integer(kind=4)",
  30176. description="integer(kind=4) mod1::var_i;"}]}]},
  30177. {module="mod2",
  30178. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30179. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30180. symbols=[{line="28",name="mod2::var_i",type="integer(kind=4)",
  30181. description="integer(kind=4) mod2::var_i;"}]}]},
  30182. {module="mod3",
  30183. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30184. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30185. symbols=[{line="18",name="mod3::mod1",type="integer(kind=4)",
  30186. description="integer(kind=4) mod3::mod1;"},
  30187. {line="17",name="mod3::mod2",type="integer(kind=4)",
  30188. description="integer(kind=4) mod3::mod2;"},
  30189. {line="19",name="mod3::var_i",type="integer(kind=4)",
  30190. description="integer(kind=4) mod3::var_i;"}]}]},
  30191. {module="modmany",
  30192. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30193. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30194. symbols=[{line="33",name="modmany::var_a",type="integer(kind=4)",
  30195. description="integer(kind=4) modmany::var_a;"},
  30196. {line="33",name="modmany::var_b",type="integer(kind=4)",
  30197. description="integer(kind=4) modmany::var_b;"},
  30198. {line="33",name="modmany::var_c",type="integer(kind=4)",
  30199. description="integer(kind=4) modmany::var_c;"},
  30200. {line="33",name="modmany::var_i",type="integer(kind=4)",
  30201. description="integer(kind=4) modmany::var_i;"}]}]},
  30202. {module="moduse",
  30203. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30204. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30205. symbols=[{line="42",name="moduse::var_x",type="integer(kind=4)",
  30206. description="integer(kind=4) moduse::var_x;"},
  30207. {line="42",name="moduse::var_y",type="integer(kind=4)",
  30208. description="integer(kind=4) moduse::var_y;"}]}]}]
  30209. The '-symbol-info-modules' Command
  30210. ----------------------------------
  30211. Synopsis
  30212. ........
  30213. -symbol-info-modules [--name NAME_REGEXP]
  30214. [--max-results LIMIT]
  30215. Return a list containing the names of all known Fortran modules. The
  30216. modules are grouped by source file, and shown with the line number on
  30217. which each modules is defined.
  30218. The option '--name' allows the modules returned to be filtered based
  30219. the name of the module.
  30220. The option '--max-results' restricts the command to return no more
  30221. than LIMIT results. If exactly LIMIT results are returned then there
  30222. might be additional results available if a higher limit is used.
  30223. GDB Command
  30224. ...........
  30225. The corresponding GDB command is 'info modules'.
  30226. Example
  30227. .......
  30228. (gdb)
  30229. -symbol-info-modules
  30230. ^done,symbols=
  30231. {debug=
  30232. [{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30233. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30234. symbols=[{line="16",name="mod1"},
  30235. {line="22",name="mod2"}]},
  30236. {filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30237. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30238. symbols=[{line="16",name="mod3"},
  30239. {line="22",name="modmany"},
  30240. {line="26",name="moduse"}]}]}
  30241. (gdb)
  30242. -symbol-info-modules --name mod[123]
  30243. ^done,symbols=
  30244. {debug=
  30245. [{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30246. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30247. symbols=[{line="16",name="mod1"},
  30248. {line="22",name="mod2"}]},
  30249. {filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30250. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30251. symbols=[{line="16",name="mod3"}]}]}
  30252. The '-symbol-info-types' Command
  30253. --------------------------------
  30254. Synopsis
  30255. ........
  30256. -symbol-info-types [--name NAME_REGEXP]
  30257. [--max-results LIMIT]
  30258. Return a list of all defined types. The types are grouped by source
  30259. file, and shown with the line number on which each user defined type is
  30260. defined. Some base types are not defined in the source code but are
  30261. added to the debug information by the compiler, for example 'int',
  30262. 'float', etc.; these types do not have an associated line number.
  30263. The option '--name' allows the list of types returned to be filtered
  30264. by name.
  30265. The option '--max-results' restricts the command to return no more
  30266. than LIMIT results. If exactly LIMIT results are returned then there
  30267. might be additional results available if a higher limit is used.
  30268. GDB Command
  30269. ...........
  30270. The corresponding GDB command is 'info types'.
  30271. Example
  30272. .......
  30273. (gdb)
  30274. -symbol-info-types
  30275. ^done,symbols=
  30276. {debug=
  30277. [{filename="gdb.mi/mi-sym-info-1.c",
  30278. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30279. symbols=[{name="float"},
  30280. {name="int"},
  30281. {line="27",name="typedef int my_int_t;"}]},
  30282. {filename="gdb.mi/mi-sym-info-2.c",
  30283. fullname="/project/gdb.mi/mi-sym-info-2.c",
  30284. symbols=[{line="24",name="typedef float another_float_t;"},
  30285. {line="23",name="typedef int another_int_t;"},
  30286. {name="float"},
  30287. {name="int"}]}]}
  30288. (gdb)
  30289. -symbol-info-types --name _int_
  30290. ^done,symbols=
  30291. {debug=
  30292. [{filename="gdb.mi/mi-sym-info-1.c",
  30293. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30294. symbols=[{line="27",name="typedef int my_int_t;"}]},
  30295. {filename="gdb.mi/mi-sym-info-2.c",
  30296. fullname="/project/gdb.mi/mi-sym-info-2.c",
  30297. symbols=[{line="23",name="typedef int another_int_t;"}]}]}
  30298. The '-symbol-info-variables' Command
  30299. ------------------------------------
  30300. Synopsis
  30301. ........
  30302. -symbol-info-variables [--include-nondebug]
  30303. [--type TYPE_REGEXP]
  30304. [--name NAME_REGEXP]
  30305. [--max-results LIMIT]
  30306. Return a list containing the names and types for all global variables
  30307. taken from the debug information. The variables are grouped by source
  30308. file, and shown with the line number on which each variable is defined.
  30309. The '--include-nondebug' option causes the output to include data
  30310. symbols from the symbol table.
  30311. The options '--type' and '--name' allow the symbols returned to be
  30312. filtered based on either the name of the variable, or the type of the
  30313. variable.
  30314. The option '--max-results' restricts the command to return no more
  30315. than LIMIT results. If exactly LIMIT results are returned then there
  30316. might be additional results available if a higher limit is used.
  30317. GDB Command
  30318. ...........
  30319. The corresponding GDB command is 'info variables'.
  30320. Example
  30321. .......
  30322. (gdb)
  30323. -symbol-info-variables
  30324. ^done,symbols=
  30325. {debug=
  30326. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30327. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30328. symbols=[{line="25",name="global_f1",type="float",
  30329. description="static float global_f1;"},
  30330. {line="24",name="global_i1",type="int",
  30331. description="static int global_i1;"}]},
  30332. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30333. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30334. symbols=[{line="21",name="global_f2",type="int",
  30335. description="int global_f2;"},
  30336. {line="20",name="global_i2",type="int",
  30337. description="int global_i2;"},
  30338. {line="19",name="global_f1",type="float",
  30339. description="static float global_f1;"},
  30340. {line="18",name="global_i1",type="int",
  30341. description="static int global_i1;"}]}]}
  30342. (gdb)
  30343. -symbol-info-variables --name f1
  30344. ^done,symbols=
  30345. {debug=
  30346. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30347. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30348. symbols=[{line="25",name="global_f1",type="float",
  30349. description="static float global_f1;"}]},
  30350. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30351. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30352. symbols=[{line="19",name="global_f1",type="float",
  30353. description="static float global_f1;"}]}]}
  30354. (gdb)
  30355. -symbol-info-variables --type float
  30356. ^done,symbols=
  30357. {debug=
  30358. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30359. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30360. symbols=[{line="25",name="global_f1",type="float",
  30361. description="static float global_f1;"}]},
  30362. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30363. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30364. symbols=[{line="19",name="global_f1",type="float",
  30365. description="static float global_f1;"}]}]}
  30366. (gdb)
  30367. -symbol-info-variables --include-nondebug
  30368. ^done,symbols=
  30369. {debug=
  30370. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30371. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30372. symbols=[{line="25",name="global_f1",type="float",
  30373. description="static float global_f1;"},
  30374. {line="24",name="global_i1",type="int",
  30375. description="static int global_i1;"}]},
  30376. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30377. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30378. symbols=[{line="21",name="global_f2",type="int",
  30379. description="int global_f2;"},
  30380. {line="20",name="global_i2",type="int",
  30381. description="int global_i2;"},
  30382. {line="19",name="global_f1",type="float",
  30383. description="static float global_f1;"},
  30384. {line="18",name="global_i1",type="int",
  30385. description="static int global_i1;"}]}],
  30386. nondebug=
  30387. [{address="0x00000000004005d0",name="_IO_stdin_used"},
  30388. {address="0x00000000004005d8",name="__dso_handle"}
  30389. ...
  30390. ]}
  30391. The '-symbol-list-lines' Command
  30392. --------------------------------
  30393. Synopsis
  30394. ........
  30395. -symbol-list-lines FILENAME
  30396. Print the list of lines that contain code and their associated
  30397. program addresses for the given source filename. The entries are sorted
  30398. in ascending PC order.
  30399. GDB Command
  30400. ...........
  30401. There is no corresponding GDB command.
  30402. Example
  30403. .......
  30404. (gdb)
  30405. -symbol-list-lines basics.c
  30406. ^done,lines=[{pc="0x08048554",line="7"},{pc="0x0804855a",line="8"}]
  30407. (gdb)
  30408. 
  30409. File: gdb.info, Node: GDB/MI File Commands, Next: GDB/MI Target Manipulation, Prev: GDB/MI Symbol Query, Up: GDB/MI
  30410. 27.19 GDB/MI File Commands
  30411. ==========================
  30412. This section describes the GDB/MI commands to specify executable file
  30413. names and to read in and obtain symbol table information.
  30414. The '-file-exec-and-symbols' Command
  30415. ------------------------------------
  30416. Synopsis
  30417. ........
  30418. -file-exec-and-symbols FILE
  30419. Specify the executable file to be debugged. This file is the one
  30420. from which the symbol table is also read. If no file is specified, the
  30421. command clears the executable and symbol information. If breakpoints
  30422. are set when using this command with no arguments, GDB will produce
  30423. error messages. Otherwise, no output is produced, except a completion
  30424. notification.
  30425. GDB Command
  30426. ...........
  30427. The corresponding GDB command is 'file'.
  30428. Example
  30429. .......
  30430. (gdb)
  30431. -file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
  30432. ^done
  30433. (gdb)
  30434. The '-file-exec-file' Command
  30435. -----------------------------
  30436. Synopsis
  30437. ........
  30438. -file-exec-file FILE
  30439. Specify the executable file to be debugged. Unlike
  30440. '-file-exec-and-symbols', the symbol table is _not_ read from this file.
  30441. If used without argument, GDB clears the information about the
  30442. executable file. No output is produced, except a completion
  30443. notification.
  30444. GDB Command
  30445. ...........
  30446. The corresponding GDB command is 'exec-file'.
  30447. Example
  30448. .......
  30449. (gdb)
  30450. -file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
  30451. ^done
  30452. (gdb)
  30453. The '-file-list-exec-source-file' Command
  30454. -----------------------------------------
  30455. Synopsis
  30456. ........
  30457. -file-list-exec-source-file
  30458. List the line number, the current source file, and the absolute path
  30459. to the current source file for the current executable. The macro
  30460. information field has a value of '1' or '0' depending on whether or not
  30461. the file includes preprocessor macro information.
  30462. GDB Command
  30463. ...........
  30464. The GDB equivalent is 'info source'
  30465. Example
  30466. .......
  30467. (gdb)
  30468. 123-file-list-exec-source-file
  30469. 123^done,line="1",file="foo.c",fullname="/home/bar/foo.c,macro-info="1"
  30470. (gdb)
  30471. The '-file-list-exec-source-files' Command
  30472. ------------------------------------------
  30473. Synopsis
  30474. ........
  30475. -file-list-exec-source-files
  30476. List the source files for the current executable.
  30477. It will always output both the filename and fullname (absolute file
  30478. name) of a source file.
  30479. GDB Command
  30480. ...........
  30481. The GDB equivalent is 'info sources'. 'gdbtk' has an analogous command
  30482. 'gdb_listfiles'.
  30483. Example
  30484. .......
  30485. (gdb)
  30486. -file-list-exec-source-files
  30487. ^done,files=[
  30488. {file=foo.c,fullname=/home/foo.c},
  30489. {file=/home/bar.c,fullname=/home/bar.c},
  30490. {file=gdb_could_not_find_fullpath.c}]
  30491. (gdb)
  30492. The '-file-list-shared-libraries' Command
  30493. -----------------------------------------
  30494. Synopsis
  30495. ........
  30496. -file-list-shared-libraries [ REGEXP ]
  30497. List the shared libraries in the program. With a regular expression
  30498. REGEXP, only those libraries whose names match REGEXP are listed.
  30499. GDB Command
  30500. ...........
  30501. The corresponding GDB command is 'info shared'. The fields have a
  30502. similar meaning to the '=library-loaded' notification. The 'ranges'
  30503. field specifies the multiple segments belonging to this library. Each
  30504. range has the following fields:
  30505. 'from'
  30506. The address defining the inclusive lower bound of the segment.
  30507. 'to'
  30508. The address defining the exclusive upper bound of the segment.
  30509. Example
  30510. .......
  30511. (gdb)
  30512. -file-list-exec-source-files
  30513. ^done,shared-libraries=[
  30514. {id="/lib/libfoo.so",target-name="/lib/libfoo.so",host-name="/lib/libfoo.so",symbols-loaded="1",thread-group="i1",ranges=[{from="0x72815989",to="0x728162c0"}]},
  30515. {id="/lib/libbar.so",target-name="/lib/libbar.so",host-name="/lib/libbar.so",symbols-loaded="1",thread-group="i1",ranges=[{from="0x76ee48c0",to="0x76ee9160"}]}]
  30516. (gdb)
  30517. The '-file-symbol-file' Command
  30518. -------------------------------
  30519. Synopsis
  30520. ........
  30521. -file-symbol-file FILE
  30522. Read symbol table info from the specified FILE argument. When used
  30523. without arguments, clears GDB's symbol table info. No output is
  30524. produced, except for a completion notification.
  30525. GDB Command
  30526. ...........
  30527. The corresponding GDB command is 'symbol-file'.
  30528. Example
  30529. .......
  30530. (gdb)
  30531. -file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
  30532. ^done
  30533. (gdb)
  30534. 
  30535. File: gdb.info, Node: GDB/MI Target Manipulation, Next: GDB/MI File Transfer Commands, Prev: GDB/MI File Commands, Up: GDB/MI
  30536. 27.20 GDB/MI Target Manipulation Commands
  30537. =========================================
  30538. The '-target-attach' Command
  30539. ----------------------------
  30540. Synopsis
  30541. ........
  30542. -target-attach PID | GID | FILE
  30543. Attach to a process PID or a file FILE outside of GDB, or a thread
  30544. group GID. If attaching to a thread group, the id previously returned
  30545. by '-list-thread-groups --available' must be used.
  30546. GDB Command
  30547. ...........
  30548. The corresponding GDB command is 'attach'.
  30549. Example
  30550. .......
  30551. (gdb)
  30552. -target-attach 34
  30553. =thread-created,id="1"
  30554. *stopped,thread-id="1",frame={addr="0xb7f7e410",func="bar",args=[]}
  30555. ^done
  30556. (gdb)
  30557. The '-target-detach' Command
  30558. ----------------------------
  30559. Synopsis
  30560. ........
  30561. -target-detach [ PID | GID ]
  30562. Detach from the remote target which normally resumes its execution.
  30563. If either PID or GID is specified, detaches from either the specified
  30564. process, or specified thread group. There's no output.
  30565. GDB Command
  30566. ...........
  30567. The corresponding GDB command is 'detach'.
  30568. Example
  30569. .......
  30570. (gdb)
  30571. -target-detach
  30572. ^done
  30573. (gdb)
  30574. The '-target-disconnect' Command
  30575. --------------------------------
  30576. Synopsis
  30577. ........
  30578. -target-disconnect
  30579. Disconnect from the remote target. There's no output and the target
  30580. is generally not resumed.
  30581. GDB Command
  30582. ...........
  30583. The corresponding GDB command is 'disconnect'.
  30584. Example
  30585. .......
  30586. (gdb)
  30587. -target-disconnect
  30588. ^done
  30589. (gdb)
  30590. The '-target-download' Command
  30591. ------------------------------
  30592. Synopsis
  30593. ........
  30594. -target-download
  30595. Loads the executable onto the remote target. It prints out an update
  30596. message every half second, which includes the fields:
  30597. 'section'
  30598. The name of the section.
  30599. 'section-sent'
  30600. The size of what has been sent so far for that section.
  30601. 'section-size'
  30602. The size of the section.
  30603. 'total-sent'
  30604. The total size of what was sent so far (the current and the
  30605. previous sections).
  30606. 'total-size'
  30607. The size of the overall executable to download.
  30608. Each message is sent as status record (*note GDB/MI Output Syntax:
  30609. GDB/MI Output Syntax.).
  30610. In addition, it prints the name and size of the sections, as they are
  30611. downloaded. These messages include the following fields:
  30612. 'section'
  30613. The name of the section.
  30614. 'section-size'
  30615. The size of the section.
  30616. 'total-size'
  30617. The size of the overall executable to download.
  30618. At the end, a summary is printed.
  30619. GDB Command
  30620. ...........
  30621. The corresponding GDB command is 'load'.
  30622. Example
  30623. .......
  30624. Note: each status message appears on a single line. Here the messages
  30625. have been broken down so that they can fit onto a page.
  30626. (gdb)
  30627. -target-download
  30628. +download,{section=".text",section-size="6668",total-size="9880"}
  30629. +download,{section=".text",section-sent="512",section-size="6668",
  30630. total-sent="512",total-size="9880"}
  30631. +download,{section=".text",section-sent="1024",section-size="6668",
  30632. total-sent="1024",total-size="9880"}
  30633. +download,{section=".text",section-sent="1536",section-size="6668",
  30634. total-sent="1536",total-size="9880"}
  30635. +download,{section=".text",section-sent="2048",section-size="6668",
  30636. total-sent="2048",total-size="9880"}
  30637. +download,{section=".text",section-sent="2560",section-size="6668",
  30638. total-sent="2560",total-size="9880"}
  30639. +download,{section=".text",section-sent="3072",section-size="6668",
  30640. total-sent="3072",total-size="9880"}
  30641. +download,{section=".text",section-sent="3584",section-size="6668",
  30642. total-sent="3584",total-size="9880"}
  30643. +download,{section=".text",section-sent="4096",section-size="6668",
  30644. total-sent="4096",total-size="9880"}
  30645. +download,{section=".text",section-sent="4608",section-size="6668",
  30646. total-sent="4608",total-size="9880"}
  30647. +download,{section=".text",section-sent="5120",section-size="6668",
  30648. total-sent="5120",total-size="9880"}
  30649. +download,{section=".text",section-sent="5632",section-size="6668",
  30650. total-sent="5632",total-size="9880"}
  30651. +download,{section=".text",section-sent="6144",section-size="6668",
  30652. total-sent="6144",total-size="9880"}
  30653. +download,{section=".text",section-sent="6656",section-size="6668",
  30654. total-sent="6656",total-size="9880"}
  30655. +download,{section=".init",section-size="28",total-size="9880"}
  30656. +download,{section=".fini",section-size="28",total-size="9880"}
  30657. +download,{section=".data",section-size="3156",total-size="9880"}
  30658. +download,{section=".data",section-sent="512",section-size="3156",
  30659. total-sent="7236",total-size="9880"}
  30660. +download,{section=".data",section-sent="1024",section-size="3156",
  30661. total-sent="7748",total-size="9880"}
  30662. +download,{section=".data",section-sent="1536",section-size="3156",
  30663. total-sent="8260",total-size="9880"}
  30664. +download,{section=".data",section-sent="2048",section-size="3156",
  30665. total-sent="8772",total-size="9880"}
  30666. +download,{section=".data",section-sent="2560",section-size="3156",
  30667. total-sent="9284",total-size="9880"}
  30668. +download,{section=".data",section-sent="3072",section-size="3156",
  30669. total-sent="9796",total-size="9880"}
  30670. ^done,address="0x10004",load-size="9880",transfer-rate="6586",
  30671. write-rate="429"
  30672. (gdb)
  30673. GDB Command
  30674. ...........
  30675. No equivalent.
  30676. Example
  30677. .......
  30678. N.A.
  30679. The '-target-flash-erase' Command
  30680. ---------------------------------
  30681. Synopsis
  30682. ........
  30683. -target-flash-erase
  30684. Erases all known flash memory regions on the target.
  30685. The corresponding GDB command is 'flash-erase'.
  30686. The output is a list of flash regions that have been erased, with
  30687. starting addresses and memory region sizes.
  30688. (gdb)
  30689. -target-flash-erase
  30690. ^done,erased-regions={address="0x0",size="0x40000"}
  30691. (gdb)
  30692. The '-target-select' Command
  30693. ----------------------------
  30694. Synopsis
  30695. ........
  30696. -target-select TYPE PARAMETERS ...
  30697. Connect GDB to the remote target. This command takes two args:
  30698. 'TYPE'
  30699. The type of target, for instance 'remote', etc.
  30700. 'PARAMETERS'
  30701. Device names, host names and the like. *Note Commands for Managing
  30702. Targets: Target Commands, for more details.
  30703. The output is a connection notification, followed by the address at
  30704. which the target program is, in the following form:
  30705. ^connected,addr="ADDRESS",func="FUNCTION NAME",
  30706. args=[ARG LIST]
  30707. GDB Command
  30708. ...........
  30709. The corresponding GDB command is 'target'.
  30710. Example
  30711. .......
  30712. (gdb)
  30713. -target-select remote /dev/ttya
  30714. ^connected,addr="0xfe00a300",func="??",args=[]
  30715. (gdb)
  30716. 
  30717. File: gdb.info, Node: GDB/MI File Transfer Commands, Next: GDB/MI Ada Exceptions Commands, Prev: GDB/MI Target Manipulation, Up: GDB/MI
  30718. 27.21 GDB/MI File Transfer Commands
  30719. ===================================
  30720. The '-target-file-put' Command
  30721. ------------------------------
  30722. Synopsis
  30723. ........
  30724. -target-file-put HOSTFILE TARGETFILE
  30725. Copy file HOSTFILE from the host system (the machine running GDB) to
  30726. TARGETFILE on the target system.
  30727. GDB Command
  30728. ...........
  30729. The corresponding GDB command is 'remote put'.
  30730. Example
  30731. .......
  30732. (gdb)
  30733. -target-file-put localfile remotefile
  30734. ^done
  30735. (gdb)
  30736. The '-target-file-get' Command
  30737. ------------------------------
  30738. Synopsis
  30739. ........
  30740. -target-file-get TARGETFILE HOSTFILE
  30741. Copy file TARGETFILE from the target system to HOSTFILE on the host
  30742. system.
  30743. GDB Command
  30744. ...........
  30745. The corresponding GDB command is 'remote get'.
  30746. Example
  30747. .......
  30748. (gdb)
  30749. -target-file-get remotefile localfile
  30750. ^done
  30751. (gdb)
  30752. The '-target-file-delete' Command
  30753. ---------------------------------
  30754. Synopsis
  30755. ........
  30756. -target-file-delete TARGETFILE
  30757. Delete TARGETFILE from the target system.
  30758. GDB Command
  30759. ...........
  30760. The corresponding GDB command is 'remote delete'.
  30761. Example
  30762. .......
  30763. (gdb)
  30764. -target-file-delete remotefile
  30765. ^done
  30766. (gdb)
  30767. 
  30768. File: gdb.info, Node: GDB/MI Ada Exceptions Commands, Next: GDB/MI Support Commands, Prev: GDB/MI File Transfer Commands, Up: GDB/MI
  30769. 27.22 Ada Exceptions GDB/MI Commands
  30770. ====================================
  30771. The '-info-ada-exceptions' Command
  30772. ----------------------------------
  30773. Synopsis
  30774. ........
  30775. -info-ada-exceptions [ REGEXP]
  30776. List all Ada exceptions defined within the program being debugged.
  30777. With a regular expression REGEXP, only those exceptions whose names
  30778. match REGEXP are listed.
  30779. GDB Command
  30780. ...........
  30781. The corresponding GDB command is 'info exceptions'.
  30782. Result
  30783. ......
  30784. The result is a table of Ada exceptions. The following columns are
  30785. defined for each exception:
  30786. 'name'
  30787. The name of the exception.
  30788. 'address'
  30789. The address of the exception.
  30790. Example
  30791. .......
  30792. -info-ada-exceptions aint
  30793. ^done,ada-exceptions={nr_rows="2",nr_cols="2",
  30794. hdr=[{width="1",alignment="-1",col_name="name",colhdr="Name"},
  30795. {width="1",alignment="-1",col_name="address",colhdr="Address"}],
  30796. body=[{name="constraint_error",address="0x0000000000613da0"},
  30797. {name="const.aint_global_e",address="0x0000000000613b00"}]}
  30798. Catching Ada Exceptions
  30799. -----------------------
  30800. The commands describing how to ask GDB to stop when a program raises an
  30801. exception are described at *note Ada Exception GDB/MI Catchpoint
  30802. Commands::.
  30803. 
  30804. File: gdb.info, Node: GDB/MI Support Commands, Next: GDB/MI Miscellaneous Commands, Prev: GDB/MI Ada Exceptions Commands, Up: GDB/MI
  30805. 27.23 GDB/MI Support Commands
  30806. =============================
  30807. Since new commands and features get regularly added to GDB/MI, some
  30808. commands are available to help front-ends query the debugger about
  30809. support for these capabilities. Similarly, it is also possible to query
  30810. GDB about target support of certain features.
  30811. The '-info-gdb-mi-command' Command
  30812. ----------------------------------
  30813. Synopsis
  30814. ........
  30815. -info-gdb-mi-command CMD_NAME
  30816. Query support for the GDB/MI command named CMD_NAME.
  30817. Note that the dash ('-') starting all GDB/MI commands is technically
  30818. not part of the command name (*note GDB/MI Input Syntax::), and thus
  30819. should be omitted in CMD_NAME. However, for ease of use, this command
  30820. also accepts the form with the leading dash.
  30821. GDB Command
  30822. ...........
  30823. There is no corresponding GDB command.
  30824. Result
  30825. ......
  30826. The result is a tuple. There is currently only one field:
  30827. 'exists'
  30828. This field is equal to '"true"' if the GDB/MI command exists,
  30829. '"false"' otherwise.
  30830. Example
  30831. .......
  30832. Here is an example where the GDB/MI command does not exist:
  30833. -info-gdb-mi-command unsupported-command
  30834. ^done,command={exists="false"}
  30835. And here is an example where the GDB/MI command is known to the
  30836. debugger:
  30837. -info-gdb-mi-command symbol-list-lines
  30838. ^done,command={exists="true"}
  30839. The '-list-features' Command
  30840. ----------------------------
  30841. Returns a list of particular features of the MI protocol that this
  30842. version of gdb implements. A feature can be a command, or a new field
  30843. in an output of some command, or even an important bugfix. While a
  30844. frontend can sometimes detect presence of a feature at runtime, it is
  30845. easier to perform detection at debugger startup.
  30846. The command returns a list of strings, with each string naming an
  30847. available feature. Each returned string is just a name, it does not
  30848. have any internal structure. The list of possible feature names is
  30849. given below.
  30850. Example output:
  30851. (gdb) -list-features
  30852. ^done,result=["feature1","feature2"]
  30853. The current list of features is:
  30854. 'frozen-varobjs'
  30855. Indicates support for the '-var-set-frozen' command, as well as
  30856. possible presence of the 'frozen' field in the output of
  30857. '-varobj-create'.
  30858. 'pending-breakpoints'
  30859. Indicates support for the '-f' option to the '-break-insert'
  30860. command.
  30861. 'python'
  30862. Indicates Python scripting support, Python-based pretty-printing
  30863. commands, and possible presence of the 'display_hint' field in the
  30864. output of '-var-list-children'
  30865. 'thread-info'
  30866. Indicates support for the '-thread-info' command.
  30867. 'data-read-memory-bytes'
  30868. Indicates support for the '-data-read-memory-bytes' and the
  30869. '-data-write-memory-bytes' commands.
  30870. 'breakpoint-notifications'
  30871. Indicates that changes to breakpoints and breakpoints created via
  30872. the CLI will be announced via async records.
  30873. 'ada-task-info'
  30874. Indicates support for the '-ada-task-info' command.
  30875. 'language-option'
  30876. Indicates that all GDB/MI commands accept the '--language' option
  30877. (*note Context management::).
  30878. 'info-gdb-mi-command'
  30879. Indicates support for the '-info-gdb-mi-command' command.
  30880. 'undefined-command-error-code'
  30881. Indicates support for the "undefined-command" error code in error
  30882. result records, produced when trying to execute an undefined GDB/MI
  30883. command (*note GDB/MI Result Records::).
  30884. 'exec-run-start-option'
  30885. Indicates that the '-exec-run' command supports the '--start'
  30886. option (*note GDB/MI Program Execution::).
  30887. 'data-disassemble-a-option'
  30888. Indicates that the '-data-disassemble' command supports the '-a'
  30889. option (*note GDB/MI Data Manipulation::).
  30890. The '-list-target-features' Command
  30891. -----------------------------------
  30892. Returns a list of particular features that are supported by the target.
  30893. Those features affect the permitted MI commands, but unlike the features
  30894. reported by the '-list-features' command, the features depend on which
  30895. target GDB is using at the moment. Whenever a target can change, due to
  30896. commands such as '-target-select', '-target-attach' or '-exec-run', the
  30897. list of target features may change, and the frontend should obtain it
  30898. again. Example output:
  30899. (gdb) -list-target-features
  30900. ^done,result=["async"]
  30901. The current list of features is:
  30902. 'async'
  30903. Indicates that the target is capable of asynchronous command
  30904. execution, which means that GDB will accept further commands while
  30905. the target is running.
  30906. 'reverse'
  30907. Indicates that the target is capable of reverse execution. *Note
  30908. Reverse Execution::, for more information.
  30909. 
  30910. File: gdb.info, Node: GDB/MI Miscellaneous Commands, Prev: GDB/MI Support Commands, Up: GDB/MI
  30911. 27.24 Miscellaneous GDB/MI Commands
  30912. ===================================
  30913. The '-gdb-exit' Command
  30914. -----------------------
  30915. Synopsis
  30916. ........
  30917. -gdb-exit
  30918. Exit GDB immediately.
  30919. GDB Command
  30920. ...........
  30921. Approximately corresponds to 'quit'.
  30922. Example
  30923. .......
  30924. (gdb)
  30925. -gdb-exit
  30926. ^exit
  30927. The '-gdb-set' Command
  30928. ----------------------
  30929. Synopsis
  30930. ........
  30931. -gdb-set
  30932. Set an internal GDB variable.
  30933. GDB Command
  30934. ...........
  30935. The corresponding GDB command is 'set'.
  30936. Example
  30937. .......
  30938. (gdb)
  30939. -gdb-set $foo=3
  30940. ^done
  30941. (gdb)
  30942. The '-gdb-show' Command
  30943. -----------------------
  30944. Synopsis
  30945. ........
  30946. -gdb-show
  30947. Show the current value of a GDB variable.
  30948. GDB Command
  30949. ...........
  30950. The corresponding GDB command is 'show'.
  30951. Example
  30952. .......
  30953. (gdb)
  30954. -gdb-show annotate
  30955. ^done,value="0"
  30956. (gdb)
  30957. The '-gdb-version' Command
  30958. --------------------------
  30959. Synopsis
  30960. ........
  30961. -gdb-version
  30962. Show version information for GDB. Used mostly in testing.
  30963. GDB Command
  30964. ...........
  30965. The GDB equivalent is 'show version'. GDB by default shows this
  30966. information when you start an interactive session.
  30967. Example
  30968. .......
  30969. (gdb)
  30970. -gdb-version
  30971. ~GNU gdb 5.2.1
  30972. ~Copyright 2000 Free Software Foundation, Inc.
  30973. ~GDB is free software, covered by the GNU General Public License, and
  30974. ~you are welcome to change it and/or distribute copies of it under
  30975. ~ certain conditions.
  30976. ~Type "show copying" to see the conditions.
  30977. ~There is absolutely no warranty for GDB. Type "show warranty" for
  30978. ~ details.
  30979. ~This GDB was configured as
  30980. "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi".
  30981. ^done
  30982. (gdb)
  30983. The '-list-thread-groups' Command
  30984. ---------------------------------
  30985. Synopsis
  30986. --------
  30987. -list-thread-groups [ --available ] [ --recurse 1 ] [ GROUP ... ]
  30988. Lists thread groups (*note Thread groups::). When a single thread
  30989. group is passed as the argument, lists the children of that group. When
  30990. several thread group are passed, lists information about those thread
  30991. groups. Without any parameters, lists information about all top-level
  30992. thread groups.
  30993. Normally, thread groups that are being debugged are reported. With
  30994. the '--available' option, GDB reports thread groups available on the
  30995. target.
  30996. The output of this command may have either a 'threads' result or a
  30997. 'groups' result. The 'thread' result has a list of tuples as value,
  30998. with each tuple describing a thread (*note GDB/MI Thread Information::).
  30999. The 'groups' result has a list of tuples as value, each tuple describing
  31000. a thread group. If top-level groups are requested (that is, no
  31001. parameter is passed), or when several groups are passed, the output
  31002. always has a 'groups' result. The format of the 'group' result is
  31003. described below.
  31004. To reduce the number of roundtrips it's possible to list thread
  31005. groups together with their children, by passing the '--recurse' option
  31006. and the recursion depth. Presently, only recursion depth of 1 is
  31007. permitted. If this option is present, then every reported thread group
  31008. will also include its children, either as 'group' or 'threads' field.
  31009. In general, any combination of option and parameters is permitted,
  31010. with the following caveats:
  31011. * When a single thread group is passed, the output will typically be
  31012. the 'threads' result. Because threads may not contain anything,
  31013. the 'recurse' option will be ignored.
  31014. * When the '--available' option is passed, limited information may be
  31015. available. In particular, the list of threads of a process might
  31016. be inaccessible. Further, specifying specific thread groups might
  31017. not give any performance advantage over listing all thread groups.
  31018. The frontend should assume that '-list-thread-groups --available'
  31019. is always an expensive operation and cache the results.
  31020. The 'groups' result is a list of tuples, where each tuple may have
  31021. the following fields:
  31022. 'id'
  31023. Identifier of the thread group. This field is always present. The
  31024. identifier is an opaque string; frontends should not try to convert
  31025. it to an integer, even though it might look like one.
  31026. 'type'
  31027. The type of the thread group. At present, only 'process' is a
  31028. valid type.
  31029. 'pid'
  31030. The target-specific process identifier. This field is only present
  31031. for thread groups of type 'process' and only if the process exists.
  31032. 'exit-code'
  31033. The exit code of this group's last exited thread, formatted in
  31034. octal. This field is only present for thread groups of type
  31035. 'process' and only if the process is not running.
  31036. 'num_children'
  31037. The number of children this thread group has. This field may be
  31038. absent for an available thread group.
  31039. 'threads'
  31040. This field has a list of tuples as value, each tuple describing a
  31041. thread. It may be present if the '--recurse' option is specified,
  31042. and it's actually possible to obtain the threads.
  31043. 'cores'
  31044. This field is a list of integers, each identifying a core that one
  31045. thread of the group is running on. This field may be absent if
  31046. such information is not available.
  31047. 'executable'
  31048. The name of the executable file that corresponds to this thread
  31049. group. The field is only present for thread groups of type
  31050. 'process', and only if there is a corresponding executable file.
  31051. Example
  31052. -------
  31053. gdb
  31054. -list-thread-groups
  31055. ^done,groups=[{id="17",type="process",pid="yyy",num_children="2"}]
  31056. -list-thread-groups 17
  31057. ^done,threads=[{id="2",target-id="Thread 0xb7e14b90 (LWP 21257)",
  31058. frame={level="0",addr="0xffffe410",func="__kernel_vsyscall",args=[]},state="running"},
  31059. {id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
  31060. frame={level="0",addr="0x0804891f",func="foo",args=[{name="i",value="10"}],
  31061. file="/tmp/a.c",fullname="/tmp/a.c",line="158",arch="i386:x86_64"},state="running"}]]
  31062. -list-thread-groups --available
  31063. ^done,groups=[{id="17",type="process",pid="yyy",num_children="2",cores=[1,2]}]
  31064. -list-thread-groups --available --recurse 1
  31065. ^done,groups=[{id="17", types="process",pid="yyy",num_children="2",cores=[1,2],
  31066. threads=[{id="1",target-id="Thread 0xb7e14b90",cores=[1]},
  31067. {id="2",target-id="Thread 0xb7e14b90",cores=[2]}]},..]
  31068. -list-thread-groups --available --recurse 1 17 18
  31069. ^done,groups=[{id="17", types="process",pid="yyy",num_children="2",cores=[1,2],
  31070. threads=[{id="1",target-id="Thread 0xb7e14b90",cores=[1]},
  31071. {id="2",target-id="Thread 0xb7e14b90",cores=[2]}]},...]
  31072. The '-info-os' Command
  31073. ----------------------
  31074. Synopsis
  31075. ........
  31076. -info-os [ TYPE ]
  31077. If no argument is supplied, the command returns a table of available
  31078. operating-system-specific information types. If one of these types is
  31079. supplied as an argument TYPE, then the command returns a table of data
  31080. of that type.
  31081. The types of information available depend on the target operating
  31082. system.
  31083. GDB Command
  31084. ...........
  31085. The corresponding GDB command is 'info os'.
  31086. Example
  31087. .......
  31088. When run on a GNU/Linux system, the output will look something like
  31089. this:
  31090. gdb
  31091. -info-os
  31092. ^done,OSDataTable={nr_rows="10",nr_cols="3",
  31093. hdr=[{width="10",alignment="-1",col_name="col0",colhdr="Type"},
  31094. {width="10",alignment="-1",col_name="col1",colhdr="Description"},
  31095. {width="10",alignment="-1",col_name="col2",colhdr="Title"}],
  31096. body=[item={col0="cpus",col1="Listing of all cpus/cores on the system",
  31097. col2="CPUs"},
  31098. item={col0="files",col1="Listing of all file descriptors",
  31099. col2="File descriptors"},
  31100. item={col0="modules",col1="Listing of all loaded kernel modules",
  31101. col2="Kernel modules"},
  31102. item={col0="msg",col1="Listing of all message queues",
  31103. col2="Message queues"},
  31104. item={col0="processes",col1="Listing of all processes",
  31105. col2="Processes"},
  31106. item={col0="procgroups",col1="Listing of all process groups",
  31107. col2="Process groups"},
  31108. item={col0="semaphores",col1="Listing of all semaphores",
  31109. col2="Semaphores"},
  31110. item={col0="shm",col1="Listing of all shared-memory regions",
  31111. col2="Shared-memory regions"},
  31112. item={col0="sockets",col1="Listing of all internet-domain sockets",
  31113. col2="Sockets"},
  31114. item={col0="threads",col1="Listing of all threads",
  31115. col2="Threads"}]
  31116. gdb
  31117. -info-os processes
  31118. ^done,OSDataTable={nr_rows="190",nr_cols="4",
  31119. hdr=[{width="10",alignment="-1",col_name="col0",colhdr="pid"},
  31120. {width="10",alignment="-1",col_name="col1",colhdr="user"},
  31121. {width="10",alignment="-1",col_name="col2",colhdr="command"},
  31122. {width="10",alignment="-1",col_name="col3",colhdr="cores"}],
  31123. body=[item={col0="1",col1="root",col2="/sbin/init",col3="0"},
  31124. item={col0="2",col1="root",col2="[kthreadd]",col3="1"},
  31125. item={col0="3",col1="root",col2="[ksoftirqd/0]",col3="0"},
  31126. ...
  31127. item={col0="26446",col1="stan",col2="bash",col3="0"},
  31128. item={col0="28152",col1="stan",col2="bash",col3="1"}]}
  31129. (gdb)
  31130. (Note that the MI output here includes a '"Title"' column that does
  31131. not appear in command-line 'info os'; this column is useful for MI
  31132. clients that want to enumerate the types of data, such as in a popup
  31133. menu, but is needless clutter on the command line, and 'info os' omits
  31134. it.)
  31135. The '-add-inferior' Command
  31136. ---------------------------
  31137. Synopsis
  31138. --------
  31139. -add-inferior
  31140. Creates a new inferior (*note Inferiors Connections and Programs::).
  31141. The created inferior is not associated with any executable. Such
  31142. association may be established with the '-file-exec-and-symbols' command
  31143. (*note GDB/MI File Commands::). The command response has a single
  31144. field, 'inferior', whose value is the identifier of the thread group
  31145. corresponding to the new inferior.
  31146. Example
  31147. -------
  31148. gdb
  31149. -add-inferior
  31150. ^done,inferior="i3"
  31151. The '-interpreter-exec' Command
  31152. -------------------------------
  31153. Synopsis
  31154. --------
  31155. -interpreter-exec INTERPRETER COMMAND
  31156. Execute the specified COMMAND in the given INTERPRETER.
  31157. GDB Command
  31158. -----------
  31159. The corresponding GDB command is 'interpreter-exec'.
  31160. Example
  31161. -------
  31162. (gdb)
  31163. -interpreter-exec console "break main"
  31164. &"During symbol reading, couldn't parse type; debugger out of date?.\n"
  31165. &"During symbol reading, bad structure-type format.\n"
  31166. ~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n"
  31167. ^done
  31168. (gdb)
  31169. The '-inferior-tty-set' Command
  31170. -------------------------------
  31171. Synopsis
  31172. --------
  31173. -inferior-tty-set /dev/pts/1
  31174. Set terminal for future runs of the program being debugged.
  31175. GDB Command
  31176. -----------
  31177. The corresponding GDB command is 'set inferior-tty' /dev/pts/1.
  31178. Example
  31179. -------
  31180. (gdb)
  31181. -inferior-tty-set /dev/pts/1
  31182. ^done
  31183. (gdb)
  31184. The '-inferior-tty-show' Command
  31185. --------------------------------
  31186. Synopsis
  31187. --------
  31188. -inferior-tty-show
  31189. Show terminal for future runs of program being debugged.
  31190. GDB Command
  31191. -----------
  31192. The corresponding GDB command is 'show inferior-tty'.
  31193. Example
  31194. -------
  31195. (gdb)
  31196. -inferior-tty-set /dev/pts/1
  31197. ^done
  31198. (gdb)
  31199. -inferior-tty-show
  31200. ^done,inferior_tty_terminal="/dev/pts/1"
  31201. (gdb)
  31202. The '-enable-timings' Command
  31203. -----------------------------
  31204. Synopsis
  31205. --------
  31206. -enable-timings [yes | no]
  31207. Toggle the printing of the wallclock, user and system times for an MI
  31208. command as a field in its output. This command is to help frontend
  31209. developers optimize the performance of their code. No argument is
  31210. equivalent to 'yes'.
  31211. GDB Command
  31212. -----------
  31213. No equivalent.
  31214. Example
  31215. -------
  31216. (gdb)
  31217. -enable-timings
  31218. ^done
  31219. (gdb)
  31220. -break-insert main
  31221. ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  31222. addr="0x080484ed",func="main",file="myprog.c",
  31223. fullname="/home/nickrob/myprog.c",line="73",thread-groups=["i1"],
  31224. times="0"},
  31225. time={wallclock="0.05185",user="0.00800",system="0.00000"}
  31226. (gdb)
  31227. -enable-timings no
  31228. ^done
  31229. (gdb)
  31230. -exec-run
  31231. ^running
  31232. (gdb)
  31233. *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
  31234. frame={addr="0x080484ed",func="main",args=[{name="argc",value="1"},
  31235. {name="argv",value="0xbfb60364"}],file="myprog.c",
  31236. fullname="/home/nickrob/myprog.c",line="73",arch="i386:x86_64"}
  31237. (gdb)
  31238. The '-complete' Command
  31239. -----------------------
  31240. Synopsis
  31241. --------
  31242. -complete COMMAND
  31243. Show a list of completions for partially typed CLI COMMAND.
  31244. This command is intended for GDB/MI frontends that cannot use two
  31245. separate CLI and MI channels -- for example: because of lack of PTYs
  31246. like on Windows or because GDB is used remotely via a SSH connection.
  31247. Result
  31248. ------
  31249. The result consists of two or three fields:
  31250. 'completion'
  31251. This field contains the completed COMMAND. If COMMAND has no known
  31252. completions, this field is omitted.
  31253. 'matches'
  31254. This field contains a (possibly empty) array of matches. It is
  31255. always present.
  31256. 'max_completions_reached'
  31257. This field contains '1' if number of known completions is above
  31258. 'max-completions' limit (*note Completion::), otherwise it contains
  31259. '0'. It is always present.
  31260. GDB Command
  31261. -----------
  31262. The corresponding GDB command is 'complete'.
  31263. Example
  31264. -------
  31265. (gdb)
  31266. -complete br
  31267. ^done,completion="break",
  31268. matches=["break","break-range"],
  31269. max_completions_reached="0"
  31270. (gdb)
  31271. -complete "b ma"
  31272. ^done,completion="b ma",
  31273. matches=["b madvise","b main"],max_completions_reached="0"
  31274. (gdb)
  31275. -complete "b push_b"
  31276. ^done,completion="b push_back(",
  31277. matches=[
  31278. "b A::push_back(void*)",
  31279. "b std::string::push_back(char)",
  31280. "b std::vector<int, std::allocator<int> >::push_back(int&&)"],
  31281. max_completions_reached="0"
  31282. (gdb)
  31283. -complete "nonexist"
  31284. ^done,matches=[],max_completions_reached="0"
  31285. (gdb)
  31286. 
  31287. File: gdb.info, Node: Annotations, Next: JIT Interface, Prev: GDB/MI, Up: Top
  31288. 28 GDB Annotations
  31289. ******************
  31290. This chapter describes annotations in GDB. Annotations were designed to
  31291. interface GDB to graphical user interfaces or other similar programs
  31292. which want to interact with GDB at a relatively high level.
  31293. The annotation mechanism has largely been superseded by GDB/MI (*note
  31294. GDB/MI::).
  31295. * Menu:
  31296. * Annotations Overview:: What annotations are; the general syntax.
  31297. * Server Prefix:: Issuing a command without affecting user state.
  31298. * Prompting:: Annotations marking GDB's need for input.
  31299. * Errors:: Annotations for error messages.
  31300. * Invalidation:: Some annotations describe things now invalid.
  31301. * Annotations for Running::
  31302. Whether the program is running, how it stopped, etc.
  31303. * Source Annotations:: Annotations describing source code.
  31304. 
  31305. File: gdb.info, Node: Annotations Overview, Next: Server Prefix, Up: Annotations
  31306. 28.1 What is an Annotation?
  31307. ===========================
  31308. Annotations start with a newline character, two 'control-z' characters,
  31309. and the name of the annotation. If there is no additional information
  31310. associated with this annotation, the name of the annotation is followed
  31311. immediately by a newline. If there is additional information, the name
  31312. of the annotation is followed by a space, the additional information,
  31313. and a newline. The additional information cannot contain newline
  31314. characters.
  31315. Any output not beginning with a newline and two 'control-z'
  31316. characters denotes literal output from GDB. Currently there is no need
  31317. for GDB to output a newline followed by two 'control-z' characters, but
  31318. if there was such a need, the annotations could be extended with an
  31319. 'escape' annotation which means those three characters as output.
  31320. The annotation LEVEL, which is specified using the '--annotate'
  31321. command line option (*note Mode Options::), controls how much
  31322. information GDB prints together with its prompt, values of expressions,
  31323. source lines, and other types of output. Level 0 is for no annotations,
  31324. level 1 is for use when GDB is run as a subprocess of GNU Emacs, level 3
  31325. is the maximum annotation suitable for programs that control GDB, and
  31326. level 2 annotations have been made obsolete (*note Limitations of the
  31327. Annotation Interface: (annotate)Limitations.).
  31328. 'set annotate LEVEL'
  31329. The GDB command 'set annotate' sets the level of annotations to the
  31330. specified LEVEL.
  31331. 'show annotate'
  31332. Show the current annotation level.
  31333. This chapter describes level 3 annotations.
  31334. A simple example of starting up GDB with annotations is:
  31335. $ gdb --annotate=3
  31336. GNU gdb 6.0
  31337. Copyright 2003 Free Software Foundation, Inc.
  31338. GDB is free software, covered by the GNU General Public License,
  31339. and you are welcome to change it and/or distribute copies of it
  31340. under certain conditions.
  31341. Type "show copying" to see the conditions.
  31342. There is absolutely no warranty for GDB. Type "show warranty"
  31343. for details.
  31344. This GDB was configured as "i386-pc-linux-gnu"
  31345. ^Z^Zpre-prompt
  31346. (gdb)
  31347. ^Z^Zprompt
  31348. quit
  31349. ^Z^Zpost-prompt
  31350. $
  31351. Here 'quit' is input to GDB; the rest is output from GDB. The three
  31352. lines beginning '^Z^Z' (where '^Z' denotes a 'control-z' character) are
  31353. annotations; the rest is output from GDB.
  31354. 
  31355. File: gdb.info, Node: Server Prefix, Next: Prompting, Prev: Annotations Overview, Up: Annotations
  31356. 28.2 The Server Prefix
  31357. ======================
  31358. If you prefix a command with 'server ' then it will not affect the
  31359. command history, nor will it affect GDB's notion of which command to
  31360. repeat if <RET> is pressed on a line by itself. This means that
  31361. commands can be run behind a user's back by a front-end in a transparent
  31362. manner.
  31363. The 'server ' prefix does not affect the recording of values into the
  31364. value history; to print a value without recording it into the value
  31365. history, use the 'output' command instead of the 'print' command.
  31366. Using this prefix also disables confirmation requests (*note
  31367. confirmation requests::).
  31368. 
  31369. File: gdb.info, Node: Prompting, Next: Errors, Prev: Server Prefix, Up: Annotations
  31370. 28.3 Annotation for GDB Input
  31371. =============================
  31372. When GDB prompts for input, it annotates this fact so it is possible to
  31373. know when to send output, when the output from a given command is over,
  31374. etc.
  31375. Different kinds of input each have a different "input type". Each
  31376. input type has three annotations: a 'pre-' annotation, which denotes the
  31377. beginning of any prompt which is being output, a plain annotation, which
  31378. denotes the end of the prompt, and then a 'post-' annotation which
  31379. denotes the end of any echo which may (or may not) be associated with
  31380. the input. For example, the 'prompt' input type features the following
  31381. annotations:
  31382. ^Z^Zpre-prompt
  31383. ^Z^Zprompt
  31384. ^Z^Zpost-prompt
  31385. The input types are
  31386. 'prompt'
  31387. When GDB is prompting for a command (the main GDB prompt).
  31388. 'commands'
  31389. When GDB prompts for a set of commands, like in the 'commands'
  31390. command. The annotations are repeated for each command which is
  31391. input.
  31392. 'overload-choice'
  31393. When GDB wants the user to select between various overloaded
  31394. functions.
  31395. 'query'
  31396. When GDB wants the user to confirm a potentially dangerous
  31397. operation.
  31398. 'prompt-for-continue'
  31399. When GDB is asking the user to press return to continue. Note:
  31400. Don't expect this to work well; instead use 'set height 0' to
  31401. disable prompting. This is because the counting of lines is buggy
  31402. in the presence of annotations.
  31403. 
  31404. File: gdb.info, Node: Errors, Next: Invalidation, Prev: Prompting, Up: Annotations
  31405. 28.4 Errors
  31406. ===========
  31407. ^Z^Zquit
  31408. This annotation occurs right before GDB responds to an interrupt.
  31409. ^Z^Zerror
  31410. This annotation occurs right before GDB responds to an error.
  31411. Quit and error annotations indicate that any annotations which GDB
  31412. was in the middle of may end abruptly. For example, if a
  31413. 'value-history-begin' annotation is followed by a 'error', one cannot
  31414. expect to receive the matching 'value-history-end'. One cannot expect
  31415. not to receive it either, however; an error annotation does not
  31416. necessarily mean that GDB is immediately returning all the way to the
  31417. top level.
  31418. A quit or error annotation may be preceded by
  31419. ^Z^Zerror-begin
  31420. Any output between that and the quit or error annotation is the error
  31421. message.
  31422. Warning messages are not yet annotated.
  31423. 
  31424. File: gdb.info, Node: Invalidation, Next: Annotations for Running, Prev: Errors, Up: Annotations
  31425. 28.5 Invalidation Notices
  31426. =========================
  31427. The following annotations say that certain pieces of state may have
  31428. changed.
  31429. '^Z^Zframes-invalid'
  31430. The frames (for example, output from the 'backtrace' command) may
  31431. have changed.
  31432. '^Z^Zbreakpoints-invalid'
  31433. The breakpoints may have changed. For example, the user just added
  31434. or deleted a breakpoint.
  31435. 
  31436. File: gdb.info, Node: Annotations for Running, Next: Source Annotations, Prev: Invalidation, Up: Annotations
  31437. 28.6 Running the Program
  31438. ========================
  31439. When the program starts executing due to a GDB command such as 'step' or
  31440. 'continue',
  31441. ^Z^Zstarting
  31442. is output. When the program stops,
  31443. ^Z^Zstopped
  31444. is output. Before the 'stopped' annotation, a variety of annotations
  31445. describe how the program stopped.
  31446. '^Z^Zexited EXIT-STATUS'
  31447. The program exited, and EXIT-STATUS is the exit status (zero for
  31448. successful exit, otherwise nonzero).
  31449. '^Z^Zsignalled'
  31450. The program exited with a signal. After the '^Z^Zsignalled', the
  31451. annotation continues:
  31452. INTRO-TEXT
  31453. ^Z^Zsignal-name
  31454. NAME
  31455. ^Z^Zsignal-name-end
  31456. MIDDLE-TEXT
  31457. ^Z^Zsignal-string
  31458. STRING
  31459. ^Z^Zsignal-string-end
  31460. END-TEXT
  31461. where NAME is the name of the signal, such as 'SIGILL' or
  31462. 'SIGSEGV', and STRING is the explanation of the signal, such as
  31463. 'Illegal Instruction' or 'Segmentation fault'. The arguments
  31464. INTRO-TEXT, MIDDLE-TEXT, and END-TEXT are for the user's benefit
  31465. and have no particular format.
  31466. '^Z^Zsignal'
  31467. The syntax of this annotation is just like 'signalled', but GDB is
  31468. just saying that the program received the signal, not that it was
  31469. terminated with it.
  31470. '^Z^Zbreakpoint NUMBER'
  31471. The program hit breakpoint number NUMBER.
  31472. '^Z^Zwatchpoint NUMBER'
  31473. The program hit watchpoint number NUMBER.
  31474. 
  31475. File: gdb.info, Node: Source Annotations, Prev: Annotations for Running, Up: Annotations
  31476. 28.7 Displaying Source
  31477. ======================
  31478. The following annotation is used instead of displaying source code:
  31479. ^Z^Zsource FILENAME:LINE:CHARACTER:MIDDLE:ADDR
  31480. where FILENAME is an absolute file name indicating which source file,
  31481. LINE is the line number within that file (where 1 is the first line in
  31482. the file), CHARACTER is the character position within the file (where 0
  31483. is the first character in the file) (for most debug formats this will
  31484. necessarily point to the beginning of a line), MIDDLE is 'middle' if
  31485. ADDR is in the middle of the line, or 'beg' if ADDR is at the beginning
  31486. of the line, and ADDR is the address in the target program associated
  31487. with the source which is being displayed. The ADDR is in the form '0x'
  31488. followed by one or more lowercase hex digits (note that this does not
  31489. depend on the language).
  31490. 
  31491. File: gdb.info, Node: JIT Interface, Next: In-Process Agent, Prev: Annotations, Up: Top
  31492. 29 JIT Compilation Interface
  31493. ****************************
  31494. This chapter documents GDB's "just-in-time" (JIT) compilation interface.
  31495. A JIT compiler is a program or library that generates native executable
  31496. code at runtime and executes it, usually in order to achieve good
  31497. performance while maintaining platform independence.
  31498. Programs that use JIT compilation are normally difficult to debug
  31499. because portions of their code are generated at runtime, instead of
  31500. being loaded from object files, which is where GDB normally finds the
  31501. program's symbols and debug information. In order to debug programs
  31502. that use JIT compilation, GDB has an interface that allows the program
  31503. to register in-memory symbol files with GDB at runtime.
  31504. If you are using GDB to debug a program that uses this interface,
  31505. then it should work transparently so long as you have not stripped the
  31506. binary. If you are developing a JIT compiler, then the interface is
  31507. documented in the rest of this chapter. At this time, the only known
  31508. client of this interface is the LLVM JIT.
  31509. Broadly speaking, the JIT interface mirrors the dynamic loader
  31510. interface. The JIT compiler communicates with GDB by writing data into
  31511. a global variable and calling a function at a well-known symbol. When
  31512. GDB attaches, it reads a linked list of symbol files from the global
  31513. variable to find existing code, and puts a breakpoint in the function so
  31514. that it can find out about additional code.
  31515. * Menu:
  31516. * Declarations:: Relevant C struct declarations
  31517. * Registering Code:: Steps to register code
  31518. * Unregistering Code:: Steps to unregister code
  31519. * Custom Debug Info:: Emit debug information in a custom format
  31520. 
  31521. File: gdb.info, Node: Declarations, Next: Registering Code, Up: JIT Interface
  31522. 29.1 JIT Declarations
  31523. =====================
  31524. These are the relevant struct declarations that a C program should
  31525. include to implement the interface:
  31526. typedef enum
  31527. {
  31528. JIT_NOACTION = 0,
  31529. JIT_REGISTER_FN,
  31530. JIT_UNREGISTER_FN
  31531. } jit_actions_t;
  31532. struct jit_code_entry
  31533. {
  31534. struct jit_code_entry *next_entry;
  31535. struct jit_code_entry *prev_entry;
  31536. const char *symfile_addr;
  31537. uint64_t symfile_size;
  31538. };
  31539. struct jit_descriptor
  31540. {
  31541. uint32_t version;
  31542. /* This type should be jit_actions_t, but we use uint32_t
  31543. to be explicit about the bitwidth. */
  31544. uint32_t action_flag;
  31545. struct jit_code_entry *relevant_entry;
  31546. struct jit_code_entry *first_entry;
  31547. };
  31548. /* GDB puts a breakpoint in this function. */
  31549. void __attribute__((noinline)) __jit_debug_register_code() { };
  31550. /* Make sure to specify the version statically, because the
  31551. debugger may check the version before we can set it. */
  31552. struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
  31553. If the JIT is multi-threaded, then it is important that the JIT
  31554. synchronize any modifications to this global data properly, which can
  31555. easily be done by putting a global mutex around modifications to these
  31556. structures.
  31557. 
  31558. File: gdb.info, Node: Registering Code, Next: Unregistering Code, Prev: Declarations, Up: JIT Interface
  31559. 29.2 Registering Code
  31560. =====================
  31561. To register code with GDB, the JIT should follow this protocol:
  31562. * Generate an object file in memory with symbols and other desired
  31563. debug information. The file must include the virtual addresses of
  31564. the sections.
  31565. * Create a code entry for the file, which gives the start and size of
  31566. the symbol file.
  31567. * Add it to the linked list in the JIT descriptor.
  31568. * Point the relevant_entry field of the descriptor at the entry.
  31569. * Set 'action_flag' to 'JIT_REGISTER' and call
  31570. '__jit_debug_register_code'.
  31571. When GDB is attached and the breakpoint fires, GDB uses the
  31572. 'relevant_entry' pointer so it doesn't have to walk the list looking for
  31573. new code. However, the linked list must still be maintained in order to
  31574. allow GDB to attach to a running process and still find the symbol
  31575. files.
  31576. 
  31577. File: gdb.info, Node: Unregistering Code, Next: Custom Debug Info, Prev: Registering Code, Up: JIT Interface
  31578. 29.3 Unregistering Code
  31579. =======================
  31580. If code is freed, then the JIT should use the following protocol:
  31581. * Remove the code entry corresponding to the code from the linked
  31582. list.
  31583. * Point the 'relevant_entry' field of the descriptor at the code
  31584. entry.
  31585. * Set 'action_flag' to 'JIT_UNREGISTER' and call
  31586. '__jit_debug_register_code'.
  31587. If the JIT frees or recompiles code without unregistering it, then
  31588. GDB and the JIT will leak the memory used for the associated symbol
  31589. files.
  31590. 
  31591. File: gdb.info, Node: Custom Debug Info, Prev: Unregistering Code, Up: JIT Interface
  31592. 29.4 Custom Debug Info
  31593. ======================
  31594. Generating debug information in platform-native file formats (like ELF
  31595. or COFF) may be an overkill for JIT compilers; especially if all the
  31596. debug info is used for is displaying a meaningful backtrace. The issue
  31597. can be resolved by having the JIT writers decide on a debug info format
  31598. and also provide a reader that parses the debug info generated by the
  31599. JIT compiler. This section gives a brief overview on writing such a
  31600. parser. More specific details can be found in the source file
  31601. 'gdb/jit-reader.in', which is also installed as a header at
  31602. 'INCLUDEDIR/gdb/jit-reader.h' for easy inclusion.
  31603. The reader is implemented as a shared object (so this functionality
  31604. is not available on platforms which don't allow loading shared objects
  31605. at runtime). Two GDB commands, 'jit-reader-load' and
  31606. 'jit-reader-unload' are provided, to be used to load and unload the
  31607. readers from a preconfigured directory. Once loaded, the shared object
  31608. is used the parse the debug information emitted by the JIT compiler.
  31609. * Menu:
  31610. * Using JIT Debug Info Readers:: How to use supplied readers correctly
  31611. * Writing JIT Debug Info Readers:: Creating a debug-info reader
  31612. 
  31613. File: gdb.info, Node: Using JIT Debug Info Readers, Next: Writing JIT Debug Info Readers, Up: Custom Debug Info
  31614. 29.4.1 Using JIT Debug Info Readers
  31615. -----------------------------------
  31616. Readers can be loaded and unloaded using the 'jit-reader-load' and
  31617. 'jit-reader-unload' commands.
  31618. 'jit-reader-load READER'
  31619. Load the JIT reader named READER, which is a shared object
  31620. specified as either an absolute or a relative file name. In the
  31621. latter case, GDB will try to load the reader from a pre-configured
  31622. directory, usually 'LIBDIR/gdb/' on a UNIX system (here LIBDIR is
  31623. the system library directory, often '/usr/local/lib').
  31624. Only one reader can be active at a time; trying to load a second
  31625. reader when one is already loaded will result in GDB reporting an
  31626. error. A new JIT reader can be loaded by first unloading the
  31627. current one using 'jit-reader-unload' and then invoking
  31628. 'jit-reader-load'.
  31629. 'jit-reader-unload'
  31630. Unload the currently loaded JIT reader.
  31631. 
  31632. File: gdb.info, Node: Writing JIT Debug Info Readers, Prev: Using JIT Debug Info Readers, Up: Custom Debug Info
  31633. 29.4.2 Writing JIT Debug Info Readers
  31634. -------------------------------------
  31635. As mentioned, a reader is essentially a shared object conforming to a
  31636. certain ABI. This ABI is described in 'jit-reader.h'.
  31637. 'jit-reader.h' defines the structures, macros and functions required
  31638. to write a reader. It is installed (along with GDB), in
  31639. 'INCLUDEDIR/gdb' where INCLUDEDIR is the system include directory.
  31640. Readers need to be released under a GPL compatible license. A reader
  31641. can be declared as released under such a license by placing the macro
  31642. 'GDB_DECLARE_GPL_COMPATIBLE_READER' in a source file.
  31643. The entry point for readers is the symbol 'gdb_init_reader', which is
  31644. expected to be a function with the prototype
  31645. extern struct gdb_reader_funcs *gdb_init_reader (void);
  31646. 'struct gdb_reader_funcs' contains a set of pointers to callback
  31647. functions. These functions are executed to read the debug info
  31648. generated by the JIT compiler ('read'), to unwind stack frames
  31649. ('unwind') and to create canonical frame IDs ('get_frame_id'). It also
  31650. has a callback that is called when the reader is being unloaded
  31651. ('destroy'). The struct looks like this
  31652. struct gdb_reader_funcs
  31653. {
  31654. /* Must be set to GDB_READER_INTERFACE_VERSION. */
  31655. int reader_version;
  31656. /* For use by the reader. */
  31657. void *priv_data;
  31658. gdb_read_debug_info *read;
  31659. gdb_unwind_frame *unwind;
  31660. gdb_get_frame_id *get_frame_id;
  31661. gdb_destroy_reader *destroy;
  31662. };
  31663. The callbacks are provided with another set of callbacks by GDB to do
  31664. their job. For 'read', these callbacks are passed in a 'struct
  31665. gdb_symbol_callbacks' and for 'unwind' and 'get_frame_id', in a 'struct
  31666. gdb_unwind_callbacks'. 'struct gdb_symbol_callbacks' has callbacks to
  31667. create new object files and new symbol tables inside those object files.
  31668. 'struct gdb_unwind_callbacks' has callbacks to read registers off the
  31669. current frame and to write out the values of the registers in the
  31670. previous frame. Both have a callback ('target_read') to read bytes off
  31671. the target's address space.
  31672. 
  31673. File: gdb.info, Node: In-Process Agent, Next: GDB Bugs, Prev: JIT Interface, Up: Top
  31674. 30 In-Process Agent
  31675. *******************
  31676. The traditional debugging model is conceptually low-speed, but works
  31677. fine, because most bugs can be reproduced in debugging-mode execution.
  31678. However, as multi-core or many-core processors are becoming mainstream,
  31679. and multi-threaded programs become more and more popular, there should
  31680. be more and more bugs that only manifest themselves at normal-mode
  31681. execution, for example, thread races, because debugger's interference
  31682. with the program's timing may conceal the bugs. On the other hand, in
  31683. some applications, it is not feasible for the debugger to interrupt the
  31684. program's execution long enough for the developer to learn anything
  31685. helpful about its behavior. If the program's correctness depends on its
  31686. real-time behavior, delays introduced by a debugger might cause the
  31687. program to fail, even when the code itself is correct. It is useful to
  31688. be able to observe the program's behavior without interrupting it.
  31689. Therefore, traditional debugging model is too intrusive to reproduce
  31690. some bugs. In order to reduce the interference with the program, we can
  31691. reduce the number of operations performed by debugger. The "In-Process
  31692. Agent", a shared library, is running within the same process with
  31693. inferior, and is able to perform some debugging operations itself. As a
  31694. result, debugger is only involved when necessary, and performance of
  31695. debugging can be improved accordingly. Note that interference with
  31696. program can be reduced but can't be removed completely, because the
  31697. in-process agent will still stop or slow down the program.
  31698. The in-process agent can interpret and execute Agent Expressions
  31699. (*note Agent Expressions::) during performing debugging operations. The
  31700. agent expressions can be used for different purposes, such as collecting
  31701. data in tracepoints, and condition evaluation in breakpoints.
  31702. You can control whether the in-process agent is used as an aid for
  31703. debugging with the following commands:
  31704. 'set agent on'
  31705. Causes the in-process agent to perform some operations on behalf of
  31706. the debugger. Just which operations requested by the user will be
  31707. done by the in-process agent depends on the its capabilities. For
  31708. example, if you request to evaluate breakpoint conditions in the
  31709. in-process agent, and the in-process agent has such capability as
  31710. well, then breakpoint conditions will be evaluated in the
  31711. in-process agent.
  31712. 'set agent off'
  31713. Disables execution of debugging operations by the in-process agent.
  31714. All of the operations will be performed by GDB.
  31715. 'show agent'
  31716. Display the current setting of execution of debugging operations by
  31717. the in-process agent.
  31718. * Menu:
  31719. * In-Process Agent Protocol::
  31720. 
  31721. File: gdb.info, Node: In-Process Agent Protocol, Up: In-Process Agent
  31722. 30.1 In-Process Agent Protocol
  31723. ==============================
  31724. The in-process agent is able to communicate with both GDB and GDBserver
  31725. (*note In-Process Agent::). This section documents the protocol used
  31726. for communications between GDB or GDBserver and the IPA. In general, GDB
  31727. or GDBserver sends commands (*note IPA Protocol Commands::) and data to
  31728. in-process agent, and then in-process agent replies back with the return
  31729. result of the command, or some other information. The data sent to
  31730. in-process agent is composed of primitive data types, such as 4-byte or
  31731. 8-byte type, and composite types, which are called objects (*note IPA
  31732. Protocol Objects::).
  31733. * Menu:
  31734. * IPA Protocol Objects::
  31735. * IPA Protocol Commands::
  31736. 
  31737. File: gdb.info, Node: IPA Protocol Objects, Next: IPA Protocol Commands, Up: In-Process Agent Protocol
  31738. 30.1.1 IPA Protocol Objects
  31739. ---------------------------
  31740. The commands sent to and results received from agent may contain some
  31741. complex data types called "objects".
  31742. The in-process agent is running on the same machine with GDB or
  31743. GDBserver, so it doesn't have to handle as much differences between two
  31744. ends as remote protocol (*note Remote Protocol::) tries to handle.
  31745. However, there are still some differences of two ends in two processes:
  31746. 1. word size. On some 64-bit machines, GDB or GDBserver can be
  31747. compiled as a 64-bit executable, while in-process agent is a 32-bit
  31748. one.
  31749. 2. ABI. Some machines may have multiple types of ABI, GDB or GDBserver
  31750. is compiled with one, and in-process agent is compiled with the
  31751. other one.
  31752. Here are the IPA Protocol Objects:
  31753. 1. agent expression object. It represents an agent expression (*note
  31754. Agent Expressions::).
  31755. 2. tracepoint action object. It represents a tracepoint action (*note
  31756. Tracepoint Action Lists: Tracepoint Actions.) to collect registers,
  31757. memory, static trace data and to evaluate expression.
  31758. 3. tracepoint object. It represents a tracepoint (*note
  31759. Tracepoints::).
  31760. The following table describes important attributes of each IPA
  31761. protocol object:
  31762. Name Size Description
  31763. ---------------------------------------------------------------------------
  31764. _agent expression
  31765. object_
  31766. length 4 length of bytes code
  31767. byte code LENGTH contents of byte code
  31768. _tracepoint action
  31769. for collecting
  31770. memory_
  31771. 'M' 1 type of tracepoint action
  31772. addr 8 if BASEREG is '-1', ADDR is the
  31773. address of the lowest byte to
  31774. collect, otherwise ADDR is the
  31775. offset of BASEREG for memory
  31776. collecting.
  31777. len 8 length of memory for collecting
  31778. basereg 4 the register number containing the
  31779. starting memory address for
  31780. collecting.
  31781. _tracepoint action
  31782. for collecting
  31783. registers_
  31784. 'R' 1 type of tracepoint action
  31785. _tracepoint action
  31786. for collecting
  31787. static trace data_
  31788. 'L' 1 type of tracepoint action
  31789. _tracepoint action
  31790. for expression
  31791. evaluation_
  31792. 'X' 1 type of tracepoint action
  31793. agent expression length of *note agent expression object::
  31794. _tracepoint object_
  31795. number 4 number of tracepoint
  31796. address 8 address of tracepoint inserted on
  31797. type 4 type of tracepoint
  31798. enabled 1 enable or disable of tracepoint
  31799. step_count 8 step
  31800. pass_count 8 pass
  31801. numactions 4 number of tracepoint actions
  31802. hit count 8 hit count
  31803. trace frame usage 8 trace frame usage
  31804. compiled_cond 8 compiled condition
  31805. orig_size 8 orig size
  31806. condition 4 if zero if condition is NULL,
  31807. condition is otherwise is
  31808. NULL *note agent expression object::
  31809. otherwise
  31810. length of
  31811. *note agent expression object::
  31812. actions variable numactions number of
  31813. *note tracepoint action object::
  31814. 
  31815. File: gdb.info, Node: IPA Protocol Commands, Prev: IPA Protocol Objects, Up: In-Process Agent Protocol
  31816. 30.1.2 IPA Protocol Commands
  31817. ----------------------------
  31818. The spaces in each command are delimiters to ease reading this commands
  31819. specification. They don't exist in real commands.
  31820. 'FastTrace:TRACEPOINT_OBJECT GDB_JUMP_PAD_HEAD'
  31821. Installs a new fast tracepoint described by TRACEPOINT_OBJECT
  31822. (*note tracepoint object::). The GDB_JUMP_PAD_HEAD, 8-byte long,
  31823. is the head of "jumppad", which is used to jump to data collection
  31824. routine in IPA finally.
  31825. Replies:
  31826. 'OK TARGET_ADDRESS GDB_JUMP_PAD_HEAD FJUMP_SIZE FJUMP'
  31827. TARGET_ADDRESS is address of tracepoint in the inferior. The
  31828. GDB_JUMP_PAD_HEAD is updated head of jumppad. Both of
  31829. TARGET_ADDRESS and GDB_JUMP_PAD_HEAD are 8-byte long. The
  31830. FJUMP contains a sequence of instructions jump to jumppad
  31831. entry. The FJUMP_SIZE, 4-byte long, is the size of FJUMP.
  31832. 'E NN'
  31833. for an error
  31834. 'close'
  31835. Closes the in-process agent. This command is sent when GDB or
  31836. GDBserver is about to kill inferiors.
  31837. 'qTfSTM'
  31838. *Note qTfSTM::.
  31839. 'qTsSTM'
  31840. *Note qTsSTM::.
  31841. 'qTSTMat'
  31842. *Note qTSTMat::.
  31843. 'probe_marker_at:ADDRESS'
  31844. Asks in-process agent to probe the marker at ADDRESS.
  31845. Replies:
  31846. 'E NN'
  31847. for an error
  31848. 'unprobe_marker_at:ADDRESS'
  31849. Asks in-process agent to unprobe the marker at ADDRESS.
  31850. 
  31851. File: gdb.info, Node: GDB Bugs, Next: Command Line Editing, Prev: In-Process Agent, Up: Top
  31852. 31 Reporting Bugs in GDB
  31853. ************************
  31854. Your bug reports play an essential role in making GDB reliable.
  31855. Reporting a bug may help you by bringing a solution to your problem,
  31856. or it may not. But in any case the principal function of a bug report
  31857. is to help the entire community by making the next version of GDB work
  31858. better. Bug reports are your contribution to the maintenance of GDB.
  31859. In order for a bug report to serve its purpose, you must include the
  31860. information that enables us to fix the bug.
  31861. * Menu:
  31862. * Bug Criteria:: Have you found a bug?
  31863. * Bug Reporting:: How to report bugs
  31864. 
  31865. File: gdb.info, Node: Bug Criteria, Next: Bug Reporting, Up: GDB Bugs
  31866. 31.1 Have You Found a Bug?
  31867. ==========================
  31868. If you are not sure whether you have found a bug, here are some
  31869. guidelines:
  31870. * If the debugger gets a fatal signal, for any input whatever, that
  31871. is a GDB bug. Reliable debuggers never crash.
  31872. * If GDB produces an error message for valid input, that is a bug.
  31873. (Note that if you're cross debugging, the problem may also be
  31874. somewhere in the connection to the target.)
  31875. * If GDB does not produce an error message for invalid input, that is
  31876. a bug. However, you should note that your idea of "invalid input"
  31877. might be our idea of "an extension" or "support for traditional
  31878. practice".
  31879. * If you are an experienced user of debugging tools, your suggestions
  31880. for improvement of GDB are welcome in any case.
  31881. 
  31882. File: gdb.info, Node: Bug Reporting, Prev: Bug Criteria, Up: GDB Bugs
  31883. 31.2 How to Report Bugs
  31884. =======================
  31885. A number of companies and individuals offer support for GNU products.
  31886. If you obtained GDB from a support organization, we recommend you
  31887. contact that organization first.
  31888. You can find contact information for many support companies and
  31889. individuals in the file 'etc/SERVICE' in the GNU Emacs distribution.
  31890. In any event, we also recommend that you submit bug reports for GDB
  31891. to <https://www.gnu.org/software/gdb/bugs/>.
  31892. The fundamental principle of reporting bugs usefully is this: *report
  31893. all the facts*. If you are not sure whether to state a fact or leave it
  31894. out, state it!
  31895. Often people omit facts because they think they know what causes the
  31896. problem and assume that some details do not matter. Thus, you might
  31897. assume that the name of the variable you use in an example does not
  31898. matter. Well, probably it does not, but one cannot be sure. Perhaps
  31899. the bug is a stray memory reference which happens to fetch from the
  31900. location where that name is stored in memory; perhaps, if the name were
  31901. different, the contents of that location would fool the debugger into
  31902. doing the right thing despite the bug. Play it safe and give a
  31903. specific, complete example. That is the easiest thing for you to do,
  31904. and the most helpful.
  31905. Keep in mind that the purpose of a bug report is to enable us to fix
  31906. the bug. It may be that the bug has been reported previously, but
  31907. neither you nor we can know that unless your bug report is complete and
  31908. self-contained.
  31909. Sometimes people give a few sketchy facts and ask, "Does this ring a
  31910. bell?" Those bug reports are useless, and we urge everyone to _refuse
  31911. to respond to them_ except to chide the sender to report bugs properly.
  31912. To enable us to fix the bug, you should include all these things:
  31913. * The version of GDB. GDB announces it if you start with no
  31914. arguments; you can also print it at any time using 'show version'.
  31915. Without this, we will not know whether there is any point in
  31916. looking for the bug in the current version of GDB.
  31917. * The type of machine you are using, and the operating system name
  31918. and version number.
  31919. * The details of the GDB build-time configuration. GDB shows these
  31920. details if you invoke it with the '--configuration' command-line
  31921. option, or if you type 'show configuration' at GDB's prompt.
  31922. * What compiler (and its version) was used to compile GDB--e.g.
  31923. "gcc-2.8.1".
  31924. * What compiler (and its version) was used to compile the program you
  31925. are debugging--e.g. "gcc-2.8.1", or "HP92453-01 A.10.32.03 HP C
  31926. Compiler". For GCC, you can say 'gcc --version' to get this
  31927. information; for other compilers, see the documentation for those
  31928. compilers.
  31929. * The command arguments you gave the compiler to compile your example
  31930. and observe the bug. For example, did you use '-O'? To guarantee
  31931. you will not omit something important, list them all. A copy of
  31932. the Makefile (or the output from make) is sufficient.
  31933. If we were to try to guess the arguments, we would probably guess
  31934. wrong and then we might not encounter the bug.
  31935. * A complete input script, and all necessary source files, that will
  31936. reproduce the bug.
  31937. * A description of what behavior you observe that you believe is
  31938. incorrect. For example, "It gets a fatal signal."
  31939. Of course, if the bug is that GDB gets a fatal signal, then we will
  31940. certainly notice it. But if the bug is incorrect output, we might
  31941. not notice unless it is glaringly wrong. You might as well not
  31942. give us a chance to make a mistake.
  31943. Even if the problem you experience is a fatal signal, you should
  31944. still say so explicitly. Suppose something strange is going on,
  31945. such as, your copy of GDB is out of synch, or you have encountered
  31946. a bug in the C library on your system. (This has happened!) Your
  31947. copy might crash and ours would not. If you told us to expect a
  31948. crash, then when ours fails to crash, we would know that the bug
  31949. was not happening for us. If you had not told us to expect a
  31950. crash, then we would not be able to draw any conclusion from our
  31951. observations.
  31952. To collect all this information, you can use a session recording
  31953. program such as 'script', which is available on many Unix systems.
  31954. Just run your GDB session inside 'script' and then include the
  31955. 'typescript' file with your bug report.
  31956. Another way to record a GDB session is to run GDB inside Emacs and
  31957. then save the entire buffer to a file.
  31958. * If you wish to suggest changes to the GDB source, send us context
  31959. diffs. If you even discuss something in the GDB source, refer to
  31960. it by context, not by line number.
  31961. The line numbers in our development sources will not match those in
  31962. your sources. Your line numbers would convey no useful information
  31963. to us.
  31964. Here are some things that are not necessary:
  31965. * A description of the envelope of the bug.
  31966. Often people who encounter a bug spend a lot of time investigating
  31967. which changes to the input file will make the bug go away and which
  31968. changes will not affect it.
  31969. This is often time consuming and not very useful, because the way
  31970. we will find the bug is by running a single example under the
  31971. debugger with breakpoints, not by pure deduction from a series of
  31972. examples. We recommend that you save your time for something else.
  31973. Of course, if you can find a simpler example to report _instead_ of
  31974. the original one, that is a convenience for us. Errors in the
  31975. output will be easier to spot, running under the debugger will take
  31976. less time, and so on.
  31977. However, simplification is not vital; if you do not want to do
  31978. this, report the bug anyway and send us the entire test case you
  31979. used.
  31980. * A patch for the bug.
  31981. A patch for the bug does help us if it is a good one. But do not
  31982. omit the necessary information, such as the test case, on the
  31983. assumption that a patch is all we need. We might see problems with
  31984. your patch and decide to fix the problem another way, or we might
  31985. not understand it at all.
  31986. Sometimes with a program as complicated as GDB it is very hard to
  31987. construct an example that will make the program follow a certain
  31988. path through the code. If you do not send us the example, we will
  31989. not be able to construct one, so we will not be able to verify that
  31990. the bug is fixed.
  31991. And if we cannot understand what bug you are trying to fix, or why
  31992. your patch should be an improvement, we will not install it. A
  31993. test case will help us to understand.
  31994. * A guess about what the bug is or what it depends on.
  31995. Such guesses are usually wrong. Even we cannot guess right about
  31996. such things without first using the debugger to find the facts.
  31997. 
  31998. File: gdb.info, Node: Command Line Editing, Next: Using History Interactively, Prev: GDB Bugs, Up: Top
  31999. 32 Command Line Editing
  32000. ***********************
  32001. This chapter describes the basic features of the GNU command line
  32002. editing interface.
  32003. * Menu:
  32004. * Introduction and Notation:: Notation used in this text.
  32005. * Readline Interaction:: The minimum set of commands for editing a line.
  32006. * Readline Init File:: Customizing Readline from a user's view.
  32007. * Bindable Readline Commands:: A description of most of the Readline commands
  32008. available for binding
  32009. * Readline vi Mode:: A short description of how to make Readline
  32010. behave like the vi editor.
  32011. 
  32012. File: gdb.info, Node: Introduction and Notation, Next: Readline Interaction, Up: Command Line Editing
  32013. 32.1 Introduction to Line Editing
  32014. =================================
  32015. The following paragraphs describe the notation used to represent
  32016. keystrokes.
  32017. The text 'C-k' is read as 'Control-K' and describes the character
  32018. produced when the <k> key is pressed while the Control key is depressed.
  32019. The text 'M-k' is read as 'Meta-K' and describes the character
  32020. produced when the Meta key (if you have one) is depressed, and the <k>
  32021. key is pressed. The Meta key is labeled <ALT> on many keyboards. On
  32022. keyboards with two keys labeled <ALT> (usually to either side of the
  32023. space bar), the <ALT> on the left side is generally set to work as a
  32024. Meta key. The <ALT> key on the right may also be configured to work as
  32025. a Meta key or may be configured as some other modifier, such as a
  32026. Compose key for typing accented characters.
  32027. If you do not have a Meta or <ALT> key, or another key working as a
  32028. Meta key, the identical keystroke can be generated by typing <ESC>
  32029. _first_, and then typing <k>. Either process is known as "metafying"
  32030. the <k> key.
  32031. The text 'M-C-k' is read as 'Meta-Control-k' and describes the
  32032. character produced by "metafying" 'C-k'.
  32033. In addition, several keys have their own names. Specifically, <DEL>,
  32034. <ESC>, <LFD>, <SPC>, <RET>, and <TAB> all stand for themselves when seen
  32035. in this text, or in an init file (*note Readline Init File::). If your
  32036. keyboard lacks a <LFD> key, typing <C-j> will produce the desired
  32037. character. The <RET> key may be labeled <Return> or <Enter> on some
  32038. keyboards.
  32039. 
  32040. File: gdb.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing
  32041. 32.2 Readline Interaction
  32042. =========================
  32043. Often during an interactive session you type in a long line of text,
  32044. only to notice that the first word on the line is misspelled. The
  32045. Readline library gives you a set of commands for manipulating the text
  32046. as you type it in, allowing you to just fix your typo, and not forcing
  32047. you to retype the majority of the line. Using these editing commands,
  32048. you move the cursor to the place that needs correction, and delete or
  32049. insert the text of the corrections. Then, when you are satisfied with
  32050. the line, you simply press <RET>. You do not have to be at the end of
  32051. the line to press <RET>; the entire line is accepted regardless of the
  32052. location of the cursor within the line.
  32053. * Menu:
  32054. * Readline Bare Essentials:: The least you need to know about Readline.
  32055. * Readline Movement Commands:: Moving about the input line.
  32056. * Readline Killing Commands:: How to delete text, and how to get it back!
  32057. * Readline Arguments:: Giving numeric arguments to commands.
  32058. * Searching:: Searching through previous lines.
  32059. 
  32060. File: gdb.info, Node: Readline Bare Essentials, Next: Readline Movement Commands, Up: Readline Interaction
  32061. 32.2.1 Readline Bare Essentials
  32062. -------------------------------
  32063. In order to enter characters into the line, simply type them. The typed
  32064. character appears where the cursor was, and then the cursor moves one
  32065. space to the right. If you mistype a character, you can use your erase
  32066. character to back up and delete the mistyped character.
  32067. Sometimes you may mistype a character, and not notice the error until
  32068. you have typed several other characters. In that case, you can type
  32069. 'C-b' to move the cursor to the left, and then correct your mistake.
  32070. Afterwards, you can move the cursor to the right with 'C-f'.
  32071. When you add text in the middle of a line, you will notice that
  32072. characters to the right of the cursor are 'pushed over' to make room for
  32073. the text that you have inserted. Likewise, when you delete text behind
  32074. the cursor, characters to the right of the cursor are 'pulled back' to
  32075. fill in the blank space created by the removal of the text. A list of
  32076. the bare essentials for editing the text of an input line follows.
  32077. 'C-b'
  32078. Move back one character.
  32079. 'C-f'
  32080. Move forward one character.
  32081. <DEL> or <Backspace>
  32082. Delete the character to the left of the cursor.
  32083. 'C-d'
  32084. Delete the character underneath the cursor.
  32085. Printing characters
  32086. Insert the character into the line at the cursor.
  32087. 'C-_' or 'C-x C-u'
  32088. Undo the last editing command. You can undo all the way back to an
  32089. empty line.
  32090. (Depending on your configuration, the <Backspace> key be set to delete
  32091. the character to the left of the cursor and the <DEL> key set to delete
  32092. the character underneath the cursor, like 'C-d', rather than the
  32093. character to the left of the cursor.)
  32094. 
  32095. File: gdb.info, Node: Readline Movement Commands, Next: Readline Killing Commands, Prev: Readline Bare Essentials, Up: Readline Interaction
  32096. 32.2.2 Readline Movement Commands
  32097. ---------------------------------
  32098. The above table describes the most basic keystrokes that you need in
  32099. order to do editing of the input line. For your convenience, many other
  32100. commands have been added in addition to 'C-b', 'C-f', 'C-d', and <DEL>.
  32101. Here are some commands for moving more rapidly about the line.
  32102. 'C-a'
  32103. Move to the start of the line.
  32104. 'C-e'
  32105. Move to the end of the line.
  32106. 'M-f'
  32107. Move forward a word, where a word is composed of letters and
  32108. digits.
  32109. 'M-b'
  32110. Move backward a word.
  32111. 'C-l'
  32112. Clear the screen, reprinting the current line at the top.
  32113. Notice how 'C-f' moves forward a character, while 'M-f' moves forward
  32114. a word. It is a loose convention that control keystrokes operate on
  32115. characters while meta keystrokes operate on words.
  32116. 
  32117. File: gdb.info, Node: Readline Killing Commands, Next: Readline Arguments, Prev: Readline Movement Commands, Up: Readline Interaction
  32118. 32.2.3 Readline Killing Commands
  32119. --------------------------------
  32120. "Killing" text means to delete the text from the line, but to save it
  32121. away for later use, usually by "yanking" (re-inserting) it back into the
  32122. line. ('Cut' and 'paste' are more recent jargon for 'kill' and 'yank'.)
  32123. If the description for a command says that it 'kills' text, then you
  32124. can be sure that you can get the text back in a different (or the same)
  32125. place later.
  32126. When you use a kill command, the text is saved in a "kill-ring". Any
  32127. number of consecutive kills save all of the killed text together, so
  32128. that when you yank it back, you get it all. The kill ring is not line
  32129. specific; the text that you killed on a previously typed line is
  32130. available to be yanked back later, when you are typing another line.
  32131. Here is the list of commands for killing text.
  32132. 'C-k'
  32133. Kill the text from the current cursor position to the end of the
  32134. line.
  32135. 'M-d'
  32136. Kill from the cursor to the end of the current word, or, if between
  32137. words, to the end of the next word. Word boundaries are the same
  32138. as those used by 'M-f'.
  32139. 'M-<DEL>'
  32140. Kill from the cursor the start of the current word, or, if between
  32141. words, to the start of the previous word. Word boundaries are the
  32142. same as those used by 'M-b'.
  32143. 'C-w'
  32144. Kill from the cursor to the previous whitespace. This is different
  32145. than 'M-<DEL>' because the word boundaries differ.
  32146. Here is how to "yank" the text back into the line. Yanking means to
  32147. copy the most-recently-killed text from the kill buffer.
  32148. 'C-y'
  32149. Yank the most recently killed text back into the buffer at the
  32150. cursor.
  32151. 'M-y'
  32152. Rotate the kill-ring, and yank the new top. You can only do this
  32153. if the prior command is 'C-y' or 'M-y'.
  32154. 
  32155. File: gdb.info, Node: Readline Arguments, Next: Searching, Prev: Readline Killing Commands, Up: Readline Interaction
  32156. 32.2.4 Readline Arguments
  32157. -------------------------
  32158. You can pass numeric arguments to Readline commands. Sometimes the
  32159. argument acts as a repeat count, other times it is the sign of the
  32160. argument that is significant. If you pass a negative argument to a
  32161. command which normally acts in a forward direction, that command will
  32162. act in a backward direction. For example, to kill text back to the
  32163. start of the line, you might type 'M-- C-k'.
  32164. The general way to pass numeric arguments to a command is to type
  32165. meta digits before the command. If the first 'digit' typed is a minus
  32166. sign ('-'), then the sign of the argument will be negative. Once you
  32167. have typed one meta digit to get the argument started, you can type the
  32168. remainder of the digits, and then the command. For example, to give the
  32169. 'C-d' command an argument of 10, you could type 'M-1 0 C-d', which will
  32170. delete the next ten characters on the input line.
  32171. 
  32172. File: gdb.info, Node: Searching, Prev: Readline Arguments, Up: Readline Interaction
  32173. 32.2.5 Searching for Commands in the History
  32174. --------------------------------------------
  32175. Readline provides commands for searching through the command history for
  32176. lines containing a specified string. There are two search modes:
  32177. "incremental" and "non-incremental".
  32178. Incremental searches begin before the user has finished typing the
  32179. search string. As each character of the search string is typed,
  32180. Readline displays the next entry from the history matching the string
  32181. typed so far. An incremental search requires only as many characters as
  32182. needed to find the desired history entry. To search backward in the
  32183. history for a particular string, type 'C-r'. Typing 'C-s' searches
  32184. forward through the history. The characters present in the value of the
  32185. 'isearch-terminators' variable are used to terminate an incremental
  32186. search. If that variable has not been assigned a value, the <ESC> and
  32187. 'C-J' characters will terminate an incremental search. 'C-g' will abort
  32188. an incremental search and restore the original line. When the search is
  32189. terminated, the history entry containing the search string becomes the
  32190. current line.
  32191. To find other matching entries in the history list, type 'C-r' or
  32192. 'C-s' as appropriate. This will search backward or forward in the
  32193. history for the next entry matching the search string typed so far. Any
  32194. other key sequence bound to a Readline command will terminate the search
  32195. and execute that command. For instance, a <RET> will terminate the
  32196. search and accept the line, thereby executing the command from the
  32197. history list. A movement command will terminate the search, make the
  32198. last line found the current line, and begin editing.
  32199. Readline remembers the last incremental search string. If two 'C-r's
  32200. are typed without any intervening characters defining a new search
  32201. string, any remembered search string is used.
  32202. Non-incremental searches read the entire search string before
  32203. starting to search for matching history lines. The search string may be
  32204. typed by the user or be part of the contents of the current line.
  32205. 
  32206. File: gdb.info, Node: Readline Init File, Next: Bindable Readline Commands, Prev: Readline Interaction, Up: Command Line Editing
  32207. 32.3 Readline Init File
  32208. =======================
  32209. Although the Readline library comes with a set of Emacs-like keybindings
  32210. installed by default, it is possible to use a different set of
  32211. keybindings. Any user can customize programs that use Readline by
  32212. putting commands in an "inputrc" file, conventionally in his home
  32213. directory. The name of this file is taken from the value of the
  32214. environment variable 'INPUTRC'. If that variable is unset, the default
  32215. is '~/.inputrc'. If that file does not exist or cannot be read, the
  32216. ultimate default is '/etc/inputrc'.
  32217. When a program which uses the Readline library starts up, the init
  32218. file is read, and the key bindings are set.
  32219. In addition, the 'C-x C-r' command re-reads this init file, thus
  32220. incorporating any changes that you might have made to it.
  32221. * Menu:
  32222. * Readline Init File Syntax:: Syntax for the commands in the inputrc file.
  32223. * Conditional Init Constructs:: Conditional key bindings in the inputrc file.
  32224. * Sample Init File:: An example inputrc file.
  32225. 
  32226. File: gdb.info, Node: Readline Init File Syntax, Next: Conditional Init Constructs, Up: Readline Init File
  32227. 32.3.1 Readline Init File Syntax
  32228. --------------------------------
  32229. There are only a few basic constructs allowed in the Readline init file.
  32230. Blank lines are ignored. Lines beginning with a '#' are comments.
  32231. Lines beginning with a '$' indicate conditional constructs (*note
  32232. Conditional Init Constructs::). Other lines denote variable settings
  32233. and key bindings.
  32234. Variable Settings
  32235. You can modify the run-time behavior of Readline by altering the
  32236. values of variables in Readline using the 'set' command within the
  32237. init file. The syntax is simple:
  32238. set VARIABLE VALUE
  32239. Here, for example, is how to change from the default Emacs-like key
  32240. binding to use 'vi' line editing commands:
  32241. set editing-mode vi
  32242. Variable names and values, where appropriate, are recognized
  32243. without regard to case. Unrecognized variable names are ignored.
  32244. Boolean variables (those that can be set to on or off) are set to
  32245. on if the value is null or empty, ON (case-insensitive), or 1. Any
  32246. other value results in the variable being set to off.
  32247. A great deal of run-time behavior is changeable with the following
  32248. variables.
  32249. 'bell-style'
  32250. Controls what happens when Readline wants to ring the terminal
  32251. bell. If set to 'none', Readline never rings the bell. If
  32252. set to 'visible', Readline uses a visible bell if one is
  32253. available. If set to 'audible' (the default), Readline
  32254. attempts to ring the terminal's bell.
  32255. 'bind-tty-special-chars'
  32256. If set to 'on' (the default), Readline attempts to bind the
  32257. control characters treated specially by the kernel's terminal
  32258. driver to their Readline equivalents.
  32259. 'blink-matching-paren'
  32260. If set to 'on', Readline attempts to briefly move the cursor
  32261. to an opening parenthesis when a closing parenthesis is
  32262. inserted. The default is 'off'.
  32263. 'colored-completion-prefix'
  32264. If set to 'on', when listing completions, Readline displays
  32265. the common prefix of the set of possible completions using a
  32266. different color. The color definitions are taken from the
  32267. value of the 'LS_COLORS' environment variable. The default is
  32268. 'off'.
  32269. 'colored-stats'
  32270. If set to 'on', Readline displays possible completions using
  32271. different colors to indicate their file type. The color
  32272. definitions are taken from the value of the 'LS_COLORS'
  32273. environment variable. The default is 'off'.
  32274. 'comment-begin'
  32275. The string to insert at the beginning of the line when the
  32276. 'insert-comment' command is executed. The default value is
  32277. '"#"'.
  32278. 'completion-display-width'
  32279. The number of screen columns used to display possible matches
  32280. when performing completion. The value is ignored if it is
  32281. less than 0 or greater than the terminal screen width. A
  32282. value of 0 will cause matches to be displayed one per line.
  32283. The default value is -1.
  32284. 'completion-ignore-case'
  32285. If set to 'on', Readline performs filename matching and
  32286. completion in a case-insensitive fashion. The default value
  32287. is 'off'.
  32288. 'completion-map-case'
  32289. If set to 'on', and COMPLETION-IGNORE-CASE is enabled,
  32290. Readline treats hyphens ('-') and underscores ('_') as
  32291. equivalent when performing case-insensitive filename matching
  32292. and completion. The default value is 'off'.
  32293. 'completion-prefix-display-length'
  32294. The length in characters of the common prefix of a list of
  32295. possible completions that is displayed without modification.
  32296. When set to a value greater than zero, common prefixes longer
  32297. than this value are replaced with an ellipsis when displaying
  32298. possible completions.
  32299. 'completion-query-items'
  32300. The number of possible completions that determines when the
  32301. user is asked whether the list of possibilities should be
  32302. displayed. If the number of possible completions is greater
  32303. than this value, Readline will ask the user whether or not he
  32304. wishes to view them; otherwise, they are simply listed. This
  32305. variable must be set to an integer value greater than or equal
  32306. to 0. A negative value means Readline should never ask. The
  32307. default limit is '100'.
  32308. 'convert-meta'
  32309. If set to 'on', Readline will convert characters with the
  32310. eighth bit set to an ASCII key sequence by stripping the
  32311. eighth bit and prefixing an <ESC> character, converting them
  32312. to a meta-prefixed key sequence. The default value is 'on',
  32313. but will be set to 'off' if the locale is one that contains
  32314. eight-bit characters.
  32315. 'disable-completion'
  32316. If set to 'On', Readline will inhibit word completion.
  32317. Completion characters will be inserted into the line as if
  32318. they had been mapped to 'self-insert'. The default is 'off'.
  32319. 'echo-control-characters'
  32320. When set to 'on', on operating systems that indicate they
  32321. support it, readline echoes a character corresponding to a
  32322. signal generated from the keyboard. The default is 'on'.
  32323. 'editing-mode'
  32324. The 'editing-mode' variable controls which default set of key
  32325. bindings is used. By default, Readline starts up in Emacs
  32326. editing mode, where the keystrokes are most similar to Emacs.
  32327. This variable can be set to either 'emacs' or 'vi'.
  32328. 'emacs-mode-string'
  32329. If the SHOW-MODE-IN-PROMPT variable is enabled, this string is
  32330. displayed immediately before the last line of the primary
  32331. prompt when emacs editing mode is active. The value is
  32332. expanded like a key binding, so the standard set of meta- and
  32333. control prefixes and backslash escape sequences is available.
  32334. Use the '\1' and '\2' escapes to begin and end sequences of
  32335. non-printing characters, which can be used to embed a terminal
  32336. control sequence into the mode string. The default is '@'.
  32337. 'enable-bracketed-paste'
  32338. When set to 'On', Readline will configure the terminal in a
  32339. way that will enable it to insert each paste into the editing
  32340. buffer as a single string of characters, instead of treating
  32341. each character as if it had been read from the keyboard. This
  32342. can prevent pasted characters from being interpreted as
  32343. editing commands. The default is 'off'.
  32344. 'enable-keypad'
  32345. When set to 'on', Readline will try to enable the application
  32346. keypad when it is called. Some systems need this to enable
  32347. the arrow keys. The default is 'off'.
  32348. 'enable-meta-key'
  32349. When set to 'on', Readline will try to enable any meta
  32350. modifier key the terminal claims to support when it is called.
  32351. On many terminals, the meta key is used to send eight-bit
  32352. characters. The default is 'on'.
  32353. 'expand-tilde'
  32354. If set to 'on', tilde expansion is performed when Readline
  32355. attempts word completion. The default is 'off'.
  32356. 'history-preserve-point'
  32357. If set to 'on', the history code attempts to place the point
  32358. (the current cursor position) at the same location on each
  32359. history line retrieved with 'previous-history' or
  32360. 'next-history'. The default is 'off'.
  32361. 'history-size'
  32362. Set the maximum number of history entries saved in the history
  32363. list. If set to zero, any existing history entries are
  32364. deleted and no new entries are saved. If set to a value less
  32365. than zero, the number of history entries is not limited. By
  32366. default, the number of history entries is not limited. If an
  32367. attempt is made to set HISTORY-SIZE to a non-numeric value,
  32368. the maximum number of history entries will be set to 500.
  32369. 'horizontal-scroll-mode'
  32370. This variable can be set to either 'on' or 'off'. Setting it
  32371. to 'on' means that the text of the lines being edited will
  32372. scroll horizontally on a single screen line when they are
  32373. longer than the width of the screen, instead of wrapping onto
  32374. a new screen line. By default, this variable is set to 'off'.
  32375. 'input-meta'
  32376. If set to 'on', Readline will enable eight-bit input (it will
  32377. not clear the eighth bit in the characters it reads),
  32378. regardless of what the terminal claims it can support. The
  32379. default value is 'off', but Readline will set it to 'on' if
  32380. the locale contains eight-bit characters. The name
  32381. 'meta-flag' is a synonym for this variable.
  32382. 'isearch-terminators'
  32383. The string of characters that should terminate an incremental
  32384. search without subsequently executing the character as a
  32385. command (*note Searching::). If this variable has not been
  32386. given a value, the characters <ESC> and 'C-J' will terminate
  32387. an incremental search.
  32388. 'keymap'
  32389. Sets Readline's idea of the current keymap for key binding
  32390. commands. Built-in 'keymap' names are 'emacs',
  32391. 'emacs-standard', 'emacs-meta', 'emacs-ctlx', 'vi', 'vi-move',
  32392. 'vi-command', and 'vi-insert'. 'vi' is equivalent to
  32393. 'vi-command' ('vi-move' is also a synonym); 'emacs' is
  32394. equivalent to 'emacs-standard'. Applications may add
  32395. additional names. The default value is 'emacs'. The value of
  32396. the 'editing-mode' variable also affects the default keymap.
  32397. 'keyseq-timeout'
  32398. Specifies the duration Readline will wait for a character when
  32399. reading an ambiguous key sequence (one that can form a
  32400. complete key sequence using the input read so far, or can take
  32401. additional input to complete a longer key sequence). If no
  32402. input is received within the timeout, Readline will use the
  32403. shorter but complete key sequence. Readline uses this value
  32404. to determine whether or not input is available on the current
  32405. input source ('rl_instream' by default). The value is
  32406. specified in milliseconds, so a value of 1000 means that
  32407. Readline will wait one second for additional input. If this
  32408. variable is set to a value less than or equal to zero, or to a
  32409. non-numeric value, Readline will wait until another key is
  32410. pressed to decide which key sequence to complete. The default
  32411. value is '500'.
  32412. 'mark-directories'
  32413. If set to 'on', completed directory names have a slash
  32414. appended. The default is 'on'.
  32415. 'mark-modified-lines'
  32416. This variable, when set to 'on', causes Readline to display an
  32417. asterisk ('*') at the start of history lines which have been
  32418. modified. This variable is 'off' by default.
  32419. 'mark-symlinked-directories'
  32420. If set to 'on', completed names which are symbolic links to
  32421. directories have a slash appended (subject to the value of
  32422. 'mark-directories'). The default is 'off'.
  32423. 'match-hidden-files'
  32424. This variable, when set to 'on', causes Readline to match
  32425. files whose names begin with a '.' (hidden files) when
  32426. performing filename completion. If set to 'off', the leading
  32427. '.' must be supplied by the user in the filename to be
  32428. completed. This variable is 'on' by default.
  32429. 'menu-complete-display-prefix'
  32430. If set to 'on', menu completion displays the common prefix of
  32431. the list of possible completions (which may be empty) before
  32432. cycling through the list. The default is 'off'.
  32433. 'output-meta'
  32434. If set to 'on', Readline will display characters with the
  32435. eighth bit set directly rather than as a meta-prefixed escape
  32436. sequence. The default is 'off', but Readline will set it to
  32437. 'on' if the locale contains eight-bit characters.
  32438. 'page-completions'
  32439. If set to 'on', Readline uses an internal 'more'-like pager to
  32440. display a screenful of possible completions at a time. This
  32441. variable is 'on' by default.
  32442. 'print-completions-horizontally'
  32443. If set to 'on', Readline will display completions with matches
  32444. sorted horizontally in alphabetical order, rather than down
  32445. the screen. The default is 'off'.
  32446. 'revert-all-at-newline'
  32447. If set to 'on', Readline will undo all changes to history
  32448. lines before returning when 'accept-line' is executed. By
  32449. default, history lines may be modified and retain individual
  32450. undo lists across calls to 'readline'. The default is 'off'.
  32451. 'show-all-if-ambiguous'
  32452. This alters the default behavior of the completion functions.
  32453. If set to 'on', words which have more than one possible
  32454. completion cause the matches to be listed immediately instead
  32455. of ringing the bell. The default value is 'off'.
  32456. 'show-all-if-unmodified'
  32457. This alters the default behavior of the completion functions
  32458. in a fashion similar to SHOW-ALL-IF-AMBIGUOUS. If set to
  32459. 'on', words which have more than one possible completion
  32460. without any possible partial completion (the possible
  32461. completions don't share a common prefix) cause the matches to
  32462. be listed immediately instead of ringing the bell. The
  32463. default value is 'off'.
  32464. 'show-mode-in-prompt'
  32465. If set to 'on', add a string to the beginning of the prompt
  32466. indicating the editing mode: emacs, vi command, or vi
  32467. insertion. The mode strings are user-settable (e.g.,
  32468. EMACS-MODE-STRING). The default value is 'off'.
  32469. 'skip-completed-text'
  32470. If set to 'on', this alters the default completion behavior
  32471. when inserting a single match into the line. It's only active
  32472. when performing completion in the middle of a word. If
  32473. enabled, readline does not insert characters from the
  32474. completion that match characters after point in the word being
  32475. completed, so portions of the word following the cursor are
  32476. not duplicated. For instance, if this is enabled, attempting
  32477. completion when the cursor is after the 'e' in 'Makefile' will
  32478. result in 'Makefile' rather than 'Makefilefile', assuming
  32479. there is a single possible completion. The default value is
  32480. 'off'.
  32481. 'vi-cmd-mode-string'
  32482. If the SHOW-MODE-IN-PROMPT variable is enabled, this string is
  32483. displayed immediately before the last line of the primary
  32484. prompt when vi editing mode is active and in command mode.
  32485. The value is expanded like a key binding, so the standard set
  32486. of meta- and control prefixes and backslash escape sequences
  32487. is available. Use the '\1' and '\2' escapes to begin and end
  32488. sequences of non-printing characters, which can be used to
  32489. embed a terminal control sequence into the mode string. The
  32490. default is '(cmd)'.
  32491. 'vi-ins-mode-string'
  32492. If the SHOW-MODE-IN-PROMPT variable is enabled, this string is
  32493. displayed immediately before the last line of the primary
  32494. prompt when vi editing mode is active and in insertion mode.
  32495. The value is expanded like a key binding, so the standard set
  32496. of meta- and control prefixes and backslash escape sequences
  32497. is available. Use the '\1' and '\2' escapes to begin and end
  32498. sequences of non-printing characters, which can be used to
  32499. embed a terminal control sequence into the mode string. The
  32500. default is '(ins)'.
  32501. 'visible-stats'
  32502. If set to 'on', a character denoting a file's type is appended
  32503. to the filename when listing possible completions. The
  32504. default is 'off'.
  32505. Key Bindings
  32506. The syntax for controlling key bindings in the init file is simple.
  32507. First you need to find the name of the command that you want to
  32508. change. The following sections contain tables of the command name,
  32509. the default keybinding, if any, and a short description of what the
  32510. command does.
  32511. Once you know the name of the command, simply place on a line in
  32512. the init file the name of the key you wish to bind the command to,
  32513. a colon, and then the name of the command. There can be no space
  32514. between the key name and the colon - that will be interpreted as
  32515. part of the key name. The name of the key can be expressed in
  32516. different ways, depending on what you find most comfortable.
  32517. In addition to command names, readline allows keys to be bound to a
  32518. string that is inserted when the key is pressed (a MACRO).
  32519. KEYNAME: FUNCTION-NAME or MACRO
  32520. KEYNAME is the name of a key spelled out in English. For
  32521. example:
  32522. Control-u: universal-argument
  32523. Meta-Rubout: backward-kill-word
  32524. Control-o: "> output"
  32525. In the example above, 'C-u' is bound to the function
  32526. 'universal-argument', 'M-DEL' is bound to the function
  32527. 'backward-kill-word', and 'C-o' is bound to run the macro
  32528. expressed on the right hand side (that is, to insert the text
  32529. '> output' into the line).
  32530. A number of symbolic character names are recognized while
  32531. processing this key binding syntax: DEL, ESC, ESCAPE, LFD,
  32532. NEWLINE, RET, RETURN, RUBOUT, SPACE, SPC, and TAB.
  32533. "KEYSEQ": FUNCTION-NAME or MACRO
  32534. KEYSEQ differs from KEYNAME above in that strings denoting an
  32535. entire key sequence can be specified, by placing the key
  32536. sequence in double quotes. Some GNU Emacs style key escapes
  32537. can be used, as in the following example, but the special
  32538. character names are not recognized.
  32539. "\C-u": universal-argument
  32540. "\C-x\C-r": re-read-init-file
  32541. "\e[11~": "Function Key 1"
  32542. In the above example, 'C-u' is again bound to the function
  32543. 'universal-argument' (just as it was in the first example),
  32544. ''C-x' 'C-r'' is bound to the function 're-read-init-file',
  32545. and '<ESC> <[> <1> <1> <~>' is bound to insert the text
  32546. 'Function Key 1'.
  32547. The following GNU Emacs style escape sequences are available when
  32548. specifying key sequences:
  32549. '\C-'
  32550. control prefix
  32551. '\M-'
  32552. meta prefix
  32553. '\e'
  32554. an escape character
  32555. '\\'
  32556. backslash
  32557. '\"'
  32558. <">, a double quotation mark
  32559. '\''
  32560. <'>, a single quote or apostrophe
  32561. In addition to the GNU Emacs style escape sequences, a second set
  32562. of backslash escapes is available:
  32563. '\a'
  32564. alert (bell)
  32565. '\b'
  32566. backspace
  32567. '\d'
  32568. delete
  32569. '\f'
  32570. form feed
  32571. '\n'
  32572. newline
  32573. '\r'
  32574. carriage return
  32575. '\t'
  32576. horizontal tab
  32577. '\v'
  32578. vertical tab
  32579. '\NNN'
  32580. the eight-bit character whose value is the octal value NNN
  32581. (one to three digits)
  32582. '\xHH'
  32583. the eight-bit character whose value is the hexadecimal value
  32584. HH (one or two hex digits)
  32585. When entering the text of a macro, single or double quotes must be
  32586. used to indicate a macro definition. Unquoted text is assumed to
  32587. be a function name. In the macro body, the backslash escapes
  32588. described above are expanded. Backslash will quote any other
  32589. character in the macro text, including '"' and '''. For example,
  32590. the following binding will make ''C-x' \' insert a single '\' into
  32591. the line:
  32592. "\C-x\\": "\\"
  32593. 
  32594. File: gdb.info, Node: Conditional Init Constructs, Next: Sample Init File, Prev: Readline Init File Syntax, Up: Readline Init File
  32595. 32.3.2 Conditional Init Constructs
  32596. ----------------------------------
  32597. Readline implements a facility similar in spirit to the conditional
  32598. compilation features of the C preprocessor which allows key bindings and
  32599. variable settings to be performed as the result of tests. There are
  32600. four parser directives used.
  32601. '$if'
  32602. The '$if' construct allows bindings to be made based on the editing
  32603. mode, the terminal being used, or the application using Readline.
  32604. The text of the test, after any comparison operator, extends to the
  32605. end of the line; unless otherwise noted, no characters are required
  32606. to isolate it.
  32607. 'mode'
  32608. The 'mode=' form of the '$if' directive is used to test
  32609. whether Readline is in 'emacs' or 'vi' mode. This may be used
  32610. in conjunction with the 'set keymap' command, for instance, to
  32611. set bindings in the 'emacs-standard' and 'emacs-ctlx' keymaps
  32612. only if Readline is starting out in 'emacs' mode.
  32613. 'term'
  32614. The 'term=' form may be used to include terminal-specific key
  32615. bindings, perhaps to bind the key sequences output by the
  32616. terminal's function keys. The word on the right side of the
  32617. '=' is tested against both the full name of the terminal and
  32618. the portion of the terminal name before the first '-'. This
  32619. allows 'sun' to match both 'sun' and 'sun-cmd', for instance.
  32620. 'version'
  32621. The 'version' test may be used to perform comparisons against
  32622. specific Readline versions. The 'version' expands to the
  32623. current Readline version. The set of comparison operators
  32624. includes '=' (and '=='), '!=', '<=', '>=', '<', and '>'. The
  32625. version number supplied on the right side of the operator
  32626. consists of a major version number, an optional decimal point,
  32627. and an optional minor version (e.g., '7.1'). If the minor
  32628. version is omitted, it is assumed to be '0'. The operator may
  32629. be separated from the string 'version' and from the version
  32630. number argument by whitespace. The following example sets a
  32631. variable if the Readline version being used is 7.0 or newer:
  32632. $if version >= 7.0
  32633. set show-mode-in-prompt on
  32634. $endif
  32635. 'application'
  32636. The APPLICATION construct is used to include
  32637. application-specific settings. Each program using the
  32638. Readline library sets the APPLICATION NAME, and you can test
  32639. for a particular value. This could be used to bind key
  32640. sequences to functions useful for a specific program. For
  32641. instance, the following command adds a key sequence that
  32642. quotes the current or previous word in Bash:
  32643. $if Bash
  32644. # Quote the current or previous word
  32645. "\C-xq": "\eb\"\ef\""
  32646. $endif
  32647. 'variable'
  32648. The VARIABLE construct provides simple equality tests for
  32649. Readline variables and values. The permitted comparison
  32650. operators are '=', '==', and '!='. The variable name must be
  32651. separated from the comparison operator by whitespace; the
  32652. operator may be separated from the value on the right hand
  32653. side by whitespace. Both string and boolean variables may be
  32654. tested. Boolean variables must be tested against the values
  32655. ON and OFF. The following example is equivalent to the
  32656. 'mode=emacs' test described above:
  32657. $if editing-mode == emacs
  32658. set show-mode-in-prompt on
  32659. $endif
  32660. '$endif'
  32661. This command, as seen in the previous example, terminates an '$if'
  32662. command.
  32663. '$else'
  32664. Commands in this branch of the '$if' directive are executed if the
  32665. test fails.
  32666. '$include'
  32667. This directive takes a single filename as an argument and reads
  32668. commands and bindings from that file. For example, the following
  32669. directive reads from '/etc/inputrc':
  32670. $include /etc/inputrc
  32671. 
  32672. File: gdb.info, Node: Sample Init File, Prev: Conditional Init Constructs, Up: Readline Init File
  32673. 32.3.3 Sample Init File
  32674. -----------------------
  32675. Here is an example of an INPUTRC file. This illustrates key binding,
  32676. variable assignment, and conditional syntax.
  32677. # This file controls the behaviour of line input editing for
  32678. # programs that use the GNU Readline library. Existing
  32679. # programs include FTP, Bash, and GDB.
  32680. #
  32681. # You can re-read the inputrc file with C-x C-r.
  32682. # Lines beginning with '#' are comments.
  32683. #
  32684. # First, include any system-wide bindings and variable
  32685. # assignments from /etc/Inputrc
  32686. $include /etc/Inputrc
  32687. #
  32688. # Set various bindings for emacs mode.
  32689. set editing-mode emacs
  32690. $if mode=emacs
  32691. Meta-Control-h: backward-kill-word Text after the function name is ignored
  32692. #
  32693. # Arrow keys in keypad mode
  32694. #
  32695. #"\M-OD": backward-char
  32696. #"\M-OC": forward-char
  32697. #"\M-OA": previous-history
  32698. #"\M-OB": next-history
  32699. #
  32700. # Arrow keys in ANSI mode
  32701. #
  32702. "\M-[D": backward-char
  32703. "\M-[C": forward-char
  32704. "\M-[A": previous-history
  32705. "\M-[B": next-history
  32706. #
  32707. # Arrow keys in 8 bit keypad mode
  32708. #
  32709. #"\M-\C-OD": backward-char
  32710. #"\M-\C-OC": forward-char
  32711. #"\M-\C-OA": previous-history
  32712. #"\M-\C-OB": next-history
  32713. #
  32714. # Arrow keys in 8 bit ANSI mode
  32715. #
  32716. #"\M-\C-[D": backward-char
  32717. #"\M-\C-[C": forward-char
  32718. #"\M-\C-[A": previous-history
  32719. #"\M-\C-[B": next-history
  32720. C-q: quoted-insert
  32721. $endif
  32722. # An old-style binding. This happens to be the default.
  32723. TAB: complete
  32724. # Macros that are convenient for shell interaction
  32725. $if Bash
  32726. # edit the path
  32727. "\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f"
  32728. # prepare to type a quoted word --
  32729. # insert open and close double quotes
  32730. # and move to just after the open quote
  32731. "\C-x\"": "\"\"\C-b"
  32732. # insert a backslash (testing backslash escapes
  32733. # in sequences and macros)
  32734. "\C-x\\": "\\"
  32735. # Quote the current or previous word
  32736. "\C-xq": "\eb\"\ef\""
  32737. # Add a binding to refresh the line, which is unbound
  32738. "\C-xr": redraw-current-line
  32739. # Edit variable on current line.
  32740. "\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y="
  32741. $endif
  32742. # use a visible bell if one is available
  32743. set bell-style visible
  32744. # don't strip characters to 7 bits when reading
  32745. set input-meta on
  32746. # allow iso-latin1 characters to be inserted rather
  32747. # than converted to prefix-meta sequences
  32748. set convert-meta off
  32749. # display characters with the eighth bit set directly
  32750. # rather than as meta-prefixed characters
  32751. set output-meta on
  32752. # if there are more than 150 possible completions for
  32753. # a word, ask the user if he wants to see all of them
  32754. set completion-query-items 150
  32755. # For FTP
  32756. $if Ftp
  32757. "\C-xg": "get \M-?"
  32758. "\C-xt": "put \M-?"
  32759. "\M-.": yank-last-arg
  32760. $endif
  32761. 
  32762. File: gdb.info, Node: Bindable Readline Commands, Next: Readline vi Mode, Prev: Readline Init File, Up: Command Line Editing
  32763. 32.4 Bindable Readline Commands
  32764. ===============================
  32765. * Menu:
  32766. * Commands For Moving:: Moving about the line.
  32767. * Commands For History:: Getting at previous lines.
  32768. * Commands For Text:: Commands for changing text.
  32769. * Commands For Killing:: Commands for killing and yanking.
  32770. * Numeric Arguments:: Specifying numeric arguments, repeat counts.
  32771. * Commands For Completion:: Getting Readline to do the typing for you.
  32772. * Keyboard Macros:: Saving and re-executing typed characters
  32773. * Miscellaneous Commands:: Other miscellaneous commands.
  32774. This section describes Readline commands that may be bound to key
  32775. sequences. Command names without an accompanying key sequence are
  32776. unbound by default.
  32777. In the following descriptions, "point" refers to the current cursor
  32778. position, and "mark" refers to a cursor position saved by the 'set-mark'
  32779. command. The text between the point and mark is referred to as the
  32780. "region".
  32781. 
  32782. File: gdb.info, Node: Commands For Moving, Next: Commands For History, Up: Bindable Readline Commands
  32783. 32.4.1 Commands For Moving
  32784. --------------------------
  32785. 'beginning-of-line (C-a)'
  32786. Move to the start of the current line.
  32787. 'end-of-line (C-e)'
  32788. Move to the end of the line.
  32789. 'forward-char (C-f)'
  32790. Move forward a character.
  32791. 'backward-char (C-b)'
  32792. Move back a character.
  32793. 'forward-word (M-f)'
  32794. Move forward to the end of the next word. Words are composed of
  32795. letters and digits.
  32796. 'backward-word (M-b)'
  32797. Move back to the start of the current or previous word. Words are
  32798. composed of letters and digits.
  32799. 'previous-screen-line ()'
  32800. Attempt to move point to the same physical screen column on the
  32801. previous physical screen line. This will not have the desired
  32802. effect if the current Readline line does not take up more than one
  32803. physical line or if point is not greater than the length of the
  32804. prompt plus the screen width.
  32805. 'next-screen-line ()'
  32806. Attempt to move point to the same physical screen column on the
  32807. next physical screen line. This will not have the desired effect
  32808. if the current Readline line does not take up more than one
  32809. physical line or if the length of the current Readline line is not
  32810. greater than the length of the prompt plus the screen width.
  32811. 'clear-screen (C-l)'
  32812. Clear the screen and redraw the current line, leaving the current
  32813. line at the top of the screen.
  32814. 'redraw-current-line ()'
  32815. Refresh the current line. By default, this is unbound.
  32816. 
  32817. File: gdb.info, Node: Commands For History, Next: Commands For Text, Prev: Commands For Moving, Up: Bindable Readline Commands
  32818. 32.4.2 Commands For Manipulating The History
  32819. --------------------------------------------
  32820. 'accept-line (Newline or Return)'
  32821. Accept the line regardless of where the cursor is. If this line is
  32822. non-empty, it may be added to the history list for future recall
  32823. with 'add_history()'. If this line is a modified history line, the
  32824. history line is restored to its original state.
  32825. 'previous-history (C-p)'
  32826. Move 'back' through the history list, fetching the previous
  32827. command.
  32828. 'next-history (C-n)'
  32829. Move 'forward' through the history list, fetching the next command.
  32830. 'beginning-of-history (M-<)'
  32831. Move to the first line in the history.
  32832. 'end-of-history (M->)'
  32833. Move to the end of the input history, i.e., the line currently
  32834. being entered.
  32835. 'reverse-search-history (C-r)'
  32836. Search backward starting at the current line and moving 'up'
  32837. through the history as necessary. This is an incremental search.
  32838. 'forward-search-history (C-s)'
  32839. Search forward starting at the current line and moving 'down'
  32840. through the history as necessary. This is an incremental search.
  32841. 'non-incremental-reverse-search-history (M-p)'
  32842. Search backward starting at the current line and moving 'up'
  32843. through the history as necessary using a non-incremental search for
  32844. a string supplied by the user. The search string may match
  32845. anywhere in a history line.
  32846. 'non-incremental-forward-search-history (M-n)'
  32847. Search forward starting at the current line and moving 'down'
  32848. through the history as necessary using a non-incremental search for
  32849. a string supplied by the user. The search string may match
  32850. anywhere in a history line.
  32851. 'history-search-forward ()'
  32852. Search forward through the history for the string of characters
  32853. between the start of the current line and the point. The search
  32854. string must match at the beginning of a history line. This is a
  32855. non-incremental search. By default, this command is unbound.
  32856. 'history-search-backward ()'
  32857. Search backward through the history for the string of characters
  32858. between the start of the current line and the point. The search
  32859. string must match at the beginning of a history line. This is a
  32860. non-incremental search. By default, this command is unbound.
  32861. 'history-substring-search-forward ()'
  32862. Search forward through the history for the string of characters
  32863. between the start of the current line and the point. The search
  32864. string may match anywhere in a history line. This is a
  32865. non-incremental search. By default, this command is unbound.
  32866. 'history-substring-search-backward ()'
  32867. Search backward through the history for the string of characters
  32868. between the start of the current line and the point. The search
  32869. string may match anywhere in a history line. This is a
  32870. non-incremental search. By default, this command is unbound.
  32871. 'yank-nth-arg (M-C-y)'
  32872. Insert the first argument to the previous command (usually the
  32873. second word on the previous line) at point. With an argument N,
  32874. insert the Nth word from the previous command (the words in the
  32875. previous command begin with word 0). A negative argument inserts
  32876. the Nth word from the end of the previous command. Once the
  32877. argument N is computed, the argument is extracted as if the '!N'
  32878. history expansion had been specified.
  32879. 'yank-last-arg (M-. or M-_)'
  32880. Insert last argument to the previous command (the last word of the
  32881. previous history entry). With a numeric argument, behave exactly
  32882. like 'yank-nth-arg'. Successive calls to 'yank-last-arg' move back
  32883. through the history list, inserting the last word (or the word
  32884. specified by the argument to the first call) of each line in turn.
  32885. Any numeric argument supplied to these successive calls determines
  32886. the direction to move through the history. A negative argument
  32887. switches the direction through the history (back or forward). The
  32888. history expansion facilities are used to extract the last argument,
  32889. as if the '!$' history expansion had been specified.
  32890. 
  32891. File: gdb.info, Node: Commands For Text, Next: Commands For Killing, Prev: Commands For History, Up: Bindable Readline Commands
  32892. 32.4.3 Commands For Changing Text
  32893. ---------------------------------
  32894. 'end-of-file (usually C-d)'
  32895. The character indicating end-of-file as set, for example, by
  32896. 'stty'. If this character is read when there are no characters on
  32897. the line, and point is at the beginning of the line, Readline
  32898. interprets it as the end of input and returns EOF.
  32899. 'delete-char (C-d)'
  32900. Delete the character at point. If this function is bound to the
  32901. same character as the tty EOF character, as 'C-d' commonly is, see
  32902. above for the effects.
  32903. 'backward-delete-char (Rubout)'
  32904. Delete the character behind the cursor. A numeric argument means
  32905. to kill the characters instead of deleting them.
  32906. 'forward-backward-delete-char ()'
  32907. Delete the character under the cursor, unless the cursor is at the
  32908. end of the line, in which case the character behind the cursor is
  32909. deleted. By default, this is not bound to a key.
  32910. 'quoted-insert (C-q or C-v)'
  32911. Add the next character typed to the line verbatim. This is how to
  32912. insert key sequences like 'C-q', for example.
  32913. 'tab-insert (M-<TAB>)'
  32914. Insert a tab character.
  32915. 'self-insert (a, b, A, 1, !, ...)'
  32916. Insert yourself.
  32917. 'bracketed-paste-begin ()'
  32918. This function is intended to be bound to the "bracketed paste"
  32919. escape sequence sent by some terminals, and such a binding is
  32920. assigned by default. It allows Readline to insert the pasted text
  32921. as a single unit without treating each character as if it had been
  32922. read from the keyboard. The characters are inserted as if each one
  32923. was bound to 'self-insert' instead of executing any editing
  32924. commands.
  32925. 'transpose-chars (C-t)'
  32926. Drag the character before the cursor forward over the character at
  32927. the cursor, moving the cursor forward as well. If the insertion
  32928. point is at the end of the line, then this transposes the last two
  32929. characters of the line. Negative arguments have no effect.
  32930. 'transpose-words (M-t)'
  32931. Drag the word before point past the word after point, moving point
  32932. past that word as well. If the insertion point is at the end of
  32933. the line, this transposes the last two words on the line.
  32934. 'upcase-word (M-u)'
  32935. Uppercase the current (or following) word. With a negative
  32936. argument, uppercase the previous word, but do not move the cursor.
  32937. 'downcase-word (M-l)'
  32938. Lowercase the current (or following) word. With a negative
  32939. argument, lowercase the previous word, but do not move the cursor.
  32940. 'capitalize-word (M-c)'
  32941. Capitalize the current (or following) word. With a negative
  32942. argument, capitalize the previous word, but do not move the cursor.
  32943. 'overwrite-mode ()'
  32944. Toggle overwrite mode. With an explicit positive numeric argument,
  32945. switches to overwrite mode. With an explicit non-positive numeric
  32946. argument, switches to insert mode. This command affects only
  32947. 'emacs' mode; 'vi' mode does overwrite differently. Each call to
  32948. 'readline()' starts in insert mode.
  32949. In overwrite mode, characters bound to 'self-insert' replace the
  32950. text at point rather than pushing the text to the right.
  32951. Characters bound to 'backward-delete-char' replace the character
  32952. before point with a space.
  32953. By default, this command is unbound.
  32954. 
  32955. File: gdb.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands
  32956. 32.4.4 Killing And Yanking
  32957. --------------------------
  32958. 'kill-line (C-k)'
  32959. Kill the text from point to the end of the line.
  32960. 'backward-kill-line (C-x Rubout)'
  32961. Kill backward from the cursor to the beginning of the current line.
  32962. 'unix-line-discard (C-u)'
  32963. Kill backward from the cursor to the beginning of the current line.
  32964. 'kill-whole-line ()'
  32965. Kill all characters on the current line, no matter where point is.
  32966. By default, this is unbound.
  32967. 'kill-word (M-d)'
  32968. Kill from point to the end of the current word, or if between
  32969. words, to the end of the next word. Word boundaries are the same
  32970. as 'forward-word'.
  32971. 'backward-kill-word (M-<DEL>)'
  32972. Kill the word behind point. Word boundaries are the same as
  32973. 'backward-word'.
  32974. 'unix-word-rubout (C-w)'
  32975. Kill the word behind point, using white space as a word boundary.
  32976. The killed text is saved on the kill-ring.
  32977. 'unix-filename-rubout ()'
  32978. Kill the word behind point, using white space and the slash
  32979. character as the word boundaries. The killed text is saved on the
  32980. kill-ring.
  32981. 'delete-horizontal-space ()'
  32982. Delete all spaces and tabs around point. By default, this is
  32983. unbound.
  32984. 'kill-region ()'
  32985. Kill the text in the current region. By default, this command is
  32986. unbound.
  32987. 'copy-region-as-kill ()'
  32988. Copy the text in the region to the kill buffer, so it can be yanked
  32989. right away. By default, this command is unbound.
  32990. 'copy-backward-word ()'
  32991. Copy the word before point to the kill buffer. The word boundaries
  32992. are the same as 'backward-word'. By default, this command is
  32993. unbound.
  32994. 'copy-forward-word ()'
  32995. Copy the word following point to the kill buffer. The word
  32996. boundaries are the same as 'forward-word'. By default, this
  32997. command is unbound.
  32998. 'yank (C-y)'
  32999. Yank the top of the kill ring into the buffer at point.
  33000. 'yank-pop (M-y)'
  33001. Rotate the kill-ring, and yank the new top. You can only do this
  33002. if the prior command is 'yank' or 'yank-pop'.
  33003. 
  33004. File: gdb.info, Node: Numeric Arguments, Next: Commands For Completion, Prev: Commands For Killing, Up: Bindable Readline Commands
  33005. 32.4.5 Specifying Numeric Arguments
  33006. -----------------------------------
  33007. 'digit-argument (M-0, M-1, ... M--)'
  33008. Add this digit to the argument already accumulating, or start a new
  33009. argument. 'M--' starts a negative argument.
  33010. 'universal-argument ()'
  33011. This is another way to specify an argument. If this command is
  33012. followed by one or more digits, optionally with a leading minus
  33013. sign, those digits define the argument. If the command is followed
  33014. by digits, executing 'universal-argument' again ends the numeric
  33015. argument, but is otherwise ignored. As a special case, if this
  33016. command is immediately followed by a character that is neither a
  33017. digit nor minus sign, the argument count for the next command is
  33018. multiplied by four. The argument count is initially one, so
  33019. executing this function the first time makes the argument count
  33020. four, a second time makes the argument count sixteen, and so on.
  33021. By default, this is not bound to a key.
  33022. 
  33023. File: gdb.info, Node: Commands For Completion, Next: Keyboard Macros, Prev: Numeric Arguments, Up: Bindable Readline Commands
  33024. 32.4.6 Letting Readline Type For You
  33025. ------------------------------------
  33026. 'complete (<TAB>)'
  33027. Attempt to perform completion on the text before point. The actual
  33028. completion performed is application-specific. The default is
  33029. filename completion.
  33030. 'possible-completions (M-?)'
  33031. List the possible completions of the text before point. When
  33032. displaying completions, Readline sets the number of columns used
  33033. for display to the value of 'completion-display-width', the value
  33034. of the environment variable 'COLUMNS', or the screen width, in that
  33035. order.
  33036. 'insert-completions (M-*)'
  33037. Insert all completions of the text before point that would have
  33038. been generated by 'possible-completions'.
  33039. 'menu-complete ()'
  33040. Similar to 'complete', but replaces the word to be completed with a
  33041. single match from the list of possible completions. Repeated
  33042. execution of 'menu-complete' steps through the list of possible
  33043. completions, inserting each match in turn. At the end of the list
  33044. of completions, the bell is rung (subject to the setting of
  33045. 'bell-style') and the original text is restored. An argument of N
  33046. moves N positions forward in the list of matches; a negative
  33047. argument may be used to move backward through the list. This
  33048. command is intended to be bound to <TAB>, but is unbound by
  33049. default.
  33050. 'menu-complete-backward ()'
  33051. Identical to 'menu-complete', but moves backward through the list
  33052. of possible completions, as if 'menu-complete' had been given a
  33053. negative argument.
  33054. 'delete-char-or-list ()'
  33055. Deletes the character under the cursor if not at the beginning or
  33056. end of the line (like 'delete-char'). If at the end of the line,
  33057. behaves identically to 'possible-completions'. This command is
  33058. unbound by default.
  33059. 
  33060. File: gdb.info, Node: Keyboard Macros, Next: Miscellaneous Commands, Prev: Commands For Completion, Up: Bindable Readline Commands
  33061. 32.4.7 Keyboard Macros
  33062. ----------------------
  33063. 'start-kbd-macro (C-x ()'
  33064. Begin saving the characters typed into the current keyboard macro.
  33065. 'end-kbd-macro (C-x ))'
  33066. Stop saving the characters typed into the current keyboard macro
  33067. and save the definition.
  33068. 'call-last-kbd-macro (C-x e)'
  33069. Re-execute the last keyboard macro defined, by making the
  33070. characters in the macro appear as if typed at the keyboard.
  33071. 'print-last-kbd-macro ()'
  33072. Print the last keboard macro defined in a format suitable for the
  33073. INPUTRC file.
  33074. 
  33075. File: gdb.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up: Bindable Readline Commands
  33076. 32.4.8 Some Miscellaneous Commands
  33077. ----------------------------------
  33078. 're-read-init-file (C-x C-r)'
  33079. Read in the contents of the INPUTRC file, and incorporate any
  33080. bindings or variable assignments found there.
  33081. 'abort (C-g)'
  33082. Abort the current editing command and ring the terminal's bell
  33083. (subject to the setting of 'bell-style').
  33084. 'do-lowercase-version (M-A, M-B, M-X, ...)'
  33085. If the metafied character X is upper case, run the command that is
  33086. bound to the corresponding metafied lower case character. The
  33087. behavior is undefined if X is already lower case.
  33088. 'prefix-meta (<ESC>)'
  33089. Metafy the next character typed. This is for keyboards without a
  33090. meta key. Typing '<ESC> f' is equivalent to typing 'M-f'.
  33091. 'undo (C-_ or C-x C-u)'
  33092. Incremental undo, separately remembered for each line.
  33093. 'revert-line (M-r)'
  33094. Undo all changes made to this line. This is like executing the
  33095. 'undo' command enough times to get back to the beginning.
  33096. 'tilde-expand (M-~)'
  33097. Perform tilde expansion on the current word.
  33098. 'set-mark (C-@)'
  33099. Set the mark to the point. If a numeric argument is supplied, the
  33100. mark is set to that position.
  33101. 'exchange-point-and-mark (C-x C-x)'
  33102. Swap the point with the mark. The current cursor position is set
  33103. to the saved position, and the old cursor position is saved as the
  33104. mark.
  33105. 'character-search (C-])'
  33106. A character is read and point is moved to the next occurrence of
  33107. that character. A negative count searches for previous
  33108. occurrences.
  33109. 'character-search-backward (M-C-])'
  33110. A character is read and point is moved to the previous occurrence
  33111. of that character. A negative count searches for subsequent
  33112. occurrences.
  33113. 'skip-csi-sequence ()'
  33114. Read enough characters to consume a multi-key sequence such as
  33115. those defined for keys like Home and End. Such sequences begin
  33116. with a Control Sequence Indicator (CSI), usually ESC-[. If this
  33117. sequence is bound to "\e[", keys producing such sequences will have
  33118. no effect unless explicitly bound to a readline command, instead of
  33119. inserting stray characters into the editing buffer. This is
  33120. unbound by default, but usually bound to ESC-[.
  33121. 'insert-comment (M-#)'
  33122. Without a numeric argument, the value of the 'comment-begin'
  33123. variable is inserted at the beginning of the current line. If a
  33124. numeric argument is supplied, this command acts as a toggle: if the
  33125. characters at the beginning of the line do not match the value of
  33126. 'comment-begin', the value is inserted, otherwise the characters in
  33127. 'comment-begin' are deleted from the beginning of the line. In
  33128. either case, the line is accepted as if a newline had been typed.
  33129. 'dump-functions ()'
  33130. Print all of the functions and their key bindings to the Readline
  33131. output stream. If a numeric argument is supplied, the output is
  33132. formatted in such a way that it can be made part of an INPUTRC
  33133. file. This command is unbound by default.
  33134. 'dump-variables ()'
  33135. Print all of the settable variables and their values to the
  33136. Readline output stream. If a numeric argument is supplied, the
  33137. output is formatted in such a way that it can be made part of an
  33138. INPUTRC file. This command is unbound by default.
  33139. 'dump-macros ()'
  33140. Print all of the Readline key sequences bound to macros and the
  33141. strings they output. If a numeric argument is supplied, the output
  33142. is formatted in such a way that it can be made part of an INPUTRC
  33143. file. This command is unbound by default.
  33144. 'emacs-editing-mode (C-e)'
  33145. When in 'vi' command mode, this causes a switch to 'emacs' editing
  33146. mode.
  33147. 'vi-editing-mode (M-C-j)'
  33148. When in 'emacs' editing mode, this causes a switch to 'vi' editing
  33149. mode.
  33150. 
  33151. File: gdb.info, Node: Readline vi Mode, Prev: Bindable Readline Commands, Up: Command Line Editing
  33152. 32.5 Readline vi Mode
  33153. =====================
  33154. While the Readline library does not have a full set of 'vi' editing
  33155. functions, it does contain enough to allow simple editing of the line.
  33156. The Readline 'vi' mode behaves as specified in the POSIX standard.
  33157. In order to switch interactively between 'emacs' and 'vi' editing
  33158. modes, use the command 'M-C-j' (bound to emacs-editing-mode when in 'vi'
  33159. mode and to vi-editing-mode in 'emacs' mode). The Readline default is
  33160. 'emacs' mode.
  33161. When you enter a line in 'vi' mode, you are already placed in
  33162. 'insertion' mode, as if you had typed an 'i'. Pressing <ESC> switches
  33163. you into 'command' mode, where you can edit the text of the line with
  33164. the standard 'vi' movement keys, move to previous history lines with 'k'
  33165. and subsequent lines with 'j', and so forth.
  33166. 
  33167. File: gdb.info, Node: Using History Interactively, Next: In Memoriam, Prev: Command Line Editing, Up: Top
  33168. 33 Using History Interactively
  33169. ******************************
  33170. This chapter describes how to use the GNU History Library interactively,
  33171. from a user's standpoint. It should be considered a user's guide. For
  33172. information on using the GNU History Library in your own programs, *note
  33173. (history)Programming with GNU History::.
  33174. * Menu:
  33175. * History Interaction:: What it feels like using History as a user.
  33176. 
  33177. File: gdb.info, Node: History Interaction, Up: Using History Interactively
  33178. 33.1 History Expansion
  33179. ======================
  33180. The History library provides a history expansion feature that is similar
  33181. to the history expansion provided by 'csh'. This section describes the
  33182. syntax used to manipulate the history information.
  33183. History expansions introduce words from the history list into the
  33184. input stream, making it easy to repeat commands, insert the arguments to
  33185. a previous command into the current input line, or fix errors in
  33186. previous commands quickly.
  33187. History expansion takes place in two parts. The first is to
  33188. determine which line from the history list should be used during
  33189. substitution. The second is to select portions of that line for
  33190. inclusion into the current one. The line selected from the history is
  33191. called the "event", and the portions of that line that are acted upon
  33192. are called "words". Various "modifiers" are available to manipulate the
  33193. selected words. The line is broken into words in the same fashion that
  33194. Bash does, so that several words surrounded by quotes are considered one
  33195. word. History expansions are introduced by the appearance of the
  33196. history expansion character, which is '!' by default.
  33197. History expansion implements shell-like quoting conventions: a
  33198. backslash can be used to remove the special handling for the next
  33199. character; single quotes enclose verbatim sequences of characters, and
  33200. can be used to inhibit history expansion; and characters enclosed within
  33201. double quotes may be subject to history expansion, since backslash can
  33202. escape the history expansion character, but single quotes may not, since
  33203. they are not treated specially within double quotes.
  33204. * Menu:
  33205. * Event Designators:: How to specify which history line to use.
  33206. * Word Designators:: Specifying which words are of interest.
  33207. * Modifiers:: Modifying the results of substitution.
  33208. 
  33209. File: gdb.info, Node: Event Designators, Next: Word Designators, Up: History Interaction
  33210. 33.1.1 Event Designators
  33211. ------------------------
  33212. An event designator is a reference to a command line entry in the
  33213. history list. Unless the reference is absolute, events are relative to
  33214. the current position in the history list.
  33215. '!'
  33216. Start a history substitution, except when followed by a space, tab,
  33217. the end of the line, or '='.
  33218. '!N'
  33219. Refer to command line N.
  33220. '!-N'
  33221. Refer to the command N lines back.
  33222. '!!'
  33223. Refer to the previous command. This is a synonym for '!-1'.
  33224. '!STRING'
  33225. Refer to the most recent command preceding the current position in
  33226. the history list starting with STRING.
  33227. '!?STRING[?]'
  33228. Refer to the most recent command preceding the current position in
  33229. the history list containing STRING. The trailing '?' may be
  33230. omitted if the STRING is followed immediately by a newline.
  33231. '^STRING1^STRING2^'
  33232. Quick Substitution. Repeat the last command, replacing STRING1
  33233. with STRING2. Equivalent to '!!:s/STRING1/STRING2/'.
  33234. '!#'
  33235. The entire command line typed so far.
  33236. 
  33237. File: gdb.info, Node: Word Designators, Next: Modifiers, Prev: Event Designators, Up: History Interaction
  33238. 33.1.2 Word Designators
  33239. -----------------------
  33240. Word designators are used to select desired words from the event. A ':'
  33241. separates the event specification from the word designator. It may be
  33242. omitted if the word designator begins with a '^', '$', '*', '-', or '%'.
  33243. Words are numbered from the beginning of the line, with the first word
  33244. being denoted by 0 (zero). Words are inserted into the current line
  33245. separated by single spaces.
  33246. For example,
  33247. '!!'
  33248. designates the preceding command. When you type this, the
  33249. preceding command is repeated in toto.
  33250. '!!:$'
  33251. designates the last argument of the preceding command. This may be
  33252. shortened to '!$'.
  33253. '!fi:2'
  33254. designates the second argument of the most recent command starting
  33255. with the letters 'fi'.
  33256. Here are the word designators:
  33257. '0 (zero)'
  33258. The '0'th word. For many applications, this is the command word.
  33259. 'N'
  33260. The Nth word.
  33261. '^'
  33262. The first argument; that is, word 1.
  33263. '$'
  33264. The last argument.
  33265. '%'
  33266. The word matched by the most recent '?STRING?' search.
  33267. 'X-Y'
  33268. A range of words; '-Y' abbreviates '0-Y'.
  33269. '*'
  33270. All of the words, except the '0'th. This is a synonym for '1-$'.
  33271. It is not an error to use '*' if there is just one word in the
  33272. event; the empty string is returned in that case.
  33273. 'X*'
  33274. Abbreviates 'X-$'
  33275. 'X-'
  33276. Abbreviates 'X-$' like 'X*', but omits the last word.
  33277. If a word designator is supplied without an event specification, the
  33278. previous command is used as the event.
  33279. 
  33280. File: gdb.info, Node: Modifiers, Prev: Word Designators, Up: History Interaction
  33281. 33.1.3 Modifiers
  33282. ----------------
  33283. After the optional word designator, you can add a sequence of one or
  33284. more of the following modifiers, each preceded by a ':'.
  33285. 'h'
  33286. Remove a trailing pathname component, leaving only the head.
  33287. 't'
  33288. Remove all leading pathname components, leaving the tail.
  33289. 'r'
  33290. Remove a trailing suffix of the form '.SUFFIX', leaving the
  33291. basename.
  33292. 'e'
  33293. Remove all but the trailing suffix.
  33294. 'p'
  33295. Print the new command but do not execute it.
  33296. 's/OLD/NEW/'
  33297. Substitute NEW for the first occurrence of OLD in the event line.
  33298. Any delimiter may be used in place of '/'. The delimiter may be
  33299. quoted in OLD and NEW with a single backslash. If '&' appears in
  33300. NEW, it is replaced by OLD. A single backslash will quote the '&'.
  33301. The final delimiter is optional if it is the last character on the
  33302. input line.
  33303. '&'
  33304. Repeat the previous substitution.
  33305. 'g'
  33306. 'a'
  33307. Cause changes to be applied over the entire event line. Used in
  33308. conjunction with 's', as in 'gs/OLD/NEW/', or with '&'.
  33309. 'G'
  33310. Apply the following 's' modifier once to each word in the event.
  33311. 
  33312. File: gdb.info, Node: In Memoriam, Next: Formatting Documentation, Prev: Using History Interactively, Up: Top
  33313. Appendix A In Memoriam
  33314. **********************
  33315. The GDB project mourns the loss of the following long-time contributors:
  33316. 'Fred Fish'
  33317. Fred was a long-standing contributor to GDB (1991-2006), and to
  33318. Free Software in general. Outside of GDB, he was known in the
  33319. Amiga world for his series of Fish Disks, and the GeekGadget
  33320. project.
  33321. 'Michael Snyder'
  33322. Michael was one of the Global Maintainers of the GDB project, with
  33323. contributions recorded as early as 1996, until 2011. In addition
  33324. to his day to day participation, he was a large driving force
  33325. behind adding Reverse Debugging to GDB.
  33326. Beyond their technical contributions to the project, they were also
  33327. enjoyable members of the Free Software Community. We will miss them.
  33328. 
  33329. File: gdb.info, Node: Formatting Documentation, Next: Installing GDB, Prev: In Memoriam, Up: Top
  33330. Appendix B Formatting Documentation
  33331. ***********************************
  33332. The GDB 4 release includes an already-formatted reference card, ready
  33333. for printing with PostScript or Ghostscript, in the 'gdb' subdirectory
  33334. of the main source directory(1). If you can use PostScript or
  33335. Ghostscript with your printer, you can print the reference card
  33336. immediately with 'refcard.ps'.
  33337. The release also includes the source for the reference card. You can
  33338. format it, using TeX, by typing:
  33339. make refcard.dvi
  33340. The GDB reference card is designed to print in "landscape" mode on US
  33341. "letter" size paper; that is, on a sheet 11 inches wide by 8.5 inches
  33342. high. You will need to specify this form of printing as an option to
  33343. your DVI output program.
  33344. All the documentation for GDB comes as part of the machine-readable
  33345. distribution. The documentation is written in Texinfo format, which is
  33346. a documentation system that uses a single source file to produce both
  33347. on-line information and a printed manual. You can use one of the Info
  33348. formatting commands to create the on-line version of the documentation
  33349. and TeX (or 'texi2roff') to typeset the printed version.
  33350. GDB includes an already formatted copy of the on-line Info version of
  33351. this manual in the 'gdb' subdirectory. The main Info file is
  33352. 'gdb-10.1.90.20201028-git/gdb/gdb.info', and it refers to subordinate
  33353. files matching 'gdb.info*' in the same directory. If necessary, you can
  33354. print out these files, or read them with any editor; but they are easier
  33355. to read using the 'info' subsystem in GNU Emacs or the standalone 'info'
  33356. program, available as part of the GNU Texinfo distribution.
  33357. If you want to format these Info files yourself, you need one of the
  33358. Info formatting programs, such as 'texinfo-format-buffer' or 'makeinfo'.
  33359. If you have 'makeinfo' installed, and are in the top level GDB source
  33360. directory ('gdb-10.1.90.20201028-git', in the case of version
  33361. 10.1.90.20201028-git), you can make the Info file by typing:
  33362. cd gdb
  33363. make gdb.info
  33364. If you want to typeset and print copies of this manual, you need TeX,
  33365. a program to print its DVI output files, and 'texinfo.tex', the Texinfo
  33366. definitions file.
  33367. TeX is a typesetting program; it does not print files directly, but
  33368. produces output files called DVI files. To print a typeset document,
  33369. you need a program to print DVI files. If your system has TeX
  33370. installed, chances are it has such a program. The precise command to
  33371. use depends on your system; 'lpr -d' is common; another (for PostScript
  33372. devices) is 'dvips'. The DVI print command may require a file name
  33373. without any extension or a '.dvi' extension.
  33374. TeX also requires a macro definitions file called 'texinfo.tex'.
  33375. This file tells TeX how to typeset a document written in Texinfo format.
  33376. On its own, TeX cannot either read or typeset a Texinfo file.
  33377. 'texinfo.tex' is distributed with GDB and is located in the
  33378. 'gdb-VERSION-NUMBER/texinfo' directory.
  33379. If you have TeX and a DVI printer program installed, you can typeset
  33380. and print this manual. First switch to the 'gdb' subdirectory of the
  33381. main source directory (for example, to 'gdb-10.1.90.20201028-git/gdb')
  33382. and type:
  33383. make gdb.dvi
  33384. Then give 'gdb.dvi' to your DVI printing program.
  33385. ---------- Footnotes ----------
  33386. (1) In 'gdb-10.1.90.20201028-git/gdb/refcard.ps' of the version
  33387. 10.1.90.20201028-git release.
  33388. 
  33389. File: gdb.info, Node: Installing GDB, Next: Maintenance Commands, Prev: Formatting Documentation, Up: Top
  33390. Appendix C Installing GDB
  33391. *************************
  33392. * Menu:
  33393. * Requirements:: Requirements for building GDB
  33394. * Running Configure:: Invoking the GDB 'configure' script
  33395. * Separate Objdir:: Compiling GDB in another directory
  33396. * Config Names:: Specifying names for hosts and targets
  33397. * Configure Options:: Summary of options for configure
  33398. * System-wide configuration:: Having a system-wide init file
  33399. 
  33400. File: gdb.info, Node: Requirements, Next: Running Configure, Up: Installing GDB
  33401. C.1 Requirements for Building GDB
  33402. =================================
  33403. Building GDB requires various tools and packages to be available. Other
  33404. packages will be used only if they are found.
  33405. Tools/Packages Necessary for Building GDB
  33406. =========================================
  33407. C++11 compiler
  33408. GDB is written in C++11. It should be buildable with any recent
  33409. C++11 compiler, e.g. GCC.
  33410. GNU make
  33411. GDB's build system relies on features only found in the GNU make
  33412. program. Other variants of 'make' will not work.
  33413. Tools/Packages Optional for Building GDB
  33414. ========================================
  33415. Expat
  33416. GDB can use the Expat XML parsing library. This library may be
  33417. included with your operating system distribution; if it is not, you
  33418. can get the latest version from <http://expat.sourceforge.net>.
  33419. The 'configure' script will search for this library in several
  33420. standard locations; if it is installed in an unusual path, you can
  33421. use the '--with-libexpat-prefix' option to specify its location.
  33422. Expat is used for:
  33423. * Remote protocol memory maps (*note Memory Map Format::)
  33424. * Target descriptions (*note Target Descriptions::)
  33425. * Remote shared library lists (*Note Library List Format::, or
  33426. alternatively *note Library List Format for SVR4 Targets::)
  33427. * MS-Windows shared libraries (*note Shared Libraries::)
  33428. * Traceframe info (*note Traceframe Info Format::)
  33429. * Branch trace (*note Branch Trace Format::, *note Branch Trace
  33430. Configuration Format::)
  33431. Guile
  33432. GDB can be scripted using GNU Guile. *Note Guile::. By default,
  33433. GDB will be compiled if the Guile libraries are installed and are
  33434. found by 'configure'. You can use the '--with-guile' option to
  33435. request Guile, and pass either the Guile version number or the file
  33436. name of the relevant 'pkg-config' program to choose a particular
  33437. version of Guile.
  33438. iconv
  33439. GDB's features related to character sets (*note Character Sets::)
  33440. require a functioning 'iconv' implementation. If you are on a GNU
  33441. system, then this is provided by the GNU C Library. Some other
  33442. systems also provide a working 'iconv'.
  33443. If GDB is using the 'iconv' program which is installed in a
  33444. non-standard place, you will need to tell GDB where to find it.
  33445. This is done with '--with-iconv-bin' which specifies the directory
  33446. that contains the 'iconv' program. This program is run in order to
  33447. make a list of the available character sets.
  33448. On systems without 'iconv', you can install GNU Libiconv. If
  33449. Libiconv is installed in a standard place, GDB will automatically
  33450. use it if it is needed. If you have previously installed Libiconv
  33451. in a non-standard place, you can use the '--with-libiconv-prefix'
  33452. option to 'configure'.
  33453. GDB's top-level 'configure' and 'Makefile' will arrange to build
  33454. Libiconv if a directory named 'libiconv' appears in the top-most
  33455. source directory. If Libiconv is built this way, and if the
  33456. operating system does not provide a suitable 'iconv'
  33457. implementation, then the just-built library will automatically be
  33458. used by GDB. One easy way to set this up is to download GNU
  33459. Libiconv, unpack it inside the top-level directory of the GDB
  33460. source tree, and then rename the directory holding the Libiconv
  33461. source code to 'libiconv'.
  33462. lzma
  33463. GDB can support debugging sections that are compressed with the
  33464. LZMA library. *Note MiniDebugInfo::. If this library is not
  33465. included with your operating system, you can find it in the xz
  33466. package at <http://tukaani.org/xz/>. If the LZMA library is
  33467. available in the usual place, then the 'configure' script will use
  33468. it automatically. If it is installed in an unusual path, you can
  33469. use the '--with-lzma-prefix' option to specify its location.
  33470. MPFR
  33471. GDB can use the GNU MPFR multiple-precision floating-point library.
  33472. This library may be included with your operating system
  33473. distribution; if it is not, you can get the latest version from
  33474. <http://www.mpfr.org>. The 'configure' script will search for this
  33475. library in several standard locations; if it is installed in an
  33476. unusual path, you can use the '--with-libmpfr-prefix' option to
  33477. specify its location.
  33478. GNU MPFR is used to emulate target floating-point arithmetic during
  33479. expression evaluation when the target uses different floating-point
  33480. formats than the host. If GNU MPFR it is not available, GDB will
  33481. fall back to using host floating-point arithmetic.
  33482. Python
  33483. GDB can be scripted using Python language. *Note Python::. By
  33484. default, GDB will be compiled if the Python libraries are installed
  33485. and are found by 'configure'. You can use the '--with-python'
  33486. option to request Python, and pass either the file name of the
  33487. relevant 'python' executable, or the name of the directory in which
  33488. Python is installed, to choose a particular installation of Python.
  33489. zlib
  33490. GDB will use the 'zlib' library, if available, to read compressed
  33491. debug sections. Some linkers, such as GNU gold, are capable of
  33492. producing binaries with compressed debug sections. If GDB is
  33493. compiled with 'zlib', it will be able to read the debug information
  33494. in such binaries.
  33495. The 'zlib' library is likely included with your operating system
  33496. distribution; if it is not, you can get the latest version from
  33497. <http://zlib.net>.
  33498. 
  33499. File: gdb.info, Node: Running Configure, Next: Separate Objdir, Prev: Requirements, Up: Installing GDB
  33500. C.2 Invoking the GDB 'configure' Script
  33501. =======================================
  33502. GDB comes with a 'configure' script that automates the process of
  33503. preparing GDB for installation; you can then use 'make' to build the
  33504. 'gdb' program.
  33505. The GDB distribution includes all the source code you need for GDB in
  33506. a single directory, whose name is usually composed by appending the
  33507. version number to 'gdb'.
  33508. For example, the GDB version 10.1.90.20201028-git distribution is in
  33509. the 'gdb-10.1.90.20201028-git' directory. That directory contains:
  33510. 'gdb-10.1.90.20201028-git/configure (and supporting files)'
  33511. script for configuring GDB and all its supporting libraries
  33512. 'gdb-10.1.90.20201028-git/gdb'
  33513. the source specific to GDB itself
  33514. 'gdb-10.1.90.20201028-git/bfd'
  33515. source for the Binary File Descriptor library
  33516. 'gdb-10.1.90.20201028-git/include'
  33517. GNU include files
  33518. 'gdb-10.1.90.20201028-git/libiberty'
  33519. source for the '-liberty' free software library
  33520. 'gdb-10.1.90.20201028-git/opcodes'
  33521. source for the library of opcode tables and disassemblers
  33522. 'gdb-10.1.90.20201028-git/readline'
  33523. source for the GNU command-line interface
  33524. There may be other subdirectories as well.
  33525. The simplest way to configure and build GDB is to run 'configure'
  33526. from the 'gdb-VERSION-NUMBER' source directory, which in this example is
  33527. the 'gdb-10.1.90.20201028-git' directory.
  33528. First switch to the 'gdb-VERSION-NUMBER' source directory if you are
  33529. not already in it; then run 'configure'. Pass the identifier for the
  33530. platform on which GDB will run as an argument.
  33531. For example:
  33532. cd gdb-10.1.90.20201028-git
  33533. ./configure
  33534. make
  33535. Running 'configure' and then running 'make' builds the included
  33536. supporting libraries, then 'gdb' itself. The configured source files,
  33537. and the binaries, are left in the corresponding source directories.
  33538. 'configure' is a Bourne-shell ('/bin/sh') script; if your system does
  33539. not recognize this automatically when you run a different shell, you may
  33540. need to run 'sh' on it explicitly:
  33541. sh configure
  33542. You should run the 'configure' script from the top directory in the
  33543. source tree, the 'gdb-VERSION-NUMBER' directory. If you run 'configure'
  33544. from one of the subdirectories, you will configure only that
  33545. subdirectory. That is usually not what you want. In particular, if you
  33546. run the first 'configure' from the 'gdb' subdirectory of the
  33547. 'gdb-VERSION-NUMBER' directory, you will omit the configuration of
  33548. 'bfd', 'readline', and other sibling directories of the 'gdb'
  33549. subdirectory. This leads to build errors about missing include files
  33550. such as 'bfd/bfd.h'.
  33551. You can install 'GDB' anywhere. The best way to do this is to pass
  33552. the '--prefix' option to 'configure', and then install it with 'make
  33553. install'.
  33554. 
  33555. File: gdb.info, Node: Separate Objdir, Next: Config Names, Prev: Running Configure, Up: Installing GDB
  33556. C.3 Compiling GDB in Another Directory
  33557. ======================================
  33558. If you want to run GDB versions for several host or target machines, you
  33559. need a different 'gdb' compiled for each combination of host and target.
  33560. 'configure' is designed to make this easy by allowing you to generate
  33561. each configuration in a separate subdirectory, rather than in the source
  33562. directory. If your 'make' program handles the 'VPATH' feature (GNU
  33563. 'make' does), running 'make' in each of these directories builds the
  33564. 'gdb' program specified there.
  33565. To build 'gdb' in a separate directory, run 'configure' with the
  33566. '--srcdir' option to specify where to find the source. (You also need
  33567. to specify a path to find 'configure' itself from your working
  33568. directory. If the path to 'configure' would be the same as the argument
  33569. to '--srcdir', you can leave out the '--srcdir' option; it is assumed.)
  33570. For example, with version 10.1.90.20201028-git, you can build GDB in
  33571. a separate directory for a Sun 4 like this:
  33572. cd gdb-10.1.90.20201028-git
  33573. mkdir ../gdb-sun4
  33574. cd ../gdb-sun4
  33575. ../gdb-10.1.90.20201028-git/configure
  33576. make
  33577. When 'configure' builds a configuration using a remote source
  33578. directory, it creates a tree for the binaries with the same structure
  33579. (and using the same names) as the tree under the source directory. In
  33580. the example, you'd find the Sun 4 library 'libiberty.a' in the directory
  33581. 'gdb-sun4/libiberty', and GDB itself in 'gdb-sun4/gdb'.
  33582. Make sure that your path to the 'configure' script has just one
  33583. instance of 'gdb' in it. If your path to 'configure' looks like
  33584. '../gdb-10.1.90.20201028-git/gdb/configure', you are configuring only
  33585. one subdirectory of GDB, not the whole package. This leads to build
  33586. errors about missing include files such as 'bfd/bfd.h'.
  33587. One popular reason to build several GDB configurations in separate
  33588. directories is to configure GDB for cross-compiling (where GDB runs on
  33589. one machine--the "host"--while debugging programs that run on another
  33590. machine--the "target"). You specify a cross-debugging target by giving
  33591. the '--target=TARGET' option to 'configure'.
  33592. When you run 'make' to build a program or library, you must run it in
  33593. a configured directory--whatever directory you were in when you called
  33594. 'configure' (or one of its subdirectories).
  33595. The 'Makefile' that 'configure' generates in each source directory
  33596. also runs recursively. If you type 'make' in a source directory such as
  33597. 'gdb-10.1.90.20201028-git' (or in a separate configured directory
  33598. configured with '--srcdir=DIRNAME/gdb-10.1.90.20201028-git'), you will
  33599. build all the required libraries, and then build GDB.
  33600. When you have multiple hosts or targets configured in separate
  33601. directories, you can run 'make' on them in parallel (for example, if
  33602. they are NFS-mounted on each of the hosts); they will not interfere with
  33603. each other.
  33604. 
  33605. File: gdb.info, Node: Config Names, Next: Configure Options, Prev: Separate Objdir, Up: Installing GDB
  33606. C.4 Specifying Names for Hosts and Targets
  33607. ==========================================
  33608. The specifications used for hosts and targets in the 'configure' script
  33609. are based on a three-part naming scheme, but some short predefined
  33610. aliases are also supported. The full naming scheme encodes three pieces
  33611. of information in the following pattern:
  33612. ARCHITECTURE-VENDOR-OS
  33613. For example, you can use the alias 'sun4' as a HOST argument, or as
  33614. the value for TARGET in a '--target=TARGET' option. The equivalent full
  33615. name is 'sparc-sun-sunos4'.
  33616. The 'configure' script accompanying GDB does not provide any query
  33617. facility to list all supported host and target names or aliases.
  33618. 'configure' calls the Bourne shell script 'config.sub' to map
  33619. abbreviations to full names; you can read the script, if you wish, or
  33620. you can use it to test your guesses on abbreviations--for example:
  33621. % sh config.sub i386-linux
  33622. i386-pc-linux-gnu
  33623. % sh config.sub alpha-linux
  33624. alpha-unknown-linux-gnu
  33625. % sh config.sub hp9k700
  33626. hppa1.1-hp-hpux
  33627. % sh config.sub sun4
  33628. sparc-sun-sunos4.1.1
  33629. % sh config.sub sun3
  33630. m68k-sun-sunos4.1.1
  33631. % sh config.sub i986v
  33632. Invalid configuration `i986v': machine `i986v' not recognized
  33633. 'config.sub' is also distributed in the GDB source directory
  33634. ('gdb-10.1.90.20201028-git', for version 10.1.90.20201028-git).
  33635. 
  33636. File: gdb.info, Node: Configure Options, Next: System-wide configuration, Prev: Config Names, Up: Installing GDB
  33637. C.5 'configure' Options
  33638. =======================
  33639. Here is a summary of the 'configure' options and arguments that are most
  33640. often useful for building GDB. 'configure' also has several other
  33641. options not listed here. *note (autoconf.info)Running configure
  33642. scripts::, for a full explanation of 'configure'.
  33643. configure [--help]
  33644. [--prefix=DIR]
  33645. [--exec-prefix=DIR]
  33646. [--srcdir=DIRNAME]
  33647. [--target=TARGET]
  33648. You may introduce options with a single '-' rather than '--' if you
  33649. prefer; but you may abbreviate option names if you use '--'.
  33650. '--help'
  33651. Display a quick summary of how to invoke 'configure'.
  33652. '--prefix=DIR'
  33653. Configure the source to install programs and files under directory
  33654. 'DIR'.
  33655. '--exec-prefix=DIR'
  33656. Configure the source to install programs under directory 'DIR'.
  33657. '--srcdir=DIRNAME'
  33658. Use this option to make configurations in directories separate from
  33659. the GDB source directories. Among other things, you can use this
  33660. to build (or maintain) several configurations simultaneously, in
  33661. separate directories. 'configure' writes configuration-specific
  33662. files in the current directory, but arranges for them to use the
  33663. source in the directory DIRNAME. 'configure' creates directories
  33664. under the working directory in parallel to the source directories
  33665. below DIRNAME.
  33666. '--target=TARGET'
  33667. Configure GDB for cross-debugging programs running on the specified
  33668. TARGET. Without this option, GDB is configured to debug programs
  33669. that run on the same machine (HOST) as GDB itself.
  33670. There is no convenient way to generate a list of all available
  33671. targets. Also see the '--enable-targets' option, below.
  33672. There are many other options that are specific to GDB. This lists
  33673. just the most common ones; there are some very specialized options not
  33674. described here.
  33675. '--enable-targets=[TARGET]...'
  33676. '--enable-targets=all'
  33677. Configure GDB for cross-debugging programs running on the specified
  33678. list of targets. The special value 'all' configures GDB for
  33679. debugging programs running on any target it supports.
  33680. '--with-gdb-datadir=PATH'
  33681. Set the GDB-specific data directory. GDB will look here for
  33682. certain supporting files or scripts. This defaults to the 'gdb'
  33683. subdirectory of 'datadir' (which can be set using '--datadir').
  33684. '--with-relocated-sources=DIR'
  33685. Sets up the default source path substitution rule so that directory
  33686. names recorded in debug information will be automatically adjusted
  33687. for any directory under DIR. DIR should be a subdirectory of GDB's
  33688. configured prefix, the one mentioned in the '--prefix' or
  33689. '--exec-prefix' options to configure. This option is useful if GDB
  33690. is supposed to be moved to a different place after it is built.
  33691. '--enable-64-bit-bfd'
  33692. Enable 64-bit support in BFD on 32-bit hosts.
  33693. '--disable-gdbmi'
  33694. Build GDB without the GDB/MI machine interface (*note GDB/MI::).
  33695. '--enable-tui'
  33696. Build GDB with the text-mode full-screen user interface (TUI).
  33697. Requires a curses library (ncurses and cursesX are also supported).
  33698. '--with-curses'
  33699. Use the curses library instead of the termcap library, for
  33700. text-mode terminal operations.
  33701. '--with-debuginfod'
  33702. Build GDB with libdebuginfod, the debuginfod client library. Used
  33703. to automatically fetch source files and separate debug files from
  33704. debuginfod servers using the associated executable's build ID.
  33705. Enabled by default if libdebuginfod is installed and found at
  33706. configure time. debuginfod is packaged with elfutils, starting
  33707. with version 0.178. You can get the latest version from
  33708. 'https://sourceware.org/elfutils/'.
  33709. '--with-libunwind-ia64'
  33710. Use the libunwind library for unwinding function call stack on ia64
  33711. target platforms. See http://www.nongnu.org/libunwind/index.html
  33712. for details.
  33713. '--with-system-readline'
  33714. Use the readline library installed on the host, rather than the
  33715. library supplied as part of GDB. Readline 7 or newer is required;
  33716. this is enforced by the build system.
  33717. '--with-system-zlib'
  33718. Use the zlib library installed on the host, rather than the library
  33719. supplied as part of GDB.
  33720. '--with-expat'
  33721. Build GDB with Expat, a library for XML parsing. (Done by default
  33722. if libexpat is installed and found at configure time.) This
  33723. library is used to read XML files supplied with GDB. If it is
  33724. unavailable, some features, such as remote protocol memory maps,
  33725. target descriptions, and shared library lists, that are based on
  33726. XML files, will not be available in GDB. If your host does not
  33727. have libexpat installed, you can get the latest version from
  33728. 'http://expat.sourceforge.net'.
  33729. '--with-libiconv-prefix[=DIR]'
  33730. Build GDB with GNU libiconv, a character set encoding conversion
  33731. library. This is not done by default, as on GNU systems the
  33732. 'iconv' that is built in to the C library is sufficient. If your
  33733. host does not have a working 'iconv', you can get the latest
  33734. version of GNU iconv from 'https://www.gnu.org/software/libiconv/'.
  33735. GDB's build system also supports building GNU libiconv as part of
  33736. the overall build. *Note Requirements::.
  33737. '--with-lzma'
  33738. Build GDB with LZMA, a compression library. (Done by default if
  33739. liblzma is installed and found at configure time.) LZMA is used by
  33740. GDB's "mini debuginfo" feature, which is only useful on platforms
  33741. using the ELF object file format. If your host does not have
  33742. liblzma installed, you can get the latest version from
  33743. 'https://tukaani.org/xz/'.
  33744. '--with-mpfr'
  33745. Build GDB with GNU MPFR, a library for multiple-precision
  33746. floating-point computation with correct rounding. (Done by default
  33747. if GNU MPFR is installed and found at configure time.) This
  33748. library is used to emulate target floating-point arithmetic during
  33749. expression evaluation when the target uses different floating-point
  33750. formats than the host. If GNU MPFR is not available, GDB will fall
  33751. back to using host floating-point arithmetic. If your host does
  33752. not have GNU MPFR installed, you can get the latest version from
  33753. 'http://www.mpfr.org'.
  33754. '--with-python[=PYTHON]'
  33755. Build GDB with Python scripting support. (Done by default if
  33756. libpython is present and found at configure time.) Python makes
  33757. GDB scripting much more powerful than the restricted CLI scripting
  33758. language. If your host does not have Python installed, you can
  33759. find it on 'http://www.python.org/download/'. The oldest version
  33760. of Python supported by GDB is 2.6. The optional argument PYTHON is
  33761. used to find the Python headers and libraries. It can be either
  33762. the name of a Python executable, or the name of the directory in
  33763. which Python is installed.
  33764. '--with-guile[=GUILE]''
  33765. Build GDB with GNU Guile scripting support. (Done by default if
  33766. libguile is present and found at configure time.) If your host
  33767. does not have Guile installed, you can find it at
  33768. 'https://www.gnu.org/software/guile/'. The optional argument GUILE
  33769. can be a version number, which will cause 'configure' to try to use
  33770. that version of Guile; or the file name of a 'pkg-config'
  33771. executable, which will be queried to find the information needed to
  33772. compile and link against Guile.
  33773. '--without-included-regex'
  33774. Don't use the regex library included with GDB (as part of the
  33775. libiberty library). This is the default on hosts with version 2 of
  33776. the GNU C library.
  33777. '--with-sysroot=DIR'
  33778. Use DIR as the default system root directory for libraries whose
  33779. file names begin with '/lib'' or '/usr/lib''. (The value of DIR
  33780. can be modified at run time by using the 'set sysroot' command.)
  33781. If DIR is under the GDB configured prefix (set with '--prefix' or
  33782. '--exec-prefix options', the default system root will be
  33783. automatically adjusted if and when GDB is moved to a different
  33784. location.
  33785. '--with-system-gdbinit=FILE'
  33786. Configure GDB to automatically load a system-wide init file. FILE
  33787. should be an absolute file name. If FILE is in a directory under
  33788. the configured prefix, and GDB is moved to another location after
  33789. being built, the location of the system-wide init file will be
  33790. adjusted accordingly.
  33791. '--with-system-gdbinit-dir=DIRECTORY'
  33792. Configure GDB to automatically load init files from a system-wide
  33793. directory. DIRECTORY should be an absolute directory name. If
  33794. DIRECTORY is in a directory under the configured prefix, and GDB is
  33795. moved to another location after being built, the location of the
  33796. system-wide init directory will be adjusted accordingly.
  33797. '--enable-build-warnings'
  33798. When building the GDB sources, ask the compiler to warn about any
  33799. code which looks even vaguely suspicious. It passes many different
  33800. warning flags, depending on the exact version of the compiler you
  33801. are using.
  33802. '--enable-werror'
  33803. Treat compiler warnings as werrors. It adds the '-Werror' flag to
  33804. the compiler, which will fail the compilation if the compiler
  33805. outputs any warning messages.
  33806. '--enable-ubsan'
  33807. Enable the GCC undefined behavior sanitizer. This is disabled by
  33808. default, but passing '--enable-ubsan=yes' or '--enable-ubsan=auto'
  33809. to 'configure' will enable it. The undefined behavior sanitizer
  33810. checks for C++ undefined behavior. It has a performance cost, so
  33811. if you are looking at GDB's performance, you should disable it.
  33812. The undefined behavior sanitizer was first introduced in GCC 4.9.
  33813. 
  33814. File: gdb.info, Node: System-wide configuration, Prev: Configure Options, Up: Installing GDB
  33815. C.6 System-wide configuration and settings
  33816. ==========================================
  33817. GDB can be configured to have a system-wide init file and a system-wide
  33818. init file directory; this file and files in that directory (if they have
  33819. a recognized file extension) will be read and executed at startup (*note
  33820. What GDB does during startup: Startup.).
  33821. Here are the corresponding configure options:
  33822. '--with-system-gdbinit=FILE'
  33823. Specify that the default location of the system-wide init file is
  33824. FILE.
  33825. '--with-system-gdbinit-dir=DIRECTORY'
  33826. Specify that the default location of the system-wide init file
  33827. directory is DIRECTORY.
  33828. If GDB has been configured with the option '--prefix=$prefix', they
  33829. may be subject to relocation. Two possible cases:
  33830. * If the default location of this init file/directory contains
  33831. '$prefix', it will be subject to relocation. Suppose that the
  33832. configure options are '--prefix=$prefix
  33833. --with-system-gdbinit=$prefix/etc/gdbinit'; if GDB is moved from
  33834. '$prefix' to '$install', the system init file is looked for as
  33835. '$install/etc/gdbinit' instead of '$prefix/etc/gdbinit'.
  33836. * By contrast, if the default location does not contain the prefix,
  33837. it will not be relocated. E.g. if GDB has been configured with
  33838. '--prefix=/usr/local --with-system-gdbinit=/usr/share/gdb/gdbinit',
  33839. then GDB will always look for '/usr/share/gdb/gdbinit', wherever
  33840. GDB is installed.
  33841. If the configured location of the system-wide init file (as given by
  33842. the '--with-system-gdbinit' option at configure time) is in the
  33843. data-directory (as specified by '--with-gdb-datadir' at configure time)
  33844. or in one of its subdirectories, then GDB will look for the system-wide
  33845. init file in the directory specified by the '--data-directory'
  33846. command-line option. Note that the system-wide init file is only read
  33847. once, during GDB initialization. If the data-directory is changed after
  33848. GDB has started with the 'set data-directory' command, the file will not
  33849. be reread.
  33850. This applies similarly to the system-wide directory specified in
  33851. '--with-system-gdbinit-dir'.
  33852. Any supported scripting language can be used for these init files, as
  33853. long as the file extension matches the scripting language. To be
  33854. interpreted as regular GDB commands, the files needs to have a '.gdb'
  33855. extension.
  33856. * Menu:
  33857. * System-wide Configuration Scripts:: Installed System-wide Configuration Scripts
  33858. 
  33859. File: gdb.info, Node: System-wide Configuration Scripts, Up: System-wide configuration
  33860. C.6.1 Installed System-wide Configuration Scripts
  33861. -------------------------------------------------
  33862. The 'system-gdbinit' directory, located inside the data-directory (as
  33863. specified by '--with-gdb-datadir' at configure time) contains a number
  33864. of scripts which can be used as system-wide init files. To
  33865. automatically source those scripts at startup, GDB should be configured
  33866. with '--with-system-gdbinit'. Otherwise, any user should be able to
  33867. source them by hand as needed.
  33868. The following scripts are currently available:
  33869. * 'elinos.py' This script is useful when debugging a program on an
  33870. ELinOS target. It takes advantage of the environment variables
  33871. defined in a standard ELinOS environment in order to determine the
  33872. location of the system shared libraries, and then sets the
  33873. 'solib-absolute-prefix' and 'solib-search-path' variables
  33874. appropriately.
  33875. * 'wrs-linux.py' This script is useful when debugging a program on a
  33876. target running Wind River Linux. It expects the 'ENV_PREFIX' to be
  33877. set to the host-side sysroot used by the target system.
  33878. 
  33879. File: gdb.info, Node: Maintenance Commands, Next: Remote Protocol, Prev: Installing GDB, Up: Top
  33880. Appendix D Maintenance Commands
  33881. *******************************
  33882. In addition to commands intended for GDB users, GDB includes a number of
  33883. commands intended for GDB developers, that are not documented elsewhere
  33884. in this manual. These commands are provided here for reference. (For
  33885. commands that turn on debugging messages, see *note Debugging Output::.)
  33886. 'maint agent [-at LOCATION,] EXPRESSION'
  33887. 'maint agent-eval [-at LOCATION,] EXPRESSION'
  33888. Translate the given EXPRESSION into remote agent bytecodes. This
  33889. command is useful for debugging the Agent Expression mechanism
  33890. (*note Agent Expressions::). The 'agent' version produces an
  33891. expression useful for data collection, such as by tracepoints,
  33892. while 'maint agent-eval' produces an expression that evaluates
  33893. directly to a result. For instance, a collection expression for
  33894. 'globa + globb' will include bytecodes to record four bytes of
  33895. memory at each of the addresses of 'globa' and 'globb', while
  33896. discarding the result of the addition, while an evaluation
  33897. expression will do the addition and return the sum. If '-at' is
  33898. given, generate remote agent bytecode for LOCATION. If not,
  33899. generate remote agent bytecode for current frame PC address.
  33900. 'maint agent-printf FORMAT,EXPR,...'
  33901. Translate the given format string and list of argument expressions
  33902. into remote agent bytecodes and display them as a disassembled
  33903. list. This command is useful for debugging the agent version of
  33904. dynamic printf (*note Dynamic Printf::).
  33905. 'maint info breakpoints'
  33906. Using the same format as 'info breakpoints', display both the
  33907. breakpoints you've set explicitly, and those GDB is using for
  33908. internal purposes. Internal breakpoints are shown with negative
  33909. breakpoint numbers. The type column identifies what kind of
  33910. breakpoint is shown:
  33911. 'breakpoint'
  33912. Normal, explicitly set breakpoint.
  33913. 'watchpoint'
  33914. Normal, explicitly set watchpoint.
  33915. 'longjmp'
  33916. Internal breakpoint, used to handle correctly stepping through
  33917. 'longjmp' calls.
  33918. 'longjmp resume'
  33919. Internal breakpoint at the target of a 'longjmp'.
  33920. 'until'
  33921. Temporary internal breakpoint used by the GDB 'until' command.
  33922. 'finish'
  33923. Temporary internal breakpoint used by the GDB 'finish'
  33924. command.
  33925. 'shlib events'
  33926. Shared library events.
  33927. 'maint info btrace'
  33928. Pint information about raw branch tracing data.
  33929. 'maint btrace packet-history'
  33930. Print the raw branch trace packets that are used to compute the
  33931. execution history for the 'record btrace' command. Both the
  33932. information and the format in which it is printed depend on the
  33933. btrace recording format.
  33934. 'bts'
  33935. For the BTS recording format, print a list of blocks of
  33936. sequential code. For each block, the following information is
  33937. printed:
  33938. Block number
  33939. Newer blocks have higher numbers. The oldest block has
  33940. number zero.
  33941. Lowest 'PC'
  33942. Highest 'PC'
  33943. 'pt'
  33944. For the Intel Processor Trace recording format, print a list
  33945. of Intel Processor Trace packets. For each packet, the
  33946. following information is printed:
  33947. Packet number
  33948. Newer packets have higher numbers. The oldest packet has
  33949. number zero.
  33950. Trace offset
  33951. The packet's offset in the trace stream.
  33952. Packet opcode and payload
  33953. 'maint btrace clear-packet-history'
  33954. Discards the cached packet history printed by the 'maint btrace
  33955. packet-history' command. The history will be computed again when
  33956. needed.
  33957. 'maint btrace clear'
  33958. Discard the branch trace data. The data will be fetched anew and
  33959. the branch trace will be recomputed when needed.
  33960. This implicitly truncates the branch trace to a single branch trace
  33961. buffer. When updating branch trace incrementally, the branch trace
  33962. available to GDB may be bigger than a single branch trace buffer.
  33963. 'maint set btrace pt skip-pad'
  33964. 'maint show btrace pt skip-pad'
  33965. Control whether GDB will skip PAD packets when computing the packet
  33966. history.
  33967. 'set displaced-stepping'
  33968. 'show displaced-stepping'
  33969. Control whether or not GDB will do "displaced stepping" if the
  33970. target supports it. Displaced stepping is a way to single-step
  33971. over breakpoints without removing them from the inferior, by
  33972. executing an out-of-line copy of the instruction that was
  33973. originally at the breakpoint location. It is also known as
  33974. out-of-line single-stepping.
  33975. 'set displaced-stepping on'
  33976. If the target architecture supports it, GDB will use displaced
  33977. stepping to step over breakpoints.
  33978. 'set displaced-stepping off'
  33979. GDB will not use displaced stepping to step over breakpoints,
  33980. even if such is supported by the target architecture.
  33981. 'set displaced-stepping auto'
  33982. This is the default mode. GDB will use displaced stepping
  33983. only if non-stop mode is active (*note Non-Stop Mode::) and
  33984. the target architecture supports displaced stepping.
  33985. 'maint check-psymtabs'
  33986. Check the consistency of currently expanded psymtabs versus
  33987. symtabs. Use this to check, for example, whether a symbol is in
  33988. one but not the other.
  33989. 'maint check-symtabs'
  33990. Check the consistency of currently expanded symtabs.
  33991. 'maint expand-symtabs [REGEXP]'
  33992. Expand symbol tables. If REGEXP is specified, only expand symbol
  33993. tables for file names matching REGEXP.
  33994. 'maint set catch-demangler-crashes [on|off]'
  33995. 'maint show catch-demangler-crashes'
  33996. Control whether GDB should attempt to catch crashes in the symbol
  33997. name demangler. The default is to attempt to catch crashes. If
  33998. enabled, the first time a crash is caught, a core file is created,
  33999. the offending symbol is displayed and the user is presented with
  34000. the option to terminate the current session.
  34001. 'maint cplus first_component NAME'
  34002. Print the first C++ class/namespace component of NAME.
  34003. 'maint cplus namespace'
  34004. Print the list of possible C++ namespaces.
  34005. 'maint deprecate COMMAND [REPLACEMENT]'
  34006. 'maint undeprecate COMMAND'
  34007. Deprecate or undeprecate the named COMMAND. Deprecated commands
  34008. cause GDB to issue a warning when you use them. The optional
  34009. argument REPLACEMENT says which newer command should be used in
  34010. favor of the deprecated one; if it is given, GDB will mention the
  34011. replacement as part of the warning.
  34012. 'maint dump-me'
  34013. Cause a fatal signal in the debugger and force it to dump its core.
  34014. This is supported only on systems which support aborting a program
  34015. with the 'SIGQUIT' signal.
  34016. 'maint internal-error [MESSAGE-TEXT]'
  34017. 'maint internal-warning [MESSAGE-TEXT]'
  34018. 'maint demangler-warning [MESSAGE-TEXT]'
  34019. Cause GDB to call the internal function 'internal_error',
  34020. 'internal_warning' or 'demangler_warning' and hence behave as
  34021. though an internal problem has been detected. In addition to
  34022. reporting the internal problem, these functions give the user the
  34023. opportunity to either quit GDB or (for 'internal_error' and
  34024. 'internal_warning') create a core file of the current GDB session.
  34025. These commands take an optional parameter MESSAGE-TEXT that is used
  34026. as the text of the error or warning message.
  34027. Here's an example of using 'internal-error':
  34028. (gdb) maint internal-error testing, 1, 2
  34029. .../maint.c:121: internal-error: testing, 1, 2
  34030. A problem internal to GDB has been detected. Further
  34031. debugging may prove unreliable.
  34032. Quit this debugging session? (y or n) n
  34033. Create a core file? (y or n) n
  34034. (gdb)
  34035. 'maint set internal-error ACTION [ask|yes|no]'
  34036. 'maint show internal-error ACTION'
  34037. 'maint set internal-warning ACTION [ask|yes|no]'
  34038. 'maint show internal-warning ACTION'
  34039. 'maint set demangler-warning ACTION [ask|yes|no]'
  34040. 'maint show demangler-warning ACTION'
  34041. When GDB reports an internal problem (error or warning) it gives
  34042. the user the opportunity to both quit GDB and create a core file of
  34043. the current GDB session. These commands let you override the
  34044. default behaviour for each particular ACTION, described in the
  34045. table below.
  34046. 'quit'
  34047. You can specify that GDB should always (yes) or never (no)
  34048. quit. The default is to ask the user what to do.
  34049. 'corefile'
  34050. You can specify that GDB should always (yes) or never (no)
  34051. create a core file. The default is to ask the user what to
  34052. do. Note that there is no 'corefile' option for
  34053. 'demangler-warning': demangler warnings always create a core
  34054. file and this cannot be disabled.
  34055. 'maint packet TEXT'
  34056. If GDB is talking to an inferior via the serial protocol, then this
  34057. command sends the string TEXT to the inferior, and displays the
  34058. response packet. GDB supplies the initial '$' character, the
  34059. terminating '#' character, and the checksum.
  34060. 'maint print architecture [FILE]'
  34061. Print the entire architecture configuration. The optional argument
  34062. FILE names the file where the output goes.
  34063. 'maint print c-tdesc'
  34064. Print the target description (*note Target Descriptions::) as a C
  34065. source file. By default, the target description is for the current
  34066. target, but if the optional argument FILE is provided, that file is
  34067. used to produce the description. The FILE should be an XML
  34068. document, of the form described in *note Target Description
  34069. Format::. The created source file is built into GDB when GDB is
  34070. built again. This command is used by developers after they add or
  34071. modify XML target descriptions.
  34072. 'maint print xml-tdesc [FILE]'
  34073. Print the target description (*note Target Descriptions::) as an
  34074. XML file. By default print the target description for the current
  34075. target, but if the optional argument FILE is provided, then that
  34076. file is read in by GDB and then used to produce the description.
  34077. The FILE should be an XML document, of the form described in *note
  34078. Target Description Format::.
  34079. 'maint check xml-descriptions DIR'
  34080. Check that the target descriptions dynamically created by GDB equal
  34081. the descriptions created from XML files found in DIR.
  34082. 'maint check libthread-db'
  34083. Run integrity checks on the current inferior's thread debugging
  34084. library. This exercises all 'libthread_db' functionality used by
  34085. GDB on GNU/Linux systems, and by extension also exercises the
  34086. 'proc_service' functions provided by GDB that 'libthread_db' uses.
  34087. Note that parts of the test may be skipped on some platforms when
  34088. debugging core files.
  34089. 'maint print core-file-backed-mappings'
  34090. Print the file-backed mappings which were loaded from a core file
  34091. note. This output represents state internal to GDB and should be
  34092. similar to the mappings displayed by the 'info proc mappings'
  34093. command.
  34094. 'maint print dummy-frames'
  34095. Prints the contents of GDB's internal dummy-frame stack.
  34096. (gdb) b add
  34097. ...
  34098. (gdb) print add(2,3)
  34099. Breakpoint 2, add (a=2, b=3) at ...
  34100. 58 return (a + b);
  34101. The program being debugged stopped while in a function called from GDB.
  34102. ...
  34103. (gdb) maint print dummy-frames
  34104. 0xa8206d8: id={stack=0xbfffe734,code=0xbfffe73f,!special}, ptid=process 9353
  34105. (gdb)
  34106. Takes an optional file parameter.
  34107. 'maint print registers [FILE]'
  34108. 'maint print raw-registers [FILE]'
  34109. 'maint print cooked-registers [FILE]'
  34110. 'maint print register-groups [FILE]'
  34111. 'maint print remote-registers [FILE]'
  34112. Print GDB's internal register data structures.
  34113. The command 'maint print raw-registers' includes the contents of
  34114. the raw register cache; the command 'maint print cooked-registers'
  34115. includes the (cooked) value of all registers, including registers
  34116. which aren't available on the target nor visible to user; the
  34117. command 'maint print register-groups' includes the groups that each
  34118. register is a member of; and the command 'maint print
  34119. remote-registers' includes the remote target's register numbers and
  34120. offsets in the 'G' packets.
  34121. These commands take an optional parameter, a file name to which to
  34122. write the information.
  34123. 'maint print reggroups [FILE]'
  34124. Print GDB's internal register group data structures. The optional
  34125. argument FILE tells to what file to write the information.
  34126. The register groups info looks like this:
  34127. (gdb) maint print reggroups
  34128. Group Type
  34129. general user
  34130. float user
  34131. all user
  34132. vector user
  34133. system user
  34134. save internal
  34135. restore internal
  34136. 'flushregs'
  34137. This command forces GDB to flush its internal register cache.
  34138. 'maint print objfiles [REGEXP]'
  34139. Print a dump of all known object files. If REGEXP is specified,
  34140. only print object files whose names match REGEXP. For each object
  34141. file, this command prints its name, address in memory, and all of
  34142. its psymtabs and symtabs.
  34143. 'maint print user-registers'
  34144. List all currently available "user registers". User registers
  34145. typically provide alternate names for actual hardware registers.
  34146. They include the four "standard" registers '$fp', '$pc', '$sp', and
  34147. '$ps'. *Note standard registers::. User registers can be used in
  34148. expressions in the same way as the canonical register names, but
  34149. only the latter are listed by the 'info registers' and 'maint print
  34150. registers' commands.
  34151. 'maint print section-scripts [REGEXP]'
  34152. Print a dump of scripts specified in the '.debug_gdb_section'
  34153. section. If REGEXP is specified, only print scripts loaded by
  34154. object files matching REGEXP. For each script, this command prints
  34155. its name as specified in the objfile, and the full path if known.
  34156. *Note dotdebug_gdb_scripts section::.
  34157. 'maint print statistics'
  34158. This command prints, for each object file in the program, various
  34159. data about that object file followed by the byte cache ("bcache")
  34160. statistics for the object file. The objfile data includes the
  34161. number of minimal, partial, full, and stabs symbols, the number of
  34162. types defined by the objfile, the number of as yet unexpanded psym
  34163. tables, the number of line tables and string tables, and the amount
  34164. of memory used by the various tables. The bcache statistics
  34165. include the counts, sizes, and counts of duplicates of all and
  34166. unique objects, max, average, and median entry size, total memory
  34167. used and its overhead and savings, and various measures of the hash
  34168. table size and chain lengths.
  34169. 'maint print target-stack'
  34170. A "target" is an interface between the debugger and a particular
  34171. kind of file or process. Targets can be stacked in "strata", so
  34172. that more than one target can potentially respond to a request. In
  34173. particular, memory accesses will walk down the stack of targets
  34174. until they find a target that is interested in handling that
  34175. particular address.
  34176. This command prints a short description of each layer that was
  34177. pushed on the "target stack", starting from the top layer down to
  34178. the bottom one.
  34179. 'maint print type EXPR'
  34180. Print the type chain for a type specified by EXPR. The argument
  34181. can be either a type name or a symbol. If it is a symbol, the type
  34182. of that symbol is described. The type chain produced by this
  34183. command is a recursive definition of the data type as stored in
  34184. GDB's data structures, including its flags and contained types.
  34185. 'maint selftest [FILTER]'
  34186. Run any self tests that were compiled in to GDB. This will print a
  34187. message showing how many tests were run, and how many failed. If a
  34188. FILTER is passed, only the tests with FILTER in their name will by
  34189. ran.
  34190. 'maint info selftests'
  34191. List the selftests compiled in to GDB.
  34192. 'maint set dwarf always-disassemble'
  34193. 'maint show dwarf always-disassemble'
  34194. Control the behavior of 'info address' when using DWARF debugging
  34195. information.
  34196. The default is 'off', which means that GDB should try to describe a
  34197. variable's location in an easily readable format. When 'on', GDB
  34198. will instead display the DWARF location expression in an
  34199. assembly-like format. Note that some locations are too complex for
  34200. GDB to describe simply; in this case you will always see the
  34201. disassembly form.
  34202. Here is an example of the resulting disassembly:
  34203. (gdb) info addr argc
  34204. Symbol "argc" is a complex DWARF expression:
  34205. 1: DW_OP_fbreg 0
  34206. For more information on these expressions, see the DWARF standard
  34207. (http://www.dwarfstd.org/).
  34208. 'maint set dwarf max-cache-age'
  34209. 'maint show dwarf max-cache-age'
  34210. Control the DWARF compilation unit cache.
  34211. In object files with inter-compilation-unit references, such as
  34212. those produced by the GCC option '-feliminate-dwarf2-dups', the
  34213. DWARF reader needs to frequently refer to previously read
  34214. compilation units. This setting controls how long a compilation
  34215. unit will remain in the cache if it is not referenced. A higher
  34216. limit means that cached compilation units will be stored in memory
  34217. longer, and more total memory will be used. Setting it to zero
  34218. disables caching, which will slow down GDB startup, but reduce
  34219. memory consumption.
  34220. 'maint set dwarf unwinders'
  34221. 'maint show dwarf unwinders'
  34222. Control use of the DWARF frame unwinders.
  34223. Many targets that support DWARF debugging use GDB's DWARF frame
  34224. unwinders to build the backtrace. Many of these targets will also
  34225. have a second mechanism for building the backtrace for use in cases
  34226. where DWARF information is not available, this second mechanism is
  34227. often an analysis of a function's prologue.
  34228. In order to extend testing coverage of the second level stack
  34229. unwinding mechanisms it is helpful to be able to disable the DWARF
  34230. stack unwinders, this can be done with this switch.
  34231. In normal use of GDB disabling the DWARF unwinders is not
  34232. advisable, there are cases that are better handled through DWARF
  34233. than prologue analysis, and the debug experience is likely to be
  34234. better with the DWARF frame unwinders enabled.
  34235. If DWARF frame unwinders are not supported for a particular target
  34236. architecture, then enabling this flag does not cause them to be
  34237. used.
  34238. 'maint set worker-threads'
  34239. 'maint show worker-threads'
  34240. Control the number of worker threads that may be used by GDB. On
  34241. capable hosts, GDB may use multiple threads to speed up certain
  34242. CPU-intensive operations, such as demangling symbol names. While
  34243. the number of threads used by GDB may vary, this command can be
  34244. used to set an upper bound on this number. The default is
  34245. 'unlimited', which lets GDB choose a reasonable number. Note that
  34246. this only controls worker threads started by GDB itself; libraries
  34247. used by GDB may start threads of their own.
  34248. 'maint set profile'
  34249. 'maint show profile'
  34250. Control profiling of GDB.
  34251. Profiling will be disabled until you use the 'maint set profile'
  34252. command to enable it. When you enable profiling, the system will
  34253. begin collecting timing and execution count data; when you disable
  34254. profiling or exit GDB, the results will be written to a log file.
  34255. Remember that if you use profiling, GDB will overwrite the
  34256. profiling log file (often called 'gmon.out'). If you have a record
  34257. of important profiling data in a 'gmon.out' file, be sure to move
  34258. it to a safe location.
  34259. Configuring with '--enable-profiling' arranges for GDB to be
  34260. compiled with the '-pg' compiler option.
  34261. 'maint set show-debug-regs'
  34262. 'maint show show-debug-regs'
  34263. Control whether to show variables that mirror the hardware debug
  34264. registers. Use 'on' to enable, 'off' to disable. If enabled, the
  34265. debug registers values are shown when GDB inserts or removes a
  34266. hardware breakpoint or watchpoint, and when the inferior triggers a
  34267. hardware-assisted breakpoint or watchpoint.
  34268. 'maint set show-all-tib'
  34269. 'maint show show-all-tib'
  34270. Control whether to show all non zero areas within a 1k block
  34271. starting at thread local base, when using the 'info w32
  34272. thread-information-block' command.
  34273. 'maint set target-async'
  34274. 'maint show target-async'
  34275. This controls whether GDB targets operate in synchronous or
  34276. asynchronous mode (*note Background Execution::). Normally the
  34277. default is asynchronous, if it is available; but this can be
  34278. changed to more easily debug problems occurring only in synchronous
  34279. mode.
  34280. 'maint set target-non-stop'
  34281. 'maint show target-non-stop'
  34282. This controls whether GDB targets always operate in non-stop mode
  34283. even if 'set non-stop' is 'off' (*note Non-Stop Mode::). The
  34284. default is 'auto', meaning non-stop mode is enabled if supported by
  34285. the target.
  34286. 'maint set target-non-stop auto'
  34287. This is the default mode. GDB controls the target in non-stop
  34288. mode if the target supports it.
  34289. 'maint set target-non-stop on'
  34290. GDB controls the target in non-stop mode even if the target
  34291. does not indicate support.
  34292. 'maint set target-non-stop off'
  34293. GDB does not control the target in non-stop mode even if the
  34294. target supports it.
  34295. 'maint set tui-resize-message'
  34296. 'maint show tui-resize-message'
  34297. Control whether GDB displays a message each time the terminal is
  34298. resized when in TUI mode. The default is 'off', which means that
  34299. GDB is silent during resizes. When 'on', GDB will display a
  34300. message after a resize is completed; the message will include a
  34301. number indicating how many times the terminal has been resized.
  34302. This setting is intended for use by the test suite, where it would
  34303. otherwise be difficult to determine when a resize and refresh has
  34304. been completed.
  34305. 'maint set per-command'
  34306. 'maint show per-command'
  34307. GDB can display the resources used by each command. This is useful
  34308. in debugging performance problems.
  34309. 'maint set per-command space [on|off]'
  34310. 'maint show per-command space'
  34311. Enable or disable the printing of the memory used by GDB for
  34312. each command. If enabled, GDB will display how much memory
  34313. each command took, following the command's own output. This
  34314. can also be requested by invoking GDB with the '--statistics'
  34315. command-line switch (*note Mode Options::).
  34316. 'maint set per-command time [on|off]'
  34317. 'maint show per-command time'
  34318. Enable or disable the printing of the execution time of GDB
  34319. for each command. If enabled, GDB will display how much time
  34320. it took to execute each command, following the command's own
  34321. output. Both CPU time and wallclock time are printed.
  34322. Printing both is useful when trying to determine whether the
  34323. cost is CPU or, e.g., disk/network latency. Note that the CPU
  34324. time printed is for GDB only, it does not include the
  34325. execution time of the inferior because there's no mechanism
  34326. currently to compute how much time was spent by GDB and how
  34327. much time was spent by the program been debugged. This can
  34328. also be requested by invoking GDB with the '--statistics'
  34329. command-line switch (*note Mode Options::).
  34330. 'maint set per-command symtab [on|off]'
  34331. 'maint show per-command symtab'
  34332. Enable or disable the printing of basic symbol table
  34333. statistics for each command. If enabled, GDB will display the
  34334. following information:
  34335. a. number of symbol tables
  34336. b. number of primary symbol tables
  34337. c. number of blocks in the blockvector
  34338. 'maint set check-libthread-db [on|off]'
  34339. 'maint show check-libthread-db'
  34340. Control whether GDB should run integrity checks on inferior
  34341. specific thread debugging libraries as they are loaded. The
  34342. default is not to perform such checks. If any check fails GDB will
  34343. unload the library and continue searching for a suitable candidate
  34344. as described in *note set libthread-db-search-path::. For more
  34345. information about the tests, see *note maint check libthread-db::.
  34346. 'maint space VALUE'
  34347. An alias for 'maint set per-command space'. A non-zero value
  34348. enables it, zero disables it.
  34349. 'maint time VALUE'
  34350. An alias for 'maint set per-command time'. A non-zero value
  34351. enables it, zero disables it.
  34352. 'maint translate-address [SECTION] ADDR'
  34353. Find the symbol stored at the location specified by the address
  34354. ADDR and an optional section name SECTION. If found, GDB prints
  34355. the name of the closest symbol and an offset from the symbol's
  34356. location to the specified address. This is similar to the 'info
  34357. address' command (*note Symbols::), except that this command also
  34358. allows to find symbols in other sections.
  34359. If section was not specified, the section in which the symbol was
  34360. found is also printed. For dynamically linked executables, the
  34361. name of executable or shared library containing the symbol is
  34362. printed as well.
  34363. 'maint test-options require-delimiter'
  34364. 'maint test-options unknown-is-error'
  34365. 'maint test-options unknown-is-operand'
  34366. These commands are used by the testsuite to validate the command
  34367. options framework. The 'require-delimiter' variant requires a
  34368. double-dash delimiter to indicate end of options. The
  34369. 'unknown-is-error' and 'unknown-is-operand' do not. The
  34370. 'unknown-is-error' variant throws an error on unknown option, while
  34371. 'unknown-is-operand' treats unknown options as the start of the
  34372. command's operands. When run, the commands output the result of
  34373. the processed options. When completed, the commands store the
  34374. internal result of completion in a variable exposed by the 'maint
  34375. show test-options-completion-result' command.
  34376. 'maint show test-options-completion-result'
  34377. Shows the result of completing the 'maint test-options'
  34378. subcommands. This is used by the testsuite to validate completion
  34379. support in the command options framework.
  34380. 'maint set test-settings KIND'
  34381. 'maint show test-settings KIND'
  34382. These are representative commands for each KIND of setting type GDB
  34383. supports. They are used by the testsuite for exercising the
  34384. settings infrastructure.
  34385. 'maint with SETTING [VALUE] [-- COMMAND]'
  34386. Like the 'with' command, but works with 'maintenance set'
  34387. variables. This is used by the testsuite to exercise the 'with'
  34388. command's infrastructure.
  34389. The following command is useful for non-interactive invocations of
  34390. GDB, such as in the test suite.
  34391. 'set watchdog NSEC'
  34392. Set the maximum number of seconds GDB will wait for the target
  34393. operation to finish. If this time expires, GDB reports and error
  34394. and the command is aborted.
  34395. 'show watchdog'
  34396. Show the current setting of the target wait timeout.
  34397. 
  34398. File: gdb.info, Node: Remote Protocol, Next: Agent Expressions, Prev: Maintenance Commands, Up: Top
  34399. Appendix E GDB Remote Serial Protocol
  34400. *************************************
  34401. * Menu:
  34402. * Overview::
  34403. * Packets::
  34404. * Stop Reply Packets::
  34405. * General Query Packets::
  34406. * Architecture-Specific Protocol Details::
  34407. * Tracepoint Packets::
  34408. * Host I/O Packets::
  34409. * Interrupts::
  34410. * Notification Packets::
  34411. * Remote Non-Stop::
  34412. * Packet Acknowledgment::
  34413. * Examples::
  34414. * File-I/O Remote Protocol Extension::
  34415. * Library List Format::
  34416. * Library List Format for SVR4 Targets::
  34417. * Memory Map Format::
  34418. * Thread List Format::
  34419. * Traceframe Info Format::
  34420. * Branch Trace Format::
  34421. * Branch Trace Configuration Format::
  34422. 
  34423. File: gdb.info, Node: Overview, Next: Packets, Up: Remote Protocol
  34424. E.1 Overview
  34425. ============
  34426. There may be occasions when you need to know something about the
  34427. protocol--for example, if there is only one serial port to your target
  34428. machine, you might want your program to do something special if it
  34429. recognizes a packet meant for GDB.
  34430. In the examples below, '->' and '<-' are used to indicate transmitted
  34431. and received data, respectively.
  34432. All GDB commands and responses (other than acknowledgments and
  34433. notifications, see *note Notification Packets::) are sent as a PACKET.
  34434. A PACKET is introduced with the character '$', the actual PACKET-DATA,
  34435. and the terminating character '#' followed by a two-digit CHECKSUM:
  34436. $PACKET-DATA#CHECKSUM
  34437. The two-digit CHECKSUM is computed as the modulo 256 sum of all
  34438. characters between the leading '$' and the trailing '#' (an eight bit
  34439. unsigned checksum).
  34440. Implementors should note that prior to GDB 5.0 the protocol
  34441. specification also included an optional two-digit SEQUENCE-ID:
  34442. $SEQUENCE-ID:PACKET-DATA#CHECKSUM
  34443. That SEQUENCE-ID was appended to the acknowledgment. GDB has never
  34444. output SEQUENCE-IDs. Stubs that handle packets added since GDB 5.0 must
  34445. not accept SEQUENCE-ID.
  34446. When either the host or the target machine receives a packet, the
  34447. first response expected is an acknowledgment: either '+' (to indicate
  34448. the package was received correctly) or '-' (to request retransmission):
  34449. -> $PACKET-DATA#CHECKSUM
  34450. <- +
  34451. The '+'/'-' acknowledgments can be disabled once a connection is
  34452. established. *Note Packet Acknowledgment::, for details.
  34453. The host (GDB) sends COMMANDs, and the target (the debugging stub
  34454. incorporated in your program) sends a RESPONSE. In the case of step and
  34455. continue COMMANDs, the response is only sent when the operation has
  34456. completed, and the target has again stopped all threads in all attached
  34457. processes. This is the default all-stop mode behavior, but the remote
  34458. protocol also supports GDB's non-stop execution mode; see *note Remote
  34459. Non-Stop::, for details.
  34460. PACKET-DATA consists of a sequence of characters with the exception
  34461. of '#' and '$' (see 'X' packet for additional exceptions).
  34462. Fields within the packet should be separated using ',' ';' or ':'.
  34463. Except where otherwise noted all numbers are represented in HEX with
  34464. leading zeros suppressed.
  34465. Implementors should note that prior to GDB 5.0, the character ':'
  34466. could not appear as the third character in a packet (as it would
  34467. potentially conflict with the SEQUENCE-ID).
  34468. Binary data in most packets is encoded either as two hexadecimal
  34469. digits per byte of binary data. This allowed the traditional remote
  34470. protocol to work over connections which were only seven-bit clean. Some
  34471. packets designed more recently assume an eight-bit clean connection, and
  34472. use a more efficient encoding to send and receive binary data.
  34473. The binary data representation uses '7d' (ASCII '}') as an escape
  34474. character. Any escaped byte is transmitted as the escape character
  34475. followed by the original character XORed with '0x20'. For example, the
  34476. byte '0x7d' would be transmitted as the two bytes '0x7d 0x5d'. The
  34477. bytes '0x23' (ASCII '#'), '0x24' (ASCII '$'), and '0x7d' (ASCII '}')
  34478. must always be escaped. Responses sent by the stub must also escape
  34479. '0x2a' (ASCII '*'), so that it is not interpreted as the start of a
  34480. run-length encoded sequence (described next).
  34481. Response DATA can be run-length encoded to save space. Run-length
  34482. encoding replaces runs of identical characters with one instance of the
  34483. repeated character, followed by a '*' and a repeat count. The repeat
  34484. count is itself sent encoded, to avoid binary characters in DATA: a
  34485. value of N is sent as 'N+29'. For a repeat count greater or equal to 3,
  34486. this produces a printable ASCII character, e.g. a space (ASCII code 32)
  34487. for a repeat count of 3. (This is because run-length encoding starts to
  34488. win for counts 3 or more.) Thus, for example, '0* ' is a run-length
  34489. encoding of "0000": the space character after '*' means repeat the
  34490. leading '0' '32 - 29 = 3' more times.
  34491. The printable characters '#' and '$' or with a numeric value greater
  34492. than 126 must not be used. Runs of six repeats ('#') or seven repeats
  34493. ('$') can be expanded using a repeat count of only five ('"'). For
  34494. example, '00000000' can be encoded as '0*"00'.
  34495. The error response returned for some packets includes a two character
  34496. error number. That number is not well defined.
  34497. For any COMMAND not supported by the stub, an empty response ('$#00')
  34498. should be returned. That way it is possible to extend the protocol. A
  34499. newer GDB can tell if a packet is supported based on that response.
  34500. At a minimum, a stub is required to support the '?' command to tell
  34501. GDB the reason for halting, 'g' and 'G' commands for register access,
  34502. and the 'm' and 'M' commands for memory access. Stubs that only control
  34503. single-threaded targets can implement run control with the 'c'
  34504. (continue) command, and if the target architecture supports
  34505. hardware-assisted single-stepping, the 's' (step) command. Stubs that
  34506. support multi-threading targets should support the 'vCont' command. All
  34507. other commands are optional.
  34508. 
  34509. File: gdb.info, Node: Packets, Next: Stop Reply Packets, Prev: Overview, Up: Remote Protocol
  34510. E.2 Packets
  34511. ===========
  34512. The following table provides a complete list of all currently defined
  34513. COMMANDs and their corresponding response DATA. *Note File-I/O Remote
  34514. Protocol Extension::, for details about the File I/O extension of the
  34515. remote protocol.
  34516. Each packet's description has a template showing the packet's overall
  34517. syntax, followed by an explanation of the packet's meaning. We include
  34518. spaces in some of the templates for clarity; these are not part of the
  34519. packet's syntax. No GDB packet uses spaces to separate its components.
  34520. For example, a template like 'foo BAR BAZ' describes a packet beginning
  34521. with the three ASCII bytes 'foo', followed by a BAR, followed directly
  34522. by a BAZ. GDB does not transmit a space character between the 'foo' and
  34523. the BAR, or between the BAR and the BAZ.
  34524. Several packets and replies include a THREAD-ID field to identify a
  34525. thread. Normally these are positive numbers with a target-specific
  34526. interpretation, formatted as big-endian hex strings. A THREAD-ID can
  34527. also be a literal '-1' to indicate all threads, or '0' to pick any
  34528. thread.
  34529. In addition, the remote protocol supports a multiprocess feature in
  34530. which the THREAD-ID syntax is extended to optionally include both
  34531. process and thread ID fields, as 'pPID.TID'. The PID (process) and TID
  34532. (thread) components each have the format described above: a positive
  34533. number with target-specific interpretation formatted as a big-endian hex
  34534. string, literal '-1' to indicate all processes or threads
  34535. (respectively), or '0' to indicate an arbitrary process or thread.
  34536. Specifying just a process, as 'pPID', is equivalent to 'pPID.-1'. It is
  34537. an error to specify all processes but a specific thread, such as
  34538. 'p-1.TID'. Note that the 'p' prefix is _not_ used for those packets and
  34539. replies explicitly documented to include a process ID, rather than a
  34540. THREAD-ID.
  34541. The multiprocess THREAD-ID syntax extensions are only used if both
  34542. GDB and the stub report support for the 'multiprocess' feature using
  34543. 'qSupported'. *Note multiprocess extensions::, for more information.
  34544. Note that all packet forms beginning with an upper- or lower-case
  34545. letter, other than those described here, are reserved for future use.
  34546. Here are the packet descriptions.
  34547. '!'
  34548. Enable extended mode. In extended mode, the remote server is made
  34549. persistent. The 'R' packet is used to restart the program being
  34550. debugged.
  34551. Reply:
  34552. 'OK'
  34553. The remote target both supports and has enabled extended mode.
  34554. '?'
  34555. Indicate the reason the target halted. The reply is the same as
  34556. for step and continue. This packet has a special interpretation
  34557. when the target is in non-stop mode; see *note Remote Non-Stop::.
  34558. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34559. 'A ARGLEN,ARGNUM,ARG,...'
  34560. Initialized 'argv[]' array passed into program. ARGLEN specifies
  34561. the number of bytes in the hex encoded byte stream ARG. See
  34562. 'gdbserver' for more details.
  34563. Reply:
  34564. 'OK'
  34565. The arguments were set.
  34566. 'E NN'
  34567. An error occurred.
  34568. 'b BAUD'
  34569. (Don't use this packet; its behavior is not well-defined.) Change
  34570. the serial line speed to BAUD.
  34571. JTC: _When does the transport layer state change? When it's
  34572. received, or after the ACK is transmitted. In either case, there
  34573. are problems if the command or the acknowledgment packet is
  34574. dropped._
  34575. Stan: _If people really wanted to add something like this, and get
  34576. it working for the first time, they ought to modify ser-unix.c to
  34577. send some kind of out-of-band message to a specially-setup stub and
  34578. have the switch happen "in between" packets, so that from remote
  34579. protocol's point of view, nothing actually happened._
  34580. 'B ADDR,MODE'
  34581. Set (MODE is 'S') or clear (MODE is 'C') a breakpoint at ADDR.
  34582. Don't use this packet. Use the 'Z' and 'z' packets instead (*note
  34583. insert breakpoint or watchpoint packet::).
  34584. 'bc'
  34585. Backward continue. Execute the target system in reverse. No
  34586. parameter. *Note Reverse Execution::, for more information.
  34587. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34588. 'bs'
  34589. Backward single step. Execute one instruction in reverse. No
  34590. parameter. *Note Reverse Execution::, for more information.
  34591. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34592. 'c [ADDR]'
  34593. Continue at ADDR, which is the address to resume. If ADDR is
  34594. omitted, resume at current address.
  34595. This packet is deprecated for multi-threading support. *Note vCont
  34596. packet::.
  34597. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34598. 'C SIG[;ADDR]'
  34599. Continue with signal SIG (hex signal number). If ';ADDR' is
  34600. omitted, resume at same address.
  34601. This packet is deprecated for multi-threading support. *Note vCont
  34602. packet::.
  34603. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34604. 'd'
  34605. Toggle debug flag.
  34606. Don't use this packet; instead, define a general set packet (*note
  34607. General Query Packets::).
  34608. 'D'
  34609. 'D;PID'
  34610. The first form of the packet is used to detach GDB from the remote
  34611. system. It is sent to the remote target before GDB disconnects via
  34612. the 'detach' command.
  34613. The second form, including a process ID, is used when multiprocess
  34614. protocol extensions are enabled (*note multiprocess extensions::),
  34615. to detach only a specific process. The PID is specified as a
  34616. big-endian hex string.
  34617. Reply:
  34618. 'OK'
  34619. for success
  34620. 'E NN'
  34621. for an error
  34622. 'F RC,EE,CF;XX'
  34623. A reply from GDB to an 'F' packet sent by the target. This is part
  34624. of the File-I/O protocol extension. *Note File-I/O Remote Protocol
  34625. Extension::, for the specification.
  34626. 'g'
  34627. Read general registers.
  34628. Reply:
  34629. 'XX...'
  34630. Each byte of register data is described by two hex digits.
  34631. The bytes with the register are transmitted in target byte
  34632. order. The size of each register and their position within
  34633. the 'g' packet are determined by the GDB internal gdbarch
  34634. functions 'DEPRECATED_REGISTER_RAW_SIZE' and
  34635. 'gdbarch_register_name'.
  34636. When reading registers from a trace frame (*note Using the
  34637. Collected Data: Analyze Collected Data.), the stub may also
  34638. return a string of literal 'x''s in place of the register data
  34639. digits, to indicate that the corresponding register has not
  34640. been collected, thus its value is unavailable. For example,
  34641. for an architecture with 4 registers of 4 bytes each, the
  34642. following reply indicates to GDB that registers 0 and 2 have
  34643. not been collected, while registers 1 and 3 have been
  34644. collected, and both have zero value:
  34645. -> g
  34646. <- xxxxxxxx00000000xxxxxxxx00000000
  34647. 'E NN'
  34648. for an error.
  34649. 'G XX...'
  34650. Write general registers. *Note read registers packet::, for a
  34651. description of the XX... data.
  34652. Reply:
  34653. 'OK'
  34654. for success
  34655. 'E NN'
  34656. for an error
  34657. 'H OP THREAD-ID'
  34658. Set thread for subsequent operations ('m', 'M', 'g', 'G', et.al.).
  34659. Depending on the operation to be performed, OP should be 'c' for
  34660. step and continue operations (note that this is deprecated,
  34661. supporting the 'vCont' command is a better option), and 'g' for
  34662. other operations. The thread designator THREAD-ID has the format
  34663. and interpretation described in *note thread-id syntax::.
  34664. Reply:
  34665. 'OK'
  34666. for success
  34667. 'E NN'
  34668. for an error
  34669. 'i [ADDR[,NNN]]'
  34670. Step the remote target by a single clock cycle. If ',NNN' is
  34671. present, cycle step NNN cycles. If ADDR is present, cycle step
  34672. starting at that address.
  34673. 'I'
  34674. Signal, then cycle step. *Note step with signal packet::. *Note
  34675. cycle step packet::.
  34676. 'k'
  34677. Kill request.
  34678. The exact effect of this packet is not specified.
  34679. For a bare-metal target, it may power cycle or reset the target
  34680. system. For that reason, the 'k' packet has no reply.
  34681. For a single-process target, it may kill that process if possible.
  34682. A multiple-process target may choose to kill just one process, or
  34683. all that are under GDB's control. For more precise control, use
  34684. the vKill packet (*note vKill packet::).
  34685. If the target system immediately closes the connection in response
  34686. to 'k', GDB does not consider the lack of packet acknowledgment to
  34687. be an error, and assumes the kill was successful.
  34688. If connected using 'target extended-remote', and the target does
  34689. not close the connection in response to a kill request, GDB probes
  34690. the target state as if a new connection was opened (*note ?
  34691. packet::).
  34692. 'm ADDR,LENGTH'
  34693. Read LENGTH addressable memory units starting at address ADDR
  34694. (*note addressable memory unit::). Note that ADDR may not be
  34695. aligned to any particular boundary.
  34696. The stub need not use any particular size or alignment when
  34697. gathering data from memory for the response; even if ADDR is
  34698. word-aligned and LENGTH is a multiple of the word size, the stub is
  34699. free to use byte accesses, or not. For this reason, this packet
  34700. may not be suitable for accessing memory-mapped I/O devices.
  34701. Reply:
  34702. 'XX...'
  34703. Memory contents; each byte is transmitted as a two-digit
  34704. hexadecimal number. The reply may contain fewer addressable
  34705. memory units than requested if the server was able to read
  34706. only part of the region of memory.
  34707. 'E NN'
  34708. NN is errno
  34709. 'M ADDR,LENGTH:XX...'
  34710. Write LENGTH addressable memory units starting at address ADDR
  34711. (*note addressable memory unit::). The data is given by XX...;
  34712. each byte is transmitted as a two-digit hexadecimal number.
  34713. Reply:
  34714. 'OK'
  34715. for success
  34716. 'E NN'
  34717. for an error (this includes the case where only part of the
  34718. data was written).
  34719. 'p N'
  34720. Read the value of register N; N is in hex. *Note read registers
  34721. packet::, for a description of how the returned register value is
  34722. encoded.
  34723. Reply:
  34724. 'XX...'
  34725. the register's value
  34726. 'E NN'
  34727. for an error
  34728. ''
  34729. Indicating an unrecognized QUERY.
  34730. 'P N...=R...'
  34731. Write register N... with value R.... The register number N is in
  34732. hexadecimal, and R... contains two hex digits for each byte in the
  34733. register (target byte order).
  34734. Reply:
  34735. 'OK'
  34736. for success
  34737. 'E NN'
  34738. for an error
  34739. 'q NAME PARAMS...'
  34740. 'Q NAME PARAMS...'
  34741. General query ('q') and set ('Q'). These packets are described
  34742. fully in *note General Query Packets::.
  34743. 'r'
  34744. Reset the entire system.
  34745. Don't use this packet; use the 'R' packet instead.
  34746. 'R XX'
  34747. Restart the program being debugged. The XX, while needed, is
  34748. ignored. This packet is only available in extended mode (*note
  34749. extended mode::).
  34750. The 'R' packet has no reply.
  34751. 's [ADDR]'
  34752. Single step, resuming at ADDR. If ADDR is omitted, resume at same
  34753. address.
  34754. This packet is deprecated for multi-threading support. *Note vCont
  34755. packet::.
  34756. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34757. 'S SIG[;ADDR]'
  34758. Step with signal. This is analogous to the 'C' packet, but
  34759. requests a single-step, rather than a normal resumption of
  34760. execution.
  34761. This packet is deprecated for multi-threading support. *Note vCont
  34762. packet::.
  34763. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34764. 't ADDR:PP,MM'
  34765. Search backwards starting at address ADDR for a match with pattern
  34766. PP and mask MM, both of which are are 4 byte long. There must be
  34767. at least 3 digits in ADDR.
  34768. 'T THREAD-ID'
  34769. Find out if the thread THREAD-ID is alive. *Note thread-id
  34770. syntax::.
  34771. Reply:
  34772. 'OK'
  34773. thread is still alive
  34774. 'E NN'
  34775. thread is dead
  34776. 'v'
  34777. Packets starting with 'v' are identified by a multi-letter name, up
  34778. to the first ';' or '?' (or the end of the packet).
  34779. 'vAttach;PID'
  34780. Attach to a new process with the specified process ID PID. The
  34781. process ID is a hexadecimal integer identifying the process. In
  34782. all-stop mode, all threads in the attached process are stopped; in
  34783. non-stop mode, it may be attached without being stopped if that is
  34784. supported by the target.
  34785. This packet is only available in extended mode (*note extended
  34786. mode::).
  34787. Reply:
  34788. 'E NN'
  34789. for an error
  34790. 'Any stop packet'
  34791. for success in all-stop mode (*note Stop Reply Packets::)
  34792. 'OK'
  34793. for success in non-stop mode (*note Remote Non-Stop::)
  34794. 'vCont[;ACTION[:THREAD-ID]]...'
  34795. Resume the inferior, specifying different actions for each thread.
  34796. For each inferior thread, the leftmost action with a matching
  34797. THREAD-ID is applied. Threads that don't match any action remain
  34798. in their current state. Thread IDs are specified using the syntax
  34799. described in *note thread-id syntax::. If multiprocess extensions
  34800. (*note multiprocess extensions::) are supported, actions can be
  34801. specified to match all threads in a process by using the 'pPID.-1'
  34802. form of the THREAD-ID. An action with no THREAD-ID matches all
  34803. threads. Specifying no actions is an error.
  34804. Currently supported actions are:
  34805. 'c'
  34806. Continue.
  34807. 'C SIG'
  34808. Continue with signal SIG. The signal SIG should be two hex
  34809. digits.
  34810. 's'
  34811. Step.
  34812. 'S SIG'
  34813. Step with signal SIG. The signal SIG should be two hex
  34814. digits.
  34815. 't'
  34816. Stop.
  34817. 'r START,END'
  34818. Step once, and then keep stepping as long as the thread stops
  34819. at addresses between START (inclusive) and END (exclusive).
  34820. The remote stub reports a stop reply when either the thread
  34821. goes out of the range or is stopped due to an unrelated
  34822. reason, such as hitting a breakpoint. *Note range stepping::.
  34823. If the range is empty (START == END), then the action becomes
  34824. equivalent to the 's' action. In other words, single-step
  34825. once, and report the stop (even if the stepped instruction
  34826. jumps to START).
  34827. (A stop reply may be sent at any point even if the PC is still
  34828. within the stepping range; for example, it is valid to
  34829. implement this packet in a degenerate way as a single
  34830. instruction step operation.)
  34831. The optional argument ADDR normally associated with the 'c', 'C',
  34832. 's', and 'S' packets is not supported in 'vCont'.
  34833. The 't' action is only relevant in non-stop mode (*note Remote
  34834. Non-Stop::) and may be ignored by the stub otherwise. A stop reply
  34835. should be generated for any affected thread not already stopped.
  34836. When a thread is stopped by means of a 't' action, the
  34837. corresponding stop reply should indicate that the thread has
  34838. stopped with signal '0', regardless of whether the target uses some
  34839. other signal as an implementation detail.
  34840. The server must ignore 'c', 'C', 's', 'S', and 'r' actions for
  34841. threads that are already running. Conversely, the server must
  34842. ignore 't' actions for threads that are already stopped.
  34843. _Note:_ In non-stop mode, a thread is considered running until GDB
  34844. acknowledges an asynchronous stop notification for it with the
  34845. 'vStopped' packet (*note Remote Non-Stop::).
  34846. The stub must support 'vCont' if it reports support for
  34847. multiprocess extensions (*note multiprocess extensions::).
  34848. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34849. 'vCont?'
  34850. Request a list of actions supported by the 'vCont' packet.
  34851. Reply:
  34852. 'vCont[;ACTION...]'
  34853. The 'vCont' packet is supported. Each ACTION is a supported
  34854. command in the 'vCont' packet.
  34855. ''
  34856. The 'vCont' packet is not supported.
  34857. 'vCtrlC'
  34858. Interrupt remote target as if a control-C was pressed on the remote
  34859. terminal. This is the equivalent to reacting to the '^C' ('\003',
  34860. the control-C character) character in all-stop mode while the
  34861. target is running, except this works in non-stop mode. *Note
  34862. interrupting remote targets::, for more info on the all-stop
  34863. variant.
  34864. Reply:
  34865. 'E NN'
  34866. for an error
  34867. 'OK'
  34868. for success
  34869. 'vFile:OPERATION:PARAMETER...'
  34870. Perform a file operation on the target system. For details, see
  34871. *note Host I/O Packets::.
  34872. 'vFlashErase:ADDR,LENGTH'
  34873. Direct the stub to erase LENGTH bytes of flash starting at ADDR.
  34874. The region may enclose any number of flash blocks, but its start
  34875. and end must fall on block boundaries, as indicated by the flash
  34876. block size appearing in the memory map (*note Memory Map Format::).
  34877. GDB groups flash memory programming operations together, and sends
  34878. a 'vFlashDone' request after each group; the stub is allowed to
  34879. delay erase operation until the 'vFlashDone' packet is received.
  34880. Reply:
  34881. 'OK'
  34882. for success
  34883. 'E NN'
  34884. for an error
  34885. 'vFlashWrite:ADDR:XX...'
  34886. Direct the stub to write data to flash address ADDR. The data is
  34887. passed in binary form using the same encoding as for the 'X' packet
  34888. (*note Binary Data::). The memory ranges specified by
  34889. 'vFlashWrite' packets preceding a 'vFlashDone' packet must not
  34890. overlap, and must appear in order of increasing addresses (although
  34891. 'vFlashErase' packets for higher addresses may already have been
  34892. received; the ordering is guaranteed only between 'vFlashWrite'
  34893. packets). If a packet writes to an address that was neither erased
  34894. by a preceding 'vFlashErase' packet nor by some other
  34895. target-specific method, the results are unpredictable.
  34896. Reply:
  34897. 'OK'
  34898. for success
  34899. 'E.memtype'
  34900. for vFlashWrite addressing non-flash memory
  34901. 'E NN'
  34902. for an error
  34903. 'vFlashDone'
  34904. Indicate to the stub that flash programming operation is finished.
  34905. The stub is permitted to delay or batch the effects of a group of
  34906. 'vFlashErase' and 'vFlashWrite' packets until a 'vFlashDone' packet
  34907. is received. The contents of the affected regions of flash memory
  34908. are unpredictable until the 'vFlashDone' request is completed.
  34909. 'vKill;PID'
  34910. Kill the process with the specified process ID PID, which is a
  34911. hexadecimal integer identifying the process. This packet is used
  34912. in preference to 'k' when multiprocess protocol extensions are
  34913. supported; see *note multiprocess extensions::.
  34914. Reply:
  34915. 'E NN'
  34916. for an error
  34917. 'OK'
  34918. for success
  34919. 'vMustReplyEmpty'
  34920. The correct reply to an unknown 'v' packet is to return the empty
  34921. string, however, some older versions of 'gdbserver' would
  34922. incorrectly return 'OK' for unknown 'v' packets.
  34923. The 'vMustReplyEmpty' is used as a feature test to check how
  34924. 'gdbserver' handles unknown packets, it is important that this
  34925. packet be handled in the same way as other unknown 'v' packets. If
  34926. this packet is handled differently to other unknown 'v' packets
  34927. then it is possible that GDB may run into problems in other areas,
  34928. specifically around use of 'vFile:setfs:'.
  34929. 'vRun;FILENAME[;ARGUMENT]...'
  34930. Run the program FILENAME, passing it each ARGUMENT on its command
  34931. line. The file and arguments are hex-encoded strings. If FILENAME
  34932. is an empty string, the stub may use a default program (e.g. the
  34933. last program run). The program is created in the stopped state.
  34934. This packet is only available in extended mode (*note extended
  34935. mode::).
  34936. Reply:
  34937. 'E NN'
  34938. for an error
  34939. 'Any stop packet'
  34940. for success (*note Stop Reply Packets::)
  34941. 'vStopped'
  34942. *Note Notification Packets::.
  34943. 'X ADDR,LENGTH:XX...'
  34944. Write data to memory, where the data is transmitted in binary.
  34945. Memory is specified by its address ADDR and number of addressable
  34946. memory units LENGTH (*note addressable memory unit::); 'XX...' is
  34947. binary data (*note Binary Data::).
  34948. Reply:
  34949. 'OK'
  34950. for success
  34951. 'E NN'
  34952. for an error
  34953. 'z TYPE,ADDR,KIND'
  34954. 'Z TYPE,ADDR,KIND'
  34955. Insert ('Z') or remove ('z') a TYPE breakpoint or watchpoint
  34956. starting at address ADDRESS of kind KIND.
  34957. Each breakpoint and watchpoint packet TYPE is documented
  34958. separately.
  34959. _Implementation notes: A remote target shall return an empty string
  34960. for an unrecognized breakpoint or watchpoint packet TYPE. A remote
  34961. target shall support either both or neither of a given 'ZTYPE...'
  34962. and 'zTYPE...' packet pair. To avoid potential problems with
  34963. duplicate packets, the operations should be implemented in an
  34964. idempotent way._
  34965. 'z0,ADDR,KIND'
  34966. 'Z0,ADDR,KIND[;COND_LIST...][;cmds:PERSIST,CMD_LIST...]'
  34967. Insert ('Z0') or remove ('z0') a software breakpoint at address
  34968. ADDR of type KIND.
  34969. A software breakpoint is implemented by replacing the instruction
  34970. at ADDR with a software breakpoint or trap instruction. The KIND
  34971. is target-specific and typically indicates the size of the
  34972. breakpoint in bytes that should be inserted. E.g., the ARM and
  34973. MIPS can insert either a 2 or 4 byte breakpoint. Some
  34974. architectures have additional meanings for KIND (*note
  34975. Architecture-Specific Protocol Details::); if no
  34976. architecture-specific value is being used, it should be '0'. KIND
  34977. is hex-encoded. COND_LIST is an optional list of conditional
  34978. expressions in bytecode form that should be evaluated on the
  34979. target's side. These are the conditions that should be taken into
  34980. consideration when deciding if the breakpoint trigger should be
  34981. reported back to GDB.
  34982. See also the 'swbreak' stop reason (*note swbreak stop reason::)
  34983. for how to best report a software breakpoint event to GDB.
  34984. The COND_LIST parameter is comprised of a series of expressions,
  34985. concatenated without separators. Each expression has the following
  34986. form:
  34987. 'X LEN,EXPR'
  34988. LEN is the length of the bytecode expression and EXPR is the
  34989. actual conditional expression in bytecode form.
  34990. The optional CMD_LIST parameter introduces commands that may be run
  34991. on the target, rather than being reported back to GDB. The
  34992. parameter starts with a numeric flag PERSIST; if the flag is
  34993. nonzero, then the breakpoint may remain active and the commands
  34994. continue to be run even when GDB disconnects from the target.
  34995. Following this flag is a series of expressions concatenated with no
  34996. separators. Each expression has the following form:
  34997. 'X LEN,EXPR'
  34998. LEN is the length of the bytecode expression and EXPR is the
  34999. actual commands expression in bytecode form.
  35000. _Implementation note: It is possible for a target to copy or move
  35001. code that contains software breakpoints (e.g., when implementing
  35002. overlays). The behavior of this packet, in the presence of such a
  35003. target, is not defined._
  35004. Reply:
  35005. 'OK'
  35006. success
  35007. ''
  35008. not supported
  35009. 'E NN'
  35010. for an error
  35011. 'z1,ADDR,KIND'
  35012. 'Z1,ADDR,KIND[;COND_LIST...][;cmds:PERSIST,CMD_LIST...]'
  35013. Insert ('Z1') or remove ('z1') a hardware breakpoint at address
  35014. ADDR.
  35015. A hardware breakpoint is implemented using a mechanism that is not
  35016. dependent on being able to modify the target's memory. The KIND,
  35017. COND_LIST, and CMD_LIST arguments have the same meaning as in 'Z0'
  35018. packets.
  35019. _Implementation note: A hardware breakpoint is not affected by code
  35020. movement._
  35021. Reply:
  35022. 'OK'
  35023. success
  35024. ''
  35025. not supported
  35026. 'E NN'
  35027. for an error
  35028. 'z2,ADDR,KIND'
  35029. 'Z2,ADDR,KIND'
  35030. Insert ('Z2') or remove ('z2') a write watchpoint at ADDR. The
  35031. number of bytes to watch is specified by KIND.
  35032. Reply:
  35033. 'OK'
  35034. success
  35035. ''
  35036. not supported
  35037. 'E NN'
  35038. for an error
  35039. 'z3,ADDR,KIND'
  35040. 'Z3,ADDR,KIND'
  35041. Insert ('Z3') or remove ('z3') a read watchpoint at ADDR. The
  35042. number of bytes to watch is specified by KIND.
  35043. Reply:
  35044. 'OK'
  35045. success
  35046. ''
  35047. not supported
  35048. 'E NN'
  35049. for an error
  35050. 'z4,ADDR,KIND'
  35051. 'Z4,ADDR,KIND'
  35052. Insert ('Z4') or remove ('z4') an access watchpoint at ADDR. The
  35053. number of bytes to watch is specified by KIND.
  35054. Reply:
  35055. 'OK'
  35056. success
  35057. ''
  35058. not supported
  35059. 'E NN'
  35060. for an error
  35061. 
  35062. File: gdb.info, Node: Stop Reply Packets, Next: General Query Packets, Prev: Packets, Up: Remote Protocol
  35063. E.3 Stop Reply Packets
  35064. ======================
  35065. The 'C', 'c', 'S', 's', 'vCont', 'vAttach', 'vRun', 'vStopped', and '?'
  35066. packets can receive any of the below as a reply. Except for '?' and
  35067. 'vStopped', that reply is only returned when the target halts. In the
  35068. below the exact meaning of "signal number" is defined by the header
  35069. 'include/gdb/signals.h' in the GDB source code.
  35070. In non-stop mode, the server will simply reply 'OK' to commands such
  35071. as 'vCont'; any stop will be the subject of a future notification.
  35072. *Note Remote Non-Stop::.
  35073. As in the description of request packets, we include spaces in the
  35074. reply templates for clarity; these are not part of the reply packet's
  35075. syntax. No GDB stop reply packet uses spaces to separate its
  35076. components.
  35077. 'S AA'
  35078. The program received signal number AA (a two-digit hexadecimal
  35079. number). This is equivalent to a 'T' response with no N:R pairs.
  35080. 'T AA N1:R1;N2:R2;...'
  35081. The program received signal number AA (a two-digit hexadecimal
  35082. number). This is equivalent to an 'S' response, except that the
  35083. 'N:R' pairs can carry values of important registers and other
  35084. information directly in the stop reply packet, reducing round-trip
  35085. latency. Single-step and breakpoint traps are reported this way.
  35086. Each 'N:R' pair is interpreted as follows:
  35087. * If N is a hexadecimal number, it is a register number, and the
  35088. corresponding R gives that register's value. The data R is a
  35089. series of bytes in target byte order, with each byte given by
  35090. a two-digit hex number.
  35091. * If N is 'thread', then R is the THREAD-ID of the stopped
  35092. thread, as specified in *note thread-id syntax::.
  35093. * If N is 'core', then R is the hexadecimal number of the core
  35094. on which the stop event was detected.
  35095. * If N is a recognized "stop reason", it describes a more
  35096. specific event that stopped the target. The currently defined
  35097. stop reasons are listed below. The AA should be '05', the
  35098. trap signal. At most one stop reason should be present.
  35099. * Otherwise, GDB should ignore this 'N:R' pair and go on to the
  35100. next; this allows us to extend the protocol in the future.
  35101. The currently defined stop reasons are:
  35102. 'watch'
  35103. 'rwatch'
  35104. 'awatch'
  35105. The packet indicates a watchpoint hit, and R is the data
  35106. address, in hex.
  35107. 'syscall_entry'
  35108. 'syscall_return'
  35109. The packet indicates a syscall entry or return, and R is the
  35110. syscall number, in hex.
  35111. 'library'
  35112. The packet indicates that the loaded libraries have changed.
  35113. GDB should use 'qXfer:libraries:read' to fetch a new list of
  35114. loaded libraries. The R part is ignored.
  35115. 'replaylog'
  35116. The packet indicates that the target cannot continue replaying
  35117. logged execution events, because it has reached the end (or
  35118. the beginning when executing backward) of the log. The value
  35119. of R will be either 'begin' or 'end'. *Note Reverse
  35120. Execution::, for more information.
  35121. 'swbreak'
  35122. The packet indicates a software breakpoint instruction was
  35123. executed, irrespective of whether it was GDB that planted the
  35124. breakpoint or the breakpoint is hardcoded in the program. The
  35125. R part must be left empty.
  35126. On some architectures, such as x86, at the architecture level,
  35127. when a breakpoint instruction executes the program counter
  35128. points at the breakpoint address plus an offset. On such
  35129. targets, the stub is responsible for adjusting the PC to point
  35130. back at the breakpoint address.
  35131. This packet should not be sent by default; older GDB versions
  35132. did not support it. GDB requests it, by supplying an
  35133. appropriate 'qSupported' feature (*note qSupported::). The
  35134. remote stub must also supply the appropriate 'qSupported'
  35135. feature indicating support.
  35136. This packet is required for correct non-stop mode operation.
  35137. 'hwbreak'
  35138. The packet indicates the target stopped for a hardware
  35139. breakpoint. The R part must be left empty.
  35140. The same remarks about 'qSupported' and non-stop mode above
  35141. apply.
  35142. 'fork'
  35143. The packet indicates that 'fork' was called, and R is the
  35144. thread ID of the new child process. Refer to *note thread-id
  35145. syntax:: for the format of the THREAD-ID field. This packet
  35146. is only applicable to targets that support fork events.
  35147. This packet should not be sent by default; older GDB versions
  35148. did not support it. GDB requests it, by supplying an
  35149. appropriate 'qSupported' feature (*note qSupported::). The
  35150. remote stub must also supply the appropriate 'qSupported'
  35151. feature indicating support.
  35152. 'vfork'
  35153. The packet indicates that 'vfork' was called, and R is the
  35154. thread ID of the new child process. Refer to *note thread-id
  35155. syntax:: for the format of the THREAD-ID field. This packet
  35156. is only applicable to targets that support vfork events.
  35157. This packet should not be sent by default; older GDB versions
  35158. did not support it. GDB requests it, by supplying an
  35159. appropriate 'qSupported' feature (*note qSupported::). The
  35160. remote stub must also supply the appropriate 'qSupported'
  35161. feature indicating support.
  35162. 'vforkdone'
  35163. The packet indicates that a child process created by a vfork
  35164. has either called 'exec' or terminated, so that the address
  35165. spaces of the parent and child process are no longer shared.
  35166. The R part is ignored. This packet is only applicable to
  35167. targets that support vforkdone events.
  35168. This packet should not be sent by default; older GDB versions
  35169. did not support it. GDB requests it, by supplying an
  35170. appropriate 'qSupported' feature (*note qSupported::). The
  35171. remote stub must also supply the appropriate 'qSupported'
  35172. feature indicating support.
  35173. 'exec'
  35174. The packet indicates that 'execve' was called, and R is the
  35175. absolute pathname of the file that was executed, in hex. This
  35176. packet is only applicable to targets that support exec events.
  35177. This packet should not be sent by default; older GDB versions
  35178. did not support it. GDB requests it, by supplying an
  35179. appropriate 'qSupported' feature (*note qSupported::). The
  35180. remote stub must also supply the appropriate 'qSupported'
  35181. feature indicating support.
  35182. 'create'
  35183. The packet indicates that the thread was just created. The
  35184. new thread is stopped until GDB sets it running with a
  35185. resumption packet (*note vCont packet::). This packet should
  35186. not be sent by default; GDB requests it with the *note
  35187. QThreadEvents:: packet. See also the 'w' (*note thread exit
  35188. event::) remote reply below. The R part is ignored.
  35189. 'W AA'
  35190. 'W AA ; process:PID'
  35191. The process exited, and AA is the exit status. This is only
  35192. applicable to certain targets.
  35193. The second form of the response, including the process ID of the
  35194. exited process, can be used only when GDB has reported support for
  35195. multiprocess protocol extensions; see *note multiprocess
  35196. extensions::. Both AA and PID are formatted as big-endian hex
  35197. strings.
  35198. 'X AA'
  35199. 'X AA ; process:PID'
  35200. The process terminated with signal AA.
  35201. The second form of the response, including the process ID of the
  35202. terminated process, can be used only when GDB has reported support
  35203. for multiprocess protocol extensions; see *note multiprocess
  35204. extensions::. Both AA and PID are formatted as big-endian hex
  35205. strings.
  35206. 'w AA ; TID'
  35207. The thread exited, and AA is the exit status. This response should
  35208. not be sent by default; GDB requests it with the *note
  35209. QThreadEvents:: packet. See also *note thread create event::
  35210. above. AA is formatted as a big-endian hex string.
  35211. 'N'
  35212. There are no resumed threads left in the target. In other words,
  35213. even though the process is alive, the last resumed thread has
  35214. exited. For example, say the target process has two threads:
  35215. thread 1 and thread 2. The client leaves thread 1 stopped, and
  35216. resumes thread 2, which subsequently exits. At this point, even
  35217. though the process is still alive, and thus no 'W' stop reply is
  35218. sent, no thread is actually executing either. The 'N' stop reply
  35219. thus informs the client that it can stop waiting for stop replies.
  35220. This packet should not be sent by default; older GDB versions did
  35221. not support it. GDB requests it, by supplying an appropriate
  35222. 'qSupported' feature (*note qSupported::). The remote stub must
  35223. also supply the appropriate 'qSupported' feature indicating
  35224. support.
  35225. 'O XX...'
  35226. 'XX...' is hex encoding of ASCII data, to be written as the
  35227. program's console output. This can happen at any time while the
  35228. program is running and the debugger should continue to wait for
  35229. 'W', 'T', etc. This reply is not permitted in non-stop mode.
  35230. 'F CALL-ID,PARAMETER...'
  35231. CALL-ID is the identifier which says which host system call should
  35232. be called. This is just the name of the function. Translation
  35233. into the correct system call is only applicable as it's defined in
  35234. GDB. *Note File-I/O Remote Protocol Extension::, for a list of
  35235. implemented system calls.
  35236. 'PARAMETER...' is a list of parameters as defined for this very
  35237. system call.
  35238. The target replies with this packet when it expects GDB to call a
  35239. host system call on behalf of the target. GDB replies with an
  35240. appropriate 'F' packet and keeps up waiting for the next reply
  35241. packet from the target. The latest 'C', 'c', 'S' or 's' action is
  35242. expected to be continued. *Note File-I/O Remote Protocol
  35243. Extension::, for more details.
  35244. 
  35245. File: gdb.info, Node: General Query Packets, Next: Architecture-Specific Protocol Details, Prev: Stop Reply Packets, Up: Remote Protocol
  35246. E.4 General Query Packets
  35247. =========================
  35248. Packets starting with 'q' are "general query packets"; packets starting
  35249. with 'Q' are "general set packets". General query and set packets are a
  35250. semi-unified form for retrieving and sending information to and from the
  35251. stub.
  35252. The initial letter of a query or set packet is followed by a name
  35253. indicating what sort of thing the packet applies to. For example, GDB
  35254. may use a 'qSymbol' packet to exchange symbol definitions with the stub.
  35255. These packet names follow some conventions:
  35256. * The name must not contain commas, colons or semicolons.
  35257. * Most GDB query and set packets have a leading upper case letter.
  35258. * The names of custom vendor packets should use a company prefix, in
  35259. lower case, followed by a period. For example, packets designed at
  35260. the Acme Corporation might begin with 'qacme.foo' (for querying
  35261. foos) or 'Qacme.bar' (for setting bars).
  35262. The name of a query or set packet should be separated from any
  35263. parameters by a ':'; the parameters themselves should be separated by
  35264. ',' or ';'. Stubs must be careful to match the full packet name, and
  35265. check for a separator or the end of the packet, in case two packet names
  35266. share a common prefix. New packets should not begin with 'qC', 'qP', or
  35267. 'qL'(1).
  35268. Like the descriptions of the other packets, each description here has
  35269. a template showing the packet's overall syntax, followed by an
  35270. explanation of the packet's meaning. We include spaces in some of the
  35271. templates for clarity; these are not part of the packet's syntax. No
  35272. GDB packet uses spaces to separate its components.
  35273. Here are the currently defined query and set packets:
  35274. 'QAgent:1'
  35275. 'QAgent:0'
  35276. Turn on or off the agent as a helper to perform some debugging
  35277. operations delegated from GDB (*note Control Agent::).
  35278. 'QAllow:OP:VAL...'
  35279. Specify which operations GDB expects to request of the target, as a
  35280. semicolon-separated list of operation name and value pairs.
  35281. Possible values for OP include 'WriteReg', 'WriteMem',
  35282. 'InsertBreak', 'InsertTrace', 'InsertFastTrace', and 'Stop'. VAL
  35283. is either 0, indicating that GDB will not request the operation, or
  35284. 1, indicating that it may. (The target can then use this to set up
  35285. its own internals optimally, for instance if the debugger never
  35286. expects to insert breakpoints, it may not need to install its own
  35287. trap handler.)
  35288. 'qC'
  35289. Return the current thread ID.
  35290. Reply:
  35291. 'QC THREAD-ID'
  35292. Where THREAD-ID is a thread ID as documented in *note
  35293. thread-id syntax::.
  35294. '(anything else)'
  35295. Any other reply implies the old thread ID.
  35296. 'qCRC:ADDR,LENGTH'
  35297. Compute the CRC checksum of a block of memory using CRC-32 defined
  35298. in IEEE 802.3. The CRC is computed byte at a time, taking the most
  35299. significant bit of each byte first. The initial pattern code
  35300. '0xffffffff' is used to ensure leading zeros affect the CRC.
  35301. _Note:_ This is the same CRC used in validating separate debug
  35302. files (*note Debugging Information in Separate Files: Separate
  35303. Debug Files.). However the algorithm is slightly different. When
  35304. validating separate debug files, the CRC is computed taking the
  35305. _least_ significant bit of each byte first, and the final result is
  35306. inverted to detect trailing zeros.
  35307. Reply:
  35308. 'E NN'
  35309. An error (such as memory fault)
  35310. 'C CRC32'
  35311. The specified memory region's checksum is CRC32.
  35312. 'QDisableRandomization:VALUE'
  35313. Some target operating systems will randomize the virtual address
  35314. space of the inferior process as a security feature, but provide a
  35315. feature to disable such randomization, e.g. to allow for a more
  35316. deterministic debugging experience. On such systems, this packet
  35317. with a VALUE of 1 directs the target to disable address space
  35318. randomization for processes subsequently started via 'vRun'
  35319. packets, while a packet with a VALUE of 0 tells the target to
  35320. enable address space randomization.
  35321. This packet is only available in extended mode (*note extended
  35322. mode::).
  35323. Reply:
  35324. 'OK'
  35325. The request succeeded.
  35326. 'E NN'
  35327. An error occurred. The error number NN is given as hex
  35328. digits.
  35329. ''
  35330. An empty reply indicates that 'QDisableRandomization' is not
  35331. supported by the stub.
  35332. This packet is not probed by default; the remote stub must request
  35333. it, by supplying an appropriate 'qSupported' response (*note
  35334. qSupported::). This should only be done on targets that actually
  35335. support disabling address space randomization.
  35336. 'QStartupWithShell:VALUE'
  35337. On UNIX-like targets, it is possible to start the inferior using a
  35338. shell program. This is the default behavior on both GDB and
  35339. 'gdbserver' (*note set startup-with-shell::). This packet is used
  35340. to inform 'gdbserver' whether it should start the inferior using a
  35341. shell or not.
  35342. If VALUE is '0', 'gdbserver' will not use a shell to start the
  35343. inferior. If VALUE is '1', 'gdbserver' will use a shell to start
  35344. the inferior. All other values are considered an error.
  35345. This packet is only available in extended mode (*note extended
  35346. mode::).
  35347. Reply:
  35348. 'OK'
  35349. The request succeeded.
  35350. 'E NN'
  35351. An error occurred. The error number NN is given as hex
  35352. digits.
  35353. This packet is not probed by default; the remote stub must request
  35354. it, by supplying an appropriate 'qSupported' response (*note
  35355. qSupported::). This should only be done on targets that actually
  35356. support starting the inferior using a shell.
  35357. Use of this packet is controlled by the 'set startup-with-shell'
  35358. command; *note set startup-with-shell::.
  35359. 'QEnvironmentHexEncoded:HEX-VALUE'
  35360. On UNIX-like targets, it is possible to set environment variables
  35361. that will be passed to the inferior during the startup process.
  35362. This packet is used to inform 'gdbserver' of an environment
  35363. variable that has been defined by the user on GDB (*note set
  35364. environment::).
  35365. The packet is composed by HEX-VALUE, an hex encoded representation
  35366. of the NAME=VALUE format representing an environment variable. The
  35367. name of the environment variable is represented by NAME, and the
  35368. value to be assigned to the environment variable is represented by
  35369. VALUE. If the variable has no value (i.e., the value is 'null'),
  35370. then VALUE will not be present.
  35371. This packet is only available in extended mode (*note extended
  35372. mode::).
  35373. Reply:
  35374. 'OK'
  35375. The request succeeded.
  35376. This packet is not probed by default; the remote stub must request
  35377. it, by supplying an appropriate 'qSupported' response (*note
  35378. qSupported::). This should only be done on targets that actually
  35379. support passing environment variables to the starting inferior.
  35380. This packet is related to the 'set environment' command; *note set
  35381. environment::.
  35382. 'QEnvironmentUnset:HEX-VALUE'
  35383. On UNIX-like targets, it is possible to unset environment variables
  35384. before starting the inferior in the remote target. This packet is
  35385. used to inform 'gdbserver' of an environment variable that has been
  35386. unset by the user on GDB (*note unset environment::).
  35387. The packet is composed by HEX-VALUE, an hex encoded representation
  35388. of the name of the environment variable to be unset.
  35389. This packet is only available in extended mode (*note extended
  35390. mode::).
  35391. Reply:
  35392. 'OK'
  35393. The request succeeded.
  35394. This packet is not probed by default; the remote stub must request
  35395. it, by supplying an appropriate 'qSupported' response (*note
  35396. qSupported::). This should only be done on targets that actually
  35397. support passing environment variables to the starting inferior.
  35398. This packet is related to the 'unset environment' command; *note
  35399. unset environment::.
  35400. 'QEnvironmentReset'
  35401. On UNIX-like targets, this packet is used to reset the state of
  35402. environment variables in the remote target before starting the
  35403. inferior. In this context, reset means unsetting all environment
  35404. variables that were previously set by the user (i.e., were not
  35405. initially present in the environment). It is sent to 'gdbserver'
  35406. before the 'QEnvironmentHexEncoded' (*note
  35407. QEnvironmentHexEncoded::) and the 'QEnvironmentUnset' (*note
  35408. QEnvironmentUnset::) packets.
  35409. This packet is only available in extended mode (*note extended
  35410. mode::).
  35411. Reply:
  35412. 'OK'
  35413. The request succeeded.
  35414. This packet is not probed by default; the remote stub must request
  35415. it, by supplying an appropriate 'qSupported' response (*note
  35416. qSupported::). This should only be done on targets that actually
  35417. support passing environment variables to the starting inferior.
  35418. 'QSetWorkingDir:[DIRECTORY]'
  35419. This packet is used to inform the remote server of the intended
  35420. current working directory for programs that are going to be
  35421. executed.
  35422. The packet is composed by DIRECTORY, an hex encoded representation
  35423. of the directory that the remote inferior will use as its current
  35424. working directory. If DIRECTORY is an empty string, the remote
  35425. server should reset the inferior's current working directory to its
  35426. original, empty value.
  35427. This packet is only available in extended mode (*note extended
  35428. mode::).
  35429. Reply:
  35430. 'OK'
  35431. The request succeeded.
  35432. 'qfThreadInfo'
  35433. 'qsThreadInfo'
  35434. Obtain a list of all active thread IDs from the target (OS). Since
  35435. there may be too many active threads to fit into one reply packet,
  35436. this query works iteratively: it may require more than one
  35437. query/reply sequence to obtain the entire list of threads. The
  35438. first query of the sequence will be the 'qfThreadInfo' query;
  35439. subsequent queries in the sequence will be the 'qsThreadInfo'
  35440. query.
  35441. NOTE: This packet replaces the 'qL' query (see below).
  35442. Reply:
  35443. 'm THREAD-ID'
  35444. A single thread ID
  35445. 'm THREAD-ID,THREAD-ID...'
  35446. a comma-separated list of thread IDs
  35447. 'l'
  35448. (lower case letter 'L') denotes end of list.
  35449. In response to each query, the target will reply with a list of one
  35450. or more thread IDs, separated by commas. GDB will respond to each
  35451. reply with a request for more thread ids (using the 'qs' form of
  35452. the query), until the target responds with 'l' (lower-case ell, for
  35453. "last"). Refer to *note thread-id syntax::, for the format of the
  35454. THREAD-ID fields.
  35455. _Note: GDB will send the 'qfThreadInfo' query during the initial
  35456. connection with the remote target, and the very first thread ID
  35457. mentioned in the reply will be stopped by GDB in a subsequent
  35458. message. Therefore, the stub should ensure that the first thread
  35459. ID in the 'qfThreadInfo' reply is suitable for being stopped by
  35460. GDB._
  35461. 'qGetTLSAddr:THREAD-ID,OFFSET,LM'
  35462. Fetch the address associated with thread local storage specified by
  35463. THREAD-ID, OFFSET, and LM.
  35464. THREAD-ID is the thread ID associated with the thread for which to
  35465. fetch the TLS address. *Note thread-id syntax::.
  35466. OFFSET is the (big endian, hex encoded) offset associated with the
  35467. thread local variable. (This offset is obtained from the debug
  35468. information associated with the variable.)
  35469. LM is the (big endian, hex encoded) OS/ABI-specific encoding of the
  35470. load module associated with the thread local storage. For example,
  35471. a GNU/Linux system will pass the link map address of the shared
  35472. object associated with the thread local storage under
  35473. consideration. Other operating environments may choose to
  35474. represent the load module differently, so the precise meaning of
  35475. this parameter will vary.
  35476. Reply:
  35477. 'XX...'
  35478. Hex encoded (big endian) bytes representing the address of the
  35479. thread local storage requested.
  35480. 'E NN'
  35481. An error occurred. The error number NN is given as hex
  35482. digits.
  35483. ''
  35484. An empty reply indicates that 'qGetTLSAddr' is not supported
  35485. by the stub.
  35486. 'qGetTIBAddr:THREAD-ID'
  35487. Fetch address of the Windows OS specific Thread Information Block.
  35488. THREAD-ID is the thread ID associated with the thread.
  35489. Reply:
  35490. 'XX...'
  35491. Hex encoded (big endian) bytes representing the linear address
  35492. of the thread information block.
  35493. 'E NN'
  35494. An error occured. This means that either the thread was not
  35495. found, or the address could not be retrieved.
  35496. ''
  35497. An empty reply indicates that 'qGetTIBAddr' is not supported
  35498. by the stub.
  35499. 'qL STARTFLAG THREADCOUNT NEXTTHREAD'
  35500. Obtain thread information from RTOS. Where: STARTFLAG (one hex
  35501. digit) is one to indicate the first query and zero to indicate a
  35502. subsequent query; THREADCOUNT (two hex digits) is the maximum
  35503. number of threads the response packet can contain; and NEXTTHREAD
  35504. (eight hex digits), for subsequent queries (STARTFLAG is zero), is
  35505. returned in the response as ARGTHREAD.
  35506. Don't use this packet; use the 'qfThreadInfo' query instead (see
  35507. above).
  35508. Reply:
  35509. 'qM COUNT DONE ARGTHREAD THREAD...'
  35510. Where: COUNT (two hex digits) is the number of threads being
  35511. returned; DONE (one hex digit) is zero to indicate more
  35512. threads and one indicates no further threads; ARGTHREADID
  35513. (eight hex digits) is NEXTTHREAD from the request packet;
  35514. THREAD... is a sequence of thread IDs, THREADID (eight hex
  35515. digits), from the target. See
  35516. 'remote.c:parse_threadlist_response()'.
  35517. 'qOffsets'
  35518. Get section offsets that the target used when relocating the
  35519. downloaded image.
  35520. Reply:
  35521. 'Text=XXX;Data=YYY[;Bss=ZZZ]'
  35522. Relocate the 'Text' section by XXX from its original address.
  35523. Relocate the 'Data' section by YYY from its original address.
  35524. If the object file format provides segment information (e.g.
  35525. ELF 'PT_LOAD' program headers), GDB will relocate entire
  35526. segments by the supplied offsets.
  35527. _Note: while a 'Bss' offset may be included in the response,
  35528. GDB ignores this and instead applies the 'Data' offset to the
  35529. 'Bss' section._
  35530. 'TextSeg=XXX[;DataSeg=YYY]'
  35531. Relocate the first segment of the object file, which
  35532. conventionally contains program code, to a starting address of
  35533. XXX. If 'DataSeg' is specified, relocate the second segment,
  35534. which conventionally contains modifiable data, to a starting
  35535. address of YYY. GDB will report an error if the object file
  35536. does not contain segment information, or does not contain at
  35537. least as many segments as mentioned in the reply. Extra
  35538. segments are kept at fixed offsets relative to the last
  35539. relocated segment.
  35540. 'qP MODE THREAD-ID'
  35541. Returns information on THREAD-ID. Where: MODE is a hex encoded 32
  35542. bit mode; THREAD-ID is a thread ID (*note thread-id syntax::).
  35543. Don't use this packet; use the 'qThreadExtraInfo' query instead
  35544. (see below).
  35545. Reply: see 'remote.c:remote_unpack_thread_info_response()'.
  35546. 'QNonStop:1'
  35547. 'QNonStop:0'
  35548. Enter non-stop ('QNonStop:1') or all-stop ('QNonStop:0') mode.
  35549. *Note Remote Non-Stop::, for more information.
  35550. Reply:
  35551. 'OK'
  35552. The request succeeded.
  35553. 'E NN'
  35554. An error occurred. The error number NN is given as hex
  35555. digits.
  35556. ''
  35557. An empty reply indicates that 'QNonStop' is not supported by
  35558. the stub.
  35559. This packet is not probed by default; the remote stub must request
  35560. it, by supplying an appropriate 'qSupported' response (*note
  35561. qSupported::). Use of this packet is controlled by the 'set
  35562. non-stop' command; *note Non-Stop Mode::.
  35563. 'QCatchSyscalls:1 [;SYSNO]...'
  35564. 'QCatchSyscalls:0'
  35565. Enable ('QCatchSyscalls:1') or disable ('QCatchSyscalls:0')
  35566. catching syscalls from the inferior process.
  35567. For 'QCatchSyscalls:1', each listed syscall SYSNO (encoded in hex)
  35568. should be reported to GDB. If no syscall SYSNO is listed, every
  35569. system call should be reported.
  35570. Note that if a syscall not in the list is reported, GDB will still
  35571. filter the event according to its own list from all corresponding
  35572. 'catch syscall' commands. However, it is more efficient to only
  35573. report the requested syscalls.
  35574. Multiple 'QCatchSyscalls:1' packets do not combine; any earlier
  35575. 'QCatchSyscalls:1' list is completely replaced by the new list.
  35576. If the inferior process execs, the state of 'QCatchSyscalls' is
  35577. kept for the new process too. On targets where exec may affect
  35578. syscall numbers, for example with exec between 32 and 64-bit
  35579. processes, the client should send a new packet with the new syscall
  35580. list.
  35581. Reply:
  35582. 'OK'
  35583. The request succeeded.
  35584. 'E NN'
  35585. An error occurred. NN are hex digits.
  35586. ''
  35587. An empty reply indicates that 'QCatchSyscalls' is not
  35588. supported by the stub.
  35589. Use of this packet is controlled by the 'set remote catch-syscalls'
  35590. command (*note set remote catch-syscalls: Remote Configuration.).
  35591. This packet is not probed by default; the remote stub must request
  35592. it, by supplying an appropriate 'qSupported' response (*note
  35593. qSupported::).
  35594. 'QPassSignals: SIGNAL [;SIGNAL]...'
  35595. Each listed SIGNAL should be passed directly to the inferior
  35596. process. Signals are numbered identically to continue packets and
  35597. stop replies (*note Stop Reply Packets::). Each SIGNAL list item
  35598. should be strictly greater than the previous item. These signals
  35599. do not need to stop the inferior, or be reported to GDB. All other
  35600. signals should be reported to GDB. Multiple 'QPassSignals' packets
  35601. do not combine; any earlier 'QPassSignals' list is completely
  35602. replaced by the new list. This packet improves performance when
  35603. using 'handle SIGNAL nostop noprint pass'.
  35604. Reply:
  35605. 'OK'
  35606. The request succeeded.
  35607. 'E NN'
  35608. An error occurred. The error number NN is given as hex
  35609. digits.
  35610. ''
  35611. An empty reply indicates that 'QPassSignals' is not supported
  35612. by the stub.
  35613. Use of this packet is controlled by the 'set remote pass-signals'
  35614. command (*note set remote pass-signals: Remote Configuration.).
  35615. This packet is not probed by default; the remote stub must request
  35616. it, by supplying an appropriate 'qSupported' response (*note
  35617. qSupported::).
  35618. 'QProgramSignals: SIGNAL [;SIGNAL]...'
  35619. Each listed SIGNAL may be delivered to the inferior process.
  35620. Others should be silently discarded.
  35621. In some cases, the remote stub may need to decide whether to
  35622. deliver a signal to the program or not without GDB involvement.
  35623. One example of that is while detaching -- the program's threads may
  35624. have stopped for signals that haven't yet had a chance of being
  35625. reported to GDB, and so the remote stub can use the signal list
  35626. specified by this packet to know whether to deliver or ignore those
  35627. pending signals.
  35628. This does not influence whether to deliver a signal as requested by
  35629. a resumption packet (*note vCont packet::).
  35630. Signals are numbered identically to continue packets and stop
  35631. replies (*note Stop Reply Packets::). Each SIGNAL list item should
  35632. be strictly greater than the previous item. Multiple
  35633. 'QProgramSignals' packets do not combine; any earlier
  35634. 'QProgramSignals' list is completely replaced by the new list.
  35635. Reply:
  35636. 'OK'
  35637. The request succeeded.
  35638. 'E NN'
  35639. An error occurred. The error number NN is given as hex
  35640. digits.
  35641. ''
  35642. An empty reply indicates that 'QProgramSignals' is not
  35643. supported by the stub.
  35644. Use of this packet is controlled by the 'set remote
  35645. program-signals' command (*note set remote program-signals: Remote
  35646. Configuration.). This packet is not probed by default; the remote
  35647. stub must request it, by supplying an appropriate 'qSupported'
  35648. response (*note qSupported::).
  35649. 'QThreadEvents:1'
  35650. 'QThreadEvents:0'
  35651. Enable ('QThreadEvents:1') or disable ('QThreadEvents:0') reporting
  35652. of thread create and exit events. *Note thread create event::, for
  35653. the reply specifications. For example, this is used in non-stop
  35654. mode when GDB stops a set of threads and synchronously waits for
  35655. the their corresponding stop replies. Without exit events, if one
  35656. of the threads exits, GDB would hang forever not knowing that it
  35657. should no longer expect a stop for that same thread. GDB does not
  35658. enable this feature unless the stub reports that it supports it by
  35659. including 'QThreadEvents+' in its 'qSupported' reply.
  35660. Reply:
  35661. 'OK'
  35662. The request succeeded.
  35663. 'E NN'
  35664. An error occurred. The error number NN is given as hex
  35665. digits.
  35666. ''
  35667. An empty reply indicates that 'QThreadEvents' is not supported
  35668. by the stub.
  35669. Use of this packet is controlled by the 'set remote thread-events'
  35670. command (*note set remote thread-events: Remote Configuration.).
  35671. 'qRcmd,COMMAND'
  35672. COMMAND (hex encoded) is passed to the local interpreter for
  35673. execution. Invalid commands should be reported using the output
  35674. string. Before the final result packet, the target may also
  35675. respond with a number of intermediate 'OOUTPUT' console output
  35676. packets. _Implementors should note that providing access to a
  35677. stubs's interpreter may have security implications_.
  35678. Reply:
  35679. 'OK'
  35680. A command response with no output.
  35681. 'OUTPUT'
  35682. A command response with the hex encoded output string OUTPUT.
  35683. 'E NN'
  35684. Indicate a badly formed request.
  35685. ''
  35686. An empty reply indicates that 'qRcmd' is not recognized.
  35687. (Note that the 'qRcmd' packet's name is separated from the command
  35688. by a ',', not a ':', contrary to the naming conventions above.
  35689. Please don't use this packet as a model for new packets.)
  35690. 'qSearch:memory:ADDRESS;LENGTH;SEARCH-PATTERN'
  35691. Search LENGTH bytes at ADDRESS for SEARCH-PATTERN. Both ADDRESS
  35692. and LENGTH are encoded in hex; SEARCH-PATTERN is a sequence of
  35693. bytes, also hex encoded.
  35694. Reply:
  35695. '0'
  35696. The pattern was not found.
  35697. '1,address'
  35698. The pattern was found at ADDRESS.
  35699. 'E NN'
  35700. A badly formed request or an error was encountered while
  35701. searching memory.
  35702. ''
  35703. An empty reply indicates that 'qSearch:memory' is not
  35704. recognized.
  35705. 'QStartNoAckMode'
  35706. Request that the remote stub disable the normal '+'/'-' protocol
  35707. acknowledgments (*note Packet Acknowledgment::).
  35708. Reply:
  35709. 'OK'
  35710. The stub has switched to no-acknowledgment mode. GDB
  35711. acknowledges this response, but neither the stub nor GDB shall
  35712. send or expect further '+'/'-' acknowledgments in the current
  35713. connection.
  35714. ''
  35715. An empty reply indicates that the stub does not support
  35716. no-acknowledgment mode.
  35717. 'qSupported [:GDBFEATURE [;GDBFEATURE]... ]'
  35718. Tell the remote stub about features supported by GDB, and query the
  35719. stub for features it supports. This packet allows GDB and the
  35720. remote stub to take advantage of each others' features.
  35721. 'qSupported' also consolidates multiple feature probes at startup,
  35722. to improve GDB performance--a single larger packet performs better
  35723. than multiple smaller probe packets on high-latency links. Some
  35724. features may enable behavior which must not be on by default, e.g.
  35725. because it would confuse older clients or stubs. Other features
  35726. may describe packets which could be automatically probed for, but
  35727. are not. These features must be reported before GDB will use them.
  35728. This "default unsupported" behavior is not appropriate for all
  35729. packets, but it helps to keep the initial connection time under
  35730. control with new versions of GDB which support increasing numbers
  35731. of packets.
  35732. Reply:
  35733. 'STUBFEATURE [;STUBFEATURE]...'
  35734. The stub supports or does not support each returned
  35735. STUBFEATURE, depending on the form of each STUBFEATURE (see
  35736. below for the possible forms).
  35737. ''
  35738. An empty reply indicates that 'qSupported' is not recognized,
  35739. or that no features needed to be reported to GDB.
  35740. The allowed forms for each feature (either a GDBFEATURE in the
  35741. 'qSupported' packet, or a STUBFEATURE in the response) are:
  35742. 'NAME=VALUE'
  35743. The remote protocol feature NAME is supported, and associated
  35744. with the specified VALUE. The format of VALUE depends on the
  35745. feature, but it must not include a semicolon.
  35746. 'NAME+'
  35747. The remote protocol feature NAME is supported, and does not
  35748. need an associated value.
  35749. 'NAME-'
  35750. The remote protocol feature NAME is not supported.
  35751. 'NAME?'
  35752. The remote protocol feature NAME may be supported, and GDB
  35753. should auto-detect support in some other way when it is
  35754. needed. This form will not be used for GDBFEATURE
  35755. notifications, but may be used for STUBFEATURE responses.
  35756. Whenever the stub receives a 'qSupported' request, the supplied set
  35757. of GDB features should override any previous request. This allows
  35758. GDB to put the stub in a known state, even if the stub had
  35759. previously been communicating with a different version of GDB.
  35760. The following values of GDBFEATURE (for the packet sent by GDB) are
  35761. defined:
  35762. 'multiprocess'
  35763. This feature indicates whether GDB supports multiprocess
  35764. extensions to the remote protocol. GDB does not use such
  35765. extensions unless the stub also reports that it supports them
  35766. by including 'multiprocess+' in its 'qSupported' reply. *Note
  35767. multiprocess extensions::, for details.
  35768. 'xmlRegisters'
  35769. This feature indicates that GDB supports the XML target
  35770. description. If the stub sees 'xmlRegisters=' with target
  35771. specific strings separated by a comma, it will report register
  35772. description.
  35773. 'qRelocInsn'
  35774. This feature indicates whether GDB supports the 'qRelocInsn'
  35775. packet (*note Relocate instruction reply packet: Tracepoint
  35776. Packets.).
  35777. 'swbreak'
  35778. This feature indicates whether GDB supports the swbreak stop
  35779. reason in stop replies. *Note swbreak stop reason::, for
  35780. details.
  35781. 'hwbreak'
  35782. This feature indicates whether GDB supports the hwbreak stop
  35783. reason in stop replies. *Note swbreak stop reason::, for
  35784. details.
  35785. 'fork-events'
  35786. This feature indicates whether GDB supports fork event
  35787. extensions to the remote protocol. GDB does not use such
  35788. extensions unless the stub also reports that it supports them
  35789. by including 'fork-events+' in its 'qSupported' reply.
  35790. 'vfork-events'
  35791. This feature indicates whether GDB supports vfork event
  35792. extensions to the remote protocol. GDB does not use such
  35793. extensions unless the stub also reports that it supports them
  35794. by including 'vfork-events+' in its 'qSupported' reply.
  35795. 'exec-events'
  35796. This feature indicates whether GDB supports exec event
  35797. extensions to the remote protocol. GDB does not use such
  35798. extensions unless the stub also reports that it supports them
  35799. by including 'exec-events+' in its 'qSupported' reply.
  35800. 'vContSupported'
  35801. This feature indicates whether GDB wants to know the supported
  35802. actions in the reply to 'vCont?' packet.
  35803. Stubs should ignore any unknown values for GDBFEATURE. Any GDB
  35804. which sends a 'qSupported' packet supports receiving packets of
  35805. unlimited length (earlier versions of GDB may reject overly long
  35806. responses). Additional values for GDBFEATURE may be defined in the
  35807. future to let the stub take advantage of new features in GDB, e.g.
  35808. incompatible improvements in the remote protocol--the
  35809. 'multiprocess' feature is an example of such a feature. The stub's
  35810. reply should be independent of the GDBFEATURE entries sent by GDB;
  35811. first GDB describes all the features it supports, and then the stub
  35812. replies with all the features it supports.
  35813. Similarly, GDB will silently ignore unrecognized stub feature
  35814. responses, as long as each response uses one of the standard forms.
  35815. Some features are flags. A stub which supports a flag feature
  35816. should respond with a '+' form response. Other features require
  35817. values, and the stub should respond with an '=' form response.
  35818. Each feature has a default value, which GDB will use if
  35819. 'qSupported' is not available or if the feature is not mentioned in
  35820. the 'qSupported' response. The default values are fixed; a stub is
  35821. free to omit any feature responses that match the defaults.
  35822. Not all features can be probed, but for those which can, the
  35823. probing mechanism is useful: in some cases, a stub's internal
  35824. architecture may not allow the protocol layer to know some
  35825. information about the underlying target in advance. This is
  35826. especially common in stubs which may be configured for multiple
  35827. targets.
  35828. These are the currently defined stub features and their properties:
  35829. Feature Name Value Default Probe
  35830. Required Allowed
  35831. 'PacketSize' Yes '-' No
  35832. 'qXfer:auxv:read' No '-' Yes
  35833. 'qXfer:btrace:read' No '-' Yes
  35834. 'qXfer:btrace-conf:read' No '-' Yes
  35835. 'qXfer:exec-file:read' No '-' Yes
  35836. 'qXfer:features:read' No '-' Yes
  35837. 'qXfer:libraries:read' No '-' Yes
  35838. 'qXfer:libraries-svr4:read'No '-' Yes
  35839. 'augmented-libraries-svr4-read'No '-' No
  35840. 'qXfer:memory-map:read' No '-' Yes
  35841. 'qXfer:sdata:read' No '-' Yes
  35842. 'qXfer:siginfo:read' No '-' Yes
  35843. 'qXfer:siginfo:write' No '-' Yes
  35844. 'qXfer:threads:read' No '-' Yes
  35845. 'qXfer:traceframe-info:read'No '-' Yes
  35846. 'qXfer:uib:read' No '-' Yes
  35847. 'qXfer:fdpic:read' No '-' Yes
  35848. 'Qbtrace:off' Yes '-' Yes
  35849. 'Qbtrace:bts' Yes '-' Yes
  35850. 'Qbtrace:pt' Yes '-' Yes
  35851. 'Qbtrace-conf:bts:size' Yes '-' Yes
  35852. 'Qbtrace-conf:pt:size' Yes '-' Yes
  35853. 'QNonStop' No '-' Yes
  35854. 'QCatchSyscalls' No '-' Yes
  35855. 'QPassSignals' No '-' Yes
  35856. 'QStartNoAckMode' No '-' Yes
  35857. 'multiprocess' No '-' No
  35858. 'ConditionalBreakpoints' No '-' No
  35859. 'ConditionalTracepoints' No '-' No
  35860. 'ReverseContinue' No '-' No
  35861. 'ReverseStep' No '-' No
  35862. 'TracepointSource' No '-' No
  35863. 'QAgent' No '-' No
  35864. 'QAllow' No '-' No
  35865. 'QDisableRandomization' No '-' No
  35866. 'EnableDisableTracepoints'No '-' No
  35867. 'QTBuffer:size' No '-' No
  35868. 'tracenz' No '-' No
  35869. 'BreakpointCommands' No '-' No
  35870. 'swbreak' No '-' No
  35871. 'hwbreak' No '-' No
  35872. 'fork-events' No '-' No
  35873. 'vfork-events' No '-' No
  35874. 'exec-events' No '-' No
  35875. 'QThreadEvents' No '-' No
  35876. 'no-resumed' No '-' No
  35877. These are the currently defined stub features, in more detail:
  35878. 'PacketSize=BYTES'
  35879. The remote stub can accept packets up to at least BYTES in
  35880. length. GDB will send packets up to this size for bulk
  35881. transfers, and will never send larger packets. This is a
  35882. limit on the data characters in the packet, including the
  35883. frame and checksum. There is no trailing NUL byte in a remote
  35884. protocol packet; if the stub stores packets in a
  35885. NUL-terminated format, it should allow an extra byte in its
  35886. buffer for the NUL. If this stub feature is not supported, GDB
  35887. guesses based on the size of the 'g' packet response.
  35888. 'qXfer:auxv:read'
  35889. The remote stub understands the 'qXfer:auxv:read' packet
  35890. (*note qXfer auxiliary vector read::).
  35891. 'qXfer:btrace:read'
  35892. The remote stub understands the 'qXfer:btrace:read' packet
  35893. (*note qXfer btrace read::).
  35894. 'qXfer:btrace-conf:read'
  35895. The remote stub understands the 'qXfer:btrace-conf:read'
  35896. packet (*note qXfer btrace-conf read::).
  35897. 'qXfer:exec-file:read'
  35898. The remote stub understands the 'qXfer:exec-file:read' packet
  35899. (*note qXfer executable filename read::).
  35900. 'qXfer:features:read'
  35901. The remote stub understands the 'qXfer:features:read' packet
  35902. (*note qXfer target description read::).
  35903. 'qXfer:libraries:read'
  35904. The remote stub understands the 'qXfer:libraries:read' packet
  35905. (*note qXfer library list read::).
  35906. 'qXfer:libraries-svr4:read'
  35907. The remote stub understands the 'qXfer:libraries-svr4:read'
  35908. packet (*note qXfer svr4 library list read::).
  35909. 'augmented-libraries-svr4-read'
  35910. The remote stub understands the augmented form of the
  35911. 'qXfer:libraries-svr4:read' packet (*note qXfer svr4 library
  35912. list read::).
  35913. 'qXfer:memory-map:read'
  35914. The remote stub understands the 'qXfer:memory-map:read' packet
  35915. (*note qXfer memory map read::).
  35916. 'qXfer:sdata:read'
  35917. The remote stub understands the 'qXfer:sdata:read' packet
  35918. (*note qXfer sdata read::).
  35919. 'qXfer:siginfo:read'
  35920. The remote stub understands the 'qXfer:siginfo:read' packet
  35921. (*note qXfer siginfo read::).
  35922. 'qXfer:siginfo:write'
  35923. The remote stub understands the 'qXfer:siginfo:write' packet
  35924. (*note qXfer siginfo write::).
  35925. 'qXfer:threads:read'
  35926. The remote stub understands the 'qXfer:threads:read' packet
  35927. (*note qXfer threads read::).
  35928. 'qXfer:traceframe-info:read'
  35929. The remote stub understands the 'qXfer:traceframe-info:read'
  35930. packet (*note qXfer traceframe info read::).
  35931. 'qXfer:uib:read'
  35932. The remote stub understands the 'qXfer:uib:read' packet (*note
  35933. qXfer unwind info block::).
  35934. 'qXfer:fdpic:read'
  35935. The remote stub understands the 'qXfer:fdpic:read' packet
  35936. (*note qXfer fdpic loadmap read::).
  35937. 'QNonStop'
  35938. The remote stub understands the 'QNonStop' packet (*note
  35939. QNonStop::).
  35940. 'QCatchSyscalls'
  35941. The remote stub understands the 'QCatchSyscalls' packet (*note
  35942. QCatchSyscalls::).
  35943. 'QPassSignals'
  35944. The remote stub understands the 'QPassSignals' packet (*note
  35945. QPassSignals::).
  35946. 'QStartNoAckMode'
  35947. The remote stub understands the 'QStartNoAckMode' packet and
  35948. prefers to operate in no-acknowledgment mode. *Note Packet
  35949. Acknowledgment::.
  35950. 'multiprocess'
  35951. The remote stub understands the multiprocess extensions to the
  35952. remote protocol syntax. The multiprocess extensions affect
  35953. the syntax of thread IDs in both packets and replies (*note
  35954. thread-id syntax::), and add process IDs to the 'D' packet and
  35955. 'W' and 'X' replies. Note that reporting this feature
  35956. indicates support for the syntactic extensions only, not that
  35957. the stub necessarily supports debugging of more than one
  35958. process at a time. The stub must not use multiprocess
  35959. extensions in packet replies unless GDB has also indicated it
  35960. supports them in its 'qSupported' request.
  35961. 'qXfer:osdata:read'
  35962. The remote stub understands the 'qXfer:osdata:read' packet
  35963. ((*note qXfer osdata read::).
  35964. 'ConditionalBreakpoints'
  35965. The target accepts and implements evaluation of conditional
  35966. expressions defined for breakpoints. The target will only
  35967. report breakpoint triggers when such conditions are true
  35968. (*note Break Conditions: Conditions.).
  35969. 'ConditionalTracepoints'
  35970. The remote stub accepts and implements conditional expressions
  35971. defined for tracepoints (*note Tracepoint Conditions::).
  35972. 'ReverseContinue'
  35973. The remote stub accepts and implements the reverse continue
  35974. packet (*note bc::).
  35975. 'ReverseStep'
  35976. The remote stub accepts and implements the reverse step packet
  35977. (*note bs::).
  35978. 'TracepointSource'
  35979. The remote stub understands the 'QTDPsrc' packet that supplies
  35980. the source form of tracepoint definitions.
  35981. 'QAgent'
  35982. The remote stub understands the 'QAgent' packet.
  35983. 'QAllow'
  35984. The remote stub understands the 'QAllow' packet.
  35985. 'QDisableRandomization'
  35986. The remote stub understands the 'QDisableRandomization'
  35987. packet.
  35988. 'StaticTracepoint'
  35989. The remote stub supports static tracepoints.
  35990. 'InstallInTrace'
  35991. The remote stub supports installing tracepoint in tracing.
  35992. 'EnableDisableTracepoints'
  35993. The remote stub supports the 'QTEnable' (*note QTEnable::) and
  35994. 'QTDisable' (*note QTDisable::) packets that allow tracepoints
  35995. to be enabled and disabled while a trace experiment is
  35996. running.
  35997. 'QTBuffer:size'
  35998. The remote stub supports the 'QTBuffer:size' (*note
  35999. QTBuffer-size::) packet that allows to change the size of the
  36000. trace buffer.
  36001. 'tracenz'
  36002. The remote stub supports the 'tracenz' bytecode for collecting
  36003. strings. See *note Bytecode Descriptions:: for details about
  36004. the bytecode.
  36005. 'BreakpointCommands'
  36006. The remote stub supports running a breakpoint's command list
  36007. itself, rather than reporting the hit to GDB.
  36008. 'Qbtrace:off'
  36009. The remote stub understands the 'Qbtrace:off' packet.
  36010. 'Qbtrace:bts'
  36011. The remote stub understands the 'Qbtrace:bts' packet.
  36012. 'Qbtrace:pt'
  36013. The remote stub understands the 'Qbtrace:pt' packet.
  36014. 'Qbtrace-conf:bts:size'
  36015. The remote stub understands the 'Qbtrace-conf:bts:size'
  36016. packet.
  36017. 'Qbtrace-conf:pt:size'
  36018. The remote stub understands the 'Qbtrace-conf:pt:size' packet.
  36019. 'swbreak'
  36020. The remote stub reports the 'swbreak' stop reason for memory
  36021. breakpoints.
  36022. 'hwbreak'
  36023. The remote stub reports the 'hwbreak' stop reason for hardware
  36024. breakpoints.
  36025. 'fork-events'
  36026. The remote stub reports the 'fork' stop reason for fork
  36027. events.
  36028. 'vfork-events'
  36029. The remote stub reports the 'vfork' stop reason for vfork
  36030. events and vforkdone events.
  36031. 'exec-events'
  36032. The remote stub reports the 'exec' stop reason for exec
  36033. events.
  36034. 'vContSupported'
  36035. The remote stub reports the supported actions in the reply to
  36036. 'vCont?' packet.
  36037. 'QThreadEvents'
  36038. The remote stub understands the 'QThreadEvents' packet.
  36039. 'no-resumed'
  36040. The remote stub reports the 'N' stop reply.
  36041. 'qSymbol::'
  36042. Notify the target that GDB is prepared to serve symbol lookup
  36043. requests. Accept requests from the target for the values of
  36044. symbols.
  36045. Reply:
  36046. 'OK'
  36047. The target does not need to look up any (more) symbols.
  36048. 'qSymbol:SYM_NAME'
  36049. The target requests the value of symbol SYM_NAME (hex
  36050. encoded). GDB may provide the value by using the
  36051. 'qSymbol:SYM_VALUE:SYM_NAME' message, described below.
  36052. 'qSymbol:SYM_VALUE:SYM_NAME'
  36053. Set the value of SYM_NAME to SYM_VALUE.
  36054. SYM_NAME (hex encoded) is the name of a symbol whose value the
  36055. target has previously requested.
  36056. SYM_VALUE (hex) is the value for symbol SYM_NAME. If GDB cannot
  36057. supply a value for SYM_NAME, then this field will be empty.
  36058. Reply:
  36059. 'OK'
  36060. The target does not need to look up any (more) symbols.
  36061. 'qSymbol:SYM_NAME'
  36062. The target requests the value of a new symbol SYM_NAME (hex
  36063. encoded). GDB will continue to supply the values of symbols
  36064. (if available), until the target ceases to request them.
  36065. 'qTBuffer'
  36066. 'QTBuffer'
  36067. 'QTDisconnected'
  36068. 'QTDP'
  36069. 'QTDPsrc'
  36070. 'QTDV'
  36071. 'qTfP'
  36072. 'qTfV'
  36073. 'QTFrame'
  36074. 'qTMinFTPILen'
  36075. *Note Tracepoint Packets::.
  36076. 'qThreadExtraInfo,THREAD-ID'
  36077. Obtain from the target OS a printable string description of thread
  36078. attributes for the thread THREAD-ID; see *note thread-id syntax::,
  36079. for the forms of THREAD-ID. This string may contain anything that
  36080. the target OS thinks is interesting for GDB to tell the user about
  36081. the thread. The string is displayed in GDB's 'info threads'
  36082. display. Some examples of possible thread extra info strings are
  36083. 'Runnable', or 'Blocked on Mutex'.
  36084. Reply:
  36085. 'XX...'
  36086. Where 'XX...' is a hex encoding of ASCII data, comprising the
  36087. printable string containing the extra information about the
  36088. thread's attributes.
  36089. (Note that the 'qThreadExtraInfo' packet's name is separated from
  36090. the command by a ',', not a ':', contrary to the naming conventions
  36091. above. Please don't use this packet as a model for new packets.)
  36092. 'QTNotes'
  36093. 'qTP'
  36094. 'QTSave'
  36095. 'qTsP'
  36096. 'qTsV'
  36097. 'QTStart'
  36098. 'QTStop'
  36099. 'QTEnable'
  36100. 'QTDisable'
  36101. 'QTinit'
  36102. 'QTro'
  36103. 'qTStatus'
  36104. 'qTV'
  36105. 'qTfSTM'
  36106. 'qTsSTM'
  36107. 'qTSTMat'
  36108. *Note Tracepoint Packets::.
  36109. 'qXfer:OBJECT:read:ANNEX:OFFSET,LENGTH'
  36110. Read uninterpreted bytes from the target's special data area
  36111. identified by the keyword OBJECT. Request LENGTH bytes starting at
  36112. OFFSET bytes into the data. The content and encoding of ANNEX is
  36113. specific to OBJECT; it can supply additional details about what
  36114. data to access.
  36115. Reply:
  36116. 'm DATA'
  36117. Data DATA (*note Binary Data::) has been read from the target.
  36118. There may be more data at a higher address (although it is
  36119. permitted to return 'm' even for the last valid block of data,
  36120. as long as at least one byte of data was read). It is
  36121. possible for DATA to have fewer bytes than the LENGTH in the
  36122. request.
  36123. 'l DATA'
  36124. Data DATA (*note Binary Data::) has been read from the target.
  36125. There is no more data to be read. It is possible for DATA to
  36126. have fewer bytes than the LENGTH in the request.
  36127. 'l'
  36128. The OFFSET in the request is at the end of the data. There is
  36129. no more data to be read.
  36130. 'E00'
  36131. The request was malformed, or ANNEX was invalid.
  36132. 'E NN'
  36133. The offset was invalid, or there was an error encountered
  36134. reading the data. The NN part is a hex-encoded 'errno' value.
  36135. ''
  36136. An empty reply indicates the OBJECT string was not recognized
  36137. by the stub, or that the object does not support reading.
  36138. Here are the specific requests of this form defined so far. All
  36139. the 'qXfer:OBJECT:read:...' requests use the same reply formats,
  36140. listed above.
  36141. 'qXfer:auxv:read::OFFSET,LENGTH'
  36142. Access the target's "auxiliary vector". *Note auxiliary
  36143. vector: OS Information. Note ANNEX must be empty.
  36144. This packet is not probed by default; the remote stub must
  36145. request it, by supplying an appropriate 'qSupported' response
  36146. (*note qSupported::).
  36147. 'qXfer:btrace:read:ANNEX:OFFSET,LENGTH'
  36148. Return a description of the current branch trace. *Note
  36149. Branch Trace Format::. The annex part of the generic 'qXfer'
  36150. packet may have one of the following values:
  36151. 'all'
  36152. Returns all available branch trace.
  36153. 'new'
  36154. Returns all available branch trace if the branch trace
  36155. changed since the last read request.
  36156. 'delta'
  36157. Returns the new branch trace since the last read request.
  36158. Adds a new block to the end of the trace that begins at
  36159. zero and ends at the source location of the first branch
  36160. in the trace buffer. This extra block is used to stitch
  36161. traces together.
  36162. If the trace buffer overflowed, returns an error
  36163. indicating the overflow.
  36164. This packet is not probed by default; the remote stub must
  36165. request it by supplying an appropriate 'qSupported' response
  36166. (*note qSupported::).
  36167. 'qXfer:btrace-conf:read::OFFSET,LENGTH'
  36168. Return a description of the current branch trace
  36169. configuration. *Note Branch Trace Configuration Format::.
  36170. This packet is not probed by default; the remote stub must
  36171. request it by supplying an appropriate 'qSupported' response
  36172. (*note qSupported::).
  36173. 'qXfer:exec-file:read:ANNEX:OFFSET,LENGTH'
  36174. Return the full absolute name of the file that was executed to
  36175. create a process running on the remote system. The annex
  36176. specifies the numeric process ID of the process to query,
  36177. encoded as a hexadecimal number. If the annex part is empty
  36178. the remote stub should return the filename corresponding to
  36179. the currently executing process.
  36180. This packet is not probed by default; the remote stub must
  36181. request it, by supplying an appropriate 'qSupported' response
  36182. (*note qSupported::).
  36183. 'qXfer:features:read:ANNEX:OFFSET,LENGTH'
  36184. Access the "target description". *Note Target Descriptions::.
  36185. The annex specifies which XML document to access. The main
  36186. description is always loaded from the 'target.xml' annex.
  36187. This packet is not probed by default; the remote stub must
  36188. request it, by supplying an appropriate 'qSupported' response
  36189. (*note qSupported::).
  36190. 'qXfer:libraries:read:ANNEX:OFFSET,LENGTH'
  36191. Access the target's list of loaded libraries. *Note Library
  36192. List Format::. The annex part of the generic 'qXfer' packet
  36193. must be empty (*note qXfer read::).
  36194. Targets which maintain a list of libraries in the program's
  36195. memory do not need to implement this packet; it is designed
  36196. for platforms where the operating system manages the list of
  36197. loaded libraries.
  36198. This packet is not probed by default; the remote stub must
  36199. request it, by supplying an appropriate 'qSupported' response
  36200. (*note qSupported::).
  36201. 'qXfer:libraries-svr4:read:ANNEX:OFFSET,LENGTH'
  36202. Access the target's list of loaded libraries when the target
  36203. is an SVR4 platform. *Note Library List Format for SVR4
  36204. Targets::. The annex part of the generic 'qXfer' packet must
  36205. be empty unless the remote stub indicated it supports the
  36206. augmented form of this packet by supplying an appropriate
  36207. 'qSupported' response (*note qXfer read::, *note
  36208. qSupported::).
  36209. This packet is optional for better performance on SVR4
  36210. targets. GDB uses memory read packets to read the SVR4
  36211. library list otherwise.
  36212. This packet is not probed by default; the remote stub must
  36213. request it, by supplying an appropriate 'qSupported' response
  36214. (*note qSupported::).
  36215. If the remote stub indicates it supports the augmented form of
  36216. this packet then the annex part of the generic 'qXfer' packet
  36217. may contain a semicolon-separated list of 'NAME=VALUE'
  36218. arguments. The currently supported arguments are:
  36219. 'start=ADDRESS'
  36220. A hexadecimal number specifying the address of the
  36221. 'struct link_map' to start reading the library list from.
  36222. If unset or zero then the first 'struct link_map' in the
  36223. library list will be chosen as the starting point.
  36224. 'prev=ADDRESS'
  36225. A hexadecimal number specifying the address of the
  36226. 'struct link_map' immediately preceding the 'struct
  36227. link_map' specified by the 'start' argument. If unset or
  36228. zero then the remote stub will expect that no 'struct
  36229. link_map' exists prior to the starting point.
  36230. Arguments that are not understood by the remote stub will be
  36231. silently ignored.
  36232. 'qXfer:memory-map:read::OFFSET,LENGTH'
  36233. Access the target's "memory-map". *Note Memory Map Format::.
  36234. The annex part of the generic 'qXfer' packet must be empty
  36235. (*note qXfer read::).
  36236. This packet is not probed by default; the remote stub must
  36237. request it, by supplying an appropriate 'qSupported' response
  36238. (*note qSupported::).
  36239. 'qXfer:sdata:read::OFFSET,LENGTH'
  36240. Read contents of the extra collected static tracepoint marker
  36241. information. The annex part of the generic 'qXfer' packet
  36242. must be empty (*note qXfer read::). *Note Tracepoint Action
  36243. Lists: Tracepoint Actions.
  36244. This packet is not probed by default; the remote stub must
  36245. request it, by supplying an appropriate 'qSupported' response
  36246. (*note qSupported::).
  36247. 'qXfer:siginfo:read::OFFSET,LENGTH'
  36248. Read contents of the extra signal information on the target
  36249. system. The annex part of the generic 'qXfer' packet must be
  36250. empty (*note qXfer read::).
  36251. This packet is not probed by default; the remote stub must
  36252. request it, by supplying an appropriate 'qSupported' response
  36253. (*note qSupported::).
  36254. 'qXfer:threads:read::OFFSET,LENGTH'
  36255. Access the list of threads on target. *Note Thread List
  36256. Format::. The annex part of the generic 'qXfer' packet must
  36257. be empty (*note qXfer read::).
  36258. This packet is not probed by default; the remote stub must
  36259. request it, by supplying an appropriate 'qSupported' response
  36260. (*note qSupported::).
  36261. 'qXfer:traceframe-info:read::OFFSET,LENGTH'
  36262. Return a description of the current traceframe's contents.
  36263. *Note Traceframe Info Format::. The annex part of the generic
  36264. 'qXfer' packet must be empty (*note qXfer read::).
  36265. This packet is not probed by default; the remote stub must
  36266. request it, by supplying an appropriate 'qSupported' response
  36267. (*note qSupported::).
  36268. 'qXfer:uib:read:PC:OFFSET,LENGTH'
  36269. Return the unwind information block for PC. This packet is
  36270. used on OpenVMS/ia64 to ask the kernel unwind information.
  36271. This packet is not probed by default.
  36272. 'qXfer:fdpic:read:ANNEX:OFFSET,LENGTH'
  36273. Read contents of 'loadmap's on the target system. The annex,
  36274. either 'exec' or 'interp', specifies which 'loadmap',
  36275. executable 'loadmap' or interpreter 'loadmap' to read.
  36276. This packet is not probed by default; the remote stub must
  36277. request it, by supplying an appropriate 'qSupported' response
  36278. (*note qSupported::).
  36279. 'qXfer:osdata:read::OFFSET,LENGTH'
  36280. Access the target's "operating system information". *Note
  36281. Operating System Information::.
  36282. 'qXfer:OBJECT:write:ANNEX:OFFSET:DATA...'
  36283. Write uninterpreted bytes into the target's special data area
  36284. identified by the keyword OBJECT, starting at OFFSET bytes into the
  36285. data. The binary-encoded data (*note Binary Data::) to be written
  36286. is given by DATA.... The content and encoding of ANNEX is specific
  36287. to OBJECT; it can supply additional details about what data to
  36288. access.
  36289. Reply:
  36290. 'NN'
  36291. NN (hex encoded) is the number of bytes written. This may be
  36292. fewer bytes than supplied in the request.
  36293. 'E00'
  36294. The request was malformed, or ANNEX was invalid.
  36295. 'E NN'
  36296. The offset was invalid, or there was an error encountered
  36297. writing the data. The NN part is a hex-encoded 'errno' value.
  36298. ''
  36299. An empty reply indicates the OBJECT string was not recognized
  36300. by the stub, or that the object does not support writing.
  36301. Here are the specific requests of this form defined so far. All
  36302. the 'qXfer:OBJECT:write:...' requests use the same reply formats,
  36303. listed above.
  36304. 'qXfer:siginfo:write::OFFSET:DATA...'
  36305. Write DATA to the extra signal information on the target
  36306. system. The annex part of the generic 'qXfer' packet must be
  36307. empty (*note qXfer write::).
  36308. This packet is not probed by default; the remote stub must
  36309. request it, by supplying an appropriate 'qSupported' response
  36310. (*note qSupported::).
  36311. 'qXfer:OBJECT:OPERATION:...'
  36312. Requests of this form may be added in the future. When a stub does
  36313. not recognize the OBJECT keyword, or its support for OBJECT does
  36314. not recognize the OPERATION keyword, the stub must respond with an
  36315. empty packet.
  36316. 'qAttached:PID'
  36317. Return an indication of whether the remote server attached to an
  36318. existing process or created a new process. When the multiprocess
  36319. protocol extensions are supported (*note multiprocess
  36320. extensions::), PID is an integer in hexadecimal format identifying
  36321. the target process. Otherwise, GDB will omit the PID field and the
  36322. query packet will be simplified as 'qAttached'.
  36323. This query is used, for example, to know whether the remote process
  36324. should be detached or killed when a GDB session is ended with the
  36325. 'quit' command.
  36326. Reply:
  36327. '1'
  36328. The remote server attached to an existing process.
  36329. '0'
  36330. The remote server created a new process.
  36331. 'E NN'
  36332. A badly formed request or an error was encountered.
  36333. 'Qbtrace:bts'
  36334. Enable branch tracing for the current thread using Branch Trace
  36335. Store.
  36336. Reply:
  36337. 'OK'
  36338. Branch tracing has been enabled.
  36339. 'E.errtext'
  36340. A badly formed request or an error was encountered.
  36341. 'Qbtrace:pt'
  36342. Enable branch tracing for the current thread using Intel Processor
  36343. Trace.
  36344. Reply:
  36345. 'OK'
  36346. Branch tracing has been enabled.
  36347. 'E.errtext'
  36348. A badly formed request or an error was encountered.
  36349. 'Qbtrace:off'
  36350. Disable branch tracing for the current thread.
  36351. Reply:
  36352. 'OK'
  36353. Branch tracing has been disabled.
  36354. 'E.errtext'
  36355. A badly formed request or an error was encountered.
  36356. 'Qbtrace-conf:bts:size=VALUE'
  36357. Set the requested ring buffer size for new threads that use the
  36358. btrace recording method in bts format.
  36359. Reply:
  36360. 'OK'
  36361. The ring buffer size has been set.
  36362. 'E.errtext'
  36363. A badly formed request or an error was encountered.
  36364. 'Qbtrace-conf:pt:size=VALUE'
  36365. Set the requested ring buffer size for new threads that use the
  36366. btrace recording method in pt format.
  36367. Reply:
  36368. 'OK'
  36369. The ring buffer size has been set.
  36370. 'E.errtext'
  36371. A badly formed request or an error was encountered.
  36372. ---------- Footnotes ----------
  36373. (1) The 'qP' and 'qL' packets predate these conventions, and have
  36374. arguments without any terminator for the packet name; we suspect they
  36375. are in widespread use in places that are difficult to upgrade. The 'qC'
  36376. packet has no arguments, but some existing stubs (e.g. RedBoot) are
  36377. known to not check for the end of the packet.
  36378. 
  36379. File: gdb.info, Node: Architecture-Specific Protocol Details, Next: Tracepoint Packets, Prev: General Query Packets, Up: Remote Protocol
  36380. E.5 Architecture-Specific Protocol Details
  36381. ==========================================
  36382. This section describes how the remote protocol is applied to specific
  36383. target architectures. Also see *note Standard Target Features::, for
  36384. details of XML target descriptions for each architecture.
  36385. * Menu:
  36386. * ARM-Specific Protocol Details::
  36387. * MIPS-Specific Protocol Details::
  36388. 
  36389. File: gdb.info, Node: ARM-Specific Protocol Details, Next: MIPS-Specific Protocol Details, Up: Architecture-Specific Protocol Details
  36390. E.5.1 ARM-specific Protocol Details
  36391. -----------------------------------
  36392. * Menu:
  36393. * ARM Breakpoint Kinds::
  36394. 
  36395. File: gdb.info, Node: ARM Breakpoint Kinds, Up: ARM-Specific Protocol Details
  36396. E.5.1.1 ARM Breakpoint Kinds
  36397. ............................
  36398. These breakpoint kinds are defined for the 'Z0' and 'Z1' packets.
  36399. 2
  36400. 16-bit Thumb mode breakpoint.
  36401. 3
  36402. 32-bit Thumb mode (Thumb-2) breakpoint.
  36403. 4
  36404. 32-bit ARM mode breakpoint.
  36405. 
  36406. File: gdb.info, Node: MIPS-Specific Protocol Details, Prev: ARM-Specific Protocol Details, Up: Architecture-Specific Protocol Details
  36407. E.5.2 MIPS-specific Protocol Details
  36408. ------------------------------------
  36409. * Menu:
  36410. * MIPS Register packet Format::
  36411. * MIPS Breakpoint Kinds::
  36412. 
  36413. File: gdb.info, Node: MIPS Register packet Format, Next: MIPS Breakpoint Kinds, Up: MIPS-Specific Protocol Details
  36414. E.5.2.1 MIPS Register Packet Format
  36415. ...................................
  36416. The following 'g'/'G' packets have previously been defined. In the
  36417. below, some thirty-two bit registers are transferred as sixty-four bits.
  36418. Those registers should be zero/sign extended (which?) to fill the space
  36419. allocated. Register bytes are transferred in target byte order. The
  36420. two nibbles within a register byte are transferred most-significant -
  36421. least-significant.
  36422. MIPS32
  36423. All registers are transferred as thirty-two bit quantities in the
  36424. order: 32 general-purpose; sr; lo; hi; bad; cause; pc; 32
  36425. floating-point registers; fsr; fir; fp.
  36426. MIPS64
  36427. All registers are transferred as sixty-four bit quantities
  36428. (including thirty-two bit registers such as 'sr'). The ordering is
  36429. the same as 'MIPS32'.
  36430. 
  36431. File: gdb.info, Node: MIPS Breakpoint Kinds, Prev: MIPS Register packet Format, Up: MIPS-Specific Protocol Details
  36432. E.5.2.2 MIPS Breakpoint Kinds
  36433. .............................
  36434. These breakpoint kinds are defined for the 'Z0' and 'Z1' packets.
  36435. 2
  36436. 16-bit MIPS16 mode breakpoint.
  36437. 3
  36438. 16-bit microMIPS mode breakpoint.
  36439. 4
  36440. 32-bit standard MIPS mode breakpoint.
  36441. 5
  36442. 32-bit microMIPS mode breakpoint.
  36443. 
  36444. File: gdb.info, Node: Tracepoint Packets, Next: Host I/O Packets, Prev: Architecture-Specific Protocol Details, Up: Remote Protocol
  36445. E.6 Tracepoint Packets
  36446. ======================
  36447. Here we describe the packets GDB uses to implement tracepoints (*note
  36448. Tracepoints::).
  36449. 'QTDP:N:ADDR:ENA:STEP:PASS[:FFLEN][:XLEN,BYTES][-]'
  36450. Create a new tracepoint, number N, at ADDR. If ENA is 'E', then
  36451. the tracepoint is enabled; if it is 'D', then the tracepoint is
  36452. disabled. The STEP gives the tracepoint's step count, and PASS
  36453. gives its pass count. If an 'F' is present, then the tracepoint is
  36454. to be a fast tracepoint, and the FLEN is the number of bytes that
  36455. the target should copy elsewhere to make room for the tracepoint.
  36456. If an 'X' is present, it introduces a tracepoint condition, which
  36457. consists of a hexadecimal length, followed by a comma and
  36458. hex-encoded bytes, in a manner similar to action encodings as
  36459. described below. If the trailing '-' is present, further 'QTDP'
  36460. packets will follow to specify this tracepoint's actions.
  36461. Replies:
  36462. 'OK'
  36463. The packet was understood and carried out.
  36464. 'qRelocInsn'
  36465. *Note Relocate instruction reply packet: Tracepoint Packets.
  36466. ''
  36467. The packet was not recognized.
  36468. 'QTDP:-N:ADDR:[S]ACTION...[-]'
  36469. Define actions to be taken when a tracepoint is hit. The N and
  36470. ADDR must be the same as in the initial 'QTDP' packet for this
  36471. tracepoint. This packet may only be sent immediately after another
  36472. 'QTDP' packet that ended with a '-'. If the trailing '-' is
  36473. present, further 'QTDP' packets will follow, specifying more
  36474. actions for this tracepoint.
  36475. In the series of action packets for a given tracepoint, at most one
  36476. can have an 'S' before its first ACTION. If such a packet is sent,
  36477. it and the following packets define "while-stepping" actions. Any
  36478. prior packets define ordinary actions -- that is, those taken when
  36479. the tracepoint is first hit. If no action packet has an 'S', then
  36480. all the packets in the series specify ordinary tracepoint actions.
  36481. The 'ACTION...' portion of the packet is a series of actions,
  36482. concatenated without separators. Each action has one of the
  36483. following forms:
  36484. 'R MASK'
  36485. Collect the registers whose bits are set in MASK, a
  36486. hexadecimal number whose I'th bit is set if register number I
  36487. should be collected. (The least significant bit is numbered
  36488. zero.) Note that MASK may be any number of digits long; it
  36489. may not fit in a 32-bit word.
  36490. 'M BASEREG,OFFSET,LEN'
  36491. Collect LEN bytes of memory starting at the address in
  36492. register number BASEREG, plus OFFSET. If BASEREG is '-1',
  36493. then the range has a fixed address: OFFSET is the address of
  36494. the lowest byte to collect. The BASEREG, OFFSET, and LEN
  36495. parameters are all unsigned hexadecimal values (the '-1' value
  36496. for BASEREG is a special case).
  36497. 'X LEN,EXPR'
  36498. Evaluate EXPR, whose length is LEN, and collect memory as it
  36499. directs. The agent expression EXPR is as described in *note
  36500. Agent Expressions::. Each byte of the expression is encoded
  36501. as a two-digit hex number in the packet; LEN is the number of
  36502. bytes in the expression (and thus one-half the number of hex
  36503. digits in the packet).
  36504. Any number of actions may be packed together in a single 'QTDP'
  36505. packet, as long as the packet does not exceed the maximum packet
  36506. length (400 bytes, for many stubs). There may be only one 'R'
  36507. action per tracepoint, and it must precede any 'M' or 'X' actions.
  36508. Any registers referred to by 'M' and 'X' actions must be collected
  36509. by a preceding 'R' action. (The "while-stepping" actions are
  36510. treated as if they were attached to a separate tracepoint, as far
  36511. as these restrictions are concerned.)
  36512. Replies:
  36513. 'OK'
  36514. The packet was understood and carried out.
  36515. 'qRelocInsn'
  36516. *Note Relocate instruction reply packet: Tracepoint Packets.
  36517. ''
  36518. The packet was not recognized.
  36519. 'QTDPsrc:N:ADDR:TYPE:START:SLEN:BYTES'
  36520. Specify a source string of tracepoint N at address ADDR. This is
  36521. useful to get accurate reproduction of the tracepoints originally
  36522. downloaded at the beginning of the trace run. The TYPE is the name
  36523. of the tracepoint part, such as 'cond' for the tracepoint's
  36524. conditional expression (see below for a list of types), while BYTES
  36525. is the string, encoded in hexadecimal.
  36526. START is the offset of the BYTES within the overall source string,
  36527. while SLEN is the total length of the source string. This is
  36528. intended for handling source strings that are longer than will fit
  36529. in a single packet.
  36530. The available string types are 'at' for the location, 'cond' for
  36531. the conditional, and 'cmd' for an action command. GDB sends a
  36532. separate packet for each command in the action list, in the same
  36533. order in which the commands are stored in the list.
  36534. The target does not need to do anything with source strings except
  36535. report them back as part of the replies to the 'qTfP'/'qTsP' query
  36536. packets.
  36537. Although this packet is optional, and GDB will only send it if the
  36538. target replies with 'TracepointSource' *Note General Query
  36539. Packets::, it makes both disconnected tracing and trace files much
  36540. easier to use. Otherwise the user must be careful that the
  36541. tracepoints in effect while looking at trace frames are identical
  36542. to the ones in effect during the trace run; even a small
  36543. discrepancy could cause 'tdump' not to work, or a particular trace
  36544. frame not be found.
  36545. 'QTDV:N:VALUE:BUILTIN:NAME'
  36546. Create a new trace state variable, number N, with an initial value
  36547. of VALUE, which is a 64-bit signed integer. Both N and VALUE are
  36548. encoded as hexadecimal values. GDB has the option of not using
  36549. this packet for initial values of zero; the target should simply
  36550. create the trace state variables as they are mentioned in
  36551. expressions. The value BUILTIN should be 1 (one) if the trace
  36552. state variable is builtin and 0 (zero) if it is not builtin. GDB
  36553. only sets BUILTIN to 1 if a previous 'qTfV' or 'qTsV' packet had it
  36554. set. The contents of NAME is the hex-encoded name (without the
  36555. leading '$') of the trace state variable.
  36556. 'QTFrame:N'
  36557. Select the N'th tracepoint frame from the buffer, and use the
  36558. register and memory contents recorded there to answer subsequent
  36559. request packets from GDB.
  36560. A successful reply from the stub indicates that the stub has found
  36561. the requested frame. The response is a series of parts,
  36562. concatenated without separators, describing the frame we selected.
  36563. Each part has one of the following forms:
  36564. 'F F'
  36565. The selected frame is number N in the trace frame buffer; F is
  36566. a hexadecimal number. If F is '-1', then there was no frame
  36567. matching the criteria in the request packet.
  36568. 'T T'
  36569. The selected trace frame records a hit of tracepoint number T;
  36570. T is a hexadecimal number.
  36571. 'QTFrame:pc:ADDR'
  36572. Like 'QTFrame:N', but select the first tracepoint frame after the
  36573. currently selected frame whose PC is ADDR; ADDR is a hexadecimal
  36574. number.
  36575. 'QTFrame:tdp:T'
  36576. Like 'QTFrame:N', but select the first tracepoint frame after the
  36577. currently selected frame that is a hit of tracepoint T; T is a
  36578. hexadecimal number.
  36579. 'QTFrame:range:START:END'
  36580. Like 'QTFrame:N', but select the first tracepoint frame after the
  36581. currently selected frame whose PC is between START (inclusive) and
  36582. END (inclusive); START and END are hexadecimal numbers.
  36583. 'QTFrame:outside:START:END'
  36584. Like 'QTFrame:range:START:END', but select the first frame
  36585. _outside_ the given range of addresses (exclusive).
  36586. 'qTMinFTPILen'
  36587. This packet requests the minimum length of instruction at which a
  36588. fast tracepoint (*note Set Tracepoints::) may be placed. For
  36589. instance, on the 32-bit x86 architecture, it is possible to use a
  36590. 4-byte jump, but it depends on the target system being able to
  36591. create trampolines in the first 64K of memory, which might or might
  36592. not be possible for that system. So the reply to this packet will
  36593. be 4 if it is able to arrange for that.
  36594. Replies:
  36595. '0'
  36596. The minimum instruction length is currently unknown.
  36597. 'LENGTH'
  36598. The minimum instruction length is LENGTH, where LENGTH is a
  36599. hexadecimal number greater or equal to 1. A reply of 1 means
  36600. that a fast tracepoint may be placed on any instruction
  36601. regardless of size.
  36602. 'E'
  36603. An error has occurred.
  36604. ''
  36605. An empty reply indicates that the request is not supported by
  36606. the stub.
  36607. 'QTStart'
  36608. Begin the tracepoint experiment. Begin collecting data from
  36609. tracepoint hits in the trace frame buffer. This packet supports
  36610. the 'qRelocInsn' reply (*note Relocate instruction reply packet:
  36611. Tracepoint Packets.).
  36612. 'QTStop'
  36613. End the tracepoint experiment. Stop collecting trace frames.
  36614. 'QTEnable:N:ADDR'
  36615. Enable tracepoint N at address ADDR in a started tracepoint
  36616. experiment. If the tracepoint was previously disabled, then
  36617. collection of data from it will resume.
  36618. 'QTDisable:N:ADDR'
  36619. Disable tracepoint N at address ADDR in a started tracepoint
  36620. experiment. No more data will be collected from the tracepoint
  36621. unless 'QTEnable:N:ADDR' is subsequently issued.
  36622. 'QTinit'
  36623. Clear the table of tracepoints, and empty the trace frame buffer.
  36624. 'QTro:START1,END1:START2,END2:...'
  36625. Establish the given ranges of memory as "transparent". The stub
  36626. will answer requests for these ranges from memory's current
  36627. contents, if they were not collected as part of the tracepoint hit.
  36628. GDB uses this to mark read-only regions of memory, like those
  36629. containing program code. Since these areas never change, they
  36630. should still have the same contents they did when the tracepoint
  36631. was hit, so there's no reason for the stub to refuse to provide
  36632. their contents.
  36633. 'QTDisconnected:VALUE'
  36634. Set the choice to what to do with the tracing run when GDB
  36635. disconnects from the target. A VALUE of 1 directs the target to
  36636. continue the tracing run, while 0 tells the target to stop tracing
  36637. if GDB is no longer in the picture.
  36638. 'qTStatus'
  36639. Ask the stub if there is a trace experiment running right now.
  36640. The reply has the form:
  36641. 'TRUNNING[;FIELD]...'
  36642. RUNNING is a single digit '1' if the trace is presently
  36643. running, or '0' if not. It is followed by semicolon-separated
  36644. optional fields that an agent may use to report additional
  36645. status.
  36646. If the trace is not running, the agent may report any of several
  36647. explanations as one of the optional fields:
  36648. 'tnotrun:0'
  36649. No trace has been run yet.
  36650. 'tstop[:TEXT]:0'
  36651. The trace was stopped by a user-originated stop command. The
  36652. optional TEXT field is a user-supplied string supplied as part
  36653. of the stop command (for instance, an explanation of why the
  36654. trace was stopped manually). It is hex-encoded.
  36655. 'tfull:0'
  36656. The trace stopped because the trace buffer filled up.
  36657. 'tdisconnected:0'
  36658. The trace stopped because GDB disconnected from the target.
  36659. 'tpasscount:TPNUM'
  36660. The trace stopped because tracepoint TPNUM exceeded its pass
  36661. count.
  36662. 'terror:TEXT:TPNUM'
  36663. The trace stopped because tracepoint TPNUM had an error. The
  36664. string TEXT is available to describe the nature of the error
  36665. (for instance, a divide by zero in the condition expression);
  36666. it is hex encoded.
  36667. 'tunknown:0'
  36668. The trace stopped for some other reason.
  36669. Additional optional fields supply statistical and other
  36670. information. Although not required, they are extremely useful for
  36671. users monitoring the progress of a trace run. If a trace has
  36672. stopped, and these numbers are reported, they must reflect the
  36673. state of the just-stopped trace.
  36674. 'tframes:N'
  36675. The number of trace frames in the buffer.
  36676. 'tcreated:N'
  36677. The total number of trace frames created during the run. This
  36678. may be larger than the trace frame count, if the buffer is
  36679. circular.
  36680. 'tsize:N'
  36681. The total size of the trace buffer, in bytes.
  36682. 'tfree:N'
  36683. The number of bytes still unused in the buffer.
  36684. 'circular:N'
  36685. The value of the circular trace buffer flag. '1' means that
  36686. the trace buffer is circular and old trace frames will be
  36687. discarded if necessary to make room, '0' means that the trace
  36688. buffer is linear and may fill up.
  36689. 'disconn:N'
  36690. The value of the disconnected tracing flag. '1' means that
  36691. tracing will continue after GDB disconnects, '0' means that
  36692. the trace run will stop.
  36693. 'qTP:TP:ADDR'
  36694. Ask the stub for the current state of tracepoint number TP at
  36695. address ADDR.
  36696. Replies:
  36697. 'VHITS:USAGE'
  36698. The tracepoint has been hit HITS times so far during the trace
  36699. run, and accounts for USAGE in the trace buffer. Note that
  36700. 'while-stepping' steps are not counted as separate hits, but
  36701. the steps' space consumption is added into the usage number.
  36702. 'qTV:VAR'
  36703. Ask the stub for the value of the trace state variable number VAR.
  36704. Replies:
  36705. 'VVALUE'
  36706. The value of the variable is VALUE. This will be the current
  36707. value of the variable if the user is examining a running
  36708. target, or a saved value if the variable was collected in the
  36709. trace frame that the user is looking at. Note that multiple
  36710. requests may result in different reply values, such as when
  36711. requesting values while the program is running.
  36712. 'U'
  36713. The value of the variable is unknown. This would occur, for
  36714. example, if the user is examining a trace frame in which the
  36715. requested variable was not collected.
  36716. 'qTfP'
  36717. 'qTsP'
  36718. These packets request data about tracepoints that are being used by
  36719. the target. GDB sends 'qTfP' to get the first piece of data, and
  36720. multiple 'qTsP' to get additional pieces. Replies to these packets
  36721. generally take the form of the 'QTDP' packets that define
  36722. tracepoints. (FIXME add detailed syntax)
  36723. 'qTfV'
  36724. 'qTsV'
  36725. These packets request data about trace state variables that are on
  36726. the target. GDB sends 'qTfV' to get the first vari of data, and
  36727. multiple 'qTsV' to get additional variables. Replies to these
  36728. packets follow the syntax of the 'QTDV' packets that define trace
  36729. state variables.
  36730. 'qTfSTM'
  36731. 'qTsSTM'
  36732. These packets request data about static tracepoint markers that
  36733. exist in the target program. GDB sends 'qTfSTM' to get the first
  36734. piece of data, and multiple 'qTsSTM' to get additional pieces.
  36735. Replies to these packets take the following form:
  36736. Reply:
  36737. 'm ADDRESS:ID:EXTRA'
  36738. A single marker
  36739. 'm ADDRESS:ID:EXTRA,ADDRESS:ID:EXTRA...'
  36740. a comma-separated list of markers
  36741. 'l'
  36742. (lower case letter 'L') denotes end of list.
  36743. 'E NN'
  36744. An error occurred. The error number NN is given as hex
  36745. digits.
  36746. ''
  36747. An empty reply indicates that the request is not supported by
  36748. the stub.
  36749. The ADDRESS is encoded in hex; ID and EXTRA are strings encoded in
  36750. hex.
  36751. In response to each query, the target will reply with a list of one
  36752. or more markers, separated by commas. GDB will respond to each
  36753. reply with a request for more markers (using the 'qs' form of the
  36754. query), until the target responds with 'l' (lower-case ell, for
  36755. "last").
  36756. 'qTSTMat:ADDRESS'
  36757. This packets requests data about static tracepoint markers in the
  36758. target program at ADDRESS. Replies to this packet follow the
  36759. syntax of the 'qTfSTM' and 'qTsSTM' packets that list static
  36760. tracepoint markers.
  36761. 'QTSave:FILENAME'
  36762. This packet directs the target to save trace data to the file name
  36763. FILENAME in the target's filesystem. The FILENAME is encoded as a
  36764. hex string; the interpretation of the file name (relative vs
  36765. absolute, wild cards, etc) is up to the target.
  36766. 'qTBuffer:OFFSET,LEN'
  36767. Return up to LEN bytes of the current contents of trace buffer,
  36768. starting at OFFSET. The trace buffer is treated as if it were a
  36769. contiguous collection of traceframes, as per the trace file format.
  36770. The reply consists as many hex-encoded bytes as the target can
  36771. deliver in a packet; it is not an error to return fewer than were
  36772. asked for. A reply consisting of just 'l' indicates that no bytes
  36773. are available.
  36774. 'QTBuffer:circular:VALUE'
  36775. This packet directs the target to use a circular trace buffer if
  36776. VALUE is 1, or a linear buffer if the value is 0.
  36777. 'QTBuffer:size:SIZE'
  36778. This packet directs the target to make the trace buffer be of size
  36779. SIZE if possible. A value of '-1' tells the target to use whatever
  36780. size it prefers.
  36781. 'QTNotes:[TYPE:TEXT][;TYPE:TEXT]...'
  36782. This packet adds optional textual notes to the trace run.
  36783. Allowable types include 'user', 'notes', and 'tstop', the TEXT
  36784. fields are arbitrary strings, hex-encoded.
  36785. E.6.1 Relocate instruction reply packet
  36786. ---------------------------------------
  36787. When installing fast tracepoints in memory, the target may need to
  36788. relocate the instruction currently at the tracepoint address to a
  36789. different address in memory. For most instructions, a simple copy is
  36790. enough, but, for example, call instructions that implicitly push the
  36791. return address on the stack, and relative branches or other PC-relative
  36792. instructions require offset adjustment, so that the effect of executing
  36793. the instruction at a different address is the same as if it had executed
  36794. in the original location.
  36795. In response to several of the tracepoint packets, the target may also
  36796. respond with a number of intermediate 'qRelocInsn' request packets
  36797. before the final result packet, to have GDB handle this relocation
  36798. operation. If a packet supports this mechanism, its documentation will
  36799. explicitly say so. See for example the above descriptions for the
  36800. 'QTStart' and 'QTDP' packets. The format of the request is:
  36801. 'qRelocInsn:FROM;TO'
  36802. This requests GDB to copy instruction at address FROM to address
  36803. TO, possibly adjusted so that executing the instruction at TO has
  36804. the same effect as executing it at FROM. GDB writes the adjusted
  36805. instruction to target memory starting at TO.
  36806. Replies:
  36807. 'qRelocInsn:ADJUSTED_SIZE'
  36808. Informs the stub the relocation is complete. The ADJUSTED_SIZE is
  36809. the length in bytes of resulting relocated instruction sequence.
  36810. 'E NN'
  36811. A badly formed request was detected, or an error was encountered
  36812. while relocating the instruction.
  36813. 
  36814. File: gdb.info, Node: Host I/O Packets, Next: Interrupts, Prev: Tracepoint Packets, Up: Remote Protocol
  36815. E.7 Host I/O Packets
  36816. ====================
  36817. The "Host I/O" packets allow GDB to perform I/O operations on the far
  36818. side of a remote link. For example, Host I/O is used to upload and
  36819. download files to a remote target with its own filesystem. Host I/O
  36820. uses the same constant values and data structure layout as the
  36821. target-initiated File-I/O protocol. However, the Host I/O packets are
  36822. structured differently. The target-initiated protocol relies on target
  36823. memory to store parameters and buffers. Host I/O requests are initiated
  36824. by GDB, and the target's memory is not involved. *Note File-I/O Remote
  36825. Protocol Extension::, for more details on the target-initiated protocol.
  36826. The Host I/O request packets all encode a single operation along with
  36827. its arguments. They have this format:
  36828. 'vFile:OPERATION: PARAMETER...'
  36829. OPERATION is the name of the particular request; the target should
  36830. compare the entire packet name up to the second colon when checking
  36831. for a supported operation. The format of PARAMETER depends on the
  36832. operation. Numbers are always passed in hexadecimal. Negative
  36833. numbers have an explicit minus sign (i.e. two's complement is not
  36834. used). Strings (e.g. filenames) are encoded as a series of
  36835. hexadecimal bytes. The last argument to a system call may be a
  36836. buffer of escaped binary data (*note Binary Data::).
  36837. The valid responses to Host I/O packets are:
  36838. 'F RESULT [, ERRNO] [; ATTACHMENT]'
  36839. RESULT is the integer value returned by this operation, usually
  36840. non-negative for success and -1 for errors. If an error has
  36841. occured, ERRNO will be included in the result specifying a value
  36842. defined by the File-I/O protocol (*note Errno Values::). For
  36843. operations which return data, ATTACHMENT supplies the data as a
  36844. binary buffer. Binary buffers in response packets are escaped in
  36845. the normal way (*note Binary Data::). See the individual packet
  36846. documentation for the interpretation of RESULT and ATTACHMENT.
  36847. ''
  36848. An empty response indicates that this operation is not recognized.
  36849. These are the supported Host I/O operations:
  36850. 'vFile:open: FILENAME, FLAGS, MODE'
  36851. Open a file at FILENAME and return a file descriptor for it, or
  36852. return -1 if an error occurs. The FILENAME is a string, FLAGS is
  36853. an integer indicating a mask of open flags (*note Open Flags::),
  36854. and MODE is an integer indicating a mask of mode bits to use if the
  36855. file is created (*note mode_t Values::). *Note open::, for details
  36856. of the open flags and mode values.
  36857. 'vFile:close: FD'
  36858. Close the open file corresponding to FD and return 0, or -1 if an
  36859. error occurs.
  36860. 'vFile:pread: FD, COUNT, OFFSET'
  36861. Read data from the open file corresponding to FD. Up to COUNT
  36862. bytes will be read from the file, starting at OFFSET relative to
  36863. the start of the file. The target may read fewer bytes; common
  36864. reasons include packet size limits and an end-of-file condition.
  36865. The number of bytes read is returned. Zero should only be returned
  36866. for a successful read at the end of the file, or if COUNT was zero.
  36867. The data read should be returned as a binary attachment on success.
  36868. If zero bytes were read, the response should include an empty
  36869. binary attachment (i.e. a trailing semicolon). The return value is
  36870. the number of target bytes read; the binary attachment may be
  36871. longer if some characters were escaped.
  36872. 'vFile:pwrite: FD, OFFSET, DATA'
  36873. Write DATA (a binary buffer) to the open file corresponding to FD.
  36874. Start the write at OFFSET from the start of the file. Unlike many
  36875. 'write' system calls, there is no separate COUNT argument; the
  36876. length of DATA in the packet is used. 'vFile:pwrite' returns the
  36877. number of bytes written, which may be shorter than the length of
  36878. DATA, or -1 if an error occurred.
  36879. 'vFile:fstat: FD'
  36880. Get information about the open file corresponding to FD. On
  36881. success the information is returned as a binary attachment and the
  36882. return value is the size of this attachment in bytes. If an error
  36883. occurs the return value is -1. The format of the returned binary
  36884. attachment is as described in *note struct stat::.
  36885. 'vFile:unlink: FILENAME'
  36886. Delete the file at FILENAME on the target. Return 0, or -1 if an
  36887. error occurs. The FILENAME is a string.
  36888. 'vFile:readlink: FILENAME'
  36889. Read value of symbolic link FILENAME on the target. Return the
  36890. number of bytes read, or -1 if an error occurs.
  36891. The data read should be returned as a binary attachment on success.
  36892. If zero bytes were read, the response should include an empty
  36893. binary attachment (i.e. a trailing semicolon). The return value is
  36894. the number of target bytes read; the binary attachment may be
  36895. longer if some characters were escaped.
  36896. 'vFile:setfs: PID'
  36897. Select the filesystem on which 'vFile' operations with FILENAME
  36898. arguments will operate. This is required for GDB to be able to
  36899. access files on remote targets where the remote stub does not share
  36900. a common filesystem with the inferior(s).
  36901. If PID is nonzero, select the filesystem as seen by process PID.
  36902. If PID is zero, select the filesystem as seen by the remote stub.
  36903. Return 0 on success, or -1 if an error occurs. If 'vFile:setfs:'
  36904. indicates success, the selected filesystem remains selected until
  36905. the next successful 'vFile:setfs:' operation.
  36906. 
  36907. File: gdb.info, Node: Interrupts, Next: Notification Packets, Prev: Host I/O Packets, Up: Remote Protocol
  36908. E.8 Interrupts
  36909. ==============
  36910. In all-stop mode, when a program on the remote target is running, GDB
  36911. may attempt to interrupt it by sending a 'Ctrl-C', 'BREAK' or a 'BREAK'
  36912. followed by 'g', control of which is specified via GDB's
  36913. 'interrupt-sequence'.
  36914. The precise meaning of 'BREAK' is defined by the transport mechanism
  36915. and may, in fact, be undefined. GDB does not currently define a 'BREAK'
  36916. mechanism for any of the network interfaces except for TCP, in which
  36917. case GDB sends the 'telnet' BREAK sequence.
  36918. 'Ctrl-C', on the other hand, is defined and implemented for all
  36919. transport mechanisms. It is represented by sending the single byte
  36920. '0x03' without any of the usual packet overhead described in the
  36921. Overview section (*note Overview::). When a '0x03' byte is transmitted
  36922. as part of a packet, it is considered to be packet data and does _not_
  36923. represent an interrupt. E.g., an 'X' packet (*note X packet::), used
  36924. for binary downloads, may include an unescaped '0x03' as part of its
  36925. packet.
  36926. 'BREAK' followed by 'g' is also known as Magic SysRq g. When Linux
  36927. kernel receives this sequence from serial port, it stops execution and
  36928. connects to gdb.
  36929. In non-stop mode, because packet resumptions are asynchronous (*note
  36930. vCont packet::), GDB is always free to send a remote command to the
  36931. remote stub, even when the target is running. For that reason, GDB
  36932. instead sends a regular packet (*note vCtrlC packet::) with the usual
  36933. packet framing instead of the single byte '0x03'.
  36934. Stubs are not required to recognize these interrupt mechanisms and
  36935. the precise meaning associated with receipt of the interrupt is
  36936. implementation defined. If the target supports debugging of multiple
  36937. threads and/or processes, it should attempt to interrupt all
  36938. currently-executing threads and processes. If the stub is successful at
  36939. interrupting the running program, it should send one of the stop reply
  36940. packets (*note Stop Reply Packets::) to GDB as a result of successfully
  36941. stopping the program in all-stop mode, and a stop reply for each stopped
  36942. thread in non-stop mode. Interrupts received while the program is
  36943. stopped are queued and the program will be interrupted when it is
  36944. resumed next time.
  36945. 
  36946. File: gdb.info, Node: Notification Packets, Next: Remote Non-Stop, Prev: Interrupts, Up: Remote Protocol
  36947. E.9 Notification Packets
  36948. ========================
  36949. The GDB remote serial protocol includes "notifications", packets that
  36950. require no acknowledgment. Both the GDB and the stub may send
  36951. notifications (although the only notifications defined at present are
  36952. sent by the stub). Notifications carry information without incurring
  36953. the round-trip latency of an acknowledgment, and so are useful for
  36954. low-impact communications where occasional packet loss is not a problem.
  36955. A notification packet has the form '% DATA # CHECKSUM', where DATA is
  36956. the content of the notification, and CHECKSUM is a checksum of DATA,
  36957. computed and formatted as for ordinary GDB packets. A notification's
  36958. DATA never contains '$', '%' or '#' characters. Upon receiving a
  36959. notification, the recipient sends no '+' or '-' to acknowledge the
  36960. notification's receipt or to report its corruption.
  36961. Every notification's DATA begins with a name, which contains no colon
  36962. characters, followed by a colon character.
  36963. Recipients should silently ignore corrupted notifications and
  36964. notifications they do not understand. Recipients should restart timeout
  36965. periods on receipt of a well-formed notification, whether or not they
  36966. understand it.
  36967. Senders should only send the notifications described here when this
  36968. protocol description specifies that they are permitted. In the future,
  36969. we may extend the protocol to permit existing notifications in new
  36970. contexts; this rule helps older senders avoid confusing newer
  36971. recipients.
  36972. (Older versions of GDB ignore bytes received until they see the '$'
  36973. byte that begins an ordinary packet, so new stubs may transmit
  36974. notifications without fear of confusing older clients. There are no
  36975. notifications defined for GDB to send at the moment, but we assume that
  36976. most older stubs would ignore them, as well.)
  36977. Each notification is comprised of three parts:
  36978. 'NAME:EVENT'
  36979. The notification packet is sent by the side that initiates the
  36980. exchange (currently, only the stub does that), with EVENT carrying
  36981. the specific information about the notification, and NAME
  36982. specifying the name of the notification.
  36983. 'ACK'
  36984. The acknowledge sent by the other side, usually GDB, to acknowledge
  36985. the exchange and request the event.
  36986. The purpose of an asynchronous notification mechanism is to report to
  36987. GDB that something interesting happened in the remote stub.
  36988. The remote stub may send notification NAME:EVENT at any time, but GDB
  36989. acknowledges the notification when appropriate. The notification event
  36990. is pending before GDB acknowledges. Only one notification at a time may
  36991. be pending; if additional events occur before GDB has acknowledged the
  36992. previous notification, they must be queued by the stub for later
  36993. synchronous transmission in response to ACK packets from GDB. Because
  36994. the notification mechanism is unreliable, the stub is permitted to
  36995. resend a notification if it believes GDB may not have received it.
  36996. Specifically, notifications may appear when GDB is not otherwise
  36997. reading input from the stub, or when GDB is expecting to read a normal
  36998. synchronous response or a '+'/'-' acknowledgment to a packet it has
  36999. sent. Notification packets are distinct from any other communication
  37000. from the stub so there is no ambiguity.
  37001. After receiving a notification, GDB shall acknowledge it by sending a
  37002. ACK packet as a regular, synchronous request to the stub. Such
  37003. acknowledgment is not required to happen immediately, as GDB is
  37004. permitted to send other, unrelated packets to the stub first, which the
  37005. stub should process normally.
  37006. Upon receiving a ACK packet, if the stub has other queued events to
  37007. report to GDB, it shall respond by sending a normal EVENT. GDB shall
  37008. then send another ACK packet to solicit further responses; again, it is
  37009. permitted to send other, unrelated packets as well which the stub should
  37010. process normally.
  37011. If the stub receives a ACK packet and there are no additional EVENT
  37012. to report, the stub shall return an 'OK' response. At this point, GDB
  37013. has finished processing a notification and the stub has completed
  37014. sending any queued events. GDB won't accept any new notifications until
  37015. the final 'OK' is received . If further notification events occur, the
  37016. stub shall send a new notification, GDB shall accept the notification,
  37017. and the process shall be repeated.
  37018. The process of asynchronous notification can be illustrated by the
  37019. following example:
  37020. <- %Stop:T0505:98e7ffbf;04:4ce6ffbf;08:b1b6e54c;thread:p7526.7526;core:0;
  37021. ...
  37022. -> vStopped
  37023. <- T0505:68f37db7;04:40f37db7;08:63850408;thread:p7526.7528;core:0;
  37024. -> vStopped
  37025. <- T0505:68e3fdb6;04:40e3fdb6;08:63850408;thread:p7526.7529;core:0;
  37026. -> vStopped
  37027. <- OK
  37028. The following notifications are defined:
  37029. NotificationAck Event Description
  37030. Stop vStopped REPLY. The REPLY has the Report an asynchronous
  37031. form of a stop reply, as stop event in non-stop
  37032. described in mode.
  37033. *note Stop Reply Packets::.
  37034. Refer to
  37035. *note Remote Non-Stop::,
  37036. for information on how
  37037. these notifications are
  37038. acknowledged by GDB.
  37039. 
  37040. File: gdb.info, Node: Remote Non-Stop, Next: Packet Acknowledgment, Prev: Notification Packets, Up: Remote Protocol
  37041. E.10 Remote Protocol Support for Non-Stop Mode
  37042. ==============================================
  37043. GDB's remote protocol supports non-stop debugging of multi-threaded
  37044. programs, as described in *note Non-Stop Mode::. If the stub supports
  37045. non-stop mode, it should report that to GDB by including 'QNonStop+' in
  37046. its 'qSupported' response (*note qSupported::).
  37047. GDB typically sends a 'QNonStop' packet only when establishing a new
  37048. connection with the stub. Entering non-stop mode does not alter the
  37049. state of any currently-running threads, but targets must stop all
  37050. threads in any already-attached processes when entering all-stop mode.
  37051. GDB uses the '?' packet as necessary to probe the target state after a
  37052. mode change.
  37053. In non-stop mode, when an attached process encounters an event that
  37054. would otherwise be reported with a stop reply, it uses the asynchronous
  37055. notification mechanism (*note Notification Packets::) to inform GDB. In
  37056. contrast to all-stop mode, where all threads in all processes are
  37057. stopped when a stop reply is sent, in non-stop mode only the thread
  37058. reporting the stop event is stopped. That is, when reporting a 'S' or
  37059. 'T' response to indicate completion of a step operation, hitting a
  37060. breakpoint, or a fault, only the affected thread is stopped; any other
  37061. still-running threads continue to run. When reporting a 'W' or 'X'
  37062. response, all running threads belonging to other attached processes
  37063. continue to run.
  37064. In non-stop mode, the target shall respond to the '?' packet as
  37065. follows. First, any incomplete stop reply notification/'vStopped'
  37066. sequence in progress is abandoned. The target must begin a new sequence
  37067. reporting stop events for all stopped threads, whether or not it has
  37068. previously reported those events to GDB. The first stop reply is sent
  37069. as a synchronous reply to the '?' packet, and subsequent stop replies
  37070. are sent as responses to 'vStopped' packets using the mechanism
  37071. described above. The target must not send asynchronous stop reply
  37072. notifications until the sequence is complete. If all threads are
  37073. running when the target receives the '?' packet, or if the target is not
  37074. attached to any process, it shall respond 'OK'.
  37075. If the stub supports non-stop mode, it should also support the
  37076. 'swbreak' stop reason if software breakpoints are supported, and the
  37077. 'hwbreak' stop reason if hardware breakpoints are supported (*note
  37078. swbreak stop reason::). This is because given the asynchronous nature
  37079. of non-stop mode, between the time a thread hits a breakpoint and the
  37080. time the event is finally processed by GDB, the breakpoint may have
  37081. already been removed from the target. Due to this, GDB needs to be able
  37082. to tell whether a trap stop was caused by a delayed breakpoint event,
  37083. which should be ignored, as opposed to a random trap signal, which
  37084. should be reported to the user. Note the 'swbreak' feature implies that
  37085. the target is responsible for adjusting the PC when a software
  37086. breakpoint triggers, if necessary, such as on the x86 architecture.
  37087. 
  37088. File: gdb.info, Node: Packet Acknowledgment, Next: Examples, Prev: Remote Non-Stop, Up: Remote Protocol
  37089. E.11 Packet Acknowledgment
  37090. ==========================
  37091. By default, when either the host or the target machine receives a
  37092. packet, the first response expected is an acknowledgment: either '+' (to
  37093. indicate the package was received correctly) or '-' (to request
  37094. retransmission). This mechanism allows the GDB remote protocol to
  37095. operate over unreliable transport mechanisms, such as a serial line.
  37096. In cases where the transport mechanism is itself reliable (such as a
  37097. pipe or TCP connection), the '+'/'-' acknowledgments are redundant. It
  37098. may be desirable to disable them in that case to reduce communication
  37099. overhead, or for other reasons. This can be accomplished by means of
  37100. the 'QStartNoAckMode' packet; *note QStartNoAckMode::.
  37101. When in no-acknowledgment mode, neither the stub nor GDB shall send
  37102. or expect '+'/'-' protocol acknowledgments. The packet and response
  37103. format still includes the normal checksum, as described in *note
  37104. Overview::, but the checksum may be ignored by the receiver.
  37105. If the stub supports 'QStartNoAckMode' and prefers to operate in
  37106. no-acknowledgment mode, it should report that to GDB by including
  37107. 'QStartNoAckMode+' in its response to 'qSupported'; *note qSupported::.
  37108. If GDB also supports 'QStartNoAckMode' and it has not been disabled via
  37109. the 'set remote noack-packet off' command (*note Remote
  37110. Configuration::), GDB may then send a 'QStartNoAckMode' packet to the
  37111. stub. Only then may the stub actually turn off packet acknowledgments.
  37112. GDB sends a final '+' acknowledgment of the stub's 'OK' response, which
  37113. can be safely ignored by the stub.
  37114. Note that 'set remote noack-packet' command only affects negotiation
  37115. between GDB and the stub when subsequent connections are made; it does
  37116. not affect the protocol acknowledgment state for any current connection.
  37117. Since '+'/'-' acknowledgments are enabled by default when a new
  37118. connection is established, there is also no protocol request to
  37119. re-enable the acknowledgments for the current connection, once disabled.
  37120. 
  37121. File: gdb.info, Node: Examples, Next: File-I/O Remote Protocol Extension, Prev: Packet Acknowledgment, Up: Remote Protocol
  37122. E.12 Examples
  37123. =============
  37124. Example sequence of a target being re-started. Notice how the restart
  37125. does not get any direct output:
  37126. -> R00
  37127. <- +
  37128. _target restarts_
  37129. -> ?
  37130. <- +
  37131. <- T001:1234123412341234
  37132. -> +
  37133. Example sequence of a target being stepped by a single instruction:
  37134. -> G1445...
  37135. <- +
  37136. -> s
  37137. <- +
  37138. _time passes_
  37139. <- T001:1234123412341234
  37140. -> +
  37141. -> g
  37142. <- +
  37143. <- 1455...
  37144. -> +
  37145. 
  37146. File: gdb.info, Node: File-I/O Remote Protocol Extension, Next: Library List Format, Prev: Examples, Up: Remote Protocol
  37147. E.13 File-I/O Remote Protocol Extension
  37148. =======================================
  37149. * Menu:
  37150. * File-I/O Overview::
  37151. * Protocol Basics::
  37152. * The F Request Packet::
  37153. * The F Reply Packet::
  37154. * The Ctrl-C Message::
  37155. * Console I/O::
  37156. * List of Supported Calls::
  37157. * Protocol-specific Representation of Datatypes::
  37158. * Constants::
  37159. * File-I/O Examples::
  37160. 
  37161. File: gdb.info, Node: File-I/O Overview, Next: Protocol Basics, Up: File-I/O Remote Protocol Extension
  37162. E.13.1 File-I/O Overview
  37163. ------------------------
  37164. The "File I/O remote protocol extension" (short: File-I/O) allows the
  37165. target to use the host's file system and console I/O to perform various
  37166. system calls. System calls on the target system are translated into a
  37167. remote protocol packet to the host system, which then performs the
  37168. needed actions and returns a response packet to the target system. This
  37169. simulates file system operations even on targets that lack file systems.
  37170. The protocol is defined to be independent of both the host and target
  37171. systems. It uses its own internal representation of datatypes and
  37172. values. Both GDB and the target's GDB stub are responsible for
  37173. translating the system-dependent value representations into the internal
  37174. protocol representations when data is transmitted.
  37175. The communication is synchronous. A system call is possible only
  37176. when GDB is waiting for a response from the 'C', 'c', 'S' or 's'
  37177. packets. While GDB handles the request for a system call, the target is
  37178. stopped to allow deterministic access to the target's memory. Therefore
  37179. File-I/O is not interruptible by target signals. On the other hand, it
  37180. is possible to interrupt File-I/O by a user interrupt ('Ctrl-C') within
  37181. GDB.
  37182. The target's request to perform a host system call does not finish
  37183. the latest 'C', 'c', 'S' or 's' action. That means, after finishing the
  37184. system call, the target returns to continuing the previous activity
  37185. (continue, step). No additional continue or step request from GDB is
  37186. required.
  37187. (gdb) continue
  37188. <- target requests 'system call X'
  37189. target is stopped, GDB executes system call
  37190. -> GDB returns result
  37191. ... target continues, GDB returns to wait for the target
  37192. <- target hits breakpoint and sends a Txx packet
  37193. The protocol only supports I/O on the console and to regular files on
  37194. the host file system. Character or block special devices, pipes, named
  37195. pipes, sockets or any other communication method on the host system are
  37196. not supported by this protocol.
  37197. File I/O is not supported in non-stop mode.
  37198. 
  37199. File: gdb.info, Node: Protocol Basics, Next: The F Request Packet, Prev: File-I/O Overview, Up: File-I/O Remote Protocol Extension
  37200. E.13.2 Protocol Basics
  37201. ----------------------
  37202. The File-I/O protocol uses the 'F' packet as the request as well as
  37203. reply packet. Since a File-I/O system call can only occur when GDB is
  37204. waiting for a response from the continuing or stepping target, the
  37205. File-I/O request is a reply that GDB has to expect as a result of a
  37206. previous 'C', 'c', 'S' or 's' packet. This 'F' packet contains all
  37207. information needed to allow GDB to call the appropriate host system
  37208. call:
  37209. * A unique identifier for the requested system call.
  37210. * All parameters to the system call. Pointers are given as addresses
  37211. in the target memory address space. Pointers to strings are given
  37212. as pointer/length pair. Numerical values are given as they are.
  37213. Numerical control flags are given in a protocol-specific
  37214. representation.
  37215. At this point, GDB has to perform the following actions.
  37216. * If the parameters include pointer values to data needed as input to
  37217. a system call, GDB requests this data from the target with a
  37218. standard 'm' packet request. This additional communication has to
  37219. be expected by the target implementation and is handled as any
  37220. other 'm' packet.
  37221. * GDB translates all value from protocol representation to host
  37222. representation as needed. Datatypes are coerced into the host
  37223. types.
  37224. * GDB calls the system call.
  37225. * It then coerces datatypes back to protocol representation.
  37226. * If the system call is expected to return data in buffer space
  37227. specified by pointer parameters to the call, the data is
  37228. transmitted to the target using a 'M' or 'X' packet. This packet
  37229. has to be expected by the target implementation and is handled as
  37230. any other 'M' or 'X' packet.
  37231. Eventually GDB replies with another 'F' packet which contains all
  37232. necessary information for the target to continue. This at least
  37233. contains
  37234. * Return value.
  37235. * 'errno', if has been changed by the system call.
  37236. * "Ctrl-C" flag.
  37237. After having done the needed type and value coercion, the target
  37238. continues the latest continue or step action.
  37239. 
  37240. File: gdb.info, Node: The F Request Packet, Next: The F Reply Packet, Prev: Protocol Basics, Up: File-I/O Remote Protocol Extension
  37241. E.13.3 The 'F' Request Packet
  37242. -----------------------------
  37243. The 'F' request packet has the following format:
  37244. 'FCALL-ID,PARAMETER...'
  37245. CALL-ID is the identifier to indicate the host system call to be
  37246. called. This is just the name of the function.
  37247. PARAMETER... are the parameters to the system call. Parameters are
  37248. hexadecimal integer values, either the actual values in case of
  37249. scalar datatypes, pointers to target buffer space in case of
  37250. compound datatypes and unspecified memory areas, or pointer/length
  37251. pairs in case of string parameters. These are appended to the
  37252. CALL-ID as a comma-delimited list. All values are transmitted in
  37253. ASCII string representation, pointer/length pairs separated by a
  37254. slash.
  37255. 
  37256. File: gdb.info, Node: The F Reply Packet, Next: The Ctrl-C Message, Prev: The F Request Packet, Up: File-I/O Remote Protocol Extension
  37257. E.13.4 The 'F' Reply Packet
  37258. ---------------------------
  37259. The 'F' reply packet has the following format:
  37260. 'FRETCODE,ERRNO,CTRL-C FLAG;CALL-SPECIFIC ATTACHMENT'
  37261. RETCODE is the return code of the system call as hexadecimal value.
  37262. ERRNO is the 'errno' set by the call, in protocol-specific
  37263. representation. This parameter can be omitted if the call was
  37264. successful.
  37265. CTRL-C FLAG is only sent if the user requested a break. In this
  37266. case, ERRNO must be sent as well, even if the call was successful.
  37267. The CTRL-C FLAG itself consists of the character 'C':
  37268. F0,0,C
  37269. or, if the call was interrupted before the host call has been
  37270. performed:
  37271. F-1,4,C
  37272. assuming 4 is the protocol-specific representation of 'EINTR'.
  37273. 
  37274. File: gdb.info, Node: The Ctrl-C Message, Next: Console I/O, Prev: The F Reply Packet, Up: File-I/O Remote Protocol Extension
  37275. E.13.5 The 'Ctrl-C' Message
  37276. ---------------------------
  37277. If the 'Ctrl-C' flag is set in the GDB reply packet (*note The F Reply
  37278. Packet::), the target should behave as if it had gotten a break message.
  37279. The meaning for the target is "system call interrupted by 'SIGINT'".
  37280. Consequentially, the target should actually stop (as with a break
  37281. message) and return to GDB with a 'T02' packet.
  37282. It's important for the target to know in which state the system call
  37283. was interrupted. There are two possible cases:
  37284. * The system call hasn't been performed on the host yet.
  37285. * The system call on the host has been finished.
  37286. These two states can be distinguished by the target by the value of
  37287. the returned 'errno'. If it's the protocol representation of 'EINTR',
  37288. the system call hasn't been performed. This is equivalent to the
  37289. 'EINTR' handling on POSIX systems. In any other case, the target may
  37290. presume that the system call has been finished -- successfully or not --
  37291. and should behave as if the break message arrived right after the system
  37292. call.
  37293. GDB must behave reliably. If the system call has not been called
  37294. yet, GDB may send the 'F' reply immediately, setting 'EINTR' as 'errno'
  37295. in the packet. If the system call on the host has been finished before
  37296. the user requests a break, the full action must be finished by GDB.
  37297. This requires sending 'M' or 'X' packets as necessary. The 'F' packet
  37298. may only be sent when either nothing has happened or the full action has
  37299. been completed.
  37300. 
  37301. File: gdb.info, Node: Console I/O, Next: List of Supported Calls, Prev: The Ctrl-C Message, Up: File-I/O Remote Protocol Extension
  37302. E.13.6 Console I/O
  37303. ------------------
  37304. By default and if not explicitly closed by the target system, the file
  37305. descriptors 0, 1 and 2 are connected to the GDB console. Output on the
  37306. GDB console is handled as any other file output operation ('write(1,
  37307. ...)' or 'write(2, ...)'). Console input is handled by GDB so that
  37308. after the target read request from file descriptor 0 all following
  37309. typing is buffered until either one of the following conditions is met:
  37310. * The user types 'Ctrl-c'. The behaviour is as explained above, and
  37311. the 'read' system call is treated as finished.
  37312. * The user presses <RET>. This is treated as end of input with a
  37313. trailing newline.
  37314. * The user types 'Ctrl-d'. This is treated as end of input. No
  37315. trailing character (neither newline nor 'Ctrl-D') is appended to
  37316. the input.
  37317. If the user has typed more characters than fit in the buffer given to
  37318. the 'read' call, the trailing characters are buffered in GDB until
  37319. either another 'read(0, ...)' is requested by the target, or debugging
  37320. is stopped at the user's request.
  37321. 
  37322. File: gdb.info, Node: List of Supported Calls, Next: Protocol-specific Representation of Datatypes, Prev: Console I/O, Up: File-I/O Remote Protocol Extension
  37323. E.13.7 List of Supported Calls
  37324. ------------------------------
  37325. * Menu:
  37326. * open::
  37327. * close::
  37328. * read::
  37329. * write::
  37330. * lseek::
  37331. * rename::
  37332. * unlink::
  37333. * stat/fstat::
  37334. * gettimeofday::
  37335. * isatty::
  37336. * system::
  37337. 
  37338. File: gdb.info, Node: open, Next: close, Up: List of Supported Calls
  37339. open
  37340. ....
  37341. Synopsis:
  37342. int open(const char *pathname, int flags);
  37343. int open(const char *pathname, int flags, mode_t mode);
  37344. Request:
  37345. 'Fopen,PATHPTR/LEN,FLAGS,MODE'
  37346. FLAGS is the bitwise 'OR' of the following values:
  37347. 'O_CREAT'
  37348. If the file does not exist it will be created. The host rules
  37349. apply as far as file ownership and time stamps are concerned.
  37350. 'O_EXCL'
  37351. When used with 'O_CREAT', if the file already exists it is an
  37352. error and open() fails.
  37353. 'O_TRUNC'
  37354. If the file already exists and the open mode allows writing
  37355. ('O_RDWR' or 'O_WRONLY' is given) it will be truncated to zero
  37356. length.
  37357. 'O_APPEND'
  37358. The file is opened in append mode.
  37359. 'O_RDONLY'
  37360. The file is opened for reading only.
  37361. 'O_WRONLY'
  37362. The file is opened for writing only.
  37363. 'O_RDWR'
  37364. The file is opened for reading and writing.
  37365. Other bits are silently ignored.
  37366. MODE is the bitwise 'OR' of the following values:
  37367. 'S_IRUSR'
  37368. User has read permission.
  37369. 'S_IWUSR'
  37370. User has write permission.
  37371. 'S_IRGRP'
  37372. Group has read permission.
  37373. 'S_IWGRP'
  37374. Group has write permission.
  37375. 'S_IROTH'
  37376. Others have read permission.
  37377. 'S_IWOTH'
  37378. Others have write permission.
  37379. Other bits are silently ignored.
  37380. Return value:
  37381. 'open' returns the new file descriptor or -1 if an error occurred.
  37382. Errors:
  37383. 'EEXIST'
  37384. PATHNAME already exists and 'O_CREAT' and 'O_EXCL' were used.
  37385. 'EISDIR'
  37386. PATHNAME refers to a directory.
  37387. 'EACCES'
  37388. The requested access is not allowed.
  37389. 'ENAMETOOLONG'
  37390. PATHNAME was too long.
  37391. 'ENOENT'
  37392. A directory component in PATHNAME does not exist.
  37393. 'ENODEV'
  37394. PATHNAME refers to a device, pipe, named pipe or socket.
  37395. 'EROFS'
  37396. PATHNAME refers to a file on a read-only filesystem and write
  37397. access was requested.
  37398. 'EFAULT'
  37399. PATHNAME is an invalid pointer value.
  37400. 'ENOSPC'
  37401. No space on device to create the file.
  37402. 'EMFILE'
  37403. The process already has the maximum number of files open.
  37404. 'ENFILE'
  37405. The limit on the total number of files open on the system has
  37406. been reached.
  37407. 'EINTR'
  37408. The call was interrupted by the user.
  37409. 
  37410. File: gdb.info, Node: close, Next: read, Prev: open, Up: List of Supported Calls
  37411. close
  37412. .....
  37413. Synopsis:
  37414. int close(int fd);
  37415. Request:
  37416. 'Fclose,FD'
  37417. Return value:
  37418. 'close' returns zero on success, or -1 if an error occurred.
  37419. Errors:
  37420. 'EBADF'
  37421. FD isn't a valid open file descriptor.
  37422. 'EINTR'
  37423. The call was interrupted by the user.
  37424. 
  37425. File: gdb.info, Node: read, Next: write, Prev: close, Up: List of Supported Calls
  37426. read
  37427. ....
  37428. Synopsis:
  37429. int read(int fd, void *buf, unsigned int count);
  37430. Request:
  37431. 'Fread,FD,BUFPTR,COUNT'
  37432. Return value:
  37433. On success, the number of bytes read is returned. Zero indicates
  37434. end of file. If count is zero, read returns zero as well. On
  37435. error, -1 is returned.
  37436. Errors:
  37437. 'EBADF'
  37438. FD is not a valid file descriptor or is not open for reading.
  37439. 'EFAULT'
  37440. BUFPTR is an invalid pointer value.
  37441. 'EINTR'
  37442. The call was interrupted by the user.
  37443. 
  37444. File: gdb.info, Node: write, Next: lseek, Prev: read, Up: List of Supported Calls
  37445. write
  37446. .....
  37447. Synopsis:
  37448. int write(int fd, const void *buf, unsigned int count);
  37449. Request:
  37450. 'Fwrite,FD,BUFPTR,COUNT'
  37451. Return value:
  37452. On success, the number of bytes written are returned. Zero
  37453. indicates nothing was written. On error, -1 is returned.
  37454. Errors:
  37455. 'EBADF'
  37456. FD is not a valid file descriptor or is not open for writing.
  37457. 'EFAULT'
  37458. BUFPTR is an invalid pointer value.
  37459. 'EFBIG'
  37460. An attempt was made to write a file that exceeds the
  37461. host-specific maximum file size allowed.
  37462. 'ENOSPC'
  37463. No space on device to write the data.
  37464. 'EINTR'
  37465. The call was interrupted by the user.
  37466. 
  37467. File: gdb.info, Node: lseek, Next: rename, Prev: write, Up: List of Supported Calls
  37468. lseek
  37469. .....
  37470. Synopsis:
  37471. long lseek (int fd, long offset, int flag);
  37472. Request:
  37473. 'Flseek,FD,OFFSET,FLAG'
  37474. FLAG is one of:
  37475. 'SEEK_SET'
  37476. The offset is set to OFFSET bytes.
  37477. 'SEEK_CUR'
  37478. The offset is set to its current location plus OFFSET bytes.
  37479. 'SEEK_END'
  37480. The offset is set to the size of the file plus OFFSET bytes.
  37481. Return value:
  37482. On success, the resulting unsigned offset in bytes from the
  37483. beginning of the file is returned. Otherwise, a value of -1 is
  37484. returned.
  37485. Errors:
  37486. 'EBADF'
  37487. FD is not a valid open file descriptor.
  37488. 'ESPIPE'
  37489. FD is associated with the GDB console.
  37490. 'EINVAL'
  37491. FLAG is not a proper value.
  37492. 'EINTR'
  37493. The call was interrupted by the user.
  37494. 
  37495. File: gdb.info, Node: rename, Next: unlink, Prev: lseek, Up: List of Supported Calls
  37496. rename
  37497. ......
  37498. Synopsis:
  37499. int rename(const char *oldpath, const char *newpath);
  37500. Request:
  37501. 'Frename,OLDPATHPTR/LEN,NEWPATHPTR/LEN'
  37502. Return value:
  37503. On success, zero is returned. On error, -1 is returned.
  37504. Errors:
  37505. 'EISDIR'
  37506. NEWPATH is an existing directory, but OLDPATH is not a
  37507. directory.
  37508. 'EEXIST'
  37509. NEWPATH is a non-empty directory.
  37510. 'EBUSY'
  37511. OLDPATH or NEWPATH is a directory that is in use by some
  37512. process.
  37513. 'EINVAL'
  37514. An attempt was made to make a directory a subdirectory of
  37515. itself.
  37516. 'ENOTDIR'
  37517. A component used as a directory in OLDPATH or new path is not
  37518. a directory. Or OLDPATH is a directory and NEWPATH exists but
  37519. is not a directory.
  37520. 'EFAULT'
  37521. OLDPATHPTR or NEWPATHPTR are invalid pointer values.
  37522. 'EACCES'
  37523. No access to the file or the path of the file.
  37524. 'ENAMETOOLONG'
  37525. OLDPATH or NEWPATH was too long.
  37526. 'ENOENT'
  37527. A directory component in OLDPATH or NEWPATH does not exist.
  37528. 'EROFS'
  37529. The file is on a read-only filesystem.
  37530. 'ENOSPC'
  37531. The device containing the file has no room for the new
  37532. directory entry.
  37533. 'EINTR'
  37534. The call was interrupted by the user.
  37535. 
  37536. File: gdb.info, Node: unlink, Next: stat/fstat, Prev: rename, Up: List of Supported Calls
  37537. unlink
  37538. ......
  37539. Synopsis:
  37540. int unlink(const char *pathname);
  37541. Request:
  37542. 'Funlink,PATHNAMEPTR/LEN'
  37543. Return value:
  37544. On success, zero is returned. On error, -1 is returned.
  37545. Errors:
  37546. 'EACCES'
  37547. No access to the file or the path of the file.
  37548. 'EPERM'
  37549. The system does not allow unlinking of directories.
  37550. 'EBUSY'
  37551. The file PATHNAME cannot be unlinked because it's being used
  37552. by another process.
  37553. 'EFAULT'
  37554. PATHNAMEPTR is an invalid pointer value.
  37555. 'ENAMETOOLONG'
  37556. PATHNAME was too long.
  37557. 'ENOENT'
  37558. A directory component in PATHNAME does not exist.
  37559. 'ENOTDIR'
  37560. A component of the path is not a directory.
  37561. 'EROFS'
  37562. The file is on a read-only filesystem.
  37563. 'EINTR'
  37564. The call was interrupted by the user.
  37565. 
  37566. File: gdb.info, Node: stat/fstat, Next: gettimeofday, Prev: unlink, Up: List of Supported Calls
  37567. stat/fstat
  37568. ..........
  37569. Synopsis:
  37570. int stat(const char *pathname, struct stat *buf);
  37571. int fstat(int fd, struct stat *buf);
  37572. Request:
  37573. 'Fstat,PATHNAMEPTR/LEN,BUFPTR'
  37574. 'Ffstat,FD,BUFPTR'
  37575. Return value:
  37576. On success, zero is returned. On error, -1 is returned.
  37577. Errors:
  37578. 'EBADF'
  37579. FD is not a valid open file.
  37580. 'ENOENT'
  37581. A directory component in PATHNAME does not exist or the path
  37582. is an empty string.
  37583. 'ENOTDIR'
  37584. A component of the path is not a directory.
  37585. 'EFAULT'
  37586. PATHNAMEPTR is an invalid pointer value.
  37587. 'EACCES'
  37588. No access to the file or the path of the file.
  37589. 'ENAMETOOLONG'
  37590. PATHNAME was too long.
  37591. 'EINTR'
  37592. The call was interrupted by the user.
  37593. 
  37594. File: gdb.info, Node: gettimeofday, Next: isatty, Prev: stat/fstat, Up: List of Supported Calls
  37595. gettimeofday
  37596. ............
  37597. Synopsis:
  37598. int gettimeofday(struct timeval *tv, void *tz);
  37599. Request:
  37600. 'Fgettimeofday,TVPTR,TZPTR'
  37601. Return value:
  37602. On success, 0 is returned, -1 otherwise.
  37603. Errors:
  37604. 'EINVAL'
  37605. TZ is a non-NULL pointer.
  37606. 'EFAULT'
  37607. TVPTR and/or TZPTR is an invalid pointer value.
  37608. 
  37609. File: gdb.info, Node: isatty, Next: system, Prev: gettimeofday, Up: List of Supported Calls
  37610. isatty
  37611. ......
  37612. Synopsis:
  37613. int isatty(int fd);
  37614. Request:
  37615. 'Fisatty,FD'
  37616. Return value:
  37617. Returns 1 if FD refers to the GDB console, 0 otherwise.
  37618. Errors:
  37619. 'EINTR'
  37620. The call was interrupted by the user.
  37621. Note that the 'isatty' call is treated as a special case: it returns
  37622. 1 to the target if the file descriptor is attached to the GDB console, 0
  37623. otherwise. Implementing through system calls would require implementing
  37624. 'ioctl' and would be more complex than needed.
  37625. 
  37626. File: gdb.info, Node: system, Prev: isatty, Up: List of Supported Calls
  37627. system
  37628. ......
  37629. Synopsis:
  37630. int system(const char *command);
  37631. Request:
  37632. 'Fsystem,COMMANDPTR/LEN'
  37633. Return value:
  37634. If LEN is zero, the return value indicates whether a shell is
  37635. available. A zero return value indicates a shell is not available.
  37636. For non-zero LEN, the value returned is -1 on error and the return
  37637. status of the command otherwise. Only the exit status of the
  37638. command is returned, which is extracted from the host's 'system'
  37639. return value by calling 'WEXITSTATUS(retval)'. In case '/bin/sh'
  37640. could not be executed, 127 is returned.
  37641. Errors:
  37642. 'EINTR'
  37643. The call was interrupted by the user.
  37644. GDB takes over the full task of calling the necessary host calls to
  37645. perform the 'system' call. The return value of 'system' on the host is
  37646. simplified before it's returned to the target. Any termination signal
  37647. information from the child process is discarded, and the return value
  37648. consists entirely of the exit status of the called command.
  37649. Due to security concerns, the 'system' call is by default refused by
  37650. GDB. The user has to allow this call explicitly with the 'set remote
  37651. system-call-allowed 1' command.
  37652. 'set remote system-call-allowed'
  37653. Control whether to allow the 'system' calls in the File I/O
  37654. protocol for the remote target. The default is zero (disabled).
  37655. 'show remote system-call-allowed'
  37656. Show whether the 'system' calls are allowed in the File I/O
  37657. protocol.
  37658. 
  37659. File: gdb.info, Node: Protocol-specific Representation of Datatypes, Next: Constants, Prev: List of Supported Calls, Up: File-I/O Remote Protocol Extension
  37660. E.13.8 Protocol-specific Representation of Datatypes
  37661. ----------------------------------------------------
  37662. * Menu:
  37663. * Integral Datatypes::
  37664. * Pointer Values::
  37665. * Memory Transfer::
  37666. * struct stat::
  37667. * struct timeval::
  37668. 
  37669. File: gdb.info, Node: Integral Datatypes, Next: Pointer Values, Up: Protocol-specific Representation of Datatypes
  37670. Integral Datatypes
  37671. ..................
  37672. The integral datatypes used in the system calls are 'int', 'unsigned
  37673. int', 'long', 'unsigned long', 'mode_t', and 'time_t'.
  37674. 'int', 'unsigned int', 'mode_t' and 'time_t' are implemented as 32
  37675. bit values in this protocol.
  37676. 'long' and 'unsigned long' are implemented as 64 bit types.
  37677. *Note Limits::, for corresponding MIN and MAX values (similar to
  37678. those in 'limits.h') to allow range checking on host and target.
  37679. 'time_t' datatypes are defined as seconds since the Epoch.
  37680. All integral datatypes transferred as part of a memory read or write
  37681. of a structured datatype e.g. a 'struct stat' have to be given in big
  37682. endian byte order.
  37683. 
  37684. File: gdb.info, Node: Pointer Values, Next: Memory Transfer, Prev: Integral Datatypes, Up: Protocol-specific Representation of Datatypes
  37685. Pointer Values
  37686. ..............
  37687. Pointers to target data are transmitted as they are. An exception is
  37688. made for pointers to buffers for which the length isn't transmitted as
  37689. part of the function call, namely strings. Strings are transmitted as a
  37690. pointer/length pair, both as hex values, e.g.
  37691. 1aaf/12
  37692. which is a pointer to data of length 18 bytes at position 0x1aaf. The
  37693. length is defined as the full string length in bytes, including the
  37694. trailing null byte. For example, the string '"hello world"' at address
  37695. 0x123456 is transmitted as
  37696. 123456/d
  37697. 
  37698. File: gdb.info, Node: Memory Transfer, Next: struct stat, Prev: Pointer Values, Up: Protocol-specific Representation of Datatypes
  37699. Memory Transfer
  37700. ...............
  37701. Structured data which is transferred using a memory read or write (for
  37702. example, a 'struct stat') is expected to be in a protocol-specific
  37703. format with all scalar multibyte datatypes being big endian.
  37704. Translation to this representation needs to be done both by the target
  37705. before the 'F' packet is sent, and by GDB before it transfers memory to
  37706. the target. Transferred pointers to structured data should point to the
  37707. already-coerced data at any time.
  37708. 
  37709. File: gdb.info, Node: struct stat, Next: struct timeval, Prev: Memory Transfer, Up: Protocol-specific Representation of Datatypes
  37710. struct stat
  37711. ...........
  37712. The buffer of type 'struct stat' used by the target and GDB is defined
  37713. as follows:
  37714. struct stat {
  37715. unsigned int st_dev; /* device */
  37716. unsigned int st_ino; /* inode */
  37717. mode_t st_mode; /* protection */
  37718. unsigned int st_nlink; /* number of hard links */
  37719. unsigned int st_uid; /* user ID of owner */
  37720. unsigned int st_gid; /* group ID of owner */
  37721. unsigned int st_rdev; /* device type (if inode device) */
  37722. unsigned long st_size; /* total size, in bytes */
  37723. unsigned long st_blksize; /* blocksize for filesystem I/O */
  37724. unsigned long st_blocks; /* number of blocks allocated */
  37725. time_t st_atime; /* time of last access */
  37726. time_t st_mtime; /* time of last modification */
  37727. time_t st_ctime; /* time of last change */
  37728. };
  37729. The integral datatypes conform to the definitions given in the
  37730. appropriate section (see *note Integral Datatypes::, for details) so
  37731. this structure is of size 64 bytes.
  37732. The values of several fields have a restricted meaning and/or range
  37733. of values.
  37734. 'st_dev'
  37735. A value of 0 represents a file, 1 the console.
  37736. 'st_ino'
  37737. No valid meaning for the target. Transmitted unchanged.
  37738. 'st_mode'
  37739. Valid mode bits are described in *note Constants::. Any other bits
  37740. have currently no meaning for the target.
  37741. 'st_uid'
  37742. 'st_gid'
  37743. 'st_rdev'
  37744. No valid meaning for the target. Transmitted unchanged.
  37745. 'st_atime'
  37746. 'st_mtime'
  37747. 'st_ctime'
  37748. These values have a host and file system dependent accuracy.
  37749. Especially on Windows hosts, the file system may not support exact
  37750. timing values.
  37751. The target gets a 'struct stat' of the above representation and is
  37752. responsible for coercing it to the target representation before
  37753. continuing.
  37754. Note that due to size differences between the host, target, and
  37755. protocol representations of 'struct stat' members, these members could
  37756. eventually get truncated on the target.
  37757. 
  37758. File: gdb.info, Node: struct timeval, Prev: struct stat, Up: Protocol-specific Representation of Datatypes
  37759. struct timeval
  37760. ..............
  37761. The buffer of type 'struct timeval' used by the File-I/O protocol is
  37762. defined as follows:
  37763. struct timeval {
  37764. time_t tv_sec; /* second */
  37765. long tv_usec; /* microsecond */
  37766. };
  37767. The integral datatypes conform to the definitions given in the
  37768. appropriate section (see *note Integral Datatypes::, for details) so
  37769. this structure is of size 8 bytes.
  37770. 
  37771. File: gdb.info, Node: Constants, Next: File-I/O Examples, Prev: Protocol-specific Representation of Datatypes, Up: File-I/O Remote Protocol Extension
  37772. E.13.9 Constants
  37773. ----------------
  37774. The following values are used for the constants inside of the protocol.
  37775. GDB and target are responsible for translating these values before and
  37776. after the call as needed.
  37777. * Menu:
  37778. * Open Flags::
  37779. * mode_t Values::
  37780. * Errno Values::
  37781. * Lseek Flags::
  37782. * Limits::
  37783. 
  37784. File: gdb.info, Node: Open Flags, Next: mode_t Values, Up: Constants
  37785. Open Flags
  37786. ..........
  37787. All values are given in hexadecimal representation.
  37788. O_RDONLY 0x0
  37789. O_WRONLY 0x1
  37790. O_RDWR 0x2
  37791. O_APPEND 0x8
  37792. O_CREAT 0x200
  37793. O_TRUNC 0x400
  37794. O_EXCL 0x800
  37795. 
  37796. File: gdb.info, Node: mode_t Values, Next: Errno Values, Prev: Open Flags, Up: Constants
  37797. mode_t Values
  37798. .............
  37799. All values are given in octal representation.
  37800. S_IFREG 0100000
  37801. S_IFDIR 040000
  37802. S_IRUSR 0400
  37803. S_IWUSR 0200
  37804. S_IXUSR 0100
  37805. S_IRGRP 040
  37806. S_IWGRP 020
  37807. S_IXGRP 010
  37808. S_IROTH 04
  37809. S_IWOTH 02
  37810. S_IXOTH 01
  37811. 
  37812. File: gdb.info, Node: Errno Values, Next: Lseek Flags, Prev: mode_t Values, Up: Constants
  37813. Errno Values
  37814. ............
  37815. All values are given in decimal representation.
  37816. EPERM 1
  37817. ENOENT 2
  37818. EINTR 4
  37819. EBADF 9
  37820. EACCES 13
  37821. EFAULT 14
  37822. EBUSY 16
  37823. EEXIST 17
  37824. ENODEV 19
  37825. ENOTDIR 20
  37826. EISDIR 21
  37827. EINVAL 22
  37828. ENFILE 23
  37829. EMFILE 24
  37830. EFBIG 27
  37831. ENOSPC 28
  37832. ESPIPE 29
  37833. EROFS 30
  37834. ENAMETOOLONG 91
  37835. EUNKNOWN 9999
  37836. 'EUNKNOWN' is used as a fallback error value if a host system returns
  37837. any error value not in the list of supported error numbers.
  37838. 
  37839. File: gdb.info, Node: Lseek Flags, Next: Limits, Prev: Errno Values, Up: Constants
  37840. Lseek Flags
  37841. ...........
  37842. SEEK_SET 0
  37843. SEEK_CUR 1
  37844. SEEK_END 2
  37845. 
  37846. File: gdb.info, Node: Limits, Prev: Lseek Flags, Up: Constants
  37847. Limits
  37848. ......
  37849. All values are given in decimal representation.
  37850. INT_MIN -2147483648
  37851. INT_MAX 2147483647
  37852. UINT_MAX 4294967295
  37853. LONG_MIN -9223372036854775808
  37854. LONG_MAX 9223372036854775807
  37855. ULONG_MAX 18446744073709551615
  37856. 
  37857. File: gdb.info, Node: File-I/O Examples, Prev: Constants, Up: File-I/O Remote Protocol Extension
  37858. E.13.10 File-I/O Examples
  37859. -------------------------
  37860. Example sequence of a write call, file descriptor 3, buffer is at target
  37861. address 0x1234, 6 bytes should be written:
  37862. <- Fwrite,3,1234,6
  37863. _request memory read from target_
  37864. -> m1234,6
  37865. <- XXXXXX
  37866. _return "6 bytes written"_
  37867. -> F6
  37868. Example sequence of a read call, file descriptor 3, buffer is at
  37869. target address 0x1234, 6 bytes should be read:
  37870. <- Fread,3,1234,6
  37871. _request memory write to target_
  37872. -> X1234,6:XXXXXX
  37873. _return "6 bytes read"_
  37874. -> F6
  37875. Example sequence of a read call, call fails on the host due to
  37876. invalid file descriptor ('EBADF'):
  37877. <- Fread,3,1234,6
  37878. -> F-1,9
  37879. Example sequence of a read call, user presses 'Ctrl-c' before syscall
  37880. on host is called:
  37881. <- Fread,3,1234,6
  37882. -> F-1,4,C
  37883. <- T02
  37884. Example sequence of a read call, user presses 'Ctrl-c' after syscall
  37885. on host is called:
  37886. <- Fread,3,1234,6
  37887. -> X1234,6:XXXXXX
  37888. <- T02
  37889. 
  37890. File: gdb.info, Node: Library List Format, Next: Library List Format for SVR4 Targets, Prev: File-I/O Remote Protocol Extension, Up: Remote Protocol
  37891. E.14 Library List Format
  37892. ========================
  37893. On some platforms, a dynamic loader (e.g. 'ld.so') runs in the same
  37894. process as your application to manage libraries. In this case, GDB can
  37895. use the loader's symbol table and normal memory operations to maintain a
  37896. list of shared libraries. On other platforms, the operating system
  37897. manages loaded libraries. GDB can not retrieve the list of currently
  37898. loaded libraries through memory operations, so it uses the
  37899. 'qXfer:libraries:read' packet (*note qXfer library list read::) instead.
  37900. The remote stub queries the target's operating system and reports which
  37901. libraries are loaded.
  37902. The 'qXfer:libraries:read' packet returns an XML document which lists
  37903. loaded libraries and their offsets. Each library has an associated name
  37904. and one or more segment or section base addresses, which report where
  37905. the library was loaded in memory.
  37906. For the common case of libraries that are fully linked binaries, the
  37907. library should have a list of segments. If the target supports dynamic
  37908. linking of a relocatable object file, its library XML element should
  37909. instead include a list of allocated sections. The segment or section
  37910. bases are start addresses, not relocation offsets; they do not depend on
  37911. the library's link-time base addresses.
  37912. GDB must be linked with the Expat library to support XML library
  37913. lists. *Note Expat::.
  37914. A simple memory map, with one loaded library relocated by a single
  37915. offset, looks like this:
  37916. <library-list>
  37917. <library name="/lib/libc.so.6">
  37918. <segment address="0x10000000"/>
  37919. </library>
  37920. </library-list>
  37921. Another simple memory map, with one loaded library with three
  37922. allocated sections (.text, .data, .bss), looks like this:
  37923. <library-list>
  37924. <library name="sharedlib.o">
  37925. <section address="0x10000000"/>
  37926. <section address="0x20000000"/>
  37927. <section address="0x30000000"/>
  37928. </library>
  37929. </library-list>
  37930. The format of a library list is described by this DTD:
  37931. <!-- library-list: Root element with versioning -->
  37932. <!ELEMENT library-list (library)*>
  37933. <!ATTLIST library-list version CDATA #FIXED "1.0">
  37934. <!ELEMENT library (segment*, section*)>
  37935. <!ATTLIST library name CDATA #REQUIRED>
  37936. <!ELEMENT segment EMPTY>
  37937. <!ATTLIST segment address CDATA #REQUIRED>
  37938. <!ELEMENT section EMPTY>
  37939. <!ATTLIST section address CDATA #REQUIRED>
  37940. In addition, segments and section descriptors cannot be mixed within
  37941. a single library element, and you must supply at least one segment or
  37942. section for each library.
  37943. 
  37944. File: gdb.info, Node: Library List Format for SVR4 Targets, Next: Memory Map Format, Prev: Library List Format, Up: Remote Protocol
  37945. E.15 Library List Format for SVR4 Targets
  37946. =========================================
  37947. On SVR4 platforms GDB can use the symbol table of a dynamic loader (e.g.
  37948. 'ld.so') and normal memory operations to maintain a list of shared
  37949. libraries. Still a special library list provided by this packet is more
  37950. efficient for the GDB remote protocol.
  37951. The 'qXfer:libraries-svr4:read' packet returns an XML document which
  37952. lists loaded libraries and their SVR4 linker parameters. For each
  37953. library on SVR4 target, the following parameters are reported:
  37954. - 'name', the absolute file name from the 'l_name' field of 'struct
  37955. link_map'.
  37956. - 'lm' with address of 'struct link_map' used for TLS (Thread Local
  37957. Storage) access.
  37958. - 'l_addr', the displacement as read from the field 'l_addr' of
  37959. 'struct link_map'. For prelinked libraries this is not an absolute
  37960. memory address. It is a displacement of absolute memory address
  37961. against address the file was prelinked to during the library load.
  37962. - 'l_ld', which is memory address of the 'PT_DYNAMIC' segment
  37963. Additionally the single 'main-lm' attribute specifies address of
  37964. 'struct link_map' used for the main executable. This parameter is used
  37965. for TLS access and its presence is optional.
  37966. GDB must be linked with the Expat library to support XML SVR4 library
  37967. lists. *Note Expat::.
  37968. A simple memory map, with two loaded libraries (which do not use
  37969. prelink), looks like this:
  37970. <library-list-svr4 version="1.0" main-lm="0xe4f8f8">
  37971. <library name="/lib/ld-linux.so.2" lm="0xe4f51c" l_addr="0xe2d000"
  37972. l_ld="0xe4eefc"/>
  37973. <library name="/lib/libc.so.6" lm="0xe4fbe8" l_addr="0x154000"
  37974. l_ld="0x152350"/>
  37975. </library-list-svr>
  37976. The format of an SVR4 library list is described by this DTD:
  37977. <!-- library-list-svr4: Root element with versioning -->
  37978. <!ELEMENT library-list-svr4 (library)*>
  37979. <!ATTLIST library-list-svr4 version CDATA #FIXED "1.0">
  37980. <!ATTLIST library-list-svr4 main-lm CDATA #IMPLIED>
  37981. <!ELEMENT library EMPTY>
  37982. <!ATTLIST library name CDATA #REQUIRED>
  37983. <!ATTLIST library lm CDATA #REQUIRED>
  37984. <!ATTLIST library l_addr CDATA #REQUIRED>
  37985. <!ATTLIST library l_ld CDATA #REQUIRED>
  37986. 
  37987. File: gdb.info, Node: Memory Map Format, Next: Thread List Format, Prev: Library List Format for SVR4 Targets, Up: Remote Protocol
  37988. E.16 Memory Map Format
  37989. ======================
  37990. To be able to write into flash memory, GDB needs to obtain a memory map
  37991. from the target. This section describes the format of the memory map.
  37992. The memory map is obtained using the 'qXfer:memory-map:read' (*note
  37993. qXfer memory map read::) packet and is an XML document that lists memory
  37994. regions.
  37995. GDB must be linked with the Expat library to support XML memory maps.
  37996. *Note Expat::.
  37997. The top-level structure of the document is shown below:
  37998. <?xml version="1.0"?>
  37999. <!DOCTYPE memory-map
  38000. PUBLIC "+//IDN gnu.org//DTD GDB Memory Map V1.0//EN"
  38001. "http://sourceware.org/gdb/gdb-memory-map.dtd">
  38002. <memory-map>
  38003. region...
  38004. </memory-map>
  38005. Each region can be either:
  38006. * A region of RAM starting at ADDR and extending for LENGTH bytes
  38007. from there:
  38008. <memory type="ram" start="ADDR" length="LENGTH"/>
  38009. * A region of read-only memory:
  38010. <memory type="rom" start="ADDR" length="LENGTH"/>
  38011. * A region of flash memory, with erasure blocks BLOCKSIZE bytes in
  38012. length:
  38013. <memory type="flash" start="ADDR" length="LENGTH">
  38014. <property name="blocksize">BLOCKSIZE</property>
  38015. </memory>
  38016. Regions must not overlap. GDB assumes that areas of memory not
  38017. covered by the memory map are RAM, and uses the ordinary 'M' and 'X'
  38018. packets to write to addresses in such ranges.
  38019. The formal DTD for memory map format is given below:
  38020. <!-- ................................................... -->
  38021. <!-- Memory Map XML DTD ................................ -->
  38022. <!-- File: memory-map.dtd .............................. -->
  38023. <!-- .................................... .............. -->
  38024. <!-- memory-map.dtd -->
  38025. <!-- memory-map: Root element with versioning -->
  38026. <!ELEMENT memory-map (memory)*>
  38027. <!ATTLIST memory-map version CDATA #FIXED "1.0.0">
  38028. <!ELEMENT memory (property)*>
  38029. <!-- memory: Specifies a memory region,
  38030. and its type, or device. -->
  38031. <!ATTLIST memory type (ram|rom|flash) #REQUIRED
  38032. start CDATA #REQUIRED
  38033. length CDATA #REQUIRED>
  38034. <!-- property: Generic attribute tag -->
  38035. <!ELEMENT property (#PCDATA | property)*>
  38036. <!ATTLIST property name (blocksize) #REQUIRED>
  38037. 
  38038. File: gdb.info, Node: Thread List Format, Next: Traceframe Info Format, Prev: Memory Map Format, Up: Remote Protocol
  38039. E.17 Thread List Format
  38040. =======================
  38041. To efficiently update the list of threads and their attributes, GDB
  38042. issues the 'qXfer:threads:read' packet (*note qXfer threads read::) and
  38043. obtains the XML document with the following structure:
  38044. <?xml version="1.0"?>
  38045. <threads>
  38046. <thread id="id" core="0" name="name">
  38047. ... description ...
  38048. </thread>
  38049. </threads>
  38050. Each 'thread' element must have the 'id' attribute that identifies
  38051. the thread (*note thread-id syntax::). The 'core' attribute, if
  38052. present, specifies which processor core the thread was last executing
  38053. on. The 'name' attribute, if present, specifies the human-readable name
  38054. of the thread. The content of the of 'thread' element is interpreted as
  38055. human-readable auxiliary information. The 'handle' attribute, if
  38056. present, is a hex encoded representation of the thread handle.
  38057. 
  38058. File: gdb.info, Node: Traceframe Info Format, Next: Branch Trace Format, Prev: Thread List Format, Up: Remote Protocol
  38059. E.18 Traceframe Info Format
  38060. ===========================
  38061. To be able to know which objects in the inferior can be examined when
  38062. inspecting a tracepoint hit, GDB needs to obtain the list of memory
  38063. ranges, registers and trace state variables that have been collected in
  38064. a traceframe.
  38065. This list is obtained using the 'qXfer:traceframe-info:read' (*note
  38066. qXfer traceframe info read::) packet and is an XML document.
  38067. GDB must be linked with the Expat library to support XML traceframe
  38068. info discovery. *Note Expat::.
  38069. The top-level structure of the document is shown below:
  38070. <?xml version="1.0"?>
  38071. <!DOCTYPE traceframe-info
  38072. PUBLIC "+//IDN gnu.org//DTD GDB Memory Map V1.0//EN"
  38073. "http://sourceware.org/gdb/gdb-traceframe-info.dtd">
  38074. <traceframe-info>
  38075. block...
  38076. </traceframe-info>
  38077. Each traceframe block can be either:
  38078. * A region of collected memory starting at ADDR and extending for
  38079. LENGTH bytes from there:
  38080. <memory start="ADDR" length="LENGTH"/>
  38081. * A block indicating trace state variable numbered NUMBER has been
  38082. collected:
  38083. <tvar id="NUMBER"/>
  38084. The formal DTD for the traceframe info format is given below:
  38085. <!ELEMENT traceframe-info (memory | tvar)* >
  38086. <!ATTLIST traceframe-info version CDATA #FIXED "1.0">
  38087. <!ELEMENT memory EMPTY>
  38088. <!ATTLIST memory start CDATA #REQUIRED
  38089. length CDATA #REQUIRED>
  38090. <!ELEMENT tvar>
  38091. <!ATTLIST tvar id CDATA #REQUIRED>
  38092. 
  38093. File: gdb.info, Node: Branch Trace Format, Next: Branch Trace Configuration Format, Prev: Traceframe Info Format, Up: Remote Protocol
  38094. E.19 Branch Trace Format
  38095. ========================
  38096. In order to display the branch trace of an inferior thread, GDB needs to
  38097. obtain the list of branches. This list is represented as list of
  38098. sequential code blocks that are connected via branches. The code in
  38099. each block has been executed sequentially.
  38100. This list is obtained using the 'qXfer:btrace:read' (*note qXfer
  38101. btrace read::) packet and is an XML document.
  38102. GDB must be linked with the Expat library to support XML traceframe
  38103. info discovery. *Note Expat::.
  38104. The top-level structure of the document is shown below:
  38105. <?xml version="1.0"?>
  38106. <!DOCTYPE btrace
  38107. PUBLIC "+//IDN gnu.org//DTD GDB Branch Trace V1.0//EN"
  38108. "http://sourceware.org/gdb/gdb-btrace.dtd">
  38109. <btrace>
  38110. block...
  38111. </btrace>
  38112. * A block of sequentially executed instructions starting at BEGIN and
  38113. ending at END:
  38114. <block begin="BEGIN" end="END"/>
  38115. The formal DTD for the branch trace format is given below:
  38116. <!ELEMENT btrace (block* | pt) >
  38117. <!ATTLIST btrace version CDATA #FIXED "1.0">
  38118. <!ELEMENT block EMPTY>
  38119. <!ATTLIST block begin CDATA #REQUIRED
  38120. end CDATA #REQUIRED>
  38121. <!ELEMENT pt (pt-config?, raw?)>
  38122. <!ELEMENT pt-config (cpu?)>
  38123. <!ELEMENT cpu EMPTY>
  38124. <!ATTLIST cpu vendor CDATA #REQUIRED
  38125. family CDATA #REQUIRED
  38126. model CDATA #REQUIRED
  38127. stepping CDATA #REQUIRED>
  38128. <!ELEMENT raw (#PCDATA)>
  38129. 
  38130. File: gdb.info, Node: Branch Trace Configuration Format, Prev: Branch Trace Format, Up: Remote Protocol
  38131. E.20 Branch Trace Configuration Format
  38132. ======================================
  38133. For each inferior thread, GDB can obtain the branch trace configuration
  38134. using the 'qXfer:btrace-conf:read' (*note qXfer btrace-conf read::)
  38135. packet.
  38136. The configuration describes the branch trace format and configuration
  38137. settings for that format. The following information is described:
  38138. 'bts'
  38139. This thread uses the "Branch Trace Store" (BTS) format.
  38140. 'size'
  38141. The size of the BTS ring buffer in bytes.
  38142. 'pt'
  38143. This thread uses the "Intel Processor Trace" (Intel PT) format.
  38144. 'size'
  38145. The size of the Intel PT ring buffer in bytes.
  38146. GDB must be linked with the Expat library to support XML branch trace
  38147. configuration discovery. *Note Expat::.
  38148. The formal DTD for the branch trace configuration format is given
  38149. below:
  38150. <!ELEMENT btrace-conf (bts?, pt?)>
  38151. <!ATTLIST btrace-conf version CDATA #FIXED "1.0">
  38152. <!ELEMENT bts EMPTY>
  38153. <!ATTLIST bts size CDATA #IMPLIED>
  38154. <!ELEMENT pt EMPTY>
  38155. <!ATTLIST pt size CDATA #IMPLIED>
  38156. 
  38157. File: gdb.info, Node: Agent Expressions, Next: Target Descriptions, Prev: Remote Protocol, Up: Top
  38158. Appendix F The GDB Agent Expression Mechanism
  38159. *********************************************
  38160. In some applications, it is not feasible for the debugger to interrupt
  38161. the program's execution long enough for the developer to learn anything
  38162. helpful about its behavior. If the program's correctness depends on its
  38163. real-time behavior, delays introduced by a debugger might cause the
  38164. program to fail, even when the code itself is correct. It is useful to
  38165. be able to observe the program's behavior without interrupting it.
  38166. Using GDB's 'trace' and 'collect' commands, the user can specify
  38167. locations in the program, and arbitrary expressions to evaluate when
  38168. those locations are reached. Later, using the 'tfind' command, she can
  38169. examine the values those expressions had when the program hit the trace
  38170. points. The expressions may also denote objects in memory -- structures
  38171. or arrays, for example -- whose values GDB should record; while visiting
  38172. a particular tracepoint, the user may inspect those objects as if they
  38173. were in memory at that moment. However, because GDB records these
  38174. values without interacting with the user, it can do so quickly and
  38175. unobtrusively, hopefully not disturbing the program's behavior.
  38176. When GDB is debugging a remote target, the GDB "agent" code running
  38177. on the target computes the values of the expressions itself. To avoid
  38178. having a full symbolic expression evaluator on the agent, GDB translates
  38179. expressions in the source language into a simpler bytecode language, and
  38180. then sends the bytecode to the agent; the agent then executes the
  38181. bytecode, and records the values for GDB to retrieve later.
  38182. The bytecode language is simple; there are forty-odd opcodes, the
  38183. bulk of which are the usual vocabulary of C operands (addition,
  38184. subtraction, shifts, and so on) and various sizes of literals and memory
  38185. reference operations. The bytecode interpreter operates strictly on
  38186. machine-level values -- various sizes of integers and floating point
  38187. numbers -- and requires no information about types or symbols; thus, the
  38188. interpreter's internal data structures are simple, and each bytecode
  38189. requires only a few native machine instructions to implement it. The
  38190. interpreter is small, and strict limits on the memory and time required
  38191. to evaluate an expression are easy to determine, making it suitable for
  38192. use by the debugging agent in real-time applications.
  38193. * Menu:
  38194. * General Bytecode Design:: Overview of the interpreter.
  38195. * Bytecode Descriptions:: What each one does.
  38196. * Using Agent Expressions:: How agent expressions fit into the big picture.
  38197. * Varying Target Capabilities:: How to discover what the target can do.
  38198. * Rationale:: Why we did it this way.
  38199. 
  38200. File: gdb.info, Node: General Bytecode Design, Next: Bytecode Descriptions, Up: Agent Expressions
  38201. F.1 General Bytecode Design
  38202. ===========================
  38203. The agent represents bytecode expressions as an array of bytes. Each
  38204. instruction is one byte long (thus the term "bytecode"). Some
  38205. instructions are followed by operand bytes; for example, the 'goto'
  38206. instruction is followed by a destination for the jump.
  38207. The bytecode interpreter is a stack-based machine; most instructions
  38208. pop their operands off the stack, perform some operation, and push the
  38209. result back on the stack for the next instruction to consume. Each
  38210. element of the stack may contain either a integer or a floating point
  38211. value; these values are as many bits wide as the largest integer that
  38212. can be directly manipulated in the source language. Stack elements
  38213. carry no record of their type; bytecode could push a value as an
  38214. integer, then pop it as a floating point value. However, GDB will not
  38215. generate code which does this. In C, one might define the type of a
  38216. stack element as follows:
  38217. union agent_val {
  38218. LONGEST l;
  38219. DOUBLEST d;
  38220. };
  38221. where 'LONGEST' and 'DOUBLEST' are 'typedef' names for the largest
  38222. integer and floating point types on the machine.
  38223. By the time the bytecode interpreter reaches the end of the
  38224. expression, the value of the expression should be the only value left on
  38225. the stack. For tracing applications, 'trace' bytecodes in the
  38226. expression will have recorded the necessary data, and the value on the
  38227. stack may be discarded. For other applications, like conditional
  38228. breakpoints, the value may be useful.
  38229. Separate from the stack, the interpreter has two registers:
  38230. 'pc'
  38231. The address of the next bytecode to execute.
  38232. 'start'
  38233. The address of the start of the bytecode expression, necessary for
  38234. interpreting the 'goto' and 'if_goto' instructions.
  38235. Neither of these registers is directly visible to the bytecode language
  38236. itself, but they are useful for defining the meanings of the bytecode
  38237. operations.
  38238. There are no instructions to perform side effects on the running
  38239. program, or call the program's functions; we assume that these
  38240. expressions are only used for unobtrusive debugging, not for patching
  38241. the running code.
  38242. Most bytecode instructions do not distinguish between the various
  38243. sizes of values, and operate on full-width values; the upper bits of the
  38244. values are simply ignored, since they do not usually make a difference
  38245. to the value computed. The exceptions to this rule are:
  38246. memory reference instructions ('ref'N)
  38247. There are distinct instructions to fetch different word sizes from
  38248. memory. Once on the stack, however, the values are treated as
  38249. full-size integers. They may need to be sign-extended; the 'ext'
  38250. instruction exists for this purpose.
  38251. the sign-extension instruction ('ext' N)
  38252. These clearly need to know which portion of their operand is to be
  38253. extended to occupy the full length of the word.
  38254. If the interpreter is unable to evaluate an expression completely for
  38255. some reason (a memory location is inaccessible, or a divisor is zero,
  38256. for example), we say that interpretation "terminates with an error".
  38257. This means that the problem is reported back to the interpreter's caller
  38258. in some helpful way. In general, code using agent expressions should
  38259. assume that they may attempt to divide by zero, fetch arbitrary memory
  38260. locations, and misbehave in other ways.
  38261. Even complicated C expressions compile to a few bytecode
  38262. instructions; for example, the expression 'x + y * z' would typically
  38263. produce code like the following, assuming that 'x' and 'y' live in
  38264. registers, and 'z' is a global variable holding a 32-bit 'int':
  38265. reg 1
  38266. reg 2
  38267. const32 address of z
  38268. ref32
  38269. ext 32
  38270. mul
  38271. add
  38272. end
  38273. In detail, these mean:
  38274. 'reg 1'
  38275. Push the value of register 1 (presumably holding 'x') onto the
  38276. stack.
  38277. 'reg 2'
  38278. Push the value of register 2 (holding 'y').
  38279. 'const32 address of z'
  38280. Push the address of 'z' onto the stack.
  38281. 'ref32'
  38282. Fetch a 32-bit word from the address at the top of the stack;
  38283. replace the address on the stack with the value. Thus, we replace
  38284. the address of 'z' with 'z''s value.
  38285. 'ext 32'
  38286. Sign-extend the value on the top of the stack from 32 bits to full
  38287. length. This is necessary because 'z' is a signed integer.
  38288. 'mul'
  38289. Pop the top two numbers on the stack, multiply them, and push their
  38290. product. Now the top of the stack contains the value of the
  38291. expression 'y * z'.
  38292. 'add'
  38293. Pop the top two numbers, add them, and push the sum. Now the top
  38294. of the stack contains the value of 'x + y * z'.
  38295. 'end'
  38296. Stop executing; the value left on the stack top is the value to be
  38297. recorded.
  38298. 
  38299. File: gdb.info, Node: Bytecode Descriptions, Next: Using Agent Expressions, Prev: General Bytecode Design, Up: Agent Expressions
  38300. F.2 Bytecode Descriptions
  38301. =========================
  38302. Each bytecode description has the following form:
  38303. 'add' (0x02): A B => A+B
  38304. Pop the top two stack items, A and B, as integers; push their sum,
  38305. as an integer.
  38306. In this example, 'add' is the name of the bytecode, and '(0x02)' is
  38307. the one-byte value used to encode the bytecode, in hexadecimal. The
  38308. phrase "A B => A+B" shows the stack before and after the bytecode
  38309. executes. Beforehand, the stack must contain at least two values, A and
  38310. B; since the top of the stack is to the right, B is on the top of the
  38311. stack, and A is underneath it. After execution, the bytecode will have
  38312. popped A and B from the stack, and replaced them with a single value,
  38313. A+B. There may be other values on the stack below those shown, but the
  38314. bytecode affects only those shown.
  38315. Here is another example:
  38316. 'const8' (0x22) N: => N
  38317. Push the 8-bit integer constant N on the stack, without sign
  38318. extension.
  38319. In this example, the bytecode 'const8' takes an operand N directly
  38320. from the bytecode stream; the operand follows the 'const8' bytecode
  38321. itself. We write any such operands immediately after the name of the
  38322. bytecode, before the colon, and describe the exact encoding of the
  38323. operand in the bytecode stream in the body of the bytecode description.
  38324. For the 'const8' bytecode, there are no stack items given before the
  38325. =>; this simply means that the bytecode consumes no values from the
  38326. stack. If a bytecode consumes no values, or produces no values, the
  38327. list on either side of the => may be empty.
  38328. If a value is written as A, B, or N, then the bytecode treats it as
  38329. an integer. If a value is written is ADDR, then the bytecode treats it
  38330. as an address.
  38331. We do not fully describe the floating point operations here; although
  38332. this design can be extended in a clean way to handle floating point
  38333. values, they are not of immediate interest to the customer, so we avoid
  38334. describing them, to save time.
  38335. 'float' (0x01): =>
  38336. Prefix for floating-point bytecodes. Not implemented yet.
  38337. 'add' (0x02): A B => A+B
  38338. Pop two integers from the stack, and push their sum, as an integer.
  38339. 'sub' (0x03): A B => A-B
  38340. Pop two integers from the stack, subtract the top value from the
  38341. next-to-top value, and push the difference.
  38342. 'mul' (0x04): A B => A*B
  38343. Pop two integers from the stack, multiply them, and push the
  38344. product on the stack. Note that, when one multiplies two N-bit
  38345. numbers yielding another N-bit number, it is irrelevant whether the
  38346. numbers are signed or not; the results are the same.
  38347. 'div_signed' (0x05): A B => A/B
  38348. Pop two signed integers from the stack; divide the next-to-top
  38349. value by the top value, and push the quotient. If the divisor is
  38350. zero, terminate with an error.
  38351. 'div_unsigned' (0x06): A B => A/B
  38352. Pop two unsigned integers from the stack; divide the next-to-top
  38353. value by the top value, and push the quotient. If the divisor is
  38354. zero, terminate with an error.
  38355. 'rem_signed' (0x07): A B => A MODULO B
  38356. Pop two signed integers from the stack; divide the next-to-top
  38357. value by the top value, and push the remainder. If the divisor is
  38358. zero, terminate with an error.
  38359. 'rem_unsigned' (0x08): A B => A MODULO B
  38360. Pop two unsigned integers from the stack; divide the next-to-top
  38361. value by the top value, and push the remainder. If the divisor is
  38362. zero, terminate with an error.
  38363. 'lsh' (0x09): A B => A<<B
  38364. Pop two integers from the stack; let A be the next-to-top value,
  38365. and B be the top value. Shift A left by B bits, and push the
  38366. result.
  38367. 'rsh_signed' (0x0a): A B => '(signed)'A>>B
  38368. Pop two integers from the stack; let A be the next-to-top value,
  38369. and B be the top value. Shift A right by B bits, inserting copies
  38370. of the top bit at the high end, and push the result.
  38371. 'rsh_unsigned' (0x0b): A B => A>>B
  38372. Pop two integers from the stack; let A be the next-to-top value,
  38373. and B be the top value. Shift A right by B bits, inserting zero
  38374. bits at the high end, and push the result.
  38375. 'log_not' (0x0e): A => !A
  38376. Pop an integer from the stack; if it is zero, push the value one;
  38377. otherwise, push the value zero.
  38378. 'bit_and' (0x0f): A B => A&B
  38379. Pop two integers from the stack, and push their bitwise 'and'.
  38380. 'bit_or' (0x10): A B => A|B
  38381. Pop two integers from the stack, and push their bitwise 'or'.
  38382. 'bit_xor' (0x11): A B => A^B
  38383. Pop two integers from the stack, and push their bitwise
  38384. exclusive-'or'.
  38385. 'bit_not' (0x12): A => ~A
  38386. Pop an integer from the stack, and push its bitwise complement.
  38387. 'equal' (0x13): A B => A=B
  38388. Pop two integers from the stack; if they are equal, push the value
  38389. one; otherwise, push the value zero.
  38390. 'less_signed' (0x14): A B => A<B
  38391. Pop two signed integers from the stack; if the next-to-top value is
  38392. less than the top value, push the value one; otherwise, push the
  38393. value zero.
  38394. 'less_unsigned' (0x15): A B => A<B
  38395. Pop two unsigned integers from the stack; if the next-to-top value
  38396. is less than the top value, push the value one; otherwise, push the
  38397. value zero.
  38398. 'ext' (0x16) N: A => A, sign-extended from N bits
  38399. Pop an unsigned value from the stack; treating it as an N-bit
  38400. twos-complement value, extend it to full length. This means that
  38401. all bits to the left of bit N-1 (where the least significant bit is
  38402. bit 0) are set to the value of bit N-1. Note that N may be larger
  38403. than or equal to the width of the stack elements of the bytecode
  38404. engine; in this case, the bytecode should have no effect.
  38405. The number of source bits to preserve, N, is encoded as a single
  38406. byte unsigned integer following the 'ext' bytecode.
  38407. 'zero_ext' (0x2a) N: A => A, zero-extended from N bits
  38408. Pop an unsigned value from the stack; zero all but the bottom N
  38409. bits.
  38410. The number of source bits to preserve, N, is encoded as a single
  38411. byte unsigned integer following the 'zero_ext' bytecode.
  38412. 'ref8' (0x17): ADDR => A
  38413. 'ref16' (0x18): ADDR => A
  38414. 'ref32' (0x19): ADDR => A
  38415. 'ref64' (0x1a): ADDR => A
  38416. Pop an address ADDR from the stack. For bytecode 'ref'N, fetch an
  38417. N-bit value from ADDR, using the natural target endianness. Push
  38418. the fetched value as an unsigned integer.
  38419. Note that ADDR may not be aligned in any particular way; the 'refN'
  38420. bytecodes should operate correctly for any address.
  38421. If attempting to access memory at ADDR would cause a processor
  38422. exception of some sort, terminate with an error.
  38423. 'ref_float' (0x1b): ADDR => D
  38424. 'ref_double' (0x1c): ADDR => D
  38425. 'ref_long_double' (0x1d): ADDR => D
  38426. 'l_to_d' (0x1e): A => D
  38427. 'd_to_l' (0x1f): D => A
  38428. Not implemented yet.
  38429. 'dup' (0x28): A => A A
  38430. Push another copy of the stack's top element.
  38431. 'swap' (0x2b): A B => B A
  38432. Exchange the top two items on the stack.
  38433. 'pop' (0x29): A =>
  38434. Discard the top value on the stack.
  38435. 'pick' (0x32) N: A ... B => A ... B A
  38436. Duplicate an item from the stack and push it on the top of the
  38437. stack. N, a single byte, indicates the stack item to copy. If N
  38438. is zero, this is the same as 'dup'; if N is one, it copies the item
  38439. under the top item, etc. If N exceeds the number of items on the
  38440. stack, terminate with an error.
  38441. 'rot' (0x33): A B C => C A B
  38442. Rotate the top three items on the stack. The top item (c) becomes
  38443. the third item, the next-to-top item (b) becomes the top item and
  38444. the third item (a) from the top becomes the next-to-top item.
  38445. 'if_goto' (0x20) OFFSET: A =>
  38446. Pop an integer off the stack; if it is non-zero, branch to the
  38447. given offset in the bytecode string. Otherwise, continue to the
  38448. next instruction in the bytecode stream. In other words, if A is
  38449. non-zero, set the 'pc' register to 'start' + OFFSET. Thus, an
  38450. offset of zero denotes the beginning of the expression.
  38451. The OFFSET is stored as a sixteen-bit unsigned value, stored
  38452. immediately following the 'if_goto' bytecode. It is always stored
  38453. most significant byte first, regardless of the target's normal
  38454. endianness. The offset is not guaranteed to fall at any particular
  38455. alignment within the bytecode stream; thus, on machines where
  38456. fetching a 16-bit on an unaligned address raises an exception, you
  38457. should fetch the offset one byte at a time.
  38458. 'goto' (0x21) OFFSET: =>
  38459. Branch unconditionally to OFFSET; in other words, set the 'pc'
  38460. register to 'start' + OFFSET.
  38461. The offset is stored in the same way as for the 'if_goto' bytecode.
  38462. 'const8' (0x22) N: => N
  38463. 'const16' (0x23) N: => N
  38464. 'const32' (0x24) N: => N
  38465. 'const64' (0x25) N: => N
  38466. Push the integer constant N on the stack, without sign extension.
  38467. To produce a small negative value, push a small twos-complement
  38468. value, and then sign-extend it using the 'ext' bytecode.
  38469. The constant N is stored in the appropriate number of bytes
  38470. following the 'const'B bytecode. The constant N is always stored
  38471. most significant byte first, regardless of the target's normal
  38472. endianness. The constant is not guaranteed to fall at any
  38473. particular alignment within the bytecode stream; thus, on machines
  38474. where fetching a 16-bit on an unaligned address raises an
  38475. exception, you should fetch N one byte at a time.
  38476. 'reg' (0x26) N: => A
  38477. Push the value of register number N, without sign extension. The
  38478. registers are numbered following GDB's conventions.
  38479. The register number N is encoded as a 16-bit unsigned integer
  38480. immediately following the 'reg' bytecode. It is always stored most
  38481. significant byte first, regardless of the target's normal
  38482. endianness. The register number is not guaranteed to fall at any
  38483. particular alignment within the bytecode stream; thus, on machines
  38484. where fetching a 16-bit on an unaligned address raises an
  38485. exception, you should fetch the register number one byte at a time.
  38486. 'getv' (0x2c) N: => V
  38487. Push the value of trace state variable number N, without sign
  38488. extension.
  38489. The variable number N is encoded as a 16-bit unsigned integer
  38490. immediately following the 'getv' bytecode. It is always stored
  38491. most significant byte first, regardless of the target's normal
  38492. endianness. The variable number is not guaranteed to fall at any
  38493. particular alignment within the bytecode stream; thus, on machines
  38494. where fetching a 16-bit on an unaligned address raises an
  38495. exception, you should fetch the register number one byte at a time.
  38496. 'setv' (0x2d) N: V => V
  38497. Set trace state variable number N to the value found on the top of
  38498. the stack. The stack is unchanged, so that the value is readily
  38499. available if the assignment is part of a larger expression. The
  38500. handling of N is as described for 'getv'.
  38501. 'trace' (0x0c): ADDR SIZE =>
  38502. Record the contents of the SIZE bytes at ADDR in a trace buffer,
  38503. for later retrieval by GDB.
  38504. 'trace_quick' (0x0d) SIZE: ADDR => ADDR
  38505. Record the contents of the SIZE bytes at ADDR in a trace buffer,
  38506. for later retrieval by GDB. SIZE is a single byte unsigned integer
  38507. following the 'trace' opcode.
  38508. This bytecode is equivalent to the sequence 'dup const8 SIZE
  38509. trace', but we provide it anyway to save space in bytecode strings.
  38510. 'trace16' (0x30) SIZE: ADDR => ADDR
  38511. Identical to trace_quick, except that SIZE is a 16-bit big-endian
  38512. unsigned integer, not a single byte. This should probably have
  38513. been named 'trace_quick16', for consistency.
  38514. 'tracev' (0x2e) N: => A
  38515. Record the value of trace state variable number N in the trace
  38516. buffer. The handling of N is as described for 'getv'.
  38517. 'tracenz' (0x2f) ADDR SIZE =>
  38518. Record the bytes at ADDR in a trace buffer, for later retrieval by
  38519. GDB. Stop at either the first zero byte, or when SIZE bytes have
  38520. been recorded, whichever occurs first.
  38521. 'printf' (0x34) NUMARGS STRING =>
  38522. Do a formatted print, in the style of the C function 'printf').
  38523. The value of NUMARGS is the number of arguments to expect on the
  38524. stack, while STRING is the format string, prefixed with a two-byte
  38525. length. The last byte of the string must be zero, and is included
  38526. in the length. The format string includes escaped sequences just
  38527. as it appears in C source, so for instance the format string
  38528. '"\t%d\n"' is six characters long, and the output will consist of a
  38529. tab character, a decimal number, and a newline. At the top of the
  38530. stack, above the values to be printed, this bytecode will pop a
  38531. "function" and "channel". If the function is nonzero, then the
  38532. target may treat it as a function and call it, passing the channel
  38533. as a first argument, as with the C function 'fprintf'. If the
  38534. function is zero, then the target may simply call a standard
  38535. formatted print function of its choice. In all, this bytecode pops
  38536. 2 + NUMARGS stack elements, and pushes nothing.
  38537. 'end' (0x27): =>
  38538. Stop executing bytecode; the result should be the top element of
  38539. the stack. If the purpose of the expression was to compute an
  38540. lvalue or a range of memory, then the next-to-top of the stack is
  38541. the lvalue's address, and the top of the stack is the lvalue's
  38542. size, in bytes.
  38543. 
  38544. File: gdb.info, Node: Using Agent Expressions, Next: Varying Target Capabilities, Prev: Bytecode Descriptions, Up: Agent Expressions
  38545. F.3 Using Agent Expressions
  38546. ===========================
  38547. Agent expressions can be used in several different ways by GDB, and the
  38548. debugger can generate different bytecode sequences as appropriate.
  38549. One possibility is to do expression evaluation on the target rather
  38550. than the host, such as for the conditional of a conditional tracepoint.
  38551. In such a case, GDB compiles the source expression into a bytecode
  38552. sequence that simply gets values from registers or memory, does
  38553. arithmetic, and returns a result.
  38554. Another way to use agent expressions is for tracepoint data
  38555. collection. GDB generates a different bytecode sequence for collection;
  38556. in addition to bytecodes that do the calculation, GDB adds 'trace'
  38557. bytecodes to save the pieces of memory that were used.
  38558. * The user selects trace points in the program's code at which GDB
  38559. should collect data.
  38560. * The user specifies expressions to evaluate at each trace point.
  38561. These expressions may denote objects in memory, in which case those
  38562. objects' contents are recorded as the program runs, or computed
  38563. values, in which case the values themselves are recorded.
  38564. * GDB transmits the tracepoints and their associated expressions to
  38565. the GDB agent, running on the debugging target.
  38566. * The agent arranges to be notified when a trace point is hit.
  38567. * When execution on the target reaches a trace point, the agent
  38568. evaluates the expressions associated with that trace point, and
  38569. records the resulting values and memory ranges.
  38570. * Later, when the user selects a given trace event and inspects the
  38571. objects and expression values recorded, GDB talks to the agent to
  38572. retrieve recorded data as necessary to meet the user's requests.
  38573. If the user asks to see an object whose contents have not been
  38574. recorded, GDB reports an error.
  38575. 
  38576. File: gdb.info, Node: Varying Target Capabilities, Next: Rationale, Prev: Using Agent Expressions, Up: Agent Expressions
  38577. F.4 Varying Target Capabilities
  38578. ===============================
  38579. Some targets don't support floating-point, and some would rather not
  38580. have to deal with 'long long' operations. Also, different targets will
  38581. have different stack sizes, and different bytecode buffer lengths.
  38582. Thus, GDB needs a way to ask the target about itself. We haven't
  38583. worked out the details yet, but in general, GDB should be able to send
  38584. the target a packet asking it to describe itself. The reply should be a
  38585. packet whose length is explicit, so we can add new information to the
  38586. packet in future revisions of the agent, without confusing old versions
  38587. of GDB, and it should contain a version number. It should contain at
  38588. least the following information:
  38589. * whether floating point is supported
  38590. * whether 'long long' is supported
  38591. * maximum acceptable size of bytecode stack
  38592. * maximum acceptable length of bytecode expressions
  38593. * which registers are actually available for collection
  38594. * whether the target supports disabled tracepoints
  38595. 
  38596. File: gdb.info, Node: Rationale, Prev: Varying Target Capabilities, Up: Agent Expressions
  38597. F.5 Rationale
  38598. =============
  38599. Some of the design decisions apparent above are arguable.
  38600. What about stack overflow/underflow?
  38601. GDB should be able to query the target to discover its stack size.
  38602. Given that information, GDB can determine at translation time
  38603. whether a given expression will overflow the stack. But this spec
  38604. isn't about what kinds of error-checking GDB ought to do.
  38605. Why are you doing everything in LONGEST?
  38606. Speed isn't important, but agent code size is; using LONGEST brings
  38607. in a bunch of support code to do things like division, etc. So
  38608. this is a serious concern.
  38609. First, note that you don't need different bytecodes for different
  38610. operand sizes. You can generate code without _knowing_ how big the
  38611. stack elements actually are on the target. If the target only
  38612. supports 32-bit ints, and you don't send any 64-bit bytecodes,
  38613. everything just works. The observation here is that the MIPS and
  38614. the Alpha have only fixed-size registers, and you can still get C's
  38615. semantics even though most instructions only operate on full-sized
  38616. words. You just need to make sure everything is properly
  38617. sign-extended at the right times. So there is no need for 32- and
  38618. 64-bit variants of the bytecodes. Just implement everything using
  38619. the largest size you support.
  38620. GDB should certainly check to see what sizes the target supports,
  38621. so the user can get an error earlier, rather than later. But this
  38622. information is not necessary for correctness.
  38623. Why don't you have '>' or '<=' operators?
  38624. I want to keep the interpreter small, and we don't need them. We
  38625. can combine the 'less_' opcodes with 'log_not', and swap the order
  38626. of the operands, yielding all four asymmetrical comparison
  38627. operators. For example, '(x <= y)' is '! (x > y)', which is '! (y
  38628. < x)'.
  38629. Why do you have 'log_not'?
  38630. Why do you have 'ext'?
  38631. Why do you have 'zero_ext'?
  38632. These are all easily synthesized from other instructions, but I
  38633. expect them to be used frequently, and they're simple, so I include
  38634. them to keep bytecode strings short.
  38635. 'log_not' is equivalent to 'const8 0 equal'; it's used in half the
  38636. relational operators.
  38637. 'ext N' is equivalent to 'const8 S-N lsh const8 S-N rsh_signed',
  38638. where S is the size of the stack elements; it follows 'refM' and
  38639. REG bytecodes when the value should be signed. See the next
  38640. bulleted item.
  38641. 'zero_ext N' is equivalent to 'constM MASK log_and'; it's used
  38642. whenever we push the value of a register, because we can't assume
  38643. the upper bits of the register aren't garbage.
  38644. Why not have sign-extending variants of the 'ref' operators?
  38645. Because that would double the number of 'ref' operators, and we
  38646. need the 'ext' bytecode anyway for accessing bitfields.
  38647. Why not have constant-address variants of the 'ref' operators?
  38648. Because that would double the number of 'ref' operators again, and
  38649. 'const32 ADDRESS ref32' is only one byte longer.
  38650. Why do the 'refN' operators have to support unaligned fetches?
  38651. GDB will generate bytecode that fetches multi-byte values at
  38652. unaligned addresses whenever the executable's debugging information
  38653. tells it to. Furthermore, GDB does not know the value the pointer
  38654. will have when GDB generates the bytecode, so it cannot determine
  38655. whether a particular fetch will be aligned or not.
  38656. In particular, structure bitfields may be several bytes long, but
  38657. follow no alignment rules; members of packed structures are not
  38658. necessarily aligned either.
  38659. In general, there are many cases where unaligned references occur
  38660. in correct C code, either at the programmer's explicit request, or
  38661. at the compiler's discretion. Thus, it is simpler to make the GDB
  38662. agent bytecodes work correctly in all circumstances than to make
  38663. GDB guess in each case whether the compiler did the usual thing.
  38664. Why are there no side-effecting operators?
  38665. Because our current client doesn't want them? That's a cheap
  38666. answer. I think the real answer is that I'm afraid of implementing
  38667. function calls. We should re-visit this issue after the present
  38668. contract is delivered.
  38669. Why aren't the 'goto' ops PC-relative?
  38670. The interpreter has the base address around anyway for PC bounds
  38671. checking, and it seemed simpler.
  38672. Why is there only one offset size for the 'goto' ops?
  38673. Offsets are currently sixteen bits. I'm not happy with this
  38674. situation either:
  38675. Suppose we have multiple branch ops with different offset sizes.
  38676. As I generate code left-to-right, all my jumps are forward jumps
  38677. (there are no loops in expressions), so I never know the target
  38678. when I emit the jump opcode. Thus, I have to either always assume
  38679. the largest offset size, or do jump relaxation on the code after I
  38680. generate it, which seems like a big waste of time.
  38681. I can imagine a reasonable expression being longer than 256 bytes.
  38682. I can't imagine one being longer than 64k. Thus, we need 16-bit
  38683. offsets. This kind of reasoning is so bogus, but relaxation is
  38684. pathetic.
  38685. The other approach would be to generate code right-to-left. Then
  38686. I'd always know my offset size. That might be fun.
  38687. Where is the function call bytecode?
  38688. When we add side-effects, we should add this.
  38689. Why does the 'reg' bytecode take a 16-bit register number?
  38690. Intel's IA-64 architecture has 128 general-purpose registers, and
  38691. 128 floating-point registers, and I'm sure it has some random
  38692. control registers.
  38693. Why do we need 'trace' and 'trace_quick'?
  38694. Because GDB needs to record all the memory contents and registers
  38695. an expression touches. If the user wants to evaluate an expression
  38696. 'x->y->z', the agent must record the values of 'x' and 'x->y' as
  38697. well as the value of 'x->y->z'.
  38698. Don't the 'trace' bytecodes make the interpreter less general?
  38699. They do mean that the interpreter contains special-purpose code,
  38700. but that doesn't mean the interpreter can only be used for that
  38701. purpose. If an expression doesn't use the 'trace' bytecodes, they
  38702. don't get in its way.
  38703. Why doesn't 'trace_quick' consume its arguments the way everything else does?
  38704. In general, you do want your operators to consume their arguments;
  38705. it's consistent, and generally reduces the amount of stack
  38706. rearrangement necessary. However, 'trace_quick' is a kludge to
  38707. save space; it only exists so we needn't write 'dup const8 SIZE
  38708. trace' before every memory reference. Therefore, it's okay for it
  38709. not to consume its arguments; it's meant for a specific context in
  38710. which we know exactly what it should do with the stack. If we're
  38711. going to have a kludge, it should be an effective kludge.
  38712. Why does 'trace16' exist?
  38713. That opcode was added by the customer that contracted Cygnus for
  38714. the data tracing work. I personally think it is unnecessary;
  38715. objects that large will be quite rare, so it is okay to use 'dup
  38716. const16 SIZE trace' in those cases.
  38717. Whatever we decide to do with 'trace16', we should at least leave
  38718. opcode 0x30 reserved, to remain compatible with the customer who
  38719. added it.
  38720. 
  38721. File: gdb.info, Node: Target Descriptions, Next: Operating System Information, Prev: Agent Expressions, Up: Top
  38722. Appendix G Target Descriptions
  38723. ******************************
  38724. One of the challenges of using GDB to debug embedded systems is that
  38725. there are so many minor variants of each processor architecture in use.
  38726. It is common practice for vendors to start with a standard processor
  38727. core -- ARM, PowerPC, or MIPS, for example -- and then make changes to
  38728. adapt it to a particular market niche. Some architectures have hundreds
  38729. of variants, available from dozens of vendors. This leads to a number
  38730. of problems:
  38731. * With so many different customized processors, it is difficult for
  38732. the GDB maintainers to keep up with the changes.
  38733. * Since individual variants may have short lifetimes or limited
  38734. audiences, it may not be worthwhile to carry information about
  38735. every variant in the GDB source tree.
  38736. * When GDB does support the architecture of the embedded system at
  38737. hand, the task of finding the correct architecture name to give the
  38738. 'set architecture' command can be error-prone.
  38739. To address these problems, the GDB remote protocol allows a target
  38740. system to not only identify itself to GDB, but to actually describe its
  38741. own features. This lets GDB support processor variants it has never
  38742. seen before -- to the extent that the descriptions are accurate, and
  38743. that GDB understands them.
  38744. GDB must be linked with the Expat library to support XML target
  38745. descriptions. *Note Expat::.
  38746. * Menu:
  38747. * Retrieving Descriptions:: How descriptions are fetched from a target.
  38748. * Target Description Format:: The contents of a target description.
  38749. * Predefined Target Types:: Standard types available for target
  38750. descriptions.
  38751. * Enum Target Types:: How to define enum target types.
  38752. * Standard Target Features:: Features GDB knows about.
  38753. 
  38754. File: gdb.info, Node: Retrieving Descriptions, Next: Target Description Format, Up: Target Descriptions
  38755. G.1 Retrieving Descriptions
  38756. ===========================
  38757. Target descriptions can be read from the target automatically, or
  38758. specified by the user manually. The default behavior is to read the
  38759. description from the target. GDB retrieves it via the remote protocol
  38760. using 'qXfer' requests (*note qXfer: General Query Packets.). The ANNEX
  38761. in the 'qXfer' packet will be 'target.xml'. The contents of the
  38762. 'target.xml' annex are an XML document, of the form described in *note
  38763. Target Description Format::.
  38764. Alternatively, you can specify a file to read for the target
  38765. description. If a file is set, the target will not be queried. The
  38766. commands to specify a file are:
  38767. 'set tdesc filename PATH'
  38768. Read the target description from PATH.
  38769. 'unset tdesc filename'
  38770. Do not read the XML target description from a file. GDB will use
  38771. the description supplied by the current target.
  38772. 'show tdesc filename'
  38773. Show the filename to read for a target description, if any.
  38774. 
  38775. File: gdb.info, Node: Target Description Format, Next: Predefined Target Types, Prev: Retrieving Descriptions, Up: Target Descriptions
  38776. G.2 Target Description Format
  38777. =============================
  38778. A target description annex is an XML (http://www.w3.org/XML/) document
  38779. which complies with the Document Type Definition provided in the GDB
  38780. sources in 'gdb/features/gdb-target.dtd'. This means you can use
  38781. generally available tools like 'xmllint' to check that your feature
  38782. descriptions are well-formed and valid. However, to help people
  38783. unfamiliar with XML write descriptions for their targets, we also
  38784. describe the grammar here.
  38785. Target descriptions can identify the architecture of the remote
  38786. target and (for some architectures) provide information about custom
  38787. register sets. They can also identify the OS ABI of the remote target.
  38788. GDB can use this information to autoconfigure for your target, or to
  38789. warn you if you connect to an unsupported target.
  38790. Here is a simple target description:
  38791. <target version="1.0">
  38792. <architecture>i386:x86-64</architecture>
  38793. </target>
  38794. This minimal description only says that the target uses the x86-64
  38795. architecture.
  38796. A target description has the following overall form, with [ ] marking
  38797. optional elements and ... marking repeatable elements. The elements are
  38798. explained further below.
  38799. <?xml version="1.0"?>
  38800. <!DOCTYPE target SYSTEM "gdb-target.dtd">
  38801. <target version="1.0">
  38802. [ARCHITECTURE]
  38803. [OSABI]
  38804. [COMPATIBLE]
  38805. [FEATURE...]
  38806. </target>
  38807. The description is generally insensitive to whitespace and line breaks,
  38808. under the usual common-sense rules. The XML version declaration and
  38809. document type declaration can generally be omitted (GDB does not require
  38810. them), but specifying them may be useful for XML validation tools. The
  38811. 'version' attribute for '<target>' may also be omitted, but we recommend
  38812. including it; if future versions of GDB use an incompatible revision of
  38813. 'gdb-target.dtd', they will detect and report the version mismatch.
  38814. G.2.1 Inclusion
  38815. ---------------
  38816. It can sometimes be valuable to split a target description up into
  38817. several different annexes, either for organizational purposes, or to
  38818. share files between different possible target descriptions. You can
  38819. divide a description into multiple files by replacing any element of the
  38820. target description with an inclusion directive of the form:
  38821. <xi:include href="DOCUMENT"/>
  38822. When GDB encounters an element of this form, it will retrieve the named
  38823. XML DOCUMENT, and replace the inclusion directive with the contents of
  38824. that document. If the current description was read using 'qXfer', then
  38825. so will be the included document; DOCUMENT will be interpreted as the
  38826. name of an annex. If the current description was read from a file, GDB
  38827. will look for DOCUMENT as a file in the same directory where it found
  38828. the original description.
  38829. G.2.2 Architecture
  38830. ------------------
  38831. An '<architecture>' element has this form:
  38832. <architecture>ARCH</architecture>
  38833. ARCH is one of the architectures from the set accepted by 'set
  38834. architecture' (*note Specifying a Debugging Target: Targets.).
  38835. G.2.3 OS ABI
  38836. ------------
  38837. This optional field was introduced in GDB version 7.0. Previous
  38838. versions of GDB ignore it.
  38839. An '<osabi>' element has this form:
  38840. <osabi>ABI-NAME</osabi>
  38841. ABI-NAME is an OS ABI name from the same selection accepted by
  38842. 'set osabi' (*note Configuring the Current ABI: ABI.).
  38843. G.2.4 Compatible Architecture
  38844. -----------------------------
  38845. This optional field was introduced in GDB version 7.0. Previous
  38846. versions of GDB ignore it.
  38847. A '<compatible>' element has this form:
  38848. <compatible>ARCH</compatible>
  38849. ARCH is one of the architectures from the set accepted by 'set
  38850. architecture' (*note Specifying a Debugging Target: Targets.).
  38851. A '<compatible>' element is used to specify that the target is able
  38852. to run binaries in some other than the main target architecture given by
  38853. the '<architecture>' element. For example, on the Cell Broadband
  38854. Engine, the main architecture is 'powerpc:common' or 'powerpc:common64',
  38855. but the system is able to run binaries in the 'spu' architecture as
  38856. well. The way to describe this capability with '<compatible>' is as
  38857. follows:
  38858. <architecture>powerpc:common</architecture>
  38859. <compatible>spu</compatible>
  38860. G.2.5 Features
  38861. --------------
  38862. Each '<feature>' describes some logical portion of the target system.
  38863. Features are currently used to describe available CPU registers and the
  38864. types of their contents. A '<feature>' element has this form:
  38865. <feature name="NAME">
  38866. [TYPE...]
  38867. REG...
  38868. </feature>
  38869. Each feature's name should be unique within the description. The name
  38870. of a feature does not matter unless GDB has some special knowledge of
  38871. the contents of that feature; if it does, the feature should have its
  38872. standard name. *Note Standard Target Features::.
  38873. G.2.6 Types
  38874. -----------
  38875. Any register's value is a collection of bits which GDB must interpret.
  38876. The default interpretation is a two's complement integer, but other
  38877. types can be requested by name in the register description. Some
  38878. predefined types are provided by GDB (*note Predefined Target Types::),
  38879. and the description can define additional composite and enum types.
  38880. Each type element must have an 'id' attribute, which gives a unique
  38881. (within the containing '<feature>') name to the type. Types must be
  38882. defined before they are used.
  38883. Some targets offer vector registers, which can be treated as arrays
  38884. of scalar elements. These types are written as '<vector>' elements,
  38885. specifying the array element type, TYPE, and the number of elements,
  38886. COUNT:
  38887. <vector id="ID" type="TYPE" count="COUNT"/>
  38888. If a register's value is usefully viewed in multiple ways, define it
  38889. with a union type containing the useful representations. The '<union>'
  38890. element contains one or more '<field>' elements, each of which has a
  38891. NAME and a TYPE:
  38892. <union id="ID">
  38893. <field name="NAME" type="TYPE"/>
  38894. ...
  38895. </union>
  38896. If a register's value is composed from several separate values,
  38897. define it with either a structure type or a flags type. A flags type
  38898. may only contain bitfields. A structure type may either contain only
  38899. bitfields or contain no bitfields. If the value contains only
  38900. bitfields, its total size in bytes must be specified.
  38901. Non-bitfield values have a NAME and TYPE.
  38902. <struct id="ID">
  38903. <field name="NAME" type="TYPE"/>
  38904. ...
  38905. </struct>
  38906. Both NAME and TYPE values are required. No implicit padding is
  38907. added.
  38908. Bitfield values have a NAME, START, END and TYPE.
  38909. <struct id="ID" size="SIZE">
  38910. <field name="NAME" start="START" end="END" type="TYPE"/>
  38911. ...
  38912. </struct>
  38913. <flags id="ID" size="SIZE">
  38914. <field name="NAME" start="START" end="END" type="TYPE"/>
  38915. ...
  38916. </flags>
  38917. The NAME value is required. Bitfield values may be named with the
  38918. empty string, '""', in which case the field is "filler" and its value is
  38919. not printed. Not all bits need to be specified, so "filler" fields are
  38920. optional.
  38921. The START and END values are required, and TYPE is optional. The
  38922. field's START must be less than or equal to its END, and zero represents
  38923. the least significant bit.
  38924. The default value of TYPE is 'bool' for single bit fields, and an
  38925. unsigned integer otherwise.
  38926. Which to choose? Structures or flags?
  38927. Registers defined with 'flags' have these advantages over defining
  38928. them with 'struct':
  38929. * Arithmetic may be performed on them as if they were integers.
  38930. * They are printed in a more readable fashion.
  38931. Registers defined with 'struct' have one advantage over defining them
  38932. with 'flags':
  38933. * One can fetch individual fields like in 'C'.
  38934. (gdb) print $my_struct_reg.field3
  38935. $1 = 42
  38936. G.2.7 Registers
  38937. ---------------
  38938. Each register is represented as an element with this form:
  38939. <reg name="NAME"
  38940. bitsize="SIZE"
  38941. [regnum="NUM"]
  38942. [save-restore="SAVE-RESTORE"]
  38943. [type="TYPE"]
  38944. [group="GROUP"]/>
  38945. The components are as follows:
  38946. NAME
  38947. The register's name; it must be unique within the target
  38948. description.
  38949. BITSIZE
  38950. The register's size, in bits.
  38951. REGNUM
  38952. The register's number. If omitted, a register's number is one
  38953. greater than that of the previous register (either in the current
  38954. feature or in a preceding feature); the first register in the
  38955. target description defaults to zero. This register number is used
  38956. to read or write the register; e.g. it is used in the remote 'p'
  38957. and 'P' packets, and registers appear in the 'g' and 'G' packets in
  38958. order of increasing register number.
  38959. SAVE-RESTORE
  38960. Whether the register should be preserved across inferior function
  38961. calls; this must be either 'yes' or 'no'. The default is 'yes',
  38962. which is appropriate for most registers except for some system
  38963. control registers; this is not related to the target's ABI.
  38964. TYPE
  38965. The type of the register. It may be a predefined type, a type
  38966. defined in the current feature, or one of the special types 'int'
  38967. and 'float'. 'int' is an integer type of the correct size for
  38968. BITSIZE, and 'float' is a floating point type (in the
  38969. architecture's normal floating point format) of the correct size
  38970. for BITSIZE. The default is 'int'.
  38971. GROUP
  38972. The register group to which this register belongs. It can be one
  38973. of the standard register groups 'general', 'float', 'vector' or an
  38974. arbitrary string. Group names should be limited to alphanumeric
  38975. characters. If a group name is made up of multiple words the words
  38976. may be separated by hyphens; e.g. 'special-group' or
  38977. 'ultra-special-group'. If no GROUP is specified, GDB will not
  38978. display the register in 'info registers'.
  38979. 
  38980. File: gdb.info, Node: Predefined Target Types, Next: Enum Target Types, Prev: Target Description Format, Up: Target Descriptions
  38981. G.3 Predefined Target Types
  38982. ===========================
  38983. Type definitions in the self-description can build up composite types
  38984. from basic building blocks, but can not define fundamental types.
  38985. Instead, standard identifiers are provided by GDB for the fundamental
  38986. types. The currently supported types are:
  38987. 'bool'
  38988. Boolean type, occupying a single bit.
  38989. 'int8'
  38990. 'int16'
  38991. 'int24'
  38992. 'int32'
  38993. 'int64'
  38994. 'int128'
  38995. Signed integer types holding the specified number of bits.
  38996. 'uint8'
  38997. 'uint16'
  38998. 'uint24'
  38999. 'uint32'
  39000. 'uint64'
  39001. 'uint128'
  39002. Unsigned integer types holding the specified number of bits.
  39003. 'code_ptr'
  39004. 'data_ptr'
  39005. Pointers to unspecified code and data. The program counter and any
  39006. dedicated return address register may be marked as code pointers;
  39007. printing a code pointer converts it into a symbolic address. The
  39008. stack pointer and any dedicated address registers may be marked as
  39009. data pointers.
  39010. 'ieee_single'
  39011. Single precision IEEE floating point.
  39012. 'ieee_double'
  39013. Double precision IEEE floating point.
  39014. 'arm_fpa_ext'
  39015. The 12-byte extended precision format used by ARM FPA registers.
  39016. 'i387_ext'
  39017. The 10-byte extended precision format used by x87 registers.
  39018. 'i386_eflags'
  39019. 32bit EFLAGS register used by x86.
  39020. 'i386_mxcsr'
  39021. 32bit MXCSR register used by x86.
  39022. 
  39023. File: gdb.info, Node: Enum Target Types, Next: Standard Target Features, Prev: Predefined Target Types, Up: Target Descriptions
  39024. G.4 Enum Target Types
  39025. =====================
  39026. Enum target types are useful in 'struct' and 'flags' register
  39027. descriptions. *Note Target Description Format::.
  39028. Enum types have a name, size and a list of name/value pairs.
  39029. <enum id="ID" size="SIZE">
  39030. <evalue name="NAME" value="VALUE"/>
  39031. ...
  39032. </enum>
  39033. Enums must be defined before they are used.
  39034. <enum id="levels_type" size="4">
  39035. <evalue name="low" value="0"/>
  39036. <evalue name="high" value="1"/>
  39037. </enum>
  39038. <flags id="flags_type" size="4">
  39039. <field name="X" start="0"/>
  39040. <field name="LEVEL" start="1" end="1" type="levels_type"/>
  39041. </flags>
  39042. <reg name="flags" bitsize="32" type="flags_type"/>
  39043. Given that description, a value of 3 for the 'flags' register would
  39044. be printed as:
  39045. (gdb) info register flags
  39046. flags 0x3 [ X LEVEL=high ]
  39047. 
  39048. File: gdb.info, Node: Standard Target Features, Prev: Enum Target Types, Up: Target Descriptions
  39049. G.5 Standard Target Features
  39050. ============================
  39051. A target description must contain either no registers or all the
  39052. target's registers. If the description contains no registers, then GDB
  39053. will assume a default register layout, selected based on the
  39054. architecture. If the description contains any registers, the default
  39055. layout will not be used; the standard registers must be described in the
  39056. target description, in such a way that GDB can recognize them.
  39057. This is accomplished by giving specific names to feature elements
  39058. which contain standard registers. GDB will look for features with those
  39059. names and verify that they contain the expected registers; if any known
  39060. feature is missing required registers, or if any required feature is
  39061. missing, GDB will reject the target description. You can add additional
  39062. registers to any of the standard features -- GDB will display them just
  39063. as if they were added to an unrecognized feature.
  39064. This section lists the known features and their expected contents.
  39065. Sample XML documents for these features are included in the GDB source
  39066. tree, in the directory 'gdb/features'.
  39067. Names recognized by GDB should include the name of the company or
  39068. organization which selected the name, and the overall architecture to
  39069. which the feature applies; so e.g. the feature containing ARM core
  39070. registers is named 'org.gnu.gdb.arm.core'.
  39071. The names of registers are not case sensitive for the purpose of
  39072. recognizing standard features, but GDB will only display registers using
  39073. the capitalization used in the description.
  39074. * Menu:
  39075. * AArch64 Features::
  39076. * ARC Features::
  39077. * ARM Features::
  39078. * i386 Features::
  39079. * MicroBlaze Features::
  39080. * MIPS Features::
  39081. * M68K Features::
  39082. * NDS32 Features::
  39083. * Nios II Features::
  39084. * OpenRISC 1000 Features::
  39085. * PowerPC Features::
  39086. * RISC-V Features::
  39087. * RX Features::
  39088. * S/390 and System z Features::
  39089. * Sparc Features::
  39090. * TIC6x Features::
  39091. 
  39092. File: gdb.info, Node: AArch64 Features, Next: ARC Features, Up: Standard Target Features
  39093. G.5.1 AArch64 Features
  39094. ----------------------
  39095. The 'org.gnu.gdb.aarch64.core' feature is required for AArch64 targets.
  39096. It should contain registers 'x0' through 'x30', 'sp', 'pc', and 'cpsr'.
  39097. The 'org.gnu.gdb.aarch64.fpu' feature is optional. If present, it
  39098. should contain registers 'v0' through 'v31', 'fpsr', and 'fpcr'.
  39099. The 'org.gnu.gdb.aarch64.sve' feature is optional. If present, it
  39100. should contain registers 'z0' through 'z31', 'p0' through 'p15', 'ffr'
  39101. and 'vg'.
  39102. The 'org.gnu.gdb.aarch64.pauth' feature is optional. If present, it
  39103. should contain registers 'pauth_dmask' and 'pauth_cmask'.
  39104. 
  39105. File: gdb.info, Node: ARC Features, Next: ARM Features, Prev: AArch64 Features, Up: Standard Target Features
  39106. G.5.2 ARC Features
  39107. ------------------
  39108. ARC processors are so configurable that even core registers and their
  39109. numbers are not predetermined completely. Moreover, _flags_ and _PC_
  39110. registers, which are important to GDB, are not "core" registers in ARC.
  39111. Therefore, there are two features that their presence is mandatory:
  39112. 'org.gnu.gdb.arc.core' and 'org.gnu.gdb.arc.aux'.
  39113. The 'org.gnu.gdb.arc.core' feature is required for all targets. It
  39114. must contain registers:
  39115. - 'r0' through 'r25' for normal register file targets.
  39116. - 'r0' through 'r3', and 'r10' through 'r15' for reduced register
  39117. file targets.
  39118. - 'gp', 'fp', 'sp', 'r30'(1), 'blink', 'lp_count', 'pcl'.
  39119. In case of an ARCompact target (ARCv1 ISA), the
  39120. 'org.gnu.gdb.arc.core' feature may contain registers 'ilink1' and
  39121. 'ilink2'. While in case of ARC EM and ARC HS targets (ARCv2 ISA),
  39122. register 'ilink' may be present. The difference between ARCv1 and ARCv2
  39123. is the naming of registers _29th_ and _30th_. They are called 'ilink1'
  39124. and 'ilink2' for ARCv1 and are optional. For ARCv2, they are called
  39125. 'ilink' and 'r30' and only 'ilink' is optional. The optionality of
  39126. 'ilink*' registers is because of their inaccessibility during user space
  39127. debugging sessions.
  39128. Extension core registers 'r32' through 'r59' are optional and their
  39129. existence depends on the configuration. When debugging GNU/Linux
  39130. applications, i.e. user space debugging, these core registers are not
  39131. available.
  39132. The 'org.gnu.gdb.arc.aux' feature is required for all ARC targets.
  39133. Here is the list of registers pertinent to this feature:
  39134. - mandatory: 'pc' and 'status32'.
  39135. - optional: 'lp_start', 'lp_end', and 'bta'.
  39136. ---------- Footnotes ----------
  39137. (1) Not necessary for ARCv1.
  39138. 
  39139. File: gdb.info, Node: ARM Features, Next: i386 Features, Prev: ARC Features, Up: Standard Target Features
  39140. G.5.3 ARM Features
  39141. ------------------
  39142. The 'org.gnu.gdb.arm.core' feature is required for non-M-profile ARM
  39143. targets. It should contain registers 'r0' through 'r13', 'sp', 'lr',
  39144. 'pc', and 'cpsr'.
  39145. For M-profile targets (e.g. Cortex-M3), the 'org.gnu.gdb.arm.core'
  39146. feature is replaced by 'org.gnu.gdb.arm.m-profile'. It should contain
  39147. registers 'r0' through 'r13', 'sp', 'lr', 'pc', and 'xpsr'.
  39148. The 'org.gnu.gdb.arm.fpa' feature is optional. If present, it should
  39149. contain registers 'f0' through 'f7' and 'fps'.
  39150. The 'org.gnu.gdb.xscale.iwmmxt' feature is optional. If present, it
  39151. should contain at least registers 'wR0' through 'wR15' and 'wCGR0'
  39152. through 'wCGR3'. The 'wCID', 'wCon', 'wCSSF', and 'wCASF' registers are
  39153. optional.
  39154. The 'org.gnu.gdb.arm.vfp' feature is optional. If present, it should
  39155. contain at least registers 'd0' through 'd15'. If they are present,
  39156. 'd16' through 'd31' should also be included. GDB will synthesize the
  39157. single-precision registers from halves of the double-precision
  39158. registers.
  39159. The 'org.gnu.gdb.arm.neon' feature is optional. It does not need to
  39160. contain registers; it instructs GDB to display the VFP double-precision
  39161. registers as vectors and to synthesize the quad-precision registers from
  39162. pairs of double-precision registers. If this feature is present,
  39163. 'org.gnu.gdb.arm.vfp' must also be present and include 32
  39164. double-precision registers.
  39165. 
  39166. File: gdb.info, Node: i386 Features, Next: MicroBlaze Features, Prev: ARM Features, Up: Standard Target Features
  39167. G.5.4 i386 Features
  39168. -------------------
  39169. The 'org.gnu.gdb.i386.core' feature is required for i386/amd64 targets.
  39170. It should describe the following registers:
  39171. - 'eax' through 'edi' plus 'eip' for i386
  39172. - 'rax' through 'r15' plus 'rip' for amd64
  39173. - 'eflags', 'cs', 'ss', 'ds', 'es', 'fs', 'gs'
  39174. - 'st0' through 'st7'
  39175. - 'fctrl', 'fstat', 'ftag', 'fiseg', 'fioff', 'foseg', 'fooff' and
  39176. 'fop'
  39177. The register sets may be different, depending on the target.
  39178. The 'org.gnu.gdb.i386.sse' feature is optional. It should describe
  39179. registers:
  39180. - 'xmm0' through 'xmm7' for i386
  39181. - 'xmm0' through 'xmm15' for amd64
  39182. - 'mxcsr'
  39183. The 'org.gnu.gdb.i386.avx' feature is optional and requires the
  39184. 'org.gnu.gdb.i386.sse' feature. It should describe the upper 128 bits
  39185. of YMM registers:
  39186. - 'ymm0h' through 'ymm7h' for i386
  39187. - 'ymm0h' through 'ymm15h' for amd64
  39188. The 'org.gnu.gdb.i386.mpx' is an optional feature representing Intel
  39189. Memory Protection Extension (MPX). It should describe the following
  39190. registers:
  39191. - 'bnd0raw' through 'bnd3raw' for i386 and amd64.
  39192. - 'bndcfgu' and 'bndstatus' for i386 and amd64.
  39193. The 'org.gnu.gdb.i386.linux' feature is optional. It should describe
  39194. a single register, 'orig_eax'.
  39195. The 'org.gnu.gdb.i386.segments' feature is optional. It should
  39196. describe two system registers: 'fs_base' and 'gs_base'.
  39197. The 'org.gnu.gdb.i386.avx512' feature is optional and requires the
  39198. 'org.gnu.gdb.i386.avx' feature. It should describe additional XMM
  39199. registers:
  39200. - 'xmm16h' through 'xmm31h', only valid for amd64.
  39201. It should describe the upper 128 bits of additional YMM registers:
  39202. - 'ymm16h' through 'ymm31h', only valid for amd64.
  39203. It should describe the upper 256 bits of ZMM registers:
  39204. - 'zmm0h' through 'zmm7h' for i386.
  39205. - 'zmm0h' through 'zmm15h' for amd64.
  39206. It should describe the additional ZMM registers:
  39207. - 'zmm16h' through 'zmm31h', only valid for amd64.
  39208. The 'org.gnu.gdb.i386.pkeys' feature is optional. It should describe
  39209. a single register, 'pkru'. It is a 32-bit register valid for i386 and
  39210. amd64.
  39211. 
  39212. File: gdb.info, Node: MicroBlaze Features, Next: MIPS Features, Prev: i386 Features, Up: Standard Target Features
  39213. G.5.5 MicroBlaze Features
  39214. -------------------------
  39215. The 'org.gnu.gdb.microblaze.core' feature is required for MicroBlaze
  39216. targets. It should contain registers 'r0' through 'r31', 'rpc', 'rmsr',
  39217. 'rear', 'resr', 'rfsr', 'rbtr', 'rpvr', 'rpvr1' through 'rpvr11',
  39218. 'redr', 'rpid', 'rzpr', 'rtlbx', 'rtlbsx', 'rtlblo', and 'rtlbhi'.
  39219. The 'org.gnu.gdb.microblaze.stack-protect' feature is optional. If
  39220. present, it should contain registers 'rshr' and 'rslr'
  39221. 
  39222. File: gdb.info, Node: MIPS Features, Next: M68K Features, Prev: MicroBlaze Features, Up: Standard Target Features
  39223. G.5.6 MIPS Features
  39224. -------------------
  39225. The 'org.gnu.gdb.mips.cpu' feature is required for MIPS targets. It
  39226. should contain registers 'r0' through 'r31', 'lo', 'hi', and 'pc'. They
  39227. may be 32-bit or 64-bit depending on the target.
  39228. The 'org.gnu.gdb.mips.cp0' feature is also required. It should
  39229. contain at least the 'status', 'badvaddr', and 'cause' registers. They
  39230. may be 32-bit or 64-bit depending on the target.
  39231. The 'org.gnu.gdb.mips.fpu' feature is currently required, though it
  39232. may be optional in a future version of GDB. It should contain registers
  39233. 'f0' through 'f31', 'fcsr', and 'fir'. They may be 32-bit or 64-bit
  39234. depending on the target.
  39235. The 'org.gnu.gdb.mips.dsp' feature is optional. It should contain
  39236. registers 'hi1' through 'hi3', 'lo1' through 'lo3', and 'dspctl'. The
  39237. 'dspctl' register should be 32-bit and the rest may be 32-bit or 64-bit
  39238. depending on the target.
  39239. The 'org.gnu.gdb.mips.linux' feature is optional. It should contain
  39240. a single register, 'restart', which is used by the Linux kernel to
  39241. control restartable syscalls.
  39242. 
  39243. File: gdb.info, Node: M68K Features, Next: NDS32 Features, Prev: MIPS Features, Up: Standard Target Features
  39244. G.5.7 M68K Features
  39245. -------------------
  39246. ''org.gnu.gdb.m68k.core''
  39247. ''org.gnu.gdb.coldfire.core''
  39248. ''org.gnu.gdb.fido.core''
  39249. One of those features must be always present. The feature that is
  39250. present determines which flavor of m68k is used. The feature that
  39251. is present should contain registers 'd0' through 'd7', 'a0' through
  39252. 'a5', 'fp', 'sp', 'ps' and 'pc'.
  39253. ''org.gnu.gdb.coldfire.fp''
  39254. This feature is optional. If present, it should contain registers
  39255. 'fp0' through 'fp7', 'fpcontrol', 'fpstatus' and 'fpiaddr'.
  39256. Note that, despite the fact that this feature's name says
  39257. 'coldfire', it is used to describe any floating point registers.
  39258. The size of the registers must match the main m68k flavor; so, for
  39259. example, if the primary feature is reported as 'coldfire', then
  39260. 64-bit floating point registers are required.
  39261. 
  39262. File: gdb.info, Node: NDS32 Features, Next: Nios II Features, Prev: M68K Features, Up: Standard Target Features
  39263. G.5.8 NDS32 Features
  39264. --------------------
  39265. The 'org.gnu.gdb.nds32.core' feature is required for NDS32 targets. It
  39266. should contain at least registers 'r0' through 'r10', 'r15', 'fp', 'gp',
  39267. 'lp', 'sp', and 'pc'.
  39268. The 'org.gnu.gdb.nds32.fpu' feature is optional. If present, it
  39269. should contain 64-bit double-precision floating-point registers 'fd0'
  39270. through _fdN_, which should be 'fd3', 'fd7', 'fd15', or 'fd31' based on
  39271. the FPU configuration implemented.
  39272. _Note:_ The first sixteen 64-bit double-precision floating-point
  39273. registers are overlapped with the thirty-two 32-bit single-precision
  39274. floating-point registers. The 32-bit single-precision registers, if not
  39275. being listed explicitly, will be synthesized from halves of the
  39276. overlapping 64-bit double-precision registers. Listing 32-bit
  39277. single-precision registers explicitly is deprecated, and the support to
  39278. it could be totally removed some day.
  39279. 
  39280. File: gdb.info, Node: Nios II Features, Next: OpenRISC 1000 Features, Prev: NDS32 Features, Up: Standard Target Features
  39281. G.5.9 Nios II Features
  39282. ----------------------
  39283. The 'org.gnu.gdb.nios2.cpu' feature is required for Nios II targets. It
  39284. should contain the 32 core registers ('zero', 'at', 'r2' through 'r23',
  39285. 'et' through 'ra'), 'pc', and the 16 control registers ('status' through
  39286. 'mpuacc').
  39287. 
  39288. File: gdb.info, Node: OpenRISC 1000 Features, Next: PowerPC Features, Prev: Nios II Features, Up: Standard Target Features
  39289. G.5.10 Openrisc 1000 Features
  39290. -----------------------------
  39291. The 'org.gnu.gdb.or1k.group0' feature is required for OpenRISC 1000
  39292. targets. It should contain the 32 general purpose registers ('r0'
  39293. through 'r31'), 'ppc', 'npc' and 'sr'.
  39294. 
  39295. File: gdb.info, Node: PowerPC Features, Next: RISC-V Features, Prev: OpenRISC 1000 Features, Up: Standard Target Features
  39296. G.5.11 PowerPC Features
  39297. -----------------------
  39298. The 'org.gnu.gdb.power.core' feature is required for PowerPC targets.
  39299. It should contain registers 'r0' through 'r31', 'pc', 'msr', 'cr', 'lr',
  39300. 'ctr', and 'xer'. They may be 32-bit or 64-bit depending on the target.
  39301. The 'org.gnu.gdb.power.fpu' feature is optional. It should contain
  39302. registers 'f0' through 'f31' and 'fpscr'.
  39303. The 'org.gnu.gdb.power.altivec' feature is optional. It should
  39304. contain registers 'vr0' through 'vr31', 'vscr', and 'vrsave'. GDB will
  39305. define pseudo-registers 'v0' through 'v31' as aliases for the
  39306. corresponding 'vrX' registers.
  39307. The 'org.gnu.gdb.power.vsx' feature is optional. It should contain
  39308. registers 'vs0h' through 'vs31h'. GDB will combine these registers with
  39309. the floating point registers ('f0' through 'f31') and the altivec
  39310. registers ('vr0' through 'vr31') to present the 128-bit wide registers
  39311. 'vs0' through 'vs63', the set of vector-scalar registers for POWER7.
  39312. Therefore, this feature requires both 'org.gnu.gdb.power.fpu' and
  39313. 'org.gnu.gdb.power.altivec'.
  39314. The 'org.gnu.gdb.power.spe' feature is optional. It should contain
  39315. registers 'ev0h' through 'ev31h', 'acc', and 'spefscr'. SPE targets
  39316. should provide 32-bit registers in 'org.gnu.gdb.power.core' and provide
  39317. the upper halves in 'ev0h' through 'ev31h'. GDB will combine these to
  39318. present registers 'ev0' through 'ev31' to the user.
  39319. The 'org.gnu.gdb.power.ppr' feature is optional. It should contain
  39320. the 64-bit register 'ppr'.
  39321. The 'org.gnu.gdb.power.dscr' feature is optional. It should contain
  39322. the 64-bit register 'dscr'.
  39323. The 'org.gnu.gdb.power.tar' feature is optional. It should contain
  39324. the 64-bit register 'tar'.
  39325. The 'org.gnu.gdb.power.ebb' feature is optional. It should contain
  39326. registers 'bescr', 'ebbhr' and 'ebbrr', all 64-bit wide.
  39327. The 'org.gnu.gdb.power.linux.pmu' feature is optional. It should
  39328. contain registers 'mmcr0', 'mmcr2', 'siar', 'sdar' and 'sier', all
  39329. 64-bit wide. This is the subset of the isa 2.07 server PMU registers
  39330. provided by GNU/Linux.
  39331. The 'org.gnu.gdb.power.htm.spr' feature is optional. It should
  39332. contain registers 'tfhar', 'texasr' and 'tfiar', all 64-bit wide.
  39333. The 'org.gnu.gdb.power.htm.core' feature is optional. It should
  39334. contain the checkpointed general-purpose registers 'cr0' through 'cr31',
  39335. as well as the checkpointed registers 'clr' and 'cctr'. These registers
  39336. may all be either 32-bit or 64-bit depending on the target. It should
  39337. also contain the checkpointed registers 'ccr' and 'cxer', which should
  39338. both be 32-bit wide.
  39339. The 'org.gnu.gdb.power.htm.fpu' feature is optional. It should
  39340. contain the checkpointed 64-bit floating-point registers 'cf0' through
  39341. 'cf31', as well as the checkpointed 64-bit register 'cfpscr'.
  39342. The 'org.gnu.gdb.power.htm.altivec' feature is optional. It should
  39343. contain the checkpointed altivec registers 'cvr0' through 'cvr31', all
  39344. 128-bit wide. It should also contain the checkpointed registers 'cvscr'
  39345. and 'cvrsave', both 32-bit wide.
  39346. The 'org.gnu.gdb.power.htm.vsx' feature is optional. It should
  39347. contain registers 'cvs0h' through 'cvs31h'. GDB will combine these
  39348. registers with the checkpointed floating point registers ('cf0' through
  39349. 'cf31') and the checkpointed altivec registers ('cvr0' through 'cvr31')
  39350. to present the 128-bit wide checkpointed vector-scalar registers 'cvs0'
  39351. through 'cvs63'. Therefore, this feature requires both
  39352. 'org.gnu.gdb.power.htm.altivec' and 'org.gnu.gdb.power.htm.fpu'.
  39353. The 'org.gnu.gdb.power.htm.ppr' feature is optional. It should
  39354. contain the 64-bit checkpointed register 'cppr'.
  39355. The 'org.gnu.gdb.power.htm.dscr' feature is optional. It should
  39356. contain the 64-bit checkpointed register 'cdscr'.
  39357. The 'org.gnu.gdb.power.htm.tar' feature is optional. It should
  39358. contain the 64-bit checkpointed register 'ctar'.
  39359. 
  39360. File: gdb.info, Node: RISC-V Features, Next: RX Features, Prev: PowerPC Features, Up: Standard Target Features
  39361. G.5.12 RISC-V Features
  39362. ----------------------
  39363. The 'org.gnu.gdb.riscv.cpu' feature is required for RISC-V targets. It
  39364. should contain the registers 'x0' through 'x31', and 'pc'. Either the
  39365. architectural names ('x0', 'x1', etc) can be used, or the ABI names
  39366. ('zero', 'ra', etc).
  39367. The 'org.gnu.gdb.riscv.fpu' feature is optional. If present, it
  39368. should contain registers 'f0' through 'f31', 'fflags', 'frm', and
  39369. 'fcsr'. As with the cpu feature, either the architectural register
  39370. names, or the ABI names can be used.
  39371. The 'org.gnu.gdb.riscv.virtual' feature is optional. If present, it
  39372. should contain registers that are not backed by real registers on the
  39373. target, but are instead virtual, where the register value is derived
  39374. from other target state. In many ways these are like GDBs
  39375. pseudo-registers, except implemented by the target. Currently the only
  39376. register expected in this set is the one byte 'priv' register that
  39377. contains the target's privilege level in the least significant two bits.
  39378. The 'org.gnu.gdb.riscv.csr' feature is optional. If present, it
  39379. should contain all of the target's standard CSRs. Standard CSRs are
  39380. those defined in the RISC-V specification documents. There is some
  39381. overlap between this feature and the fpu feature; the 'fflags', 'frm',
  39382. and 'fcsr' registers could be in either feature. The expectation is
  39383. that these registers will be in the fpu feature if the target has
  39384. floating point hardware, but can be moved into the csr feature if the
  39385. target has the floating point control registers, but no other floating
  39386. point hardware.
  39387. 
  39388. File: gdb.info, Node: RX Features, Next: S/390 and System z Features, Prev: RISC-V Features, Up: Standard Target Features
  39389. G.5.13 RX Features
  39390. ------------------
  39391. The 'org.gnu.gdb.rx.core' feature is required for RX targets. It should
  39392. contain the registers 'r0' through 'r15', 'usp', 'isp', 'psw', 'pc',
  39393. 'intb', 'bpsw', 'bpc', 'fintv', 'fpsw', and 'acc'.
  39394. 
  39395. File: gdb.info, Node: S/390 and System z Features, Next: Sparc Features, Prev: RX Features, Up: Standard Target Features
  39396. G.5.14 S/390 and System z Features
  39397. ----------------------------------
  39398. The 'org.gnu.gdb.s390.core' feature is required for S/390 and System z
  39399. targets. It should contain the PSW and the 16 general registers. In
  39400. particular, System z targets should provide the 64-bit registers 'pswm',
  39401. 'pswa', and 'r0' through 'r15'. S/390 targets should provide the 32-bit
  39402. versions of these registers. A System z target that runs in 31-bit
  39403. addressing mode should provide 32-bit versions of 'pswm' and 'pswa', as
  39404. well as the general register's upper halves 'r0h' through 'r15h', and
  39405. their lower halves 'r0l' through 'r15l'.
  39406. The 'org.gnu.gdb.s390.fpr' feature is required. It should contain
  39407. the 64-bit registers 'f0' through 'f15', and 'fpc'.
  39408. The 'org.gnu.gdb.s390.acr' feature is required. It should contain
  39409. the 32-bit registers 'acr0' through 'acr15'.
  39410. The 'org.gnu.gdb.s390.linux' feature is optional. It should contain
  39411. the register 'orig_r2', which is 64-bit wide on System z targets and
  39412. 32-bit otherwise. In addition, the feature may contain the 'last_break'
  39413. register, whose width depends on the addressing mode, as well as the
  39414. 'system_call' register, which is always 32-bit wide.
  39415. The 'org.gnu.gdb.s390.tdb' feature is optional. It should contain
  39416. the 64-bit registers 'tdb0', 'tac', 'tct', 'atia', and 'tr0' through
  39417. 'tr15'.
  39418. The 'org.gnu.gdb.s390.vx' feature is optional. It should contain
  39419. 64-bit wide registers 'v0l' through 'v15l', which will be combined by
  39420. GDB with the floating point registers 'f0' through 'f15' to present the
  39421. 128-bit wide vector registers 'v0' through 'v15'. In addition, this
  39422. feature should contain the 128-bit wide vector registers 'v16' through
  39423. 'v31'.
  39424. The 'org.gnu.gdb.s390.gs' feature is optional. It should contain the
  39425. 64-bit wide guarded-storage-control registers 'gsd', 'gssm', and
  39426. 'gsepla'.
  39427. The 'org.gnu.gdb.s390.gsbc' feature is optional. It should contain
  39428. the 64-bit wide guarded-storage broadcast control registers 'bc_gsd',
  39429. 'bc_gssm', and 'bc_gsepla'.
  39430. 
  39431. File: gdb.info, Node: Sparc Features, Next: TIC6x Features, Prev: S/390 and System z Features, Up: Standard Target Features
  39432. G.5.15 Sparc Features
  39433. ---------------------
  39434. The 'org.gnu.gdb.sparc.cpu' feature is required for sparc32/sparc64
  39435. targets. It should describe the following registers:
  39436. - 'g0' through 'g7'
  39437. - 'o0' through 'o7'
  39438. - 'l0' through 'l7'
  39439. - 'i0' through 'i7'
  39440. They may be 32-bit or 64-bit depending on the target.
  39441. Also the 'org.gnu.gdb.sparc.fpu' feature is required for
  39442. sparc32/sparc64 targets. It should describe the following registers:
  39443. - 'f0' through 'f31'
  39444. - 'f32' through 'f62' for sparc64
  39445. The 'org.gnu.gdb.sparc.cp0' feature is required for sparc32/sparc64
  39446. targets. It should describe the following registers:
  39447. - 'y', 'psr', 'wim', 'tbr', 'pc', 'npc', 'fsr', and 'csr' for sparc32
  39448. - 'pc', 'npc', 'state', 'fsr', 'fprs', and 'y' for sparc64
  39449. 
  39450. File: gdb.info, Node: TIC6x Features, Prev: Sparc Features, Up: Standard Target Features
  39451. G.5.16 TMS320C6x Features
  39452. -------------------------
  39453. The 'org.gnu.gdb.tic6x.core' feature is required for TMS320C6x targets.
  39454. It should contain registers 'A0' through 'A15', registers 'B0' through
  39455. 'B15', 'CSR' and 'PC'.
  39456. The 'org.gnu.gdb.tic6x.gp' feature is optional. It should contain
  39457. registers 'A16' through 'A31' and 'B16' through 'B31'.
  39458. The 'org.gnu.gdb.tic6x.c6xp' feature is optional. It should contain
  39459. registers 'TSR', 'ILC' and 'RILC'.
  39460. 
  39461. File: gdb.info, Node: Operating System Information, Next: Trace File Format, Prev: Target Descriptions, Up: Top
  39462. Appendix H Operating System Information
  39463. ***************************************
  39464. * Menu:
  39465. * Process list::
  39466. Users of GDB often wish to obtain information about the state of the
  39467. operating system running on the target--for example the list of
  39468. processes, or the list of open files. This section describes the
  39469. mechanism that makes it possible. This mechanism is similar to the
  39470. target features mechanism (*note Target Descriptions::), but focuses on
  39471. a different aspect of target.
  39472. Operating system information is retrieved from the target via the
  39473. remote protocol, using 'qXfer' requests (*note qXfer osdata read::).
  39474. The object name in the request should be 'osdata', and the ANNEX
  39475. identifies the data to be fetched.
  39476. 
  39477. File: gdb.info, Node: Process list, Up: Operating System Information
  39478. H.1 Process list
  39479. ================
  39480. When requesting the process list, the ANNEX field in the 'qXfer' request
  39481. should be 'processes'. The returned data is an XML document. The
  39482. formal syntax of this document is defined in 'gdb/features/osdata.dtd'.
  39483. An example document is:
  39484. <?xml version="1.0"?>
  39485. <!DOCTYPE target SYSTEM "osdata.dtd">
  39486. <osdata type="processes">
  39487. <item>
  39488. <column name="pid">1</column>
  39489. <column name="user">root</column>
  39490. <column name="command">/sbin/init</column>
  39491. <column name="cores">1,2,3</column>
  39492. </item>
  39493. </osdata>
  39494. Each item should include a column whose name is 'pid'. The value of
  39495. that column should identify the process on the target. The 'user' and
  39496. 'command' columns are optional, and will be displayed by GDB. The
  39497. 'cores' column, if present, should contain a comma-separated list of
  39498. cores that this process is running on. Target may provide additional
  39499. columns, which GDB currently ignores.
  39500. 
  39501. File: gdb.info, Node: Trace File Format, Next: Index Section Format, Prev: Operating System Information, Up: Top
  39502. Appendix I Trace File Format
  39503. ****************************
  39504. The trace file comes in three parts: a header, a textual description
  39505. section, and a trace frame section with binary data.
  39506. The header has the form '\x7fTRACE0\n'. The first byte is '0x7f' so
  39507. as to indicate that the file contains binary data, while the '0' is a
  39508. version number that may have different values in the future.
  39509. The description section consists of multiple lines of ASCII text
  39510. separated by newline characters ('0xa'). The lines may include a
  39511. variety of optional descriptive or context-setting information, such as
  39512. tracepoint definitions or register set size. GDB will ignore any line
  39513. that it does not recognize. An empty line marks the end of this
  39514. section.
  39515. 'R SIZE'
  39516. Specifies the size of a register block in bytes. This is equal to
  39517. the size of a 'g' packet payload in the remote protocol. SIZE is
  39518. an ascii decimal number. There should be only one such line in a
  39519. single trace file.
  39520. 'status STATUS'
  39521. Trace status. STATUS has the same format as a 'qTStatus' remote
  39522. packet reply. There should be only one such line in a single trace
  39523. file.
  39524. 'tp PAYLOAD'
  39525. Tracepoint definition. The PAYLOAD has the same format as
  39526. 'qTfP'/'qTsP' remote packet reply payload. A single tracepoint may
  39527. take multiple lines of definition, corresponding to the multiple
  39528. reply packets.
  39529. 'tsv PAYLOAD'
  39530. Trace state variable definition. The PAYLOAD has the same format
  39531. as 'qTfV'/'qTsV' remote packet reply payload. A single variable
  39532. may take multiple lines of definition, corresponding to the
  39533. multiple reply packets.
  39534. 'tdesc PAYLOAD'
  39535. Target description in XML format. The PAYLOAD is a single line of
  39536. the XML file. All such lines should be concatenated together to
  39537. get the original XML file. This file is in the same format as
  39538. 'qXfer' 'features' payload, and corresponds to the main
  39539. 'target.xml' file. Includes are not allowed.
  39540. The trace frame section consists of a number of consecutive frames.
  39541. Each frame begins with a two-byte tracepoint number, followed by a
  39542. four-byte size giving the amount of data in the frame. The data in the
  39543. frame consists of a number of blocks, each introduced by a character
  39544. indicating its type (at least register, memory, and trace state
  39545. variable). The data in this section is raw binary, not a hexadecimal or
  39546. other encoding; its endianness matches the target's endianness.
  39547. 'R BYTES'
  39548. Register block. The number and ordering of bytes matches that of a
  39549. 'g' packet in the remote protocol. Note that these are the actual
  39550. bytes, in target order, not a hexadecimal encoding.
  39551. 'M ADDRESS LENGTH BYTES...'
  39552. Memory block. This is a contiguous block of memory, at the 8-byte
  39553. address ADDRESS, with a 2-byte length LENGTH, followed by LENGTH
  39554. bytes.
  39555. 'V NUMBER VALUE'
  39556. Trace state variable block. This records the 8-byte signed value
  39557. VALUE of trace state variable numbered NUMBER.
  39558. Future enhancements of the trace file format may include additional
  39559. types of blocks.
  39560. 
  39561. File: gdb.info, Node: Index Section Format, Next: Man Pages, Prev: Trace File Format, Up: Top
  39562. Appendix J '.gdb_index' section format
  39563. **************************************
  39564. This section documents the index section that is created by 'save
  39565. gdb-index' (*note Index Files::). The index section is DWARF-specific;
  39566. some knowledge of DWARF is assumed in this description.
  39567. The mapped index file format is designed to be directly 'mmap'able on
  39568. any architecture. In most cases, a datum is represented using a
  39569. little-endian 32-bit integer value, called an 'offset_type'. Big endian
  39570. machines must byte-swap the values before using them. Exceptions to
  39571. this rule are noted. The data is laid out such that alignment is always
  39572. respected.
  39573. A mapped index consists of several areas, laid out in order.
  39574. 1. The file header. This is a sequence of values, of 'offset_type'
  39575. unless otherwise noted:
  39576. 1. The version number, currently 8. Versions 1, 2 and 3 are
  39577. obsolete. Version 4 uses a different hashing function from
  39578. versions 5 and 6. Version 6 includes symbols for inlined
  39579. functions, whereas versions 4 and 5 do not. Version 7 adds
  39580. attributes to the CU indices in the symbol table. Version 8
  39581. specifies that symbols from DWARF type units
  39582. ('DW_TAG_type_unit') refer to the type unit's symbol table and
  39583. not the compilation unit ('DW_TAG_comp_unit') using the type.
  39584. GDB will only read version 4, 5, or 6 indices by specifying
  39585. 'set use-deprecated-index-sections on'. GDB has a workaround
  39586. for potentially broken version 7 indices so it is currently
  39587. not flagged as deprecated.
  39588. 2. The offset, from the start of the file, of the CU list.
  39589. 3. The offset, from the start of the file, of the types CU list.
  39590. Note that this area can be empty, in which case this offset
  39591. will be equal to the next offset.
  39592. 4. The offset, from the start of the file, of the address area.
  39593. 5. The offset, from the start of the file, of the symbol table.
  39594. 6. The offset, from the start of the file, of the constant pool.
  39595. 2. The CU list. This is a sequence of pairs of 64-bit little-endian
  39596. values, sorted by the CU offset. The first element in each pair is
  39597. the offset of a CU in the '.debug_info' section. The second
  39598. element in each pair is the length of that CU. References to a CU
  39599. elsewhere in the map are done using a CU index, which is just the
  39600. 0-based index into this table. Note that if there are type CUs,
  39601. then conceptually CUs and type CUs form a single list for the
  39602. purposes of CU indices.
  39603. 3. The types CU list. This is a sequence of triplets of 64-bit
  39604. little-endian values. In a triplet, the first value is the CU
  39605. offset, the second value is the type offset in the CU, and the
  39606. third value is the type signature. The types CU list is not
  39607. sorted.
  39608. 4. The address area. The address area consists of a sequence of
  39609. address entries. Each address entry has three elements:
  39610. 1. The low address. This is a 64-bit little-endian value.
  39611. 2. The high address. This is a 64-bit little-endian value. Like
  39612. 'DW_AT_high_pc', the value is one byte beyond the end.
  39613. 3. The CU index. This is an 'offset_type' value.
  39614. 5. The symbol table. This is an open-addressed hash table. The size
  39615. of the hash table is always a power of 2.
  39616. Each slot in the hash table consists of a pair of 'offset_type'
  39617. values. The first value is the offset of the symbol's name in the
  39618. constant pool. The second value is the offset of the CU vector in
  39619. the constant pool.
  39620. If both values are 0, then this slot in the hash table is empty.
  39621. This is ok because while 0 is a valid constant pool index, it
  39622. cannot be a valid index for both a string and a CU vector.
  39623. The hash value for a table entry is computed by applying an
  39624. iterative hash function to the symbol's name. Starting with an
  39625. initial value of 'r = 0', each (unsigned) character 'c' in the
  39626. string is incorporated into the hash using the formula depending on
  39627. the index version:
  39628. Version 4
  39629. The formula is 'r = r * 67 + c - 113'.
  39630. Versions 5 to 7
  39631. The formula is 'r = r * 67 + tolower (c) - 113'.
  39632. The terminating '\0' is not incorporated into the hash.
  39633. The step size used in the hash table is computed via '((hash * 17)
  39634. & (size - 1)) | 1', where 'hash' is the hash value, and 'size' is
  39635. the size of the hash table. The step size is used to find the next
  39636. candidate slot when handling a hash collision.
  39637. The names of C++ symbols in the hash table are canonicalized. We
  39638. don't currently have a simple description of the canonicalization
  39639. algorithm; if you intend to create new index sections, you must
  39640. read the code.
  39641. 6. The constant pool. This is simply a bunch of bytes. It is
  39642. organized so that alignment is correct: CU vectors are stored
  39643. first, followed by strings.
  39644. A CU vector in the constant pool is a sequence of 'offset_type'
  39645. values. The first value is the number of CU indices in the vector.
  39646. Each subsequent value is the index and symbol attributes of a CU in
  39647. the CU list. This element in the hash table is used to indicate
  39648. which CUs define the symbol and how the symbol is used. See below
  39649. for the format of each CU index+attributes entry.
  39650. A string in the constant pool is zero-terminated.
  39651. Attributes were added to CU index values in '.gdb_index' version 7.
  39652. If a symbol has multiple uses within a CU then there is one CU
  39653. index+attributes value for each use.
  39654. The format of each CU index+attributes entry is as follows (bit 0 =
  39655. LSB):
  39656. Bits 0-23
  39657. This is the index of the CU in the CU list.
  39658. Bits 24-27
  39659. These bits are reserved for future purposes and must be zero.
  39660. Bits 28-30
  39661. The kind of the symbol in the CU.
  39662. 0
  39663. This value is reserved and should not be used. By reserving
  39664. zero the full 'offset_type' value is backwards compatible with
  39665. previous versions of the index.
  39666. 1
  39667. The symbol is a type.
  39668. 2
  39669. The symbol is a variable or an enum value.
  39670. 3
  39671. The symbol is a function.
  39672. 4
  39673. Any other kind of symbol.
  39674. 5,6,7
  39675. These values are reserved.
  39676. Bit 31
  39677. This bit is zero if the value is global and one if it is static.
  39678. The determination of whether a symbol is global or static is
  39679. complicated. The authorative reference is the file 'dwarf2read.c'
  39680. in GDB sources.
  39681. This pseudo-code describes the computation of a symbol's kind and
  39682. global/static attributes in the index.
  39683. is_external = get_attribute (die, DW_AT_external);
  39684. language = get_attribute (cu_die, DW_AT_language);
  39685. switch (die->tag)
  39686. {
  39687. case DW_TAG_typedef:
  39688. case DW_TAG_base_type:
  39689. case DW_TAG_subrange_type:
  39690. kind = TYPE;
  39691. is_static = 1;
  39692. break;
  39693. case DW_TAG_enumerator:
  39694. kind = VARIABLE;
  39695. is_static = language != CPLUS;
  39696. break;
  39697. case DW_TAG_subprogram:
  39698. kind = FUNCTION;
  39699. is_static = ! (is_external || language == ADA);
  39700. break;
  39701. case DW_TAG_constant:
  39702. kind = VARIABLE;
  39703. is_static = ! is_external;
  39704. break;
  39705. case DW_TAG_variable:
  39706. kind = VARIABLE;
  39707. is_static = ! is_external;
  39708. break;
  39709. case DW_TAG_namespace:
  39710. kind = TYPE;
  39711. is_static = 0;
  39712. break;
  39713. case DW_TAG_class_type:
  39714. case DW_TAG_interface_type:
  39715. case DW_TAG_structure_type:
  39716. case DW_TAG_union_type:
  39717. case DW_TAG_enumeration_type:
  39718. kind = TYPE;
  39719. is_static = language != CPLUS;
  39720. break;
  39721. default:
  39722. assert (0);
  39723. }
  39724. 
  39725. File: gdb.info, Node: Man Pages, Next: Copying, Prev: Index Section Format, Up: Top
  39726. Appendix K Manual pages
  39727. ***********************
  39728. * Menu:
  39729. * gdb man:: The GNU Debugger man page
  39730. * gdbserver man:: Remote Server for the GNU Debugger man page
  39731. * gcore man:: Generate a core file of a running program
  39732. * gdbinit man:: gdbinit scripts
  39733. * gdb-add-index man:: Add index files to speed up GDB
  39734. 
  39735. File: gdb.info, Node: gdb man, Next: gdbserver man, Up: Man Pages
  39736. gdb man
  39737. =======
  39738. gdb ['-help'] ['-nh'] ['-nx'] ['-q'] ['-batch'] ['-cd='DIR] ['-f']
  39739. ['-b' BPS] ['-tty='DEV] ['-s' SYMFILE] ['-e' PROG] ['-se' PROG]
  39740. ['-c' CORE] ['-p' PROCID] ['-x' CMDS] ['-d' DIR] [PROG|PROG PROCID|PROG
  39741. CORE]
  39742. The purpose of a debugger such as GDB is to allow you to see what is
  39743. going on "inside" another program while it executes - or what another
  39744. program was doing at the moment it crashed.
  39745. GDB can do four main kinds of things (plus other things in support of
  39746. these) to help you catch bugs in the act:
  39747. * Start your program, specifying anything that might affect its
  39748. behavior.
  39749. * Make your program stop on specified conditions.
  39750. * Examine what has happened, when your program has stopped.
  39751. * Change things in your program, so you can experiment with
  39752. correcting the effects of one bug and go on to learn about another.
  39753. You can use GDB to debug programs written in C, C++, Fortran and
  39754. Modula-2.
  39755. GDB is invoked with the shell command 'gdb'. Once started, it reads
  39756. commands from the terminal until you tell it to exit with the GDB
  39757. command 'quit'. You can get online help from GDB itself by using the
  39758. command 'help'.
  39759. You can run 'gdb' with no arguments or options; but the most usual
  39760. way to start GDB is with one argument or two, specifying an executable
  39761. program as the argument:
  39762. gdb program
  39763. You can also start with both an executable program and a core file
  39764. specified:
  39765. gdb program core
  39766. You can, instead, specify a process ID as a second argument or use
  39767. option '-p', if you want to debug a running process:
  39768. gdb program 1234
  39769. gdb -p 1234
  39770. would attach GDB to process '1234'. With option '-p' you can omit the
  39771. PROGRAM filename.
  39772. Here are some of the most frequently needed GDB commands:
  39773. 'break [FILE:]FUNCTION'
  39774. Set a breakpoint at FUNCTION (in FILE).
  39775. 'run [ARGLIST]'
  39776. Start your program (with ARGLIST, if specified).
  39777. 'bt'
  39778. Backtrace: display the program stack.
  39779. 'print EXPR'
  39780. Display the value of an expression.
  39781. 'c'
  39782. Continue running your program (after stopping, e.g. at a
  39783. breakpoint).
  39784. 'next'
  39785. Execute next program line (after stopping); step _over_ any
  39786. function calls in the line.
  39787. 'edit [FILE:]FUNCTION'
  39788. look at the program line where it is presently stopped.
  39789. 'list [FILE:]FUNCTION'
  39790. type the text of the program in the vicinity of where it is
  39791. presently stopped.
  39792. 'step'
  39793. Execute next program line (after stopping); step _into_ any
  39794. function calls in the line.
  39795. 'help [NAME]'
  39796. Show information about GDB command NAME, or general information
  39797. about using GDB.
  39798. 'quit'
  39799. Exit from GDB.
  39800. Any arguments other than options specify an executable file and core
  39801. file (or process ID); that is, the first argument encountered with no
  39802. associated option flag is equivalent to a '-se' option, and the second,
  39803. if any, is equivalent to a '-c' option if it's the name of a file. Many
  39804. options have both long and short forms; both are shown here. The long
  39805. forms are also recognized if you truncate them, so long as enough of the
  39806. option is present to be unambiguous. (If you prefer, you can flag
  39807. option arguments with '+' rather than '-', though we illustrate the more
  39808. usual convention.)
  39809. All the options and command line arguments you give are processed in
  39810. sequential order. The order makes a difference when the '-x' option is
  39811. used.
  39812. '-help'
  39813. '-h'
  39814. List all options, with brief explanations.
  39815. '-symbols=FILE'
  39816. '-s FILE'
  39817. Read symbol table from file FILE.
  39818. '-write'
  39819. Enable writing into executable and core files.
  39820. '-exec=FILE'
  39821. '-e FILE'
  39822. Use file FILE as the executable file to execute when appropriate,
  39823. and for examining pure data in conjunction with a core dump.
  39824. '-se=FILE'
  39825. Read symbol table from file FILE and use it as the executable file.
  39826. '-core=FILE'
  39827. '-c FILE'
  39828. Use file FILE as a core dump to examine.
  39829. '-command=FILE'
  39830. '-x FILE'
  39831. Execute GDB commands from file FILE.
  39832. '-ex COMMAND'
  39833. Execute given GDB COMMAND.
  39834. '-directory=DIRECTORY'
  39835. '-d DIRECTORY'
  39836. Add DIRECTORY to the path to search for source files.
  39837. '-nh'
  39838. Do not execute commands from '~/.gdbinit'.
  39839. '-nx'
  39840. '-n'
  39841. Do not execute commands from any '.gdbinit' initialization files.
  39842. '-quiet'
  39843. '-q'
  39844. "Quiet". Do not print the introductory and copyright messages.
  39845. These messages are also suppressed in batch mode.
  39846. '-batch'
  39847. Run in batch mode. Exit with status '0' after processing all the
  39848. command files specified with '-x' (and '.gdbinit', if not
  39849. inhibited). Exit with nonzero status if an error occurs in
  39850. executing the GDB commands in the command files.
  39851. Batch mode may be useful for running GDB as a filter, for example
  39852. to download and run a program on another computer; in order to make
  39853. this more useful, the message
  39854. Program exited normally.
  39855. (which is ordinarily issued whenever a program running under GDB
  39856. control terminates) is not issued when running in batch mode.
  39857. '-cd=DIRECTORY'
  39858. Run GDB using DIRECTORY as its working directory, instead of the
  39859. current directory.
  39860. '-fullname'
  39861. '-f'
  39862. Emacs sets this option when it runs GDB as a subprocess. It tells
  39863. GDB to output the full file name and line number in a standard,
  39864. recognizable fashion each time a stack frame is displayed (which
  39865. includes each time the program stops). This recognizable format
  39866. looks like two '\032' characters, followed by the file name, line
  39867. number and character position separated by colons, and a newline.
  39868. The Emacs-to-GDB interface program uses the two '\032' characters
  39869. as a signal to display the source code for the frame.
  39870. '-b BPS'
  39871. Set the line speed (baud rate or bits per second) of any serial
  39872. interface used by GDB for remote debugging.
  39873. '-tty=DEVICE'
  39874. Run using DEVICE for your program's standard input and output.
  39875. 
  39876. File: gdb.info, Node: gdbserver man, Next: gcore man, Prev: gdb man, Up: Man Pages
  39877. gdbserver man
  39878. =============
  39879. gdbserver COMM PROG [ARGS...]
  39880. gdbserver -attach COMM PID
  39881. gdbserver -multi COMM
  39882. 'gdbserver' is a program that allows you to run GDB on a different
  39883. machine than the one which is running the program being debugged.
  39884. Usage (server (target) side)
  39885. ----------------------------
  39886. First, you need to have a copy of the program you want to debug put onto
  39887. the target system. The program can be stripped to save space if needed,
  39888. as 'gdbserver' doesn't care about symbols. All symbol handling is taken
  39889. care of by the GDB running on the host system.
  39890. To use the server, you log on to the target system, and run the
  39891. 'gdbserver' program. You must tell it (a) how to communicate with GDB,
  39892. (b) the name of your program, and (c) its arguments. The general syntax
  39893. is:
  39894. target> gdbserver COMM PROGRAM [ARGS ...]
  39895. For example, using a serial port, you might say:
  39896. target> gdbserver /dev/com1 emacs foo.txt
  39897. This tells 'gdbserver' to debug emacs with an argument of foo.txt,
  39898. and to communicate with GDB via '/dev/com1'. 'gdbserver' now waits
  39899. patiently for the host GDB to communicate with it.
  39900. To use a TCP connection, you could say:
  39901. target> gdbserver host:2345 emacs foo.txt
  39902. This says pretty much the same thing as the last example, except that
  39903. we are going to communicate with the 'host' GDB via TCP. The 'host:2345'
  39904. argument means that we are expecting to see a TCP connection from 'host'
  39905. to local TCP port 2345. (Currently, the 'host' part is ignored.) You
  39906. can choose any number you want for the port number as long as it does
  39907. not conflict with any existing TCP ports on the target system. This
  39908. same port number must be used in the host GDBs 'target remote' command,
  39909. which will be described shortly. Note that if you chose a port number
  39910. that conflicts with another service, 'gdbserver' will print an error
  39911. message and exit.
  39912. 'gdbserver' can also attach to running programs. This is
  39913. accomplished via the '--attach' argument. The syntax is:
  39914. target> gdbserver --attach COMM PID
  39915. PID is the process ID of a currently running process. It isn't
  39916. necessary to point 'gdbserver' at a binary for the running process.
  39917. To start 'gdbserver' without supplying an initial command to run or
  39918. process ID to attach, use the '--multi' command line option. In such
  39919. case you should connect using 'target extended-remote' to start the
  39920. program you want to debug.
  39921. target> gdbserver --multi COMM
  39922. Usage (host side)
  39923. -----------------
  39924. You need an unstripped copy of the target program on your host system,
  39925. since GDB needs to examine its symbol tables and such. Start up GDB as
  39926. you normally would, with the target program as the first argument. (You
  39927. may need to use the '--baud' option if the serial line is running at
  39928. anything except 9600 baud.) That is 'gdb TARGET-PROG', or 'gdb --baud
  39929. BAUD TARGET-PROG'. After that, the only new command you need to know
  39930. about is 'target remote' (or 'target extended-remote'). Its argument is
  39931. either a device name (usually a serial device, like '/dev/ttyb'), or a
  39932. 'HOST:PORT' descriptor. For example:
  39933. (gdb) target remote /dev/ttyb
  39934. communicates with the server via serial line '/dev/ttyb', and:
  39935. (gdb) target remote the-target:2345
  39936. communicates via a TCP connection to port 2345 on host 'the-target',
  39937. where you previously started up 'gdbserver' with the same port number.
  39938. Note that for TCP connections, you must start up 'gdbserver' prior to
  39939. using the 'target remote' command, otherwise you may get an error that
  39940. looks something like 'Connection refused'.
  39941. 'gdbserver' can also debug multiple inferiors at once, described in
  39942. *note Inferiors Connections and Programs::. In such case use the
  39943. 'extended-remote' GDB command variant:
  39944. (gdb) target extended-remote the-target:2345
  39945. The 'gdbserver' option '--multi' may or may not be used in such case.
  39946. There are three different modes for invoking 'gdbserver':
  39947. * Debug a specific program specified by its program name:
  39948. gdbserver COMM PROG [ARGS...]
  39949. The COMM parameter specifies how should the server communicate with
  39950. GDB; it is either a device name (to use a serial line), a TCP port
  39951. number (':1234'), or '-' or 'stdio' to use stdin/stdout of
  39952. 'gdbserver'. Specify the name of the program to debug in PROG.
  39953. Any remaining arguments will be passed to the program verbatim.
  39954. When the program exits, GDB will close the connection, and
  39955. 'gdbserver' will exit.
  39956. * Debug a specific program by specifying the process ID of a running
  39957. program:
  39958. gdbserver --attach COMM PID
  39959. The COMM parameter is as described above. Supply the process ID of
  39960. a running program in PID; GDB will do everything else. Like with
  39961. the previous mode, when the process PID exits, GDB will close the
  39962. connection, and 'gdbserver' will exit.
  39963. * Multi-process mode - debug more than one program/process:
  39964. gdbserver --multi COMM
  39965. In this mode, GDB can instruct 'gdbserver' which command(s) to run.
  39966. Unlike the other 2 modes, GDB will not close the connection when a
  39967. process being debugged exits, so you can debug several processes in
  39968. the same session.
  39969. In each of the modes you may specify these options:
  39970. '--help'
  39971. List all options, with brief explanations.
  39972. '--version'
  39973. This option causes 'gdbserver' to print its version number and
  39974. exit.
  39975. '--attach'
  39976. 'gdbserver' will attach to a running program. The syntax is:
  39977. target> gdbserver --attach COMM PID
  39978. PID is the process ID of a currently running process. It isn't
  39979. necessary to point 'gdbserver' at a binary for the running process.
  39980. '--multi'
  39981. To start 'gdbserver' without supplying an initial command to run or
  39982. process ID to attach, use this command line option. Then you can
  39983. connect using 'target extended-remote' and start the program you
  39984. want to debug. The syntax is:
  39985. target> gdbserver --multi COMM
  39986. '--debug'
  39987. Instruct 'gdbserver' to display extra status information about the
  39988. debugging process. This option is intended for 'gdbserver'
  39989. development and for bug reports to the developers.
  39990. '--remote-debug'
  39991. Instruct 'gdbserver' to display remote protocol debug output. This
  39992. option is intended for 'gdbserver' development and for bug reports
  39993. to the developers.
  39994. '--debug-file=FILENAME'
  39995. Instruct 'gdbserver' to send any debug output to the given
  39996. FILENAME. This option is intended for 'gdbserver' development and
  39997. for bug reports to the developers.
  39998. '--debug-format=option1[,option2,...]'
  39999. Instruct 'gdbserver' to include extra information in each line of
  40000. debugging output. *Note Other Command-Line Arguments for
  40001. gdbserver::.
  40002. '--wrapper'
  40003. Specify a wrapper to launch programs for debugging. The option
  40004. should be followed by the name of the wrapper, then any
  40005. command-line arguments to pass to the wrapper, then '--' indicating
  40006. the end of the wrapper arguments.
  40007. '--once'
  40008. By default, 'gdbserver' keeps the listening TCP port open, so that
  40009. additional connections are possible. However, if you start
  40010. 'gdbserver' with the '--once' option, it will stop listening for
  40011. any further connection attempts after connecting to the first GDB
  40012. session.
  40013. 
  40014. File: gdb.info, Node: gcore man, Next: gdbinit man, Prev: gdbserver man, Up: Man Pages
  40015. gcore
  40016. =====
  40017. gcore [-a] [-o PREFIX] PID1 [PID2...PIDN]
  40018. Generate core dumps of one or more running programs with process IDs
  40019. PID1, PID2, etc. A core file produced by 'gcore' is equivalent to one
  40020. produced by the kernel when the process crashes (and when 'ulimit -c'
  40021. was used to set up an appropriate core dump limit). However, unlike
  40022. after a crash, after 'gcore' finishes its job the program remains
  40023. running without any change.
  40024. '-a'
  40025. Dump all memory mappings. The actual effect of this option depends
  40026. on the Operating System. On GNU/Linux, it will disable
  40027. 'use-coredump-filter' (*note set use-coredump-filter::) and enable
  40028. 'dump-excluded-mappings' (*note set dump-excluded-mappings::).
  40029. '-o PREFIX'
  40030. The optional argument PREFIX specifies the prefix to be used when
  40031. composing the file names of the core dumps. The file name is
  40032. composed as 'PREFIX.PID', where PID is the process ID of the
  40033. running program being analyzed by 'gcore'. If not specified,
  40034. PREFIX defaults to GCORE.
  40035. 
  40036. File: gdb.info, Node: gdbinit man, Next: gdb-add-index man, Prev: gcore man, Up: Man Pages
  40037. gdbinit
  40038. =======
  40039. /tmp/jenkins-GCC-10-pipeline-48_20201124_1606180639/install-native/x86_64-apple-darwin10/arm-none-eabi/lib/gdbinit
  40040. ~/.gdbinit
  40041. ./.gdbinit
  40042. These files contain GDB commands to automatically execute during GDB
  40043. startup. The lines of contents are canned sequences of commands,
  40044. described in *note Sequences::.
  40045. Please read more in *note Startup::.
  40046. '/tmp/jenkins-GCC-10-pipeline-48_20201124_1606180639/install-native/x86_64-apple-darwin10/arm-none-eabi/lib/gdbinit'
  40047. System-wide initialization file. It is executed unless user
  40048. specified GDB option '-nx' or '-n'. See more in
  40049. '(not enabled with --with-system-gdbinit-dir during compilation)'
  40050. System-wide initialization directory. All files in this directory
  40051. are executed on startup unless user specified GDB option '-nx' or
  40052. '-n', as long as they have a recognized file extension. See more
  40053. in *note System-wide configuration::.
  40054. '~/.gdbinit'
  40055. User initialization file. It is executed unless user specified GDB
  40056. options '-nx', '-n' or '-nh'.
  40057. './.gdbinit'
  40058. Initialization file for current directory. It may need to be
  40059. enabled with GDB security command 'set auto-load local-gdbinit'.
  40060. See more in *note Init File in the Current Directory::.
  40061. 
  40062. File: gdb.info, Node: gdb-add-index man, Prev: gdbinit man, Up: Man Pages
  40063. gdb-add-index
  40064. =============
  40065. gdb-add-index FILENAME
  40066. When GDB finds a symbol file, it scans the symbols in the file in
  40067. order to construct an internal symbol table. This lets most GDB
  40068. operations work quickly-at the cost of a delay early on. For large
  40069. programs, this delay can be quite lengthy, so GDB provides a way to
  40070. build an index, which speeds up startup.
  40071. To determine whether a file contains such an index, use the command
  40072. 'readelf -S filename': the index is stored in a section named
  40073. '.gdb_index'. The index file can only be produced on systems which use
  40074. ELF binaries and DWARF debug information (i.e., sections named
  40075. '.debug_*').
  40076. 'gdb-add-index' uses GDB and 'objdump' found in the 'PATH'
  40077. environment variable. If you want to use different versions of these
  40078. programs, you can specify them through the 'GDB' and 'OBJDUMP'
  40079. environment variables.
  40080. See more in *note Index Files::.
  40081. 
  40082. File: gdb.info, Node: Copying, Next: GNU Free Documentation License, Prev: Man Pages, Up: Top
  40083. Appendix L GNU GENERAL PUBLIC LICENSE
  40084. *************************************
  40085. Version 3, 29 June 2007
  40086. Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
  40087. Everyone is permitted to copy and distribute verbatim copies of this
  40088. license document, but changing it is not allowed.
  40089. Preamble
  40090. ========
  40091. The GNU General Public License is a free, copyleft license for software
  40092. and other kinds of works.
  40093. The licenses for most software and other practical works are designed
  40094. to take away your freedom to share and change the works. By contrast,
  40095. the GNU General Public License is intended to guarantee your freedom to
  40096. share and change all versions of a program--to make sure it remains free
  40097. software for all its users. We, the Free Software Foundation, use the
  40098. GNU General Public License for most of our software; it applies also to
  40099. any other work released this way by its authors. You can apply it to
  40100. your programs, too.
  40101. When we speak of free software, we are referring to freedom, not
  40102. price. Our General Public Licenses are designed to make sure that you
  40103. have the freedom to distribute copies of free software (and charge for
  40104. them if you wish), that you receive source code or can get it if you
  40105. want it, that you can change the software or use pieces of it in new
  40106. free programs, and that you know you can do these things.
  40107. To protect your rights, we need to prevent others from denying you
  40108. these rights or asking you to surrender the rights. Therefore, you have
  40109. certain responsibilities if you distribute copies of the software, or if
  40110. you modify it: responsibilities to respect the freedom of others.
  40111. For example, if you distribute copies of such a program, whether
  40112. gratis or for a fee, you must pass on to the recipients the same
  40113. freedoms that you received. You must make sure that they, too, receive
  40114. or can get the source code. And you must show them these terms so they
  40115. know their rights.
  40116. Developers that use the GNU GPL protect your rights with two steps:
  40117. (1) assert copyright on the software, and (2) offer you this License
  40118. giving you legal permission to copy, distribute and/or modify it.
  40119. For the developers' and authors' protection, the GPL clearly explains
  40120. that there is no warranty for this free software. For both users' and
  40121. authors' sake, the GPL requires that modified versions be marked as
  40122. changed, so that their problems will not be attributed erroneously to
  40123. authors of previous versions.
  40124. Some devices are designed to deny users access to install or run
  40125. modified versions of the software inside them, although the manufacturer
  40126. can do so. This is fundamentally incompatible with the aim of
  40127. protecting users' freedom to change the software. The systematic
  40128. pattern of such abuse occurs in the area of products for individuals to
  40129. use, which is precisely where it is most unacceptable. Therefore, we
  40130. have designed this version of the GPL to prohibit the practice for those
  40131. products. If such problems arise substantially in other domains, we
  40132. stand ready to extend this provision to those domains in future versions
  40133. of the GPL, as needed to protect the freedom of users.
  40134. Finally, every program is threatened constantly by software patents.
  40135. States should not allow patents to restrict development and use of
  40136. software on general-purpose computers, but in those that do, we wish to
  40137. avoid the special danger that patents applied to a free program could
  40138. make it effectively proprietary. To prevent this, the GPL assures that
  40139. patents cannot be used to render the program non-free.
  40140. The precise terms and conditions for copying, distribution and
  40141. modification follow.
  40142. TERMS AND CONDITIONS
  40143. ====================
  40144. 0. Definitions.
  40145. "This License" refers to version 3 of the GNU General Public
  40146. License.
  40147. "Copyright" also means copyright-like laws that apply to other
  40148. kinds of works, such as semiconductor masks.
  40149. "The Program" refers to any copyrightable work licensed under this
  40150. License. Each licensee is addressed as "you". "Licensees" and
  40151. "recipients" may be individuals or organizations.
  40152. To "modify" a work means to copy from or adapt all or part of the
  40153. work in a fashion requiring copyright permission, other than the
  40154. making of an exact copy. The resulting work is called a "modified
  40155. version" of the earlier work or a work "based on" the earlier work.
  40156. A "covered work" means either the unmodified Program or a work
  40157. based on the Program.
  40158. To "propagate" a work means to do anything with it that, without
  40159. permission, would make you directly or secondarily liable for
  40160. infringement under applicable copyright law, except executing it on
  40161. a computer or modifying a private copy. Propagation includes
  40162. copying, distribution (with or without modification), making
  40163. available to the public, and in some countries other activities as
  40164. well.
  40165. To "convey" a work means any kind of propagation that enables other
  40166. parties to make or receive copies. Mere interaction with a user
  40167. through a computer network, with no transfer of a copy, is not
  40168. conveying.
  40169. An interactive user interface displays "Appropriate Legal Notices"
  40170. to the extent that it includes a convenient and prominently visible
  40171. feature that (1) displays an appropriate copyright notice, and (2)
  40172. tells the user that there is no warranty for the work (except to
  40173. the extent that warranties are provided), that licensees may convey
  40174. the work under this License, and how to view a copy of this
  40175. License. If the interface presents a list of user commands or
  40176. options, such as a menu, a prominent item in the list meets this
  40177. criterion.
  40178. 1. Source Code.
  40179. The "source code" for a work means the preferred form of the work
  40180. for making modifications to it. "Object code" means any non-source
  40181. form of a work.
  40182. A "Standard Interface" means an interface that either is an
  40183. official standard defined by a recognized standards body, or, in
  40184. the case of interfaces specified for a particular programming
  40185. language, one that is widely used among developers working in that
  40186. language.
  40187. The "System Libraries" of an executable work include anything,
  40188. other than the work as a whole, that (a) is included in the normal
  40189. form of packaging a Major Component, but which is not part of that
  40190. Major Component, and (b) serves only to enable use of the work with
  40191. that Major Component, or to implement a Standard Interface for
  40192. which an implementation is available to the public in source code
  40193. form. A "Major Component", in this context, means a major
  40194. essential component (kernel, window system, and so on) of the
  40195. specific operating system (if any) on which the executable work
  40196. runs, or a compiler used to produce the work, or an object code
  40197. interpreter used to run it.
  40198. The "Corresponding Source" for a work in object code form means all
  40199. the source code needed to generate, install, and (for an executable
  40200. work) run the object code and to modify the work, including scripts
  40201. to control those activities. However, it does not include the
  40202. work's System Libraries, or general-purpose tools or generally
  40203. available free programs which are used unmodified in performing
  40204. those activities but which are not part of the work. For example,
  40205. Corresponding Source includes interface definition files associated
  40206. with source files for the work, and the source code for shared
  40207. libraries and dynamically linked subprograms that the work is
  40208. specifically designed to require, such as by intimate data
  40209. communication or control flow between those subprograms and other
  40210. parts of the work.
  40211. The Corresponding Source need not include anything that users can
  40212. regenerate automatically from other parts of the Corresponding
  40213. Source.
  40214. The Corresponding Source for a work in source code form is that
  40215. same work.
  40216. 2. Basic Permissions.
  40217. All rights granted under this License are granted for the term of
  40218. copyright on the Program, and are irrevocable provided the stated
  40219. conditions are met. This License explicitly affirms your unlimited
  40220. permission to run the unmodified Program. The output from running
  40221. a covered work is covered by this License only if the output, given
  40222. its content, constitutes a covered work. This License acknowledges
  40223. your rights of fair use or other equivalent, as provided by
  40224. copyright law.
  40225. You may make, run and propagate covered works that you do not
  40226. convey, without conditions so long as your license otherwise
  40227. remains in force. You may convey covered works to others for the
  40228. sole purpose of having them make modifications exclusively for you,
  40229. or provide you with facilities for running those works, provided
  40230. that you comply with the terms of this License in conveying all
  40231. material for which you do not control copyright. Those thus making
  40232. or running the covered works for you must do so exclusively on your
  40233. behalf, under your direction and control, on terms that prohibit
  40234. them from making any copies of your copyrighted material outside
  40235. their relationship with you.
  40236. Conveying under any other circumstances is permitted solely under
  40237. the conditions stated below. Sublicensing is not allowed; section
  40238. 10 makes it unnecessary.
  40239. 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
  40240. No covered work shall be deemed part of an effective technological
  40241. measure under any applicable law fulfilling obligations under
  40242. article 11 of the WIPO copyright treaty adopted on 20 December
  40243. 1996, or similar laws prohibiting or restricting circumvention of
  40244. such measures.
  40245. When you convey a covered work, you waive any legal power to forbid
  40246. circumvention of technological measures to the extent such
  40247. circumvention is effected by exercising rights under this License
  40248. with respect to the covered work, and you disclaim any intention to
  40249. limit operation or modification of the work as a means of
  40250. enforcing, against the work's users, your or third parties' legal
  40251. rights to forbid circumvention of technological measures.
  40252. 4. Conveying Verbatim Copies.
  40253. You may convey verbatim copies of the Program's source code as you
  40254. receive it, in any medium, provided that you conspicuously and
  40255. appropriately publish on each copy an appropriate copyright notice;
  40256. keep intact all notices stating that this License and any
  40257. non-permissive terms added in accord with section 7 apply to the
  40258. code; keep intact all notices of the absence of any warranty; and
  40259. give all recipients a copy of this License along with the Program.
  40260. You may charge any price or no price for each copy that you convey,
  40261. and you may offer support or warranty protection for a fee.
  40262. 5. Conveying Modified Source Versions.
  40263. You may convey a work based on the Program, or the modifications to
  40264. produce it from the Program, in the form of source code under the
  40265. terms of section 4, provided that you also meet all of these
  40266. conditions:
  40267. a. The work must carry prominent notices stating that you
  40268. modified it, and giving a relevant date.
  40269. b. The work must carry prominent notices stating that it is
  40270. released under this License and any conditions added under
  40271. section 7. This requirement modifies the requirement in
  40272. section 4 to "keep intact all notices".
  40273. c. You must license the entire work, as a whole, under this
  40274. License to anyone who comes into possession of a copy. This
  40275. License will therefore apply, along with any applicable
  40276. section 7 additional terms, to the whole of the work, and all
  40277. its parts, regardless of how they are packaged. This License
  40278. gives no permission to license the work in any other way, but
  40279. it does not invalidate such permission if you have separately
  40280. received it.
  40281. d. If the work has interactive user interfaces, each must display
  40282. Appropriate Legal Notices; however, if the Program has
  40283. interactive interfaces that do not display Appropriate Legal
  40284. Notices, your work need not make them do so.
  40285. A compilation of a covered work with other separate and independent
  40286. works, which are not by their nature extensions of the covered
  40287. work, and which are not combined with it such as to form a larger
  40288. program, in or on a volume of a storage or distribution medium, is
  40289. called an "aggregate" if the compilation and its resulting
  40290. copyright are not used to limit the access or legal rights of the
  40291. compilation's users beyond what the individual works permit.
  40292. Inclusion of a covered work in an aggregate does not cause this
  40293. License to apply to the other parts of the aggregate.
  40294. 6. Conveying Non-Source Forms.
  40295. You may convey a covered work in object code form under the terms
  40296. of sections 4 and 5, provided that you also convey the
  40297. machine-readable Corresponding Source under the terms of this
  40298. License, in one of these ways:
  40299. a. Convey the object code in, or embodied in, a physical product
  40300. (including a physical distribution medium), accompanied by the
  40301. Corresponding Source fixed on a durable physical medium
  40302. customarily used for software interchange.
  40303. b. Convey the object code in, or embodied in, a physical product
  40304. (including a physical distribution medium), accompanied by a
  40305. written offer, valid for at least three years and valid for as
  40306. long as you offer spare parts or customer support for that
  40307. product model, to give anyone who possesses the object code
  40308. either (1) a copy of the Corresponding Source for all the
  40309. software in the product that is covered by this License, on a
  40310. durable physical medium customarily used for software
  40311. interchange, for a price no more than your reasonable cost of
  40312. physically performing this conveying of source, or (2) access
  40313. to copy the Corresponding Source from a network server at no
  40314. charge.
  40315. c. Convey individual copies of the object code with a copy of the
  40316. written offer to provide the Corresponding Source. This
  40317. alternative is allowed only occasionally and noncommercially,
  40318. and only if you received the object code with such an offer,
  40319. in accord with subsection 6b.
  40320. d. Convey the object code by offering access from a designated
  40321. place (gratis or for a charge), and offer equivalent access to
  40322. the Corresponding Source in the same way through the same
  40323. place at no further charge. You need not require recipients
  40324. to copy the Corresponding Source along with the object code.
  40325. If the place to copy the object code is a network server, the
  40326. Corresponding Source may be on a different server (operated by
  40327. you or a third party) that supports equivalent copying
  40328. facilities, provided you maintain clear directions next to the
  40329. object code saying where to find the Corresponding Source.
  40330. Regardless of what server hosts the Corresponding Source, you
  40331. remain obligated to ensure that it is available for as long as
  40332. needed to satisfy these requirements.
  40333. e. Convey the object code using peer-to-peer transmission,
  40334. provided you inform other peers where the object code and
  40335. Corresponding Source of the work are being offered to the
  40336. general public at no charge under subsection 6d.
  40337. A separable portion of the object code, whose source code is
  40338. excluded from the Corresponding Source as a System Library, need
  40339. not be included in conveying the object code work.
  40340. A "User Product" is either (1) a "consumer product", which means
  40341. any tangible personal property which is normally used for personal,
  40342. family, or household purposes, or (2) anything designed or sold for
  40343. incorporation into a dwelling. In determining whether a product is
  40344. a consumer product, doubtful cases shall be resolved in favor of
  40345. coverage. For a particular product received by a particular user,
  40346. "normally used" refers to a typical or common use of that class of
  40347. product, regardless of the status of the particular user or of the
  40348. way in which the particular user actually uses, or expects or is
  40349. expected to use, the product. A product is a consumer product
  40350. regardless of whether the product has substantial commercial,
  40351. industrial or non-consumer uses, unless such uses represent the
  40352. only significant mode of use of the product.
  40353. "Installation Information" for a User Product means any methods,
  40354. procedures, authorization keys, or other information required to
  40355. install and execute modified versions of a covered work in that
  40356. User Product from a modified version of its Corresponding Source.
  40357. The information must suffice to ensure that the continued
  40358. functioning of the modified object code is in no case prevented or
  40359. interfered with solely because modification has been made.
  40360. If you convey an object code work under this section in, or with,
  40361. or specifically for use in, a User Product, and the conveying
  40362. occurs as part of a transaction in which the right of possession
  40363. and use of the User Product is transferred to the recipient in
  40364. perpetuity or for a fixed term (regardless of how the transaction
  40365. is characterized), the Corresponding Source conveyed under this
  40366. section must be accompanied by the Installation Information. But
  40367. this requirement does not apply if neither you nor any third party
  40368. retains the ability to install modified object code on the User
  40369. Product (for example, the work has been installed in ROM).
  40370. The requirement to provide Installation Information does not
  40371. include a requirement to continue to provide support service,
  40372. warranty, or updates for a work that has been modified or installed
  40373. by the recipient, or for the User Product in which it has been
  40374. modified or installed. Access to a network may be denied when the
  40375. modification itself materially and adversely affects the operation
  40376. of the network or violates the rules and protocols for
  40377. communication across the network.
  40378. Corresponding Source conveyed, and Installation Information
  40379. provided, in accord with this section must be in a format that is
  40380. publicly documented (and with an implementation available to the
  40381. public in source code form), and must require no special password
  40382. or key for unpacking, reading or copying.
  40383. 7. Additional Terms.
  40384. "Additional permissions" are terms that supplement the terms of
  40385. this License by making exceptions from one or more of its
  40386. conditions. Additional permissions that are applicable to the
  40387. entire Program shall be treated as though they were included in
  40388. this License, to the extent that they are valid under applicable
  40389. law. If additional permissions apply only to part of the Program,
  40390. that part may be used separately under those permissions, but the
  40391. entire Program remains governed by this License without regard to
  40392. the additional permissions.
  40393. When you convey a copy of a covered work, you may at your option
  40394. remove any additional permissions from that copy, or from any part
  40395. of it. (Additional permissions may be written to require their own
  40396. removal in certain cases when you modify the work.) You may place
  40397. additional permissions on material, added by you to a covered work,
  40398. for which you have or can give appropriate copyright permission.
  40399. Notwithstanding any other provision of this License, for material
  40400. you add to a covered work, you may (if authorized by the copyright
  40401. holders of that material) supplement the terms of this License with
  40402. terms:
  40403. a. Disclaiming warranty or limiting liability differently from
  40404. the terms of sections 15 and 16 of this License; or
  40405. b. Requiring preservation of specified reasonable legal notices
  40406. or author attributions in that material or in the Appropriate
  40407. Legal Notices displayed by works containing it; or
  40408. c. Prohibiting misrepresentation of the origin of that material,
  40409. or requiring that modified versions of such material be marked
  40410. in reasonable ways as different from the original version; or
  40411. d. Limiting the use for publicity purposes of names of licensors
  40412. or authors of the material; or
  40413. e. Declining to grant rights under trademark law for use of some
  40414. trade names, trademarks, or service marks; or
  40415. f. Requiring indemnification of licensors and authors of that
  40416. material by anyone who conveys the material (or modified
  40417. versions of it) with contractual assumptions of liability to
  40418. the recipient, for any liability that these contractual
  40419. assumptions directly impose on those licensors and authors.
  40420. All other non-permissive additional terms are considered "further
  40421. restrictions" within the meaning of section 10. If the Program as
  40422. you received it, or any part of it, contains a notice stating that
  40423. it is governed by this License along with a term that is a further
  40424. restriction, you may remove that term. If a license document
  40425. contains a further restriction but permits relicensing or conveying
  40426. under this License, you may add to a covered work material governed
  40427. by the terms of that license document, provided that the further
  40428. restriction does not survive such relicensing or conveying.
  40429. If you add terms to a covered work in accord with this section, you
  40430. must place, in the relevant source files, a statement of the
  40431. additional terms that apply to those files, or a notice indicating
  40432. where to find the applicable terms.
  40433. Additional terms, permissive or non-permissive, may be stated in
  40434. the form of a separately written license, or stated as exceptions;
  40435. the above requirements apply either way.
  40436. 8. Termination.
  40437. You may not propagate or modify a covered work except as expressly
  40438. provided under this License. Any attempt otherwise to propagate or
  40439. modify it is void, and will automatically terminate your rights
  40440. under this License (including any patent licenses granted under the
  40441. third paragraph of section 11).
  40442. However, if you cease all violation of this License, then your
  40443. license from a particular copyright holder is reinstated (a)
  40444. provisionally, unless and until the copyright holder explicitly and
  40445. finally terminates your license, and (b) permanently, if the
  40446. copyright holder fails to notify you of the violation by some
  40447. reasonable means prior to 60 days after the cessation.
  40448. Moreover, your license from a particular copyright holder is
  40449. reinstated permanently if the copyright holder notifies you of the
  40450. violation by some reasonable means, this is the first time you have
  40451. received notice of violation of this License (for any work) from
  40452. that copyright holder, and you cure the violation prior to 30 days
  40453. after your receipt of the notice.
  40454. Termination of your rights under this section does not terminate
  40455. the licenses of parties who have received copies or rights from you
  40456. under this License. If your rights have been terminated and not
  40457. permanently reinstated, you do not qualify to receive new licenses
  40458. for the same material under section 10.
  40459. 9. Acceptance Not Required for Having Copies.
  40460. You are not required to accept this License in order to receive or
  40461. run a copy of the Program. Ancillary propagation of a covered work
  40462. occurring solely as a consequence of using peer-to-peer
  40463. transmission to receive a copy likewise does not require
  40464. acceptance. However, nothing other than this License grants you
  40465. permission to propagate or modify any covered work. These actions
  40466. infringe copyright if you do not accept this License. Therefore,
  40467. by modifying or propagating a covered work, you indicate your
  40468. acceptance of this License to do so.
  40469. 10. Automatic Licensing of Downstream Recipients.
  40470. Each time you convey a covered work, the recipient automatically
  40471. receives a license from the original licensors, to run, modify and
  40472. propagate that work, subject to this License. You are not
  40473. responsible for enforcing compliance by third parties with this
  40474. License.
  40475. An "entity transaction" is a transaction transferring control of an
  40476. organization, or substantially all assets of one, or subdividing an
  40477. organization, or merging organizations. If propagation of a
  40478. covered work results from an entity transaction, each party to that
  40479. transaction who receives a copy of the work also receives whatever
  40480. licenses to the work the party's predecessor in interest had or
  40481. could give under the previous paragraph, plus a right to possession
  40482. of the Corresponding Source of the work from the predecessor in
  40483. interest, if the predecessor has it or can get it with reasonable
  40484. efforts.
  40485. You may not impose any further restrictions on the exercise of the
  40486. rights granted or affirmed under this License. For example, you
  40487. may not impose a license fee, royalty, or other charge for exercise
  40488. of rights granted under this License, and you may not initiate
  40489. litigation (including a cross-claim or counterclaim in a lawsuit)
  40490. alleging that any patent claim is infringed by making, using,
  40491. selling, offering for sale, or importing the Program or any portion
  40492. of it.
  40493. 11. Patents.
  40494. A "contributor" is a copyright holder who authorizes use under this
  40495. License of the Program or a work on which the Program is based.
  40496. The work thus licensed is called the contributor's "contributor
  40497. version".
  40498. A contributor's "essential patent claims" are all patent claims
  40499. owned or controlled by the contributor, whether already acquired or
  40500. hereafter acquired, that would be infringed by some manner,
  40501. permitted by this License, of making, using, or selling its
  40502. contributor version, but do not include claims that would be
  40503. infringed only as a consequence of further modification of the
  40504. contributor version. For purposes of this definition, "control"
  40505. includes the right to grant patent sublicenses in a manner
  40506. consistent with the requirements of this License.
  40507. Each contributor grants you a non-exclusive, worldwide,
  40508. royalty-free patent license under the contributor's essential
  40509. patent claims, to make, use, sell, offer for sale, import and
  40510. otherwise run, modify and propagate the contents of its contributor
  40511. version.
  40512. In the following three paragraphs, a "patent license" is any
  40513. express agreement or commitment, however denominated, not to
  40514. enforce a patent (such as an express permission to practice a
  40515. patent or covenant not to sue for patent infringement). To "grant"
  40516. such a patent license to a party means to make such an agreement or
  40517. commitment not to enforce a patent against the party.
  40518. If you convey a covered work, knowingly relying on a patent
  40519. license, and the Corresponding Source of the work is not available
  40520. for anyone to copy, free of charge and under the terms of this
  40521. License, through a publicly available network server or other
  40522. readily accessible means, then you must either (1) cause the
  40523. Corresponding Source to be so available, or (2) arrange to deprive
  40524. yourself of the benefit of the patent license for this particular
  40525. work, or (3) arrange, in a manner consistent with the requirements
  40526. of this License, to extend the patent license to downstream
  40527. recipients. "Knowingly relying" means you have actual knowledge
  40528. that, but for the patent license, your conveying the covered work
  40529. in a country, or your recipient's use of the covered work in a
  40530. country, would infringe one or more identifiable patents in that
  40531. country that you have reason to believe are valid.
  40532. If, pursuant to or in connection with a single transaction or
  40533. arrangement, you convey, or propagate by procuring conveyance of, a
  40534. covered work, and grant a patent license to some of the parties
  40535. receiving the covered work authorizing them to use, propagate,
  40536. modify or convey a specific copy of the covered work, then the
  40537. patent license you grant is automatically extended to all
  40538. recipients of the covered work and works based on it.
  40539. A patent license is "discriminatory" if it does not include within
  40540. the scope of its coverage, prohibits the exercise of, or is
  40541. conditioned on the non-exercise of one or more of the rights that
  40542. are specifically granted under this License. You may not convey a
  40543. covered work if you are a party to an arrangement with a third
  40544. party that is in the business of distributing software, under which
  40545. you make payment to the third party based on the extent of your
  40546. activity of conveying the work, and under which the third party
  40547. grants, to any of the parties who would receive the covered work
  40548. from you, a discriminatory patent license (a) in connection with
  40549. copies of the covered work conveyed by you (or copies made from
  40550. those copies), or (b) primarily for and in connection with specific
  40551. products or compilations that contain the covered work, unless you
  40552. entered into that arrangement, or that patent license was granted,
  40553. prior to 28 March 2007.
  40554. Nothing in this License shall be construed as excluding or limiting
  40555. any implied license or other defenses to infringement that may
  40556. otherwise be available to you under applicable patent law.
  40557. 12. No Surrender of Others' Freedom.
  40558. If conditions are imposed on you (whether by court order, agreement
  40559. or otherwise) that contradict the conditions of this License, they
  40560. do not excuse you from the conditions of this License. If you
  40561. cannot convey a covered work so as to satisfy simultaneously your
  40562. obligations under this License and any other pertinent obligations,
  40563. then as a consequence you may not convey it at all. For example,
  40564. if you agree to terms that obligate you to collect a royalty for
  40565. further conveying from those to whom you convey the Program, the
  40566. only way you could satisfy both those terms and this License would
  40567. be to refrain entirely from conveying the Program.
  40568. 13. Use with the GNU Affero General Public License.
  40569. Notwithstanding any other provision of this License, you have
  40570. permission to link or combine any covered work with a work licensed
  40571. under version 3 of the GNU Affero General Public License into a
  40572. single combined work, and to convey the resulting work. The terms
  40573. of this License will continue to apply to the part which is the
  40574. covered work, but the special requirements of the GNU Affero
  40575. General Public License, section 13, concerning interaction through
  40576. a network will apply to the combination as such.
  40577. 14. Revised Versions of this License.
  40578. The Free Software Foundation may publish revised and/or new
  40579. versions of the GNU General Public License from time to time. Such
  40580. new versions will be similar in spirit to the present version, but
  40581. may differ in detail to address new problems or concerns.
  40582. Each version is given a distinguishing version number. If the
  40583. Program specifies that a certain numbered version of the GNU
  40584. General Public License "or any later version" applies to it, you
  40585. have the option of following the terms and conditions either of
  40586. that numbered version or of any later version published by the Free
  40587. Software Foundation. If the Program does not specify a version
  40588. number of the GNU General Public License, you may choose any
  40589. version ever published by the Free Software Foundation.
  40590. If the Program specifies that a proxy can decide which future
  40591. versions of the GNU General Public License can be used, that
  40592. proxy's public statement of acceptance of a version permanently
  40593. authorizes you to choose that version for the Program.
  40594. Later license versions may give you additional or different
  40595. permissions. However, no additional obligations are imposed on any
  40596. author or copyright holder as a result of your choosing to follow a
  40597. later version.
  40598. 15. Disclaimer of Warranty.
  40599. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
  40600. APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
  40601. COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS"
  40602. WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
  40603. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  40604. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE
  40605. RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.
  40606. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
  40607. NECESSARY SERVICING, REPAIR OR CORRECTION.
  40608. 16. Limitation of Liability.
  40609. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
  40610. WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES
  40611. AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
  40612. DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
  40613. CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
  40614. THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
  40615. BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
  40616. PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
  40617. PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
  40618. THE POSSIBILITY OF SUCH DAMAGES.
  40619. 17. Interpretation of Sections 15 and 16.
  40620. If the disclaimer of warranty and limitation of liability provided
  40621. above cannot be given local legal effect according to their terms,
  40622. reviewing courts shall apply local law that most closely
  40623. approximates an absolute waiver of all civil liability in
  40624. connection with the Program, unless a warranty or assumption of
  40625. liability accompanies a copy of the Program in return for a fee.
  40626. END OF TERMS AND CONDITIONS
  40627. ===========================
  40628. How to Apply These Terms to Your New Programs
  40629. =============================================
  40630. If you develop a new program, and you want it to be of the greatest
  40631. possible use to the public, the best way to achieve this is to make it
  40632. free software which everyone can redistribute and change under these
  40633. terms.
  40634. To do so, attach the following notices to the program. It is safest
  40635. to attach them to the start of each source file to most effectively
  40636. state the exclusion of warranty; and each file should have at least the
  40637. "copyright" line and a pointer to where the full notice is found.
  40638. ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
  40639. Copyright (C) YEAR NAME OF AUTHOR
  40640. This program is free software: you can redistribute it and/or modify
  40641. it under the terms of the GNU General Public License as published by
  40642. the Free Software Foundation, either version 3 of the License, or (at
  40643. your option) any later version.
  40644. This program is distributed in the hope that it will be useful, but
  40645. WITHOUT ANY WARRANTY; without even the implied warranty of
  40646. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  40647. General Public License for more details.
  40648. You should have received a copy of the GNU General Public License
  40649. along with this program. If not, see <http://www.gnu.org/licenses/>.
  40650. Also add information on how to contact you by electronic and paper
  40651. mail.
  40652. If the program does terminal interaction, make it output a short
  40653. notice like this when it starts in an interactive mode:
  40654. PROGRAM Copyright (C) YEAR NAME OF AUTHOR
  40655. This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
  40656. This is free software, and you are welcome to redistribute it
  40657. under certain conditions; type 'show c' for details.
  40658. The hypothetical commands 'show w' and 'show c' should show the
  40659. appropriate parts of the General Public License. Of course, your
  40660. program's commands might be different; for a GUI interface, you would
  40661. use an "about box".
  40662. You should also get your employer (if you work as a programmer) or
  40663. school, if any, to sign a "copyright disclaimer" for the program, if
  40664. necessary. For more information on this, and how to apply and follow
  40665. the GNU GPL, see <http://www.gnu.org/licenses/>.
  40666. The GNU General Public License does not permit incorporating your
  40667. program into proprietary programs. If your program is a subroutine
  40668. library, you may consider it more useful to permit linking proprietary
  40669. applications with the library. If this is what you want to do, use the
  40670. GNU Lesser General Public License instead of this License. But first,
  40671. please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.
  40672. 
  40673. File: gdb.info, Node: GNU Free Documentation License, Next: Concept Index, Prev: Copying, Up: Top
  40674. Appendix M GNU Free Documentation License
  40675. *****************************************
  40676. Version 1.3, 3 November 2008
  40677. Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
  40678. <http://fsf.org/>
  40679. Everyone is permitted to copy and distribute verbatim copies
  40680. of this license document, but changing it is not allowed.
  40681. 0. PREAMBLE
  40682. The purpose of this License is to make a manual, textbook, or other
  40683. functional and useful document "free" in the sense of freedom: to
  40684. assure everyone the effective freedom to copy and redistribute it,
  40685. with or without modifying it, either commercially or
  40686. noncommercially. Secondarily, this License preserves for the
  40687. author and publisher a way to get credit for their work, while not
  40688. being considered responsible for modifications made by others.
  40689. This License is a kind of "copyleft", which means that derivative
  40690. works of the document must themselves be free in the same sense.
  40691. It complements the GNU General Public License, which is a copyleft
  40692. license designed for free software.
  40693. We have designed this License in order to use it for manuals for
  40694. free software, because free software needs free documentation: a
  40695. free program should come with manuals providing the same freedoms
  40696. that the software does. But this License is not limited to
  40697. software manuals; it can be used for any textual work, regardless
  40698. of subject matter or whether it is published as a printed book. We
  40699. recommend this License principally for works whose purpose is
  40700. instruction or reference.
  40701. 1. APPLICABILITY AND DEFINITIONS
  40702. This License applies to any manual or other work, in any medium,
  40703. that contains a notice placed by the copyright holder saying it can
  40704. be distributed under the terms of this License. Such a notice
  40705. grants a world-wide, royalty-free license, unlimited in duration,
  40706. to use that work under the conditions stated herein. The
  40707. "Document", below, refers to any such manual or work. Any member
  40708. of the public is a licensee, and is addressed as "you". You accept
  40709. the license if you copy, modify or distribute the work in a way
  40710. requiring permission under copyright law.
  40711. A "Modified Version" of the Document means any work containing the
  40712. Document or a portion of it, either copied verbatim, or with
  40713. modifications and/or translated into another language.
  40714. A "Secondary Section" is a named appendix or a front-matter section
  40715. of the Document that deals exclusively with the relationship of the
  40716. publishers or authors of the Document to the Document's overall
  40717. subject (or to related matters) and contains nothing that could
  40718. fall directly within that overall subject. (Thus, if the Document
  40719. is in part a textbook of mathematics, a Secondary Section may not
  40720. explain any mathematics.) The relationship could be a matter of
  40721. historical connection with the subject or with related matters, or
  40722. of legal, commercial, philosophical, ethical or political position
  40723. regarding them.
  40724. The "Invariant Sections" are certain Secondary Sections whose
  40725. titles are designated, as being those of Invariant Sections, in the
  40726. notice that says that the Document is released under this License.
  40727. If a section does not fit the above definition of Secondary then it
  40728. is not allowed to be designated as Invariant. The Document may
  40729. contain zero Invariant Sections. If the Document does not identify
  40730. any Invariant Sections then there are none.
  40731. The "Cover Texts" are certain short passages of text that are
  40732. listed, as Front-Cover Texts or Back-Cover Texts, in the notice
  40733. that says that the Document is released under this License. A
  40734. Front-Cover Text may be at most 5 words, and a Back-Cover Text may
  40735. be at most 25 words.
  40736. A "Transparent" copy of the Document means a machine-readable copy,
  40737. represented in a format whose specification is available to the
  40738. general public, that is suitable for revising the document
  40739. straightforwardly with generic text editors or (for images composed
  40740. of pixels) generic paint programs or (for drawings) some widely
  40741. available drawing editor, and that is suitable for input to text
  40742. formatters or for automatic translation to a variety of formats
  40743. suitable for input to text formatters. A copy made in an otherwise
  40744. Transparent file format whose markup, or absence of markup, has
  40745. been arranged to thwart or discourage subsequent modification by
  40746. readers is not Transparent. An image format is not Transparent if
  40747. used for any substantial amount of text. A copy that is not
  40748. "Transparent" is called "Opaque".
  40749. Examples of suitable formats for Transparent copies include plain
  40750. ASCII without markup, Texinfo input format, LaTeX input format,
  40751. SGML or XML using a publicly available DTD, and standard-conforming
  40752. simple HTML, PostScript or PDF designed for human modification.
  40753. Examples of transparent image formats include PNG, XCF and JPG.
  40754. Opaque formats include proprietary formats that can be read and
  40755. edited only by proprietary word processors, SGML or XML for which
  40756. the DTD and/or processing tools are not generally available, and
  40757. the machine-generated HTML, PostScript or PDF produced by some word
  40758. processors for output purposes only.
  40759. The "Title Page" means, for a printed book, the title page itself,
  40760. plus such following pages as are needed to hold, legibly, the
  40761. material this License requires to appear in the title page. For
  40762. works in formats which do not have any title page as such, "Title
  40763. Page" means the text near the most prominent appearance of the
  40764. work's title, preceding the beginning of the body of the text.
  40765. The "publisher" means any person or entity that distributes copies
  40766. of the Document to the public.
  40767. A section "Entitled XYZ" means a named subunit of the Document
  40768. whose title either is precisely XYZ or contains XYZ in parentheses
  40769. following text that translates XYZ in another language. (Here XYZ
  40770. stands for a specific section name mentioned below, such as
  40771. "Acknowledgements", "Dedications", "Endorsements", or "History".)
  40772. To "Preserve the Title" of such a section when you modify the
  40773. Document means that it remains a section "Entitled XYZ" according
  40774. to this definition.
  40775. The Document may include Warranty Disclaimers next to the notice
  40776. which states that this License applies to the Document. These
  40777. Warranty Disclaimers are considered to be included by reference in
  40778. this License, but only as regards disclaiming warranties: any other
  40779. implication that these Warranty Disclaimers may have is void and
  40780. has no effect on the meaning of this License.
  40781. 2. VERBATIM COPYING
  40782. You may copy and distribute the Document in any medium, either
  40783. commercially or noncommercially, provided that this License, the
  40784. copyright notices, and the license notice saying this License
  40785. applies to the Document are reproduced in all copies, and that you
  40786. add no other conditions whatsoever to those of this License. You
  40787. may not use technical measures to obstruct or control the reading
  40788. or further copying of the copies you make or distribute. However,
  40789. you may accept compensation in exchange for copies. If you
  40790. distribute a large enough number of copies you must also follow the
  40791. conditions in section 3.
  40792. You may also lend copies, under the same conditions stated above,
  40793. and you may publicly display copies.
  40794. 3. COPYING IN QUANTITY
  40795. If you publish printed copies (or copies in media that commonly
  40796. have printed covers) of the Document, numbering more than 100, and
  40797. the Document's license notice requires Cover Texts, you must
  40798. enclose the copies in covers that carry, clearly and legibly, all
  40799. these Cover Texts: Front-Cover Texts on the front cover, and
  40800. Back-Cover Texts on the back cover. Both covers must also clearly
  40801. and legibly identify you as the publisher of these copies. The
  40802. front cover must present the full title with all words of the title
  40803. equally prominent and visible. You may add other material on the
  40804. covers in addition. Copying with changes limited to the covers, as
  40805. long as they preserve the title of the Document and satisfy these
  40806. conditions, can be treated as verbatim copying in other respects.
  40807. If the required texts for either cover are too voluminous to fit
  40808. legibly, you should put the first ones listed (as many as fit
  40809. reasonably) on the actual cover, and continue the rest onto
  40810. adjacent pages.
  40811. If you publish or distribute Opaque copies of the Document
  40812. numbering more than 100, you must either include a machine-readable
  40813. Transparent copy along with each Opaque copy, or state in or with
  40814. each Opaque copy a computer-network location from which the general
  40815. network-using public has access to download using public-standard
  40816. network protocols a complete Transparent copy of the Document, free
  40817. of added material. If you use the latter option, you must take
  40818. reasonably prudent steps, when you begin distribution of Opaque
  40819. copies in quantity, to ensure that this Transparent copy will
  40820. remain thus accessible at the stated location until at least one
  40821. year after the last time you distribute an Opaque copy (directly or
  40822. through your agents or retailers) of that edition to the public.
  40823. It is requested, but not required, that you contact the authors of
  40824. the Document well before redistributing any large number of copies,
  40825. to give them a chance to provide you with an updated version of the
  40826. Document.
  40827. 4. MODIFICATIONS
  40828. You may copy and distribute a Modified Version of the Document
  40829. under the conditions of sections 2 and 3 above, provided that you
  40830. release the Modified Version under precisely this License, with the
  40831. Modified Version filling the role of the Document, thus licensing
  40832. distribution and modification of the Modified Version to whoever
  40833. possesses a copy of it. In addition, you must do these things in
  40834. the Modified Version:
  40835. A. Use in the Title Page (and on the covers, if any) a title
  40836. distinct from that of the Document, and from those of previous
  40837. versions (which should, if there were any, be listed in the
  40838. History section of the Document). You may use the same title
  40839. as a previous version if the original publisher of that
  40840. version gives permission.
  40841. B. List on the Title Page, as authors, one or more persons or
  40842. entities responsible for authorship of the modifications in
  40843. the Modified Version, together with at least five of the
  40844. principal authors of the Document (all of its principal
  40845. authors, if it has fewer than five), unless they release you
  40846. from this requirement.
  40847. C. State on the Title page the name of the publisher of the
  40848. Modified Version, as the publisher.
  40849. D. Preserve all the copyright notices of the Document.
  40850. E. Add an appropriate copyright notice for your modifications
  40851. adjacent to the other copyright notices.
  40852. F. Include, immediately after the copyright notices, a license
  40853. notice giving the public permission to use the Modified
  40854. Version under the terms of this License, in the form shown in
  40855. the Addendum below.
  40856. G. Preserve in that license notice the full lists of Invariant
  40857. Sections and required Cover Texts given in the Document's
  40858. license notice.
  40859. H. Include an unaltered copy of this License.
  40860. I. Preserve the section Entitled "History", Preserve its Title,
  40861. and add to it an item stating at least the title, year, new
  40862. authors, and publisher of the Modified Version as given on the
  40863. Title Page. If there is no section Entitled "History" in the
  40864. Document, create one stating the title, year, authors, and
  40865. publisher of the Document as given on its Title Page, then add
  40866. an item describing the Modified Version as stated in the
  40867. previous sentence.
  40868. J. Preserve the network location, if any, given in the Document
  40869. for public access to a Transparent copy of the Document, and
  40870. likewise the network locations given in the Document for
  40871. previous versions it was based on. These may be placed in the
  40872. "History" section. You may omit a network location for a work
  40873. that was published at least four years before the Document
  40874. itself, or if the original publisher of the version it refers
  40875. to gives permission.
  40876. K. For any section Entitled "Acknowledgements" or "Dedications",
  40877. Preserve the Title of the section, and preserve in the section
  40878. all the substance and tone of each of the contributor
  40879. acknowledgements and/or dedications given therein.
  40880. L. Preserve all the Invariant Sections of the Document, unaltered
  40881. in their text and in their titles. Section numbers or the
  40882. equivalent are not considered part of the section titles.
  40883. M. Delete any section Entitled "Endorsements". Such a section
  40884. may not be included in the Modified Version.
  40885. N. Do not retitle any existing section to be Entitled
  40886. "Endorsements" or to conflict in title with any Invariant
  40887. Section.
  40888. O. Preserve any Warranty Disclaimers.
  40889. If the Modified Version includes new front-matter sections or
  40890. appendices that qualify as Secondary Sections and contain no
  40891. material copied from the Document, you may at your option designate
  40892. some or all of these sections as invariant. To do this, add their
  40893. titles to the list of Invariant Sections in the Modified Version's
  40894. license notice. These titles must be distinct from any other
  40895. section titles.
  40896. You may add a section Entitled "Endorsements", provided it contains
  40897. nothing but endorsements of your Modified Version by various
  40898. parties--for example, statements of peer review or that the text
  40899. has been approved by an organization as the authoritative
  40900. definition of a standard.
  40901. You may add a passage of up to five words as a Front-Cover Text,
  40902. and a passage of up to 25 words as a Back-Cover Text, to the end of
  40903. the list of Cover Texts in the Modified Version. Only one passage
  40904. of Front-Cover Text and one of Back-Cover Text may be added by (or
  40905. through arrangements made by) any one entity. If the Document
  40906. already includes a cover text for the same cover, previously added
  40907. by you or by arrangement made by the same entity you are acting on
  40908. behalf of, you may not add another; but you may replace the old
  40909. one, on explicit permission from the previous publisher that added
  40910. the old one.
  40911. The author(s) and publisher(s) of the Document do not by this
  40912. License give permission to use their names for publicity for or to
  40913. assert or imply endorsement of any Modified Version.
  40914. 5. COMBINING DOCUMENTS
  40915. You may combine the Document with other documents released under
  40916. this License, under the terms defined in section 4 above for
  40917. modified versions, provided that you include in the combination all
  40918. of the Invariant Sections of all of the original documents,
  40919. unmodified, and list them all as Invariant Sections of your
  40920. combined work in its license notice, and that you preserve all
  40921. their Warranty Disclaimers.
  40922. The combined work need only contain one copy of this License, and
  40923. multiple identical Invariant Sections may be replaced with a single
  40924. copy. If there are multiple Invariant Sections with the same name
  40925. but different contents, make the title of each such section unique
  40926. by adding at the end of it, in parentheses, the name of the
  40927. original author or publisher of that section if known, or else a
  40928. unique number. Make the same adjustment to the section titles in
  40929. the list of Invariant Sections in the license notice of the
  40930. combined work.
  40931. In the combination, you must combine any sections Entitled
  40932. "History" in the various original documents, forming one section
  40933. Entitled "History"; likewise combine any sections Entitled
  40934. "Acknowledgements", and any sections Entitled "Dedications". You
  40935. must delete all sections Entitled "Endorsements."
  40936. 6. COLLECTIONS OF DOCUMENTS
  40937. You may make a collection consisting of the Document and other
  40938. documents released under this License, and replace the individual
  40939. copies of this License in the various documents with a single copy
  40940. that is included in the collection, provided that you follow the
  40941. rules of this License for verbatim copying of each of the documents
  40942. in all other respects.
  40943. You may extract a single document from such a collection, and
  40944. distribute it individually under this License, provided you insert
  40945. a copy of this License into the extracted document, and follow this
  40946. License in all other respects regarding verbatim copying of that
  40947. document.
  40948. 7. AGGREGATION WITH INDEPENDENT WORKS
  40949. A compilation of the Document or its derivatives with other
  40950. separate and independent documents or works, in or on a volume of a
  40951. storage or distribution medium, is called an "aggregate" if the
  40952. copyright resulting from the compilation is not used to limit the
  40953. legal rights of the compilation's users beyond what the individual
  40954. works permit. When the Document is included in an aggregate, this
  40955. License does not apply to the other works in the aggregate which
  40956. are not themselves derivative works of the Document.
  40957. If the Cover Text requirement of section 3 is applicable to these
  40958. copies of the Document, then if the Document is less than one half
  40959. of the entire aggregate, the Document's Cover Texts may be placed
  40960. on covers that bracket the Document within the aggregate, or the
  40961. electronic equivalent of covers if the Document is in electronic
  40962. form. Otherwise they must appear on printed covers that bracket
  40963. the whole aggregate.
  40964. 8. TRANSLATION
  40965. Translation is considered a kind of modification, so you may
  40966. distribute translations of the Document under the terms of section
  40967. 4. Replacing Invariant Sections with translations requires special
  40968. permission from their copyright holders, but you may include
  40969. translations of some or all Invariant Sections in addition to the
  40970. original versions of these Invariant Sections. You may include a
  40971. translation of this License, and all the license notices in the
  40972. Document, and any Warranty Disclaimers, provided that you also
  40973. include the original English version of this License and the
  40974. original versions of those notices and disclaimers. In case of a
  40975. disagreement between the translation and the original version of
  40976. this License or a notice or disclaimer, the original version will
  40977. prevail.
  40978. If a section in the Document is Entitled "Acknowledgements",
  40979. "Dedications", or "History", the requirement (section 4) to
  40980. Preserve its Title (section 1) will typically require changing the
  40981. actual title.
  40982. 9. TERMINATION
  40983. You may not copy, modify, sublicense, or distribute the Document
  40984. except as expressly provided under this License. Any attempt
  40985. otherwise to copy, modify, sublicense, or distribute it is void,
  40986. and will automatically terminate your rights under this License.
  40987. However, if you cease all violation of this License, then your
  40988. license from a particular copyright holder is reinstated (a)
  40989. provisionally, unless and until the copyright holder explicitly and
  40990. finally terminates your license, and (b) permanently, if the
  40991. copyright holder fails to notify you of the violation by some
  40992. reasonable means prior to 60 days after the cessation.
  40993. Moreover, your license from a particular copyright holder is
  40994. reinstated permanently if the copyright holder notifies you of the
  40995. violation by some reasonable means, this is the first time you have
  40996. received notice of violation of this License (for any work) from
  40997. that copyright holder, and you cure the violation prior to 30 days
  40998. after your receipt of the notice.
  40999. Termination of your rights under this section does not terminate
  41000. the licenses of parties who have received copies or rights from you
  41001. under this License. If your rights have been terminated and not
  41002. permanently reinstated, receipt of a copy of some or all of the
  41003. same material does not give you any rights to use it.
  41004. 10. FUTURE REVISIONS OF THIS LICENSE
  41005. The Free Software Foundation may publish new, revised versions of
  41006. the GNU Free Documentation License from time to time. Such new
  41007. versions will be similar in spirit to the present version, but may
  41008. differ in detail to address new problems or concerns. See
  41009. <http://www.gnu.org/copyleft/>.
  41010. Each version of the License is given a distinguishing version
  41011. number. If the Document specifies that a particular numbered
  41012. version of this License "or any later version" applies to it, you
  41013. have the option of following the terms and conditions either of
  41014. that specified version or of any later version that has been
  41015. published (not as a draft) by the Free Software Foundation. If the
  41016. Document does not specify a version number of this License, you may
  41017. choose any version ever published (not as a draft) by the Free
  41018. Software Foundation. If the Document specifies that a proxy can
  41019. decide which future versions of this License can be used, that
  41020. proxy's public statement of acceptance of a version permanently
  41021. authorizes you to choose that version for the Document.
  41022. 11. RELICENSING
  41023. "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
  41024. World Wide Web server that publishes copyrightable works and also
  41025. provides prominent facilities for anybody to edit those works. A
  41026. public wiki that anybody can edit is an example of such a server.
  41027. A "Massive Multiauthor Collaboration" (or "MMC") contained in the
  41028. site means any set of copyrightable works thus published on the MMC
  41029. site.
  41030. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
  41031. license published by Creative Commons Corporation, a not-for-profit
  41032. corporation with a principal place of business in San Francisco,
  41033. California, as well as future copyleft versions of that license
  41034. published by that same organization.
  41035. "Incorporate" means to publish or republish a Document, in whole or
  41036. in part, as part of another Document.
  41037. An MMC is "eligible for relicensing" if it is licensed under this
  41038. License, and if all works that were first published under this
  41039. License somewhere other than this MMC, and subsequently
  41040. incorporated in whole or in part into the MMC, (1) had no cover
  41041. texts or invariant sections, and (2) were thus incorporated prior
  41042. to November 1, 2008.
  41043. The operator of an MMC Site may republish an MMC contained in the
  41044. site under CC-BY-SA on the same site at any time before August 1,
  41045. 2009, provided the MMC is eligible for relicensing.
  41046. ADDENDUM: How to use this License for your documents
  41047. ====================================================
  41048. To use this License in a document you have written, include a copy of
  41049. the License in the document and put the following copyright and license
  41050. notices just after the title page:
  41051. Copyright (C) YEAR YOUR NAME.
  41052. Permission is granted to copy, distribute and/or modify this document
  41053. under the terms of the GNU Free Documentation License, Version 1.3
  41054. or any later version published by the Free Software Foundation;
  41055. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  41056. Texts. A copy of the license is included in the section entitled ``GNU
  41057. Free Documentation License''.
  41058. If you have Invariant Sections, Front-Cover Texts and Back-Cover
  41059. Texts, replace the "with...Texts." line with this:
  41060. with the Invariant Sections being LIST THEIR TITLES, with
  41061. the Front-Cover Texts being LIST, and with the Back-Cover Texts
  41062. being LIST.
  41063. If you have Invariant Sections without Cover Texts, or some other
  41064. combination of the three, merge those two alternatives to suit the
  41065. situation.
  41066. If your document contains nontrivial examples of program code, we
  41067. recommend releasing these examples in parallel under your choice of free
  41068. software license, such as the GNU General Public License, to permit
  41069. their use in free software.
  41070. 
  41071. File: gdb.info, Node: Concept Index, Next: Command and Variable Index, Prev: GNU Free Documentation License, Up: Top
  41072. Concept Index
  41073. *************
  41074. �[index�]
  41075. * Menu:
  41076. * ! packet: Packets. (line 49)
  41077. * "No symbol "foo" in current context": Variables. (line 122)
  41078. * # in Modula-2: GDB/M2. (line 18)
  41079. * $: Value History. (line 13)
  41080. * $$: Value History. (line 13)
  41081. * $_ and info breakpoints: Set Breaks. (line 133)
  41082. * $_ and info line: Machine Code. (line 34)
  41083. * $_, $__, and value history: Memory. (line 119)
  41084. * &, background execution of commands: Background Execution.
  41085. (line 16)
  41086. * --annotate: Mode Options. (line 132)
  41087. * --args: Mode Options. (line 145)
  41088. * --attach, gdbserver option: Server. (line 86)
  41089. * --batch: Mode Options. (line 55)
  41090. * --batch-silent: Mode Options. (line 73)
  41091. * --baud: Mode Options. (line 151)
  41092. * --cd: Mode Options. (line 112)
  41093. * --command: File Options. (line 51)
  41094. * --configuration: Mode Options. (line 195)
  41095. * --core: File Options. (line 43)
  41096. * --data-directory: Mode Options. (line 117)
  41097. * --debug, gdbserver option: Server. (line 146)
  41098. * --debug-file, gdbserver option: Server. (line 148)
  41099. * --debug-format, gdbserver option: Server. (line 153)
  41100. * --directory: File Options. (line 77)
  41101. * --eval-command: File Options. (line 57)
  41102. * --exec: File Options. (line 35)
  41103. * --fullname: Mode Options. (line 122)
  41104. * --init-command: File Options. (line 67)
  41105. * --init-eval-command: File Options. (line 72)
  41106. * --interpreter: Mode Options. (line 170)
  41107. * --multi, gdbserver option: Connecting. (line 45)
  41108. * --nh: Mode Options. (line 45)
  41109. * --nowindows: Mode Options. (line 102)
  41110. * --nx: Mode Options. (line 11)
  41111. * --once, gdbserver option: Server. (line 126)
  41112. * --pid: File Options. (line 47)
  41113. * --quiet: Mode Options. (line 51)
  41114. * --readnever, command-line option: File Options. (line 87)
  41115. * --readnow: File Options. (line 81)
  41116. * --remote-debug, gdbserver option: Server. (line 147)
  41117. * --return-child-result: Mode Options. (line 85)
  41118. * --se: File Options. (line 39)
  41119. * --selftest: Server. (line 187)
  41120. * --silent: Mode Options. (line 51)
  41121. * --statistics: Mode Options. (line 187)
  41122. * --symbols: File Options. (line 31)
  41123. * --tty: Mode Options. (line 160)
  41124. * --tui: Mode Options. (line 163)
  41125. * --version: Mode Options. (line 191)
  41126. * --windows: Mode Options. (line 108)
  41127. * --with-gdb-datadir: Data Files. (line 19)
  41128. * --with-relocated-sources: Source Path. (line 149)
  41129. * --with-sysroot: Files. (line 453)
  41130. * --wrapper, gdbserver option: Server. (line 166)
  41131. * --write: Mode Options. (line 182)
  41132. * -b: Mode Options. (line 151)
  41133. * -c: File Options. (line 43)
  41134. * -d: File Options. (line 77)
  41135. * -D: Mode Options. (line 117)
  41136. * -e: File Options. (line 35)
  41137. * -ex: File Options. (line 57)
  41138. * -f: Mode Options. (line 122)
  41139. * -iex: File Options. (line 72)
  41140. * -info-gdb-mi-command: GDB/MI Support Commands.
  41141. (line 14)
  41142. * -ix: File Options. (line 67)
  41143. * -l: Mode Options. (line 155)
  41144. * -n: Mode Options. (line 11)
  41145. * -nw: Mode Options. (line 102)
  41146. * -p: File Options. (line 47)
  41147. * -q: Mode Options. (line 51)
  41148. * -r: File Options. (line 81)
  41149. * -readnever, option for symbol-file command: Files. (line 101)
  41150. * -s: File Options. (line 31)
  41151. * -t: Mode Options. (line 160)
  41152. * -w: Mode Options. (line 108)
  41153. * -x: File Options. (line 51)
  41154. * ., Modula-2 scope operator: M2 Scope. (line 6)
  41155. * .build-id directory: Separate Debug Files.
  41156. (line 6)
  41157. * .debug subdirectories: Separate Debug Files.
  41158. (line 6)
  41159. * .debug_gdb_scripts section: dotdebug_gdb_scripts section.
  41160. (line 6)
  41161. * .gdbinit: Startup. (line 69)
  41162. * .gdb_index section: Index Files. (line 6)
  41163. * .gdb_index section format: Index Section Format.
  41164. (line 6)
  41165. * .gnu_debugdata section: MiniDebugInfo. (line 6)
  41166. * .gnu_debuglink sections: Separate Debug Files.
  41167. (line 79)
  41168. * .note.gnu.build-id sections: Separate Debug Files.
  41169. (line 95)
  41170. * .o files, reading symbols from: Files. (line 146)
  41171. * /proc: Process Information.
  41172. (line 6)
  41173. * <architecture>: Target Description Format.
  41174. (line 72)
  41175. * <compatible>: Target Description Format.
  41176. (line 95)
  41177. * <feature>: Target Description Format.
  41178. (line 119)
  41179. * <flags>: Target Description Format.
  41180. (line 163)
  41181. * <not saved> values: Registers. (line 106)
  41182. * <osabi>: Target Description Format.
  41183. (line 82)
  41184. * <reg>: Target Description Format.
  41185. (line 222)
  41186. * <struct>: Target Description Format.
  41187. (line 163)
  41188. * <union>: Target Description Format.
  41189. (line 153)
  41190. * <vector>: Target Description Format.
  41191. (line 146)
  41192. * ? packet: Packets. (line 58)
  41193. * _NSPrintForDebugger, and printing Objective-C objects: The Print Command with Objective-C.
  41194. (line 11)
  41195. * {TYPE}: Expressions. (line 41)
  41196. * A packet: Packets. (line 65)
  41197. * AArch64 Pointer Authentication.: AArch64. (line 34)
  41198. * AArch64 support: AArch64. (line 6)
  41199. * AArch64 SVE.: AArch64. (line 19)
  41200. * abbreviation: Command Syntax. (line 13)
  41201. * acknowledgment, for GDB remote: Packet Acknowledgment.
  41202. (line 6)
  41203. * active targets: Active Targets. (line 6)
  41204. * Ada: Ada. (line 6)
  41205. * Ada exception catching: Set Catchpoints. (line 66)
  41206. * Ada exception handlers catching: Set Catchpoints. (line 92)
  41207. * Ada mode, general: Ada Mode Intro. (line 6)
  41208. * Ada settings: Ada Settings. (line 6)
  41209. * Ada task switching: Ada Tasks. (line 115)
  41210. * Ada tasking and core file debugging: Ada Tasks and Core Files.
  41211. (line 6)
  41212. * Ada, deviations from: Additions to Ada. (line 6)
  41213. * Ada, omissions from: Omissions from Ada. (line 6)
  41214. * Ada, problems: Ada Glitches. (line 6)
  41215. * Ada, tasking: Ada Tasks. (line 6)
  41216. * add new commands for external monitor: Connecting. (line 279)
  41217. * address locations: Address Locations. (line 6)
  41218. * address of a symbol: Symbols. (line 85)
  41219. * address size for remote targets: Remote Configuration.
  41220. (line 12)
  41221. * addressable memory unit: Memory. (line 133)
  41222. * aggregates (Ada): Omissions from Ada. (line 44)
  41223. * AIX shared library debugging: Debugging Output. (line 30)
  41224. * AIX threads: Debugging Output. (line 36)
  41225. * aliases for commands: Aliases. (line 6)
  41226. * alignment of remote memory accesses: Packets. (line 247)
  41227. * all-stop mode: All-Stop Mode. (line 6)
  41228. * Alpha stack: MIPS. (line 6)
  41229. * ambiguous expressions: Ambiguous Expressions.
  41230. (line 6)
  41231. * annotations: Annotations Overview.
  41232. (line 6)
  41233. * annotations for errors, warnings and interrupts: Errors. (line 6)
  41234. * annotations for invalidation messages: Invalidation. (line 6)
  41235. * annotations for prompts: Prompting. (line 6)
  41236. * annotations for running programs: Annotations for Running.
  41237. (line 6)
  41238. * annotations for source display: Source Annotations. (line 6)
  41239. * append data to a file: Dump/Restore Files. (line 6)
  41240. * Application Data Integrity: Sparc64. (line 5)
  41241. * apply a command to all frames (ignoring errors and empty output): Frame Apply.
  41242. (line 96)
  41243. * apply a command to all frames of all threads (ignoring errors and empty output): Threads.
  41244. (line 229)
  41245. * apply command to all threads (ignoring errors and empty output): Threads.
  41246. (line 222)
  41247. * apply command to several frames: Frame Apply. (line 6)
  41248. * apply command to several threads: Threads. (line 187)
  41249. * ARC EM: ARC. (line 6)
  41250. * ARC HS: ARC. (line 6)
  41251. * ARC specific commands: ARC. (line 6)
  41252. * ARC600: ARC. (line 6)
  41253. * ARC700: ARC. (line 6)
  41254. * architecture debugging info: Debugging Output. (line 23)
  41255. * argument count in user-defined commands: Define. (line 25)
  41256. * arguments (to your program): Arguments. (line 6)
  41257. * arguments, to gdbserver: Server. (line 34)
  41258. * arguments, to user-defined commands: Define. (line 6)
  41259. * ARM 32-bit mode: ARM. (line 16)
  41260. * ARM AArch64: Debugging Output. (line 17)
  41261. * array aggregates (Ada): Omissions from Ada. (line 44)
  41262. * arrays: Arrays. (line 6)
  41263. * arrays in expressions: Expressions. (line 13)
  41264. * artificial array: Arrays. (line 6)
  41265. * assembly instructions: Machine Code. (line 43)
  41266. * assignment: Assignment. (line 6)
  41267. * async output in GDB/MI: GDB/MI Output Syntax.
  41268. (line 98)
  41269. * async records in GDB/MI: GDB/MI Async Records.
  41270. (line 6)
  41271. * asynchronous execution: Background Execution.
  41272. (line 6)
  41273. * asynchronous execution, and process record and replay: Process Record and Replay.
  41274. (line 101)
  41275. * AT&T disassembly flavor: Machine Code. (line 237)
  41276. * attach: Attach. (line 6)
  41277. * attach to a program, gdbserver: Server. (line 86)
  41278. * auto-loading: Auto-loading. (line 6)
  41279. * auto-loading extensions: Auto-loading extensions.
  41280. (line 6)
  41281. * auto-loading init file in the current directory: Init File in the Current Directory.
  41282. (line 6)
  41283. * auto-loading libthread_db.so.1: libthread_db.so.1 file.
  41284. (line 6)
  41285. * auto-loading safe-path: Auto-loading safe path.
  41286. (line 6)
  41287. * auto-loading verbose mode: Auto-loading verbose mode.
  41288. (line 6)
  41289. * auto-retry, for remote TCP target: Remote Configuration.
  41290. (line 131)
  41291. * automatic display: Auto Display. (line 6)
  41292. * automatic hardware breakpoints: Set Breaks. (line 296)
  41293. * automatic overlay debugging: Automatic Overlay Debugging.
  41294. (line 6)
  41295. * automatic symbol index cache: Index Files. (line 73)
  41296. * automatic thread selection: All-Stop Mode. (line 28)
  41297. * auxiliary vector: OS Information. (line 9)
  41298. * AVR: AVR. (line 6)
  41299. * b packet: Packets. (line 76)
  41300. * B packet: Packets. (line 91)
  41301. * background execution: Background Execution.
  41302. (line 6)
  41303. * backtrace beyond main function: Backtrace. (line 155)
  41304. * backtrace limit: Backtrace. (line 192)
  41305. * base name differences: Files. (line 520)
  41306. * baud rate for remote targets: Remote Configuration.
  41307. (line 21)
  41308. * bc packet: Packets. (line 96)
  41309. * bcache statistics: Maintenance Commands.
  41310. (line 342)
  41311. * bits in remote address: Remote Configuration.
  41312. (line 12)
  41313. * blocks in guile: Blocks In Guile. (line 6)
  41314. * blocks in python: Blocks In Python. (line 6)
  41315. * bookmark: Checkpoint/Restart. (line 6)
  41316. * boundary violations, Intel MPX: Signals. (line 197)
  41317. * branch trace configuration format: Branch Trace Configuration Format.
  41318. (line 6)
  41319. * branch trace format: Branch Trace Format.
  41320. (line 6)
  41321. * branch trace store: Process Record and Replay.
  41322. (line 70)
  41323. * break in overloaded functions: Debugging C Plus Plus.
  41324. (line 9)
  41325. * break on a system call.: Set Catchpoints. (line 120)
  41326. * break on fork/exec: Set Catchpoints. (line 116)
  41327. * BREAK signal instead of Ctrl-C: Remote Configuration.
  41328. (line 36)
  41329. * breakpoint address adjusted: Breakpoint-related Warnings.
  41330. (line 6)
  41331. * breakpoint at static probe point: Linespec Locations. (line 65)
  41332. * breakpoint commands: Break Commands. (line 6)
  41333. * breakpoint commands for GDB/MI: GDB/MI Breakpoint Commands.
  41334. (line 6)
  41335. * breakpoint commands, in remote protocol: General Query Packets.
  41336. (line 983)
  41337. * breakpoint conditions: Conditions. (line 6)
  41338. * breakpoint kinds, ARM: ARM Breakpoint Kinds.
  41339. (line 6)
  41340. * breakpoint kinds, MIPS: MIPS Breakpoint Kinds.
  41341. (line 6)
  41342. * breakpoint lists: Breakpoints. (line 45)
  41343. * breakpoint numbers: Breakpoints. (line 38)
  41344. * breakpoint on events: Breakpoints. (line 30)
  41345. * breakpoint on memory address: Breakpoints. (line 17)
  41346. * breakpoint on variable modification: Breakpoints. (line 17)
  41347. * breakpoint ranges: Breakpoints. (line 45)
  41348. * breakpoint subroutine, remote: Stub Contents. (line 31)
  41349. * breakpointing Ada elaboration code: Stopping Before Main Program.
  41350. (line 6)
  41351. * breakpoints: Breakpoints. (line 6)
  41352. * breakpoints and tasks, in Ada: Ada Tasks. (line 135)
  41353. * breakpoints and threads: Thread-Specific Breakpoints.
  41354. (line 10)
  41355. * breakpoints at functions matching a regexp: Set Breaks. (line 90)
  41356. * breakpoints in guile: Breakpoints In Guile.
  41357. (line 6)
  41358. * breakpoints in overlays: Overlay Commands. (line 91)
  41359. * breakpoints in python: Breakpoints In Python.
  41360. (line 6)
  41361. * breakpoints, multiple locations: Set Breaks. (line 200)
  41362. * bs packet: Packets. (line 102)
  41363. * bug criteria: Bug Criteria. (line 6)
  41364. * bug reports: Bug Reporting. (line 6)
  41365. * bugs in GDB: GDB Bugs. (line 6)
  41366. * build ID sections: Separate Debug Files.
  41367. (line 95)
  41368. * build ID, and separate debugging files: Separate Debug Files.
  41369. (line 6)
  41370. * building GDB, requirements for: Requirements. (line 6)
  41371. * built-in simulator target: Target Commands. (line 73)
  41372. * builtin Go functions: Go. (line 31)
  41373. * builtin Go types: Go. (line 28)
  41374. * C and C++: C. (line 6)
  41375. * C and C++ checks: C Checks. (line 6)
  41376. * C and C++ constants: C Constants. (line 6)
  41377. * C and C++ defaults: C Defaults. (line 6)
  41378. * C and C++ operators: C Operators. (line 6)
  41379. * c packet: Packets. (line 109)
  41380. * C packet: Packets. (line 118)
  41381. * C++: C. (line 10)
  41382. * C++ compilers: C Plus Plus Expressions.
  41383. (line 8)
  41384. * C++ demangling: Debugging C Plus Plus.
  41385. (line 36)
  41386. * C++ exception handling: Debugging C Plus Plus.
  41387. (line 20)
  41388. * C++ overload debugging info: Debugging Output. (line 147)
  41389. * C++ scope resolution: Variables. (line 90)
  41390. * C++ symbol decoding style: Print Settings. (line 529)
  41391. * C++ symbol display: Debugging C Plus Plus.
  41392. (line 40)
  41393. * caching data of targets: Caching Target Data.
  41394. (line 6)
  41395. * caching of bfd objects: File Caching. (line 6)
  41396. * caching of opened files: File Caching. (line 6)
  41397. * call dummy stack unwinding: Calling. (line 36)
  41398. * call dummy stack unwinding on unhandled exception.: Calling.
  41399. (line 47)
  41400. * call overloaded functions: C Plus Plus Expressions.
  41401. (line 26)
  41402. * call stack: Stack. (line 9)
  41403. * call stack traces: Backtrace. (line 6)
  41404. * call-clobbered registers: Registers. (line 106)
  41405. * caller-saved registers: Registers. (line 106)
  41406. * calling functions: Calling. (line 6)
  41407. * calling functions in the program, disabling: Calling. (line 59)
  41408. * calling make: Shell Commands. (line 22)
  41409. * case sensitivity in symbol names: Symbols. (line 27)
  41410. * case-insensitive symbol names: Symbols. (line 27)
  41411. * casts, in expressions: Expressions. (line 26)
  41412. * casts, to view memory: Expressions. (line 41)
  41413. * catch Ada exceptions: Set Catchpoints. (line 66)
  41414. * catch Ada exceptions when handled: Set Catchpoints. (line 92)
  41415. * catch syscalls from inferior, remote request: General Query Packets.
  41416. (line 401)
  41417. * catchpoints: Breakpoints. (line 30)
  41418. * catchpoints, setting: Set Catchpoints. (line 6)
  41419. * change GDB's working directory: Working Directory. (line 32)
  41420. * change inferior's working directory: Working Directory. (line 13)
  41421. * character sets: Character Sets. (line 6)
  41422. * charset: Character Sets. (line 6)
  41423. * checkpoint: Checkpoint/Restart. (line 6)
  41424. * checkpoints and process id: Checkpoint/Restart. (line 76)
  41425. * checks, range: Type Checking. (line 44)
  41426. * checks, type: Checks. (line 23)
  41427. * checksum, for GDB remote: Overview. (line 21)
  41428. * choosing target byte order: Byte Order. (line 6)
  41429. * circular trace buffer: Starting and Stopping Trace Experiments.
  41430. (line 80)
  41431. * clearing breakpoints, watchpoints, catchpoints: Delete Breaks.
  41432. (line 6)
  41433. * close, file-i/o system call: close. (line 6)
  41434. * closest symbol and offset for an address: Symbols. (line 95)
  41435. * code address and its source line: Machine Code. (line 28)
  41436. * code compression, MIPS: MIPS. (line 49)
  41437. * COFF/PE exported symbols: Debugging Output. (line 50)
  41438. * collected data discarded: Starting and Stopping Trace Experiments.
  41439. (line 6)
  41440. * colon, doubled as scope operator: M2 Scope. (line 6)
  41441. * colon-colon, context for variables/functions: Variables. (line 44)
  41442. * colors: Output Styling. (line 6)
  41443. * command editing: Readline Bare Essentials.
  41444. (line 6)
  41445. * command files: Command Files. (line 6)
  41446. * command history: Command History. (line 6)
  41447. * command hooks: Hooks. (line 6)
  41448. * command interpreters: Interpreters. (line 6)
  41449. * command line editing: Editing. (line 6)
  41450. * command options: Command Options. (line 6)
  41451. * command options, boolean: Command Options. (line 21)
  41452. * command options, raw input: Command Options. (line 13)
  41453. * command scripts, debugging: Messages/Warnings. (line 65)
  41454. * command tracing: Messages/Warnings. (line 60)
  41455. * commands for C++: Debugging C Plus Plus.
  41456. (line 6)
  41457. * commands in guile: Commands In Guile. (line 6)
  41458. * commands in python: Commands In Python. (line 6)
  41459. * commands to access guile: Guile Commands. (line 6)
  41460. * commands to access python: Python Commands. (line 6)
  41461. * comment: Command Syntax. (line 37)
  41462. * COMMON blocks, Fortran: Special Fortran Commands.
  41463. (line 9)
  41464. * common targets: Target Commands. (line 46)
  41465. * compatibility, GDB/MI and CLI: GDB/MI Compatibility with CLI.
  41466. (line 6)
  41467. * compilation directory: Source Path. (line 40)
  41468. * compile C++ type conversion: Compiling and Injecting Code.
  41469. (line 90)
  41470. * compile command debugging info: Compiling and Injecting Code.
  41471. (line 82)
  41472. * compile command driver filename override: Compiling and Injecting Code.
  41473. (line 300)
  41474. * compile command options override: Compiling and Injecting Code.
  41475. (line 125)
  41476. * compiling code: Compiling and Injecting Code.
  41477. (line 6)
  41478. * completion: Completion. (line 6)
  41479. * completion of Guile commands: Commands In Guile. (line 100)
  41480. * completion of Python commands: Commands In Python. (line 70)
  41481. * completion of quoted strings: Completion. (line 83)
  41482. * completion of structure field names: Completion. (line 135)
  41483. * completion of union field names: Completion. (line 135)
  41484. * compressed debug sections: Requirements. (line 110)
  41485. * conditional breakpoints: Conditions. (line 6)
  41486. * conditional tracepoints: Tracepoint Conditions.
  41487. (line 6)
  41488. * configuring GDB: Running Configure. (line 6)
  41489. * confirmation: Messages/Warnings. (line 49)
  41490. * connection timeout, for remote TCP target: Remote Configuration.
  41491. (line 147)
  41492. * console i/o as part of file-i/o: Console I/O. (line 6)
  41493. * console interpreter: Interpreters. (line 21)
  41494. * console output in GDB/MI: GDB/MI Output Syntax.
  41495. (line 106)
  41496. * constants, in file-i/o protocol: Constants. (line 6)
  41497. * continuing: Continuing and Stepping.
  41498. (line 6)
  41499. * continuing threads: Thread Stops. (line 6)
  41500. * control C, and remote debugging: Bootstrapping. (line 25)
  41501. * controlling terminal: Input/Output. (line 23)
  41502. * convenience functions: Convenience Funs. (line 6)
  41503. * convenience functions in python: Functions In Python.
  41504. (line 6)
  41505. * convenience variables: Convenience Vars. (line 6)
  41506. * convenience variables for tracepoints: Tracepoint Variables.
  41507. (line 6)
  41508. * convenience variables, and trace state variables: Trace State Variables.
  41509. (line 17)
  41510. * convenience variables, initializing: Convenience Vars. (line 42)
  41511. * core dump file: Files. (line 6)
  41512. * core dump file target: Target Commands. (line 54)
  41513. * crash of debugger: Bug Criteria. (line 9)
  41514. * CRC algorithm definition: Separate Debug Files.
  41515. (line 140)
  41516. * CRC of memory block, remote request: General Query Packets.
  41517. (line 65)
  41518. * CRIS: CRIS. (line 6)
  41519. * CRIS mode: CRIS. (line 26)
  41520. * CRIS version: CRIS. (line 10)
  41521. * Ctrl-BREAK, MS-Windows: Cygwin Native. (line 9)
  41522. * ctrl-c message, in file-i/o protocol: The Ctrl-C Message. (line 6)
  41523. * current Ada task ID: Ada Tasks. (line 105)
  41524. * current directory: Source Path. (line 40)
  41525. * current Go package: Go. (line 11)
  41526. * current thread: Threads. (line 29)
  41527. * current thread, remote request: General Query Packets.
  41528. (line 55)
  41529. * custom JIT debug info: Custom Debug Info. (line 6)
  41530. * Cygwin DLL, debugging: Cygwin Native. (line 60)
  41531. * Cygwin-specific commands: Cygwin Native. (line 6)
  41532. * D: D. (line 6)
  41533. * d packet: Packets. (line 127)
  41534. * D packet: Packets. (line 134)
  41535. * Darwin: Darwin. (line 6)
  41536. * data breakpoints: Breakpoints. (line 17)
  41537. * data manipulation, in GDB/MI: GDB/MI Data Manipulation.
  41538. (line 6)
  41539. * dcache line-size: Caching Target Data.
  41540. (line 60)
  41541. * dcache size: Caching Target Data.
  41542. (line 57)
  41543. * dead names, GNU Hurd: Hurd Native. (line 84)
  41544. * debug expression parser: Debugging Output. (line 152)
  41545. * debug formats and C++: C Plus Plus Expressions.
  41546. (line 8)
  41547. * debug link sections: Separate Debug Files.
  41548. (line 79)
  41549. * debug remote protocol: Debugging Output. (line 159)
  41550. * debugger crash: Bug Criteria. (line 9)
  41551. * debugging agent: In-Process Agent. (line 6)
  41552. * debugging C++ programs: C Plus Plus Expressions.
  41553. (line 8)
  41554. * debugging information directory, global: Separate Debug Files.
  41555. (line 6)
  41556. * debugging information in separate files: Separate Debug Files.
  41557. (line 6)
  41558. * debugging libthread_db: Threads. (line 331)
  41559. * debugging multiple processes: Forks. (line 55)
  41560. * debugging optimized code: Optimized Code. (line 6)
  41561. * debugging stub, example: Remote Stub. (line 6)
  41562. * debugging target: Targets. (line 6)
  41563. * debugging the Cygwin DLL: Cygwin Native. (line 60)
  41564. * decimal floating point format: Decimal Floating Point.
  41565. (line 6)
  41566. * default behavior of commands, changing: Command Settings. (line 6)
  41567. * default collection action: Tracepoint Actions. (line 142)
  41568. * default data directory: Data Files. (line 19)
  41569. * default settings, changing: Command Settings. (line 6)
  41570. * default source path substitution: Source Path. (line 149)
  41571. * default system root: Files. (line 453)
  41572. * define trace state variable, remote request: Tracepoint Packets.
  41573. (line 121)
  41574. * defining macros interactively: Macros. (line 59)
  41575. * definition of a macro, showing: Macros. (line 47)
  41576. * delete breakpoints: Delete Breaks. (line 41)
  41577. * deleting breakpoints, watchpoints, catchpoints: Delete Breaks.
  41578. (line 6)
  41579. * deliver a signal to a program: Signaling. (line 6)
  41580. * demangle: Symbols. (line 114)
  41581. * demangler crashes: Maintenance Commands.
  41582. (line 146)
  41583. * demangler crashes <1>: Maintenance Commands.
  41584. (line 173)
  41585. * demangler crashes <2>: Maintenance Commands.
  41586. (line 197)
  41587. * demangling C++ names: Print Settings. (line 510)
  41588. * deprecated commands: Maintenance Commands.
  41589. (line 160)
  41590. * derived type of an object, printing: Print Settings. (line 541)
  41591. * descriptor tables display: DJGPP Native. (line 24)
  41592. * detach from task, GNU Hurd: Hurd Native. (line 59)
  41593. * detach from thread, GNU Hurd: Hurd Native. (line 109)
  41594. * direct memory access (DMA) on MS-DOS: DJGPP Native. (line 74)
  41595. * directories for source files: Source Path. (line 6)
  41596. * directory, compilation: Source Path. (line 40)
  41597. * directory, current: Source Path. (line 40)
  41598. * disable address space randomization, remote request: General Query Packets.
  41599. (line 84)
  41600. * disabling calling functions in the program: Calling. (line 59)
  41601. * disassembler options: Machine Code. (line 222)
  41602. * disconnected tracing: Starting and Stopping Trace Experiments.
  41603. (line 45)
  41604. * displaced stepping debugging info: Debugging Output. (line 75)
  41605. * displaced stepping support: Maintenance Commands.
  41606. (line 112)
  41607. * displaced stepping, and process record and replay: Process Record and Replay.
  41608. (line 96)
  41609. * display command history: Command History. (line 110)
  41610. * display derived types: Print Settings. (line 541)
  41611. * display disabled out of scope: Auto Display. (line 86)
  41612. * display GDB copyright: Help. (line 167)
  41613. * display of expressions: Auto Display. (line 6)
  41614. * display remote monitor communications: Target Commands. (line 107)
  41615. * display remote packets: Debugging Output. (line 159)
  41616. * DJGPP debugging: DJGPP Native. (line 6)
  41617. * DLLs with no debugging symbols: Non-debug DLL Symbols.
  41618. (line 6)
  41619. * do not print frame arguments: Print Settings. (line 154)
  41620. * documentation: Formatting Documentation.
  41621. (line 22)
  41622. * don't repeat command: Define. (line 111)
  41623. * don't repeat Guile command: Commands In Guile. (line 67)
  41624. * don't repeat Python command: Commands In Python. (line 42)
  41625. * DOS file-name semantics of file names.: Files. (line 476)
  41626. * DOS serial data link, remote debugging: DJGPP Native. (line 118)
  41627. * DOS serial port status: DJGPP Native. (line 139)
  41628. * DPMI: DJGPP Native. (line 6)
  41629. * dprintf: Dynamic Printf. (line 6)
  41630. * dump all data collected at tracepoint: tdump. (line 6)
  41631. * dump core from inferior: Core File Generation.
  41632. (line 6)
  41633. * dump data to a file: Dump/Restore Files. (line 6)
  41634. * dump/restore files: Dump/Restore Files. (line 6)
  41635. * DVC register: PowerPC Embedded. (line 6)
  41636. * DWARF compilation units cache: Maintenance Commands.
  41637. (line 408)
  41638. * DWARF DIEs: Debugging Output. (line 56)
  41639. * DWARF frame unwinders: Maintenance Commands.
  41640. (line 422)
  41641. * DWARF Line Tables: Debugging Output. (line 61)
  41642. * DWARF Reading: Debugging Output. (line 68)
  41643. * DWARF-2 CFI and CRIS: CRIS. (line 18)
  41644. * dynamic linking: Files. (line 123)
  41645. * dynamic printf: Dynamic Printf. (line 6)
  41646. * dynamic varobj: GDB/MI Variable Objects.
  41647. (line 166)
  41648. * editing: Editing. (line 15)
  41649. * editing command lines: Readline Bare Essentials.
  41650. (line 6)
  41651. * editing source files: Edit. (line 6)
  41652. * eight-bit characters in strings: Print Settings. (line 455)
  41653. * elaboration phase: Starting. (line 92)
  41654. * ELinOS system-wide configuration script: System-wide Configuration Scripts.
  41655. (line 15)
  41656. * Emacs: Emacs. (line 6)
  41657. * empty response, for unsupported packets: Overview. (line 97)
  41658. * enable/disable a breakpoint: Disabling. (line 6)
  41659. * enabling and disabling probes: Static Probe Points.
  41660. (line 52)
  41661. * entering numbers: Numbers. (line 6)
  41662. * environment (of your program): Environment. (line 6)
  41663. * errno values, in file-i/o protocol: Errno Values. (line 6)
  41664. * error on valid input: Bug Criteria. (line 12)
  41665. * event debugging info: Debugging Output. (line 81)
  41666. * event designators: Event Designators. (line 6)
  41667. * event handling: Set Catchpoints. (line 6)
  41668. * examine process image: Process Information.
  41669. (line 6)
  41670. * examining data: Data. (line 6)
  41671. * examining memory: Memory. (line 9)
  41672. * exception handlers: Set Catchpoints. (line 6)
  41673. * exceptions, guile: Guile Exception Handling.
  41674. (line 6)
  41675. * exceptions, python: Exception Handling. (line 6)
  41676. * exec events, remote reply: Stop Reply Packets. (line 141)
  41677. * executable file: Files. (line 16)
  41678. * executable file target: Target Commands. (line 50)
  41679. * executable file, for remote target: Remote Configuration.
  41680. (line 102)
  41681. * execute commands from a file: Command Files. (line 17)
  41682. * execute forward or backward in time: Reverse Execution. (line 92)
  41683. * execute remote command, remote request: General Query Packets.
  41684. (line 536)
  41685. * execution, foreground, background and asynchronous: Background Execution.
  41686. (line 6)
  41687. * exit status of shell commands: Convenience Vars. (line 188)
  41688. * exiting GDB: Quitting GDB. (line 6)
  41689. * expand macro once: Macros. (line 38)
  41690. * expanding preprocessor macros: Macros. (line 29)
  41691. * explicit locations: Explicit Locations. (line 6)
  41692. * explore type: Data. (line 234)
  41693. * explore value: Data. (line 227)
  41694. * exploring hierarchical data structures: Data. (line 125)
  41695. * expression debugging info: Debugging Output. (line 86)
  41696. * expression parser, debugging info: Debugging Output. (line 152)
  41697. * expressions: Expressions. (line 6)
  41698. * expressions in Ada: Ada. (line 11)
  41699. * expressions in C or C++: C. (line 6)
  41700. * expressions in C++: C Plus Plus Expressions.
  41701. (line 6)
  41702. * expressions in Modula-2: Modula-2. (line 12)
  41703. * extend GDB for remote targets: Connecting. (line 279)
  41704. * extending GDB: Extending GDB. (line 6)
  41705. * extra signal information: Signals. (line 156)
  41706. * F packet: Packets. (line 150)
  41707. * F reply packet: The F Reply Packet. (line 6)
  41708. * F request packet: The F Request Packet.
  41709. (line 6)
  41710. * fast tracepoints: Set Tracepoints. (line 24)
  41711. * fast tracepoints, setting: Create and Delete Tracepoints.
  41712. (line 50)
  41713. * fatal signal: Bug Criteria. (line 9)
  41714. * fatal signals: Signals. (line 15)
  41715. * features of the remote protocol: General Query Packets.
  41716. (line 589)
  41717. * file name canonicalization: Files. (line 520)
  41718. * file transfer: File Transfer. (line 6)
  41719. * file transfer, remote protocol: Host I/O Packets. (line 6)
  41720. * file-i/o examples: File-I/O Examples. (line 6)
  41721. * file-i/o overview: File-I/O Overview. (line 6)
  41722. * File-I/O remote protocol extension: File-I/O Remote Protocol Extension.
  41723. (line 6)
  41724. * file-i/o reply packet: The F Reply Packet. (line 6)
  41725. * file-i/o request packet: The F Request Packet.
  41726. (line 6)
  41727. * filename-display: Backtrace. (line 202)
  41728. * find trace snapshot: tfind. (line 6)
  41729. * flinching: Messages/Warnings. (line 49)
  41730. * float promotion: ABI. (line 34)
  41731. * floating point: Floating Point Hardware.
  41732. (line 6)
  41733. * floating point registers: Registers. (line 15)
  41734. * floating point, MIPS remote: MIPS Embedded. (line 13)
  41735. * focus of debugging: Threads. (line 29)
  41736. * foo: Symbol Errors. (line 54)
  41737. * foreground execution: Background Execution.
  41738. (line 6)
  41739. * fork events, remote reply: Stop Reply Packets. (line 104)
  41740. * fork, debugging programs which call: Forks. (line 6)
  41741. * format options: Print Settings. (line 6)
  41742. * formatted output: Output Formats. (line 6)
  41743. * Fortran: Summary. (line 40)
  41744. * Fortran Defaults: Fortran Defaults. (line 6)
  41745. * Fortran modules, information about: Symbols. (line 555)
  41746. * Fortran operators and expressions: Fortran Operators. (line 6)
  41747. * Fortran-specific support in GDB: Fortran. (line 6)
  41748. * FR-V shared-library debugging: Debugging Output. (line 193)
  41749. * frame debugging info: Debugging Output. (line 101)
  41750. * frame decorator api: Frame Decorator API.
  41751. (line 6)
  41752. * frame filters api: Frame Filter API. (line 6)
  41753. * frame information, printing: Print Settings. (line 314)
  41754. * frame level: Frames. (line 28)
  41755. * frame number: Frames. (line 28)
  41756. * frame pointer: Frames. (line 21)
  41757. * frame pointer register: Registers. (line 31)
  41758. * frame, definition: Frames. (line 6)
  41759. * frameless execution: Frames. (line 34)
  41760. * frames in guile: Frames In Guile. (line 6)
  41761. * frames in python: Frames In Python. (line 6)
  41762. * free memory information (MS-DOS): DJGPP Native. (line 19)
  41763. * FreeBSD: FreeBSD. (line 6)
  41764. * FreeBSD LWP debug messages: Debugging Output. (line 92)
  41765. * FreeBSD native target debug messages: Debugging Output. (line 97)
  41766. * fstat, file-i/o system call: stat/fstat. (line 6)
  41767. * Fujitsu: Remote Stub. (line 68)
  41768. * full symbol tables, listing GDB's internal: Symbols. (line 645)
  41769. * function call arguments, optimized out: Backtrace. (line 133)
  41770. * function entry/exit, wrong values of variables: Variables. (line 106)
  41771. * functions and variables by Fortran module: Symbols. (line 555)
  41772. * functions without line info, and stepping: Continuing and Stepping.
  41773. (line 92)
  41774. * g packet: Packets. (line 155)
  41775. * G packet: Packets. (line 183)
  41776. * g++, GNU C++ compiler: C. (line 10)
  41777. * garbled pointers: DJGPP Native. (line 42)
  41778. * GCC and C++: C Plus Plus Expressions.
  41779. (line 8)
  41780. * GDB bugs, reporting: Bug Reporting. (line 6)
  41781. * GDB internal error: Maintenance Commands.
  41782. (line 197)
  41783. * gdb module: Basic Python. (line 28)
  41784. * gdb objects: GDB Scheme Data Types.
  41785. (line 6)
  41786. * GDB reference card: Formatting Documentation.
  41787. (line 6)
  41788. * GDB startup: Startup. (line 6)
  41789. * GDB version number: Help. (line 157)
  41790. * gdb.ini: Startup. (line 69)
  41791. * gdb.printing: gdb.printing. (line 6)
  41792. * gdb.prompt: gdb.prompt. (line 6)
  41793. * gdb.types: gdb.types. (line 6)
  41794. * gdb.Value: Values From Inferior.
  41795. (line 6)
  41796. * GDB/MI development: GDB/MI Development and Front Ends.
  41797. (line 6)
  41798. * GDB/MI General Design: GDB/MI General Design.
  41799. (line 6)
  41800. * GDB/MI, async records: GDB/MI Async Records.
  41801. (line 6)
  41802. * GDB/MI, breakpoint commands: GDB/MI Breakpoint Commands.
  41803. (line 6)
  41804. * GDB/MI, compatibility with CLI: GDB/MI Compatibility with CLI.
  41805. (line 6)
  41806. * GDB/MI, data manipulation: GDB/MI Data Manipulation.
  41807. (line 6)
  41808. * GDB/MI, input syntax: GDB/MI Input Syntax.
  41809. (line 6)
  41810. * GDB/MI, its purpose: GDB/MI. (line 36)
  41811. * GDB/MI, output syntax: GDB/MI Output Syntax.
  41812. (line 6)
  41813. * GDB/MI, result records: GDB/MI Result Records.
  41814. (line 6)
  41815. * GDB/MI, simple examples: GDB/MI Simple Examples.
  41816. (line 6)
  41817. * GDB/MI, stream records: GDB/MI Stream Records.
  41818. (line 6)
  41819. * gdbarch debugging info: Debugging Output. (line 23)
  41820. * GDBHISTFILE, environment variable: Command History. (line 26)
  41821. * GDBHISTSIZE, environment variable: Command History. (line 56)
  41822. * gdbserver, command-line arguments: Server. (line 34)
  41823. * gdbserver, connecting: Connecting. (line 6)
  41824. * gdbserver, search path for libthread_db: Server. (line 254)
  41825. * gdbserver, send all debug output to a single file: Server. (line 148)
  41826. * gdbserver, target extended-remote mode: Connecting. (line 6)
  41827. * gdbserver, target remote mode: Connecting. (line 6)
  41828. * gdbserver, types of connections: Connecting. (line 6)
  41829. * GDT: DJGPP Native. (line 24)
  41830. * get thread information block address: General Query Packets.
  41831. (line 303)
  41832. * get thread-local storage address, remote request: General Query Packets.
  41833. (line 271)
  41834. * gettimeofday, file-i/o system call: gettimeofday. (line 6)
  41835. * getting structure elements using gdb.Field objects as subscripts: Values From Inferior.
  41836. (line 40)
  41837. * global debugging information directories: Separate Debug Files.
  41838. (line 6)
  41839. * global thread identifier (GDB): Threads. (line 88)
  41840. * global thread number: Threads. (line 88)
  41841. * GNAT descriptive types: Ada Glitches. (line 57)
  41842. * GNAT encoding: Ada Glitches. (line 57)
  41843. * GNU C++: C. (line 10)
  41844. * GNU Emacs: Emacs. (line 6)
  41845. * GNU Hurd debugging: Hurd Native. (line 6)
  41846. * GNU/Hurd debug messages: Debugging Output. (line 106)
  41847. * GNU/Linux LWP debug messages: Debugging Output. (line 121)
  41848. * GNU/Linux namespaces debug messages: Debugging Output. (line 125)
  41849. * Go (programming language): Go. (line 6)
  41850. * guile api: Guile API. (line 6)
  41851. * guile architectures: Architectures In Guile.
  41852. (line 6)
  41853. * guile auto-loading: Guile Auto-loading. (line 6)
  41854. * guile commands: Guile Commands. (line 6)
  41855. * guile commands <1>: Commands In Guile. (line 6)
  41856. * guile configuration: Guile Configuration.
  41857. (line 6)
  41858. * guile exceptions: Guile Exception Handling.
  41859. (line 6)
  41860. * guile gdb module: Basic Guile. (line 37)
  41861. * guile iterators: Iterators In Guile. (line 6)
  41862. * guile modules: Guile Modules. (line 6)
  41863. * guile pagination: Basic Guile. (line 6)
  41864. * guile parameters: Parameters In Guile.
  41865. (line 6)
  41866. * guile pretty printing api: Guile Pretty Printing API.
  41867. (line 6)
  41868. * guile scripting: Guile. (line 6)
  41869. * guile scripts directory: Guile Introduction. (line 15)
  41870. * guile stdout: Basic Guile. (line 6)
  41871. * guile, working with types: Types In Guile. (line 6)
  41872. * guile, working with values from inferior: Values From Inferior In Guile.
  41873. (line 6)
  41874. * H packet: Packets. (line 193)
  41875. * handling signals: Signals. (line 27)
  41876. * hardware breakpoints: Set Breaks. (line 61)
  41877. * hardware debug registers: Maintenance Commands.
  41878. (line 468)
  41879. * hardware watchpoints: Set Watchpoints. (line 31)
  41880. * hash mark while downloading: Target Commands. (line 98)
  41881. * heuristic-fence-post (Alpha, MIPS): MIPS. (line 14)
  41882. * history events: Event Designators. (line 8)
  41883. * history expansion: History Interaction.
  41884. (line 6)
  41885. * history expansion, turn on/off: Command History. (line 85)
  41886. * history file: Command History. (line 26)
  41887. * history number: Value History. (line 13)
  41888. * history of values printed by GDB: Value History. (line 6)
  41889. * history size: Command History. (line 56)
  41890. * history substitution: Command History. (line 26)
  41891. * hooks, for commands: Hooks. (line 6)
  41892. * hooks, post-command: Hooks. (line 11)
  41893. * hooks, pre-command: Hooks. (line 6)
  41894. * host character set: Character Sets. (line 6)
  41895. * Host I/O, remote protocol: Host I/O Packets. (line 6)
  41896. * how many arguments (user-defined commands): Define. (line 25)
  41897. * HPPA support: HPPA. (line 6)
  41898. * i packet: Packets. (line 207)
  41899. * I packet: Packets. (line 212)
  41900. * i/o: Input/Output. (line 6)
  41901. * I/O registers (Atmel AVR): AVR. (line 10)
  41902. * i386: Remote Stub. (line 56)
  41903. * i386-stub.c: Remote Stub. (line 56)
  41904. * IDT: DJGPP Native. (line 24)
  41905. * ignore count (of breakpoint): Conditions. (line 79)
  41906. * in-process agent protocol: In-Process Agent Protocol.
  41907. (line 6)
  41908. * incomplete type: Symbols. (line 346)
  41909. * indentation in structure display: Print Settings. (line 417)
  41910. * index files: Index Files. (line 6)
  41911. * index section format: Index Section Format.
  41912. (line 6)
  41913. * inferior: Inferiors Connections and Programs.
  41914. (line 15)
  41915. * inferior debugging info: Debugging Output. (line 110)
  41916. * inferior events in Python: Events In Python. (line 6)
  41917. * inferior functions, calling: Calling. (line 6)
  41918. * inferior tty: Input/Output. (line 44)
  41919. * inferiors in Python: Inferiors In Python.
  41920. (line 6)
  41921. * infinite recursion in user-defined commands: Define. (line 128)
  41922. * info for known .debug_gdb_scripts-loaded scripts: Maintenance Commands.
  41923. (line 335)
  41924. * info for known object files: Maintenance Commands.
  41925. (line 320)
  41926. * info line, repeated calls: Machine Code. (line 40)
  41927. * info proc cmdline: Process Information.
  41928. (line 41)
  41929. * info proc cwd: Process Information.
  41930. (line 45)
  41931. * info proc exe: Process Information.
  41932. (line 49)
  41933. * info proc files: Process Information.
  41934. (line 53)
  41935. * information about static tracepoint markers: Listing Static Tracepoint Markers.
  41936. (line 6)
  41937. * information about tracepoints: Listing Tracepoints.
  41938. (line 6)
  41939. * inheritance: Debugging C Plus Plus.
  41940. (line 26)
  41941. * init file: Startup. (line 11)
  41942. * init file name: Startup. (line 69)
  41943. * initial frame: Frames. (line 12)
  41944. * initialization file, readline: Readline Init File. (line 6)
  41945. * injecting code: Compiling and Injecting Code.
  41946. (line 6)
  41947. * inline functions, debugging: Inline Functions. (line 6)
  41948. * innermost frame: Frames. (line 12)
  41949. * input syntax for GDB/MI: GDB/MI Input Syntax.
  41950. (line 6)
  41951. * installation: Installing GDB. (line 6)
  41952. * instructions, assembly: Machine Code. (line 43)
  41953. * integral datatypes, in file-i/o protocol: Integral Datatypes.
  41954. (line 6)
  41955. * Intel: Remote Stub. (line 56)
  41956. * Intel disassembly flavor: Machine Code. (line 237)
  41957. * Intel Memory Protection Extensions (MPX).: i386. (line 21)
  41958. * Intel MPX boundary violations: Signals. (line 197)
  41959. * Intel Processor Trace: Process Record and Replay.
  41960. (line 75)
  41961. * interaction, readline: Readline Interaction.
  41962. (line 6)
  41963. * internal commands: Maintenance Commands.
  41964. (line 6)
  41965. * internal errors, control of GDB behavior: Maintenance Commands.
  41966. (line 197)
  41967. * internal GDB breakpoints: Set Breaks. (line 374)
  41968. * interrupt: Quitting GDB. (line 13)
  41969. * interrupt debuggee on MS-Windows: Cygwin Native. (line 9)
  41970. * interrupt remote programs: Remote Configuration.
  41971. (line 36)
  41972. * interrupt remote programs <1>: Remote Configuration.
  41973. (line 108)
  41974. * interrupting remote programs: Connecting. (line 246)
  41975. * interrupting remote targets: Bootstrapping. (line 25)
  41976. * interrupts (remote protocol): Interrupts. (line 6)
  41977. * invalid input: Bug Criteria. (line 16)
  41978. * invoke another interpreter: Interpreters. (line 39)
  41979. * ipa protocol commands: IPA Protocol Commands.
  41980. (line 6)
  41981. * ipa protocol objects: IPA Protocol Objects.
  41982. (line 6)
  41983. * isatty, file-i/o system call: isatty. (line 6)
  41984. * JIT compilation interface: JIT Interface. (line 6)
  41985. * JIT debug info reader: Custom Debug Info. (line 6)
  41986. * just-in-time compilation: JIT Interface. (line 6)
  41987. * just-in-time compilation, debugging messages: Debugging Output.
  41988. (line 117)
  41989. * k packet: Packets. (line 216)
  41990. * kernel crash dump: BSD libkvm Interface.
  41991. (line 6)
  41992. * kernel memory image: BSD libkvm Interface.
  41993. (line 6)
  41994. * kill ring: Readline Killing Commands.
  41995. (line 18)
  41996. * killing text: Readline Killing Commands.
  41997. (line 6)
  41998. * languages: Languages. (line 6)
  41999. * last tracepoint number: Create and Delete Tracepoints.
  42000. (line 122)
  42001. * latest breakpoint: Set Breaks. (line 6)
  42002. * lazy strings in guile: Lazy Strings In Guile.
  42003. (line 6)
  42004. * lazy strings in python: Lazy Strings In Python.
  42005. (line 6)
  42006. * LDT: DJGPP Native. (line 24)
  42007. * leaving GDB: Quitting GDB. (line 6)
  42008. * libkvm: BSD libkvm Interface.
  42009. (line 6)
  42010. * library list format, remote protocol: Library List Format.
  42011. (line 6)
  42012. * library list format, remote protocol <1>: Library List Format for SVR4 Targets.
  42013. (line 6)
  42014. * limit hardware breakpoints and watchpoints: Remote Configuration.
  42015. (line 79)
  42016. * limit hardware watchpoints length: Remote Configuration.
  42017. (line 91)
  42018. * limit on number of printed array elements: Print Settings. (line 141)
  42019. * limits, in file-i/o protocol: Limits. (line 6)
  42020. * line tables in python: Line Tables In Python.
  42021. (line 6)
  42022. * line tables, listing GDB's internal: Symbols. (line 692)
  42023. * linespec locations: Linespec Locations. (line 6)
  42024. * Linux lightweight processes: Debugging Output. (line 121)
  42025. * list active threads, remote request: General Query Packets.
  42026. (line 238)
  42027. * list of supported file-i/o calls: List of Supported Calls.
  42028. (line 6)
  42029. * list output in GDB/MI: GDB/MI Output Syntax.
  42030. (line 117)
  42031. * list, how many lines to display: List. (line 30)
  42032. * listing GDB's internal line tables: Symbols. (line 692)
  42033. * listing GDB's internal symbol tables: Symbols. (line 645)
  42034. * listing machine instructions: Machine Code. (line 43)
  42035. * listing mapped overlays: Overlay Commands. (line 60)
  42036. * lists of breakpoints: Breakpoints. (line 45)
  42037. * load address, overlay's: How Overlays Work. (line 6)
  42038. * load shared library: Files. (line 327)
  42039. * load symbols from memory: Files. (line 193)
  42040. * local socket, target remote: Connecting. (line 147)
  42041. * local variables: Symbols. (line 415)
  42042. * locate address: Output Formats. (line 35)
  42043. * location: Specify Location. (line 6)
  42044. * lock scheduler: All-Stop Mode. (line 37)
  42045. * log output in GDB/MI: GDB/MI Output Syntax.
  42046. (line 113)
  42047. * logging file name: Logging Output. (line 12)
  42048. * logging GDB output: Logging Output. (line 6)
  42049. * lseek flags, in file-i/o protocol: Lseek Flags. (line 6)
  42050. * lseek, file-i/o system call: lseek. (line 6)
  42051. * m packet: Packets. (line 239)
  42052. * M packet: Packets. (line 259)
  42053. * m680x0: Remote Stub. (line 59)
  42054. * m68k-stub.c: Remote Stub. (line 59)
  42055. * Mach-O symbols processing: Debugging Output. (line 130)
  42056. * machine instructions: Machine Code. (line 43)
  42057. * macro definition, showing: Macros. (line 47)
  42058. * macro expansion, showing the results of preprocessor: Macros.
  42059. (line 29)
  42060. * macros, example of debugging with: Macros. (line 83)
  42061. * macros, from debug info: Macros. (line 47)
  42062. * macros, user-defined: Macros. (line 59)
  42063. * mailing lists: GDB/MI Development and Front Ends.
  42064. (line 77)
  42065. * maintenance commands: Maintenance Commands.
  42066. (line 6)
  42067. * Man pages: Man Pages. (line 6)
  42068. * managing frame filters: Frame Filter Management.
  42069. (line 6)
  42070. * manual overlay debugging: Overlay Commands. (line 23)
  42071. * map an overlay: Overlay Commands. (line 30)
  42072. * mapinfo list, QNX Neutrino: Process Information.
  42073. (line 131)
  42074. * mapped address: How Overlays Work. (line 6)
  42075. * mapped overlays: How Overlays Work. (line 6)
  42076. * markers, static tracepoints: Set Tracepoints. (line 28)
  42077. * maximum value for offset of closest symbol: Print Settings.
  42078. (line 70)
  42079. * member functions: C Plus Plus Expressions.
  42080. (line 16)
  42081. * memory address space mappings: Process Information.
  42082. (line 80)
  42083. * memory address space mappings <1>: Maintenance Commands.
  42084. (line 260)
  42085. * memory map format: Memory Map Format. (line 6)
  42086. * memory region attributes: Memory Region Attributes.
  42087. (line 6)
  42088. * memory tracing: Breakpoints. (line 17)
  42089. * memory transfer, in file-i/o protocol: Memory Transfer. (line 6)
  42090. * memory used by commands: Maintenance Commands.
  42091. (line 569)
  42092. * memory used for symbol tables: Files. (line 315)
  42093. * memory, alignment and size of remote accesses: Packets. (line 247)
  42094. * memory, viewing as typed object: Expressions. (line 41)
  42095. * mi interpreter: Interpreters. (line 26)
  42096. * mi1 interpreter: Interpreters. (line 37)
  42097. * mi2 interpreter: Interpreters. (line 34)
  42098. * mi3 interpreter: Interpreters. (line 31)
  42099. * minimal language: Unsupported Languages.
  42100. (line 6)
  42101. * minimal symbol dump: Symbols. (line 619)
  42102. * Minimal symbols and DLLs: Non-debug DLL Symbols.
  42103. (line 6)
  42104. * MIPS addresses, masking: MIPS. (line 80)
  42105. * MIPS remote floating point: MIPS Embedded. (line 13)
  42106. * MIPS stack: MIPS. (line 6)
  42107. * miscellaneous settings: Other Misc Settings.
  42108. (line 6)
  42109. * MMX registers (x86): Registers. (line 76)
  42110. * mode_t values, in file-i/o protocol: mode_t Values. (line 6)
  42111. * Modula-2: Summary. (line 29)
  42112. * Modula-2 built-ins: Built-In Func/Proc. (line 6)
  42113. * Modula-2 checks: M2 Checks. (line 6)
  42114. * Modula-2 constants: Built-In Func/Proc. (line 114)
  42115. * Modula-2 defaults: M2 Defaults. (line 6)
  42116. * Modula-2 operators: M2 Operators. (line 6)
  42117. * Modula-2 types: M2 Types. (line 6)
  42118. * Modula-2, deviations from: Deviations. (line 6)
  42119. * Modula-2, GDB support: Modula-2. (line 6)
  42120. * module functions and variables: Symbols. (line 555)
  42121. * modules: Symbols. (line 547)
  42122. * monitor commands, for gdbserver: Server. (line 218)
  42123. * Motorola 680x0: Remote Stub. (line 59)
  42124. * MS Windows debugging: Cygwin Native. (line 6)
  42125. * MS-DOS system info: DJGPP Native. (line 19)
  42126. * MS-DOS-specific commands: DJGPP Native. (line 6)
  42127. * multiple locations, breakpoints: Set Breaks. (line 200)
  42128. * multiple processes: Forks. (line 6)
  42129. * multiple targets: Active Targets. (line 6)
  42130. * multiple threads: Threads. (line 6)
  42131. * multiple threads, backtrace: Backtrace. (line 97)
  42132. * multiple-symbols menu: Ambiguous Expressions.
  42133. (line 51)
  42134. * multiprocess extensions, in remote protocol: General Query Packets.
  42135. (line 913)
  42136. * name a thread: Threads. (line 247)
  42137. * names of symbols: Symbols. (line 14)
  42138. * namespace in C++: C Plus Plus Expressions.
  42139. (line 20)
  42140. * native Cygwin debugging: Cygwin Native. (line 6)
  42141. * native DJGPP debugging: DJGPP Native. (line 6)
  42142. * native script auto-loading: Auto-loading sequences.
  42143. (line 6)
  42144. * native target: Target Commands. (line 85)
  42145. * negative breakpoint numbers: Set Breaks. (line 374)
  42146. * never read symbols: Files. (line 101)
  42147. * New SYSTAG message: Threads. (line 35)
  42148. * new user interface: Interpreters. (line 68)
  42149. * Newlib OS ABI and its influence on the longjmp handling: ABI.
  42150. (line 11)
  42151. * Nios II architecture: Nios II. (line 6)
  42152. * no debug info functions: Calling. (line 78)
  42153. * no debug info variables: Variables. (line 142)
  42154. * non-member C++ functions, set breakpoint in: Set Breaks. (line 113)
  42155. * non-stop mode: Non-Stop Mode. (line 6)
  42156. * non-stop mode, and process record and replay: Process Record and Replay.
  42157. (line 101)
  42158. * non-stop mode, and set displaced-stepping: Maintenance Commands.
  42159. (line 129)
  42160. * non-stop mode, remote request: General Query Packets.
  42161. (line 379)
  42162. * noninvasive task options: Hurd Native. (line 72)
  42163. * notation, readline: Readline Bare Essentials.
  42164. (line 6)
  42165. * notational conventions, for GDB/MI: GDB/MI. (line 52)
  42166. * notification packets: Notification Packets.
  42167. (line 6)
  42168. * notify output in GDB/MI: GDB/MI Output Syntax.
  42169. (line 102)
  42170. * NULL elements in arrays: Print Settings. (line 408)
  42171. * number of array elements to print: Print Settings. (line 141)
  42172. * number representation: Numbers. (line 6)
  42173. * numbers for breakpoints: Breakpoints. (line 38)
  42174. * object files, relocatable, reading symbols from: Files. (line 146)
  42175. * Objective-C: Objective-C. (line 6)
  42176. * Objective-C, classes and selectors: Symbols. (line 570)
  42177. * Objective-C, print objects: The Print Command with Objective-C.
  42178. (line 6)
  42179. * OBJFILE-gdb.gdb: objfile-gdbdotext file.
  42180. (line 6)
  42181. * OBJFILE-gdb.py: objfile-gdbdotext file.
  42182. (line 6)
  42183. * OBJFILE-gdb.scm: objfile-gdbdotext file.
  42184. (line 6)
  42185. * objfiles in guile: Objfiles In Guile. (line 6)
  42186. * objfiles in python: Objfiles In Python. (line 6)
  42187. * observer debugging info: Debugging Output. (line 142)
  42188. * octal escapes in strings: Print Settings. (line 455)
  42189. * online documentation: Help. (line 6)
  42190. * opaque data types: Symbols. (line 582)
  42191. * open flags, in file-i/o protocol: Open Flags. (line 6)
  42192. * open, file-i/o system call: open. (line 6)
  42193. * OpenCL C: OpenCL C. (line 6)
  42194. * OpenCL C Datatypes: OpenCL C Datatypes. (line 6)
  42195. * OpenCL C Expressions: OpenCL C Expressions.
  42196. (line 6)
  42197. * OpenCL C Operators: OpenCL C Operators. (line 6)
  42198. * OpenRISC 1000: OpenRISC 1000. (line 6)
  42199. * operate-and-get-next: Editing. (line 32)
  42200. * operating system information: Operating System Information.
  42201. (line 6)
  42202. * operating system information, process list: Process list. (line 6)
  42203. * optimized code, debugging: Optimized Code. (line 6)
  42204. * optimized code, wrong values of variables: Variables. (line 106)
  42205. * optimized out value in guile: Values From Inferior In Guile.
  42206. (line 102)
  42207. * optimized out value in Python: Values From Inferior.
  42208. (line 70)
  42209. * optimized out, in backtrace: Backtrace. (line 133)
  42210. * optional debugging messages: Debugging Output. (line 6)
  42211. * optional warnings: Messages/Warnings. (line 6)
  42212. * OS ABI: ABI. (line 11)
  42213. * OS information: OS Information. (line 6)
  42214. * out-of-line single-stepping: Maintenance Commands.
  42215. (line 112)
  42216. * outermost frame: Frames. (line 12)
  42217. * output formats: Output Formats. (line 6)
  42218. * output syntax of GDB/MI: GDB/MI Output Syntax.
  42219. (line 6)
  42220. * overlay area: How Overlays Work. (line 6)
  42221. * overlay example program: Overlay Sample Program.
  42222. (line 6)
  42223. * overlays: Overlays. (line 6)
  42224. * overlays, setting breakpoints in: Overlay Commands. (line 91)
  42225. * overloaded functions, calling: C Plus Plus Expressions.
  42226. (line 26)
  42227. * overloaded functions, overload resolution: Debugging C Plus Plus.
  42228. (line 59)
  42229. * overloading in C++: Debugging C Plus Plus.
  42230. (line 15)
  42231. * overloading, Ada: Overloading support for Ada.
  42232. (line 6)
  42233. * p packet: Packets. (line 271)
  42234. * P packet: Packets. (line 284)
  42235. * packet acknowledgment, for GDB remote: Packet Acknowledgment.
  42236. (line 6)
  42237. * packet size, remote protocol: General Query Packets.
  42238. (line 819)
  42239. * packets, notification: Notification Packets.
  42240. (line 6)
  42241. * packets, reporting on stdout: Debugging Output. (line 159)
  42242. * packets, tracepoint: Tracepoint Packets. (line 6)
  42243. * page size: Screen Size. (line 6)
  42244. * page tables display (MS-DOS): DJGPP Native. (line 55)
  42245. * pagination: Screen Size. (line 6)
  42246. * parameters in guile: Parameters In Guile.
  42247. (line 6)
  42248. * parameters in python: Parameters In Python.
  42249. (line 6)
  42250. * partial symbol dump: Symbols. (line 619)
  42251. * partial symbol tables, listing GDB's internal: Symbols. (line 645)
  42252. * Pascal: Summary. (line 35)
  42253. * Pascal objects, static members display: Print Settings. (line 570)
  42254. * Pascal support in GDB, limitations: Pascal. (line 6)
  42255. * pass signals to inferior, remote request: General Query Packets.
  42256. (line 440)
  42257. * patching binaries: Patching. (line 6)
  42258. * patching object files: Files. (line 26)
  42259. * pause current task (GNU Hurd): Hurd Native. (line 48)
  42260. * pause current thread (GNU Hurd): Hurd Native. (line 90)
  42261. * pauses in output: Screen Size. (line 6)
  42262. * pending breakpoints: Set Breaks. (line 245)
  42263. * physical address from linear address: DJGPP Native. (line 80)
  42264. * physname: Debugging Output. (line 41)
  42265. * pipe, target remote to: Connecting. (line 234)
  42266. * pipes: Starting. (line 64)
  42267. * pointer values, in file-i/o protocol: Pointer Values. (line 6)
  42268. * pointer, finding referent: Print Settings. (line 80)
  42269. * port rights, GNU Hurd: Hurd Native. (line 84)
  42270. * port sets, GNU Hurd: Hurd Native. (line 84)
  42271. * PowerPC architecture: PowerPC. (line 6)
  42272. * prefix for data files: Data Files. (line 6)
  42273. * prefix for executable and shared library file names: Files.
  42274. (line 386)
  42275. * premature return from system calls: Interrupted System Calls.
  42276. (line 6)
  42277. * preprocessor macro expansion, showing the results of: Macros.
  42278. (line 29)
  42279. * pretty print arrays: Print Settings. (line 115)
  42280. * pretty print C++ virtual function tables: Print Settings. (line 581)
  42281. * pretty-printer commands: Pretty-Printer Commands.
  42282. (line 6)
  42283. * print all frame argument values: Print Settings. (line 154)
  42284. * print an Objective-C object description: The Print Command with Objective-C.
  42285. (line 11)
  42286. * print array indexes: Print Settings. (line 125)
  42287. * print frame argument values for scalars only: Print Settings.
  42288. (line 154)
  42289. * print list of auto-loaded canned sequences of commands scripts: Auto-loading sequences.
  42290. (line 21)
  42291. * print list of auto-loaded Guile scripts: Guile Auto-loading.
  42292. (line 23)
  42293. * print list of auto-loaded Python scripts: Python Auto-loading.
  42294. (line 23)
  42295. * print messages on inferior start and exit: Inferiors Connections and Programs.
  42296. (line 169)
  42297. * print messages on thread start and exit: Threads. (line 272)
  42298. * print messages when symbols are loaded: Symbols. (line 600)
  42299. * print settings: Print Settings. (line 6)
  42300. * print structures in indented form: Print Settings. (line 417)
  42301. * print/don't print memory addresses: Print Settings. (line 13)
  42302. * printing byte arrays: Output Formats. (line 60)
  42303. * printing data: Data. (line 6)
  42304. * printing frame argument values: Print Settings. (line 154)
  42305. * printing frame information: Print Settings. (line 314)
  42306. * printing nested structures: Print Settings. (line 362)
  42307. * printing strings: Output Formats. (line 60)
  42308. * probe static tracepoint marker: Create and Delete Tracepoints.
  42309. (line 75)
  42310. * probing markers, static tracepoints: Set Tracepoints. (line 28)
  42311. * process detailed status information: Process Information.
  42312. (line 89)
  42313. * process ID: Process Information.
  42314. (line 25)
  42315. * process info via /proc: Process Information.
  42316. (line 6)
  42317. * process list, QNX Neutrino: Process Information.
  42318. (line 127)
  42319. * process record and replay: Process Record and Replay.
  42320. (line 6)
  42321. * process status register: Registers. (line 31)
  42322. * processes, multiple: Forks. (line 6)
  42323. * procfs API calls: Process Information.
  42324. (line 106)
  42325. * profiling GDB: Maintenance Commands.
  42326. (line 452)
  42327. * program counter register: Registers. (line 31)
  42328. * program entry point: Backtrace. (line 155)
  42329. * programming in guile: Guile API. (line 6)
  42330. * programming in python: Python API. (line 6)
  42331. * progspaces in guile: Progspaces In Guile.
  42332. (line 6)
  42333. * progspaces in python: Progspaces In Python.
  42334. (line 6)
  42335. * prompt: Prompt. (line 6)
  42336. * protocol basics, file-i/o: Protocol Basics. (line 6)
  42337. * protocol, GDB remote serial: Overview. (line 14)
  42338. * protocol-specific representation of datatypes, in file-i/o protocol: Protocol-specific Representation of Datatypes.
  42339. (line 6)
  42340. * python api: Python API. (line 6)
  42341. * Python architectures: Architectures In Python.
  42342. (line 6)
  42343. * Python auto-loading: Python Auto-loading.
  42344. (line 6)
  42345. * python commands: Python Commands. (line 6)
  42346. * python commands <1>: Commands In Python. (line 6)
  42347. * python convenience functions: Functions In Python.
  42348. (line 6)
  42349. * python directory: Python. (line 12)
  42350. * python exceptions: Exception Handling. (line 6)
  42351. * python finish breakpoints: Finish Breakpoints in Python.
  42352. (line 6)
  42353. * python functions: Basic Python. (line 28)
  42354. * python module: Basic Python. (line 28)
  42355. * python modules: Python modules. (line 6)
  42356. * python pagination: Basic Python. (line 6)
  42357. * python parameters: Parameters In Python.
  42358. (line 6)
  42359. * python pretty printing api: Pretty Printing API.
  42360. (line 6)
  42361. * python scripting: Python. (line 6)
  42362. * python stdout: Basic Python. (line 6)
  42363. * Python TUI Windows: TUI Windows In Python.
  42364. (line 6)
  42365. * Python, working with types: Types In Python. (line 6)
  42366. * python, working with values from inferior: Values From Inferior.
  42367. (line 6)
  42368. * q packet: Packets. (line 296)
  42369. * Q packet: Packets. (line 296)
  42370. * QAllow packet: General Query Packets.
  42371. (line 44)
  42372. * qAttached packet: General Query Packets.
  42373. (line 1381)
  42374. * qC packet: General Query Packets.
  42375. (line 55)
  42376. * QCatchSyscalls packet: General Query Packets.
  42377. (line 401)
  42378. * qCRC packet: General Query Packets.
  42379. (line 65)
  42380. * QDisableRandomization packet: General Query Packets.
  42381. (line 84)
  42382. * QEnvironmentHexEncoded packet: General Query Packets.
  42383. (line 144)
  42384. * QEnvironmentReset packet: General Query Packets.
  42385. (line 197)
  42386. * QEnvironmentUnset packet: General Query Packets.
  42387. (line 173)
  42388. * qfThreadInfo packet: General Query Packets.
  42389. (line 238)
  42390. * qGetTIBAddr packet: General Query Packets.
  42391. (line 303)
  42392. * qGetTLSAddr packet: General Query Packets.
  42393. (line 271)
  42394. * QNonStop packet: General Query Packets.
  42395. (line 379)
  42396. * qOffsets packet: General Query Packets.
  42397. (line 342)
  42398. * qP packet: General Query Packets.
  42399. (line 369)
  42400. * QPassSignals packet: General Query Packets.
  42401. (line 440)
  42402. * QProgramSignals packet: General Query Packets.
  42403. (line 469)
  42404. * qRcmd packet: General Query Packets.
  42405. (line 536)
  42406. * qSearch memory packet: General Query Packets.
  42407. (line 558)
  42408. * QSetWorkingDir packet: General Query Packets.
  42409. (line 219)
  42410. * QStartNoAckMode packet: General Query Packets.
  42411. (line 575)
  42412. * QStartupWithShell packet: General Query Packets.
  42413. (line 114)
  42414. * qsThreadInfo packet: General Query Packets.
  42415. (line 238)
  42416. * qSupported packet: General Query Packets.
  42417. (line 589)
  42418. * qSymbol packet: General Query Packets.
  42419. (line 1033)
  42420. * qTBuffer packet: Tracepoint Packets. (line 393)
  42421. * QTBuffer size packet: Tracepoint Packets. (line 406)
  42422. * QTDisable packet: Tracepoint Packets. (line 209)
  42423. * QTDisconnected packet: Tracepoint Packets. (line 228)
  42424. * QTDP packet: Tracepoint Packets. (line 10)
  42425. * QTDPsrc packet: Tracepoint Packets. (line 90)
  42426. * QTDV packet: Tracepoint Packets. (line 121)
  42427. * QTEnable packet: Tracepoint Packets. (line 204)
  42428. * qTfP packet: Tracepoint Packets. (line 335)
  42429. * QTFrame packet: Tracepoint Packets. (line 133)
  42430. * qTfSTM packet: Tracepoint Packets. (line 352)
  42431. * qTfV packet: Tracepoint Packets. (line 343)
  42432. * QThreadEvents packet: General Query Packets.
  42433. (line 509)
  42434. * qThreadExtraInfo packet: General Query Packets.
  42435. (line 1076)
  42436. * QTinit packet: Tracepoint Packets. (line 214)
  42437. * qTMinFTPILen packet: Tracepoint Packets. (line 171)
  42438. * QTNotes packet: Tracepoint Packets. (line 411)
  42439. * qTP packet: Tracepoint Packets. (line 307)
  42440. * QTro packet: Tracepoint Packets. (line 217)
  42441. * QTSave packet: Tracepoint Packets. (line 387)
  42442. * qTsP packet: Tracepoint Packets. (line 336)
  42443. * qTsSTM packet: Tracepoint Packets. (line 352)
  42444. * QTStart packet: Tracepoint Packets. (line 195)
  42445. * qTStatus packet: Tracepoint Packets. (line 234)
  42446. * qTSTMat packet: Tracepoint Packets. (line 381)
  42447. * QTStop packet: Tracepoint Packets. (line 201)
  42448. * qTsV packet: Tracepoint Packets. (line 344)
  42449. * qTV packet: Tracepoint Packets. (line 318)
  42450. * qualified thread ID: Threads. (line 52)
  42451. * query attached, remote request: General Query Packets.
  42452. (line 1381)
  42453. * quotes in commands: Completion. (line 83)
  42454. * quoting Ada internal identifiers: Additions to Ada. (line 76)
  42455. * quoting names: Symbols. (line 14)
  42456. * qXfer packet: General Query Packets.
  42457. (line 1113)
  42458. * r packet: Packets. (line 300)
  42459. * R packet: Packets. (line 305)
  42460. * range checking: Type Checking. (line 45)
  42461. * range stepping: Continuing and Stepping.
  42462. (line 217)
  42463. * ranged breakpoint: PowerPC Embedded. (line 33)
  42464. * ranges of breakpoints: Breakpoints. (line 45)
  42465. * Ravenscar Profile: Ravenscar Profile. (line 6)
  42466. * Ravenscar thread: Ravenscar Profile. (line 26)
  42467. * raw printing: Output Formats. (line 76)
  42468. * read special object, remote request: General Query Packets.
  42469. (line 1113)
  42470. * read, file-i/o system call: read. (line 6)
  42471. * read-only sections: Files. (line 265)
  42472. * reading symbols from relocatable object files: Files. (line 146)
  42473. * reading symbols immediately: Files. (line 94)
  42474. * readline: Editing. (line 6)
  42475. * Readline application name: Editing. (line 29)
  42476. * receive rights, GNU Hurd: Hurd Native. (line 84)
  42477. * recent tracepoint number: Create and Delete Tracepoints.
  42478. (line 122)
  42479. * record aggregates (Ada): Omissions from Ada. (line 44)
  42480. * record mode: Process Record and Replay.
  42481. (line 19)
  42482. * record serial communications on file: Remote Configuration.
  42483. (line 64)
  42484. * recording a session script: Bug Reporting. (line 93)
  42485. * recording inferior's execution and replaying it: Process Record and Replay.
  42486. (line 6)
  42487. * recordings in python: Recordings In Python.
  42488. (line 6)
  42489. * redirection: Input/Output. (line 6)
  42490. * reference card: Formatting Documentation.
  42491. (line 6)
  42492. * reference declarations: C Plus Plus Expressions.
  42493. (line 50)
  42494. * register packet format, MIPS: MIPS Register packet Format.
  42495. (line 6)
  42496. * registers: Registers. (line 6)
  42497. * Registers In Python: Registers In Python.
  42498. (line 6)
  42499. * regular expression: Set Breaks. (line 90)
  42500. * reloading the overlay table: Overlay Commands. (line 52)
  42501. * relocatable object files, reading symbols from: Files. (line 146)
  42502. * remote async notification debugging info: Debugging Output.
  42503. (line 136)
  42504. * remote connection commands: Connecting. (line 127)
  42505. * remote connection without stubs: Server. (line 6)
  42506. * remote debugging: Remote Debugging. (line 6)
  42507. * remote debugging, connecting: Connecting. (line 6)
  42508. * remote debugging, detach and program exit: Connecting. (line 19)
  42509. * remote debugging, symbol files: Connecting. (line 97)
  42510. * remote debugging, types of connections: Connecting. (line 6)
  42511. * remote memory comparison: Memory. (line 142)
  42512. * remote packets, enabling and disabling: Remote Configuration.
  42513. (line 159)
  42514. * remote programs, interrupting: Connecting. (line 246)
  42515. * remote protocol debugging: Debugging Output. (line 159)
  42516. * remote protocol, binary data: Overview. (line 63)
  42517. * remote protocol, field separator: Overview. (line 55)
  42518. * remote query requests: General Query Packets.
  42519. (line 6)
  42520. * remote serial debugging summary: Debug Session. (line 6)
  42521. * remote serial debugging, overview: Remote Stub. (line 14)
  42522. * remote serial protocol: Overview. (line 14)
  42523. * remote serial stub: Stub Contents. (line 6)
  42524. * remote serial stub list: Remote Stub. (line 53)
  42525. * remote serial stub, initialization: Stub Contents. (line 10)
  42526. * remote serial stub, main routine: Stub Contents. (line 15)
  42527. * remote stub, example: Remote Stub. (line 6)
  42528. * remote stub, support routines: Bootstrapping. (line 6)
  42529. * remote target: Target Commands. (line 58)
  42530. * remote target, file transfer: File Transfer. (line 6)
  42531. * remote target, limit break- and watchpoints: Remote Configuration.
  42532. (line 79)
  42533. * remote target, limit watchpoints length: Remote Configuration.
  42534. (line 91)
  42535. * remote timeout: Remote Configuration.
  42536. (line 72)
  42537. * remove actions from a tracepoint: Tracepoint Actions. (line 21)
  42538. * remove duplicate history: Command History. (line 69)
  42539. * rename, file-i/o system call: rename. (line 6)
  42540. * Renesas: Remote Stub. (line 62)
  42541. * repeated array elements: Print Settings. (line 348)
  42542. * repeating command sequences: Command Syntax. (line 41)
  42543. * repeating commands: Command Syntax. (line 21)
  42544. * replay log events, remote reply: Stop Reply Packets. (line 70)
  42545. * replay mode: Process Record and Replay.
  42546. (line 10)
  42547. * reporting bugs in GDB: GDB Bugs. (line 6)
  42548. * reprint the last value: Data. (line 112)
  42549. * reprint the last value <1>: Compiling and Injecting Code.
  42550. (line 74)
  42551. * reset environment, remote request: General Query Packets.
  42552. (line 197)
  42553. * resources used by commands: Maintenance Commands.
  42554. (line 523)
  42555. * response time, MIPS debugging: MIPS. (line 10)
  42556. * restart: Checkpoint/Restart. (line 6)
  42557. * restore data from a file: Dump/Restore Files. (line 6)
  42558. * restrictions on Go expressions: Go. (line 35)
  42559. * result records in GDB/MI: GDB/MI Result Records.
  42560. (line 6)
  42561. * resume threads of multiple processes simultaneously: All-Stop Mode.
  42562. (line 54)
  42563. * resuming execution: Continuing and Stepping.
  42564. (line 6)
  42565. * returning from a function: Returning. (line 6)
  42566. * reverse execution: Reverse Execution. (line 6)
  42567. * rewind program state: Checkpoint/Restart. (line 6)
  42568. * run to first instruction: Starting. (line 114)
  42569. * run to main procedure: Starting. (line 81)
  42570. * run until specified location: Continuing and Stepping.
  42571. (line 124)
  42572. * running: Starting. (line 6)
  42573. * running programs backward: Reverse Execution. (line 6)
  42574. * s packet: Packets. (line 312)
  42575. * S packet: Packets. (line 321)
  42576. * S12Z support: S12Z. (line 6)
  42577. * save breakpoints to a file for future sessions: Save Breakpoints.
  42578. (line 9)
  42579. * save command history: Command History. (line 44)
  42580. * save GDB output to a file: Logging Output. (line 6)
  42581. * save tracepoints for future sessions: save tracepoints. (line 6)
  42582. * scheduler locking mode: All-Stop Mode. (line 37)
  42583. * scope: M2 Scope. (line 6)
  42584. * screen size: Screen Size. (line 6)
  42585. * scripting commands: Command Files. (line 6)
  42586. * scripting with guile: Guile. (line 6)
  42587. * scripting with python: Python. (line 6)
  42588. * search for a thread: Threads. (line 258)
  42589. * search path for libthread_db: Threads. (line 293)
  42590. * searching memory: Searching Memory. (line 6)
  42591. * searching memory, in remote debugging: General Query Packets.
  42592. (line 558)
  42593. * searching source files: Search. (line 6)
  42594. * section offsets, remote request: General Query Packets.
  42595. (line 342)
  42596. * segment descriptor tables: DJGPP Native. (line 24)
  42597. * select Ctrl-C, BREAK or BREAK-g: Remote Configuration.
  42598. (line 108)
  42599. * select trace snapshot: tfind. (line 6)
  42600. * selected frame: Stack. (line 19)
  42601. * selecting guile pretty-printers: Selecting Guile Pretty-Printers.
  42602. (line 6)
  42603. * selecting python pretty-printers: Selecting Pretty-Printers.
  42604. (line 6)
  42605. * self tests: Maintenance Commands.
  42606. (line 374)
  42607. * self tests <1>: Maintenance Commands.
  42608. (line 380)
  42609. * semaphores on static probe points: Static Probe Points.
  42610. (line 20)
  42611. * send command to remote monitor: Connecting. (line 279)
  42612. * send command to simulator: Embedded Processors.
  42613. (line 9)
  42614. * send interrupt-sequence on start: Remote Configuration.
  42615. (line 121)
  42616. * send rights, GNU Hurd: Hurd Native. (line 84)
  42617. * send the output of a gdb command to a shell command: Shell Commands.
  42618. (line 26)
  42619. * sending files to remote systems: File Transfer. (line 6)
  42620. * separate debug sections: MiniDebugInfo. (line 6)
  42621. * separate debugging information files: Separate Debug Files.
  42622. (line 6)
  42623. * sequence-id, for GDB remote: Overview. (line 30)
  42624. * serial connections, debugging: Debugging Output. (line 159)
  42625. * serial line, target remote: Connecting. (line 136)
  42626. * serial protocol, GDB remote: Overview. (line 14)
  42627. * server prefix: Server Prefix. (line 6)
  42628. * server, command prefix: Command History. (line 20)
  42629. * set ABI for MIPS: MIPS. (line 32)
  42630. * set breakpoints in many functions: Set Breaks. (line 90)
  42631. * set breakpoints on all functions: Set Breaks. (line 117)
  42632. * set environment variable, remote request: General Query Packets.
  42633. (line 144)
  42634. * set exec-file-mismatch: Attach. (line 34)
  42635. * set fast tracepoint: Create and Delete Tracepoints.
  42636. (line 50)
  42637. * set inferior controlling terminal: Input/Output. (line 44)
  42638. * set static tracepoint: Create and Delete Tracepoints.
  42639. (line 75)
  42640. * set tdesc filename: Retrieving Descriptions.
  42641. (line 18)
  42642. * set tracepoint: Create and Delete Tracepoints.
  42643. (line 6)
  42644. * set working directory, remote request: General Query Packets.
  42645. (line 219)
  42646. * setting variables: Assignment. (line 6)
  42647. * setting watchpoints: Set Watchpoints. (line 6)
  42648. * settings: Command Settings. (line 39)
  42649. * SH: Remote Stub. (line 62)
  42650. * sh-stub.c: Remote Stub. (line 62)
  42651. * shared libraries: Files. (line 287)
  42652. * shared library events, remote reply: Stop Reply Packets. (line 65)
  42653. * shell command, exit code: Convenience Vars. (line 188)
  42654. * shell command, exit signal: Convenience Vars. (line 188)
  42655. * shell escape: Shell Commands. (line 10)
  42656. * show all convenience functions: Convenience Funs. (line 228)
  42657. * show all user variables and functions: Convenience Vars. (line 37)
  42658. * show exec-file-mismatch: Attach. (line 44)
  42659. * show inferior's working directory: Working Directory. (line 27)
  42660. * show last commands: Command History. (line 110)
  42661. * show tdesc filename: Retrieving Descriptions.
  42662. (line 25)
  42663. * signals: Signals. (line 6)
  42664. * signals the inferior may see, remote request: General Query Packets.
  42665. (line 469)
  42666. * SIGQUIT signal, dump core of GDB: Maintenance Commands.
  42667. (line 169)
  42668. * SingleKey keymap name: TUI Single Key Mode.
  42669. (line 53)
  42670. * size of remote memory accesses: Packets. (line 247)
  42671. * size of screen: Screen Size. (line 6)
  42672. * skipping over files via glob-style patterns: Skipping Over Functions and Files.
  42673. (line 55)
  42674. * skipping over functions and files: Skipping Over Functions and Files.
  42675. (line 6)
  42676. * skipping over functions via regular expressions: Skipping Over Functions and Files.
  42677. (line 68)
  42678. * snapshot of a process: Checkpoint/Restart. (line 6)
  42679. * software watchpoints: Set Watchpoints. (line 31)
  42680. * source file and line of a symbol: Print Settings. (line 50)
  42681. * source line and its code address: Machine Code. (line 6)
  42682. * source location: Specify Location. (line 6)
  42683. * source path: Source Path. (line 6)
  42684. * Sparc: Remote Stub. (line 65)
  42685. * sparc-stub.c: Remote Stub. (line 65)
  42686. * Sparc64 support: Sparc64. (line 6)
  42687. * sparcl-stub.c: Remote Stub. (line 68)
  42688. * SparcLite: Remote Stub. (line 68)
  42689. * Special Fortran commands: Special Fortran Commands.
  42690. (line 6)
  42691. * specifying location: Specify Location. (line 6)
  42692. * SSE registers (x86): Registers. (line 76)
  42693. * stack frame: Frames. (line 6)
  42694. * stack on Alpha: MIPS. (line 6)
  42695. * stack on MIPS: MIPS. (line 6)
  42696. * stack pointer register: Registers. (line 31)
  42697. * stacking targets: Active Targets. (line 6)
  42698. * standard registers: Registers. (line 31)
  42699. * start a new independent interpreter: Interpreters. (line 52)
  42700. * start a new trace experiment: Starting and Stopping Trace Experiments.
  42701. (line 6)
  42702. * starting: Starting. (line 6)
  42703. * startup code, and backtrace: Backtrace. (line 155)
  42704. * startup with shell, remote request: General Query Packets.
  42705. (line 114)
  42706. * stat, file-i/o system call: stat/fstat. (line 6)
  42707. * static members of C++ objects: Print Settings. (line 559)
  42708. * static members of Pascal objects: Print Settings. (line 570)
  42709. * static probe point, DTrace: Static Probe Points.
  42710. (line 6)
  42711. * static probe point, SystemTap: Static Probe Points.
  42712. (line 6)
  42713. * static tracepoints: Set Tracepoints. (line 28)
  42714. * static tracepoints, in remote protocol: General Query Packets.
  42715. (line 961)
  42716. * static tracepoints, setting: Create and Delete Tracepoints.
  42717. (line 75)
  42718. * status of trace data collection: Starting and Stopping Trace Experiments.
  42719. (line 27)
  42720. * status output in GDB/MI: GDB/MI Output Syntax.
  42721. (line 94)
  42722. * stepping: Continuing and Stepping.
  42723. (line 6)
  42724. * stepping and signal handlers: Signals. (line 106)
  42725. * stepping into functions with no line info: Continuing and Stepping.
  42726. (line 92)
  42727. * stop a running trace experiment: Starting and Stopping Trace Experiments.
  42728. (line 16)
  42729. * stop on C++ exceptions: Set Catchpoints. (line 16)
  42730. * stop reply packets: Stop Reply Packets. (line 6)
  42731. * stopped threads: Thread Stops. (line 6)
  42732. * stream records in GDB/MI: GDB/MI Stream Records.
  42733. (line 6)
  42734. * string tracing, in remote protocol: General Query Packets.
  42735. (line 978)
  42736. * struct gdb_reader_funcs: Writing JIT Debug Info Readers.
  42737. (line 22)
  42738. * struct gdb_symbol_callbacks: Writing JIT Debug Info Readers.
  42739. (line 43)
  42740. * struct gdb_unwind_callbacks: Writing JIT Debug Info Readers.
  42741. (line 43)
  42742. * struct return convention: i386. (line 7)
  42743. * struct stat, in file-i/o protocol: struct stat. (line 6)
  42744. * struct timeval, in file-i/o protocol: struct timeval. (line 6)
  42745. * struct/union returned in registers: i386. (line 7)
  42746. * structure field name completion: Completion. (line 135)
  42747. * stub example, remote debugging: Remote Stub. (line 6)
  42748. * stupid questions: Messages/Warnings. (line 49)
  42749. * styling: Output Styling. (line 6)
  42750. * Super-H: Super-H. (line 6)
  42751. * supported GDB/MI features, list: GDB/MI Support Commands.
  42752. (line 57)
  42753. * supported packets, remote query: General Query Packets.
  42754. (line 589)
  42755. * switching threads: Threads. (line 6)
  42756. * switching threads automatically: All-Stop Mode. (line 28)
  42757. * symbol cache size: Symbols. (line 698)
  42758. * symbol cache, flushing: Symbols. (line 714)
  42759. * symbol cache, printing its contents: Symbols. (line 706)
  42760. * symbol cache, printing usage statistics: Symbols. (line 710)
  42761. * symbol decoding style, C++: Print Settings. (line 529)
  42762. * symbol dump: Symbols. (line 619)
  42763. * symbol file functions: Debugging Output. (line 205)
  42764. * symbol files, remote debugging: Connecting. (line 97)
  42765. * symbol from address: Symbols. (line 95)
  42766. * symbol lookup: Debugging Output. (line 198)
  42767. * symbol lookup, remote request: General Query Packets.
  42768. (line 1033)
  42769. * symbol names: Symbols. (line 14)
  42770. * symbol table: Files. (line 6)
  42771. * symbol table creation: Debugging Output. (line 210)
  42772. * symbol tables in guile: Symbol Tables In Guile.
  42773. (line 6)
  42774. * symbol tables in python: Symbol Tables In Python.
  42775. (line 6)
  42776. * symbol tables, listing GDB's internal: Symbols. (line 645)
  42777. * symbol, source file and line: Print Settings. (line 50)
  42778. * symbols in guile: Symbols In Guile. (line 6)
  42779. * symbols in python: Symbols In Python. (line 6)
  42780. * symbols, never read: Files. (line 101)
  42781. * symbols, reading from relocatable object files: Files. (line 146)
  42782. * symbols, reading immediately: Files. (line 94)
  42783. * Synopsys ARC: ARC. (line 6)
  42784. * syscall DSO: Files. (line 193)
  42785. * system calls and thread breakpoints: Interrupted System Calls.
  42786. (line 6)
  42787. * system root, alternate: Files. (line 386)
  42788. * system, file-i/o system call: system. (line 6)
  42789. * system-wide configuration scripts: System-wide Configuration Scripts.
  42790. (line 6)
  42791. * system-wide init file: System-wide configuration.
  42792. (line 6)
  42793. * t packet: Packets. (line 331)
  42794. * T packet: Packets. (line 336)
  42795. * T packet reply: Stop Reply Packets. (line 26)
  42796. * tail call frames, debugging: Tail Call Frames. (line 6)
  42797. * target architecture: Targets. (line 17)
  42798. * target byte order: Byte Order. (line 6)
  42799. * target character set: Character Sets. (line 6)
  42800. * target debugging info: Debugging Output. (line 217)
  42801. * target descriptions: Target Descriptions.
  42802. (line 6)
  42803. * target descriptions, AArch64 features: AArch64 Features. (line 6)
  42804. * target descriptions, ARC Features: ARC Features. (line 6)
  42805. * target descriptions, ARM features: ARM Features. (line 6)
  42806. * target descriptions, enum types: Enum Target Types. (line 6)
  42807. * target descriptions, i386 features: i386 Features. (line 6)
  42808. * target descriptions, inclusion: Target Description Format.
  42809. (line 53)
  42810. * target descriptions, M68K features: M68K Features. (line 6)
  42811. * target descriptions, MicroBlaze features: MicroBlaze Features.
  42812. (line 6)
  42813. * target descriptions, MIPS features: MIPS Features. (line 6)
  42814. * target descriptions, NDS32 features: NDS32 Features. (line 6)
  42815. * target descriptions, Nios II features: Nios II Features. (line 6)
  42816. * target descriptions, OpenRISC 1000 features: OpenRISC 1000 Features.
  42817. (line 6)
  42818. * target descriptions, PowerPC features: PowerPC Features. (line 6)
  42819. * target descriptions, predefined types: Predefined Target Types.
  42820. (line 6)
  42821. * target descriptions, RISC-V Features: RISC-V Features. (line 6)
  42822. * target descriptions, RX Features: RX Features. (line 6)
  42823. * target descriptions, S/390 features: S/390 and System z Features.
  42824. (line 6)
  42825. * target descriptions, sparc32 features: Sparc Features. (line 6)
  42826. * target descriptions, sparc64 features: Sparc Features. (line 6)
  42827. * target descriptions, standard features: Standard Target Features.
  42828. (line 6)
  42829. * target descriptions, System z features: S/390 and System z Features.
  42830. (line 6)
  42831. * target descriptions, TIC6x features: TIC6x Features. (line 6)
  42832. * target descriptions, TMS320C6x features: TIC6x Features. (line 6)
  42833. * target descriptions, XML format: Target Description Format.
  42834. (line 6)
  42835. * target memory comparison: Memory. (line 142)
  42836. * target output in GDB/MI: GDB/MI Output Syntax.
  42837. (line 110)
  42838. * target stack description: Maintenance Commands.
  42839. (line 355)
  42840. * target-assisted range stepping: Continuing and Stepping.
  42841. (line 217)
  42842. * task attributes (GNU Hurd): Hurd Native. (line 48)
  42843. * task breakpoints, in Ada: Ada Tasks. (line 135)
  42844. * task exception port, GNU Hurd: Hurd Native. (line 67)
  42845. * task suspend count: Hurd Native. (line 59)
  42846. * task switching with program using Ravenscar Profile: Ravenscar Profile.
  42847. (line 10)
  42848. * TCP port, target remote: Connecting. (line 173)
  42849. * temporarily change settings: Command Settings. (line 39)
  42850. * terminal: Input/Output. (line 6)
  42851. * Text User Interface: TUI. (line 6)
  42852. * thread attributes info, remote request: General Query Packets.
  42853. (line 1076)
  42854. * thread breakpoints: Thread-Specific Breakpoints.
  42855. (line 10)
  42856. * thread breakpoints and system calls: Interrupted System Calls.
  42857. (line 6)
  42858. * thread create event, remote reply: Stop Reply Packets. (line 152)
  42859. * thread create/exit events, remote request: General Query Packets.
  42860. (line 509)
  42861. * thread default settings, GNU Hurd: Hurd Native. (line 130)
  42862. * thread exit event, remote reply: Stop Reply Packets. (line 181)
  42863. * thread ID lists: Threads. (line 65)
  42864. * thread identifier (GDB): Threads. (line 47)
  42865. * thread identifier (system): Threads. (line 35)
  42866. * thread info (Solaris): Threads. (line 167)
  42867. * thread information, remote request: General Query Packets.
  42868. (line 369)
  42869. * thread list format: Thread List Format. (line 6)
  42870. * thread number, per inferior: Threads. (line 47)
  42871. * thread properties, GNU Hurd: Hurd Native. (line 90)
  42872. * thread suspend count, GNU Hurd: Hurd Native. (line 109)
  42873. * THREAD-ID, in remote protocol: Packets. (line 20)
  42874. * threads and watchpoints: Set Watchpoints. (line 179)
  42875. * threads in python: Threads In Python. (line 6)
  42876. * threads of execution: Threads. (line 6)
  42877. * threads, automatic switching: All-Stop Mode. (line 28)
  42878. * threads, continuing: Thread Stops. (line 6)
  42879. * threads, stopped: Thread Stops. (line 6)
  42880. * time of command execution: Maintenance Commands.
  42881. (line 573)
  42882. * timeout for commands: Maintenance Commands.
  42883. (line 624)
  42884. * timeout for serial communications: Remote Configuration.
  42885. (line 72)
  42886. * timeout, for remote target connection: Remote Configuration.
  42887. (line 147)
  42888. * timestamping debugging info: Debugging Output. (line 224)
  42889. * trace experiment, status of: Starting and Stopping Trace Experiments.
  42890. (line 27)
  42891. * trace file format: Trace File Format. (line 6)
  42892. * trace files: Trace Files. (line 6)
  42893. * trace state variable value, remote request: Tracepoint Packets.
  42894. (line 318)
  42895. * trace state variables: Trace State Variables.
  42896. (line 6)
  42897. * traceback: Backtrace. (line 6)
  42898. * traceframe info format: Traceframe Info Format.
  42899. (line 6)
  42900. * tracepoint actions: Tracepoint Actions. (line 6)
  42901. * tracepoint conditions: Tracepoint Conditions.
  42902. (line 6)
  42903. * tracepoint data, display: tdump. (line 6)
  42904. * tracepoint deletion: Create and Delete Tracepoints.
  42905. (line 125)
  42906. * tracepoint number: Create and Delete Tracepoints.
  42907. (line 122)
  42908. * tracepoint packets: Tracepoint Packets. (line 6)
  42909. * tracepoint pass count: Tracepoint Passcounts.
  42910. (line 6)
  42911. * tracepoint restrictions: Tracepoint Restrictions.
  42912. (line 6)
  42913. * tracepoint status, remote request: Tracepoint Packets. (line 307)
  42914. * tracepoint variables: Tracepoint Variables.
  42915. (line 6)
  42916. * tracepoints: Tracepoints. (line 6)
  42917. * tracepoints support in gdbserver: Server. (line 272)
  42918. * trailing underscore, in Fortran symbols: Fortran. (line 9)
  42919. * translating between character sets: Character Sets. (line 6)
  42920. * TUI: TUI. (line 6)
  42921. * TUI commands: TUI Commands. (line 6)
  42922. * TUI configuration variables: TUI Configuration. (line 6)
  42923. * TUI key bindings: TUI Keys. (line 6)
  42924. * TUI single key mode: TUI Single Key Mode.
  42925. (line 6)
  42926. * type casting memory: Expressions. (line 41)
  42927. * type chain of a data type: Maintenance Commands.
  42928. (line 367)
  42929. * type checking: Checks. (line 24)
  42930. * type conversions in C++: C Plus Plus Expressions.
  42931. (line 26)
  42932. * type printer: Type Printing API. (line 9)
  42933. * type printing API for Python: Type Printing API. (line 6)
  42934. * types in guile: Types In Guile. (line 6)
  42935. * types in Python: Types In Python. (line 6)
  42936. * UDP port, target remote: Connecting. (line 222)
  42937. * union field name completion: Completion. (line 135)
  42938. * unions in structures, printing: Print Settings. (line 469)
  42939. * Unix domain socket: Connecting. (line 147)
  42940. * unknown address, locating: Output Formats. (line 35)
  42941. * unknown type: Symbols. (line 363)
  42942. * unlink, file-i/o system call: unlink. (line 6)
  42943. * unlinked object files: Files. (line 26)
  42944. * unload symbols from shared libraries: Files. (line 348)
  42945. * unmap an overlay: Overlay Commands. (line 39)
  42946. * unmapped overlays: How Overlays Work. (line 6)
  42947. * unset environment variable, remote request: General Query Packets.
  42948. (line 173)
  42949. * unset tdesc filename: Retrieving Descriptions.
  42950. (line 21)
  42951. * unsupported languages: Unsupported Languages.
  42952. (line 6)
  42953. * unwind stack in called functions: Calling. (line 36)
  42954. * unwind stack in called functions with unhandled exceptions: Calling.
  42955. (line 47)
  42956. * unwinding frames in Python: Unwinding Frames in Python.
  42957. (line 6)
  42958. * use only software watchpoints: Set Watchpoints. (line 108)
  42959. * user registers: Maintenance Commands.
  42960. (line 326)
  42961. * user-defined command: Define. (line 6)
  42962. * user-defined macros: Macros. (line 59)
  42963. * user-defined variables: Convenience Vars. (line 6)
  42964. * value history: Value History. (line 6)
  42965. * values from inferior, in guile: Values From Inferior In Guile.
  42966. (line 6)
  42967. * values from inferior, with Python: Values From Inferior.
  42968. (line 6)
  42969. * variable name conflict: Variables. (line 36)
  42970. * variable object debugging info: Debugging Output. (line 231)
  42971. * variable objects in GDB/MI: GDB/MI Variable Objects.
  42972. (line 9)
  42973. * variable values, wrong: Variables. (line 106)
  42974. * variables, readline: Readline Init File Syntax.
  42975. (line 34)
  42976. * variables, setting: Assignment. (line 16)
  42977. * vAttach packet: Packets. (line 350)
  42978. * vCont packet: Packets. (line 368)
  42979. * vCont? packet: Packets. (line 435)
  42980. * vCtrlC packet: Packets. (line 445)
  42981. * vector unit: Vector Unit. (line 6)
  42982. * vector, auxiliary: OS Information. (line 9)
  42983. * verbose operation: Messages/Warnings. (line 6)
  42984. * verify remote memory image: Memory. (line 142)
  42985. * verify target memory image: Memory. (line 142)
  42986. * vFile packet: Packets. (line 459)
  42987. * vFlashDone packet: Packets. (line 498)
  42988. * vFlashErase packet: Packets. (line 463)
  42989. * vFlashWrite packet: Packets. (line 478)
  42990. * vfork events, remote reply: Stop Reply Packets. (line 116)
  42991. * vforkdone events, remote reply: Stop Reply Packets. (line 128)
  42992. * virtual functions (C++) display: Print Settings. (line 581)
  42993. * vKill packet: Packets. (line 505)
  42994. * vMustReplyEmpty packet: Packets. (line 517)
  42995. * volatile registers: Registers. (line 106)
  42996. * vRun packet: Packets. (line 529)
  42997. * vStopped packet: Packets. (line 544)
  42998. * VTBL display: Print Settings. (line 581)
  42999. * watchdog timer: Maintenance Commands.
  43000. (line 624)
  43001. * watchpoints: Breakpoints. (line 17)
  43002. * watchpoints and threads: Set Watchpoints. (line 179)
  43003. * where to look for shared libraries: Files. (line 381)
  43004. * wild pointer, interpreting: Print Settings. (line 80)
  43005. * Wind River Linux system-wide configuration script: System-wide Configuration Scripts.
  43006. (line 22)
  43007. * word completion: Completion. (line 6)
  43008. * working directory: Source Path. (line 40)
  43009. * working directory (of your program): Working Directory. (line 6)
  43010. * working language: Languages. (line 13)
  43011. * write data into object, remote request: General Query Packets.
  43012. (line 1338)
  43013. * write, file-i/o system call: write. (line 6)
  43014. * writing a frame filter: Writing a Frame Filter.
  43015. (line 6)
  43016. * writing a Guile pretty-printer: Writing a Guile Pretty-Printer.
  43017. (line 6)
  43018. * writing a pretty-printer: Writing a Pretty-Printer.
  43019. (line 6)
  43020. * writing convenience functions: Functions In Python.
  43021. (line 6)
  43022. * writing into corefiles: Patching. (line 6)
  43023. * writing into executables: Patching. (line 6)
  43024. * writing into executables <1>: Compiling and Injecting Code.
  43025. (line 6)
  43026. * writing JIT debug info readers: Writing JIT Debug Info Readers.
  43027. (line 6)
  43028. * writing xmethods in Python: Writing an Xmethod. (line 6)
  43029. * wrong values: Variables. (line 106)
  43030. * x command, default address: Machine Code. (line 34)
  43031. * X packet: Packets. (line 547)
  43032. * Xilinx MicroBlaze: MicroBlaze. (line 6)
  43033. * XInclude: Target Description Format.
  43034. (line 53)
  43035. * XMD, Xilinx Microprocessor Debugger: MicroBlaze. (line 6)
  43036. * xmethod API: Xmethod API. (line 6)
  43037. * xmethods in Python: Xmethods In Python. (line 6)
  43038. * XML parser debugging: Debugging Output. (line 237)
  43039. * yanking text: Readline Killing Commands.
  43040. (line 6)
  43041. * z packet: Packets. (line 560)
  43042. * Z packets: Packets. (line 560)
  43043. * z0 packet: Packets. (line 575)
  43044. * Z0 packet: Packets. (line 575)
  43045. * z1 packet: Packets. (line 630)
  43046. * Z1 packet: Packets. (line 630)
  43047. * z2 packet: Packets. (line 651)
  43048. * Z2 packet: Packets. (line 651)
  43049. * z3 packet: Packets. (line 664)
  43050. * Z3 packet: Packets. (line 664)
  43051. * z4 packet: Packets. (line 677)
  43052. * Z4 packet: Packets. (line 677)
  43053. 
  43054. File: gdb.info, Node: Command and Variable Index, Prev: Concept Index, Up: Top
  43055. Command, Variable, and Function Index
  43056. *************************************
  43057. �[index�]
  43058. * Menu:
  43059. * !: Shell Commands. (line 10)
  43060. * # (a comment): Command Syntax. (line 37)
  43061. * $bpnum, convenience variable: Set Breaks. (line 6)
  43062. * $cdir, convenience variable: Source Path. (line 40)
  43063. * $cwd, convenience variable: Source Path. (line 40)
  43064. * $tpnum: Create and Delete Tracepoints.
  43065. (line 122)
  43066. * $tracepoint: Tracepoint Variables.
  43067. (line 10)
  43068. * $trace_file: Tracepoint Variables.
  43069. (line 16)
  43070. * $trace_frame: Tracepoint Variables.
  43071. (line 6)
  43072. * $trace_func: Tracepoint Variables.
  43073. (line 19)
  43074. * $trace_line: Tracepoint Variables.
  43075. (line 13)
  43076. * $_, convenience variable: Convenience Vars. (line 65)
  43077. * $_ada_exception, convenience variable: Set Catchpoints. (line 82)
  43078. * $_any_caller_is, convenience function: Convenience Funs. (line 182)
  43079. * $_any_caller_matches, convenience function: Convenience Funs.
  43080. (line 194)
  43081. * $_as_string, convenience function: Convenience Funs. (line 206)
  43082. * $_caller_is, convenience function: Convenience Funs. (line 152)
  43083. * $_caller_matches, convenience function: Convenience Funs. (line 175)
  43084. * $_cimag, convenience function: Convenience Funs. (line 217)
  43085. * $_creal, convenience function: Convenience Funs. (line 217)
  43086. * $_exception, convenience variable: Set Catchpoints. (line 21)
  43087. * $_exitcode, convenience variable: Convenience Vars. (line 80)
  43088. * $_exitsignal, convenience variable: Convenience Vars. (line 85)
  43089. * $_gdb_maint_setting, convenience function: Convenience Funs.
  43090. (line 129)
  43091. * $_gdb_maint_setting_str, convenience function: Convenience Funs.
  43092. (line 125)
  43093. * $_gdb_major, convenience variable: Convenience Vars. (line 179)
  43094. * $_gdb_minor, convenience variable: Convenience Vars. (line 179)
  43095. * $_gdb_setting, convenience function: Convenience Funs. (line 76)
  43096. * $_gdb_setting_str, convenience function: Convenience Funs. (line 63)
  43097. * $_gthread, convenience variable: Threads. (line 98)
  43098. * $_inferior, convenience variable: Inferiors Connections and Programs.
  43099. (line 90)
  43100. * $_isvoid, convenience function: Convenience Funs. (line 15)
  43101. * $_memeq, convenience function: Convenience Funs. (line 136)
  43102. * $_probe_arg, convenience variable: Static Probe Points. (line 77)
  43103. * $_regex, convenience function: Convenience Funs. (line 140)
  43104. * $_sdata, collect: Tracepoint Actions. (line 86)
  43105. * $_sdata, inspect, convenience variable: Convenience Vars. (line 147)
  43106. * $_shell_exitcode, convenience variable: Convenience Vars. (line 188)
  43107. * $_shell_exitsignal, convenience variable: Convenience Vars. (line 188)
  43108. * $_siginfo, convenience variable: Convenience Vars. (line 153)
  43109. * $_streq, convenience function: Convenience Funs. (line 145)
  43110. * $_strlen, convenience function: Convenience Funs. (line 149)
  43111. * $_thread, convenience variable: Threads. (line 98)
  43112. * $_tlb, convenience variable: Convenience Vars. (line 159)
  43113. * $__, convenience variable: Convenience Vars. (line 74)
  43114. * (make-command: Commands In Guile. (line 15)
  43115. * (make-parameter: Parameters In Guile. (line 22)
  43116. * -ada-task-info: GDB/MI Ada Tasking Commands.
  43117. (line 9)
  43118. * -add-inferior: GDB/MI Miscellaneous Commands.
  43119. (line 295)
  43120. * -break-after: GDB/MI Breakpoint Commands.
  43121. (line 11)
  43122. * -break-commands: GDB/MI Breakpoint Commands.
  43123. (line 56)
  43124. * -break-condition: GDB/MI Breakpoint Commands.
  43125. (line 90)
  43126. * -break-delete: GDB/MI Breakpoint Commands.
  43127. (line 127)
  43128. * -break-disable: GDB/MI Breakpoint Commands.
  43129. (line 161)
  43130. * -break-enable: GDB/MI Breakpoint Commands.
  43131. (line 197)
  43132. * -break-info: GDB/MI Breakpoint Commands.
  43133. (line 232)
  43134. * -break-insert: GDB/MI Breakpoint Commands.
  43135. (line 256)
  43136. * -break-list: GDB/MI Breakpoint Commands.
  43137. (line 427)
  43138. * -break-passcount: GDB/MI Breakpoint Commands.
  43139. (line 499)
  43140. * -break-watch: GDB/MI Breakpoint Commands.
  43141. (line 511)
  43142. * -catch-assert: Ada Exception GDB/MI Catchpoint Commands.
  43143. (line 12)
  43144. * -catch-catch: C++ Exception GDB/MI Catchpoint Commands.
  43145. (line 98)
  43146. * -catch-exception: Ada Exception GDB/MI Catchpoint Commands.
  43147. (line 46)
  43148. * -catch-handlers: Ada Exception GDB/MI Catchpoint Commands.
  43149. (line 91)
  43150. * -catch-load: Shared Library GDB/MI Catchpoint Commands.
  43151. (line 9)
  43152. * -catch-rethrow: C++ Exception GDB/MI Catchpoint Commands.
  43153. (line 56)
  43154. * -catch-throw: C++ Exception GDB/MI Catchpoint Commands.
  43155. (line 13)
  43156. * -catch-unload: Shared Library GDB/MI Catchpoint Commands.
  43157. (line 36)
  43158. * -complete: GDB/MI Miscellaneous Commands.
  43159. (line 436)
  43160. * -data-disassemble: GDB/MI Data Manipulation.
  43161. (line 15)
  43162. * -data-evaluate-expression: GDB/MI Data Manipulation.
  43163. (line 192)
  43164. * -data-list-changed-registers: GDB/MI Data Manipulation.
  43165. (line 230)
  43166. * -data-list-register-names: GDB/MI Data Manipulation.
  43167. (line 266)
  43168. * -data-list-register-values: GDB/MI Data Manipulation.
  43169. (line 306)
  43170. * -data-read-memory: GDB/MI Data Manipulation.
  43171. (line 393)
  43172. * -data-read-memory-bytes: GDB/MI Data Manipulation.
  43173. (line 500)
  43174. * -data-write-memory-bytes: GDB/MI Data Manipulation.
  43175. (line 575)
  43176. * -dprintf-insert: GDB/MI Breakpoint Commands.
  43177. (line 363)
  43178. * -enable-frame-filters: GDB/MI Stack Manipulation.
  43179. (line 9)
  43180. * -enable-pretty-printing: GDB/MI Variable Objects.
  43181. (line 118)
  43182. * -enable-timings: GDB/MI Miscellaneous Commands.
  43183. (line 392)
  43184. * -environment-cd: GDB/MI Program Context.
  43185. (line 33)
  43186. * -environment-directory: GDB/MI Program Context.
  43187. (line 56)
  43188. * -environment-path: GDB/MI Program Context.
  43189. (line 100)
  43190. * -environment-pwd: GDB/MI Program Context.
  43191. (line 141)
  43192. * -exec-arguments: GDB/MI Program Context.
  43193. (line 9)
  43194. * -exec-continue: GDB/MI Program Execution.
  43195. (line 13)
  43196. * -exec-finish: GDB/MI Program Execution.
  43197. (line 53)
  43198. * -exec-interrupt: GDB/MI Program Execution.
  43199. (line 97)
  43200. * -exec-jump: GDB/MI Program Execution.
  43201. (line 147)
  43202. * -exec-next: GDB/MI Program Execution.
  43203. (line 171)
  43204. * -exec-next-instruction: GDB/MI Program Execution.
  43205. (line 202)
  43206. * -exec-return: GDB/MI Program Execution.
  43207. (line 238)
  43208. * -exec-run: GDB/MI Program Execution.
  43209. (line 283)
  43210. * -exec-step: GDB/MI Program Execution.
  43211. (line 353)
  43212. * -exec-step-instruction: GDB/MI Program Execution.
  43213. (line 395)
  43214. * -exec-until: GDB/MI Program Execution.
  43215. (line 436)
  43216. * -file-exec-and-symbols: GDB/MI File Commands.
  43217. (line 12)
  43218. * -file-exec-file: GDB/MI File Commands.
  43219. (line 40)
  43220. * -file-list-exec-source-file: GDB/MI File Commands.
  43221. (line 67)
  43222. * -file-list-exec-source-files: GDB/MI File Commands.
  43223. (line 93)
  43224. * -file-list-shared-libraries: GDB/MI File Commands.
  43225. (line 123)
  43226. * -file-symbol-file: GDB/MI File Commands.
  43227. (line 157)
  43228. * -gdb-exit: GDB/MI Miscellaneous Commands.
  43229. (line 9)
  43230. * -gdb-set: GDB/MI Miscellaneous Commands.
  43231. (line 31)
  43232. * -gdb-show: GDB/MI Miscellaneous Commands.
  43233. (line 54)
  43234. * -gdb-version: GDB/MI Miscellaneous Commands.
  43235. (line 77)
  43236. * -inferior-tty-set: GDB/MI Miscellaneous Commands.
  43237. (line 343)
  43238. * -inferior-tty-show: GDB/MI Miscellaneous Commands.
  43239. (line 366)
  43240. * -info-ada-exceptions: GDB/MI Ada Exceptions Commands.
  43241. (line 9)
  43242. * -info-gdb-mi-command: GDB/MI Support Commands.
  43243. (line 14)
  43244. * -info-os: GDB/MI Miscellaneous Commands.
  43245. (line 221)
  43246. * -interpreter-exec: GDB/MI Miscellaneous Commands.
  43247. (line 317)
  43248. * -list-features: GDB/MI Support Commands.
  43249. (line 57)
  43250. * -list-target-features: GDB/MI Support Commands.
  43251. (line 115)
  43252. * -list-thread-groups: GDB/MI Miscellaneous Commands.
  43253. (line 111)
  43254. * -stack-info-depth: GDB/MI Stack Manipulation.
  43255. (line 51)
  43256. * -stack-info-frame: GDB/MI Stack Manipulation.
  43257. (line 24)
  43258. * -stack-list-arguments: GDB/MI Stack Manipulation.
  43259. (line 89)
  43260. * -stack-list-frames: GDB/MI Stack Manipulation.
  43261. (line 188)
  43262. * -stack-list-locals: GDB/MI Stack Manipulation.
  43263. (line 305)
  43264. * -stack-list-variables: GDB/MI Stack Manipulation.
  43265. (line 351)
  43266. * -stack-select-frame: GDB/MI Stack Manipulation.
  43267. (line 379)
  43268. * -symbol-info-functions: GDB/MI Symbol Query. (line 9)
  43269. * -symbol-info-module-functions: GDB/MI Symbol Query. (line 109)
  43270. * -symbol-info-module-variables: GDB/MI Symbol Query. (line 170)
  43271. * -symbol-info-modules: GDB/MI Symbol Query. (line 241)
  43272. * -symbol-info-types: GDB/MI Symbol Query. (line 295)
  43273. * -symbol-info-variables: GDB/MI Symbol Query. (line 352)
  43274. * -symbol-list-lines: GDB/MI Symbol Query. (line 457)
  43275. * -target-attach: GDB/MI Target Manipulation.
  43276. (line 9)
  43277. * -target-detach: GDB/MI Target Manipulation.
  43278. (line 36)
  43279. * -target-disconnect: GDB/MI Target Manipulation.
  43280. (line 61)
  43281. * -target-download: GDB/MI Target Manipulation.
  43282. (line 85)
  43283. * -target-file-delete: GDB/MI File Transfer Commands.
  43284. (line 57)
  43285. * -target-file-get: GDB/MI File Transfer Commands.
  43286. (line 33)
  43287. * -target-file-put: GDB/MI File Transfer Commands.
  43288. (line 9)
  43289. * -target-flash-erase: GDB/MI Target Manipulation.
  43290. (line 192)
  43291. * -target-select: GDB/MI Target Manipulation.
  43292. (line 212)
  43293. * -thread-info: GDB/MI Thread Commands.
  43294. (line 9)
  43295. * -thread-list-ids: GDB/MI Thread Commands.
  43296. (line 58)
  43297. * -thread-select: GDB/MI Thread Commands.
  43298. (line 86)
  43299. * -trace-define-variable: GDB/MI Tracepoint Commands.
  43300. (line 80)
  43301. * -trace-find: GDB/MI Tracepoint Commands.
  43302. (line 12)
  43303. * -trace-frame-collected: GDB/MI Tracepoint Commands.
  43304. (line 97)
  43305. * -trace-list-variables: GDB/MI Tracepoint Commands.
  43306. (line 204)
  43307. * -trace-save: GDB/MI Tracepoint Commands.
  43308. (line 246)
  43309. * -trace-start: GDB/MI Tracepoint Commands.
  43310. (line 267)
  43311. * -trace-status: GDB/MI Tracepoint Commands.
  43312. (line 283)
  43313. * -trace-stop: GDB/MI Tracepoint Commands.
  43314. (line 354)
  43315. * -var-assign: GDB/MI Variable Objects.
  43316. (line 497)
  43317. * -var-create: GDB/MI Variable Objects.
  43318. (line 136)
  43319. * -var-delete: GDB/MI Variable Objects.
  43320. (line 224)
  43321. * -var-evaluate-expression: GDB/MI Variable Objects.
  43322. (line 476)
  43323. * -var-info-expression: GDB/MI Variable Objects.
  43324. (line 413)
  43325. * -var-info-num-children: GDB/MI Variable Objects.
  43326. (line 278)
  43327. * -var-info-path-expression: GDB/MI Variable Objects.
  43328. (line 438)
  43329. * -var-info-type: GDB/MI Variable Objects.
  43330. (line 400)
  43331. * -var-list-children: GDB/MI Variable Objects.
  43332. (line 294)
  43333. * -var-set-format: GDB/MI Variable Objects.
  43334. (line 237)
  43335. * -var-set-frozen: GDB/MI Variable Objects.
  43336. (line 641)
  43337. * -var-set-update-range: GDB/MI Variable Objects.
  43338. (line 667)
  43339. * -var-set-visualizer: GDB/MI Variable Objects.
  43340. (line 690)
  43341. * -var-show-attributes: GDB/MI Variable Objects.
  43342. (line 462)
  43343. * -var-show-format: GDB/MI Variable Objects.
  43344. (line 265)
  43345. * -var-update: GDB/MI Variable Objects.
  43346. (line 521)
  43347. * <gdb:arch>: Architectures In Guile.
  43348. (line 6)
  43349. * <gdb:block>: Blocks In Guile. (line 6)
  43350. * <gdb:breakpoint>: Breakpoints In Guile.
  43351. (line 6)
  43352. * <gdb:iterator>: Iterators In Guile. (line 6)
  43353. * <gdb:lazy-string>: Lazy Strings In Guile.
  43354. (line 6)
  43355. * <gdb:objfile>: Objfiles In Guile. (line 6)
  43356. * <gdb:progspace>: Progspaces In Guile. (line 6)
  43357. * <gdb:sal>: Symbol Tables In Guile.
  43358. (line 6)
  43359. * <gdb:symbol>: Symbols In Guile. (line 6)
  43360. * <gdb:symtab>: Symbol Tables In Guile.
  43361. (line 6)
  43362. * <gdb:type>: Types In Guile. (line 6)
  43363. * <gdb:value>: Values From Inferior In Guile.
  43364. (line 6)
  43365. * @, referencing memory as an array: Arrays. (line 6)
  43366. * ^connected: GDB/MI Result Records.
  43367. (line 22)
  43368. * ^done: GDB/MI Result Records.
  43369. (line 9)
  43370. * ^error: GDB/MI Result Records.
  43371. (line 25)
  43372. * ^exit: GDB/MI Result Records.
  43373. (line 36)
  43374. * ^running: GDB/MI Result Records.
  43375. (line 14)
  43376. * __init__ on TypePrinter: gdb.types. (line 82)
  43377. * |: Shell Commands. (line 26)
  43378. * abort (C-g): Miscellaneous Commands.
  43379. (line 10)
  43380. * accept-line (Newline or Return): Commands For History.
  43381. (line 6)
  43382. * actions: Tracepoint Actions. (line 6)
  43383. * ada-task-info: GDB/MI Support Commands.
  43384. (line 94)
  43385. * add-auto-load-safe-path: Auto-loading safe path.
  43386. (line 50)
  43387. * add-auto-load-scripts-directory: objfile-gdbdotext file.
  43388. (line 68)
  43389. * add-inferior: Inferiors Connections and Programs.
  43390. (line 103)
  43391. * add-symbol-file: Files. (line 123)
  43392. * add-symbol-file-from-memory: Files. (line 193)
  43393. * adi assign: Sparc64. (line 45)
  43394. * adi examine: Sparc64. (line 27)
  43395. * advance LOCATION: Continuing and Stepping.
  43396. (line 187)
  43397. * alias: Aliases. (line 21)
  43398. * append: Dump/Restore Files. (line 34)
  43399. * append-pretty-printer!: Guile Printing Module.
  43400. (line 18)
  43401. * apropos: Help. (line 74)
  43402. * arch-bool-type: Architectures In Guile.
  43403. (line 84)
  43404. * arch-char-type: Architectures In Guile.
  43405. (line 36)
  43406. * arch-charset: Architectures In Guile.
  43407. (line 23)
  43408. * arch-disassemble: Disassembly In Guile.
  43409. (line 10)
  43410. * arch-double-type: Architectures In Guile.
  43411. (line 76)
  43412. * arch-float-type: Architectures In Guile.
  43413. (line 72)
  43414. * arch-int-type: Architectures In Guile.
  43415. (line 44)
  43416. * arch-int16-type: Architectures In Guile.
  43417. (line 104)
  43418. * arch-int32-type: Architectures In Guile.
  43419. (line 112)
  43420. * arch-int64-type: Architectures In Guile.
  43421. (line 120)
  43422. * arch-int8-type: Architectures In Guile.
  43423. (line 96)
  43424. * arch-long-type: Architectures In Guile.
  43425. (line 48)
  43426. * arch-longdouble-type: Architectures In Guile.
  43427. (line 80)
  43428. * arch-longlong-type: Architectures In Guile.
  43429. (line 88)
  43430. * arch-name: Architectures In Guile.
  43431. (line 20)
  43432. * arch-schar-type: Architectures In Guile.
  43433. (line 52)
  43434. * arch-short-type: Architectures In Guile.
  43435. (line 40)
  43436. * arch-uchar-type: Architectures In Guile.
  43437. (line 56)
  43438. * arch-uint-type: Architectures In Guile.
  43439. (line 64)
  43440. * arch-uint16-type: Architectures In Guile.
  43441. (line 108)
  43442. * arch-uint32-type: Architectures In Guile.
  43443. (line 116)
  43444. * arch-uint64-type: Architectures In Guile.
  43445. (line 124)
  43446. * arch-uint8-type: Architectures In Guile.
  43447. (line 100)
  43448. * arch-ulong-type: Architectures In Guile.
  43449. (line 68)
  43450. * arch-ulonglong-type: Architectures In Guile.
  43451. (line 92)
  43452. * arch-ushort-type: Architectures In Guile.
  43453. (line 60)
  43454. * arch-void-type: Architectures In Guile.
  43455. (line 32)
  43456. * arch-wide-charset: Architectures In Guile.
  43457. (line 26)
  43458. * arch?: Architectures In Guile.
  43459. (line 13)
  43460. * Architecture.disassemble: Architectures In Python.
  43461. (line 15)
  43462. * Architecture.name: Architectures In Python.
  43463. (line 12)
  43464. * Architecture.registers: Architectures In Python.
  43465. (line 47)
  43466. * Architecture.register_groups: Architectures In Python.
  43467. (line 53)
  43468. * attach: Attach. (line 6)
  43469. * attach&: Background Execution.
  43470. (line 25)
  43471. * awatch: Set Watchpoints. (line 83)
  43472. * b (break): Set Breaks. (line 6)
  43473. * backtrace: Backtrace. (line 11)
  43474. * backward-char (C-b): Commands For Moving. (line 15)
  43475. * backward-delete-char (Rubout): Commands For Text. (line 17)
  43476. * backward-kill-line (C-x Rubout): Commands For Killing.
  43477. (line 9)
  43478. * backward-kill-word (M-<DEL>): Commands For Killing.
  43479. (line 24)
  43480. * backward-word (M-b): Commands For Moving. (line 22)
  43481. * beginning-of-history (M-<): Commands For History.
  43482. (line 19)
  43483. * beginning-of-line (C-a): Commands For Moving. (line 6)
  43484. * bell-style: Readline Init File Syntax.
  43485. (line 35)
  43486. * bfd caching: File Caching. (line 14)
  43487. * bfd caching <1>: File Caching. (line 24)
  43488. * bfd caching <2>: File Caching. (line 27)
  43489. * bind-tty-special-chars: Readline Init File Syntax.
  43490. (line 42)
  43491. * blink-matching-paren: Readline Init File Syntax.
  43492. (line 47)
  43493. * block-end: Blocks In Guile. (line 70)
  43494. * block-function: Blocks In Guile. (line 73)
  43495. * block-global-block: Blocks In Guile. (line 87)
  43496. * block-global?: Blocks In Guile. (line 93)
  43497. * block-start: Blocks In Guile. (line 67)
  43498. * block-static-block: Blocks In Guile. (line 90)
  43499. * block-static?: Blocks In Guile. (line 97)
  43500. * block-superblock: Blocks In Guile. (line 83)
  43501. * block-symbols: Blocks In Guile. (line 101)
  43502. * block-symbols-progress?: Blocks In Guile. (line 112)
  43503. * block-valid?: Blocks In Guile. (line 59)
  43504. * Block.end: Blocks In Python. (line 86)
  43505. * Block.function: Blocks In Python. (line 90)
  43506. * Block.global_block: Blocks In Python. (line 105)
  43507. * Block.is_global: Blocks In Python. (line 113)
  43508. * Block.is_static: Blocks In Python. (line 117)
  43509. * Block.is_valid: Blocks In Python. (line 73)
  43510. * Block.start: Blocks In Python. (line 83)
  43511. * Block.static_block: Blocks In Python. (line 109)
  43512. * Block.superblock: Blocks In Python. (line 100)
  43513. * block?: Blocks In Guile. (line 55)
  43514. * BP_ACCESS_WATCHPOINT: Breakpoints In Python.
  43515. (line 74)
  43516. * BP_ACCESS_WATCHPOINT <1>: Breakpoints In Guile.
  43517. (line 71)
  43518. * BP_BREAKPOINT: Breakpoints In Python.
  43519. (line 62)
  43520. * BP_BREAKPOINT <1>: Breakpoints In Guile.
  43521. (line 57)
  43522. * BP_HARDWARE_WATCHPOINT: Breakpoints In Python.
  43523. (line 68)
  43524. * BP_HARDWARE_WATCHPOINT <1>: Breakpoints In Guile.
  43525. (line 63)
  43526. * BP_READ_WATCHPOINT: Breakpoints In Python.
  43527. (line 71)
  43528. * BP_READ_WATCHPOINT <1>: Breakpoints In Guile.
  43529. (line 67)
  43530. * BP_WATCHPOINT: Breakpoints In Python.
  43531. (line 65)
  43532. * BP_WATCHPOINT <1>: Breakpoints In Guile.
  43533. (line 60)
  43534. * bracketed-paste-begin (): Commands For Text. (line 36)
  43535. * break: Set Breaks. (line 6)
  43536. * break ... task TASKNO (Ada): Ada Tasks. (line 135)
  43537. * break ... thread THREAD-ID: Thread-Specific Breakpoints.
  43538. (line 10)
  43539. * break, and Objective-C: Method Names in Commands.
  43540. (line 9)
  43541. * break-range: PowerPC Embedded. (line 41)
  43542. * breakpoint annotation: Annotations for Running.
  43543. (line 47)
  43544. * breakpoint-commands: Breakpoints In Guile.
  43545. (line 236)
  43546. * breakpoint-condition: Breakpoints In Guile.
  43547. (line 194)
  43548. * breakpoint-enabled?: Breakpoints In Guile.
  43549. (line 144)
  43550. * breakpoint-expression: Breakpoints In Guile.
  43551. (line 139)
  43552. * breakpoint-hit-count: Breakpoints In Guile.
  43553. (line 169)
  43554. * breakpoint-ignore-count: Breakpoints In Guile.
  43555. (line 163)
  43556. * breakpoint-location: Breakpoints In Guile.
  43557. (line 134)
  43558. * breakpoint-notifications: GDB/MI Support Commands.
  43559. (line 91)
  43560. * breakpoint-number: Breakpoints In Guile.
  43561. (line 122)
  43562. * breakpoint-silent?: Breakpoints In Guile.
  43563. (line 151)
  43564. * breakpoint-stop: Breakpoints In Guile.
  43565. (line 202)
  43566. * breakpoint-task: Breakpoints In Guile.
  43567. (line 185)
  43568. * breakpoint-thread: Breakpoints In Guile.
  43569. (line 176)
  43570. * breakpoint-type: Breakpoints In Guile.
  43571. (line 126)
  43572. * breakpoint-valid?: Breakpoints In Guile.
  43573. (line 112)
  43574. * breakpoint-visible?: Breakpoints In Guile.
  43575. (line 130)
  43576. * Breakpoint.commands: Breakpoints In Python.
  43577. (line 211)
  43578. * Breakpoint.condition: Breakpoints In Python.
  43579. (line 206)
  43580. * Breakpoint.delete: Breakpoints In Python.
  43581. (line 128)
  43582. * Breakpoint.enabled: Breakpoints In Python.
  43583. (line 133)
  43584. * Breakpoint.expression: Breakpoints In Python.
  43585. (line 200)
  43586. * Breakpoint.hit_count: Breakpoints In Python.
  43587. (line 189)
  43588. * Breakpoint.ignore_count: Breakpoints In Python.
  43589. (line 161)
  43590. * Breakpoint.is_valid: Breakpoints In Python.
  43591. (line 120)
  43592. * Breakpoint.location: Breakpoints In Python.
  43593. (line 194)
  43594. * Breakpoint.number: Breakpoints In Python.
  43595. (line 165)
  43596. * Breakpoint.pending: Breakpoints In Python.
  43597. (line 146)
  43598. * Breakpoint.silent: Breakpoints In Python.
  43599. (line 138)
  43600. * Breakpoint.stop: Breakpoints In Python.
  43601. (line 89)
  43602. * Breakpoint.task: Breakpoints In Python.
  43603. (line 155)
  43604. * Breakpoint.temporary: Breakpoints In Python.
  43605. (line 180)
  43606. * Breakpoint.thread: Breakpoints In Python.
  43607. (line 150)
  43608. * Breakpoint.type: Breakpoints In Python.
  43609. (line 170)
  43610. * Breakpoint.visible: Breakpoints In Python.
  43611. (line 175)
  43612. * Breakpoint.__init__: Breakpoints In Python.
  43613. (line 16)
  43614. * Breakpoint.__init__ <1>: Breakpoints In Python.
  43615. (line 49)
  43616. * breakpoint?: Breakpoints In Guile.
  43617. (line 108)
  43618. * BreakpointEvent.breakpoint: Events In Python. (line 105)
  43619. * BreakpointEvent.breakpoints: Events In Python. (line 101)
  43620. * breakpoints: Breakpoints In Guile.
  43621. (line 104)
  43622. * breakpoints-invalid annotation: Invalidation. (line 14)
  43623. * bt (backtrace): Backtrace. (line 11)
  43624. * c (continue): Continuing and Stepping.
  43625. (line 16)
  43626. * c (SingleKey TUI key): TUI Single Key Mode. (line 10)
  43627. * C-L: TUI Keys. (line 79)
  43628. * C-x 1: TUI Keys. (line 22)
  43629. * C-x 2: TUI Keys. (line 32)
  43630. * C-x a: TUI Keys. (line 11)
  43631. * C-x A: TUI Keys. (line 12)
  43632. * C-x C-a: TUI Keys. (line 10)
  43633. * C-x o: TUI Keys. (line 43)
  43634. * C-x s: TUI Keys. (line 53)
  43635. * call: Calling. (line 11)
  43636. * call-last-kbd-macro (C-x e): Keyboard Macros. (line 13)
  43637. * capitalize-word (M-c): Commands For Text. (line 64)
  43638. * catch: Set Catchpoints. (line 10)
  43639. * catch assert: Set Catchpoints. (line 112)
  43640. * catch catch: Set Catchpoints. (line 16)
  43641. * catch exception: Set Catchpoints. (line 66)
  43642. * catch exception unhandled: Set Catchpoints. (line 87)
  43643. * catch exec: Set Catchpoints. (line 116)
  43644. * catch fork: Set Catchpoints. (line 261)
  43645. * catch handlers: Set Catchpoints. (line 92)
  43646. * catch load: Set Catchpoints. (line 268)
  43647. * catch rethrow: Set Catchpoints. (line 16)
  43648. * catch signal: Set Catchpoints. (line 273)
  43649. * catch syscall: Set Catchpoints. (line 120)
  43650. * catch throw: Set Catchpoints. (line 16)
  43651. * catch unload: Set Catchpoints. (line 268)
  43652. * catch vfork: Set Catchpoints. (line 264)
  43653. * cd: Working Directory. (line 32)
  43654. * cdir: Source Path. (line 40)
  43655. * character-search (C-]): Miscellaneous Commands.
  43656. (line 42)
  43657. * character-search-backward (M-C-]): Miscellaneous Commands.
  43658. (line 47)
  43659. * checkpoint: Checkpoint/Restart. (line 26)
  43660. * clear: Delete Breaks. (line 21)
  43661. * clear, and Objective-C: Method Names in Commands.
  43662. (line 9)
  43663. * clear-screen (C-l): Commands For Moving. (line 40)
  43664. * ClearObjFilesEvent.progspace: Events In Python. (line 125)
  43665. * clone-inferior: Inferiors Connections and Programs.
  43666. (line 119)
  43667. * collect (tracepoints): Tracepoint Actions. (line 49)
  43668. * colon-colon, in Modula-2: M2 Scope. (line 6)
  43669. * colored-completion-prefix: Readline Init File Syntax.
  43670. (line 52)
  43671. * colored-stats: Readline Init File Syntax.
  43672. (line 59)
  43673. * Command.complete: Commands In Python. (line 70)
  43674. * Command.dont_repeat: Commands In Python. (line 42)
  43675. * Command.invoke: Commands In Python. (line 48)
  43676. * Command.__init__: Commands In Python. (line 10)
  43677. * command?: Commands In Guile. (line 63)
  43678. * commands: Break Commands. (line 11)
  43679. * commands annotation: Prompting. (line 27)
  43680. * COMMAND_BREAKPOINTS: Commands In Python. (line 142)
  43681. * COMMAND_BREAKPOINTS <1>: Commands In Guile. (line 177)
  43682. * COMMAND_DATA: Commands In Python. (line 113)
  43683. * COMMAND_DATA <1>: Commands In Guile. (line 148)
  43684. * COMMAND_FILES: Commands In Python. (line 124)
  43685. * COMMAND_FILES <1>: Commands In Guile. (line 159)
  43686. * COMMAND_MAINTENANCE: Commands In Python. (line 171)
  43687. * COMMAND_MAINTENANCE <1>: Commands In Guile. (line 201)
  43688. * COMMAND_NONE: Commands In Python. (line 103)
  43689. * COMMAND_NONE <1>: Commands In Guile. (line 137)
  43690. * COMMAND_OBSCURE: Commands In Python. (line 165)
  43691. * COMMAND_OBSCURE <1>: Commands In Guile. (line 195)
  43692. * COMMAND_RUNNING: Commands In Python. (line 107)
  43693. * COMMAND_RUNNING <1>: Commands In Guile. (line 142)
  43694. * COMMAND_STACK: Commands In Python. (line 118)
  43695. * COMMAND_STACK <1>: Commands In Guile. (line 153)
  43696. * COMMAND_STATUS: Commands In Python. (line 136)
  43697. * COMMAND_STATUS <1>: Commands In Guile. (line 171)
  43698. * COMMAND_SUPPORT: Commands In Python. (line 129)
  43699. * COMMAND_SUPPORT <1>: Commands In Guile. (line 164)
  43700. * COMMAND_TRACEPOINTS: Commands In Python. (line 148)
  43701. * COMMAND_TRACEPOINTS <1>: Commands In Guile. (line 183)
  43702. * COMMAND_TUI: Commands In Python. (line 154)
  43703. * COMMAND_USER: Commands In Python. (line 159)
  43704. * COMMAND_USER <1>: Commands In Guile. (line 189)
  43705. * comment-begin: Readline Init File Syntax.
  43706. (line 65)
  43707. * compare-sections: Memory. (line 149)
  43708. * compile code: Compiling and Injecting Code.
  43709. (line 11)
  43710. * compile file: Compiling and Injecting Code.
  43711. (line 56)
  43712. * complete: Help. (line 106)
  43713. * complete (<TAB>): Commands For Completion.
  43714. (line 6)
  43715. * COMPLETE_COMMAND: Commands In Python. (line 192)
  43716. * COMPLETE_COMMAND <1>: Commands In Guile. (line 222)
  43717. * COMPLETE_EXPRESSION: Commands In Python. (line 200)
  43718. * COMPLETE_EXPRESSION <1>: Commands In Guile. (line 230)
  43719. * COMPLETE_FILENAME: Commands In Python. (line 185)
  43720. * COMPLETE_FILENAME <1>: Commands In Guile. (line 215)
  43721. * COMPLETE_LOCATION: Commands In Python. (line 188)
  43722. * COMPLETE_LOCATION <1>: Commands In Guile. (line 218)
  43723. * COMPLETE_NONE: Commands In Python. (line 182)
  43724. * COMPLETE_NONE <1>: Commands In Guile. (line 212)
  43725. * COMPLETE_SYMBOL: Commands In Python. (line 196)
  43726. * COMPLETE_SYMBOL <1>: Commands In Guile. (line 226)
  43727. * completion-display-width: Readline Init File Syntax.
  43728. (line 70)
  43729. * completion-ignore-case: Readline Init File Syntax.
  43730. (line 77)
  43731. * completion-map-case: Readline Init File Syntax.
  43732. (line 82)
  43733. * completion-prefix-display-length: Readline Init File Syntax.
  43734. (line 88)
  43735. * completion-query-items: Readline Init File Syntax.
  43736. (line 95)
  43737. * condition: Conditions. (line 58)
  43738. * continue: Continuing and Stepping.
  43739. (line 16)
  43740. * continue&: Background Execution.
  43741. (line 40)
  43742. * convert-meta: Readline Init File Syntax.
  43743. (line 105)
  43744. * copy-backward-word (): Commands For Killing.
  43745. (line 49)
  43746. * copy-forward-word (): Commands For Killing.
  43747. (line 54)
  43748. * copy-region-as-kill (): Commands For Killing.
  43749. (line 45)
  43750. * core-file: Files. (line 107)
  43751. * ctf: Trace Files. (line 28)
  43752. * Ctrl-o (operate-and-get-next): Command Syntax. (line 41)
  43753. * current-arch: Architectures In Guile.
  43754. (line 17)
  43755. * current-objfile: Objfiles In Guile. (line 46)
  43756. * current-progspace: Progspaces In Guile. (line 26)
  43757. * cwd: Source Path. (line 40)
  43758. * d (delete): Delete Breaks. (line 41)
  43759. * d (SingleKey TUI key): TUI Single Key Mode. (line 13)
  43760. * data-directory: Guile Configuration. (line 9)
  43761. * data-disassemble-a-option: GDB/MI Support Commands.
  43762. (line 108)
  43763. * data-read-memory-bytes: GDB/MI Support Commands.
  43764. (line 88)
  43765. * default-visualizer: Guile Pretty Printing API.
  43766. (line 129)
  43767. * define: Define. (line 50)
  43768. * define-prefix: Define. (line 75)
  43769. * delete: Delete Breaks. (line 41)
  43770. * delete checkpoint CHECKPOINT-ID: Checkpoint/Restart. (line 53)
  43771. * delete display: Auto Display. (line 45)
  43772. * delete mem: Memory Region Attributes.
  43773. (line 34)
  43774. * delete tracepoint: Create and Delete Tracepoints.
  43775. (line 125)
  43776. * delete tvariable: Trace State Variables.
  43777. (line 42)
  43778. * delete-breakpoint!: Breakpoints In Guile.
  43779. (line 95)
  43780. * delete-char (C-d): Commands For Text. (line 12)
  43781. * delete-char-or-list (): Commands For Completion.
  43782. (line 39)
  43783. * delete-horizontal-space (): Commands For Killing.
  43784. (line 37)
  43785. * demangle: Symbols. (line 114)
  43786. * detach: Attach. (line 55)
  43787. * detach (remote): Connecting. (line 263)
  43788. * detach inferiors INFNO...: Inferiors Connections and Programs.
  43789. (line 148)
  43790. * digit-argument (M-0, M-1, ... M--): Numeric Arguments. (line 6)
  43791. * dir: Source Path. (line 99)
  43792. * directory: Source Path. (line 99)
  43793. * dis (disable): Disabling. (line 37)
  43794. * disable: Disabling. (line 37)
  43795. * disable display: Auto Display. (line 56)
  43796. * disable frame-filter: Frame Filter Management.
  43797. (line 16)
  43798. * disable mem: Memory Region Attributes.
  43799. (line 38)
  43800. * disable pretty-printer: Pretty-Printer Commands.
  43801. (line 20)
  43802. * disable probes: Static Probe Points. (line 73)
  43803. * disable tracepoint: Enable and Disable Tracepoints.
  43804. (line 9)
  43805. * disable type-printer: Symbols. (line 411)
  43806. * disable-completion: Readline Init File Syntax.
  43807. (line 113)
  43808. * disassemble: Machine Code. (line 43)
  43809. * disconnect: Connecting. (line 272)
  43810. * display: Auto Display. (line 23)
  43811. * do (down): Selection. (line 74)
  43812. * do-lowercase-version (M-A, M-B, M-X, ...): Miscellaneous Commands.
  43813. (line 14)
  43814. * document: Define. (line 63)
  43815. * dont-repeat: Commands In Guile. (line 67)
  43816. * dont-repeat <1>: Define. (line 111)
  43817. * down: Selection. (line 74)
  43818. * Down: TUI Keys. (line 70)
  43819. * down-silently: Selection. (line 106)
  43820. * downcase-word (M-l): Commands For Text. (line 60)
  43821. * dprintf: Dynamic Printf. (line 26)
  43822. * dprintf-style agent: Dynamic Printf. (line 46)
  43823. * dprintf-style call: Dynamic Printf. (line 42)
  43824. * dprintf-style gdb: Dynamic Printf. (line 39)
  43825. * dump: Dump/Restore Files. (line 13)
  43826. * dump-functions (): Miscellaneous Commands.
  43827. (line 70)
  43828. * dump-macros (): Miscellaneous Commands.
  43829. (line 82)
  43830. * dump-variables (): Miscellaneous Commands.
  43831. (line 76)
  43832. * e (edit): Edit. (line 6)
  43833. * echo: Output. (line 12)
  43834. * echo-control-characters: Readline Init File Syntax.
  43835. (line 118)
  43836. * edit: Edit. (line 6)
  43837. * editing-mode: Readline Init File Syntax.
  43838. (line 123)
  43839. * else: Command Files. (line 74)
  43840. * emacs-editing-mode (C-e): Miscellaneous Commands.
  43841. (line 88)
  43842. * emacs-mode-string: Readline Init File Syntax.
  43843. (line 129)
  43844. * enable: Disabling. (line 44)
  43845. * enable display: Auto Display. (line 65)
  43846. * enable frame-filter: Frame Filter Management.
  43847. (line 26)
  43848. * enable mem: Memory Region Attributes.
  43849. (line 42)
  43850. * enable pretty-printer: Pretty-Printer Commands.
  43851. (line 25)
  43852. * enable probes: Static Probe Points. (line 60)
  43853. * enable tracepoint: Enable and Disable Tracepoints.
  43854. (line 19)
  43855. * enable type-printer: Symbols. (line 411)
  43856. * enable-bracketed-paste: Readline Init File Syntax.
  43857. (line 139)
  43858. * enable-keypad: Readline Init File Syntax.
  43859. (line 147)
  43860. * enabled: Xmethod API. (line 18)
  43861. * enabled of type_printer: Type Printing API. (line 13)
  43862. * end (breakpoint commands): Break Commands. (line 11)
  43863. * end (if/else/while commands): Command Files. (line 103)
  43864. * end (user-defined commands): Define. (line 63)
  43865. * end-kbd-macro (C-x )): Keyboard Macros. (line 9)
  43866. * end-of-file (usually C-d): Commands For Text. (line 6)
  43867. * end-of-history (M->): Commands For History.
  43868. (line 22)
  43869. * end-of-iteration: Iterators In Guile. (line 70)
  43870. * end-of-iteration?: Iterators In Guile. (line 73)
  43871. * end-of-line (C-e): Commands For Moving. (line 9)
  43872. * error annotation: Errors. (line 10)
  43873. * error-begin annotation: Errors. (line 22)
  43874. * error-port: I/O Ports in Guile. (line 12)
  43875. * eval: Output. (line 117)
  43876. * EventRegistry.connect: Events In Python. (line 19)
  43877. * EventRegistry.disconnect: Events In Python. (line 23)
  43878. * exception-args: Guile Exception Handling.
  43879. (line 103)
  43880. * exception-key: Guile Exception Handling.
  43881. (line 100)
  43882. * exception?: Guile Exception Handling.
  43883. (line 96)
  43884. * exceptionHandler: Bootstrapping. (line 38)
  43885. * exchange-point-and-mark (C-x C-x): Miscellaneous Commands.
  43886. (line 37)
  43887. * exec-file: Files. (line 39)
  43888. * exec-file-mismatch: Attach. (line 34)
  43889. * exec-run-start-option: GDB/MI Support Commands.
  43890. (line 105)
  43891. * execute: Basic Guile. (line 68)
  43892. * exited annotation: Annotations for Running.
  43893. (line 18)
  43894. * ExitedEvent.exit_code: Events In Python. (line 67)
  43895. * ExitedEvent.inferior: Events In Python. (line 72)
  43896. * expand-tilde: Readline Init File Syntax.
  43897. (line 158)
  43898. * explore: Data. (line 125)
  43899. * f (frame): Selection. (line 11)
  43900. * f (SingleKey TUI key): TUI Single Key Mode. (line 16)
  43901. * faas: Frame Apply. (line 96)
  43902. * fg (resume foreground execution): Continuing and Stepping.
  43903. (line 16)
  43904. * field-artificial?: Types In Guile. (line 262)
  43905. * field-base-class?: Types In Guile. (line 266)
  43906. * field-bitpos: Types In Guile. (line 253)
  43907. * field-bitsize: Types In Guile. (line 257)
  43908. * field-enumval: Types In Guile. (line 250)
  43909. * field-name: Types In Guile. (line 243)
  43910. * field-type: Types In Guile. (line 246)
  43911. * field?: Types In Guile. (line 239)
  43912. * file: Files. (line 16)
  43913. * fin (finish): Continuing and Stepping.
  43914. (line 109)
  43915. * find: Searching Memory. (line 9)
  43916. * find-pc-line: Symbol Tables In Guile.
  43917. (line 71)
  43918. * finish: Continuing and Stepping.
  43919. (line 109)
  43920. * finish&: Background Execution.
  43921. (line 43)
  43922. * FinishBreakpoint.out_of_scope: Finish Breakpoints in Python.
  43923. (line 21)
  43924. * FinishBreakpoint.return_value: Finish Breakpoints in Python.
  43925. (line 38)
  43926. * FinishBreakpoint.__init__: Finish Breakpoints in Python.
  43927. (line 14)
  43928. * flash-erase: Target Commands. (line 140)
  43929. * flushregs: Maintenance Commands.
  43930. (line 317)
  43931. * flush_i_cache: Bootstrapping. (line 60)
  43932. * fo (forward-search): Search. (line 9)
  43933. * focus: TUI Commands. (line 103)
  43934. * forward-backward-delete-char (): Commands For Text. (line 21)
  43935. * forward-char (C-f): Commands For Moving. (line 12)
  43936. * forward-search: Search. (line 9)
  43937. * forward-search-history (C-s): Commands For History.
  43938. (line 30)
  43939. * forward-word (M-f): Commands For Moving. (line 18)
  43940. * frame address: Selection. (line 30)
  43941. * frame apply: Frame Apply. (line 6)
  43942. * frame function: Selection. (line 48)
  43943. * frame level: Selection. (line 16)
  43944. * frame view: Selection. (line 53)
  43945. * frame, selecting: Selection. (line 11)
  43946. * frame-arch: Frames In Guile. (line 35)
  43947. * frame-block: Frames In Guile. (line 121)
  43948. * frame-function: Frames In Guile. (line 125)
  43949. * frame-name: Frames In Guile. (line 32)
  43950. * frame-newer: Frames In Guile. (line 133)
  43951. * frame-older: Frames In Guile. (line 130)
  43952. * frame-pc: Frames In Guile. (line 118)
  43953. * frame-read-register: Frames In Guile. (line 140)
  43954. * frame-read-var: Frames In Guile. (line 144)
  43955. * frame-sal: Frames In Guile. (line 136)
  43956. * frame-select: Frames In Guile. (line 152)
  43957. * frame-type: Frames In Guile. (line 39)
  43958. * frame-unwind-stop-reason: Frames In Guile. (line 67)
  43959. * frame-valid?: Frames In Guile. (line 26)
  43960. * Frame.architecture: Frames In Python. (line 53)
  43961. * Frame.block: Frames In Python. (line 139)
  43962. * Frame.find_sal: Frames In Python. (line 155)
  43963. * Frame.function: Frames In Python. (line 145)
  43964. * Frame.is_valid: Frames In Python. (line 43)
  43965. * Frame.name: Frames In Python. (line 49)
  43966. * Frame.newer: Frames In Python. (line 152)
  43967. * Frame.older: Frames In Python. (line 149)
  43968. * Frame.pc: Frames In Python. (line 136)
  43969. * Frame.read_register: Frames In Python. (line 159)
  43970. * Frame.read_var: Frames In Python. (line 179)
  43971. * Frame.select: Frames In Python. (line 187)
  43972. * Frame.type: Frames In Python. (line 57)
  43973. * Frame.unwind_stop_reason: Frames In Python. (line 84)
  43974. * frame?: Frames In Guile. (line 22)
  43975. * FrameDecorator.address: Frame Decorator API. (line 60)
  43976. * FrameDecorator.elided: Frame Decorator API. (line 29)
  43977. * FrameDecorator.filename: Frame Decorator API. (line 70)
  43978. * FrameDecorator.frame_args: Frame Decorator API. (line 91)
  43979. * FrameDecorator.frame_locals: Frame Decorator API. (line 143)
  43980. * FrameDecorator.function: Frame Decorator API. (line 49)
  43981. * FrameDecorator.inferior_frame: Frame Decorator API. (line 176)
  43982. * FrameDecorator.line: Frame Decorator API. (line 81)
  43983. * FrameFilter.enabled: Frame Filter API. (line 122)
  43984. * FrameFilter.filter: Frame Filter API. (line 75)
  43985. * FrameFilter.name: Frame Filter API. (line 115)
  43986. * FrameFilter.priority: Frame Filter API. (line 131)
  43987. * frames-invalid annotation: Invalidation. (line 9)
  43988. * frozen-varobjs: GDB/MI Support Commands.
  43989. (line 75)
  43990. * ftrace: Create and Delete Tracepoints.
  43991. (line 50)
  43992. * Function: Functions In Python. (line 6)
  43993. * Function.invoke: Functions In Python. (line 19)
  43994. * Function.__init__: Functions In Python. (line 10)
  43995. * gcore: Core File Generation.
  43996. (line 17)
  43997. * gdb-object-kind: GDB Scheme Data Types.
  43998. (line 10)
  43999. * gdb-version: Guile Configuration. (line 17)
  44000. * gdb.Block: Blocks In Python. (line 6)
  44001. * gdb.block_for_pc: Blocks In Python. (line 64)
  44002. * gdb.block_for_pc <1>: Blocks In Python. (line 64)
  44003. * gdb.BP_ACCESS_WATCHPOINT: Breakpoints In Python.
  44004. (line 74)
  44005. * gdb.BP_BREAKPOINT: Breakpoints In Python.
  44006. (line 62)
  44007. * gdb.BP_HARDWARE_WATCHPOINT: Breakpoints In Python.
  44008. (line 68)
  44009. * gdb.BP_READ_WATCHPOINT: Breakpoints In Python.
  44010. (line 71)
  44011. * gdb.BP_WATCHPOINT: Breakpoints In Python.
  44012. (line 65)
  44013. * gdb.Breakpoint: Breakpoints In Python.
  44014. (line 6)
  44015. * gdb.breakpoints: Basic Python. (line 59)
  44016. * gdb.breakpoints <1>: Basic Python. (line 59)
  44017. * gdb.COMMAND_BREAKPOINTS: Commands In Python. (line 142)
  44018. * gdb.COMMAND_DATA: Commands In Python. (line 113)
  44019. * gdb.COMMAND_FILES: Commands In Python. (line 124)
  44020. * gdb.COMMAND_MAINTENANCE: Commands In Python. (line 171)
  44021. * gdb.COMMAND_NONE: Commands In Python. (line 103)
  44022. * gdb.COMMAND_OBSCURE: Commands In Python. (line 165)
  44023. * gdb.COMMAND_RUNNING: Commands In Python. (line 107)
  44024. * gdb.COMMAND_STACK: Commands In Python. (line 118)
  44025. * gdb.COMMAND_STATUS: Commands In Python. (line 136)
  44026. * gdb.COMMAND_SUPPORT: Commands In Python. (line 129)
  44027. * gdb.COMMAND_TRACEPOINTS: Commands In Python. (line 148)
  44028. * gdb.COMMAND_TUI: Commands In Python. (line 154)
  44029. * gdb.COMMAND_USER: Commands In Python. (line 159)
  44030. * gdb.COMPLETE_COMMAND: Commands In Python. (line 192)
  44031. * gdb.COMPLETE_EXPRESSION: Commands In Python. (line 200)
  44032. * gdb.COMPLETE_FILENAME: Commands In Python. (line 185)
  44033. * gdb.COMPLETE_LOCATION: Commands In Python. (line 188)
  44034. * gdb.COMPLETE_NONE: Commands In Python. (line 182)
  44035. * gdb.COMPLETE_SYMBOL: Commands In Python. (line 196)
  44036. * gdb.convenience_variable: Basic Python. (line 106)
  44037. * gdb.convenience_variable <1>: Basic Python. (line 106)
  44038. * gdb.current_objfile: Objfiles In Python. (line 15)
  44039. * gdb.current_objfile <1>: Objfiles In Python. (line 15)
  44040. * gdb.current_progspace: Progspaces In Python.
  44041. (line 14)
  44042. * gdb.current_progspace <1>: Progspaces In Python.
  44043. (line 14)
  44044. * gdb.current_recording: Recordings In Python.
  44045. (line 21)
  44046. * gdb.decode_line: Basic Python. (line 229)
  44047. * gdb.decode_line <1>: Basic Python. (line 229)
  44048. * gdb.default_visualizer: Pretty Printing API. (line 96)
  44049. * gdb.default_visualizer <1>: Pretty Printing API. (line 96)
  44050. * gdb.error: Exception Handling. (line 22)
  44051. * gdb.execute: Basic Python. (line 40)
  44052. * gdb.execute <1>: Basic Python. (line 40)
  44053. * gdb.find_pc_line: Basic Python. (line 132)
  44054. * gdb.find_pc_line <1>: Basic Python. (line 132)
  44055. * gdb.FinishBreakpoint: Finish Breakpoints in Python.
  44056. (line 6)
  44057. * gdb.flush: Basic Python. (line 193)
  44058. * gdb.flush <1>: Basic Python. (line 193)
  44059. * gdb.FrameDecorator: Frame Decorator API. (line 25)
  44060. * gdb.frame_stop_reason_string: Frames In Python. (line 29)
  44061. * gdb.Function: Functions In Python. (line 6)
  44062. * gdb.GdbError: Exception Handling. (line 48)
  44063. * gdb.history: Basic Python. (line 93)
  44064. * gdb.history <1>: Basic Python. (line 93)
  44065. * gdb.Inferior: Inferiors In Python. (line 6)
  44066. * gdb.InferiorCallPostEvent: Events In Python. (line 145)
  44067. * gdb.InferiorCallPreEvent: Events In Python. (line 135)
  44068. * gdb.inferiors: Inferiors In Python. (line 14)
  44069. * gdb.InferiorThread: Threads In Python. (line 6)
  44070. * gdb.invalidate_cached_frames: Frames In Python. (line 34)
  44071. * gdb.invalidate_cached_frames <1>: Frames In Python. (line 34)
  44072. * gdb.LazyString: Lazy Strings In Python.
  44073. (line 6)
  44074. * gdb.LineTable: Line Tables In Python.
  44075. (line 6)
  44076. * gdb.lookup_global_symbol: Symbols In Python. (line 33)
  44077. * gdb.lookup_global_symbol <1>: Symbols In Python. (line 33)
  44078. * gdb.lookup_objfile: Objfiles In Python. (line 28)
  44079. * gdb.lookup_objfile <1>: Objfiles In Python. (line 28)
  44080. * gdb.lookup_static_symbol: Symbols In Python. (line 45)
  44081. * gdb.lookup_static_symbol <1>: Symbols In Python. (line 45)
  44082. * gdb.lookup_static_symbols: Symbols In Python. (line 71)
  44083. * gdb.lookup_static_symbols <1>: Symbols In Python. (line 71)
  44084. * gdb.lookup_symbol: Symbols In Python. (line 13)
  44085. * gdb.lookup_symbol <1>: Symbols In Python. (line 13)
  44086. * gdb.lookup_type: Types In Python. (line 11)
  44087. * gdb.lookup_type <1>: Types In Python. (line 11)
  44088. * gdb.MemoryError: Exception Handling. (line 30)
  44089. * gdb.newest_frame: Frames In Python. (line 26)
  44090. * gdb.newest_frame <1>: Frames In Python. (line 26)
  44091. * gdb.Objfile: Objfiles In Python. (line 6)
  44092. * gdb.objfiles: Objfiles In Python. (line 21)
  44093. * gdb.objfiles <1>: Objfiles In Python. (line 21)
  44094. * gdb.Parameter: Parameters In Python.
  44095. (line 6)
  44096. * gdb.parameter: Basic Python. (line 82)
  44097. * gdb.parameter <1>: Basic Python. (line 82)
  44098. * gdb.PARAM_AUTO_BOOLEAN: Parameters In Python.
  44099. (line 116)
  44100. * gdb.PARAM_BOOLEAN: Parameters In Python.
  44101. (line 112)
  44102. * gdb.PARAM_ENUM: Parameters In Python.
  44103. (line 160)
  44104. * gdb.PARAM_FILENAME: Parameters In Python.
  44105. (line 142)
  44106. * gdb.PARAM_INTEGER: Parameters In Python.
  44107. (line 125)
  44108. * gdb.PARAM_OPTIONAL_FILENAME: Parameters In Python.
  44109. (line 139)
  44110. * gdb.PARAM_STRING: Parameters In Python.
  44111. (line 129)
  44112. * gdb.PARAM_STRING_NOESCAPE: Parameters In Python.
  44113. (line 135)
  44114. * gdb.PARAM_UINTEGER: Parameters In Python.
  44115. (line 121)
  44116. * gdb.PARAM_ZINTEGER: Parameters In Python.
  44117. (line 146)
  44118. * gdb.PARAM_ZUINTEGER: Parameters In Python.
  44119. (line 150)
  44120. * gdb.PARAM_ZUINTEGER_UNLIMITED: Parameters In Python.
  44121. (line 155)
  44122. * gdb.parse_and_eval: Basic Python. (line 122)
  44123. * gdb.parse_and_eval <1>: Basic Python. (line 122)
  44124. * gdb.post_event: Basic Python. (line 141)
  44125. * gdb.post_event <1>: Basic Python. (line 141)
  44126. * gdb.pretty_printers: Selecting Pretty-Printers.
  44127. (line 12)
  44128. * gdb.pretty_printers <1>: Selecting Pretty-Printers.
  44129. (line 12)
  44130. * gdb.Progspace: Progspaces In Python.
  44131. (line 6)
  44132. * gdb.progspaces: Progspaces In Python.
  44133. (line 20)
  44134. * gdb.progspaces <1>: Progspaces In Python.
  44135. (line 20)
  44136. * gdb.prompt_hook: Basic Python. (line 241)
  44137. * gdb.PYTHONDIR: Basic Python. (line 37)
  44138. * gdb.PYTHONDIR <1>: Basic Python. (line 37)
  44139. * gdb.rbreak: Basic Python. (line 66)
  44140. * gdb.register_window_type: TUI Windows In Python.
  44141. (line 8)
  44142. * gdb.register_window_type <1>: TUI Windows In Python.
  44143. (line 8)
  44144. * gdb.search_memory: Inferiors In Python. (line 71)
  44145. * gdb.selected_frame: Frames In Python. (line 22)
  44146. * gdb.selected_frame <1>: Frames In Python. (line 22)
  44147. * gdb.selected_inferior: Inferiors In Python. (line 17)
  44148. * gdb.selected_thread: Threads In Python. (line 13)
  44149. * gdb.selected_thread <1>: Threads In Python. (line 13)
  44150. * gdb.set_convenience_variable: Basic Python. (line 113)
  44151. * gdb.set_convenience_variable <1>: Basic Python. (line 113)
  44152. * gdb.solib_name: Basic Python. (line 223)
  44153. * gdb.solib_name <1>: Basic Python. (line 223)
  44154. * gdb.start_recording: Recordings In Python.
  44155. (line 9)
  44156. * gdb.STDERR: Basic Python. (line 183)
  44157. * gdb.STDERR <1>: Basic Python. (line 203)
  44158. * gdb.STDLOG: Basic Python. (line 186)
  44159. * gdb.STDLOG <1>: Basic Python. (line 206)
  44160. * gdb.STDOUT: Basic Python. (line 180)
  44161. * gdb.STDOUT <1>: Basic Python. (line 200)
  44162. * gdb.stop_recording: Recordings In Python.
  44163. (line 25)
  44164. * gdb.string_to_argv: Commands In Python. (line 61)
  44165. * gdb.Symbol: Symbols In Python. (line 6)
  44166. * gdb.SYMBOL_COMMON_BLOCK_DOMAIN: Symbols In Python. (line 178)
  44167. * gdb.SYMBOL_LABEL_DOMAIN: Symbols In Python. (line 172)
  44168. * gdb.SYMBOL_LOC_ARG: Symbols In Python. (line 197)
  44169. * gdb.SYMBOL_LOC_BLOCK: Symbols In Python. (line 218)
  44170. * gdb.SYMBOL_LOC_COMPUTED: Symbols In Python. (line 232)
  44171. * gdb.SYMBOL_LOC_COMPUTED <1>: Symbols In Python. (line 235)
  44172. * gdb.SYMBOL_LOC_CONST: Symbols In Python. (line 188)
  44173. * gdb.SYMBOL_LOC_CONST_BYTES: Symbols In Python. (line 221)
  44174. * gdb.SYMBOL_LOC_LOCAL: Symbols In Python. (line 211)
  44175. * gdb.SYMBOL_LOC_OPTIMIZED_OUT: Symbols In Python. (line 229)
  44176. * gdb.SYMBOL_LOC_REF_ARG: Symbols In Python. (line 201)
  44177. * gdb.SYMBOL_LOC_REGISTER: Symbols In Python. (line 194)
  44178. * gdb.SYMBOL_LOC_REGPARM_ADDR: Symbols In Python. (line 206)
  44179. * gdb.SYMBOL_LOC_STATIC: Symbols In Python. (line 191)
  44180. * gdb.SYMBOL_LOC_TYPEDEF: Symbols In Python. (line 214)
  44181. * gdb.SYMBOL_LOC_UNDEF: Symbols In Python. (line 184)
  44182. * gdb.SYMBOL_LOC_UNRESOLVED: Symbols In Python. (line 224)
  44183. * gdb.SYMBOL_MODULE_DOMAIN: Symbols In Python. (line 175)
  44184. * gdb.SYMBOL_STRUCT_DOMAIN: Symbols In Python. (line 169)
  44185. * gdb.SYMBOL_UNDEF_DOMAIN: Symbols In Python. (line 160)
  44186. * gdb.SYMBOL_VAR_DOMAIN: Symbols In Python. (line 165)
  44187. * gdb.Symtab: Symbol Tables In Python.
  44188. (line 6)
  44189. * gdb.Symtab_and_line: Symbol Tables In Python.
  44190. (line 6)
  44191. * gdb.target_charset: Basic Python. (line 212)
  44192. * gdb.target_charset <1>: Basic Python. (line 212)
  44193. * gdb.target_wide_charset: Basic Python. (line 217)
  44194. * gdb.target_wide_charset <1>: Basic Python. (line 217)
  44195. * gdb.Type: Types In Python. (line 6)
  44196. * gdb.TYPE_CODE_ARRAY: Types In Python. (line 228)
  44197. * gdb.TYPE_CODE_BITSTRING: Types In Python. (line 266)
  44198. * gdb.TYPE_CODE_BOOL: Types In Python. (line 290)
  44199. * gdb.TYPE_CODE_CHAR: Types In Python. (line 287)
  44200. * gdb.TYPE_CODE_COMPLEX: Types In Python. (line 293)
  44201. * gdb.TYPE_CODE_DECFLOAT: Types In Python. (line 302)
  44202. * gdb.TYPE_CODE_ENUM: Types In Python. (line 237)
  44203. * gdb.TYPE_CODE_ERROR: Types In Python. (line 269)
  44204. * gdb.TYPE_CODE_FLAGS: Types In Python. (line 240)
  44205. * gdb.TYPE_CODE_FLT: Types In Python. (line 249)
  44206. * gdb.TYPE_CODE_FUNC: Types In Python. (line 243)
  44207. * gdb.TYPE_CODE_INT: Types In Python. (line 246)
  44208. * gdb.TYPE_CODE_INTERNAL_FUNCTION: Types In Python. (line 305)
  44209. * gdb.TYPE_CODE_MEMBERPTR: Types In Python. (line 278)
  44210. * gdb.TYPE_CODE_METHOD: Types In Python. (line 272)
  44211. * gdb.TYPE_CODE_METHODPTR: Types In Python. (line 275)
  44212. * gdb.TYPE_CODE_NAMESPACE: Types In Python. (line 299)
  44213. * gdb.TYPE_CODE_PTR: Types In Python. (line 225)
  44214. * gdb.TYPE_CODE_RANGE: Types In Python. (line 258)
  44215. * gdb.TYPE_CODE_REF: Types In Python. (line 281)
  44216. * gdb.TYPE_CODE_RVALUE_REF: Types In Python. (line 284)
  44217. * gdb.TYPE_CODE_SET: Types In Python. (line 255)
  44218. * gdb.TYPE_CODE_STRING: Types In Python. (line 261)
  44219. * gdb.TYPE_CODE_STRUCT: Types In Python. (line 231)
  44220. * gdb.TYPE_CODE_TYPEDEF: Types In Python. (line 296)
  44221. * gdb.TYPE_CODE_UNION: Types In Python. (line 234)
  44222. * gdb.TYPE_CODE_VOID: Types In Python. (line 252)
  44223. * gdb.unwinder.register_unwinder: Unwinding Frames in Python.
  44224. (line 161)
  44225. * gdb.UnwindInfo.add_saved_register: Unwinding Frames in Python.
  44226. (line 111)
  44227. * gdb.WP_ACCESS: Breakpoints In Python.
  44228. (line 86)
  44229. * gdb.WP_READ: Breakpoints In Python.
  44230. (line 80)
  44231. * gdb.WP_WRITE: Breakpoints In Python.
  44232. (line 83)
  44233. * gdb.write: Basic Python. (line 175)
  44234. * gdb.write <1>: Basic Python. (line 175)
  44235. * gdb:error: Guile Exception Handling.
  44236. (line 69)
  44237. * gdb:invalid-object: Guile Exception Handling.
  44238. (line 72)
  44239. * gdb:memory-error: Guile Exception Handling.
  44240. (line 80)
  44241. * gdb:pp-type-error: Guile Exception Handling.
  44242. (line 84)
  44243. * gdbserver: Server. (line 6)
  44244. * gdb_init_reader: Writing JIT Debug Info Readers.
  44245. (line 20)
  44246. * generate-core-file: Core File Generation.
  44247. (line 17)
  44248. * get-basic-type: Guile Types Module. (line 13)
  44249. * getDebugChar: Bootstrapping. (line 14)
  44250. * gnu_debuglink_crc32: Separate Debug Files.
  44251. (line 163)
  44252. * gr: Guile Commands. (line 8)
  44253. * gu: Guile Commands. (line 15)
  44254. * guile: Guile Commands. (line 15)
  44255. * guile-data-directory: Guile Configuration. (line 13)
  44256. * guile-repl: Guile Commands. (line 8)
  44257. * h (help): Help. (line 9)
  44258. * handle: Signals. (line 49)
  44259. * handle_exception: Stub Contents. (line 15)
  44260. * hbreak: Set Breaks. (line 61)
  44261. * help: Help. (line 6)
  44262. * help function: Convenience Funs. (line 228)
  44263. * help target: Target Commands. (line 19)
  44264. * help user-defined: Define. (line 116)
  44265. * history-append!: Basic Guile. (line 105)
  44266. * history-preserve-point: Readline Init File Syntax.
  44267. (line 162)
  44268. * history-ref: Basic Guile. (line 87)
  44269. * history-search-backward (): Commands For History.
  44270. (line 52)
  44271. * history-search-forward (): Commands For History.
  44272. (line 46)
  44273. * history-size: Readline Init File Syntax.
  44274. (line 168)
  44275. * history-substring-search-backward (): Commands For History.
  44276. (line 64)
  44277. * history-substring-search-forward (): Commands For History.
  44278. (line 58)
  44279. * hook: Hooks. (line 6)
  44280. * hookpost: Hooks. (line 11)
  44281. * horizontal-scroll-mode: Readline Init File Syntax.
  44282. (line 177)
  44283. * host-config: Guile Configuration. (line 20)
  44284. * i (info): Help. (line 129)
  44285. * i (SingleKey TUI key): TUI Single Key Mode. (line 34)
  44286. * if: Command Files. (line 74)
  44287. * ignore: Conditions. (line 90)
  44288. * inferior INFNO: Inferiors Connections and Programs.
  44289. (line 85)
  44290. * Inferior.architecture: Inferiors In Python. (line 50)
  44291. * Inferior.is_valid: Inferiors In Python. (line 38)
  44292. * Inferior.num: Inferiors In Python. (line 22)
  44293. * Inferior.pid: Inferiors In Python. (line 25)
  44294. * Inferior.progspace: Inferiors In Python. (line 33)
  44295. * Inferior.read_memory: Inferiors In Python. (line 57)
  44296. * Inferior.read_memory <1>: Inferiors In Python. (line 57)
  44297. * Inferior.search_memory: Inferiors In Python. (line 71)
  44298. * Inferior.threads: Inferiors In Python. (line 45)
  44299. * Inferior.thread_from_handle: Inferiors In Python. (line 80)
  44300. * Inferior.thread_from_handle <1>: Inferiors In Python. (line 80)
  44301. * Inferior.thread_from_thread_handle: Inferiors In Python. (line 80)
  44302. * Inferior.was_attached: Inferiors In Python. (line 29)
  44303. * Inferior.write_memory: Inferiors In Python. (line 64)
  44304. * Inferior.write_memory <1>: Inferiors In Python. (line 64)
  44305. * InferiorCallPostEvent.address: Events In Python. (line 152)
  44306. * InferiorCallPostEvent.ptid: Events In Python. (line 149)
  44307. * InferiorCallPreEvent.address: Events In Python. (line 142)
  44308. * InferiorCallPreEvent.ptid: Events In Python. (line 139)
  44309. * InferiorThread.global_num: Threads In Python. (line 35)
  44310. * InferiorThread.handle: Threads In Python. (line 74)
  44311. * InferiorThread.inferior: Threads In Python. (line 48)
  44312. * InferiorThread.is_exited: Threads In Python. (line 71)
  44313. * InferiorThread.is_running: Threads In Python. (line 68)
  44314. * InferiorThread.is_stopped: Threads In Python. (line 65)
  44315. * InferiorThread.is_valid: Threads In Python. (line 54)
  44316. * InferiorThread.name: Threads In Python. (line 22)
  44317. * InferiorThread.num: Threads In Python. (line 32)
  44318. * InferiorThread.ptid: Threads In Python. (line 40)
  44319. * InferiorThread.switch: Threads In Python. (line 61)
  44320. * info: Help. (line 129)
  44321. * info address: Symbols. (line 85)
  44322. * info all-registers: Registers. (line 15)
  44323. * info args: Frame Info. (line 43)
  44324. * info auto-load: Auto-loading. (line 60)
  44325. * info auto-load gdb-scripts: Auto-loading sequences.
  44326. (line 21)
  44327. * info auto-load guile-scripts: Guile Auto-loading. (line 23)
  44328. * info auto-load libthread-db: libthread_db.so.1 file.
  44329. (line 29)
  44330. * info auto-load local-gdbinit: Init File in the Current Directory.
  44331. (line 22)
  44332. * info auto-load python-scripts: Python Auto-loading. (line 23)
  44333. * info auxv: OS Information. (line 20)
  44334. * info breakpoints: Set Breaks. (line 133)
  44335. * info checkpoints: Checkpoint/Restart. (line 31)
  44336. * info classes: Symbols. (line 570)
  44337. * info common: Special Fortran Commands.
  44338. (line 9)
  44339. * info connections [ ID... ]: Inferiors Connections and Programs.
  44340. (line 58)
  44341. * info copying: Help. (line 167)
  44342. * info dcache: Caching Target Data. (line 46)
  44343. * info display: Auto Display. (line 78)
  44344. * info dll: Files. (line 336)
  44345. * info dos: DJGPP Native. (line 15)
  44346. * info exceptions: Ada Exceptions. (line 8)
  44347. * info extensions: Show. (line 34)
  44348. * info f (info frame): Frame Info. (line 17)
  44349. * info files: Files. (line 211)
  44350. * info float: Floating Point Hardware.
  44351. (line 9)
  44352. * info frame: Frame Info. (line 17)
  44353. * info frame, show the source language: Show. (line 15)
  44354. * info frame-filter: Frame Filter Management.
  44355. (line 12)
  44356. * info functions: Symbols. (line 467)
  44357. * info handle: Signals. (line 33)
  44358. * info inferiors [ ID... ]: Inferiors Connections and Programs.
  44359. (line 27)
  44360. * info io_registers, AVR: AVR. (line 10)
  44361. * info line: Machine Code. (line 14)
  44362. * info line, and Objective-C: Method Names in Commands.
  44363. (line 9)
  44364. * info locals: Frame Info. (line 67)
  44365. * info macro: Macros. (line 47)
  44366. * info macros: Macros. (line 54)
  44367. * info mem: Memory Region Attributes.
  44368. (line 45)
  44369. * info meminfo: Process Information. (line 131)
  44370. * info module: Symbols. (line 555)
  44371. * info modules: Symbols. (line 547)
  44372. * info os: OS Information. (line 37)
  44373. * info os cpus: OS Information. (line 43)
  44374. * info os files: OS Information. (line 51)
  44375. * info os modules: OS Information. (line 57)
  44376. * info os msg: OS Information. (line 64)
  44377. * info os processes: OS Information. (line 75)
  44378. * info os procgroups: OS Information. (line 84)
  44379. * info os semaphores: OS Information. (line 94)
  44380. * info os shm: OS Information. (line 102)
  44381. * info os sockets: OS Information. (line 112)
  44382. * info os threads: OS Information. (line 119)
  44383. * info pidlist: Process Information. (line 127)
  44384. * info pretty-printer: Pretty-Printer Commands.
  44385. (line 6)
  44386. * info probes: Static Probe Points. (line 32)
  44387. * info proc: Process Information. (line 25)
  44388. * info program: Stopping. (line 18)
  44389. * info record: Process Record and Replay.
  44390. (line 323)
  44391. * info registers: Registers. (line 11)
  44392. * info scope: Symbols. (line 415)
  44393. * info selectors: Symbols. (line 576)
  44394. * info serial: DJGPP Native. (line 139)
  44395. * info set: Help. (line 150)
  44396. * info share: Files. (line 330)
  44397. * info sharedlibrary: Files. (line 330)
  44398. * info signals: Signals. (line 33)
  44399. * info skip: Skipping Over Functions and Files.
  44400. (line 113)
  44401. * info source: Symbols. (line 436)
  44402. * info source, show the source language: Show. (line 21)
  44403. * info sources: Symbols. (line 452)
  44404. * info stack: Backtrace. (line 94)
  44405. * info static-tracepoint-markers: Listing Static Tracepoint Markers.
  44406. (line 6)
  44407. * info symbol: Symbols. (line 95)
  44408. * info target: Files. (line 211)
  44409. * info task TASKNO: Ada Tasks. (line 88)
  44410. * info tasks: Ada Tasks. (line 9)
  44411. * info terminal: Input/Output. (line 12)
  44412. * info threads: Threads. (line 115)
  44413. * info tp [N...]: Listing Tracepoints. (line 6)
  44414. * info tracepoints [N...]: Listing Tracepoints. (line 6)
  44415. * info tvariables: Trace State Variables.
  44416. (line 37)
  44417. * info type-printers: Symbols. (line 403)
  44418. * info types: Symbols. (line 378)
  44419. * info variables: Symbols. (line 512)
  44420. * info vector: Vector Unit. (line 9)
  44421. * info w32: Cygwin Native. (line 19)
  44422. * info warranty: Help. (line 171)
  44423. * info watchpoints [LIST...]: Set Watchpoints. (line 87)
  44424. * info win: TUI Commands. (line 26)
  44425. * info-gdb-mi-command: GDB/MI Support Commands.
  44426. (line 99)
  44427. * init-if-undefined: Convenience Vars. (line 42)
  44428. * input-meta: Readline Init File Syntax.
  44429. (line 184)
  44430. * input-port: I/O Ports in Guile. (line 6)
  44431. * insert-comment (M-#): Miscellaneous Commands.
  44432. (line 61)
  44433. * insert-completions (M-*): Commands For Completion.
  44434. (line 18)
  44435. * inspect: Data. (line 6)
  44436. * instantiate on type_printer: Type Printing API. (line 22)
  44437. * Instruction.data: Recordings In Python.
  44438. (line 69)
  44439. * Instruction.decoded: Recordings In Python.
  44440. (line 73)
  44441. * Instruction.pc: Recordings In Python.
  44442. (line 66)
  44443. * Instruction.size: Recordings In Python.
  44444. (line 76)
  44445. * interpreter-exec: Interpreters. (line 39)
  44446. * interrupt: Background Execution.
  44447. (line 59)
  44448. * isearch-terminators: Readline Init File Syntax.
  44449. (line 192)
  44450. * iterator->list: Iterators In Guile. (line 83)
  44451. * iterator-filter: Iterators In Guile. (line 94)
  44452. * iterator-for-each: Iterators In Guile. (line 90)
  44453. * iterator-map: Iterators In Guile. (line 86)
  44454. * iterator-next!: Iterators In Guile. (line 63)
  44455. * iterator-object: Iterators In Guile. (line 53)
  44456. * iterator-progress: Iterators In Guile. (line 57)
  44457. * iterator-until: Iterators In Guile. (line 98)
  44458. * iterator?: Iterators In Guile. (line 49)
  44459. * j (jump): Jumping. (line 10)
  44460. * jit-reader-load: Using JIT Debug Info Readers.
  44461. (line 6)
  44462. * jit-reader-unload: Using JIT Debug Info Readers.
  44463. (line 6)
  44464. * jump: Jumping. (line 10)
  44465. * jump, and Objective-C: Method Names in Commands.
  44466. (line 9)
  44467. * KeyboardInterrupt: Exception Handling. (line 34)
  44468. * keymap: Readline Init File Syntax.
  44469. (line 199)
  44470. * kill: Kill Process. (line 6)
  44471. * kill inferiors INFNO...: Inferiors Connections and Programs.
  44472. (line 154)
  44473. * kill-line (C-k): Commands For Killing.
  44474. (line 6)
  44475. * kill-region (): Commands For Killing.
  44476. (line 41)
  44477. * kill-whole-line (): Commands For Killing.
  44478. (line 15)
  44479. * kill-word (M-d): Commands For Killing.
  44480. (line 19)
  44481. * kvm: BSD libkvm Interface.
  44482. (line 24)
  44483. * l (list): List. (line 6)
  44484. * language-option: GDB/MI Support Commands.
  44485. (line 96)
  44486. * layout: TUI Commands. (line 75)
  44487. * lazy-string->value: Lazy Strings In Guile.
  44488. (line 46)
  44489. * lazy-string-address: Lazy Strings In Guile.
  44490. (line 26)
  44491. * lazy-string-encoding: Lazy Strings In Guile.
  44492. (line 34)
  44493. * lazy-string-length: Lazy Strings In Guile.
  44494. (line 29)
  44495. * lazy-string-type: Lazy Strings In Guile.
  44496. (line 40)
  44497. * lazy-string?: Lazy Strings In Guile.
  44498. (line 22)
  44499. * LazyString.address: Lazy Strings In Python.
  44500. (line 26)
  44501. * LazyString.encoding: Lazy Strings In Python.
  44502. (line 36)
  44503. * LazyString.length: Lazy Strings In Python.
  44504. (line 30)
  44505. * LazyString.type: Lazy Strings In Python.
  44506. (line 43)
  44507. * LazyString.value: Lazy Strings In Python.
  44508. (line 20)
  44509. * Left: TUI Keys. (line 73)
  44510. * LineTable.has_line: Line Tables In Python.
  44511. (line 57)
  44512. * LineTable.line: Line Tables In Python.
  44513. (line 51)
  44514. * LineTable.source_lines: Line Tables In Python.
  44515. (line 62)
  44516. * LineTableEntry.line: Line Tables In Python.
  44517. (line 16)
  44518. * LineTableEntry.pc: Line Tables In Python.
  44519. (line 21)
  44520. * list: List. (line 6)
  44521. * list, and Objective-C: Method Names in Commands.
  44522. (line 9)
  44523. * load FILENAME OFFSET: Target Commands. (line 114)
  44524. * lookup-block: Blocks In Guile. (line 117)
  44525. * lookup-global-symbol: Symbols In Guile. (line 99)
  44526. * lookup-symbol: Symbols In Guile. (line 79)
  44527. * lookup-type: Types In Guile. (line 15)
  44528. * loop_break: Command Files. (line 93)
  44529. * loop_continue: Command Files. (line 97)
  44530. * macro define: Macros. (line 59)
  44531. * macro exp1: Macros. (line 36)
  44532. * macro expand: Macros. (line 29)
  44533. * macro list: Macros. (line 80)
  44534. * macro undef: Macros. (line 74)
  44535. * maint ada set ignore-descriptive-types: Ada Glitches. (line 73)
  44536. * maint ada show ignore-descriptive-types: Ada Glitches. (line 77)
  44537. * maint agent: Maintenance Commands.
  44538. (line 11)
  44539. * maint agent-eval: Maintenance Commands.
  44540. (line 11)
  44541. * maint agent-printf: Maintenance Commands.
  44542. (line 26)
  44543. * maint btrace clear: Maintenance Commands.
  44544. (line 99)
  44545. * maint btrace clear-packet-history: Maintenance Commands.
  44546. (line 94)
  44547. * maint btrace packet-history: Maintenance Commands.
  44548. (line 65)
  44549. * maint check libthread-db: Maintenance Commands.
  44550. (line 252)
  44551. * maint check xml-descriptions: Maintenance Commands.
  44552. (line 248)
  44553. * maint check-psymtabs: Maintenance Commands.
  44554. (line 134)
  44555. * maint check-symtabs: Maintenance Commands.
  44556. (line 139)
  44557. * maint cplus first_component: Maintenance Commands.
  44558. (line 154)
  44559. * maint cplus namespace: Maintenance Commands.
  44560. (line 157)
  44561. * maint demangler-warning: Maintenance Commands.
  44562. (line 173)
  44563. * maint deprecate: Maintenance Commands.
  44564. (line 160)
  44565. * maint dump-me: Maintenance Commands.
  44566. (line 168)
  44567. * maint expand-symtabs: Maintenance Commands.
  44568. (line 142)
  44569. * maint flush-symbol-cache: Symbols. (line 714)
  44570. * maint info bdccsr, S12Z: S12Z. (line 10)
  44571. * maint info bfds: File Caching. (line 10)
  44572. * maint info breakpoints: Maintenance Commands.
  44573. (line 32)
  44574. * maint info btrace: Maintenance Commands.
  44575. (line 62)
  44576. * maint info line-table: Symbols. (line 692)
  44577. * maint info program-spaces: Inferiors Connections and Programs.
  44578. (line 191)
  44579. * maint info psymtabs: Symbols. (line 645)
  44580. * maint info sections: Files. (line 220)
  44581. * maint info selftests: Maintenance Commands.
  44582. (line 380)
  44583. * maint info sol-threads: Threads. (line 167)
  44584. * maint info symtabs: Symbols. (line 645)
  44585. * maint internal-error: Maintenance Commands.
  44586. (line 173)
  44587. * maint internal-warning: Maintenance Commands.
  44588. (line 173)
  44589. * maint packet: Maintenance Commands.
  44590. (line 220)
  44591. * maint print arc arc-instruction: ARC. (line 17)
  44592. * maint print architecture: Maintenance Commands.
  44593. (line 226)
  44594. * maint print c-tdesc [FILE]: Maintenance Commands.
  44595. (line 230)
  44596. * maint print cooked-registers: Maintenance Commands.
  44597. (line 282)
  44598. * maint print core-file-backed-mappings: Maintenance Commands.
  44599. (line 260)
  44600. * maint print dummy-frames: Maintenance Commands.
  44601. (line 266)
  44602. * maint print msymbols: Symbols. (line 619)
  44603. * maint print objfiles: Maintenance Commands.
  44604. (line 320)
  44605. * maint print psymbols: Symbols. (line 619)
  44606. * maint print raw-registers: Maintenance Commands.
  44607. (line 282)
  44608. * maint print reggroups: Maintenance Commands.
  44609. (line 301)
  44610. * maint print register-groups: Maintenance Commands.
  44611. (line 282)
  44612. * maint print registers: Maintenance Commands.
  44613. (line 282)
  44614. * maint print remote-registers: Maintenance Commands.
  44615. (line 282)
  44616. * maint print section-scripts: Maintenance Commands.
  44617. (line 335)
  44618. * maint print statistics: Maintenance Commands.
  44619. (line 342)
  44620. * maint print symbol-cache: Symbols. (line 706)
  44621. * maint print symbol-cache-statistics: Symbols. (line 710)
  44622. * maint print symbols: Symbols. (line 619)
  44623. * maint print target-stack: Maintenance Commands.
  44624. (line 355)
  44625. * maint print type: Maintenance Commands.
  44626. (line 367)
  44627. * maint print unwind, HPPA: HPPA. (line 17)
  44628. * maint print user-registers: Maintenance Commands.
  44629. (line 326)
  44630. * maint print xml-tdesc: Maintenance Commands.
  44631. (line 240)
  44632. * maint selftest: Maintenance Commands.
  44633. (line 374)
  44634. * maint set bfd-sharing: File Caching. (line 14)
  44635. * maint set btrace pt skip-pad: Maintenance Commands.
  44636. (line 107)
  44637. * maint set catch-demangler-crashes: Maintenance Commands.
  44638. (line 146)
  44639. * maint set check-libthread-db: Maintenance Commands.
  44640. (line 560)
  44641. * maint set demangler-warning: Maintenance Commands.
  44642. (line 197)
  44643. * maint set dwarf always-disassemble: Maintenance Commands.
  44644. (line 383)
  44645. * maint set dwarf max-cache-age: Maintenance Commands.
  44646. (line 404)
  44647. * maint set dwarf unwinders: Maintenance Commands.
  44648. (line 418)
  44649. * maint set internal-error: Maintenance Commands.
  44650. (line 197)
  44651. * maint set internal-warning: Maintenance Commands.
  44652. (line 197)
  44653. * maint set per-command: Maintenance Commands.
  44654. (line 521)
  44655. * maint set profile: Maintenance Commands.
  44656. (line 452)
  44657. * maint set show-all-tib: Maintenance Commands.
  44658. (line 476)
  44659. * maint set show-debug-regs: Maintenance Commands.
  44660. (line 468)
  44661. * maint set symbol-cache-size: Symbols. (line 698)
  44662. * maint set target-async: Maintenance Commands.
  44663. (line 482)
  44664. * maint set target-non-stop MODE [on|off|auto]: Maintenance Commands.
  44665. (line 490)
  44666. * maint set test-settings: Maintenance Commands.
  44667. (line 609)
  44668. * maint set tui-resize-message: Maintenance Commands.
  44669. (line 510)
  44670. * maint set worker-threads: Maintenance Commands.
  44671. (line 441)
  44672. * maint show bfd-sharing: File Caching. (line 14)
  44673. * maint show btrace pt skip-pad: Maintenance Commands.
  44674. (line 108)
  44675. * maint show catch-demangler-crashes: Maintenance Commands.
  44676. (line 146)
  44677. * maint show check-libthread-db: Maintenance Commands.
  44678. (line 560)
  44679. * maint show demangler-warning: Maintenance Commands.
  44680. (line 197)
  44681. * maint show dwarf always-disassemble: Maintenance Commands.
  44682. (line 383)
  44683. * maint show dwarf max-cache-age: Maintenance Commands.
  44684. (line 404)
  44685. * maint show dwarf unwinders: Maintenance Commands.
  44686. (line 418)
  44687. * maint show internal-error: Maintenance Commands.
  44688. (line 197)
  44689. * maint show internal-warning: Maintenance Commands.
  44690. (line 197)
  44691. * maint show per-command: Maintenance Commands.
  44692. (line 521)
  44693. * maint show profile: Maintenance Commands.
  44694. (line 452)
  44695. * maint show show-all-tib: Maintenance Commands.
  44696. (line 476)
  44697. * maint show show-debug-regs: Maintenance Commands.
  44698. (line 468)
  44699. * maint show symbol-cache-size: Symbols. (line 703)
  44700. * maint show target-async: Maintenance Commands.
  44701. (line 482)
  44702. * maint show target-non-stop: Maintenance Commands.
  44703. (line 490)
  44704. * maint show test-options-completion-result: Maintenance Commands.
  44705. (line 604)
  44706. * maint show test-settings: Maintenance Commands.
  44707. (line 609)
  44708. * maint show tui-resize-message: Maintenance Commands.
  44709. (line 510)
  44710. * maint show worker-threads: Maintenance Commands.
  44711. (line 441)
  44712. * maint space: Maintenance Commands.
  44713. (line 569)
  44714. * maint test-options: Maintenance Commands.
  44715. (line 590)
  44716. * maint time: Maintenance Commands.
  44717. (line 573)
  44718. * maint translate-address: Maintenance Commands.
  44719. (line 577)
  44720. * maint undeprecate: Maintenance Commands.
  44721. (line 160)
  44722. * maint with: Maintenance Commands.
  44723. (line 615)
  44724. * make: Shell Commands. (line 22)
  44725. * make-block-symbols-iterator: Blocks In Guile. (line 105)
  44726. * make-breakpoint: Breakpoints In Guile.
  44727. (line 19)
  44728. * make-enum-hashtable: Guile Types Module. (line 37)
  44729. * make-exception: Guile Exception Handling.
  44730. (line 91)
  44731. * make-field-iterator: Types In Guile. (line 125)
  44732. * make-iterator: Iterators In Guile. (line 11)
  44733. * make-lazy-value: Values From Inferior In Guile.
  44734. (line 327)
  44735. * make-list-iterator: Iterators In Guile. (line 80)
  44736. * make-pretty-printer: Guile Pretty Printing API.
  44737. (line 15)
  44738. * make-pretty-printer-worker: Guile Pretty Printing API.
  44739. (line 42)
  44740. * make-value: Values From Inferior In Guile.
  44741. (line 45)
  44742. * mark-modified-lines: Readline Init File Syntax.
  44743. (line 229)
  44744. * mark-symlinked-directories: Readline Init File Syntax.
  44745. (line 234)
  44746. * match-hidden-files: Readline Init File Syntax.
  44747. (line 239)
  44748. * may-insert-breakpoints: Observer Mode. (line 50)
  44749. * may-insert-fast-tracepoints: Observer Mode. (line 69)
  44750. * may-insert-tracepoints: Observer Mode. (line 59)
  44751. * may-interrupt: Observer Mode. (line 79)
  44752. * may-write-memory: Observer Mode. (line 41)
  44753. * may-write-registers: Observer Mode. (line 32)
  44754. * mem: Memory Region Attributes.
  44755. (line 22)
  44756. * memory-port-range: Memory Ports in Guile.
  44757. (line 33)
  44758. * memory-port-read-buffer-size: Memory Ports in Guile.
  44759. (line 37)
  44760. * memory-port-write-buffer-size: Memory Ports in Guile.
  44761. (line 52)
  44762. * memory-port?: Memory Ports in Guile.
  44763. (line 29)
  44764. * MemoryChangedEvent.address: Events In Python. (line 162)
  44765. * MemoryChangedEvent.length: Events In Python. (line 165)
  44766. * memset: Bootstrapping. (line 70)
  44767. * menu-complete (): Commands For Completion.
  44768. (line 22)
  44769. * menu-complete-backward (): Commands For Completion.
  44770. (line 34)
  44771. * menu-complete-display-prefix: Readline Init File Syntax.
  44772. (line 246)
  44773. * meta-flag: Readline Init File Syntax.
  44774. (line 184)
  44775. * methods: Xmethod API. (line 22)
  44776. * monitor: Connecting. (line 279)
  44777. * n (next): Continuing and Stepping.
  44778. (line 77)
  44779. * n (SingleKey TUI key): TUI Single Key Mode. (line 19)
  44780. * name: Xmethod API. (line 15)
  44781. * name of type_printer: Type Printing API. (line 18)
  44782. * new-ui: Interpreters. (line 68)
  44783. * newest-frame: Frames In Guile. (line 160)
  44784. * NewInferiorEvent.inferior: Events In Python. (line 204)
  44785. * NewInferiorEvent.inferior <1>: Events In Python. (line 215)
  44786. * NewObjFileEvent.new_objfile: Events In Python. (line 115)
  44787. * NewThreadEvent.inferior_thread: Events In Python. (line 223)
  44788. * next: Continuing and Stepping.
  44789. (line 77)
  44790. * next&: Background Execution.
  44791. (line 34)
  44792. * next-history (C-n): Commands For History.
  44793. (line 16)
  44794. * next-screen-line (): Commands For Moving. (line 33)
  44795. * nexti: Continuing and Stepping.
  44796. (line 209)
  44797. * nexti&: Background Execution.
  44798. (line 37)
  44799. * ni (nexti): Continuing and Stepping.
  44800. (line 209)
  44801. * non-incremental-forward-search-history (M-n): Commands For History.
  44802. (line 40)
  44803. * non-incremental-reverse-search-history (M-p): Commands For History.
  44804. (line 34)
  44805. * nosharedlibrary: Files. (line 348)
  44806. * o (SingleKey TUI key): TUI Single Key Mode. (line 22)
  44807. * Objfile: Objfiles In Python. (line 6)
  44808. * objfile-filename: Objfiles In Guile. (line 28)
  44809. * objfile-pretty-printers: Objfiles In Guile. (line 36)
  44810. * objfile-progspace: Objfiles In Guile. (line 32)
  44811. * objfile-valid?: Objfiles In Guile. (line 21)
  44812. * Objfile.add_separate_debug_file: Objfiles In Python. (line 127)
  44813. * Objfile.build_id: Objfiles In Python. (line 69)
  44814. * Objfile.filename: Objfiles In Python. (line 49)
  44815. * Objfile.frame_filters: Objfiles In Python. (line 95)
  44816. * Objfile.is_valid: Objfiles In Python. (line 120)
  44817. * Objfile.lookup_global_symbol: Objfiles In Python. (line 136)
  44818. * Objfile.lookup_static_symbol: Objfiles In Python. (line 147)
  44819. * Objfile.owner: Objfiles In Python. (line 62)
  44820. * Objfile.pretty_printers: Objfiles In Python. (line 83)
  44821. * Objfile.progspace: Objfiles In Python. (line 79)
  44822. * Objfile.type_printers: Objfiles In Python. (line 91)
  44823. * Objfile.username: Objfiles In Python. (line 56)
  44824. * objfile?: Objfiles In Guile. (line 17)
  44825. * objfiles: Objfiles In Guile. (line 52)
  44826. * observer: Observer Mode. (line 22)
  44827. * open-memory: Memory Ports in Guile.
  44828. (line 11)
  44829. * output: Output. (line 35)
  44830. * output-meta: Readline Init File Syntax.
  44831. (line 251)
  44832. * output-port: I/O Ports in Guile. (line 9)
  44833. * overlay: Overlay Commands. (line 17)
  44834. * overload-choice annotation: Prompting. (line 32)
  44835. * overwrite-mode (): Commands For Text. (line 68)
  44836. * page-completions: Readline Init File Syntax.
  44837. (line 257)
  44838. * Parameter: Parameters In Python.
  44839. (line 6)
  44840. * Parameter <1>: Parameters In Guile. (line 6)
  44841. * parameter-value: Parameters In Guile. (line 103)
  44842. * Parameter.get_set_string: Parameters In Python.
  44843. (line 73)
  44844. * Parameter.get_show_string: Parameters In Python.
  44845. (line 102)
  44846. * Parameter.set_doc: Parameters In Python.
  44847. (line 53)
  44848. * Parameter.show_doc: Parameters In Python.
  44849. (line 59)
  44850. * Parameter.value: Parameters In Python.
  44851. (line 65)
  44852. * Parameter.__init__: Parameters In Python.
  44853. (line 18)
  44854. * parameter?: Parameters In Guile. (line 99)
  44855. * PARAM_AUTO_BOOLEAN: Parameters In Python.
  44856. (line 116)
  44857. * PARAM_AUTO_BOOLEAN <1>: Parameters In Guile. (line 120)
  44858. * PARAM_BOOLEAN: Parameters In Python.
  44859. (line 112)
  44860. * PARAM_BOOLEAN <1>: Parameters In Guile. (line 116)
  44861. * PARAM_ENUM: Parameters In Python.
  44862. (line 160)
  44863. * PARAM_ENUM <1>: Parameters In Guile. (line 156)
  44864. * PARAM_FILENAME: Parameters In Python.
  44865. (line 142)
  44866. * PARAM_FILENAME <1>: Parameters In Guile. (line 152)
  44867. * PARAM_INTEGER: Parameters In Python.
  44868. (line 125)
  44869. * PARAM_OPTIONAL_FILENAME: Parameters In Python.
  44870. (line 139)
  44871. * PARAM_OPTIONAL_FILENAME <1>: Parameters In Guile. (line 149)
  44872. * PARAM_STRING: Parameters In Python.
  44873. (line 129)
  44874. * PARAM_STRING <1>: Parameters In Guile. (line 139)
  44875. * PARAM_STRING_NOESCAPE: Parameters In Python.
  44876. (line 135)
  44877. * PARAM_STRING_NOESCAPE <1>: Parameters In Guile. (line 145)
  44878. * PARAM_UINTEGER: Parameters In Python.
  44879. (line 121)
  44880. * PARAM_UINTEGER <1>: Parameters In Guile. (line 125)
  44881. * PARAM_ZINTEGER: Parameters In Python.
  44882. (line 146)
  44883. * PARAM_ZINTEGER <1>: Parameters In Guile. (line 129)
  44884. * PARAM_ZUINTEGER: Parameters In Python.
  44885. (line 150)
  44886. * PARAM_ZUINTEGER <1>: Parameters In Guile. (line 132)
  44887. * PARAM_ZUINTEGER_UNLIMITED: Parameters In Python.
  44888. (line 155)
  44889. * PARAM_ZUINTEGER_UNLIMITED <1>: Parameters In Guile. (line 135)
  44890. * parse-and-eval: Basic Guile. (line 113)
  44891. * passcount: Tracepoint Passcounts.
  44892. (line 6)
  44893. * path: Environment. (line 14)
  44894. * pending-breakpoints: GDB/MI Support Commands.
  44895. (line 79)
  44896. * PendingFrame.architecture: Unwinding Frames in Python.
  44897. (line 99)
  44898. * PendingFrame.create_unwind_info: Unwinding Frames in Python.
  44899. (line 66)
  44900. * PendingFrame.read_register: Unwinding Frames in Python.
  44901. (line 42)
  44902. * PgDn: TUI Keys. (line 64)
  44903. * PgUp: TUI Keys. (line 61)
  44904. * pi: Python Commands. (line 9)
  44905. * pipe: Shell Commands. (line 26)
  44906. * po (print-object): The Print Command with Objective-C.
  44907. (line 6)
  44908. * possible-completions (M-?): Commands For Completion.
  44909. (line 11)
  44910. * post-commands annotation: Prompting. (line 27)
  44911. * post-overload-choice annotation: Prompting. (line 32)
  44912. * post-prompt annotation: Prompting. (line 24)
  44913. * post-prompt-for-continue annotation: Prompting. (line 40)
  44914. * post-query annotation: Prompting. (line 36)
  44915. * pre-commands annotation: Prompting. (line 27)
  44916. * pre-overload-choice annotation: Prompting. (line 32)
  44917. * pre-prompt annotation: Prompting. (line 24)
  44918. * pre-prompt-for-continue annotation: Prompting. (line 40)
  44919. * pre-query annotation: Prompting. (line 36)
  44920. * prefix-meta (<ESC>): Miscellaneous Commands.
  44921. (line 19)
  44922. * prepend-pretty-printer!: Guile Printing Module.
  44923. (line 13)
  44924. * pretty-printer-enabled?: Guile Pretty Printing API.
  44925. (line 28)
  44926. * pretty-printer?: Guile Pretty Printing API.
  44927. (line 24)
  44928. * pretty-printers: Guile Pretty Printing API.
  44929. (line 35)
  44930. * pretty_printer.children: Pretty Printing API. (line 10)
  44931. * pretty_printer.display_hint: Pretty Printing API. (line 32)
  44932. * pretty_printer.to_string: Pretty Printing API. (line 64)
  44933. * previous-history (C-p): Commands For History.
  44934. (line 12)
  44935. * previous-screen-line (): Commands For Moving. (line 26)
  44936. * print: Data. (line 6)
  44937. * print-last-kbd-macro (): Keyboard Macros. (line 17)
  44938. * print-object: The Print Command with Objective-C.
  44939. (line 6)
  44940. * printf: Output. (line 46)
  44941. * proc-trace-entry: Process Information. (line 123)
  44942. * proc-trace-exit: Process Information. (line 123)
  44943. * proc-untrace-entry: Process Information. (line 123)
  44944. * proc-untrace-exit: Process Information. (line 123)
  44945. * Progspace: Progspaces In Python.
  44946. (line 6)
  44947. * progspace-filename: Progspaces In Guile. (line 34)
  44948. * progspace-objfiles: Progspaces In Guile. (line 44)
  44949. * progspace-pretty-printers: Progspaces In Guile. (line 52)
  44950. * progspace-valid?: Progspaces In Guile. (line 21)
  44951. * Progspace.block_for_pc: Progspaces In Python.
  44952. (line 47)
  44953. * Progspace.block_for_pc <1>: Progspaces In Python.
  44954. (line 47)
  44955. * Progspace.filename: Progspaces In Python.
  44956. (line 26)
  44957. * Progspace.find_pc_line: Progspaces In Python.
  44958. (line 52)
  44959. * Progspace.find_pc_line <1>: Progspaces In Python.
  44960. (line 52)
  44961. * Progspace.frame_filters: Progspaces In Python.
  44962. (line 41)
  44963. * Progspace.is_valid: Progspaces In Python.
  44964. (line 59)
  44965. * Progspace.is_valid <1>: Progspaces In Python.
  44966. (line 59)
  44967. * Progspace.objfiles: Progspaces In Python.
  44968. (line 66)
  44969. * Progspace.objfiles <1>: Progspaces In Python.
  44970. (line 66)
  44971. * Progspace.pretty_printers: Progspaces In Python.
  44972. (line 29)
  44973. * Progspace.solib_name: Progspaces In Python.
  44974. (line 70)
  44975. * Progspace.solib_name <1>: Progspaces In Python.
  44976. (line 70)
  44977. * Progspace.type_printers: Progspaces In Python.
  44978. (line 37)
  44979. * progspace?: Progspaces In Guile. (line 17)
  44980. * progspaces: Progspaces In Guile. (line 31)
  44981. * prompt annotation: Prompting. (line 24)
  44982. * prompt-for-continue annotation: Prompting. (line 40)
  44983. * ptype: Symbols. (line 298)
  44984. * putDebugChar: Bootstrapping. (line 20)
  44985. * pwd: Working Directory. (line 40)
  44986. * py: Python Commands. (line 23)
  44987. * python: GDB/MI Support Commands.
  44988. (line 82)
  44989. * python <1>: Python Commands. (line 23)
  44990. * python-interactive: Python Commands. (line 9)
  44991. * q (quit): Quitting GDB. (line 6)
  44992. * q (SingleKey TUI key): TUI Single Key Mode. (line 25)
  44993. * query annotation: Prompting. (line 36)
  44994. * queue-signal: Signaling. (line 36)
  44995. * quit annotation: Errors. (line 6)
  44996. * quit [EXPRESSION]: Quitting GDB. (line 6)
  44997. * quoted-insert (C-q or C-v): Commands For Text. (line 26)
  44998. * r (run): Starting. (line 6)
  44999. * r (SingleKey TUI key): TUI Single Key Mode. (line 28)
  45000. * rbreak: Set Breaks. (line 90)
  45001. * rc (reverse-continue): Reverse Execution. (line 36)
  45002. * re-read-init-file (C-x C-r): Miscellaneous Commands.
  45003. (line 6)
  45004. * readnow: Files. (line 94)
  45005. * rec: Process Record and Replay.
  45006. (line 43)
  45007. * rec btrace: Process Record and Replay.
  45008. (line 43)
  45009. * rec btrace bts: Process Record and Replay.
  45010. (line 43)
  45011. * rec btrace pt: Process Record and Replay.
  45012. (line 43)
  45013. * rec bts: Process Record and Replay.
  45014. (line 43)
  45015. * rec del: Process Record and Replay.
  45016. (line 357)
  45017. * rec full: Process Record and Replay.
  45018. (line 43)
  45019. * rec function-call-history: Process Record and Replay.
  45020. (line 423)
  45021. * rec instruction-history: Process Record and Replay.
  45022. (line 363)
  45023. * rec pt: Process Record and Replay.
  45024. (line 43)
  45025. * rec s: Process Record and Replay.
  45026. (line 106)
  45027. * recognize on type_recognizer: Type Printing API. (line 42)
  45028. * record: Process Record and Replay.
  45029. (line 43)
  45030. * record btrace: Process Record and Replay.
  45031. (line 43)
  45032. * record btrace bts: Process Record and Replay.
  45033. (line 43)
  45034. * record btrace pt: Process Record and Replay.
  45035. (line 43)
  45036. * record bts: Process Record and Replay.
  45037. (line 43)
  45038. * record delete: Process Record and Replay.
  45039. (line 357)
  45040. * record full: Process Record and Replay.
  45041. (line 43)
  45042. * record function-call-history: Process Record and Replay.
  45043. (line 423)
  45044. * record goto: Process Record and Replay.
  45045. (line 129)
  45046. * record instruction-history: Process Record and Replay.
  45047. (line 363)
  45048. * record pt: Process Record and Replay.
  45049. (line 43)
  45050. * record restore: Process Record and Replay.
  45051. (line 150)
  45052. * record save: Process Record and Replay.
  45053. (line 143)
  45054. * record stop: Process Record and Replay.
  45055. (line 106)
  45056. * Record.begin: Recordings In Python.
  45057. (line 40)
  45058. * Record.end: Recordings In Python.
  45059. (line 44)
  45060. * Record.format: Recordings In Python.
  45061. (line 36)
  45062. * Record.function_call_history: Recordings In Python.
  45063. (line 55)
  45064. * Record.goto: Recordings In Python.
  45065. (line 60)
  45066. * Record.instruction_history: Recordings In Python.
  45067. (line 52)
  45068. * Record.method: Recordings In Python.
  45069. (line 32)
  45070. * Record.replay_position: Recordings In Python.
  45071. (line 48)
  45072. * RecordFunctionSegment.instructions: Recordings In Python.
  45073. (line 126)
  45074. * RecordFunctionSegment.level: Recordings In Python.
  45075. (line 122)
  45076. * RecordFunctionSegment.next: Recordings In Python.
  45077. (line 140)
  45078. * RecordFunctionSegment.number: Recordings In Python.
  45079. (line 113)
  45080. * RecordFunctionSegment.prev: Recordings In Python.
  45081. (line 136)
  45082. * RecordFunctionSegment.symbol: Recordings In Python.
  45083. (line 118)
  45084. * RecordFunctionSegment.up: Recordings In Python.
  45085. (line 130)
  45086. * RecordGap.error_code: Recordings In Python.
  45087. (line 104)
  45088. * RecordGap.error_string: Recordings In Python.
  45089. (line 108)
  45090. * RecordGap.number: Recordings In Python.
  45091. (line 99)
  45092. * RecordInstruction.is_speculative: Recordings In Python.
  45093. (line 91)
  45094. * RecordInstruction.number: Recordings In Python.
  45095. (line 81)
  45096. * RecordInstruction.sal: Recordings In Python.
  45097. (line 86)
  45098. * redraw-current-line (): Commands For Moving. (line 44)
  45099. * refresh: TUI Commands. (line 125)
  45100. * register-breakpoint!: Breakpoints In Guile.
  45101. (line 87)
  45102. * register-command!: Commands In Guile. (line 58)
  45103. * register-parameter!: Parameters In Guile. (line 94)
  45104. * RegisterChangedEvent.frame: Events In Python. (line 172)
  45105. * RegisterChangedEvent.regnum: Events In Python. (line 175)
  45106. * RegisterDescriptor.name: Registers In Python. (line 19)
  45107. * RegisterDescriptorIterator.find: Registers In Python. (line 25)
  45108. * RegisterGroup.name: Registers In Python. (line 48)
  45109. * register_xmethod_matcher: Xmethod API. (line 82)
  45110. * remote delete: File Transfer. (line 23)
  45111. * remote get: File Transfer. (line 19)
  45112. * remote put: File Transfer. (line 15)
  45113. * remove-inferiors: Inferiors Connections and Programs.
  45114. (line 138)
  45115. * remove-symbol-file: Files. (line 174)
  45116. * restart CHECKPOINT-ID: Checkpoint/Restart. (line 41)
  45117. * restore: Dump/Restore Files. (line 40)
  45118. * RET (repeat last command): Command Syntax. (line 21)
  45119. * return: Returning. (line 6)
  45120. * reverse-continue: Reverse Execution. (line 36)
  45121. * reverse-finish: Reverse Execution. (line 83)
  45122. * reverse-next: Reverse Execution. (line 66)
  45123. * reverse-nexti: Reverse Execution. (line 75)
  45124. * reverse-search: Search. (line 16)
  45125. * reverse-search-history (C-r): Commands For History.
  45126. (line 26)
  45127. * reverse-step: Reverse Execution. (line 43)
  45128. * reverse-stepi: Reverse Execution. (line 58)
  45129. * revert-all-at-newline: Readline Init File Syntax.
  45130. (line 267)
  45131. * revert-line (M-r): Miscellaneous Commands.
  45132. (line 26)
  45133. * Right: TUI Keys. (line 76)
  45134. * rn (reverse-next): Reverse Execution. (line 66)
  45135. * rni (reverse-nexti): Reverse Execution. (line 75)
  45136. * rs (step): Reverse Execution. (line 43)
  45137. * rsi (reverse-stepi): Reverse Execution. (line 58)
  45138. * run: Starting. (line 6)
  45139. * run&: Background Execution.
  45140. (line 21)
  45141. * rwatch: Set Watchpoints. (line 79)
  45142. * s (SingleKey TUI key): TUI Single Key Mode. (line 31)
  45143. * s (step): Continuing and Stepping.
  45144. (line 45)
  45145. * sal-last: Symbol Tables In Guile.
  45146. (line 68)
  45147. * sal-line: Symbol Tables In Guile.
  45148. (line 62)
  45149. * sal-pc: Symbol Tables In Guile.
  45150. (line 65)
  45151. * sal-symtab: Symbol Tables In Guile.
  45152. (line 59)
  45153. * sal-valid?: Symbol Tables In Guile.
  45154. (line 53)
  45155. * sal?: Symbol Tables In Guile.
  45156. (line 49)
  45157. * save breakpoints: Save Breakpoints. (line 9)
  45158. * save gdb-index: Index Files. (line 30)
  45159. * save tracepoints: save tracepoints. (line 6)
  45160. * save-tracepoints: save tracepoints. (line 6)
  45161. * search: Search. (line 9)
  45162. * section: Files. (line 203)
  45163. * select-frame: Selection. (line 98)
  45164. * selected-frame: Frames In Guile. (line 156)
  45165. * self: Commands In Guile. (line 100)
  45166. * self-insert (a, b, A, 1, !, ...): Commands For Text. (line 33)
  45167. * set: Help. (line 138)
  45168. * set ada print-signatures: Overloading support for Ada.
  45169. (line 31)
  45170. * set ada trust-PAD-over-XVS: Ada Glitches. (line 42)
  45171. * set agent off: In-Process Agent. (line 47)
  45172. * set agent on: In-Process Agent. (line 38)
  45173. * set annotate: Annotations Overview.
  45174. (line 29)
  45175. * set architecture: Targets. (line 21)
  45176. * set args: Arguments. (line 21)
  45177. * set arm: ARM. (line 9)
  45178. * set auto-connect-native-target: Starting. (line 168)
  45179. * set auto-load gdb-scripts: Auto-loading sequences.
  45180. (line 13)
  45181. * set auto-load guile-scripts: Guile Auto-loading. (line 17)
  45182. * set auto-load libthread-db: libthread_db.so.1 file.
  45183. (line 21)
  45184. * set auto-load local-gdbinit: Init File in the Current Directory.
  45185. (line 14)
  45186. * set auto-load off: Auto-loading. (line 32)
  45187. * set auto-load python-scripts: Python Auto-loading. (line 17)
  45188. * set auto-load safe-path: Auto-loading safe path.
  45189. (line 32)
  45190. * set auto-load scripts-directory: objfile-gdbdotext file.
  45191. (line 41)
  45192. * set auto-solib-add: Files. (line 307)
  45193. * set backtrace: Backtrace. (line 166)
  45194. * set basenames-may-differ: Files. (line 536)
  45195. * set breakpoint always-inserted: Set Breaks. (line 325)
  45196. * set breakpoint auto-hw: Set Breaks. (line 305)
  45197. * set breakpoint condition-evaluation: Set Breaks. (line 346)
  45198. * set breakpoint pending: Set Breaks. (line 275)
  45199. * set can-use-hw-watchpoints: Set Watchpoints. (line 116)
  45200. * set case-sensitive: Symbols. (line 27)
  45201. * set charset: Character Sets. (line 46)
  45202. * set check range: Range Checking. (line 34)
  45203. * set check type: Type Checking. (line 35)
  45204. * set circular-trace-buffer: Starting and Stopping Trace Experiments.
  45205. (line 93)
  45206. * set code-cache: Caching Target Data. (line 36)
  45207. * set coerce-float-to-double: ABI. (line 45)
  45208. * set com1base: DJGPP Native. (line 122)
  45209. * set com1irq: DJGPP Native. (line 122)
  45210. * set com2base: DJGPP Native. (line 122)
  45211. * set com2irq: DJGPP Native. (line 122)
  45212. * set com3base: DJGPP Native. (line 122)
  45213. * set com3irq: DJGPP Native. (line 122)
  45214. * set com4base: DJGPP Native. (line 122)
  45215. * set com4irq: DJGPP Native. (line 122)
  45216. * set complaints: Messages/Warnings. (line 29)
  45217. * set confirm: Messages/Warnings. (line 49)
  45218. * set cp-abi: ABI. (line 57)
  45219. * set cwd: Working Directory. (line 13)
  45220. * set cygwin-exceptions: Cygwin Native. (line 60)
  45221. * set data-directory: Data Files. (line 12)
  45222. * set dcache line-size: Caching Target Data. (line 60)
  45223. * set dcache size: Caching Target Data. (line 57)
  45224. * set debug: Debugging Output. (line 17)
  45225. * set debug aarch64: AArch64. (line 10)
  45226. * set debug arc: ARC. (line 9)
  45227. * set debug auto-load: Auto-loading verbose mode.
  45228. (line 27)
  45229. * set debug bfd-cache LEVEL: File Caching. (line 24)
  45230. * set debug darwin: Darwin. (line 9)
  45231. * set debug entry-values: Tail Call Frames. (line 47)
  45232. * set debug hppa: HPPA. (line 10)
  45233. * set debug libthread-db: Threads. (line 331)
  45234. * set debug mach-o: Darwin. (line 16)
  45235. * set debug mips: MIPS. (line 100)
  45236. * set debug monitor: Target Commands. (line 107)
  45237. * set debug nios2: Nios II. (line 10)
  45238. * set debug skip: Skipping Over Functions and Files.
  45239. (line 149)
  45240. * set debug-file-directory: Separate Debug Files.
  45241. (line 70)
  45242. * set debugevents: Cygwin Native. (line 89)
  45243. * set debugexceptions: Cygwin Native. (line 100)
  45244. * set debugexec: Cygwin Native. (line 96)
  45245. * set debugmemory: Cygwin Native. (line 104)
  45246. * set default-collect: Tracepoint Actions. (line 142)
  45247. * set demangle-style: Print Settings. (line 529)
  45248. * set detach-on-fork: Forks. (line 58)
  45249. * set directories: Source Path. (line 178)
  45250. * set disable-randomization: Starting. (line 212)
  45251. * set disassemble-next-line: Machine Code. (line 249)
  45252. * set disassembler-options: Machine Code. (line 222)
  45253. * set disassembly-flavor: Machine Code. (line 237)
  45254. * set disconnected-dprintf: Dynamic Printf. (line 83)
  45255. * set disconnected-tracing: Starting and Stopping Trace Experiments.
  45256. (line 55)
  45257. * set displaced-stepping: Maintenance Commands.
  45258. (line 112)
  45259. * set dump-excluded-mappings: Core File Generation.
  45260. (line 60)
  45261. * set editing: Editing. (line 15)
  45262. * set endian: Byte Order. (line 13)
  45263. * set environment: Environment. (line 39)
  45264. * set exceptions, Hurd command: Hurd Native. (line 39)
  45265. * set exec-direction: Reverse Execution. (line 89)
  45266. * set exec-done-display: Debugging Output. (line 11)
  45267. * set exec-wrapper: Starting. (line 120)
  45268. * set extended-prompt: Prompt. (line 25)
  45269. * set extension-language: Show. (line 30)
  45270. * set follow-exec-mode: Forks. (line 106)
  45271. * set follow-fork-mode: Forks. (line 39)
  45272. * set frame-filter priority: Frame Filter Management.
  45273. (line 84)
  45274. * set gnutarget: Target Commands. (line 28)
  45275. * set guile print-stack: Guile Exception Handling.
  45276. (line 6)
  45277. * set hash, for remote monitors: Target Commands. (line 98)
  45278. * set height: Screen Size. (line 22)
  45279. * set history expansion: Command History. (line 97)
  45280. * set history filename: Command History. (line 26)
  45281. * set history remove-duplicates: Command History. (line 69)
  45282. * set history save: Command History. (line 44)
  45283. * set history size: Command History. (line 56)
  45284. * set host-charset: Character Sets. (line 33)
  45285. * set index-cache: Index Files. (line 79)
  45286. * set inferior-tty: Input/Output. (line 49)
  45287. * set input-radix: Numbers. (line 14)
  45288. * set interactive-mode: Other Misc Settings. (line 6)
  45289. * set language: Manually. (line 9)
  45290. * set libthread-db-search-path: Threads. (line 293)
  45291. * set listsize: List. (line 33)
  45292. * set logging: Logging Output. (line 9)
  45293. * set mach-exceptions: Darwin. (line 27)
  45294. * set max-completions: Completion. (line 70)
  45295. * set max-user-call-depth: Define. (line 128)
  45296. * set max-value-size: Value Sizes. (line 12)
  45297. * set may-call-functions: Calling. (line 59)
  45298. * set mem inaccessible-by-default: Memory Region Attributes.
  45299. (line 123)
  45300. * set mips abi: MIPS. (line 32)
  45301. * set mips compression: MIPS. (line 49)
  45302. * set mips mask-address: MIPS. (line 80)
  45303. * set mipsfpu: MIPS Embedded. (line 13)
  45304. * set mpx bound: i386. (line 60)
  45305. * set multiple-symbols: Ambiguous Expressions.
  45306. (line 50)
  45307. * set new-console: Cygwin Native. (line 72)
  45308. * set new-group: Cygwin Native. (line 81)
  45309. * set non-stop: Non-Stop Mode. (line 35)
  45310. * set opaque-type-resolution: Symbols. (line 582)
  45311. * set osabi: ABI. (line 11)
  45312. * set output-radix: Numbers. (line 30)
  45313. * set overload-resolution: Debugging C Plus Plus.
  45314. (line 59)
  45315. * set pagination: Screen Size. (line 41)
  45316. * set powerpc: PowerPC Embedded. (line 51)
  45317. * set print: Print Settings. (line 11)
  45318. * set print entry-values: Print Settings. (line 214)
  45319. * set print finish: Continuing and Stepping.
  45320. (line 117)
  45321. * set print frame-arguments: Print Settings. (line 154)
  45322. * set print frame-info: Print Settings. (line 314)
  45323. * set print inferior-events: Inferiors Connections and Programs.
  45324. (line 169)
  45325. * set print symbol-loading: Symbols. (line 600)
  45326. * set print thread-events: Threads. (line 272)
  45327. * set print type methods: Symbols. (line 44)
  45328. * set print type nested-type-limit: Symbols. (line 57)
  45329. * set print type typedefs: Symbols. (line 68)
  45330. * set processor: Targets. (line 31)
  45331. * set procfs-file: Process Information. (line 112)
  45332. * set procfs-trace: Process Information. (line 106)
  45333. * set prompt: Prompt. (line 16)
  45334. * set python print-stack: Python Commands. (line 44)
  45335. * set radix: Numbers. (line 43)
  45336. * set range-stepping: Continuing and Stepping.
  45337. (line 228)
  45338. * set ravenscar task-switching off: Ravenscar Profile. (line 14)
  45339. * set ravenscar task-switching on: Ravenscar Profile. (line 10)
  45340. * set record: Process Record and Replay.
  45341. (line 413)
  45342. * set record btrace: Process Record and Replay.
  45343. (line 204)
  45344. * set record btrace bts: Process Record and Replay.
  45345. (line 277)
  45346. * set record btrace pt: Process Record and Replay.
  45347. (line 300)
  45348. * set record full: Process Record and Replay.
  45349. (line 154)
  45350. * set remote: Remote Configuration.
  45351. (line 6)
  45352. * set remote system-call-allowed: system. (line 37)
  45353. * set remote-mips64-transfers-32bit-regs: MIPS. (line 90)
  45354. * set remotecache: Caching Target Data. (line 20)
  45355. * set remoteflow: Remote Configuration.
  45356. (line 48)
  45357. * set schedule-multiple: All-Stop Mode. (line 67)
  45358. * set script-extension: Extending GDB. (line 29)
  45359. * set sh calling-convention: Super-H. (line 9)
  45360. * set shell: Cygwin Native. (line 108)
  45361. * set signal-thread: Hurd Native. (line 21)
  45362. * set signals, Hurd command: Hurd Native. (line 11)
  45363. * set sigs, Hurd command: Hurd Native. (line 11)
  45364. * set sigthread: Hurd Native. (line 21)
  45365. * set solib-absolute-prefix: Files. (line 386)
  45366. * set solib-search-path: Files. (line 462)
  45367. * set stack-cache: Caching Target Data. (line 28)
  45368. * set startup-with-shell: Starting. (line 145)
  45369. * set step-mode: Continuing and Stepping.
  45370. (line 91)
  45371. * set stop-on-solib-events: Files. (line 363)
  45372. * set stopped, Hurd command: Hurd Native. (line 31)
  45373. * set struct-convention: i386. (line 7)
  45374. * set style: Output Styling. (line 6)
  45375. * set substitute-path: Source Path. (line 185)
  45376. * set sysroot: Files. (line 386)
  45377. * set target-charset: Character Sets. (line 28)
  45378. * set target-file-system-kind (unix|dos-based|auto): Files. (line 476)
  45379. * set target-wide-charset: Character Sets. (line 61)
  45380. * set task, Hurd commands: Hurd Native. (line 48)
  45381. * set tcp: Remote Configuration.
  45382. (line 130)
  45383. * set thread, Hurd command: Hurd Native. (line 90)
  45384. * set trace-buffer-size: Starting and Stopping Trace Experiments.
  45385. (line 107)
  45386. * set trace-commands: Messages/Warnings. (line 65)
  45387. * set trace-notes: Starting and Stopping Trace Experiments.
  45388. (line 126)
  45389. * set trace-stop-notes: Starting and Stopping Trace Experiments.
  45390. (line 132)
  45391. * set trace-user: Starting and Stopping Trace Experiments.
  45392. (line 122)
  45393. * set trust-readonly-sections: Files. (line 265)
  45394. * set tui active-border-mode: TUI Configuration. (line 24)
  45395. * set tui border-kind: TUI Configuration. (line 9)
  45396. * set tui border-mode: TUI Configuration. (line 23)
  45397. * set tui compact-source: TUI Configuration. (line 54)
  45398. * set tui tab-width: TUI Configuration. (line 49)
  45399. * set unwind-on-terminating-exception: Calling. (line 47)
  45400. * set unwindonsignal: Calling. (line 36)
  45401. * set use-coredump-filter: Core File Generation.
  45402. (line 33)
  45403. * set variable: Assignment. (line 16)
  45404. * set varsize-limit: Ada Settings. (line 6)
  45405. * set verbose: Messages/Warnings. (line 15)
  45406. * set watchdog: Maintenance Commands.
  45407. (line 624)
  45408. * set width: Screen Size. (line 22)
  45409. * set write: Patching. (line 15)
  45410. * set-breakpoint-condition!: Breakpoints In Guile.
  45411. (line 198)
  45412. * set-breakpoint-enabled!: Breakpoints In Guile.
  45413. (line 147)
  45414. * set-breakpoint-hit-count!: Breakpoints In Guile.
  45415. (line 172)
  45416. * set-breakpoint-ignore-count!: Breakpoints In Guile.
  45417. (line 166)
  45418. * set-breakpoint-silent!: Breakpoints In Guile.
  45419. (line 158)
  45420. * set-breakpoint-stop!: Breakpoints In Guile.
  45421. (line 206)
  45422. * set-breakpoint-task!: Breakpoints In Guile.
  45423. (line 190)
  45424. * set-breakpoint-thread!: Breakpoints In Guile.
  45425. (line 180)
  45426. * set-iterator-progress!: Iterators In Guile. (line 60)
  45427. * set-mark (C-@): Miscellaneous Commands.
  45428. (line 33)
  45429. * set-memory-port-read-buffer-size!: Memory Ports in Guile.
  45430. (line 44)
  45431. * set-memory-port-write-buffer-size!: Memory Ports in Guile.
  45432. (line 59)
  45433. * set-objfile-pretty-printers!: Objfiles In Guile. (line 40)
  45434. * set-parameter-value!: Parameters In Guile. (line 107)
  45435. * set-pretty-printer-enabled!: Guile Pretty Printing API.
  45436. (line 31)
  45437. * set-pretty-printers!: Guile Pretty Printing API.
  45438. (line 38)
  45439. * set-progspace-pretty-printers!: Progspaces In Guile. (line 57)
  45440. * set_debug_traps: Stub Contents. (line 10)
  45441. * share: Files. (line 339)
  45442. * sharedlibrary: Files. (line 339)
  45443. * shell: Shell Commands. (line 10)
  45444. * show: Help. (line 143)
  45445. * show ada print-signatures: Overloading support for Ada.
  45446. (line 36)
  45447. * show ada trust-PAD-over-XVS: Ada Glitches. (line 42)
  45448. * show agent: In-Process Agent. (line 51)
  45449. * show annotate: Annotations Overview.
  45450. (line 34)
  45451. * show architecture: Targets. (line 21)
  45452. * show args: Arguments. (line 28)
  45453. * show arm: ARM. (line 13)
  45454. * show auto-load: Auto-loading. (line 45)
  45455. * show auto-load gdb-scripts: Auto-loading sequences.
  45456. (line 17)
  45457. * show auto-load guile-scripts: Guile Auto-loading. (line 20)
  45458. * show auto-load libthread-db: libthread_db.so.1 file.
  45459. (line 25)
  45460. * show auto-load local-gdbinit: Init File in the Current Directory.
  45461. (line 18)
  45462. * show auto-load python-scripts: Python Auto-loading. (line 20)
  45463. * show auto-load safe-path: Auto-loading safe path.
  45464. (line 46)
  45465. * show auto-load scripts-directory: objfile-gdbdotext file.
  45466. (line 65)
  45467. * show auto-solib-add: Files. (line 324)
  45468. * show backtrace: Backtrace. (line 173)
  45469. * show basenames-may-differ: Files. (line 539)
  45470. * show breakpoint always-inserted: Set Breaks. (line 325)
  45471. * show breakpoint auto-hw: Set Breaks. (line 305)
  45472. * show breakpoint condition-evaluation: Set Breaks. (line 346)
  45473. * show breakpoint pending: Set Breaks. (line 275)
  45474. * show can-use-hw-watchpoints: Set Watchpoints. (line 119)
  45475. * show case-sensitive: Symbols. (line 40)
  45476. * show charset: Character Sets. (line 52)
  45477. * show check range: Range Checking. (line 34)
  45478. * show check type: Type Checking. (line 35)
  45479. * show circular-trace-buffer: Starting and Stopping Trace Experiments.
  45480. (line 100)
  45481. * show code-cache: Caching Target Data. (line 42)
  45482. * show coerce-float-to-double: ABI. (line 54)
  45483. * show com1base: DJGPP Native. (line 134)
  45484. * show com1irq: DJGPP Native. (line 134)
  45485. * show com2base: DJGPP Native. (line 134)
  45486. * show com2irq: DJGPP Native. (line 134)
  45487. * show com3base: DJGPP Native. (line 134)
  45488. * show com3irq: DJGPP Native. (line 134)
  45489. * show com4base: DJGPP Native. (line 134)
  45490. * show com4irq: DJGPP Native. (line 134)
  45491. * show commands: Command History. (line 110)
  45492. * show complaints: Messages/Warnings. (line 35)
  45493. * show configuration: Help. (line 176)
  45494. * show confirm: Messages/Warnings. (line 57)
  45495. * show convenience: Convenience Vars. (line 37)
  45496. * show copying: Help. (line 167)
  45497. * show cp-abi: ABI. (line 57)
  45498. * show cwd: Working Directory. (line 27)
  45499. * show cygwin-exceptions: Cygwin Native. (line 68)
  45500. * show data-directory: Data Files. (line 16)
  45501. * show dcache line-size: Caching Target Data. (line 68)
  45502. * show dcache size: Caching Target Data. (line 64)
  45503. * show debug: Debugging Output. (line 20)
  45504. * show debug arc: ARC. (line 14)
  45505. * show debug auto-load: Auto-loading verbose mode.
  45506. (line 30)
  45507. * show debug bfd-cache: File Caching. (line 27)
  45508. * show debug darwin: Darwin. (line 13)
  45509. * show debug entry-values: Tail Call Frames. (line 55)
  45510. * show debug libthread-db: Threads. (line 331)
  45511. * show debug mach-o: Darwin. (line 23)
  45512. * show debug mips: MIPS. (line 104)
  45513. * show debug monitor: Target Commands. (line 111)
  45514. * show debug nios2: Nios II. (line 14)
  45515. * show debug skip: Skipping Over Functions and Files.
  45516. (line 153)
  45517. * show debug-file-directory: Separate Debug Files.
  45518. (line 75)
  45519. * show default-collect: Tracepoint Actions. (line 150)
  45520. * show detach-on-fork: Forks. (line 73)
  45521. * show directories: Source Path. (line 182)
  45522. * show disassemble-next-line: Machine Code. (line 249)
  45523. * show disassembler-options: Machine Code. (line 234)
  45524. * show disassembly-flavor: Machine Code. (line 246)
  45525. * show disconnected-dprintf: Dynamic Printf. (line 88)
  45526. * show disconnected-tracing: Starting and Stopping Trace Experiments.
  45527. (line 62)
  45528. * show displaced-stepping: Maintenance Commands.
  45529. (line 112)
  45530. * show editing: Editing. (line 22)
  45531. * show environment: Environment. (line 33)
  45532. * show exceptions, Hurd command: Hurd Native. (line 45)
  45533. * show exec-done-display: Debugging Output. (line 14)
  45534. * show extended-prompt: Prompt. (line 39)
  45535. * show follow-fork-mode: Forks. (line 52)
  45536. * show frame-filter priority: Frame Filter Management.
  45537. (line 91)
  45538. * show gnutarget: Target Commands. (line 40)
  45539. * show hash, for remote monitors: Target Commands. (line 104)
  45540. * show height: Screen Size. (line 22)
  45541. * show history: Command History. (line 102)
  45542. * show host-charset: Character Sets. (line 55)
  45543. * show index-cache: Index Files. (line 84)
  45544. * show inferior-tty: Input/Output. (line 54)
  45545. * show input-radix: Numbers. (line 35)
  45546. * show interactive-mode: Other Misc Settings. (line 20)
  45547. * show language: Show. (line 10)
  45548. * show libthread-db-search-path: Threads. (line 328)
  45549. * show listsize: List. (line 39)
  45550. * show logging: Logging Output. (line 26)
  45551. * show mach-exceptions: Darwin. (line 34)
  45552. * show max-completions: Completion. (line 78)
  45553. * show max-user-call-depth: Define. (line 128)
  45554. * show max-value-size: Value Sizes. (line 36)
  45555. * show may-call-functions: Calling. (line 73)
  45556. * show mem inaccessible-by-default: Memory Region Attributes.
  45557. (line 129)
  45558. * show mips abi: MIPS. (line 46)
  45559. * show mips compression: MIPS. (line 72)
  45560. * show mips mask-address: MIPS. (line 86)
  45561. * show mipsfpu: MIPS Embedded. (line 13)
  45562. * show mpx bound: i386. (line 57)
  45563. * show multiple-symbols: Ambiguous Expressions.
  45564. (line 70)
  45565. * show new-console: Cygwin Native. (line 77)
  45566. * show new-group: Cygwin Native. (line 86)
  45567. * show non-stop: Non-Stop Mode. (line 38)
  45568. * show opaque-type-resolution: Symbols. (line 597)
  45569. * show osabi: ABI. (line 11)
  45570. * show output-radix: Numbers. (line 38)
  45571. * show overload-resolution: Debugging C Plus Plus.
  45572. (line 76)
  45573. * show pagination: Screen Size. (line 47)
  45574. * show paths: Environment. (line 29)
  45575. * show print: Print Settings. (line 39)
  45576. * show print finish: Continuing and Stepping.
  45577. (line 117)
  45578. * show print inferior-events: Inferiors Connections and Programs.
  45579. (line 177)
  45580. * show print symbol-loading: Symbols. (line 615)
  45581. * show print thread-events: Threads. (line 282)
  45582. * show print type methods: Symbols. (line 53)
  45583. * show print type nested-type-limit: Symbols. (line 64)
  45584. * show print type typedefs: Symbols. (line 81)
  45585. * show processor: Targets. (line 31)
  45586. * show procfs-file: Process Information. (line 117)
  45587. * show procfs-trace: Process Information. (line 109)
  45588. * show prompt: Prompt. (line 19)
  45589. * show radix: Numbers. (line 43)
  45590. * show range-stepping: Continuing and Stepping.
  45591. (line 228)
  45592. * show ravenscar task-switching: Ravenscar Profile. (line 22)
  45593. * show record: Process Record and Replay.
  45594. (line 419)
  45595. * show record btrace: Process Record and Replay.
  45596. (line 270)
  45597. * show record full: Process Record and Replay.
  45598. (line 172)
  45599. * show remote: Remote Configuration.
  45600. (line 6)
  45601. * show remote system-call-allowed: system. (line 41)
  45602. * show remote-mips64-transfers-32bit-regs: MIPS. (line 96)
  45603. * show remotecache: Caching Target Data. (line 25)
  45604. * show remoteflow: Remote Configuration.
  45605. (line 52)
  45606. * show script-extension: Extending GDB. (line 29)
  45607. * show sh calling-convention: Super-H. (line 22)
  45608. * show shell: Cygwin Native. (line 112)
  45609. * show signal-thread: Hurd Native. (line 27)
  45610. * show signals, Hurd command: Hurd Native. (line 17)
  45611. * show sigs, Hurd command: Hurd Native. (line 17)
  45612. * show sigthread: Hurd Native. (line 27)
  45613. * show solib-search-path: Files. (line 473)
  45614. * show stack-cache: Caching Target Data. (line 33)
  45615. * show stop-on-solib-events: Files. (line 369)
  45616. * show stopped, Hurd command: Hurd Native. (line 36)
  45617. * show struct-convention: i386. (line 15)
  45618. * show style: Output Styling. (line 6)
  45619. * show substitute-path: Source Path. (line 222)
  45620. * show sysroot: Files. (line 459)
  45621. * show target-charset: Character Sets. (line 58)
  45622. * show target-file-system-kind: Files. (line 476)
  45623. * show target-wide-charset: Character Sets. (line 67)
  45624. * show task, Hurd commands: Hurd Native. (line 56)
  45625. * show tcp: Remote Configuration.
  45626. (line 130)
  45627. * show thread, Hurd command: Hurd Native. (line 100)
  45628. * show trace-buffer-size: Starting and Stopping Trace Experiments.
  45629. (line 114)
  45630. * show trace-notes: Starting and Stopping Trace Experiments.
  45631. (line 129)
  45632. * show trace-stop-notes: Starting and Stopping Trace Experiments.
  45633. (line 137)
  45634. * show trace-user: Starting and Stopping Trace Experiments.
  45635. (line 124)
  45636. * show unwind-on-terminating-exception: Calling. (line 55)
  45637. * show unwindonsignal: Calling. (line 43)
  45638. * show user: Define. (line 121)
  45639. * show values: Value History. (line 47)
  45640. * show varsize-limit: Ada Settings. (line 26)
  45641. * show verbose: Messages/Warnings. (line 21)
  45642. * show version: Help. (line 157)
  45643. * show warranty: Help. (line 171)
  45644. * show width: Screen Size. (line 22)
  45645. * show write: Patching. (line 26)
  45646. * show-all-if-ambiguous: Readline Init File Syntax.
  45647. (line 273)
  45648. * show-all-if-unmodified: Readline Init File Syntax.
  45649. (line 279)
  45650. * show-mode-in-prompt: Readline Init File Syntax.
  45651. (line 288)
  45652. * si (stepi): Continuing and Stepping.
  45653. (line 196)
  45654. * signal: Signaling. (line 6)
  45655. * signal annotation: Annotations for Running.
  45656. (line 42)
  45657. * signal-event: Cygwin Native. (line 35)
  45658. * signal-name annotation: Annotations for Running.
  45659. (line 22)
  45660. * signal-name-end annotation: Annotations for Running.
  45661. (line 22)
  45662. * signal-string annotation: Annotations for Running.
  45663. (line 22)
  45664. * signal-string-end annotation: Annotations for Running.
  45665. (line 22)
  45666. * SignalEvent.stop_signal: Events In Python. (line 91)
  45667. * signalled annotation: Annotations for Running.
  45668. (line 22)
  45669. * silent: Break Commands. (line 43)
  45670. * sim, a command: Embedded Processors. (line 13)
  45671. * skip: Skipping Over Functions and Files.
  45672. (line 44)
  45673. * skip delete: Skipping Over Functions and Files.
  45674. (line 137)
  45675. * skip disable: Skipping Over Functions and Files.
  45676. (line 145)
  45677. * skip enable: Skipping Over Functions and Files.
  45678. (line 141)
  45679. * skip file: Skipping Over Functions and Files.
  45680. (line 100)
  45681. * skip function: Skipping Over Functions and Files.
  45682. (line 89)
  45683. * skip-completed-text: Readline Init File Syntax.
  45684. (line 294)
  45685. * skip-csi-sequence (): Miscellaneous Commands.
  45686. (line 52)
  45687. * source: Command Files. (line 17)
  45688. * source annotation: Source Annotations. (line 6)
  45689. * start: Starting. (line 80)
  45690. * start-kbd-macro (C-x (): Keyboard Macros. (line 6)
  45691. * starti: Starting. (line 113)
  45692. * starting annotation: Annotations for Running.
  45693. (line 6)
  45694. * STDERR: Basic Python. (line 183)
  45695. * STDERR <1>: Basic Python. (line 203)
  45696. * stdio-port?: I/O Ports in Guile. (line 15)
  45697. * STDLOG: Basic Python. (line 186)
  45698. * STDLOG <1>: Basic Python. (line 206)
  45699. * STDOUT: Basic Python. (line 180)
  45700. * STDOUT <1>: Basic Python. (line 200)
  45701. * step: Continuing and Stepping.
  45702. (line 45)
  45703. * step&: Background Execution.
  45704. (line 28)
  45705. * stepi: Continuing and Stepping.
  45706. (line 196)
  45707. * stepi&: Background Execution.
  45708. (line 31)
  45709. * stop, a pseudo-command: Hooks. (line 21)
  45710. * stopping annotation: Annotations for Running.
  45711. (line 6)
  45712. * strace: Create and Delete Tracepoints.
  45713. (line 75)
  45714. * string->argv: Commands In Guile. (line 73)
  45715. * symbol-addr-class: Symbols In Guile. (line 48)
  45716. * symbol-argument?: Symbols In Guile. (line 58)
  45717. * symbol-constant?: Symbols In Guile. (line 62)
  45718. * symbol-file: Files. (line 45)
  45719. * symbol-function?: Symbols In Guile. (line 65)
  45720. * symbol-line: Symbols In Guile. (line 32)
  45721. * symbol-linkage-name: Symbols In Guile. (line 39)
  45722. * symbol-name: Symbols In Guile. (line 36)
  45723. * symbol-needs-frame?: Symbols In Guile. (line 53)
  45724. * symbol-print-name: Symbols In Guile. (line 43)
  45725. * symbol-symtab: Symbols In Guile. (line 28)
  45726. * symbol-type: Symbols In Guile. (line 24)
  45727. * symbol-valid?: Symbols In Guile. (line 17)
  45728. * symbol-value: Symbols In Guile. (line 72)
  45729. * symbol-variable?: Symbols In Guile. (line 69)
  45730. * Symbol.addr_class: Symbols In Python. (line 119)
  45731. * Symbol.is_argument: Symbols In Python. (line 129)
  45732. * Symbol.is_constant: Symbols In Python. (line 132)
  45733. * Symbol.is_function: Symbols In Python. (line 135)
  45734. * Symbol.is_valid: Symbols In Python. (line 143)
  45735. * Symbol.is_variable: Symbols In Python. (line 138)
  45736. * Symbol.line: Symbols In Python. (line 102)
  45737. * Symbol.linkage_name: Symbols In Python. (line 110)
  45738. * Symbol.name: Symbols In Python. (line 106)
  45739. * Symbol.needs_frame: Symbols In Python. (line 124)
  45740. * Symbol.print_name: Symbols In Python. (line 114)
  45741. * Symbol.symtab: Symbols In Python. (line 97)
  45742. * Symbol.type: Symbols In Python. (line 92)
  45743. * Symbol.value: Symbols In Python. (line 150)
  45744. * symbol?: Symbols In Guile. (line 13)
  45745. * SYMBOL_COMMON_BLOCK_DOMAIN: Symbols In Python. (line 178)
  45746. * SYMBOL_FUNCTIONS_DOMAIN: Symbols In Guile. (line 133)
  45747. * SYMBOL_LABEL_DOMAIN: Symbols In Python. (line 172)
  45748. * SYMBOL_LABEL_DOMAIN <1>: Symbols In Guile. (line 126)
  45749. * SYMBOL_LOC_ARG: Symbols In Python. (line 197)
  45750. * SYMBOL_LOC_ARG <1>: Symbols In Guile. (line 155)
  45751. * SYMBOL_LOC_BLOCK: Symbols In Python. (line 218)
  45752. * SYMBOL_LOC_BLOCK <1>: Symbols In Guile. (line 176)
  45753. * SYMBOL_LOC_COMPUTED: Symbols In Python. (line 232)
  45754. * SYMBOL_LOC_COMPUTED <1>: Symbols In Python. (line 235)
  45755. * SYMBOL_LOC_COMPUTED <2>: Symbols In Guile. (line 190)
  45756. * SYMBOL_LOC_CONST: Symbols In Python. (line 188)
  45757. * SYMBOL_LOC_CONST <1>: Symbols In Guile. (line 146)
  45758. * SYMBOL_LOC_CONST_BYTES: Symbols In Python. (line 221)
  45759. * SYMBOL_LOC_CONST_BYTES <1>: Symbols In Guile. (line 179)
  45760. * SYMBOL_LOC_LOCAL: Symbols In Python. (line 211)
  45761. * SYMBOL_LOC_LOCAL <1>: Symbols In Guile. (line 169)
  45762. * SYMBOL_LOC_OPTIMIZED_OUT: Symbols In Python. (line 229)
  45763. * SYMBOL_LOC_OPTIMIZED_OUT <1>: Symbols In Guile. (line 187)
  45764. * SYMBOL_LOC_REF_ARG: Symbols In Python. (line 201)
  45765. * SYMBOL_LOC_REF_ARG <1>: Symbols In Guile. (line 159)
  45766. * SYMBOL_LOC_REGISTER: Symbols In Python. (line 194)
  45767. * SYMBOL_LOC_REGISTER <1>: Symbols In Guile. (line 152)
  45768. * SYMBOL_LOC_REGPARM_ADDR: Symbols In Python. (line 206)
  45769. * SYMBOL_LOC_REGPARM_ADDR <1>: Symbols In Guile. (line 164)
  45770. * SYMBOL_LOC_STATIC: Symbols In Python. (line 191)
  45771. * SYMBOL_LOC_STATIC <1>: Symbols In Guile. (line 149)
  45772. * SYMBOL_LOC_TYPEDEF: Symbols In Python. (line 214)
  45773. * SYMBOL_LOC_TYPEDEF <1>: Symbols In Guile. (line 172)
  45774. * SYMBOL_LOC_UNDEF: Symbols In Python. (line 184)
  45775. * SYMBOL_LOC_UNDEF <1>: Symbols In Guile. (line 142)
  45776. * SYMBOL_LOC_UNRESOLVED: Symbols In Python. (line 224)
  45777. * SYMBOL_LOC_UNRESOLVED <1>: Symbols In Guile. (line 182)
  45778. * SYMBOL_MODULE_DOMAIN: Symbols In Python. (line 175)
  45779. * SYMBOL_STRUCT_DOMAIN: Symbols In Python. (line 169)
  45780. * SYMBOL_STRUCT_DOMAIN <1>: Symbols In Guile. (line 123)
  45781. * SYMBOL_TYPES_DOMAIN: Symbols In Guile. (line 136)
  45782. * SYMBOL_UNDEF_DOMAIN: Symbols In Python. (line 160)
  45783. * SYMBOL_UNDEF_DOMAIN <1>: Symbols In Guile. (line 114)
  45784. * SYMBOL_VARIABLES_DOMAIN: Symbols In Guile. (line 129)
  45785. * SYMBOL_VAR_DOMAIN: Symbols In Python. (line 165)
  45786. * SYMBOL_VAR_DOMAIN <1>: Symbols In Guile. (line 119)
  45787. * symtab-filename: Symbol Tables In Guile.
  45788. (line 28)
  45789. * symtab-fullname: Symbol Tables In Guile.
  45790. (line 31)
  45791. * symtab-global-block: Symbol Tables In Guile.
  45792. (line 38)
  45793. * symtab-objfile: Symbol Tables In Guile.
  45794. (line 34)
  45795. * symtab-static-block: Symbol Tables In Guile.
  45796. (line 42)
  45797. * symtab-valid?: Symbol Tables In Guile.
  45798. (line 21)
  45799. * Symtab.filename: Symbol Tables In Python.
  45800. (line 43)
  45801. * Symtab.fullname: Symbol Tables In Python.
  45802. (line 66)
  45803. * Symtab.global_block: Symbol Tables In Python.
  45804. (line 69)
  45805. * Symtab.is_valid: Symbol Tables In Python.
  45806. (line 59)
  45807. * Symtab.linetable: Symbol Tables In Python.
  45808. (line 77)
  45809. * Symtab.objfile: Symbol Tables In Python.
  45810. (line 47)
  45811. * Symtab.producer: Symbol Tables In Python.
  45812. (line 51)
  45813. * Symtab.static_block: Symbol Tables In Python.
  45814. (line 73)
  45815. * symtab?: Symbol Tables In Guile.
  45816. (line 17)
  45817. * Symtab_and_line.is_valid: Symbol Tables In Python.
  45818. (line 34)
  45819. * Symtab_and_line.last: Symbol Tables In Python.
  45820. (line 24)
  45821. * Symtab_and_line.line: Symbol Tables In Python.
  45822. (line 28)
  45823. * Symtab_and_line.pc: Symbol Tables In Python.
  45824. (line 20)
  45825. * Symtab_and_line.symtab: Symbol Tables In Python.
  45826. (line 16)
  45827. * sysinfo: DJGPP Native. (line 19)
  45828. * taas: Threads. (line 222)
  45829. * tab-insert (M-<TAB>): Commands For Text. (line 30)
  45830. * tabset: TUI Configuration. (line 49)
  45831. * target: Target Commands. (line 49)
  45832. * target ctf: Trace Files. (line 28)
  45833. * target record: Process Record and Replay.
  45834. (line 43)
  45835. * target record-btrace: Process Record and Replay.
  45836. (line 43)
  45837. * target record-full: Process Record and Replay.
  45838. (line 43)
  45839. * target sim: OpenRISC 1000. (line 13)
  45840. * target tfile: Trace Files. (line 28)
  45841. * target-config: Guile Configuration. (line 24)
  45842. * task (Ada): Ada Tasks. (line 105)
  45843. * tbreak: Set Breaks. (line 54)
  45844. * tcatch: Set Catchpoints. (line 298)
  45845. * tdump: tdump. (line 6)
  45846. * teval (tracepoints): Tracepoint Actions. (line 118)
  45847. * tfaas: Threads. (line 229)
  45848. * tfile: Trace Files. (line 28)
  45849. * tfind: tfind. (line 6)
  45850. * thbreak: Set Breaks. (line 80)
  45851. * this, inside C++ member functions: C Plus Plus Expressions.
  45852. (line 20)
  45853. * thread apply: Threads. (line 187)
  45854. * thread find: Threads. (line 258)
  45855. * thread name: Threads. (line 247)
  45856. * thread THREAD-ID: Threads. (line 169)
  45857. * thread-info: GDB/MI Support Commands.
  45858. (line 86)
  45859. * ThreadEvent.inferior_thread: Events In Python. (line 54)
  45860. * throw-user-error: Commands In Guile. (line 81)
  45861. * tilde-expand (M-~): Miscellaneous Commands.
  45862. (line 30)
  45863. * trace: Create and Delete Tracepoints.
  45864. (line 6)
  45865. * transpose-chars (C-t): Commands For Text. (line 45)
  45866. * transpose-words (M-t): Commands For Text. (line 51)
  45867. * tsave: Trace Files. (line 12)
  45868. * tstart [ NOTES ]: Starting and Stopping Trace Experiments.
  45869. (line 6)
  45870. * tstatus: Starting and Stopping Trace Experiments.
  45871. (line 27)
  45872. * tstop [ NOTES ]: Starting and Stopping Trace Experiments.
  45873. (line 16)
  45874. * tty: Input/Output. (line 23)
  45875. * tui disable: TUI Commands. (line 23)
  45876. * tui enable: TUI Commands. (line 18)
  45877. * tui new-layout: TUI Commands. (line 29)
  45878. * tui reg: TUI Commands. (line 128)
  45879. * TuiWindow.erase: TUI Windows In Python.
  45880. (line 44)
  45881. * TuiWindow.height: TUI Windows In Python.
  45882. (line 36)
  45883. * TuiWindow.is_valid: TUI Windows In Python.
  45884. (line 26)
  45885. * TuiWindow.title: TUI Windows In Python.
  45886. (line 39)
  45887. * TuiWindow.width: TUI Windows In Python.
  45888. (line 33)
  45889. * TuiWindow.write: TUI Windows In Python.
  45890. (line 47)
  45891. * tvariable: Trace State Variables.
  45892. (line 26)
  45893. * type-array: Types In Guile. (line 52)
  45894. * type-code: Types In Guile. (line 25)
  45895. * type-const: Types In Guile. (line 99)
  45896. * type-field: Types In Guile. (line 129)
  45897. * type-fields: Types In Guile. (line 115)
  45898. * type-has-field-deep?: Guile Types Module. (line 32)
  45899. * type-has-field?: Types In Guile. (line 142)
  45900. * type-name: Types In Guile. (line 34)
  45901. * type-num-fields: Types In Guile. (line 112)
  45902. * type-pointer: Types In Guile. (line 73)
  45903. * type-print-name: Types In Guile. (line 38)
  45904. * type-range: Types In Guile. (line 77)
  45905. * type-reference: Types In Guile. (line 81)
  45906. * type-sizeof: Types In Guile. (line 43)
  45907. * type-strip-typedefs: Types In Guile. (line 48)
  45908. * type-tag: Types In Guile. (line 29)
  45909. * type-target: Types In Guile. (line 85)
  45910. * type-unqualified: Types In Guile. (line 107)
  45911. * type-vector: Types In Guile. (line 60)
  45912. * type-volatile: Types In Guile. (line 103)
  45913. * Type.alignof: Types In Python. (line 32)
  45914. * Type.array: Types In Python. (line 138)
  45915. * Type.code: Types In Python. (line 38)
  45916. * Type.const: Types In Python. (line 159)
  45917. * Type.dynamic: Types In Python. (line 42)
  45918. * Type.fields: Types In Python. (line 85)
  45919. * Type.name: Types In Python. (line 62)
  45920. * Type.objfile: Types In Python. (line 79)
  45921. * Type.optimized_out: Types In Python. (line 216)
  45922. * Type.pointer: Types In Python. (line 182)
  45923. * Type.range: Types In Python. (line 172)
  45924. * Type.reference: Types In Python. (line 178)
  45925. * Type.sizeof: Types In Python. (line 66)
  45926. * Type.strip_typedefs: Types In Python. (line 186)
  45927. * Type.tag: Types In Python. (line 73)
  45928. * Type.target: Types In Python. (line 190)
  45929. * Type.template_argument: Types In Python. (line 204)
  45930. * Type.unqualified: Types In Python. (line 167)
  45931. * Type.vector: Types In Python. (line 146)
  45932. * Type.volatile: Types In Python. (line 163)
  45933. * type?: Types In Guile. (line 11)
  45934. * TYPE_CODE_ARRAY: Types In Python. (line 228)
  45935. * TYPE_CODE_ARRAY <1>: Types In Guile. (line 153)
  45936. * TYPE_CODE_BITSTRING: Types In Python. (line 266)
  45937. * TYPE_CODE_BITSTRING <1>: Types In Guile. (line 191)
  45938. * TYPE_CODE_BOOL: Types In Python. (line 290)
  45939. * TYPE_CODE_BOOL <1>: Types In Guile. (line 212)
  45940. * TYPE_CODE_CHAR: Types In Python. (line 287)
  45941. * TYPE_CODE_CHAR <1>: Types In Guile. (line 209)
  45942. * TYPE_CODE_COMPLEX: Types In Python. (line 293)
  45943. * TYPE_CODE_COMPLEX <1>: Types In Guile. (line 215)
  45944. * TYPE_CODE_DECFLOAT: Types In Python. (line 302)
  45945. * TYPE_CODE_DECFLOAT <1>: Types In Guile. (line 224)
  45946. * TYPE_CODE_ENUM: Types In Python. (line 237)
  45947. * TYPE_CODE_ENUM <1>: Types In Guile. (line 162)
  45948. * TYPE_CODE_ERROR: Types In Python. (line 269)
  45949. * TYPE_CODE_ERROR <1>: Types In Guile. (line 194)
  45950. * TYPE_CODE_FLAGS: Types In Python. (line 240)
  45951. * TYPE_CODE_FLAGS <1>: Types In Guile. (line 165)
  45952. * TYPE_CODE_FLT: Types In Python. (line 249)
  45953. * TYPE_CODE_FLT <1>: Types In Guile. (line 174)
  45954. * TYPE_CODE_FUNC: Types In Python. (line 243)
  45955. * TYPE_CODE_FUNC <1>: Types In Guile. (line 168)
  45956. * TYPE_CODE_INT: Types In Python. (line 246)
  45957. * TYPE_CODE_INT <1>: Types In Guile. (line 171)
  45958. * TYPE_CODE_INTERNAL_FUNCTION: Types In Python. (line 305)
  45959. * TYPE_CODE_INTERNAL_FUNCTION <1>: Types In Guile. (line 227)
  45960. * TYPE_CODE_MEMBERPTR: Types In Python. (line 278)
  45961. * TYPE_CODE_MEMBERPTR <1>: Types In Guile. (line 203)
  45962. * TYPE_CODE_METHOD: Types In Python. (line 272)
  45963. * TYPE_CODE_METHOD <1>: Types In Guile. (line 197)
  45964. * TYPE_CODE_METHODPTR: Types In Python. (line 275)
  45965. * TYPE_CODE_METHODPTR <1>: Types In Guile. (line 200)
  45966. * TYPE_CODE_NAMESPACE: Types In Python. (line 299)
  45967. * TYPE_CODE_NAMESPACE <1>: Types In Guile. (line 221)
  45968. * TYPE_CODE_PTR: Types In Python. (line 225)
  45969. * TYPE_CODE_PTR <1>: Types In Guile. (line 150)
  45970. * TYPE_CODE_RANGE: Types In Python. (line 258)
  45971. * TYPE_CODE_RANGE <1>: Types In Guile. (line 183)
  45972. * TYPE_CODE_REF: Types In Python. (line 281)
  45973. * TYPE_CODE_REF <1>: Types In Guile. (line 206)
  45974. * TYPE_CODE_RVALUE_REF: Types In Python. (line 284)
  45975. * TYPE_CODE_SET: Types In Python. (line 255)
  45976. * TYPE_CODE_SET <1>: Types In Guile. (line 180)
  45977. * TYPE_CODE_STRING: Types In Python. (line 261)
  45978. * TYPE_CODE_STRING <1>: Types In Guile. (line 186)
  45979. * TYPE_CODE_STRUCT: Types In Python. (line 231)
  45980. * TYPE_CODE_STRUCT <1>: Types In Guile. (line 156)
  45981. * TYPE_CODE_TYPEDEF: Types In Python. (line 296)
  45982. * TYPE_CODE_TYPEDEF <1>: Types In Guile. (line 218)
  45983. * TYPE_CODE_UNION: Types In Python. (line 234)
  45984. * TYPE_CODE_UNION <1>: Types In Guile. (line 159)
  45985. * TYPE_CODE_VOID: Types In Python. (line 252)
  45986. * TYPE_CODE_VOID <1>: Types In Guile. (line 177)
  45987. * u (SingleKey TUI key): TUI Single Key Mode. (line 37)
  45988. * u (until): Continuing and Stepping.
  45989. (line 124)
  45990. * undefined-command-error-code: GDB/MI Support Commands.
  45991. (line 101)
  45992. * undisplay: Auto Display. (line 45)
  45993. * undo (C-_ or C-x C-u): Miscellaneous Commands.
  45994. (line 23)
  45995. * universal-argument (): Numeric Arguments. (line 10)
  45996. * unix-filename-rubout (): Commands For Killing.
  45997. (line 32)
  45998. * unix-line-discard (C-u): Commands For Killing.
  45999. (line 12)
  46000. * unix-word-rubout (C-w): Commands For Killing.
  46001. (line 28)
  46002. * unset environment: Environment. (line 65)
  46003. * unset substitute-path: Source Path. (line 214)
  46004. * until: Continuing and Stepping.
  46005. (line 124)
  46006. * until&: Background Execution.
  46007. (line 46)
  46008. * unwind-stop-reason-string: Frames In Guile. (line 163)
  46009. * up: Selection. (line 69)
  46010. * Up: TUI Keys. (line 67)
  46011. * up-silently: Selection. (line 106)
  46012. * upcase-word (M-u): Commands For Text. (line 56)
  46013. * update: TUI Commands. (line 154)
  46014. * v (SingleKey TUI key): TUI Single Key Mode. (line 40)
  46015. * value->bool: Values From Inferior In Guile.
  46016. (line 234)
  46017. * value->bytevector: Values From Inferior In Guile.
  46018. (line 246)
  46019. * value->integer: Values From Inferior In Guile.
  46020. (line 238)
  46021. * value->lazy-string: Values From Inferior In Guile.
  46022. (line 291)
  46023. * value->real: Values From Inferior In Guile.
  46024. (line 242)
  46025. * value->string: Values From Inferior In Guile.
  46026. (line 250)
  46027. * value-abs: Arithmetic In Guile. (line 35)
  46028. * value-add: Arithmetic In Guile. (line 15)
  46029. * value-address: Values From Inferior In Guile.
  46030. (line 106)
  46031. * value-call: Values From Inferior In Guile.
  46032. (line 228)
  46033. * value-cast: Values From Inferior In Guile.
  46034. (line 129)
  46035. * value-dereference: Values From Inferior In Guile.
  46036. (line 143)
  46037. * value-div: Arithmetic In Guile. (line 21)
  46038. * value-dynamic-cast: Values From Inferior In Guile.
  46039. (line 135)
  46040. * value-dynamic-type: Values From Inferior In Guile.
  46041. (line 114)
  46042. * value-fetch-lazy!: Values From Inferior In Guile.
  46043. (line 333)
  46044. * value-field: Values From Inferior In Guile.
  46045. (line 221)
  46046. * value-lazy?: Values From Inferior In Guile.
  46047. (line 316)
  46048. * value-logand: Arithmetic In Guile. (line 47)
  46049. * value-logior: Arithmetic In Guile. (line 49)
  46050. * value-lognot: Arithmetic In Guile. (line 45)
  46051. * value-logxor: Arithmetic In Guile. (line 51)
  46052. * value-lsh: Arithmetic In Guile. (line 37)
  46053. * value-max: Arithmetic In Guile. (line 43)
  46054. * value-min: Arithmetic In Guile. (line 41)
  46055. * value-mod: Arithmetic In Guile. (line 25)
  46056. * value-mul: Arithmetic In Guile. (line 19)
  46057. * value-neg: Arithmetic In Guile. (line 31)
  46058. * value-not: Arithmetic In Guile. (line 29)
  46059. * value-optimized-out?: Values From Inferior In Guile.
  46060. (line 102)
  46061. * value-pos: Arithmetic In Guile. (line 33)
  46062. * value-pow: Arithmetic In Guile. (line 27)
  46063. * value-print: Values From Inferior In Guile.
  46064. (line 342)
  46065. * value-referenced-value: Values From Inferior In Guile.
  46066. (line 196)
  46067. * value-reinterpret-cast: Values From Inferior In Guile.
  46068. (line 139)
  46069. * value-rem: Arithmetic In Guile. (line 23)
  46070. * value-rsh: Arithmetic In Guile. (line 39)
  46071. * value-sub: Arithmetic In Guile. (line 17)
  46072. * value-subscript: Values From Inferior In Guile.
  46073. (line 224)
  46074. * value-type: Values From Inferior In Guile.
  46075. (line 110)
  46076. * Value.address: Values From Inferior.
  46077. (line 65)
  46078. * Value.cast: Values From Inferior.
  46079. (line 148)
  46080. * Value.const_value: Values From Inferior.
  46081. (line 236)
  46082. * Value.dereference: Values From Inferior.
  46083. (line 154)
  46084. * Value.dynamic_cast: Values From Inferior.
  46085. (line 240)
  46086. * Value.dynamic_type: Values From Inferior.
  46087. (line 79)
  46088. * Value.fetch_lazy: Values From Inferior.
  46089. (line 386)
  46090. * Value.format_string: Values From Inferior.
  46091. (line 248)
  46092. * Value.is_lazy: Values From Inferior.
  46093. (line 94)
  46094. * Value.is_optimized_out: Values From Inferior.
  46095. (line 70)
  46096. * Value.lazy_string: Values From Inferior.
  46097. (line 364)
  46098. * Value.referenced_value: Values From Inferior.
  46099. (line 207)
  46100. * Value.reference_value: Values From Inferior.
  46101. (line 232)
  46102. * Value.reinterpret_cast: Values From Inferior.
  46103. (line 244)
  46104. * Value.string: Values From Inferior.
  46105. (line 332)
  46106. * Value.type: Values From Inferior.
  46107. (line 75)
  46108. * Value.__init__: Values From Inferior.
  46109. (line 107)
  46110. * Value.__init__ <1>: Values From Inferior.
  46111. (line 141)
  46112. * value<=?: Arithmetic In Guile. (line 57)
  46113. * value<?: Arithmetic In Guile. (line 55)
  46114. * value=?: Arithmetic In Guile. (line 53)
  46115. * value>=?: Arithmetic In Guile. (line 61)
  46116. * value>?: Arithmetic In Guile. (line 59)
  46117. * value?: Values From Inferior In Guile.
  46118. (line 41)
  46119. * vi-cmd-mode-string: Readline Init File Syntax.
  46120. (line 307)
  46121. * vi-editing-mode (M-C-j): Miscellaneous Commands.
  46122. (line 92)
  46123. * vi-ins-mode-string: Readline Init File Syntax.
  46124. (line 318)
  46125. * visible-stats: Readline Init File Syntax.
  46126. (line 329)
  46127. * w (SingleKey TUI key): TUI Single Key Mode. (line 43)
  46128. * w (with): Command Settings. (line 39)
  46129. * watch: Set Watchpoints. (line 42)
  46130. * watchpoint annotation: Annotations for Running.
  46131. (line 50)
  46132. * whatis: Symbols. (line 125)
  46133. * where: Backtrace. (line 94)
  46134. * while: Command Files. (line 85)
  46135. * while-stepping (tracepoints): Tracepoint Actions. (line 126)
  46136. * Window.close: TUI Windows In Python.
  46137. (line 62)
  46138. * Window.hscroll: TUI Windows In Python.
  46139. (line 81)
  46140. * Window.render: TUI Windows In Python.
  46141. (line 71)
  46142. * Window.vscroll: TUI Windows In Python.
  46143. (line 88)
  46144. * winheight: TUI Commands. (line 158)
  46145. * with command: Command Settings. (line 39)
  46146. * WP_ACCESS: Breakpoints In Python.
  46147. (line 86)
  46148. * WP_ACCESS <1>: Breakpoints In Guile.
  46149. (line 84)
  46150. * WP_READ: Breakpoints In Python.
  46151. (line 80)
  46152. * WP_READ <1>: Breakpoints In Guile.
  46153. (line 78)
  46154. * WP_WRITE: Breakpoints In Python.
  46155. (line 83)
  46156. * WP_WRITE <1>: Breakpoints In Guile.
  46157. (line 81)
  46158. * x (examine memory): Memory. (line 9)
  46159. * x(examine), and info line: Machine Code. (line 34)
  46160. * XMethod.__init__: Xmethod API. (line 38)
  46161. * XMethodMatcher.match: Xmethod API. (line 47)
  46162. * XMethodMatcher.__init__: Xmethod API. (line 43)
  46163. * XMethodWorker.get_arg_types: Xmethod API. (line 60)
  46164. * XMethodWorker.get_result_type: Xmethod API. (line 67)
  46165. * XMethodWorker.__call__: Xmethod API. (line 73)
  46166. * yank (C-y): Commands For Killing.
  46167. (line 59)
  46168. * yank-last-arg (M-. or M-_): Commands For History.
  46169. (line 79)
  46170. * yank-nth-arg (M-C-y): Commands For History.
  46171. (line 70)
  46172. * yank-pop (M-y): Commands For Killing.
  46173. (line 62)
  46174. 
  46175. Tag Table:
  46176. Node: Top1757
  46177. Node: Summary5244
  46178. Node: Free Software7105
  46179. Node: Free Documentation7845
  46180. Node: Contributors12779
  46181. Node: Sample Session21810
  46182. Node: Invocation28663
  46183. Node: Invoking GDB29206
  46184. Node: File Options31548
  46185. Ref: --readnever34619
  46186. Node: Mode Options35093
  46187. Ref: -nx35320
  46188. Ref: -nh37077
  46189. Node: Startup43401
  46190. Ref: Home Directory Init File44247
  46191. Ref: Option -init-eval-command44357
  46192. Ref: Init File in the Current Directory during Startup44697
  46193. Ref: Startup-Footnote-146893
  46194. Node: Quitting GDB47002
  46195. Node: Shell Commands47899
  46196. Ref: pipe48891
  46197. Node: Logging Output50405
  46198. Node: Commands51531
  46199. Node: Command Syntax52396
  46200. Node: Command Settings54568
  46201. Node: Completion57581
  46202. Ref: Completion-Footnote-164521
  46203. Node: Command Options64681
  46204. Node: Command aliases default args67057
  46205. Ref: Command aliases default args-Footnote-170510
  46206. Node: Help70664
  46207. Node: Running77738
  46208. Node: Compilation78991
  46209. Node: Starting81070
  46210. Ref: set exec-wrapper86860
  46211. Ref: set startup-with-shell87949
  46212. Ref: set auto-connect-native-target89010
  46213. Node: Arguments93481
  46214. Node: Environment94750
  46215. Ref: set environment96632
  46216. Ref: unset environment97814
  46217. Node: Working Directory98820
  46218. Ref: set cwd command99392
  46219. Ref: cd command100332
  46220. Node: Input/Output101026
  46221. Node: Attach103086
  46222. Ref: set exec-file-mismatch104303
  46223. Node: Kill Process106439
  46224. Node: Inferiors Connections and Programs107432
  46225. Node: Threads117254
  46226. Ref: thread numbers119377
  46227. Ref: thread ID lists120267
  46228. Ref: global thread numbers121307
  46229. Ref: thread apply all125163
  46230. Ref: set libthread-db-search-path130013
  46231. Node: Forks132067
  46232. Node: Checkpoint/Restart138633
  46233. Ref: Checkpoint/Restart-Footnote-1143161
  46234. Node: Stopping143196
  46235. Node: Breakpoints144459
  46236. Node: Set Breaks147716
  46237. Node: Set Watchpoints166675
  46238. Node: Set Catchpoints176057
  46239. Ref: catch syscall181555
  46240. Node: Delete Breaks189320
  46241. Node: Disabling191256
  46242. Node: Conditions194636
  46243. Node: Break Commands200283
  46244. Node: Dynamic Printf203503
  46245. Node: Save Breakpoints207807
  46246. Node: Static Probe Points208982
  46247. Ref: Static Probe Points-Footnote-1213160
  46248. Ref: Static Probe Points-Footnote-2213320
  46249. Node: Error in Breakpoints213460
  46250. Node: Breakpoint-related Warnings214196
  46251. Node: Continuing and Stepping216523
  46252. Ref: range stepping226303
  46253. Node: Skipping Over Functions and Files227383
  46254. Node: Signals233232
  46255. Ref: stepping and signal handlers237666
  46256. Ref: stepping into signal handlers238462
  46257. Ref: extra signal information239695
  46258. Node: Thread Stops242161
  46259. Node: All-Stop Mode243260
  46260. Node: Non-Stop Mode247227
  46261. Node: Background Execution250640
  46262. Node: Thread-Specific Breakpoints252856
  46263. Node: Interrupted System Calls254872
  46264. Node: Observer Mode256386
  46265. Node: Reverse Execution259822
  46266. Ref: Reverse Execution-Footnote-1264740
  46267. Ref: Reverse Execution-Footnote-2265367
  46268. Node: Process Record and Replay265417
  46269. Node: Stack286806
  46270. Node: Frames288423
  46271. Node: Backtrace290761
  46272. Ref: backtrace-command291098
  46273. Ref: set backtrace past-main297545
  46274. Ref: set backtrace past-entry297873
  46275. Ref: set backtrace limit298440
  46276. Ref: Backtrace-Footnote-1299064
  46277. Node: Selection299252
  46278. Node: Frame Info304035
  46279. Node: Frame Apply308457
  46280. Node: Frame Filter Management312887
  46281. Ref: disable frame-filter all313415
  46282. Node: Source317723
  46283. Node: List318789
  46284. Node: Specify Location321491
  46285. Node: Linespec Locations322112
  46286. Node: Explicit Locations325511
  46287. Node: Address Locations328723
  46288. Node: Edit330474
  46289. Ref: Edit-Footnote-1331950
  46290. Node: Search332185
  46291. Node: Source Path332993
  46292. Ref: set substitute-path341934
  46293. Node: Machine Code344154
  46294. Node: Data354498
  46295. Ref: print options355337
  46296. Node: Expressions365338
  46297. Node: Ambiguous Expressions367441
  46298. Node: Variables370671
  46299. Node: Arrays377269
  46300. Node: Output Formats379800
  46301. Ref: Output Formats-Footnote-1383173
  46302. Node: Memory383330
  46303. Ref: addressable memory unit389515
  46304. Node: Auto Display391009
  46305. Node: Print Settings395551
  46306. Ref: set print address395849
  46307. Ref: set print symbol399511
  46308. Ref: set print array399999
  46309. Ref: set print array-indexes400327
  46310. Ref: set print elements400813
  46311. Ref: set print frame-arguments401478
  46312. Ref: set print raw-frame-arguments403647
  46313. Ref: set print entry-values404063
  46314. Ref: set print frame-info408442
  46315. Ref: set print repeats410108
  46316. Ref: set print max-depth410750
  46317. Ref: set print null-stop412442
  46318. Ref: set print pretty412766
  46319. Ref: set print raw-values413353
  46320. Ref: set print union414370
  46321. Ref: set print object416676
  46322. Ref: set print static-members417470
  46323. Ref: set print vtbl418147
  46324. Node: Pretty Printing418531
  46325. Node: Pretty-Printer Introduction419045
  46326. Node: Pretty-Printer Example420800
  46327. Node: Pretty-Printer Commands421578
  46328. Node: Value History424509
  46329. Node: Convenience Vars426931
  46330. Node: Convenience Funs434602
  46331. Node: Registers443117
  46332. Ref: info_registers_reggroup443774
  46333. Ref: standard registers444325
  46334. Ref: Registers-Footnote-1449276
  46335. Node: Floating Point Hardware449671
  46336. Node: Vector Unit450203
  46337. Node: OS Information450590
  46338. Ref: linux info os infotypes452614
  46339. Node: Memory Region Attributes457205
  46340. Node: Dump/Restore Files461869
  46341. Node: Core File Generation464272
  46342. Ref: set use-coredump-filter465832
  46343. Ref: set dump-excluded-mappings467280
  46344. Node: Character Sets467562
  46345. Node: Caching Target Data473927
  46346. Ref: Caching Target Data-Footnote-1476667
  46347. Node: Searching Memory476905
  46348. Node: Value Sizes480048
  46349. Node: Optimized Code481700
  46350. Node: Inline Functions483377
  46351. Node: Tail Call Frames486004
  46352. Ref: set debug entry-values488141
  46353. Node: Macros492205
  46354. Ref: Macros-Footnote-1499781
  46355. Node: Tracepoints499934
  46356. Node: Set Tracepoints501996
  46357. Node: Create and Delete Tracepoints504934
  46358. Node: Enable and Disable Tracepoints511282
  46359. Node: Tracepoint Passcounts512522
  46360. Node: Tracepoint Conditions513933
  46361. Node: Trace State Variables515627
  46362. Node: Tracepoint Actions517822
  46363. Node: Listing Tracepoints524605
  46364. Node: Listing Static Tracepoint Markers526307
  46365. Node: Starting and Stopping Trace Experiments528155
  46366. Ref: disconnected tracing529900
  46367. Node: Tracepoint Restrictions534320
  46368. Node: Analyze Collected Data538089
  46369. Node: tfind539395
  46370. Node: tdump543877
  46371. Node: save tracepoints546392
  46372. Node: Tracepoint Variables546888
  46373. Node: Trace Files548016
  46374. Node: Overlays550392
  46375. Node: How Overlays Work551112
  46376. Ref: A code overlay553647
  46377. Node: Overlay Commands557080
  46378. Node: Automatic Overlay Debugging561262
  46379. Node: Overlay Sample Program563401
  46380. Node: Languages565138
  46381. Node: Setting566301
  46382. Node: Filenames568002
  46383. Node: Manually568813
  46384. Node: Automatically570022
  46385. Node: Show571083
  46386. Ref: show language571371
  46387. Node: Checks572405
  46388. Node: Type Checking573410
  46389. Node: Range Checking575239
  46390. Node: Supported Languages577640
  46391. Node: C578977
  46392. Node: C Operators579941
  46393. Node: C Constants584280
  46394. Node: C Plus Plus Expressions587159
  46395. Node: C Defaults590519
  46396. Node: C Checks591187
  46397. Node: Debugging C591747
  46398. Node: Debugging C Plus Plus592231
  46399. Node: Decimal Floating Point597118
  46400. Node: D598388
  46401. Node: Go598646
  46402. Node: Objective-C599740
  46403. Node: Method Names in Commands600203
  46404. Node: The Print Command with Objective-C601894
  46405. Node: OpenCL C602545
  46406. Node: OpenCL C Datatypes602820
  46407. Node: OpenCL C Expressions603195
  46408. Node: OpenCL C Operators603552
  46409. Node: Fortran603784
  46410. Node: Fortran Operators604505
  46411. Node: Fortran Defaults605550
  46412. Node: Special Fortran Commands605935
  46413. Node: Pascal606441
  46414. Node: Rust606952
  46415. Node: Modula-2610039
  46416. Node: M2 Operators611012
  46417. Node: Built-In Func/Proc614010
  46418. Node: M2 Constants616924
  46419. Node: M2 Types618525
  46420. Node: M2 Defaults621743
  46421. Node: Deviations622344
  46422. Node: M2 Checks623445
  46423. Node: M2 Scope624262
  46424. Node: GDB/M2625286
  46425. Node: Ada626199
  46426. Node: Ada Mode Intro627505
  46427. Node: Omissions from Ada629007
  46428. Node: Additions to Ada633362
  46429. Node: Overloading support for Ada637290
  46430. Node: Stopping Before Main Program638930
  46431. Node: Ada Exceptions639477
  46432. Node: Ada Tasks640676
  46433. Node: Ada Tasks and Core Files647167
  46434. Node: Ravenscar Profile648014
  46435. Node: Ada Settings650185
  46436. Node: Ada Glitches651607
  46437. Node: Unsupported Languages655615
  46438. Node: Symbols656305
  46439. Ref: quoting names656908
  46440. Node: Altering687823
  46441. Node: Assignment688861
  46442. Node: Jumping691967
  46443. Node: Signaling694041
  46444. Node: Returning696970
  46445. Node: Calling700321
  46446. Node: Patching705806
  46447. Node: Compiling and Injecting Code706920
  46448. Ref: set debug compile710547
  46449. Ref: set debug compile-cplus-types710797
  46450. Node: GDB Files720818
  46451. Node: Files721607
  46452. Ref: Shared Libraries735319
  46453. Ref: Files-Footnote-1747512
  46454. Node: File Caching747641
  46455. Node: Separate Debug Files748775
  46456. Ref: build ID750016
  46457. Ref: debug-file-directory752128
  46458. Node: MiniDebugInfo760743
  46459. Node: Index Files763194
  46460. Node: Symbol Errors767257
  46461. Node: Data Files770873
  46462. Node: Targets771829
  46463. Node: Active Targets773309
  46464. Node: Target Commands774383
  46465. Ref: load778772
  46466. Ref: flash-erase779965
  46467. Node: Byte Order780025
  46468. Node: Remote Debugging781464
  46469. Node: Connecting782726
  46470. Ref: --multi Option in Types of Remote Connnections784952
  46471. Ref: Attaching in Types of Remote Connections786367
  46472. Ref: Host and target files787247
  46473. Node: File Transfer795869
  46474. Node: Server796808
  46475. Ref: Running gdbserver798384
  46476. Ref: Attaching to a program800602
  46477. Ref: Other Command-Line Arguments for gdbserver803127
  46478. Ref: Monitor Commands for gdbserver806446
  46479. Ref: Server-Footnote-1811822
  46480. Node: Remote Configuration811942
  46481. Ref: set remotebreak813202
  46482. Ref: set remote hardware-watchpoint-limit814664
  46483. Ref: set remote hardware-breakpoint-limit814664
  46484. Ref: set remote hardware-watchpoint-length-limit815166
  46485. Ref: set remote exec-file815621
  46486. Node: Remote Stub827426
  46487. Node: Stub Contents830321
  46488. Node: Bootstrapping832428
  46489. Node: Debug Session836243
  46490. Node: Configurations838284
  46491. Node: Native839053
  46492. Node: BSD libkvm Interface839622
  46493. Node: Process Information840674
  46494. Node: DJGPP Native846298
  46495. Node: Cygwin Native852852
  46496. Node: Non-debug DLL Symbols857773
  46497. Node: Hurd Native862012
  46498. Node: Darwin867268
  46499. Node: FreeBSD868545
  46500. Node: Embedded OS869265
  46501. Node: Embedded Processors869676
  46502. Node: ARC870703
  46503. Node: ARM871250
  46504. Node: BPF873796
  46505. Node: M68K874276
  46506. Node: MicroBlaze874449
  46507. Node: MIPS Embedded875898
  46508. Node: OpenRISC 1000877195
  46509. Node: PowerPC Embedded878101
  46510. Node: AVR881330
  46511. Node: CRIS881702
  46512. Node: Super-H882680
  46513. Node: Architectures883739
  46514. Node: AArch64884135
  46515. Node: i386885708
  46516. Ref: i386-Footnote-1889918
  46517. Node: Alpha890004
  46518. Node: MIPS890137
  46519. Node: HPPA894031
  46520. Node: PowerPC894553
  46521. Node: Nios II895289
  46522. Node: Sparc64895694
  46523. Node: S12Z898062
  46524. Node: Controlling GDB898355
  46525. Node: Prompt899298
  46526. Node: Editing901016
  46527. Node: Command History902326
  46528. Node: Screen Size907520
  46529. Node: Output Styling909536
  46530. Node: Numbers913619
  46531. Node: ABI915601
  46532. Node: Auto-loading918774
  46533. Ref: set auto-load off920149
  46534. Ref: show auto-load920785
  46535. Ref: info auto-load921564
  46536. Node: Init File in the Current Directory924531
  46537. Ref: set auto-load local-gdbinit925106
  46538. Ref: show auto-load local-gdbinit925288
  46539. Ref: info auto-load local-gdbinit925452
  46540. Node: libthread_db.so.1 file925600
  46541. Ref: set auto-load libthread-db926539
  46542. Ref: show auto-load libthread-db926670
  46543. Ref: info auto-load libthread-db926807
  46544. Node: Auto-loading safe path926991
  46545. Ref: set auto-load safe-path928292
  46546. Ref: show auto-load safe-path929031
  46547. Ref: add-auto-load-safe-path929154
  46548. Node: Auto-loading verbose mode932056
  46549. Ref: set debug auto-load933219
  46550. Ref: show debug auto-load933320
  46551. Node: Messages/Warnings933442
  46552. Ref: confirmation requests934876
  46553. Node: Debugging Output936080
  46554. Node: Other Misc Settings946497
  46555. Node: Extending GDB947521
  46556. Node: Sequences949374
  46557. Node: Define950035
  46558. Node: Hooks955520
  46559. Node: Command Files957886
  46560. Node: Output962959
  46561. Ref: eval967761
  46562. Node: Auto-loading sequences967923
  46563. Ref: set auto-load gdb-scripts968418
  46564. Ref: show auto-load gdb-scripts968542
  46565. Ref: info auto-load gdb-scripts968672
  46566. Node: Python968903
  46567. Node: Python Commands970189
  46568. Node: Python API972303
  46569. Node: Basic Python975038
  46570. Ref: prompt_hook986075
  46571. Node: Exception Handling986673
  46572. Node: Values From Inferior989575
  46573. Node: Types In Python1006911
  46574. Node: Pretty Printing API1018141
  46575. Node: Selecting Pretty-Printers1022584
  46576. Node: Writing a Pretty-Printer1025311
  46577. Node: Type Printing API1030633
  46578. Node: Frame Filter API1033249
  46579. Node: Frame Decorator API1040561
  46580. Ref: frame_args1044302
  46581. Node: Writing a Frame Filter1047632
  46582. Node: Unwinding Frames in Python1059106
  46583. Node: Xmethods In Python1066901
  46584. Node: Xmethod API1069797
  46585. Node: Writing an Xmethod1073609
  46586. Node: Inferiors In Python1079444
  46587. Node: Events In Python1083215
  46588. Node: Threads In Python1092423
  46589. Node: Recordings In Python1095768
  46590. Node: Commands In Python1103102
  46591. Node: Parameters In Python1112693
  46592. Node: Functions In Python1119631
  46593. Node: Progspaces In Python1121848
  46594. Node: Objfiles In Python1126772
  46595. Node: Frames In Python1133429
  46596. Ref: gdbpy_frame_read_register1139646
  46597. Node: Blocks In Python1141331
  46598. Node: Symbols In Python1145998
  46599. Node: Symbol Tables In Python1155461
  46600. Node: Line Tables In Python1158682
  46601. Node: Breakpoints In Python1161519
  46602. Ref: python_breakpoint_thread1167842
  46603. Node: Finish Breakpoints in Python1170875
  46604. Node: Lazy Strings In Python1172981
  46605. Node: Architectures In Python1175209
  46606. Ref: gdbpy_architecture_registers1177426
  46607. Ref: gdbpy_architecture_reggroups1177747
  46608. Node: Registers In Python1177946
  46609. Node: TUI Windows In Python1180216
  46610. Node: Python Auto-loading1184443
  46611. Ref: set auto-load python-scripts1185072
  46612. Ref: show auto-load python-scripts1185172
  46613. Ref: info auto-load python-scripts1185278
  46614. Node: Python modules1186412
  46615. Node: gdb.printing1186798
  46616. Node: gdb.types1188225
  46617. Node: gdb.prompt1191237
  46618. Node: Guile1192833
  46619. Node: Guile Introduction1193492
  46620. Node: Guile Commands1194330
  46621. Node: Guile API1196184
  46622. Node: Basic Guile1198181
  46623. Node: Guile Configuration1203863
  46624. Node: GDB Scheme Data Types1204839
  46625. Node: Guile Exception Handling1206671
  46626. Node: Values From Inferior In Guile1210705
  46627. Node: Arithmetic In Guile1226241
  46628. Node: Types In Guile1227872
  46629. Ref: Fields of a type in Guile1235813
  46630. Node: Guile Pretty Printing API1237201
  46631. Node: Selecting Guile Pretty-Printers1242930
  46632. Node: Writing a Guile Pretty-Printer1245306
  46633. Node: Commands In Guile1250491
  46634. Node: Parameters In Guile1261271
  46635. Ref: Parameters In Guile-Footnote-11268152
  46636. Node: Progspaces In Guile1268268
  46637. Node: Objfiles In Guile1270880
  46638. Node: Frames In Guile1273161
  46639. Node: Blocks In Guile1279739
  46640. Node: Symbols In Guile1284547
  46641. Node: Symbol Tables In Guile1291882
  46642. Node: Breakpoints In Guile1294845
  46643. Node: Lazy Strings In Guile1305106
  46644. Node: Architectures In Guile1307397
  46645. Node: Disassembly In Guile1311704
  46646. Node: I/O Ports in Guile1314906
  46647. Node: Memory Ports in Guile1315462
  46648. Node: Iterators In Guile1319313
  46649. Node: Guile Auto-loading1323602
  46650. Ref: set auto-load guile-scripts1324225
  46651. Ref: show auto-load guile-scripts1324323
  46652. Ref: info auto-load guile-scripts1324427
  46653. Node: Guile Modules1325386
  46654. Node: Guile Printing Module1325708
  46655. Node: Guile Types Module1326527
  46656. Node: Auto-loading extensions1327820
  46657. Node: objfile-gdbdotext file1329018
  46658. Ref: set auto-load scripts-directory1330688
  46659. Ref: with-auto-load-dir1331064
  46660. Ref: show auto-load scripts-directory1331882
  46661. Ref: add-auto-load-scripts-directory1331962
  46662. Node: dotdebug_gdb_scripts section1332438
  46663. Node: Which flavor to choose?1336188
  46664. Node: Multiple Extension Languages1338009
  46665. Node: Aliases1339073
  46666. Node: Interpreters1342543
  46667. Node: TUI1345694
  46668. Node: TUI Overview1346692
  46669. Node: TUI Keys1349195
  46670. Node: TUI Single Key Mode1351918
  46671. Node: TUI Commands1353101
  46672. Node: TUI Configuration1358958
  46673. Node: Emacs1360980
  46674. Node: GDB/MI1366417
  46675. Node: GDB/MI General Design1369122
  46676. Node: Context management1371642
  46677. Node: Asynchronous and non-stop modes1375429
  46678. Node: Thread groups1378402
  46679. Node: GDB/MI Command Syntax1380692
  46680. Node: GDB/MI Input Syntax1380935
  46681. Node: GDB/MI Output Syntax1382485
  46682. Node: GDB/MI Compatibility with CLI1386070
  46683. Node: GDB/MI Development and Front Ends1386807
  46684. Node: GDB/MI Output Records1390322
  46685. Node: GDB/MI Result Records1390728
  46686. Node: GDB/MI Stream Records1392078
  46687. Node: GDB/MI Async Records1393343
  46688. Node: GDB/MI Breakpoint Information1403776
  46689. Node: GDB/MI Frame Information1409412
  46690. Node: GDB/MI Thread Information1410694
  46691. Node: GDB/MI Ada Exception Information1412164
  46692. Node: GDB/MI Simple Examples1412714
  46693. Node: GDB/MI Command Description Format1414950
  46694. Node: GDB/MI Breakpoint Commands1415830
  46695. Ref: -break-insert1422938
  46696. Node: GDB/MI Catchpoint Commands1436512
  46697. Node: Shared Library GDB/MI Catchpoint Commands1436925
  46698. Node: Ada Exception GDB/MI Catchpoint Commands1438583
  46699. Node: C++ Exception GDB/MI Catchpoint Commands1442133
  46700. Node: GDB/MI Program Context1446149
  46701. Node: GDB/MI Thread Commands1450417
  46702. Node: GDB/MI Ada Tasking Commands1453718
  46703. Node: GDB/MI Program Execution1455990
  46704. Node: GDB/MI Stack Manipulation1468257
  46705. Ref: -stack-list-arguments1470181
  46706. Ref: -stack-list-frames1474011
  46707. Ref: -stack-list-locals1478340
  46708. Ref: -stack-list-variables1479830
  46709. Node: GDB/MI Variable Objects1481364
  46710. Ref: -var-set-format1491330
  46711. Ref: -var-list-children1492711
  46712. Ref: -var-update1501519
  46713. Ref: -var-set-frozen1504517
  46714. Ref: -var-set-update-range1505314
  46715. Ref: -var-set-visualizer1505843
  46716. Node: GDB/MI Data Manipulation1507333
  46717. Node: GDB/MI Tracepoint Commands1527821
  46718. Node: GDB/MI Symbol Query1539612
  46719. Ref: -symbol-info-functions1539881
  46720. Ref: -symbol-info-module-functions1544394
  46721. Ref: -symbol-info-module-variables1547374
  46722. Ref: -symbol-info-modules1551091
  46723. Ref: -symbol-info-types1552995
  46724. Ref: -symbol-info-variables1554988
  46725. Node: GDB/MI File Commands1560012
  46726. Node: GDB/MI Target Manipulation1564446
  46727. Node: GDB/MI File Transfer Commands1571104
  46728. Node: GDB/MI Ada Exceptions Commands1572427
  46729. Node: GDB/MI Support Commands1573780
  46730. Node: GDB/MI Miscellaneous Commands1578499
  46731. Ref: -interpreter-exec1588863
  46732. Node: Annotations1592835
  46733. Node: Annotations Overview1593754
  46734. Node: Server Prefix1596217
  46735. Node: Prompting1596951
  46736. Node: Errors1598468
  46737. Node: Invalidation1599364
  46738. Node: Annotations for Running1599843
  46739. Node: Source Annotations1601377
  46740. Node: JIT Interface1602306
  46741. Node: Declarations1604106
  46742. Node: Registering Code1605493
  46743. Node: Unregistering Code1606465
  46744. Node: Custom Debug Info1607092
  46745. Node: Using JIT Debug Info Readers1608388
  46746. Node: Writing JIT Debug Info Readers1609400
  46747. Node: In-Process Agent1611595
  46748. Ref: Control Agent1613538
  46749. Node: In-Process Agent Protocol1614405
  46750. Node: IPA Protocol Objects1615196
  46751. Ref: agent expression object1616194
  46752. Ref: tracepoint action object1616399
  46753. Ref: tracepoint object1616479
  46754. Node: IPA Protocol Commands1619009
  46755. Node: GDB Bugs1620479
  46756. Node: Bug Criteria1621211
  46757. Node: Bug Reporting1622088
  46758. Node: Command Line Editing1629065
  46759. Node: Introduction and Notation1629717
  46760. Node: Readline Interaction1631338
  46761. Node: Readline Bare Essentials1632527
  46762. Node: Readline Movement Commands1634308
  46763. Node: Readline Killing Commands1635266
  46764. Node: Readline Arguments1637182
  46765. Node: Searching1638224
  46766. Node: Readline Init File1640374
  46767. Node: Readline Init File Syntax1641525
  46768. Node: Conditional Init Constructs1661681
  46769. Node: Sample Init File1665875
  46770. Node: Bindable Readline Commands1668990
  46771. Node: Commands For Moving1670042
  46772. Node: Commands For History1671606
  46773. Node: Commands For Text1675868
  46774. Node: Commands For Killing1679307
  46775. Node: Numeric Arguments1681471
  46776. Node: Commands For Completion1682608
  46777. Node: Keyboard Macros1684574
  46778. Node: Miscellaneous Commands1685259
  46779. Node: Readline vi Mode1689178
  46780. Node: Using History Interactively1690088
  46781. Node: History Interaction1690603
  46782. Node: Event Designators1692499
  46783. Node: Word Designators1693636
  46784. Node: Modifiers1695271
  46785. Node: In Memoriam1696492
  46786. Node: Formatting Documentation1697375
  46787. Ref: Formatting Documentation-Footnote-11700755
  46788. Node: Installing GDB1700853
  46789. Node: Requirements1701425
  46790. Ref: Expat1702126
  46791. Ref: MPFR1705419
  46792. Node: Running Configure1707040
  46793. Node: Separate Objdir1709922
  46794. Node: Config Names1712902
  46795. Node: Configure Options1714381
  46796. Node: System-wide configuration1724203
  46797. Node: System-wide Configuration Scripts1726740
  46798. Node: Maintenance Commands1727924
  46799. Ref: maint info breakpoints1729579
  46800. Ref: maint check libthread-db1738464
  46801. Node: Remote Protocol1755382
  46802. Node: Overview1756074
  46803. Ref: Binary Data1758619
  46804. Node: Packets1761275
  46805. Ref: thread-id syntax1762175
  46806. Ref: extended mode1763620
  46807. Ref: ? packet1763878
  46808. Ref: bc1765344
  46809. Ref: bs1765554
  46810. Ref: read registers packet1767171
  46811. Ref: cycle step packet1769026
  46812. Ref: write register packet1771737
  46813. Ref: step with signal packet1772716
  46814. Ref: vCont packet1774192
  46815. Ref: vCtrlC packet1777426
  46816. Ref: vKill packet1779844
  46817. Ref: X packet1781378
  46818. Ref: insert breakpoint or watchpoint packet1781747
  46819. Node: Stop Reply Packets1786073
  46820. Ref: swbreak stop reason1789324
  46821. Ref: thread create event1792921
  46822. Ref: thread exit event1794124
  46823. Node: General Query Packets1796333
  46824. Ref: qCRC packet1799163
  46825. Ref: QEnvironmentHexEncoded1802316
  46826. Ref: QEnvironmentUnset1803546
  46827. Ref: QEnvironmentReset1804490
  46828. Ref: QSetWorkingDir packet1805434
  46829. Ref: QNonStop1811885
  46830. Ref: QCatchSyscalls1812561
  46831. Ref: QPassSignals1814098
  46832. Ref: QProgramSignals1815305
  46833. Ref: QThreadEvents1816872
  46834. Ref: qSearch memory1818890
  46835. Ref: QStartNoAckMode1819398
  46836. Ref: qSupported1819930
  46837. Ref: multiprocess extensions1835450
  46838. Ref: install tracepoint in tracing1837480
  46839. Ref: qXfer read1842003
  46840. Ref: qXfer auxiliary vector read1843610
  46841. Ref: qXfer btrace read1843958
  46842. Ref: qXfer btrace-conf read1845023
  46843. Ref: qXfer executable filename read1845374
  46844. Ref: qXfer target description read1845989
  46845. Ref: qXfer library list read1846423
  46846. Ref: qXfer svr4 library list read1847079
  46847. Ref: qXfer memory map read1848932
  46848. Ref: qXfer sdata read1849319
  46849. Ref: qXfer siginfo read1849785
  46850. Ref: qXfer threads read1850181
  46851. Ref: qXfer traceframe info read1850584
  46852. Ref: qXfer unwind info block1851002
  46853. Ref: qXfer fdpic loadmap read1851236
  46854. Ref: qXfer osdata read1851652
  46855. Ref: qXfer write1851806
  46856. Ref: qXfer siginfo write1852898
  46857. Ref: General Query Packets-Footnote-11855626
  46858. Node: Architecture-Specific Protocol Details1855953
  46859. Node: ARM-Specific Protocol Details1856462
  46860. Node: ARM Breakpoint Kinds1856710
  46861. Node: MIPS-Specific Protocol Details1857041
  46862. Node: MIPS Register packet Format1857324
  46863. Node: MIPS Breakpoint Kinds1858251
  46864. Node: Tracepoint Packets1858669
  46865. Ref: QTEnable1867983
  46866. Ref: QTDisable1868179
  46867. Ref: qTfSTM1873716
  46868. Ref: qTsSTM1873716
  46869. Ref: qTSTMat1874793
  46870. Ref: QTBuffer-size1875944
  46871. Node: Host I/O Packets1877917
  46872. Node: Interrupts1883498
  46873. Ref: interrupting remote targets1883642
  46874. Node: Notification Packets1885810
  46875. Node: Remote Non-Stop1891235
  46876. Node: Packet Acknowledgment1894351
  46877. Node: Examples1896466
  46878. Node: File-I/O Remote Protocol Extension1897060
  46879. Node: File-I/O Overview1897522
  46880. Node: Protocol Basics1899721
  46881. Node: The F Request Packet1901950
  46882. Node: The F Reply Packet1902851
  46883. Node: The Ctrl-C Message1903769
  46884. Node: Console I/O1905395
  46885. Node: List of Supported Calls1906611
  46886. Node: open1906973
  46887. Node: close1909481
  46888. Node: read1909864
  46889. Node: write1910473
  46890. Node: lseek1911244
  46891. Node: rename1912128
  46892. Node: unlink1913535
  46893. Node: stat/fstat1914482
  46894. Node: gettimeofday1915375
  46895. Node: isatty1915811
  46896. Node: system1916407
  46897. Node: Protocol-specific Representation of Datatypes1917949
  46898. Node: Integral Datatypes1918326
  46899. Node: Pointer Values1919133
  46900. Node: Memory Transfer1919837
  46901. Node: struct stat1920457
  46902. Node: struct timeval1922659
  46903. Node: Constants1923176
  46904. Node: Open Flags1923625
  46905. Node: mode_t Values1923966
  46906. Node: Errno Values1924458
  46907. Node: Lseek Flags1925268
  46908. Node: Limits1925453
  46909. Node: File-I/O Examples1925813
  46910. Node: Library List Format1926901
  46911. Node: Library List Format for SVR4 Targets1929683
  46912. Node: Memory Map Format1932150
  46913. Node: Thread List Format1934674
  46914. Node: Traceframe Info Format1935678
  46915. Node: Branch Trace Format1937364
  46916. Node: Branch Trace Configuration Format1939064
  46917. Node: Agent Expressions1940238
  46918. Node: General Bytecode Design1943059
  46919. Node: Bytecode Descriptions1947853
  46920. Node: Using Agent Expressions1961320
  46921. Node: Varying Target Capabilities1963297
  46922. Node: Rationale1964458
  46923. Node: Target Descriptions1971847
  46924. Node: Retrieving Descriptions1973790
  46925. Node: Target Description Format1974875
  46926. Node: Predefined Target Types1984750
  46927. Node: Enum Target Types1986195
  46928. Node: Standard Target Features1987190
  46929. Node: AArch64 Features1989190
  46930. Node: ARC Features1989896
  46931. Ref: ARC Features-Footnote-11991715
  46932. Node: ARM Features1991748
  46933. Node: i386 Features1993262
  46934. Node: MicroBlaze Features1995477
  46935. Node: MIPS Features1996054
  46936. Node: M68K Features1997245
  46937. Node: NDS32 Features1998232
  46938. Node: Nios II Features1999256
  46939. Node: OpenRISC 1000 Features1999661
  46940. Node: PowerPC Features2000027
  46941. Node: RISC-V Features2003997
  46942. Node: RX Features2005687
  46943. Node: S/390 and System z Features2006049
  46944. Node: Sparc Features2008189
  46945. Node: TIC6x Features2009094
  46946. Node: Operating System Information2009643
  46947. Node: Process list2010479
  46948. Node: Trace File Format2011542
  46949. Node: Index Section Format2014756
  46950. Node: Man Pages2022682
  46951. Node: gdb man2023152
  46952. Node: gdbserver man2029126
  46953. Node: gcore man2036535
  46954. Node: gdbinit man2037657
  46955. Node: gdb-add-index man2039020
  46956. Ref: gdb-add-index2039129
  46957. Node: Copying2040003
  46958. Node: GNU Free Documentation License2077564
  46959. Node: Concept Index2102711
  46960. Node: Command and Variable Index2244493
  46961. 
  46962. End Tag Table